Compare commits
2 Commits
main
...
srfi13and1
Author | SHA1 | Date |
---|---|---|
![]() |
838b110f01 | |
![]() |
e5a2148d4a |
|
@ -26,3 +26,15 @@ _$*
|
|||
*.ln
|
||||
core
|
||||
# CVS default ignores end
|
||||
Makefile
|
||||
config.log
|
||||
config.cache
|
||||
config.status
|
||||
sysdep.h
|
||||
script
|
||||
scsh.1
|
||||
scheme48.image
|
||||
scshvm
|
||||
.,*
|
||||
*.aux
|
||||
*.log
|
||||
|
|
37
COPYING
37
COPYING
|
@ -1,19 +1,28 @@
|
|||
Copyright (c) 1993, 1994 by Richard Kelsey and Jonathan Rees.
|
||||
Copyright (c) 1994, 1995 by Olin Shivers and Brian D. Carlstrom.
|
||||
|
||||
Use of this program for non-commercial purposes is permitted provided
|
||||
that such use is acknowledged both in the software itself and in
|
||||
accompanying documentation.
|
||||
|
||||
Use of this program for commercial purposes is also permitted, but
|
||||
only if, in addition to the acknowledgement required for
|
||||
non-commercial users, written notification of such use is provided by
|
||||
the commercial user to the authors prior to the fabrication and
|
||||
distribution of the resulting software.
|
||||
|
||||
This software is provided ``as is'' without express or implied warranty.
|
||||
Copyright (c) 1993-1999 Richard Kelsey and Jonathan Rees
|
||||
Copyright (c) 1994-1999 by Olin Shivers and Brian D. Carlstrom.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. The name of the authors may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Distributing Autoconf Output
|
||||
****************************
|
||||
|
|
21
Changes
21
Changes
|
@ -1,3 +1,24 @@
|
|||
AWK & field-parser/record-reader routines shifted over to SREs.
|
||||
|
||||
SRE regexp system installed.
|
||||
|
||||
BEGIN process forms are now wrapped in a stdio->stdports call, so the
|
||||
body sees the I/O environment established by the pf's EPF.
|
||||
|
||||
New char-sets and predicates:
|
||||
printing blank control punctuation hex-digit ascii empty full
|
||||
This gives full coverage of the Posix character classes
|
||||
New char-set operations.
|
||||
Space removed from char-set:graphic -- this was a bug wrt Posix definitions.
|
||||
char-set-union and char-set-intersection now n-ary
|
||||
|
||||
Fixed bug with interrupt system that prevented sigalrm from being
|
||||
caught by scsh programs.
|
||||
Mike Sperber & Kevin Esler
|
||||
|
||||
Dmitrii Pasechnik <D.Pasechnik@twi.tudelft.nl>
|
||||
bug in delete code
|
||||
|
||||
reduce -> foldl (reduce-port, reduce-char-set)
|
||||
|
||||
FILE-MATCH still treats strings as Posix regexps; now accepts regexp args, too.
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
Documentation error in STRING-OUTPUT-PORT-OUTPUT.
|
||||
Reported 12/19 by Michel.Schinz@studi.epfl.ch
|
||||
|
||||
|
||||
character-gobbling in (record-reader) caused by 'trim / 'peek
|
||||
default misunderstanding in delimited readers. Fixed 4/5/96
|
||||
Reported by Victor Zandy
|
||||
|
||||
reap-policy = early can still lose if you loop and fork.
|
||||
fork now reaps & retries if it loses and the policy is early reap.
|
||||
This is a kludge until I have sigchld handlers.
|
||||
Fixed 4/5/96; reported by Michael Becker.
|
||||
|
||||
CHAR-SET-CONTAINS? now works for non-ASCII chars.
|
||||
|
||||
SKIP-CHAR-SET now exported and documented. 4/5/96
|
||||
|
||||
Tod Olson <ta-olson@uchicago.edu> complained about the I/O performance
|
||||
of the delimited reader routines (the supposedly fast ones, with
|
||||
C support). Reported 11/95, improved 4/96.
|
||||
Things generally improved all over by improving the efficiency
|
||||
of optional argument handling (but especially I/O, I think).
|
||||
|
||||
I changed the meta-arg parser (C, Scheme, and doc) so that newline
|
||||
*always* terminates an arg -- empty or non-empty. KISS.
|
||||
|
||||
(chdir) was cd'ing to ".", not home. Reported by dmh@tibco.COM (David Hull).
|
||||
|
||||
autoreap-policy's optional arg wasn't optional -- the dot was missing.
|
||||
Reported by rthappe@mathematik.uni-freiburg.DE (Rolf-Thomas Happe).
|
||||
|
||||
alist->env didn't work, because it was passing a list, not a vector,
|
||||
to the %INSTALL-ENV procedure. Reported by Mike Sperber 9/19/96.
|
||||
|
||||
syntactically illegal LET in rw.scm. Reported by jsc 9/23/96.
|
||||
|
||||
a semantically incorrect but benign error in syscalls.1c.
|
||||
Reported by Lewis Girod 12 Dec 95. Fixed by bdc 26 Sept 96.
|
||||
|
||||
"make clean" didn't get the .o's in scsh/machine
|
||||
Reported by Kevin Esler 2 April 96. Fixed by bdc 26 Sept 96.
|
||||
|
||||
support for Solaris 2 on i386 in configure.in
|
||||
Reported by Lutz Euler on 11 Jul 96. Fixed by bdc 26 Sept 96.
|
||||
|
||||
socket-address->unix-address returns function not address
|
||||
Reported by Sean Doran 29 Jul 96. Fixed by bdc 26 Sept 96.
|
||||
|
||||
Solaris users with BIND installed lose MAXHOSTNAMELEN
|
||||
reported by Lutz Euler 23 Aug 96. Fixed by bdc 26 Sept 96.
|
||||
|
||||
on HP-UX use dld dynamic loader for symbol lookup (faster)
|
||||
reported by Bill Sommerfeld 31 Oct 95. Fixed by bdc 27 Sept 96.
|
||||
|
||||
problem with path marshalling with the unix domain protocol
|
||||
Reported by Sean Doran 29 Jul 96. Fixed by bdc 1 Oct 96.
|
||||
|
||||
exportlist.aix generated correctly on aix 4 now
|
||||
Reported by Michael Becker 2 June 96. Fix by Michael Sperber 2 Oct 96.
|
||||
|
||||
service-info using a port number is broken for little endian machines
|
||||
Reported by Jin S. Choi 3 Oct 1996. Fixed by bdc 3 Oct 96.
|
||||
|
||||
read_fdport_substring() didn't reset the port's peek-char to #F when
|
||||
consuming it. Reported by JSC 10/16/96, with fix.
|
||||
|
||||
*** 0.4.3 Released by bdc 31 Oct 96
|
||||
|
||||
problem with solaris 2.5.1 because fileno is not a macro anymore?
|
||||
Reported by Roebert E. Brown. Fix by bdc 3 Nov 96
|
||||
|
||||
distclean should remove emacs ~ backup files not clean
|
||||
Reported by Roebert E. Brown. Fix by bdc 1 Nov 96
|
||||
|
||||
signals-ignored-by-default for nextstep
|
||||
Reported by Roebert E. Brown. Fix by bdc 1 Mov 96
|
||||
|
||||
linux on a pentium pro aka 686 not properly handled by configure
|
||||
reported by Douglas S. J. De Couto. Fix by bdc 3 Nov 96
|
||||
|
||||
problem compiling on sunos 4.1.x
|
||||
reported by Franklin Chen. Fix by bdc 3 Nov 96
|
||||
|
||||
signals-ignored-by-default for nextstep
|
||||
Reported by Mike Sperber. Fix by bdc 3 Nov 96
|
||||
|
||||
*** 0.4.4 Released by bdc 3 Nov 96
|
||||
|
||||
Makefile.in didn't contain correct scsh.vm target
|
||||
Reported by Mike Sperber. Fix by bdc 4 Nov 96
|
||||
|
||||
Makefile.in needs to rerun ranlib after installing libscshvm.a
|
||||
Reported by Robert E. Brown. Fix by bdc 4 Nov 96
|
||||
|
||||
signals-ignored-by-default for ultrix
|
||||
Reported by Jay Nietling. Fix by bdc 4 Nov 96
|
||||
|
||||
signals-ignored-by-default for irix
|
||||
Reported by Richard Kelsey. Fix by bdc 4 Nov 96
|
||||
|
||||
Starting up programs with the "-e <entry-point>" command-line
|
||||
switch and with the (DUMP-SCSH-PROGRAM <file-name> <entry-point>)
|
||||
are now equivalent in that both pass a list of command-line arguments
|
||||
that includes the program name. The two start-up methods were not
|
||||
the same in the previous release. Reported by Dan Hagerty hag@ai.mit.edu
|
||||
October 1996.
|
||||
|
||||
transcendental functions broken (sin, cos, tan, log)
|
||||
reported by jsc 8 Nov 96. Fix by ,open floatnum
|
||||
|
||||
Fixed up initial sizes for allocated filename buffers to be _POSIX_PATH_MAX.
|
||||
|
||||
Solaris lacking three netconst.scm definitions
|
||||
reported by Michel Schinz 15 Nov 96. fix by ???????????
|
||||
|
||||
Irix 6.x can't compile sighandler1.c for lack of sigbits?
|
||||
reported by Stephen Pascoe 18 Nov 96. fix by ??????????
|
||||
|
||||
host-info:addresses contains bogus info if the argument to
|
||||
host-info is a socket-address.
|
||||
reported by Michael Sperber 2 Dec 96. fix by bdc
|
||||
|
||||
signals1.c missing on most ports
|
||||
reported by Mike Gunter 10 Dec 96. fix by ??????????
|
||||
|
||||
scsh.scm
|
||||
stdio->stdports was using fdes->inport to make the current-output-port
|
||||
and the current-error-port. The manual also had this bug.
|
||||
|
||||
The manual also used (exit (run ...)) in section 9.1.7, which should
|
||||
be (exit (status:exit-val (run ...))).
|
||||
|
||||
Reported by euler@lavielle.COM (Lutz Euler) 2/24/97.
|
||||
Fixed by Shivers 2/24/97.
|
||||
|
||||
Alan Bawden has reported a lot of bugs 4/97:
|
||||
Ignoring SIGPIPE is fine for scsh, but screws up sleazy C programs
|
||||
exec'd from scsh. Scsh now runs with SIGPIPE's handler set to a no-op
|
||||
C fun.
|
||||
|
||||
user-info C code was returning garbage strings when there was an error,
|
||||
crashing the system.
|
||||
|
||||
set-file-group had bugs (uid/gid args were transposed in the syscall)
|
||||
|
||||
meta.scm was blowing up on illegal numeric escapes like \3Q in meta-arg lines.
|
||||
Was also not recognizing the whole set of C escapes (e.g. \n, \a, \f).
|
||||
Jim Blandy reported the bug, with fixes for the second problem, 4/97.
|
360
Makefile.in
360
Makefile.in
|
@ -1,5 +1,5 @@
|
|||
# Scheme Shell Makefile
|
||||
# Last updated September 1995 by BDC
|
||||
# Last updated October 1995 by BDC
|
||||
|
||||
# Documentation in files INSTALL and doc/install.txt
|
||||
|
||||
|
@ -7,7 +7,8 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
CC = @CC@
|
||||
DEFS = @DEFS@
|
||||
LIBS = @LIBS@
|
||||
EXEEXT = @EXEEXT@
|
||||
LIBS = @LIBS@ @SCSHODBCLIBS@
|
||||
#DBOPEN = @DBOPEN@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS= @CPPFLAGS@ -I$(srcdir)/cig -I$(srcdir)/scsh/regexp
|
||||
|
@ -20,8 +21,8 @@ LDFLAGS_AIX= @LDFLAGS_AIX@
|
|||
|
||||
RM = rm -f
|
||||
|
||||
AR = ar cq
|
||||
RANLIB = ranlib
|
||||
AR = @AR@
|
||||
RANLIB = @RANLIB@
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
|
@ -56,7 +57,7 @@ distdir = /users/ftp/pub/s48
|
|||
# really needed if you want to build the linker or rebuild initial.image.
|
||||
include $(srcdir)/filenames.make
|
||||
#
|
||||
#NetBSD make wants to see this instead: (or use GNU make on BSD. -bri)
|
||||
# Berkeley make wants to see this instead: (or use GNU make on BSD. -bri)
|
||||
#.include "$(srcdir)/filenames.make"
|
||||
|
||||
|
||||
|
@ -98,31 +99,45 @@ VM = scshvm
|
|||
LIBCIG = cig/lib$(VM).a
|
||||
CIG = cig/cig
|
||||
CIGOBJS = cig/libcig.o cig/libcig1.o
|
||||
LIBSCSH = scsh/lib$(VM).a
|
||||
SCSHVMHACKS = proc2.o # postgcstub.o
|
||||
|
||||
SCSHOBJS = \
|
||||
scsh/dirstuff1.o \
|
||||
scsh/fdports1.o \
|
||||
scsh/flock.o scsh/flock1.o \
|
||||
scsh/jcontrol2.o scsh/jcontrol1.o \
|
||||
scsh/flock.o scsh/flock1.o \
|
||||
scsh/machine/stdio_dep.o \
|
||||
scsh/machine/time_dep1.o \
|
||||
scsh/machine/signals1.o \
|
||||
scsh/machine/libansi.o \
|
||||
scsh/network.o scsh/network1.o \
|
||||
scsh/putenv.o \
|
||||
scsh/re.o \
|
||||
scsh/rescm.o \
|
||||
scsh/syscalls.o scsh/syscalls1.o \
|
||||
scsh/tc.o scsh/tc1.o \
|
||||
scsh/time.o scsh/time1.o \
|
||||
scsh/userinfo.o \
|
||||
scsh/regexp/libregexp.a \
|
||||
scsh/rdelim.o \
|
||||
scsh/select.o scsh/select1.o
|
||||
scsh/rx/re-low.o scsh/rx/re1.o \
|
||||
scsh/select.o scsh/select1.o \
|
||||
scsh/sleep1.o \
|
||||
scsh/syscalls.o scsh/syscalls1.o \
|
||||
scsh/time.o scsh/time1.o \
|
||||
scsh/tty.o scsh/tty1.o \
|
||||
scsh/userinfo1.o \
|
||||
scsh/sighandlers1.o scsh/sighandlers.o \
|
||||
scsh/regexp/libregex.a
|
||||
|
||||
# scsh/jcontrol2.o scsh/jcontrol1.o \
|
||||
# scsh/$(DBOPEN) \
|
||||
# scsh/dbm.o scsh/dbm1.o
|
||||
|
||||
ODBCOBJS = \
|
||||
scsh/odbc/scsh-odbc.o \
|
||||
scsh/odbc/odbc0.o \
|
||||
scsh/odbc/odbc1.o \
|
||||
scsh/odbc/odbc2.o \
|
||||
#
|
||||
|
||||
SCSHODBCOBJS = @SCSHODBCOBJS@
|
||||
|
||||
OBJS = unix.o dynload.o prescheme.o extension.o scheme48vm.o \
|
||||
$(CIGOBJS) $(SCSHVMHACKS) $(SCSHOBJS)
|
||||
process_args.o $(CIGOBJS) $(SCSHVMHACKS) $(SCSHOBJS) $(SCSHODBCOBJS)
|
||||
|
||||
# Sources:
|
||||
|
||||
|
@ -133,38 +148,86 @@ CONFIG_FILES = interfaces.scm low-packages.scm rts-packages.scm \
|
|||
|
||||
# The following is the first rule and therefore the "make" command's
|
||||
# default target.
|
||||
enough: $(VM) $(IMAGE) script $(LIBCIG) scsh $(MANPAGE) .notify
|
||||
enough: $(VM) $(IMAGE) script $(LIBCIG) scsh $(LIBSCSH) $(MANPAGE) .notify
|
||||
|
||||
# The developers are curious to know. Don't be concerned if this fails.
|
||||
# You may comment these lines out if you wish to be discourteous.
|
||||
.notify: minor-version-number
|
||||
touch .notify
|
||||
-echo SCSH 0.`cat $(srcdir)/scsh/minor-version-number` \
|
||||
Scheme48 0.`cat $(srcdir)/minor-version-number` infestation. \
|
||||
| mail scheme-48-notifications@martigny.ai.mit.edu
|
||||
| mail scheme-48-notifications@zurich.ai.mit.edu
|
||||
-echo Another scsh 0.`cat $(srcdir)/scsh/minor-version-number` \
|
||||
infestation. | mail scsh-notifications@martigny.ai.mit.edu
|
||||
infestation. | mail scsh-notifications@zurich.ai.mit.edu
|
||||
|
||||
# This says how to process .scm files with cig to make .c stubs.
|
||||
.SUFFIXES: .scm
|
||||
.scm.c:
|
||||
$(srcdir)/$(VM) -o $(srcdir)/$(VM) -i $(CIG) < $< > $*.c
|
||||
|
||||
# These .h files mediate between the code exported from foo1.c
|
||||
# and imported into foo.scm's stub foo.c.
|
||||
|
||||
scsh/dirstuff1.o: scsh/dirstuff1.h
|
||||
scsh/rdelim.o: scsh/fdports1.h
|
||||
scsh/userinfo1.o: scsh/userinfo1.h
|
||||
|
||||
scsh/fdports1.o scsh/fdports.o: scsh/fdports1.h
|
||||
scsh/flock1.o scsh/flock.o: scsh/flock1.h
|
||||
scsh/network1.o scsh/network.o: scsh/network1.h
|
||||
scsh/select1.o scsh/select.o: scsh/select1.h
|
||||
scsh/syscalls1.o scsh/syscalls.o: scsh/syscalls1.h
|
||||
scsh/time1.o scsh/time.o: scsh/time1.h
|
||||
scsh/tty1.o scsh/tty.o: scsh/tty1.h
|
||||
|
||||
scsh/rx/re1.o scsh/rx/re-low.o: scsh/rx/re1.h
|
||||
|
||||
scsh/syscalls.o: scsh/syscalls1.h scsh/dirstuff1.h scsh/fdports1.h \
|
||||
scsh/select1.h scsh/userinfo1.h
|
||||
|
||||
scsh/sighandlers1.o scsh/sighandlers.o: scsh/sighandlers1.h
|
||||
|
||||
# Not really, but making regexp/libregex.a makes the regexp/regex.h file that
|
||||
# re-low.c actually does need.
|
||||
scsh/rx/re-low.o: scsh/regexp/libregex.a
|
||||
|
||||
include $(srcdir)/scsh/machine/Makefile.inc
|
||||
#NetBSD make wants to see this instead: (or use GNU make on BSD. -bri)
|
||||
# Berkeley make wants to see this instead: (or use GNU make on BSD. -bri)
|
||||
#.include "$(srcdir)/scsh/machine/Makefile.inc"
|
||||
|
||||
$(VM): main.o $(OBJS) $(AIX_P)
|
||||
$(CC) $(LDFLAGS) $(LDFLAGS_AIX) -o $@ main.o $(OBJS) $(LIBS)
|
||||
if [ ! "$${OSTYPE}" = "cygwin" ] ; then \
|
||||
$(CC) $(LDFLAGS) $(LDFLAGS_AIX) -o $@ main.o $(OBJS) $(LIBS); \
|
||||
else \
|
||||
dlltool \
|
||||
--export-all-symbols \
|
||||
--output-def $@.def \
|
||||
main.o $(OBJS); \
|
||||
$(CC) -s -Wl,--base-file,$@.base -o $@ main.o $(OBJS) $(LIBS); \
|
||||
dlltool \
|
||||
--dllname $@ \
|
||||
--input-def $@.def \
|
||||
--base-file $@.base \
|
||||
--output-exp $@.exp; \
|
||||
$(CC) -s -Wl,--base-file,$@.base,$@.exp -o $@ main.o $(OBJS) $(LIBS); \
|
||||
dlltool \
|
||||
--dllname $@ \
|
||||
--input-def $@.def \
|
||||
--base-file $@.base \
|
||||
--output-exp $@.exp; \
|
||||
$(CC) -Wl,$@.exp -o $@ main.o $(OBJS) $(LIBS); \
|
||||
fi
|
||||
|
||||
$(LIBCIG): main.o $(OBJS)
|
||||
# $(CC) -r -o $@ main.o $(OBJS)
|
||||
$(RM) $@
|
||||
$(AR) $@ main.o $(OBJS)
|
||||
@echo Do not be alarmed if the following ranlib command
|
||||
@echo fails due to the absence of a ranlib program on your system.
|
||||
-$(RANLIB) $@ || true
|
||||
#If running ranlib fails, probably there is none.
|
||||
#That's ok. So don't stop the build.
|
||||
$(RANLIB) $@
|
||||
|
||||
$(LIBSCSH): smain.o $(OBJS)
|
||||
$(RM) $@
|
||||
$(AR) $@ smain.o $(OBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
main.o: main.c
|
||||
$(CC) -c -o $@ -DDEFAULT_IMAGE_NAME=\"$(LIB)/scsh.image\" \
|
||||
|
@ -204,7 +267,7 @@ script:
|
|||
|
||||
### Fake targets: all clean install man dist
|
||||
|
||||
install: install-vm install-misc \
|
||||
install: install-dirs install-vm install-misc \
|
||||
install-man install-inc install-cig install-scsh
|
||||
|
||||
#install: script install-dirs install-vm install-image install-misc \
|
||||
|
@ -213,24 +276,30 @@ install: install-vm install-misc \
|
|||
# $(INSTALL_PROGRAM) script $(bindir)/$(RUNNABLE)
|
||||
|
||||
install-dirs:
|
||||
-mkdir $(prefix)
|
||||
-mkdir $(execfix)
|
||||
-mkdir $(bindir)
|
||||
-mkdir $(libdir)
|
||||
-mkdir $(incdir)
|
||||
-mkdir $(mandir)
|
||||
-mkdir $(mandir)/man$(manext)
|
||||
-mkdir $(LIB)
|
||||
-mkdir $(LIB)/cig
|
||||
-mkdir $(LIB)/rts
|
||||
-mkdir $(LIB)/env
|
||||
-mkdir $(LIB)/opt
|
||||
-mkdir $(LIB)/big
|
||||
-mkdir $(LIB)/misc
|
||||
-mkdir $(LIB)/link
|
||||
if [ ! -d $(prefix) ] ; then mkdir $(prefix); fi
|
||||
if [ ! -d $(exec_prefix) ] ; then mkdir $(exec_prefix); fi
|
||||
if [ ! -d $(bindir) ] ; then mkdir $(bindir); fi
|
||||
if [ ! -d $(libdir) ] ; then mkdir $(libdir); fi
|
||||
if [ ! -d $(incdir) ] ; then mkdir $(incdir); fi
|
||||
if [ ! -d $(mandir) ] ; then mkdir $(mandir); fi
|
||||
if [ ! -d $(mandir)/man$(manext) ] ; then mkdir $(mandir)/man$(manext); fi
|
||||
$(RM) -r $(LIB).old
|
||||
if [ -d $(LIB) ] ; then mv $(LIB) $(LIB).old ; fi
|
||||
mkdir $(LIB)
|
||||
mkdir $(LIB)/big
|
||||
mkdir $(LIB)/cig
|
||||
mkdir $(LIB)/doc
|
||||
mkdir $(LIB)/doc/scsh-manual
|
||||
mkdir $(LIB)/env
|
||||
mkdir $(LIB)/link
|
||||
mkdir $(LIB)/misc
|
||||
mkdir $(LIB)/opt
|
||||
mkdir $(LIB)/scsh
|
||||
mkdir $(LIB)/rts
|
||||
mkdir $(LIB)/vm
|
||||
|
||||
install-vm: $(VM)
|
||||
$(INSTALL_PROGRAM) $(VM) $(LIB)/
|
||||
$(INSTALL_PROGRAM) $(VM)$(EXEEXT) $(LIB)/
|
||||
|
||||
install-image: $(IMAGE)
|
||||
$(INSTALL_DATA) $(IMAGE) $(LIB)/
|
||||
|
@ -250,7 +319,7 @@ install-cig: cig
|
|||
$(INSTALL_DATA) $(srcdir)/cig/libcig.h $(LIB)/cig
|
||||
|
||||
install-misc: $(LIB)/rts $(LIB)/env $(LIB)/big $(LIB)/opt \
|
||||
$(LIB)/misc $(LIB)/link
|
||||
$(LIB)/misc $(LIB)/link $(LIB)/vm $(LIB)/doc
|
||||
for f in $(srcdir)/rts/*num.scm; \
|
||||
do $(INSTALL_DATA) $$f $(LIB)/rts/; done
|
||||
for f in $(srcdir)/env/*.scm; do $(INSTALL_DATA) $$f $(LIB)/env/; done
|
||||
|
@ -260,9 +329,15 @@ install-misc: $(LIB)/rts $(LIB)/env $(LIB)/big $(LIB)/opt \
|
|||
do $(INSTALL_DATA) $$f $(LIB)/misc/; done
|
||||
for f in $(srcdir)/link/*.scm; \
|
||||
do $(INSTALL_DATA) $$f $(LIB)/link/; done
|
||||
for f in $(srcdir)/vm/*.scm; do $(INSTALL_DATA) $$f $(LIB)/vm/; done
|
||||
for f in $(srcdir)/doc/*.txt; do $(INSTALL_DATA) $$f $(LIB)/doc/; done
|
||||
for f in $(srcdir)/doc/*.tex; do $(INSTALL_DATA) $$f $(LIB)/doc/; done
|
||||
for f in $(srcdir)/doc/*.ps; do $(INSTALL_DATA) $$f $(LIB)/doc/; done
|
||||
for f in $(srcdir)/doc/scsh-manual/*.tex; \
|
||||
do $(INSTALL_DATA) $$f $(LIB)/doc/scsh-manual/; done
|
||||
$(INSTALL_DATA) $(srcdir)/rts/jar-defrecord.scm $(LIB)/rts/
|
||||
# -p: Intermediate directories are created as necessary.
|
||||
# -p not portable...it is POSIX 2, bit its not widely available -bri
|
||||
# -p not portable...it is POSIX 2, but its not widely available -bri
|
||||
# just added install-dirs
|
||||
$(LIB)/rts:
|
||||
mkdir $(LIB)/rts
|
||||
|
@ -280,15 +355,20 @@ $(LIB)/link:
|
|||
configure: configure.in
|
||||
cd $(srcdir); autoconf
|
||||
|
||||
clean: clean-scsh
|
||||
-rm -f $(VM) *.o TAGS $(IMAGE) *.tmp script $(MANPAGE) \
|
||||
link/*.image debug/*.image debug/*.debug mini mini-heap.c \
|
||||
cig/*.o $(CIG) $(CIG).image $(LIBCIG)
|
||||
-find . -name "*~" -o -name ".#*" -o -name core -exec rm {} \;
|
||||
clean: clean-cig clean-scsh
|
||||
-rm -f $(VM)$(EXEEXT) *.o TAGS $(IMAGE) *.tmp script $(MANPAGE) \
|
||||
link/*.image debug/*.image debug/*.debug mini mini-heap.c
|
||||
|
||||
clean-cig:
|
||||
-rm -f cig/*.o $(CIG) $(CIG).image $(LIBCIG)
|
||||
|
||||
distclean: clean
|
||||
$(RM) Makefile sysdep.h config.status config.log config.cache \
|
||||
scsh/machine scsh/regexp/Makefile
|
||||
scsh/machine scsh/regexp/Makefile \
|
||||
scsh/endian.scm scsh/static.scm \
|
||||
exportlist.aix
|
||||
$(RM) a.exe $(VM).base $(VM).def $(VM).exp $(VM)$(EXEEXT).stackdump
|
||||
-find . -name '*~' -o -name '#*' -o -name core -exec rm {} \;
|
||||
|
||||
man: $(MANPAGE)
|
||||
|
||||
|
@ -347,8 +427,8 @@ inc:
|
|||
# try "touch filenames.make" and hope for the best.
|
||||
|
||||
PACKAGES=packages.scm rts-packages.scm alt-packages.scm \
|
||||
comp-packages.scm initial-packages.scm link-packages.scm \
|
||||
more-packages.scm filenames.scm
|
||||
comp-packages.scm initial-packages.scm link-packages.scm \
|
||||
more-packages.scm filenames.scm
|
||||
|
||||
filenames.make: $(PACKAGES)
|
||||
$(MAKE) $(VM) PACKAGES=
|
||||
|
@ -365,9 +445,9 @@ link/linker.image: $(linker-files) alt/init-defpackage.scm
|
|||
(echo ,batch; echo ,bench on; \
|
||||
echo ,open signals handle features; \
|
||||
echo ,open bitwise ascii code-vectors record; \
|
||||
echo ,load $(linker-files); \
|
||||
echo ,load $(linker-files); \
|
||||
echo ,load alt/init-defpackage.scm; \
|
||||
echo ,dump link/linker.image) \
|
||||
echo ,dump link/linker.image) \
|
||||
| $(LINKER_RUNNABLE)
|
||||
|
||||
# Or, to bootstrap from Lucid Common Lisp: (last tested with
|
||||
|
@ -441,9 +521,9 @@ mini-heap.c: debug/mini1.image
|
|||
| ./$(VM) -o ./$(VM) -h 3000000 -i $(IMAGE)
|
||||
debug/mini1.image: $(VM) debug/mini.image
|
||||
echo "(write-image \"debug/mini1.image\" \
|
||||
(usual-resumer (lambda (args) \
|
||||
(command-processor #f args))) \
|
||||
\"foo\")" \
|
||||
(usual-resumer (lambda (args) \
|
||||
(command-processor #f args))) \
|
||||
\"foo\")" \
|
||||
| ./$(VM) -i debug/mini.image
|
||||
|
||||
# --------------------
|
||||
|
@ -454,7 +534,7 @@ scheme48.h: vm/arch.scm vm/data.scm link/generate-c-header.scm
|
|||
echo ,load-package big-scheme; echo ,open big-scheme; \
|
||||
echo ,load link/generate-c-header.scm; \
|
||||
echo \(make-c-header-file \"$@\" \
|
||||
\"$(srcdir)/vm/arch.scm\" \"$(srcdir)/vm/data.scm\"\)) \
|
||||
\"$(srcdir)/vm/arch.scm\" \"$(srcdir)/vm/data.scm\"\)) \
|
||||
| $(RUNNABLE) -s-
|
||||
|
||||
#scheme48vm.c: $(vm-files)
|
||||
|
@ -501,8 +581,8 @@ $(CIG).image: $(IMAGE) $(VM) $(srcdir)/cig/cig.scm $(srcdir)/cig/libcig.scm
|
|||
echo ",dump /tmp/cig \"(CIG Preloaded -bri)\"") \
|
||||
| ./$(VM) -o ./$(VM) -i ./$(IMAGE)
|
||||
$(srcdir)/cig/image2script $(LIB)/$(VM) \
|
||||
-o $(LIB)/$(VM) \
|
||||
</tmp/cig > $(CIG).image
|
||||
-o $(LIB)/$(VM) \
|
||||
</tmp/cig > $(CIG).image
|
||||
-chmod +x $(CIG).image
|
||||
$(RM) /tmp/cig
|
||||
|
||||
|
@ -511,57 +591,74 @@ $(CIG).image: $(IMAGE) $(VM) $(srcdir)/cig/cig.scm $(srcdir)/cig/libcig.scm
|
|||
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
scsh: cig scsh/scsh scsh/scsh.image
|
||||
|
||||
SCHEME =scsh/defrec.scm \
|
||||
SCHEME =scsh/awk.scm \
|
||||
scsh/defrec.scm \
|
||||
scsh/endian.scm \
|
||||
scsh/enumconst.scm \
|
||||
scsh/fdports.scm \
|
||||
scsh/fileinfo.scm \
|
||||
scsh/filemtch.scm \
|
||||
scsh/filesys.scm \
|
||||
scsh/flock.scm \
|
||||
scsh/fname.scm \
|
||||
scsh/fr.scm \
|
||||
scsh/glob.scm \
|
||||
scsh/here.scm \
|
||||
scsh/machine/bufpol.scm \
|
||||
scsh/machine/errno.scm \
|
||||
scsh/machine/fdflags.scm \
|
||||
scsh/machine/netconst.scm \
|
||||
scsh/machine/packages.scm \
|
||||
scsh/machine/signals.scm \
|
||||
scsh/machine/waitcodes.scm \
|
||||
scsh/machine/time_dep.scm \
|
||||
scsh/machine/tty-consts.scm \
|
||||
scsh/machine/waitcodes.scm \
|
||||
scsh/meta-arg.scm \
|
||||
scsh/network.scm \
|
||||
scsh/newports.scm \
|
||||
scsh/odbc/odbc0.scm \
|
||||
scsh/odbc/odbc1.scm \
|
||||
scsh/odbc/odbc2.scm \
|
||||
scsh/procobj.scm \
|
||||
scsh/re.scm \
|
||||
scsh/pty.scm \
|
||||
scsh/rdelim.scm \
|
||||
scsh/rw.scm \
|
||||
scsh/scsh-condition.scm \
|
||||
scsh/scsh-interfaces.scm \
|
||||
scsh/scsh-package.scm \
|
||||
scsh/scsh-read.scm \
|
||||
scsh/scsh-version.scm \
|
||||
scsh/scsh.scm \
|
||||
scsh/select.scm \
|
||||
scsh/startup.scm \
|
||||
scsh/stringcoll.scm \
|
||||
scsh/syntax-helpers.scm \
|
||||
scsh/syntax.scm \
|
||||
scsh/syscalls.scm \
|
||||
scsh/tc.scm \
|
||||
scsh/time.scm \
|
||||
scsh/top.scm \
|
||||
scsh/tty.scm \
|
||||
scsh/utilities.scm
|
||||
|
||||
# scsh/dbm.scm
|
||||
# scsh/dbm.scm db.scm ndbm.scm
|
||||
# static.scm static-heap.scm static1.scm
|
||||
# jcontrol
|
||||
|
||||
# Bogus, but it makes the scm->c->o two-ply dependency work.
|
||||
# Explicitly giving the .o/.c dependency also makes it go.
|
||||
############################################################
|
||||
#scsh/dbm.c: scsh/dbm.scm
|
||||
scsh/flock.c: scsh/flock.scm
|
||||
scsh/network.c: scsh/network.scm
|
||||
scsh/re.c: scsh/re.scm
|
||||
cig/libcig.c: cig/libcig.scm
|
||||
scsh/flock.c: scsh/flock.scm
|
||||
scsh/jcontrol2.c: scsh/jcontrol2.scm
|
||||
scsh/network.c: scsh/network.scm
|
||||
scsh/rdelim.c: scsh/rdelim.scm
|
||||
scsh/select.c: scsh/select.scm
|
||||
scsh/syscalls.c: scsh/syscalls.scm
|
||||
scsh/tc.c: scsh/tc.scm
|
||||
scsh/time.c: scsh/time.scm
|
||||
scsh/rdelim.c: scsh/rdelim.scm
|
||||
scsh/select.c: scsh/select.scm
|
||||
scsh/jcontrol2.c: scsh/jcontrol2.scm
|
||||
scsh/tty.c: scsh/tty.scm
|
||||
scsh/time.c: scsh/time.scm
|
||||
scsh/odbc/odbc0.c: scsh/odbc/odbc0.scm
|
||||
scsh/odbc/odbc1.c: scsh/odbc/odbc1.scm
|
||||
scsh/odbc/odbc2.c: scsh/odbc/odbc2.scm
|
||||
|
||||
scsh/scsh: scsh/scsh-tramp.c
|
||||
$(CC) -o $@ $(CPPFLAGS) $(CFLAGS) \
|
||||
|
@ -569,22 +666,41 @@ scsh/scsh: scsh/scsh-tramp.c
|
|||
-DIMAGE=\"$(LIB)/scsh.image\" \
|
||||
scsh/scsh-tramp.c
|
||||
|
||||
loads = $(srcdir)/scsh/let-opt.scm $(srcdir)/scsh/scsh-interfaces.scm \
|
||||
$(srcdir)/scsh/machine/packages.scm \
|
||||
$(srcdir)/scsh/rx/packages.scm \
|
||||
$(srcdir)/scsh/rx/cond-package.scm \
|
||||
$(srcdir)/scsh/scsh-package.scm \
|
||||
$(srcdir)/scsh/lib/cset-package.scm \
|
||||
$(srcdir)/scsh/lib/string-package.scm \
|
||||
$(srcdir)/scsh/lib/list-pack.scm \
|
||||
$(srcdir)/scsh/lib/ccp-pack.scm \
|
||||
$(srcdir)/scsh/lib/char-package.scm \
|
||||
$(srcdir)/scsh/lib/cset-obsolete.scm
|
||||
|
||||
scsh/scsh.image: $(VM) $(SCHEME) $(CIG).image
|
||||
(echo ",translate =scheme48/ $(srcdir)/"; \
|
||||
echo ",batch on"; \
|
||||
echo ",load-package floatnums"; \
|
||||
echo ",open externals"; \
|
||||
echo "(lookup-all-externals)"; \
|
||||
echo ",config"; \
|
||||
echo ",load $(srcdir)/scsh/scsh-interfaces.scm"; \
|
||||
echo ",load $(srcdir)/scsh/machine/packages.scm"; \
|
||||
echo ",load $(srcdir)/scsh/scsh-package.scm"; \
|
||||
echo ",user"; \
|
||||
echo ",load $(loads)"; \
|
||||
echo ",load-package scsh"; \
|
||||
echo ",load-package scsh-here-string-hax"; \
|
||||
echo ",open scsh"; \
|
||||
echo ",translate =scheme48/ $(LIB)/"; \
|
||||
echo ",load-package list-lib"; \
|
||||
echo ",load-package string-lib"; \
|
||||
echo ",load-package ccp-lib"; \
|
||||
echo ",in scsh-level-0"; \
|
||||
echo "(%install-scsh-handlers)"; \
|
||||
echo "(autoreap-policy 'early)"; \
|
||||
echo ",user"; \
|
||||
echo ",open floatnums"; \
|
||||
echo ",open scsh"; \
|
||||
echo ",open list-lib string-lib ccp-lib"; \
|
||||
echo "(dump-scsh \"scsh/scsh.image\")") \
|
||||
| ./$(VM) -o ./$(VM) -i $(CIG).image
|
||||
| ./$(VM) -o ./$(VM) -h 10000000 -i $(CIG).image
|
||||
|
||||
# Removed these lines from scsh/scsh.image rule so you don't lose so
|
||||
# badly when you are debugging in scsh. -Olin 6/95
|
||||
|
@ -596,67 +712,35 @@ scsh/scsh.image: $(VM) $(SCHEME) $(CIG).image
|
|||
# < scsh/scsh.image > $@
|
||||
# -chmod +x $@
|
||||
|
||||
scsh/regexp/libregexp.a:
|
||||
cd scsh/regexp; $(MAKE)
|
||||
scsh/regexp/libregex.a:
|
||||
cd ./scsh/regexp; $(MAKE) lib
|
||||
|
||||
# SCSH static heaps
|
||||
.SUFFIXES: .scm .image .a .vm
|
||||
|
||||
.image.a:
|
||||
$(RM) $@
|
||||
(echo ",batch on"; \
|
||||
echo ",config ,load vm/ps-interface.scm"; \
|
||||
echo ",config ,load vm/interfaces.scm"; \
|
||||
echo ",config ,load vm/package-defs.scm"; \
|
||||
echo ",config ,load vm/s48-package-defs.scm"; \
|
||||
echo ",load-package bigbit"; \
|
||||
echo ",load-package destructuring"; \
|
||||
echo ",load-package heap"; \
|
||||
echo ",in heap"; \
|
||||
echo "(define (newspace-begin) *newspace-begin*)"; \
|
||||
echo "(define (heap-pointer) *hp*)"; \
|
||||
echo ",structure heap-extra (export newspace-begin"; \
|
||||
echo " heap-pointer"; \
|
||||
echo " header-a-units"; \
|
||||
echo " d-vector? "; \
|
||||
echo " stob-type)"; \
|
||||
echo ",config"; \
|
||||
echo "(define-structure static (export scsh-do-it"; \
|
||||
echo " test"; \
|
||||
echo " do-it)"; \
|
||||
echo " (open scheme heap memory data stob struct"; \
|
||||
echo " heap-extra"; \
|
||||
echo " vm-architecture"; \
|
||||
echo " formats"; \
|
||||
echo " enumerated"; \
|
||||
echo " signals"; \
|
||||
echo " tables"; \
|
||||
echo " defrec-package"; \
|
||||
echo " externals"; \
|
||||
echo " scsh)"; \
|
||||
echo " (files (scsh static)))"; \
|
||||
echo ",user"; \
|
||||
echo ",load-package static"; \
|
||||
echo ",open static"; \
|
||||
echo \(scsh-do-it \"$<\" \"/homes/bdc/tmp\" \"$@\" \
|
||||
\"$(CC) -c\" \"$(AR)\" \)) \
|
||||
| ./$(VM) -o ./$(VM) -h 4000000 -i scsh/scsh.image
|
||||
@echo Do not be alarmed if the following ranlib command
|
||||
@echo fails due to the absence of a ranlib program on your system.
|
||||
-$(RANLIB) $@ || true
|
||||
#If running ranlib fails, probably there is none.
|
||||
#That's ok. So don't stop the build.
|
||||
|
||||
.a.vm:
|
||||
$(CC) $(LDFLAGS) -o $@ smain.o $< $(OBJS) $(LIBS)
|
||||
scsh/scsh.vm: $(LIBSCSH) $(VM) scsh/scsh.image
|
||||
./$(VM) -o ./$(VM) -h 8000000 -i scsh/scsh.image \
|
||||
-lm ./vm/ps-interface.scm \
|
||||
-lm ./vm/interfaces.scm \
|
||||
-lm ./vm/package-defs.scm \
|
||||
-lm ./vm/s48-package-defs.scm \
|
||||
-dm -m static-heaps -e static-heap-linker \
|
||||
-s scsh/static.scm \
|
||||
-i scsh/scsh.image -o $@
|
||||
|
||||
install-scsh: scsh
|
||||
$(RM) $(bindir)/$(RUNNABLE)$(EXEEXT)
|
||||
$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh$(EXEEXT) \
|
||||
$(bindir)/$(RUNNABLE)$(EXEEXT)
|
||||
$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh.image $(LIB)/scsh.image
|
||||
$(INSTALL_PROGRAM) $(srcdir)/scsh/scsh $(LIB)/$(RUNNABLE)
|
||||
# -mkdir $(bindir)
|
||||
$(RM) $(bindir)/$(RUNNABLE)
|
||||
ln -s $(LIB)/$(RUNNABLE) $(bindir)/$(RUNNABLE)
|
||||
$(INSTALL_PROGRAM) $(srcdir)/$(LIBSCSH) $(libdir)/$(LIBSCSH)
|
||||
$(RANLIB) $(libdir)/$(LIBSCSH)
|
||||
for f in $(srcdir)/scsh/*.scm; \
|
||||
do $(INSTALL_DATA) $$f $(LIB)/scsh/; done
|
||||
|
||||
clean-scsh:
|
||||
$(RM) scsh/*.o scsh/regexp/*.o scsh/*.image scsh/scsh install
|
||||
$(RM) scsh/*.o
|
||||
$(RM) scsh/machine/*.o
|
||||
$(RM) scsh/odbc/*.o
|
||||
$(RM) scsh/regexp/*.o
|
||||
$(RM) scsh/rx/*.o
|
||||
$(RM) scsh/*.image
|
||||
$(RM) $(LIBSCSH) scsh/scsh$(EXEEXT) scsh/scsh.vm
|
||||
-cd scsh/regexp; $(MAKE) clean
|
||||
|
|
43
NEWS
43
NEWS
|
@ -2,12 +2,51 @@
|
|||
|
||||
Recent changes to the Scheme Shell.
|
||||
|
||||
09/xx/95 (version 0.4.0)
|
||||
??/??/?? (version 0.4.5 presumably)
|
||||
lock-region record now stores the *proc object* of the locking
|
||||
process, not the integer pid. A bug in unlock-region was fixed,
|
||||
and the documentation was fixed up.
|
||||
Did we say we had signal handlers installed in the last release?
|
||||
Now we do. Really. Installed & documented.
|
||||
Hopefully, bdc will change this line to say the static heap
|
||||
linker is documented.
|
||||
Name-consistency change (non-backwards compatible):
|
||||
open/nonblocking renamed to open/non-blocking,
|
||||
which is the way it was always described in the manual.
|
||||
-s<num> is now -sfd <num> -- more consistent with general switch
|
||||
design.
|
||||
|
||||
11/03/96 (version 0.4.4)
|
||||
minor fixes for SunOS, Solaris, AIX, NeXTStep, 686 systems
|
||||
minor static heap linker fixes
|
||||
|
||||
10/31/96 (version 0.4.3)
|
||||
Signal handlers
|
||||
Static heap linker
|
||||
Regular expression compilation
|
||||
AWK pre-compiles regexp patterns outside of main loop
|
||||
Solaris 2 on i386 support
|
||||
AIX 4 support
|
||||
HP-UX now uses dld for faster loading
|
||||
a few small networking bug fixs
|
||||
Bug fixes to I/O system.
|
||||
New meta-arg second-line syntax
|
||||
New -s<fdes> command line switch
|
||||
Last few bits of Posix: isatty(), ttyname(), ctermid(), fcntl()
|
||||
More efficient CLOEXEC handling for unrevealed file descriptors.
|
||||
Starting up programs with the "-e <entry-point>" command-line
|
||||
switch and with the (DUMP-SCSH-PROGRAM <file-name> <entry-point>)
|
||||
are now equivalent in that both pass a list of command-line
|
||||
arguments that includes the program name. The two start-up methods
|
||||
were not the same in the previous release. N.B.: This is not
|
||||
backwards-compatible with older releases' DUMP-SCSH-PROGRAM.
|
||||
|
||||
10/31/95 (version 0.4.0)
|
||||
New minor versioning introduced
|
||||
configure upgraded to autoconf-2.4 and overhauled in general
|
||||
static heap system improved from Scheme 48 version
|
||||
POSIX job control?
|
||||
POSIX terminal control
|
||||
POSIX terminal control with BSD and SVR4 extensions
|
||||
pseudo terminal (pty) interface
|
||||
select interface
|
||||
|
||||
|
|
4
README
4
README
|
@ -3,7 +3,7 @@
|
|||
Copyright (c) 1994 Brian D. Carlstrom
|
||||
See file COPYING for copying information.
|
||||
|
||||
Please report bugs to scsh-bugs@martigny.ai.mit.edu, and include
|
||||
Please report bugs to scsh-bugs@zurich.ai.mit.edu, and include
|
||||
the version number in your message.
|
||||
|
||||
Installation instructions in file INSTALL.
|
||||
|
@ -16,7 +16,7 @@ Recent changes are listed in file NEWS.
|
|||
|
||||
Known bugs and things to do in the future are listed in TODO.
|
||||
|
||||
Send mail to scsh-request@martigny.ai.mit.edu to be put on a
|
||||
Send mail to scsh-request@zurich.ai.mit.edu to be put on a
|
||||
mailing list for announcements, discussion, bug reports, and bug
|
||||
fixes.
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Copyright (c) 1993, 1994 Richard Kelsey and Jonathan Rees.
|
||||
See file COPYING for copying information.
|
||||
|
||||
Please report bugs to scheme48-bugs@martigny.ai.mit.edu, and include
|
||||
Please report bugs to scheme48-bugs@zurich.ai.mit.edu, and include
|
||||
the version number in your message.
|
||||
|
||||
Installation instructions in file INSTALL.
|
||||
|
@ -14,7 +14,7 @@ Recent changes are listed in file NEWS.
|
|||
|
||||
Known bugs and things to do in the future are listed in TODO.
|
||||
|
||||
Send mail to scheme-48-request@martigny.ai.mit.edu to be put on a
|
||||
Send mail to scheme-48-request@zurich.ai.mit.edu to be put on a
|
||||
mailing list for announcements, discussion, bug reports, and bug
|
||||
fixes.
|
||||
|
||||
|
|
317
RELEASE
317
RELEASE
|
@ -1,61 +1,288 @@
|
|||
This is a release of scsh, release 0.4.0.
|
||||
Scsh is a Unix shell that is embedded within R4RS Scheme.
|
||||
It provides high-level shell notation and full access to
|
||||
the Unix system calls. The current implementation is built
|
||||
on top of Scheme 48, version 0.36.
|
||||
Scsh 0.5.3 Release notes -*- outline -*-
|
||||
|
||||
We currently have scsh running on:
|
||||
AIX,
|
||||
CXUX,
|
||||
HP-UX,
|
||||
IRIX,
|
||||
Linux,
|
||||
NetBSD,
|
||||
NeXTSTEP,
|
||||
Solaris,
|
||||
SunOS,
|
||||
We are pleased to release scsh version 0.5.3. The new release has many bug
|
||||
fixes, improvements and new features.
|
||||
|
||||
The text below gives a general description of scsh, instructions for obtaining
|
||||
it, pointers to discussion forums, and a description of the new features in
|
||||
release 0.5.3. (Emacs should display this document is in outline mode. Say
|
||||
c-h m for instructions on how to move through it by sections (e.g., c-c c-n,
|
||||
c-c c-p).)
|
||||
|
||||
This release is the first new release of scsh in over a year. We've been
|
||||
using it, and have had no problems. However, we only recommend eager users
|
||||
download it. We'll upgrade it to a 0.5.3 release after a week or two, when
|
||||
this release has been shaken out.
|
||||
|
||||
|
||||
* Contents
|
||||
==========
|
||||
What is scsh
|
||||
Scsh as a scripting language
|
||||
Scsh as a systems-programming language
|
||||
Scsh is a portable programming environment
|
||||
Obtaining and installing scsh
|
||||
Getting in touch
|
||||
The World-Wide What?
|
||||
New in this release
|
||||
Scsh is now "open source."
|
||||
Scsh is now on Win32
|
||||
CVS repository will be public-readable
|
||||
New char-sets and char-set operations
|
||||
New regular expression system
|
||||
New libraries
|
||||
Renaming
|
||||
Bugfixes
|
||||
Thanks
|
||||
|
||||
|
||||
* What is scsh
|
||||
==============
|
||||
Scsh is a broad-spectrum systems-programming environment for Unix embedded
|
||||
in R4RS Scheme.
|
||||
|
||||
** Scsh as a scripting language
|
||||
-------------------------------
|
||||
Scsh has a high-level process notation for doing shell-script like tasks:
|
||||
running programs, establishing pipelines and I/O redirection. For example, the
|
||||
shell pipeline
|
||||
|
||||
gunzip < paper.tex.gz | detex | spell | lpr -Ppulp &
|
||||
|
||||
would be written in scsh as
|
||||
|
||||
(& (| (gunzip) (detex) (spell) (lpr -Ppulp)) ; Background a pipeline
|
||||
(< paper.tex.gz)) ; with this redirection
|
||||
|
||||
Scsh embeds this process notation within a full Scheme implementation.
|
||||
The process notation is realized as a set of macro definitions, and is
|
||||
carefully designed to allow full integration with standard Scheme code.
|
||||
Scsh isn't Scheme-like; it is Scheme.
|
||||
|
||||
At the scripting level, scsh also has an Awk design, also implemented
|
||||
as a macro that can be embedded inside general Scheme code.
|
||||
|
||||
Scripts can be written as standalone Scheme source files, with a leading
|
||||
#!/usr/local/bin/scsh -s
|
||||
trigger line.
|
||||
|
||||
|
||||
** Scsh as a systems-programming language
|
||||
-----------------------------------------
|
||||
Scsh additionally provides the low-level access to the operating system
|
||||
normally associated with C. The current release provides full access to Posix,
|
||||
plus important non-Posix extensions, such as complete sockets support.
|
||||
"Complete Posix" means: fork, exec & wait, sockets, full read, write, open &
|
||||
close, seek & tell, complete file-system access, including stat,
|
||||
chmod/chgrp/chown, symlink, FIFO & directory access, tty & pty support, file
|
||||
locking, pipes, select, file-name pattern-matching, time & date, environment
|
||||
variables, signal handlers, and more.
|
||||
|
||||
In brief, you can now write Unix systems programs in Scheme instead of C.
|
||||
For example, we have implemented an extensible HTTP server at MIT entirely
|
||||
in scsh.
|
||||
|
||||
As important as full access to the OS is the manner in which it is provided.
|
||||
Scsh integrates the OS support into Scheme in a manner which respects the
|
||||
general structure of the language. The details of the design are discussed
|
||||
in a joint MIT Lab for Computer Science/University of Hong Kong technical
|
||||
report, "A Scheme Shell," also to appear in a revised format in the *Journal
|
||||
of Lisp and Symbolic Computation." This paper is also available by ftp:
|
||||
ftp://ftp-swiss.ai.mit.edu/pub/su/scsh/scsh-paper.ps
|
||||
|
||||
|
||||
** Scsh is a portable programming environment
|
||||
---------------------------------------------
|
||||
Scsh is designed for portability. It is implemented on top of Scheme 48,
|
||||
a byte-code-interpreter Scheme implementation. The Scheme 48 virtual machine
|
||||
can be compiled on any system with a C compiler; the rest of Scheme 48 is
|
||||
machine-independent across 32-bit processors. Scsh's OS interface is
|
||||
also quite portable, providing a consistent interface across different
|
||||
Unix platforms. We currently have scsh implementations for:
|
||||
AIX
|
||||
BSD/OS
|
||||
CXUX
|
||||
FreeBSD
|
||||
HP-UX
|
||||
IRIX
|
||||
Linux
|
||||
NetBSD
|
||||
NeXTStep
|
||||
Solaris
|
||||
SunOS
|
||||
Ultrix
|
||||
It's not hard to port scsh to new systems.
|
||||
Win32
|
||||
|
||||
Scsh code should run without change across these systems.
|
||||
Porting to new platforms is usually not difficult.
|
||||
|
||||
You can get a copy of scsh via anonymous ftp, from the following:
|
||||
ftp://clark.lcs.mit.edu/pub/su/scsh/scsh.tar.gz
|
||||
ftp://swiss-ftp.ai.mit.edu/pub/su/scsh/scsh.tar.gz
|
||||
These tar files include a detailed manual and a paper describing
|
||||
|
||||
* Obtaining and installing scsh
|
||||
===============================
|
||||
You can get a copy of scsh via anonymous ftp, from
|
||||
ftp://ftp-swiss.ai.mit.edu/pub/su/scsh/scsh.tar.gz
|
||||
The tar file includes a detailed manual and a paper describing
|
||||
the design of the system.
|
||||
|
||||
For the lazily curious, we also have the manual separately available as
|
||||
ftp://clark.lcs.mit.edu/pub/su/scsh/scsh-manual.ps
|
||||
ftp://swiss-ftp.ai.mit.edu/pub/su/scsh/scsh-manual.ps
|
||||
ftp://ftp-swiss.ai.mit.edu/pub/su/scsh/scsh-manual.ps
|
||||
Just click 'n view.
|
||||
|
||||
The current release is primarily useful for writing shell scripts
|
||||
and doing general systems programming.
|
||||
You *should* be able to build scsh on the standard platforms with exactly five
|
||||
commands: gunzip, tar, cd, ./configure, and make. The configure script figures
|
||||
out the special flags and switches needed to make the build work (thanks to
|
||||
the GNU project for the autoconfig tool that makes this possible).
|
||||
|
||||
Real interactive use needs a parser for an sh-like syntax, job control,
|
||||
and the gnu readline library. If you're interested in hacking
|
||||
on these things, drop us a line at scheme-underground@ai.mit.edu.
|
||||
We've got designs for most of this stuff; we're just short on time
|
||||
and bodies.
|
||||
After doing the make, you can start up a Scheme shell and try it out
|
||||
by saying
|
||||
./scshvm -o ./scshvm -i ./scsh/scsh.image
|
||||
See the manual for full details on the command-line switches.
|
||||
|
||||
New in this release:
|
||||
- The scsh network package, a complete interface for Berkeley-style sockets.
|
||||
We are going to keep the code for our higher-level protocols (ftp, telnet,
|
||||
http, and so forth) close to home for one more release.
|
||||
If it's harder than this, and your system is standard, we'd like to know
|
||||
about it.
|
||||
|
||||
- The awk loop and field parser package.
|
||||
|
||||
These two packages are documented in the reference manual.
|
||||
* Getting in touch
|
||||
==================
|
||||
There are two main ways to join in scsh-related discussion: the mailing-list
|
||||
scsh@zurich.ai.mit.edu
|
||||
and the netnews group
|
||||
comp.lang.scheme.scsh
|
||||
These two forums are exactly equivalent, being bi-directionally gatewayed
|
||||
at MIT.
|
||||
|
||||
Lots of plans for the next release: libraries with network protocol code,
|
||||
the html parser and the server kit, module switches on the command line,
|
||||
threads -- we'll do our best.
|
||||
Bugs can be reported to
|
||||
scsh-bugs@zurich.ai.mit.edu
|
||||
|
||||
We thank Brent Benson, Travis V. Broughton, Brian Dennis, Noah Friedman Mike
|
||||
Gunter, Shriram Krishnamurthi, John P. Lewis, Tom Lord, Scott Schwartz, and
|
||||
Bill Sommerfeld, Michael Sperber, Axel Wienberg, for bug reports, bug fixes,
|
||||
and comments that were incorporated into this release.
|
||||
If you do not receive the alt netnews hierarchy, or wish to join the mailing
|
||||
list for other reasons, send mail to
|
||||
scsh-request@zurich.ai.mit.edu
|
||||
|
||||
Brought to you by the Scheme Underground scsh team.
|
||||
-Olin Shivers, Brian Carlstrom & David Albertz
|
||||
|
||||
* The World-Wide What?
|
||||
======================
|
||||
We even have one of those URL things:
|
||||
http://www-swiss.ai.mit.edu/scsh/
|
||||
|
||||
|
||||
* New in this release
|
||||
=====================
|
||||
** Scsh is now "open source."
|
||||
We finally got around to tacking an ideologically hip copyright
|
||||
onto the source. (Not that we ever cared before what you did with
|
||||
the system...) The Scheme 48 authors have also graciously retrofitted
|
||||
a BSD-style open-source copyright onto the underlying Scheme 48 0.36
|
||||
platform for us. The whole system is now open source, top-to-bottom.
|
||||
|
||||
Take all the code you like; we'll just write more.
|
||||
|
||||
** Scsh is now on Win32
|
||||
Scsh will now build and run using Cygwin B20.1. This was only tested
|
||||
on Windows NT 4.0, but presumably things could work on other Cygwin
|
||||
platforms such as Win95 or Win98. Cygwin is available from:
|
||||
http://sourceware.cygnus.com/cygwin/
|
||||
|
||||
** CVS repository will be public-readable
|
||||
We will add further information to the web-site as soon as possible.
|
||||
|
||||
** New char-sets and char-set operations
|
||||
See the manual for more information on using character sets
|
||||
for text processing. Also, see the ccp package in scsh/scsh/lib
|
||||
for a new library providing character->character partial maps,
|
||||
which are also useful for general string processing.
|
||||
|
||||
** New regular expression system
|
||||
There's a whole new regexp package in scsh. There's a new,
|
||||
s-expression-based notation for regexps, called SRE's. The new
|
||||
notation has been integrated into the AWK macro and field-parser functions.
|
||||
The older Posix notation is still supported for backwards compatibility.
|
||||
|
||||
There's a whole chapter on regexps in the new manual; it has full details.
|
||||
|
||||
The previous AWK and field-reader system is provided in a
|
||||
backwards-compatibility package. See package obsolete-awk-package
|
||||
in scsh-package.scm.
|
||||
|
||||
** New libraries
|
||||
The SRFI-1 list library is available, in the list-lib package.
|
||||
There is a large, powerful string-processing library available
|
||||
in the string-lib package. See the directory scsh/scsh/lib/ for
|
||||
documentation and source.
|
||||
|
||||
These libraries make basic list and string hacking very straightforward.
|
||||
|
||||
** Renaming
|
||||
We are shifting from a reduce-foo convention to a more standard
|
||||
foo-fold convention. This has caused the following renamings:
|
||||
reduce-char-set => char-set-fold
|
||||
reduce-port => port-fold
|
||||
The older names are still bound, but are deprecated and will likely
|
||||
go away in a future release.
|
||||
|
||||
String utilities INDEX and RINDEX are gone. Use the string-lib procedures
|
||||
instead.
|
||||
|
||||
** Bugfixes
|
||||
Over a year's worth of bug fixes. In particular, the old problems with the
|
||||
signal system blowing up builds on some of the more obscure Unix systems
|
||||
have been fixed.
|
||||
|
||||
|
||||
* Thanks
|
||||
========
|
||||
|
||||
We would like to thank the members of local-resistance cells for the
|
||||
Underground everywhere for bug reports, bug fixes, design review and comments
|
||||
that were incorporated into this release. We really appreciate their help,
|
||||
particularly in the task of porting scsh to new platforms.
|
||||
|
||||
Alan Bawden
|
||||
Jim Blandy
|
||||
Per Bothner
|
||||
Tom Breton
|
||||
Christopher Browne
|
||||
Sean Doran
|
||||
Ray Dillinger
|
||||
Allyn Dimock
|
||||
Scott Draves
|
||||
Lutz Euler
|
||||
Kevin Esler
|
||||
Jeremy Fitzhardinge
|
||||
Noah Friedman
|
||||
Martin Gasbichler
|
||||
Andy Gaynor
|
||||
Ian Grant
|
||||
Eric Hanchrow
|
||||
Karl Hegbloom
|
||||
Johann Hibschman
|
||||
Ian Horswill & the Northwestern Scheme wizards
|
||||
Gary Houston
|
||||
Graham Hughes
|
||||
Jarmo Hurri
|
||||
Lars Kellogg-Stedman
|
||||
Andre Koehoerst
|
||||
Hannu Koivisto
|
||||
Shriram Krishnamurthi
|
||||
Jakob Lichtenberg
|
||||
Eric Marsden
|
||||
Peter C. Olsen
|
||||
Willliam Pippin
|
||||
David Rush
|
||||
Michael Schinz
|
||||
Manuel Serrano
|
||||
Mark Shirle
|
||||
Bill Somerfeld
|
||||
Mike Sperber
|
||||
Harvey J. Stein
|
||||
Pawel Turnau
|
||||
Rob Warnock
|
||||
Kenneth R. Westerback
|
||||
|
||||
We'd like to thank everyone else for their patience; this release seemed like
|
||||
a long time coming.
|
||||
|
||||
Brought to you by the Scheme Underground. Go forth and write elegant systems
|
||||
programs.
|
||||
-Olin Shivers, Brian Carlstrom & Martin Gasbichler
|
||||
Cambridge
|
||||
25 December, 1994
|
||||
29 September 1999
|
||||
|
|
9
TODO
9
TODO
|
@ -10,11 +10,7 @@ immediate:
|
|||
|
||||
manual:
|
||||
pointers to relevant unix man pages
|
||||
|
||||
syscalls:
|
||||
posix terminal interface
|
||||
posix signals
|
||||
what other stuff is missing?
|
||||
HTML & info versions
|
||||
|
||||
fdports:
|
||||
rewrite to work with s48 0.39
|
||||
|
@ -54,6 +50,7 @@ perhaps one day:
|
|||
|
||||
conversion:
|
||||
sed => scsh
|
||||
awk => scsh
|
||||
find => scsh
|
||||
perl => scsh?
|
||||
|
||||
computer-on?
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Post-0.5.2-release bug reports:
|
||||
Friedrich Dominicus
|
||||
Jay Nietling
|
||||
Tim Bradshaw
|
||||
Robert Brown
|
||||
Eric Marsden
|
||||
Paul Emsley
|
||||
Pawel Turnau
|
||||
Hannu Koivisto
|
||||
Andy Gaynor
|
||||
Francisco Vides Fernandez
|
||||
Tim Burgess
|
|
@ -38,6 +38,10 @@
|
|||
p filename run
|
||||
noisy?))
|
||||
|
||||
(define (compile-and-run-port port p run noisy?)
|
||||
(compile-and-run-scanned-forms (really-scan-port port p)
|
||||
p #f run noisy?))
|
||||
|
||||
; --------------------
|
||||
|
||||
; If non-noisy, this tail-recurs to last form.
|
||||
|
|
|
@ -40,29 +40,40 @@
|
|||
(define (scan-file pathname p . env-option)
|
||||
(apply really-scan-file pathname p (current-output-port) env-option))
|
||||
|
||||
(define (really-scan-file pathname p noise . env-option)
|
||||
(define (really-scan-port port p . env-option) ; For scsh
|
||||
(let* ((env (if (null? env-option)
|
||||
(package->environment p)
|
||||
(car env-option)))
|
||||
(filename (namestring pathname #f *scheme-file-type*))
|
||||
(truename (translate filename)))
|
||||
(reader (environment-reader env)))
|
||||
(let recur ()
|
||||
(let ((form (reader port)))
|
||||
(if (eof-object? form)
|
||||
'()
|
||||
(append (scan-form form p env)
|
||||
(recur)))))))
|
||||
|
||||
(define (really-scan-file pathname p noise . env-option)
|
||||
(let* ((env (if (null? env-option)
|
||||
(package->environment p)
|
||||
(car env-option)))
|
||||
(filename (namestring pathname #f *scheme-file-type*))
|
||||
(truename (translate filename)))
|
||||
(call-with-input-file truename
|
||||
(lambda (port)
|
||||
(if filename ((fluid $note-file-package) filename p))
|
||||
(let ((env (bind-source-file-name filename env))
|
||||
(reader (environment-reader env)))
|
||||
(cond (noise (display truename noise)
|
||||
(force-output noise)))
|
||||
(let ((result (let recur ()
|
||||
(let ((form (read port)))
|
||||
(if (eof-object? form)
|
||||
'()
|
||||
(append (scan-form form p env)
|
||||
(recur)))))))
|
||||
(cond (noise (display #\space noise)
|
||||
(force-output noise)))
|
||||
result))))))
|
||||
|
||||
(if filename ((fluid $note-file-package) filename p))
|
||||
(let ((env (bind-source-file-name filename env))
|
||||
(reader (environment-reader env)))
|
||||
(cond (noise (display truename noise)
|
||||
(force-output noise)))
|
||||
(let ((result (let recur ()
|
||||
(let ((form (read port)))
|
||||
(if (eof-object? form)
|
||||
'()
|
||||
(append (scan-form form p env)
|
||||
(recur)))))))
|
||||
(cond (noise (display #\space noise)
|
||||
(force-output noise)))
|
||||
result))))))
|
||||
|
||||
; --------------------
|
||||
; Process a list of forms.
|
||||
|
|
|
@ -170,23 +170,34 @@
|
|||
(define (delq thing list)
|
||||
(delete (lambda (x) (eq? x thing)) list))
|
||||
|
||||
(define (delete pred in-list)
|
||||
(let loop ((list in-list) (res '()))
|
||||
(cond ((null? list)
|
||||
in-list)
|
||||
((pred (car list))
|
||||
(append-reverse! res (cdr list)))
|
||||
(else
|
||||
(loop (cdr list) (cons (car list) res))))))
|
||||
|
||||
(define (append-reverse! l1 l2)
|
||||
(let loop ((list l1) (res l2))
|
||||
(cond ((null? list)
|
||||
res)
|
||||
(else
|
||||
(let ((next (cdr list)))
|
||||
(set-cdr! list res)
|
||||
(loop next list))))))
|
||||
|
||||
(if (pair? list)
|
||||
(let ((next (cdr list)))
|
||||
(set-cdr! list res)
|
||||
(loop next list))
|
||||
res)))
|
||||
|
||||
;; This DELETE shares the longest tail of L that has no deleted elements.
|
||||
;; If we had multi-continuation calls, this could be made more efficient.
|
||||
|
||||
(define (delete pred l)
|
||||
(call-with-values (lambda ()
|
||||
;; (recur l) returns L with (pred x) values deleted.
|
||||
;; It also returns a flag NO-DEL? if the returned value
|
||||
;; is EQ? to L, i.e. if it didn't delete anything.
|
||||
(let recur ((l l))
|
||||
(if (pair? l)
|
||||
(let ((x (car l))
|
||||
(tl (cdr l)))
|
||||
(if (pred x)
|
||||
(call-with-values (lambda () (recur tl))
|
||||
(lambda (ans no-del?)
|
||||
(values ans #f))) ; Deleted X.
|
||||
(call-with-values (lambda () (recur tl))
|
||||
(lambda (ans no-del?)
|
||||
(if no-del?
|
||||
(values l #t)
|
||||
(values (cons x ans) #f))))))
|
||||
(values '() #t))))
|
||||
(lambda (ans no-del?) ans)))
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
; - uid - no semantic content.
|
||||
|
||||
; Date: Mon, 31 Aug 92 18:17:23 -0400
|
||||
; From: "Guillermo J. Rozas" <jinx@martigny.ai.mit.edu>
|
||||
; From: "Guillermo J. Rozas" <jinx@zurich.ai.mit.edu>
|
||||
;
|
||||
; 1: Instead of requesting a periodic timer interrupt from the system,
|
||||
; request one-shot interrupts, and re-request at the end of each throw
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
# things to change in this file
|
||||
# VERSION
|
||||
# FTPDIR
|
||||
|
||||
# *** change below in :
|
||||
# ~/scsh/RELEASE
|
||||
# ~/scsh/scsh/minor-version
|
||||
# ~/scsh/scsh/oldtop.scm
|
||||
# ~/scsh/scsh/scsh-version.scm
|
||||
# ~/scsh/bin/scsh-test
|
||||
# /zu/bdc/ftp/scsh/README
|
||||
#
|
||||
# also:
|
||||
#
|
||||
# rm /zu/bdc/ftp/scsh/README~
|
||||
#
|
||||
VERSION=-0.5.3
|
||||
FTPDIR=${HOME}/ftp/users/bdc
|
||||
|
||||
CVSROOT=/projects/express/scsh-cvs
|
||||
export CVSROOT
|
||||
|
||||
TMPSPACE=${HOME}/tmp
|
||||
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
umask 002
|
||||
# go to temp space
|
||||
echo Making release for ${FTPDIR}/scsh${VERSION} in $TMPSPACE
|
||||
cd $TMPSPACE
|
||||
|
||||
# checkout a fresh tree and prune CVS stuff
|
||||
echo Checking out scsh
|
||||
cvs checkout scsh
|
||||
echo Removing CVS directories and .cvsignore files
|
||||
find scsh/ \( -name CVS -o -name .cvsignore \) -exec rm -r {} \;
|
||||
|
||||
# fix time stampes for building
|
||||
echo Touching files to fix build dependencies
|
||||
scsh/bin/scsh-touch
|
||||
|
||||
echo Removing bin directory
|
||||
rm -rf scsh/bin
|
||||
|
||||
# "untouch" .notify
|
||||
echo Untouching .notify
|
||||
rm scsh/.notify
|
||||
|
||||
# patch dir names and make tar
|
||||
echo Making tar ball
|
||||
mv scsh scsh${VERSION}
|
||||
tar czvf ${FTPDIR}/scsh${VERSION}.tar.gz scsh${VERSION}/
|
||||
|
||||
# fix symlink
|
||||
if [ $VERSION != "" ] ; then
|
||||
echo Symlinking
|
||||
rm -f ${FTPDIR}/scsh.tar.gz
|
||||
ln -s scsh${VERSION}.tar.gz ${FTPDIR}/scsh.tar.gz
|
||||
else
|
||||
echo No VERSION therefore no symlink needed
|
||||
fi
|
||||
|
||||
# copy release notes and scsh manual
|
||||
echo Copying release notes and scsh manual
|
||||
cp scsh${VERSION}/RELEASE ${FTPDIR}
|
||||
cp scsh${VERSION}/doc/scsh-manual.ps ${FTPDIR}
|
||||
|
||||
# clean up
|
||||
echo Removing tree
|
||||
rm -r scsh${VERSION}
|
||||
|
||||
# split binary up
|
||||
echo Spliting tarball
|
||||
rm -rf ${FTPDIR}/split
|
||||
mkdir ${FTPDIR}/split
|
||||
cd ${FTPDIR}/split
|
||||
split -b 100k ../scsh${VERSION}.tar.gz scsh${VERSION}.tar.gz-x
|
||||
|
||||
# That's all folks
|
||||
echo Done.
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
scsh-touch
|
||||
tar czvf ${HOME}/ftp/users/bdc/scsh.tar.gz scsh/
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
cd /dl/bdc
|
||||
tar xzvf /zu/bdc/ftp/users/bdc/scsh.tar.gz
|
||||
cd scsh-0.5.3
|
||||
./configure
|
||||
make
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
# fixes some timestamp problems
|
||||
|
||||
touch scsh/scheme48.h
|
||||
touch scsh/filenames.make
|
||||
|
||||
touch scsh/cig/libcig.c
|
||||
|
||||
touch scsh/scsh/flock.c
|
||||
touch scsh/scsh/jcontrol2.c
|
||||
touch scsh/scsh/network.c
|
||||
touch scsh/scsh/rdelim.c
|
||||
touch scsh/scsh/re.c
|
||||
touch scsh/scsh/select.c
|
||||
touch scsh/scsh/sighandlers.c
|
||||
touch scsh/scsh/syscalls.c
|
||||
touch scsh/scsh/time.c
|
||||
touch scsh/scsh/tty.c
|
|
@ -0,0 +1,2 @@
|
|||
cig
|
||||
cig.image
|
|
@ -1,5 +1,6 @@
|
|||
%&lplain -*- latex -*-
|
||||
\documentstyle[code,11pt,boxedminipage,draftfooters,palatino,ct]{article}
|
||||
\documentclass[11pt]{article}
|
||||
\usepackage{ct,boxedminipage,draftfooters,code}
|
||||
\input{headings}
|
||||
\begin{document}
|
||||
|
||||
|
|
|
@ -110,7 +110,8 @@
|
|||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\codeallowbreaks{\catcode`\^^M\active\let^^M\cd@crbr}}
|
||||
|
||||
\def\cd@crbr{\leavevmode\endgraf} % What ^M turns into.
|
||||
%\def\cd@crbr{\leavevmode\endgraf} % What ^M turns into.
|
||||
\def\cd@crbr{\par\leavevmode} % What ^M turns into.
|
||||
|
||||
|
||||
% \cd@obeycrsp
|
||||
|
@ -149,7 +150,7 @@
|
|||
% FOO-\=BAR.
|
||||
|
||||
\def\setupcode{\parsep=0pt\parindent=0pt%
|
||||
\tt\frenchspacing\catcode``=13\@noligs%
|
||||
\normalfont\ttfamily\frenchspacing\catcode``=13\@noligs%
|
||||
\def\\{\char`\\}%
|
||||
\let\dcd=\cd@dcd\let\cddollar=\cd@dollarspecial\let\cdmath=\cd@mathspecial%
|
||||
\@makeother\$\@makeother\&\@makeother\#%
|
||||
|
@ -291,3 +292,5 @@
|
|||
% are starting a paragraph.
|
||||
% - Added the codebox env. Tricky bit involving the first line hacked
|
||||
% with help from David Long.
|
||||
% Olin 8/94
|
||||
% Changed the font commands for LaTeX2e.
|
||||
|
|
|
@ -1,44 +1,6 @@
|
|||
% Loads cmtt fonts in on \tt. -*- latex -*-
|
||||
% I prefer these to the Courier fonts that latex gives you w/postscript styles.
|
||||
% Courier is too spidery and too wide -- it's hard to get 80 chars on a line.
|
||||
% This works with the font machinery as defined at CMU; your mileage may vary.
|
||||
% \tt defined here for 5-12,14,17 pt sizes; extend in the obvious way
|
||||
% for bigger sizes. -Olin 3/91
|
||||
% -Olin
|
||||
|
||||
% Interlock: only load this file once.
|
||||
\ifx\ct@loaded\relax\endinput\else\let\ct@loaded=\relax\fi
|
||||
|
||||
% Define the fonts:
|
||||
\newfont{\ctxvii}{cmtt10 scaled \magstep3}
|
||||
\newfont{\ctxiv}{cmtt10 scaled \magstep2}
|
||||
\newfont{\ctxii}{cmtt12}
|
||||
\newfont{\ctxi}{cmtt10 scaled \magstephalf}
|
||||
\newfont{\ctx}{cmtt10}
|
||||
\newfont{\ctix}{cmtt9}
|
||||
\newfont{\ctviii}{cmtt8}
|
||||
\newfont{\ctvii}{cmtt10 at 7pt}
|
||||
\newfont{\ctvi}{cmtt10 at 6pt}
|
||||
\newfont{\ctv}{cmtt10 at 5pt}
|
||||
|
||||
% Install 3 fonts as the current \tt font family.
|
||||
% #1 is textfont; #2 scriptfont; #3 scriptscriptfont.
|
||||
\def\ct@setfonts#1#2#3{\def\ptt{\fam\ttfam#1}\textfont\ttfam#1%
|
||||
\scriptfont\ttfam#2\scriptscriptfont\ttfam#3}
|
||||
|
||||
\@addfontinfo\@vipt{\ct@setfonts\ctvi\ctvi\ctvi}
|
||||
\@addfontinfo\@viipt{\ct@setfonts\ctvii\ctvi\ctv}
|
||||
\@addfontinfo\@viiipt{\ct@setfonts\ctviii\ctvi\ctv}
|
||||
\@addfontinfo\@ixpt{\ct@setfonts\ctix\ctvi\ctv}
|
||||
\@addfontinfo\@xpt{\ct@setfonts\ctx\ctvii\ctv}
|
||||
\@addfontinfo\@xipt{\ct@setfonts\ctxi\ctviii\ctvi}
|
||||
\@addfontinfo\@xiipt{\ct@setfonts\ctxii\ctviii\ctvi}
|
||||
\@addfontinfo\@xivpt{\ct@setfonts\ctxiv\ctx\ctvii}
|
||||
\@addfontinfo\@xviipt{\ct@setfonts\ctxvii\ctxii\ctx}
|
||||
%\@addfontinfo\@xxpt{\ct@setfonts\ctxx\ctxiv\ctxii}
|
||||
%\@addfontinfo\@xxvpt{\ct@setfonts\ctxxv\ctxx\ctxvii}
|
||||
|
||||
%% Note that \@xiipt, for example, is called from 2 places:
|
||||
%% at the end of the \@setsize sets up 12pt (from, say, \normalsize),
|
||||
%% and at the end of the \@getfont that \ptt does when loading in
|
||||
%% a font. However, since the @\setsize whomps the default defn of
|
||||
%% \ptt, this second call never happens. And a good thing, too.
|
||||
\renewcommand{\ttdefault}{cmtt}
|
||||
|
|
|
@ -16,7 +16,6 @@ fi
|
|||
|
||||
exec cat
|
||||
|
||||
|
||||
# This program reads an S48 image from stdin and turns it into
|
||||
# an executable by prepending a #! prefix. The vm and its
|
||||
# args are passed to this program on the command line.
|
||||
|
|
|
@ -68,7 +68,7 @@ scheme_value df_c_veclen(long nargs, scheme_value *args)
|
|||
|
||||
scheme_value df_free(long nargs, scheme_value *args)
|
||||
{
|
||||
extern void free(void* );
|
||||
|
||||
|
||||
cig_check_nargs(1, nargs, "free");
|
||||
free((void* )AlienVal(args[0]));
|
||||
|
|
|
@ -20,4 +20,4 @@ extern char *copystring(char *, const char *);
|
|||
|
||||
extern scheme_value strlen_or_false(const char *);
|
||||
|
||||
extern void cig_check_nargs(int arity, int nargs, char *fn);
|
||||
extern void cig_check_nargs(int arity, int nargs, const char *fn);
|
||||
|
|
|
@ -123,7 +123,8 @@
|
|||
(mapv! string-carrier->string-no-free vec)))
|
||||
|
||||
|
||||
(define-foreign C-free (free ((C void*) ptr)) ignore)
|
||||
(define-foreign C-free (free ((C void*) ptr)) no-declare ; for SunOS 4.x
|
||||
ignore)
|
||||
|
||||
(define-foreign %set-string-vector-carriers!
|
||||
(set_strvec_carriers (vector-desc svec) ((C char**) cvec))
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
#include "libcig.h"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
@ -17,7 +18,7 @@
|
|||
** If C string is NULL, do nothing and return #f.
|
||||
*/
|
||||
|
||||
int c2scheme_strcpy(scheme_value sstr, char *cstr)
|
||||
int c2scheme_strcpy(scheme_value sstr, const char *cstr)
|
||||
{
|
||||
if( cstr ) {
|
||||
strncpy( (char*) StobData(sstr), cstr, STRING_LENGTH(sstr) );
|
||||
|
@ -28,7 +29,7 @@ int c2scheme_strcpy(scheme_value sstr, char *cstr)
|
|||
|
||||
|
||||
/* Same as above, but free the C string when we are done. */
|
||||
int c2scheme_strcpy_free(scheme_value sstr, char *cstr)
|
||||
int c2scheme_strcpy_free(scheme_value sstr, const char *cstr)
|
||||
{
|
||||
if( cstr ) {
|
||||
strncpy( (char*) StobData(sstr), cstr, STRING_LENGTH(sstr) );
|
||||
|
@ -42,11 +43,9 @@ char *scheme2c_strcpy(scheme_value sstr)
|
|||
{
|
||||
char *result;
|
||||
int slen;
|
||||
extern void *memcpy(void*, const void*, size_t);
|
||||
extern int errno;
|
||||
|
||||
slen = STRING_LENGTH(sstr);
|
||||
result = (char*) malloc(slen+1);
|
||||
result = Malloc(char, slen+1);
|
||||
|
||||
if( result == NULL ) {
|
||||
fprintf(stderr,
|
||||
|
@ -56,7 +55,7 @@ char *scheme2c_strcpy(scheme_value sstr)
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
memcpy(result, (void *) cig_string_body(sstr), slen);
|
||||
memcpy(result, cig_string_body(sstr), slen);
|
||||
result[slen] = '\000';
|
||||
return result;
|
||||
}
|
||||
|
@ -66,9 +65,9 @@ char *scheme2c_strcpy(scheme_value sstr)
|
|||
** The terminating null is not counted. Returns #f on NULL.
|
||||
*/
|
||||
|
||||
scheme_value c_veclen(long *vec)
|
||||
scheme_value c_veclen(const long *vec)
|
||||
{
|
||||
long *vptr = vec;
|
||||
const long *vptr = vec;
|
||||
if( !vptr ) return SCHFALSE;
|
||||
while( *vptr ) vptr++;
|
||||
return ENTER_FIXNUM(vptr - vec);
|
||||
|
@ -112,7 +111,7 @@ char *copystring_or_die(const char *str ) /* Note: NULL -> NULL. */
|
|||
else return NULL;
|
||||
}
|
||||
|
||||
int cstring_nullp( char *s ) { return ! s; }
|
||||
int cstring_nullp( const char *s ) { return ! s; }
|
||||
|
||||
scheme_value strlen_or_false(const char *s)
|
||||
{ return s ? ENTER_FIXNUM(strlen(s)) : SCHFALSE; }
|
||||
|
@ -138,7 +137,7 @@ void set_strvec_carriers(scheme_value svec, char const * const * cvec)
|
|||
}
|
||||
|
||||
/* Helper function for arg checking. Why bother, actually? */
|
||||
void cig_check_nargs(int arity, int nargs, char *fn)
|
||||
void cig_check_nargs(int arity, int nargs, const char *fn)
|
||||
{
|
||||
if( arity != nargs ) {
|
||||
fprintf(stderr,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
|
@ -14,7 +14,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
|
@ -51,17 +51,19 @@ trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
|||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
alpha:OSF1:V*:*)
|
||||
# After 1.2, OSF1 uses "V1.3" for uname -r.
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'`
|
||||
exit 0 ;;
|
||||
alpha:OSF1:*:*)
|
||||
# A Vn.n version is a released version.
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo alpha-dec-osf${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
exit 0 ;;
|
||||
Amiga*:UNIX_System_V:4.0:*)
|
||||
echo m68k-cbm-sysv4
|
||||
exit 0;;
|
||||
amiga:NetBSD:*:*)
|
||||
echo m68k-cbm-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
|
@ -79,7 +81,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
i86pc:SunOS:5.*:*)
|
||||
echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
sun4*:SunOS:6*:*)
|
||||
# According to config.sub, this is the proper way to canonicalize
|
||||
|
@ -114,9 +116,15 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:4*:UMIPS)
|
||||
echo mips-mips-riscos4sysv
|
||||
exit 0 ;;
|
||||
mips:*:5*:RISCos)
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
echo powerpc-harris-powerunix
|
||||
exit 0 ;;
|
||||
m88k:CX/UX:7*:*)
|
||||
echo m88k-harris-cxux7
|
||||
exit 0 ;;
|
||||
|
@ -127,12 +135,17 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|||
echo m88k-motorola-sysv3
|
||||
exit 0 ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
|
@ -184,10 +197,8 @@ EOF
|
|||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
IBM_REV=4.1
|
||||
elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
IBM_REV=4.1.1
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
else
|
||||
IBM_REV=4.${UNAME_RELEASE}
|
||||
fi
|
||||
|
@ -200,7 +211,7 @@ EOF
|
|||
echo romp-ibm-bsd4.4
|
||||
exit 0 ;;
|
||||
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
|
||||
exit 0 ;; # report: romp-ibm BSD 4.3
|
||||
*:BOSX:*:*)
|
||||
echo rs6000-bull-bosx
|
||||
|
@ -218,7 +229,7 @@ EOF
|
|||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;;
|
||||
9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
|
||||
9000/8?? ) HP_ARCH=hppa1.0 ;;
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
|
@ -254,13 +265,13 @@ EOF
|
|||
rm -f dummy.c dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* )
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
echo hppa1.1-hp-bsd
|
||||
exit 0 ;;
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?7:OSF1:*:* )
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
hp8??:OSF1:*:*)
|
||||
|
@ -303,7 +314,7 @@ EOF
|
|||
echo m68k-hp-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
|
@ -311,33 +322,58 @@ EOF
|
|||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-pc-cygwin32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
exit 0 ;;
|
||||
*:GNU:*:*)
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# Systems without a BFD linker
|
||||
if test -d /usr/lib/ldscripts/. ; then
|
||||
:
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
|
||||
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
echo alpha-unknown-linux-gnu ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "sparc" ; then
|
||||
echo sparc-unknown-linux-gnu ; exit 0
|
||||
else
|
||||
echo "${UNAME_MACHINE}-unknown-linuxoldld"
|
||||
exit 0
|
||||
fi
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld) or one that does not give us
|
||||
# useful --help. Gcc wants to distinguish between linux-gnuoldld and linux-gnuaout.
|
||||
test ! -d /usr/lib/ldscripts/. \
|
||||
&& echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __ELF__
|
||||
printf ("%s-unknown-linux\n", argv[1]);
|
||||
printf ("%s-pc-linux-gnu\n", argv[1]);
|
||||
#else
|
||||
printf ("%s-unknown-linuxaout\n", argv[1]);
|
||||
printf ("%s-pc-linux-gnuaout\n", argv[1]);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy;;
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
i[34]86:DYNIX/ptx:4*:*)
|
||||
|
@ -347,23 +383,25 @@ EOF
|
|||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i[34]86:*:3.2:*)
|
||||
if test -f /usr/options/cb.name; then
|
||||
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
|
||||
echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
|
||||
echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
|
||||
elif /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-sysv32
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-unknown-mach3
|
||||
echo i386-pc-mach3
|
||||
exit 0 ;;
|
||||
paragon:*:*:*)
|
||||
echo i860-intel-osf1
|
||||
|
@ -387,19 +425,19 @@ EOF
|
|||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||
m680[234]0:LynxOS:2.2*:*)
|
||||
m680[234]0:LynxOS:2.[23]*:*)
|
||||
echo m68k-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i[34]86:LynxOS:2.2*:*)
|
||||
i[34]86:LynxOS:2.[23]*:*)
|
||||
echo i386-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.2*:*)
|
||||
TSUNAMI:LynxOS:2.[23]*:*)
|
||||
echo sparc-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
rs6000:LynxOS:2.2*:*)
|
||||
rs6000:LynxOS:2.[23]*:*)
|
||||
echo rs6000-lynx-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
|
@ -413,12 +451,26 @@ EOF
|
|||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit 0 ;;
|
||||
mc68*:A/UX:*:*)
|
||||
echo m68k-apple-aux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
|
@ -469,7 +521,7 @@ main ()
|
|||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-unknown-bsd\n"); exit (0);
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
|
@ -482,7 +534,18 @@ main ()
|
|||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,7 +17,8 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
|
@ -40,6 +41,8 @@
|
|||
# The goal of this file is to map all the various variations of a given
|
||||
# machine specification into a single specification in the form:
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or in some cases, the newer four-part form:
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
|
@ -61,11 +64,21 @@ case $1 in
|
|||
;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS (if any).
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux-gnu*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
*)
|
||||
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
then os=`echo $1 | sed 's/.*-/-/'`
|
||||
else os=; fi
|
||||
;;
|
||||
esac
|
||||
|
||||
### Let's recognize common machines as not being operating systems so
|
||||
### that things like config.sub decstation-3100 work. We also
|
||||
|
@ -80,38 +93,43 @@ case $os in
|
|||
-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp )
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
os=-sco3.2v4
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2.[4-9]*)
|
||||
os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco3.2v[4-9]*)
|
||||
# Don't forget version if it is 3.2v4 or newer.
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco*)
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-clix*)
|
||||
basic_machine=clipper-intergraph
|
||||
;;
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'`
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
|
@ -122,28 +140,37 @@ case $os in
|
|||
-windowsnt*)
|
||||
os=`echo $os | sed -e 's/windowsnt/winnt/'`
|
||||
;;
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i[345]86 | i860 | m68k | m68000 | m88k | ns32k | arm \
|
||||
tahoe | i860 | m68k | m68000 | m88k | ns32k | arm \
|
||||
| arme[lb] | pyramid \
|
||||
| tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \
|
||||
| alpha | we32k | ns16k | clipper | sparclite | i370 | sh \
|
||||
| powerpc | powerpcle | sparc64 | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| alpha | we32k | ns16k | clipper | i370 | sh \
|
||||
| powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
|
||||
| pdp11 | mips64el | mips64orion | mips64orionel \
|
||||
| sparc)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
| sparc | sparclet | sparclite | sparc64)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[345]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \
|
||||
| sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
|
||||
| none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
|
||||
|
@ -189,6 +216,10 @@ case $basic_machine in
|
|||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
;;
|
||||
balance)
|
||||
basic_machine=ns32k-sequent
|
||||
os=-dynix
|
||||
|
@ -221,6 +252,10 @@ case $basic_machine in
|
|||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
|
@ -307,20 +342,20 @@ case $basic_machine in
|
|||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[345]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
i[3456]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[345]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
i[3456]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[345]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
i[3456]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[345]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'`
|
||||
i[3456]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
iris | iris4d)
|
||||
|
@ -418,14 +453,18 @@ case $basic_machine in
|
|||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | p6)
|
||||
# We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
;;
|
||||
pentium-* | p5-* | p6-*)
|
||||
# We don't have specific support for the Intel Pentium (p6) followon yet, so just call it a Pentium
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
|
@ -614,6 +653,8 @@ esac
|
|||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
|
@ -625,24 +666,29 @@ case $os in
|
|||
os=-sysv4
|
||||
;;
|
||||
-gnu/linux*)
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux|'`
|
||||
os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
|
||||
;;
|
||||
# First accept the basic system types.
|
||||
# The portable systems comes first.
|
||||
# Each alternative MUST END IN A *, to match a version number.
|
||||
# -sysv* is not here because it comes later, after sysvr4.
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[345]* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
|
||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aos* \
|
||||
| -amigados* | -msdos* | -newsos* | -unicos* | -aof* | -aos* \
|
||||
| -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \
|
||||
| -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* )
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* \
|
||||
| -linux-gnu*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
-sunos5*)
|
||||
os=`echo $os | sed -e 's|sunos5|solaris2|'`
|
||||
;;
|
||||
|
@ -667,6 +713,9 @@ case $os in
|
|||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
|
@ -774,6 +823,9 @@ case $basic_machine in
|
|||
m88k-omron*)
|
||||
os=-luna
|
||||
;;
|
||||
*-next )
|
||||
os=-nextstep
|
||||
;;
|
||||
*-sequent)
|
||||
os=-ptx
|
||||
;;
|
||||
|
@ -858,6 +910,9 @@ case $basic_machine in
|
|||
-vxworks*)
|
||||
vendor=wrs
|
||||
;;
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
|
|
112
configure.in
112
configure.in
|
@ -4,7 +4,6 @@ dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|||
dnl Autoconf does not seems to fit the needs of dynamic linking well -bri
|
||||
|
||||
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
dnl We might want AC_WORDS_BIGENDIAN in the future.
|
||||
dnl We might want AC_CHAR_UNSIGNED in the future.
|
||||
|
||||
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
@ -79,17 +78,33 @@ AC_DEFUN(S48_USCORE, [
|
|||
AC_CACHE_VAL(s48_cv_uscore,[
|
||||
echo "main(){int i=1;}
|
||||
fnord(){int i=23; int ltuae=42;}" > conftest.c
|
||||
${CC} conftest.c > /dev/null
|
||||
${CC} -o a.out conftest.c > /dev/null
|
||||
if (nm a.out | grep _fnord) > /dev/null; then
|
||||
s48_cv_uscore=yes
|
||||
else
|
||||
s48_cv_uscore=no
|
||||
fi])
|
||||
AC_MSG_RESULT($s48_cv_uscore)
|
||||
rm -f conftest.c a.out
|
||||
|
||||
if test $s48_cv_uscore = yes; then
|
||||
AC_DEFINE(USCORE)
|
||||
|
||||
if test $ac_cv_func_dlopen = yes ; then
|
||||
AC_MSG_CHECKING(whether dlsym always adds an underscore for us)
|
||||
AC_CACHE_VAL(s48_cv_dlsym_adds_uscore,AC_TRY_RUN( [
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
fnord() { int i=42;}
|
||||
main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
|
||||
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
|
||||
if(ptr1 && !ptr2) exit(0); } exit(1); }
|
||||
], [s48_cv_dlsym_adds_uscore=yes
|
||||
AC_DEFINE(DLSYM_ADDS_USCORE) ], s48_cv_dlsym_adds_uscore=no))
|
||||
|
||||
AC_MSG_RESULT($s48_cv_dlsym_adds_uscore)
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.c a.out
|
||||
])
|
||||
|
||||
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
@ -151,22 +166,40 @@ AC_DEFUN(SCSH_GMTOFF,[
|
|||
])
|
||||
|
||||
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
AC_DEFUN(SCSH_LINUX_ELF, [
|
||||
AC_MSG_CHECKING(for Linux using ELF)
|
||||
AC_CACHE_VAL(scsh_cv_linux_elf,[
|
||||
AC_DEFUN(SCSH_ELF, [
|
||||
AC_MSG_CHECKING(for ELF)
|
||||
AC_CACHE_VAL(scsh_cv_elf,[
|
||||
touch conftest.c
|
||||
if ${CC} -v conftest.c 2>&1 | grep -q __ELF__ ; then
|
||||
scsh_cv_linux_elf=yes
|
||||
if ${CC} -v -o a.out conftest.c 2>&1 | grep -q __ELF__ ; then
|
||||
scsh_cv_elf=yes
|
||||
else
|
||||
scsh_cv_linux_elf=no
|
||||
scsh_cv_elf=no
|
||||
fi])
|
||||
AC_MSG_RESULT($scsh_cv_linux_elf)
|
||||
if test $scsh_cv_linux_elf = yes; then
|
||||
AC_MSG_RESULT($scsh_cv_elf)
|
||||
if test $scsh_cv_elf = yes; then
|
||||
LDFLAGS=-rdynamic
|
||||
fi
|
||||
rm -f conftest.c a.out
|
||||
])
|
||||
|
||||
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
AC_DEFUN(SCSH_LINUX_STATIC_DEBUG, [
|
||||
case "$host" in
|
||||
*-*-linux* )
|
||||
AC_MSG_CHECKING(for broken Linux that needs -static with -g)
|
||||
AC_CACHE_VAL(scsh_cv_linux_static_debug,[
|
||||
AC_TRY_LINK([],
|
||||
[],
|
||||
scsh_cv_linux_static_debug=no,
|
||||
scsh_cv_linux_static_debug=yes)])
|
||||
AC_MSG_RESULT($scsh_cv_linux_static_debug)
|
||||
if test $scsh_cv_linux_static_debug = yes; then
|
||||
LDFLAGS="-static ${LDFLAGS}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
dnl -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
AC_DEFUN(SCSH_CONST_SYS_ERRLIST,[
|
||||
AC_MSG_CHECKING(for const sys_errlist)
|
||||
|
@ -190,8 +223,22 @@ AC_CANONICAL_HOST
|
|||
|
||||
AC_PROG_CC
|
||||
AC_ISC_POSIX
|
||||
SCSH_LINUX_STATIC_DEBUG
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
AC_C_CONST
|
||||
AC_CYGWIN
|
||||
AC_EXEEXT
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
if test $ac_cv_c_bigendian = no ; then
|
||||
ENDIAN=little
|
||||
else
|
||||
ENDIAN=big
|
||||
fi
|
||||
|
||||
AR=${AR-"ar cq"}
|
||||
TMPDIR=${TMPDIR-"/usr/tmp"}
|
||||
|
||||
case "$host" in
|
||||
|
||||
|
@ -215,6 +262,7 @@ case "$host" in
|
|||
## HP 9000 series 700 and 800, running HP/UX
|
||||
hppa*-hp-hpux* )
|
||||
dir=hpux
|
||||
LDFLAGS="-Wl,-E"
|
||||
if test ${CC} = cc; then
|
||||
CFLAGS="-Ae -O +Obb1800"
|
||||
AC_DEFINE(_HPUX_SOURCE)
|
||||
|
@ -238,13 +286,15 @@ case "$host" in
|
|||
## Linux
|
||||
*-*-linux* )
|
||||
dir=linux
|
||||
LIBS=-lm
|
||||
SCSH_LINUX_ELF
|
||||
# gross, but needed for some older a.out systems for 0.4.x
|
||||
LIBS=-lc
|
||||
SCSH_ELF
|
||||
;;
|
||||
|
||||
## NetBSD (maybe FreeBSD and 386BSD also)
|
||||
## NetBSD and FreeBSD ( and maybe 386BSD also)
|
||||
*-*-*bsd* )
|
||||
dir=bsd
|
||||
SCSH_ELF
|
||||
;;
|
||||
|
||||
## NeXT
|
||||
|
@ -266,12 +316,17 @@ case "$host" in
|
|||
dir=sunos
|
||||
;;
|
||||
|
||||
## Solaris
|
||||
sparc*-sun-solaris* )
|
||||
## Solaris - Sparc and i386
|
||||
*-*-solaris* )
|
||||
dir=solaris
|
||||
AC_DEFINE(HAVE_NLIST)
|
||||
;;
|
||||
|
||||
## NT - cygwin32
|
||||
*-*-cygwin32* )
|
||||
dir=cygwin32
|
||||
;;
|
||||
|
||||
## Generic Configuration
|
||||
* )
|
||||
dir=generic
|
||||
|
@ -282,10 +337,10 @@ case "$host" in
|
|||
;;
|
||||
esac
|
||||
|
||||
/bin/rm -f $srcdir/scsh/machine
|
||||
rm -f $srcdir/scsh/machine
|
||||
ln -s $srcdir/$dir $srcdir/scsh/machine
|
||||
|
||||
AC_CHECK_LIB(m, sqrt(0.0) + t)
|
||||
AC_CHECK_LIB(m, sqrt)
|
||||
AC_CHECK_LIB(gen, pathfind)
|
||||
AC_CHECK_LIB(nsl, gethostbyaddr)
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
|
@ -293,10 +348,13 @@ dnl Solaris 2.3 seems to need -lelf for nlist(). (tnx Bryan O'Sullivan)
|
|||
AC_CHECK_LIB(elf, nlist)
|
||||
AC_CHECK_LIB(ld, ldopen)
|
||||
AC_CHECK_LIB(dl, dlopen)
|
||||
AC_CHECK_LIB(dld, shl_findsym)
|
||||
dnl AC_CHECK_LIB(mld, main)
|
||||
|
||||
AC_RETSIGTYPE
|
||||
AC_HAVE_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h)
|
||||
AC_HAVE_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h)
|
||||
AC_HAVE_HEADERS(sys/un.h)
|
||||
AC_HAVE_FUNCS(strerror)
|
||||
AC_HAVE_FUNCS(dlopen gettimeofday ftime nlist select setitimer sigaction)
|
||||
AC_HAVE_FUNCS(socket chroot)
|
||||
|
||||
|
@ -312,10 +370,24 @@ SCSH_CONST_SYS_ERRLIST
|
|||
|
||||
CFLAGS1=${CFLAGS}
|
||||
|
||||
if test "$CYGWIN" = yes; then
|
||||
SCSHODBCLIBS=-lodbc32
|
||||
SCSHODBCOBJS="\$(ODBCOBJS)"
|
||||
fi
|
||||
|
||||
AC_SUBST(AIX_P)
|
||||
AC_SUBST(AR)
|
||||
AC_SUBST(CC)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CFLAGS1)
|
||||
AC_SUBST(EXEEXT)
|
||||
AC_SUBST(ENDIAN)
|
||||
AC_SUBST(LDFLAGS)
|
||||
AC_SUBST(LDFLAGS_AIX)
|
||||
AC_SUBST(LIBS)
|
||||
AC_SUBST(SCSHODBCLIBS)
|
||||
AC_SUBST(SCSHODBCOBJS)
|
||||
AC_SUBST(TMPDIR)
|
||||
|
||||
AC_OUTPUT(Makefile scsh/regexp/Makefile)
|
||||
AC_OUTPUT(Makefile scsh/regexp/Makefile scsh/endian.scm scsh/static.scm)
|
||||
chmod +x scsh/static.scm
|
||||
|
|
|
@ -85,7 +85,20 @@
|
|||
(eval form env)
|
||||
(loop))))))))
|
||||
|
||||
(define load-quietly load-into) ; For scsh.
|
||||
;;; For scsh.
|
||||
;;; Identical to LOAD-INTO, but accepts either a filename or port.
|
||||
|
||||
(define (load-quietly from env)
|
||||
(let ((doit (lambda (port)
|
||||
(let loop ()
|
||||
(let ((form (read port)))
|
||||
(cond ((eof-object? form))
|
||||
(else
|
||||
(eval form env)
|
||||
(loop))))))))
|
||||
(if (input-port? from) (doit from)
|
||||
(call-with-input-file from doit))))
|
||||
|
||||
|
||||
(define (eval-from-file forms env filename)
|
||||
(for-each (lambda (form) (eval form env)) forms))
|
||||
|
|
|
@ -245,11 +245,15 @@
|
|||
(package->environment package)
|
||||
filename))
|
||||
|
||||
(define (load-quietly filename package)
|
||||
(eval-nodes (really-scan-file filename package #f) ; No noise. For scsh.
|
||||
(package->environment package)
|
||||
filename))
|
||||
|
||||
(define (load-quietly from package) ; No noise. For scsh.
|
||||
(display from)
|
||||
(if (string? from)
|
||||
(eval-nodes (really-scan-file from package #f)
|
||||
(package->environment package)
|
||||
from)
|
||||
(eval-nodes (really-scan-port from package)
|
||||
(package->environment package)
|
||||
#f)))
|
||||
|
||||
(define (eval-from-file forms p file) ;Scheme 48 internal thing
|
||||
(eval-forms forms p file))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Date: Fri, 25 Jun 93 13:31:50 -0400
|
||||
From: Jonathan Rees <jar@martigny.ai.mit.edu>
|
||||
From: Jonathan Rees <jar@zurich.ai.mit.edu>
|
||||
To: sheldon@lcs.mit.edu
|
||||
Cc: jar@martigny.ai.mit.edu
|
||||
Cc: jar@zurich.ai.mit.edu
|
||||
Subject: call-back
|
||||
Message-Id: <9306251331.aa11673@mintaka.lcs.mit.edu>
|
||||
|
||||
|
|
177
doc/cheat.txt
177
doc/cheat.txt
|
@ -1,11 +1,13 @@
|
|||
Scsh cheat sheet
|
||||
Olin Shivers
|
||||
November 1994
|
||||
November 1996
|
||||
|
||||
This cheat sheet is intentionally kept brief and minimalist.
|
||||
It is intended to function as an ASCII-format reminder for the
|
||||
full manual, not as the definition. It can be read using GNU Emacs's
|
||||
outline mode.
|
||||
|
||||
It is also not entirely up-to-date. I'd appreciate getting updates from users.
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
* High-level forms
|
||||
|
@ -32,7 +34,7 @@ Subforms are implicitly backquoted.
|
|||
|
||||
Using process forms in Scheme:
|
||||
(exec-epf . EPF) ; Nuke the current process.
|
||||
(& . EPF) ; Fork process in background. Return pid.
|
||||
(& . EPF) ; Fork process in background. Return proc object.
|
||||
(run . EPF) ; Run process. Return exit code.
|
||||
|
||||
(& . EPF) = (fork (lambda () (exec-epf . EPF)))
|
||||
|
@ -67,8 +69,8 @@ run/file*, that take thunk arguments for the subprocess.
|
|||
a port read returns EOF, the current set of seed values are
|
||||
returned as multiple values.
|
||||
|
||||
(run/port+pid . EPF) -> [port fixnum]
|
||||
(run/port+pid* THUNK) -> [port fixnum]
|
||||
(run/port+proc . EPF) -> [port proc]
|
||||
(run/port+proc* THUNK) -> [port proc]
|
||||
|
||||
(run/collecting FDS . EPF) -> [port ...]
|
||||
(run/collecting* FDS THUNK) -> [port ...]
|
||||
|
@ -113,10 +115,13 @@ run/file*, that take thunk arguments for the subprocess.
|
|||
(with-current-output-port* port thunk) -> value(s) of thunk
|
||||
(with-error-output-port* port thunk) -> value(s) of thunk
|
||||
|
||||
(close port/fd)
|
||||
(close fd/port)
|
||||
|
||||
(stdports->stdio)
|
||||
(stdio->stdports THUNK)
|
||||
(stdio->stdports)
|
||||
|
||||
(with-stdio-ports* thunk) -> value(s) of thunk
|
||||
(with-stdio-ports . body) -> value(s) of body
|
||||
|
||||
(make-string-input-port) -> port
|
||||
(string-output-port-output port) -> port
|
||||
|
@ -136,10 +141,10 @@ run/file*, that take thunk arguments for the subprocess.
|
|||
|
||||
** Unix I/O
|
||||
|
||||
(dup port/fd [newfd]) -> port/fd
|
||||
(dup->inport port/fd [newfd]) -> port
|
||||
(dup->outport port/fd [newfd]) -> port
|
||||
(dup->fdes port/fd [newfd]) -> fd
|
||||
(dup fd/port [newfd]) -> fd/port
|
||||
(dup->inport fd/port [newfd]) -> port
|
||||
(dup->outport fd/port [newfd]) -> port
|
||||
(dup->fdes fd/port [newfd]) -> fd
|
||||
|
||||
(file-seek fd/port offset whence)
|
||||
|
||||
|
@ -148,16 +153,24 @@ run/file*, that take thunk arguments for the subprocess.
|
|||
(open-output-file fname [flags perms]) -> port
|
||||
(open-fdes fname flags [perms]) -> integer
|
||||
|
||||
Open flags:
|
||||
open/read ; You may only
|
||||
open/write ; choose one
|
||||
open/read+write ; of these three
|
||||
open/no-control-tty
|
||||
open/nonblocking
|
||||
open/append
|
||||
open/create
|
||||
open/truncate
|
||||
open/exclusive
|
||||
(fdes-flags fd/port)
|
||||
(set-fdes-flags fd/port flags)
|
||||
Only Posix flag defined is FDFLAGS/CLOSE-ON-EXEC, which you should
|
||||
not ever have to use -- scsh manages this automatically.
|
||||
|
||||
(fdes-status fd/port)
|
||||
(set-fdes-flags fd/port flags)
|
||||
|
||||
Operations allowed Flags
|
||||
------------------ -----
|
||||
Open+get+set open/append, open/non-blocking
|
||||
open/async, open/fsync (non-Posix)
|
||||
|
||||
Open+get open/read, open/write, open/read+write
|
||||
open/access-mask
|
||||
|
||||
Open only open/create, open/exclusive,
|
||||
open/no-control-tty, open/truncate
|
||||
|
||||
(pipe) -> [rport wport]
|
||||
(read-line [fd/port retain-newline?]) -> string or eof-object
|
||||
|
@ -171,6 +184,27 @@ Open flags:
|
|||
(write-string/partial string [fd/port start end]) -> nwritten
|
||||
(force-output [fd/port])
|
||||
|
||||
** File locking
|
||||
(define-record lock-region
|
||||
exclusive? ; write or read lock?
|
||||
start ; integer: start, end & whence
|
||||
end ; integer: define the region being locked.
|
||||
whence ; The value of SEEK/SET, SEEK/DELTA, or SEEK/END.
|
||||
proc) ; A proc object for the process locking the region.
|
||||
|
||||
(make-lock-region exclusive? start len [whence]) -> lock-region
|
||||
WHENCE defaults to the value of SEEK/SET.
|
||||
|
||||
(lock-region fdes lock)
|
||||
(lock-region/no-block fdes lock)
|
||||
|
||||
(get-lock-region fdes lock) -> lock-region or #f
|
||||
|
||||
(unlock-region fdes lock)
|
||||
|
||||
(with-region-lock* fdes lock thunk)
|
||||
(with-region-lock fdes lock body ...) Syntax
|
||||
|
||||
** File system
|
||||
(create-directory fname [perms override?])
|
||||
(create-fifo fname [perms override?])
|
||||
|
@ -223,7 +257,7 @@ Derived procedures:
|
|||
file-last-status-change ctime
|
||||
|
||||
(file-not-readable? fname) -> boolean
|
||||
(file-not-writeable? fname) -> boolean
|
||||
(file-not-writable? fname) -> boolean
|
||||
(file-not-executable? fname) -> boolean
|
||||
|
||||
Returns one of
|
||||
|
@ -271,16 +305,16 @@ Derived procedures:
|
|||
|
||||
(suspend)
|
||||
|
||||
(fork [thunk]) -> pid or #d
|
||||
(%fork [thunk]) -> pid or #f
|
||||
(fork [thunk]) -> proc or #d
|
||||
(%fork [thunk]) -> proc or #f
|
||||
|
||||
(fork/pipe [thunk]) -> pid or #f
|
||||
(%fork/pipe [thunk]) -> pid or #f
|
||||
(fork/pipe [thunk]) -> proc or #f
|
||||
(%fork/pipe [thunk]) -> proc or #f
|
||||
|
||||
(fork/pipe+ conns [thunk]) pid or #f
|
||||
(%fork/pipe+ conns [thunk]) pid or #f
|
||||
(fork/pipe+ conns [thunk]) proc or #f
|
||||
(%fork/pipe+ conns [thunk]) proc or #f
|
||||
|
||||
(wait [pid]) -> status [pid]
|
||||
(wait proc/pid [flags]) -> status [proc]
|
||||
|
||||
(call-terminally thunk)
|
||||
|
||||
|
@ -298,8 +332,8 @@ Derived procedures:
|
|||
|
||||
(pid) -> fixnum
|
||||
(parent-pid) -> fixnum
|
||||
(process-group [pid]) -> fixnum
|
||||
(set-process-group [pid] pgrp)
|
||||
(process-group) -> fixnum
|
||||
(set-process-group [proc/pid] pgrp)
|
||||
|
||||
(user-login-name) -> string
|
||||
(user-uid) -> fixnum
|
||||
|
@ -356,11 +390,72 @@ command-line-arguments
|
|||
|
||||
** Signal system
|
||||
|
||||
(signal-process pid sig)
|
||||
(signal-process proc/pid sig)
|
||||
(signal-procgroup prgrp sig)
|
||||
(pause-until-interrupt)
|
||||
(sleep secs)
|
||||
|
||||
Non-signal S48 interrupts
|
||||
-------------------------
|
||||
interrupt/memory-shortage
|
||||
|
||||
Posix signals with S48 interrupts
|
||||
------------------------------
|
||||
signal/alrm interrupt/alrm (aka interrupt/alarm)
|
||||
signal/int interrupt/int (aka interrupt/int)
|
||||
signal/chld interrupt/chld
|
||||
signal/cont interrupt/cont
|
||||
signal/hup interrupt/hup
|
||||
signal/quit interrupt/quit
|
||||
signal/term interrupt/term
|
||||
signal/tstp interrupt/tstp
|
||||
signal/usr1 interrupt/usr1
|
||||
signal/usr2 interrupt/usr2
|
||||
|
||||
signal/info interrupt/info Non-Posix
|
||||
signal/io interrupt/io Non-Posix
|
||||
signal/poll interrupt/poll Non-Posix
|
||||
signal/prof interrupt/prof Non-Posix
|
||||
signal/pwr interrupt/pwr Non-Posix
|
||||
signal/urg interrupt/urg Non-Posix
|
||||
signal/vtalrm interrupt/vtalrm Non-Posix
|
||||
signal/winch interrupt/winch Non-Posix
|
||||
signal/xcpu interrupt/xcpu Non-Posix
|
||||
signal/xfsz interrupt/xfsz Non-Posix
|
||||
|
||||
Synchronous and uncatchable signals
|
||||
-----------------------------------
|
||||
signal/stop Uncatchable Posix
|
||||
signal/kill Uncatchable Posix
|
||||
|
||||
signal/abrt Synchronous Posix
|
||||
signal/fpe Synchronous Posix
|
||||
signal/ill Synchronous Posix
|
||||
signal/pipe Synchronous Posix
|
||||
signal/segv Synchronous Posix
|
||||
signal/ttin Synchronous Posix
|
||||
signal/ttou Synchronous Posix
|
||||
|
||||
signal/bus Synchronous BSD + SVR4
|
||||
signal/emt Synchronous BSD + SVR4
|
||||
signal/iot Synchronous BSD + SVR4
|
||||
signal/sys Synchronous BSD + SVR4
|
||||
signal/trap Synchronous BSD + SVR4
|
||||
|
||||
** Interrupt handlers
|
||||
(signal->interrupt sig) -> interrupt
|
||||
(interrupt-set integer1 ...) -> integer
|
||||
|
||||
(enabled-interrupts) -> integer
|
||||
(set-enabled-interrupts! integer) -> integer
|
||||
|
||||
(with-enabled-interrupts interrupt-set body ...) Syntax
|
||||
(with-enabled-interrupts* interrupt-set thunk)
|
||||
|
||||
(set-interrupt-handler! interrupt handler) -> old-handler
|
||||
(interrupt-handler interrupt) -> handler
|
||||
HANDLER is #f (ignored), #t (default), or (lambda (enabled-ints) ...) proc.
|
||||
|
||||
** Time
|
||||
|
||||
(define-record date
|
||||
|
@ -532,7 +627,7 @@ socket/receive-timeout
|
|||
** Regular expressions
|
||||
|
||||
(string-match regexp string [start]) -> match or false
|
||||
(regexp-match obj) -> boolean
|
||||
(regexp-match? obj) -> boolean
|
||||
(match:start match [match-number]) -> fixnum
|
||||
(match:end match [match-number]) -> fixnum
|
||||
(match:substring match [match-number]) -> string
|
||||
|
@ -605,8 +700,22 @@ socket/receive-timeout
|
|||
|
||||
* Running scsh
|
||||
|
||||
scsh [end-option arg1 ...]
|
||||
end-option: -s script
|
||||
scsh [meta-arg] [switch1 ...] [end-option arg1 ...]
|
||||
meta-arg: \ <script-file-name>
|
||||
|
||||
switch: -e <entry-point> Top-level entry point
|
||||
-o <structure> Open structure in current package.
|
||||
-m <structure> Switch to package.
|
||||
-n <new-package> Switch to new package.
|
||||
|
||||
-lm <module> <file-name> Load module into config package.
|
||||
-l <file-name> Load file into current package.
|
||||
-dm Do script module.
|
||||
-ds Do script.
|
||||
|
||||
end-option: -s <script> Specifies script to load.
|
||||
-sfd <num> Script from file descriptor <num>.
|
||||
-c <expression> Eval <expression> and exit.
|
||||
--
|
||||
|
||||
scshvm [meta-arg] [vm-options] [end-option arg1 ...]
|
||||
|
|
Binary file not shown.
|
@ -6,7 +6,7 @@ Here are some remarks to complement what's in the INSTALL file.
|
|||
|
||||
When running "make", don't worry if the ".notify" target fails. Its
|
||||
only purpose is to send an email message to
|
||||
scheme-48-notifications@martigny.ai.mit.edu, so that we can get a
|
||||
scheme-48-notifications@zurich.ai.mit.edu, so that we can get a
|
||||
rough idea of how much Scheme 48 is being used and by whom. We
|
||||
promise not to use your name or email address for any commercial
|
||||
purpose. If you don't want us to know, just do "make -t .notify"
|
|
@ -26,7 +26,7 @@ scsh/generic which you can copy as a base to modify. The modifications
|
|||
mainly involve pulling some constants in from C header files and hacking
|
||||
a few lines of C based on your standard I/O internals. I know, its C and
|
||||
all, together we can survive. If you need some hand holding, feel free
|
||||
to write to the scsh mailing list at scsh@martigny.ai.mit.edu.
|
||||
to write to the scsh mailing list at scsh@zurich.ai.mit.edu.
|
||||
|
||||
stdio_dep.c:
|
||||
This is the one C file you have to actually deal with. The code in here
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
Scsh time interface
|
||||
Olin Shivers
|
||||
November, 1994
|
||||
|
||||
* Discussion
|
||||
|
||||
Jargon:
|
||||
"UTC" and "UCT" stand for "universal coordinated time," which is the
|
||||
official name for what is colloquially referred to as "Greenwich Mean
|
||||
Time."
|
||||
|
||||
Posix allows a single time zone to specify *two* different offsets from
|
||||
UTC: one standard one, and one for "summer time." Summer time is frequently
|
||||
some sort of daylight savings time.
|
||||
|
||||
The scsh time package consistently uses this jargon: we never say
|
||||
"gmt" or "dst;" we always say "utc" and "summer time."
|
||||
|
||||
We have two types: time and date.
|
||||
|
||||
A TIME specifies an instant in the history of the universe.
|
||||
It is location and time-zone independent. A time is specified
|
||||
by giving the number of elapsed seconds since the Unix "epoch"
|
||||
(Midnight, January 1, 1970 UTC).
|
||||
|
||||
A DATE is a name for an instant in time that is specified
|
||||
relative to some location/time-zone in the world, for example
|
||||
Friday October 31, 1994 3:47:21 pm
|
||||
What instant this date specifies depends on where you are. If I phone a Hong
|
||||
Kong friend from Cambridge, Massachusetts, then the current TIME is the same
|
||||
for both of us, but it has different DATES -- Hong Kong is 12 hours ahead
|
||||
of Cambridge.
|
||||
|
||||
(define-record date ; A Posix tm struct
|
||||
seconds ; Seconds after the minute (0-59)
|
||||
minute ; Minutes after the hour (0-59)
|
||||
hour ; Hours since midnight (0-23)
|
||||
month-day ; Day of the month (1-31)
|
||||
month ; Months since January (0-11)
|
||||
year ; Years since 1900
|
||||
summer? ; Summer (e.g., Daylight Savings) time in effect?
|
||||
week-day ; Days since Sunday (0-6) These two fields
|
||||
year-day) ; Days since Jan. 1 (0-365) are redundant.
|
||||
|
||||
(make-date seconds minute hour month-day month year
|
||||
[summer? week-day year-day])
|
||||
When making a DATE, the last three elements of the record are optional,
|
||||
and default to #f, 0, and 0 respectively. This is useful when creating
|
||||
a DATE record to pass to TIME->DATE.
|
||||
|
||||
Notice that the value of SUMMER? resolves amiguous boundary cases. For
|
||||
example, on the morning of the Fall daylight savings change-over, 1:00am -
|
||||
2:00am happens twice. Hence the date 1:30:00 on this morning can specify two
|
||||
different seconds; the SUMMER? flag says which one.
|
||||
|
||||
Specifying time zones:
|
||||
Several time procedures time time zones as arguments. When optional,
|
||||
the time zone defaults to local time zone. Otherwise the time zone
|
||||
can be one of:
|
||||
#f Local time
|
||||
Integer Seconds of offset from UTC. For example,
|
||||
New York City is -18000 (-5 hours), San Francisco
|
||||
is -28800 (-8 hours).
|
||||
String A Posix time zone string understood by the OS
|
||||
(i.e., the sort of time zone assigned to the $TZ
|
||||
environment variable).
|
||||
An integer time zone gives the number of seconds you must add to UTC
|
||||
to get time in that zone. It is *not* "seconds west" of UTC -- that flips
|
||||
the sign.
|
||||
|
||||
To get UTC time, use a time zone of either 0 or "UCT0".
|
||||
|
||||
|
||||
* Procedures
|
||||
|
||||
(utime) -> [secs usecs]
|
||||
The current time. UTIME provies micro-second resolution.
|
||||
Sub-second resolution is not provided by Posix, but is in BSD.
|
||||
If the OS does not support sub-second resolution, the USECS value
|
||||
is always 0.
|
||||
|
||||
(date) -> date
|
||||
The current date, in the local time zone.
|
||||
(date [time tz]) -> date
|
||||
Converts the time to the date as specified by the time zone TZ.
|
||||
TIME defaults to the current time; TZ defaults to local time,
|
||||
and is as described above.
|
||||
|
||||
(time) -> int
|
||||
The current time.
|
||||
(time [date tz]) -> int
|
||||
Converts a date to a time as specified by the time zone TZ.
|
||||
DATE defaults to the current date; TZ defaults to local time,
|
||||
and is as described above.
|
||||
|
||||
A DATE record is overconstrained; TIME ignores the DATE's
|
||||
WEEK-DAY and YEAR-DAY fields.
|
||||
|
||||
When passed to TIME, the SUMMER? field has the following meaning:
|
||||
#f Resolve an ambiguous time in favor of non-summer time.
|
||||
#t Resolve an ambiguous time in favor of summer time.
|
||||
This is useful in boundary cases during the change-over. For example,
|
||||
in the Fall, when US daylight savings time changes over at 2:00 am,
|
||||
1:30 am happens twice -- it names two instants in time, an hour apart.
|
||||
|
||||
Outside of these boundary cases, the SUMMER? flag is *ignored*. For
|
||||
example, if the standard/summer change-overs happen in the Fall and the
|
||||
Spring, then the value of SUMMER? is ignored for a January or July date.
|
||||
A January date would be resolved with standard time, and a July date with
|
||||
summer time, regardless of the SUMMER? value.
|
||||
|
||||
The SUMMER? flag is also ignored if the time zone doesn't have a summer
|
||||
time -- for example, an integer time zone, or simple UTC.
|
||||
|
||||
|
||||
(date->string date) -> string
|
||||
(time->string time [tz]) -> string
|
||||
(format-date fmt date [tz]) -> string
|
||||
These have Posix analogs. FORMAT-DATE's time zone argument is only
|
||||
used when one requests the time zone in the formatted string.
|
||||
|
||||
(utc-offset [time tz])
|
||||
Returns the offset from UTC of time zone TZ at instant TIME.
|
||||
TIME defaults to the current time; TZ defaults to local time,
|
||||
and is as specified above.
|
||||
|
||||
The offset is the number of seconds you add to UTC time to get
|
||||
local time.
|
||||
|
||||
Note: Be aware that other time interfaces (e.g., the BSD C interface)
|
||||
give offsets as seconds *west* of UTC, which flips the sign. The scsh
|
||||
definition is chosen for arithmetic simplicity. It's easy to remember
|
||||
the definition of the offset: what you add to UTC to get local.
|
||||
|
||||
(time-zone [summer? tz])
|
||||
Returns the name of the time zone as a string. SUMMER? is
|
||||
used to choose between the summer name and the standard name (e.g.,
|
||||
"EST" and "EDT"). SUMMER? is interpreted as follows:
|
||||
Integer A TIME value. The variant in use at that time
|
||||
is returned.
|
||||
#f The standard time name is returned.
|
||||
Otherwise The summer time name is returned.
|
||||
SUMMER? defaults to the case that pertains at the time of the call.
|
||||
It is ignored if the time zone doesn't have a summer variant.
|
||||
|
||||
We need a general date/time parser.
|
||||
|
||||
DATE has two more fields: tz-secs and tz-name.
|
||||
TIME->DATE: These are set.
|
||||
tz-secs is the offset from UTC for the instant this date specifies.
|
||||
It includes summer time adjustments.
|
||||
|
||||
TZ=#f: tz-name is constructed from tzname[] and tz-secs.
|
||||
TZ string: tz-name is constructed from tzname[] and tz-secs.
|
||||
TZ int: tz-name is of form UTChh:mm:ss ?? or #f ??
|
||||
|
||||
DATE->TIME:
|
||||
tz-secs integer: It is used for conversion.
|
||||
summer? is ignored.
|
||||
otw: time zone taken from tz-name, with #f meaning "local time."
|
||||
summer? is used, if the time zone is a dual one.
|
18463
doc/scsh-manual.ps
18463
doc/scsh-manual.ps
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,5 @@
|
|||
*.aux *.log
|
||||
*.idx *.ilg *.ind *.dvi
|
||||
.,*
|
||||
*.toc
|
||||
man.ps
|
|
@ -0,0 +1,37 @@
|
|||
.SUFFIXES: .idx .ind .tex .dvi .ps $(.SUFFIXES)
|
||||
|
||||
TEX= front.tex intro.tex procnotation.tex syscalls.tex network.tex \
|
||||
strings.tex awk.tex miscprocs.tex running.tex todo.tex
|
||||
|
||||
|
||||
man.dvi: $(TEX) man.ind
|
||||
man.ind: man.idx
|
||||
|
||||
.dvi.ps:
|
||||
dvips -o $@ $<
|
||||
|
||||
.tex.dvi:
|
||||
latex $<
|
||||
rm $*.log
|
||||
|
||||
.idx.ind:
|
||||
makeindex $<
|
||||
|
||||
clean:
|
||||
-rm *.log
|
||||
|
||||
INSTALL_DATA= install -c -m 644
|
||||
|
||||
tar:
|
||||
tar cf - *.tex sty | gzip > man.tar.gz
|
||||
|
||||
|
||||
install: man.ps
|
||||
@echo WARNING:
|
||||
@echo WARNING: this depends on /u/su/scsh/scsh
|
||||
@echo WARNING: pointing to the current release
|
||||
@echo WARNING:
|
||||
$(INSTALL_DATA) cheat.txt /u/su/scsh/scsh/doc/
|
||||
$(INSTALL_DATA) man.ps /u/su/scsh/scsh/doc/scsh-manual.ps
|
||||
$(INSTALL_DATA) $(TEX) /u/su/scsh/scsh/doc/scsh-manual/
|
||||
$(INSTALL_DATA) sty/* /u/su/scsh/scsh/doc/scsh-manual/sty/
|
|
@ -0,0 +1,35 @@
|
|||
Michel.Schinz@studi.epfl.ch
|
||||
Documentation error in STRING-OUTPUT-PORT-OUTPUT.
|
||||
Reported 12/19.
|
||||
|
||||
Victor Zandy
|
||||
character-gobbling in (record-reader) caused by 'trim / 'peek
|
||||
default misunderstanding in delimited readers. Fixed 4/5/96
|
||||
|
||||
Michael Becker
|
||||
reap-policy = early can still lose if you loop and fork.
|
||||
fork now reaps & retries if it loses and the policy is early reap.
|
||||
This is a kludge until I have sigchld handlers.
|
||||
Fixed 4/5/96
|
||||
|
||||
Tod Olson
|
||||
Reported painfully slow delimited-reader I/O in November.
|
||||
|
||||
Michel.Schinz@studi.epfl.ch
|
||||
Reported some picky little typos in the manual.
|
||||
|
||||
Shriram
|
||||
Doc bugs in defrec.scm
|
||||
|
||||
euler@lavielle.COM (Lutz Euler) 2/24/97
|
||||
Manual bugs and a bug in stdio->stdports.
|
||||
|
||||
Alan Bawden 4/97
|
||||
Lots of good bug reports and fixes.
|
||||
|
||||
Jim Blandy 4/97
|
||||
Fixes for meta.scm
|
||||
|
||||
Kevin Esler 4/97
|
||||
Updated Irix port
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
Acknowledgements
|
||||
|
||||
Who should I thank? My so-called "colleagues," who laugh at me behind my
|
||||
back, all the while becoming famous on *my* work? My worthless graduate
|
||||
students, whose computer skills appear to be limited to downloading bitmaps
|
||||
off of netnews? My parents, who are still waiting for me to quit "fooling
|
||||
around with computers," go to med school, and become a radiologist? My
|
||||
department chairman, a manager who gives one new insight into and sympathy for
|
||||
disgruntled postal workers?
|
||||
|
||||
My God, no one could blame me--no one!--if I went off the edge and just lost
|
||||
it completely one day. I couldn't get through the day as it is without the
|
||||
Prozac and Jack Daniels I keep on the shelf, behind my Tops-20 JSYS manuals.
|
||||
I start getting the shakes real bad around 10am, right before my advisor
|
||||
meetings. A 10 oz. Jack 'n Zac helps me get through the meetings without one
|
||||
of my students winding up with his severed head in a bowling-ball bag. They
|
||||
look at me funny; they think I twitch a lot. I'm not twitching. I'm
|
||||
controlling my impulse to snag my 9mm Sig-Sauer out from my day-pack and make
|
||||
a few strong points about the quality of undergraduate education in Amerika.
|
||||
|
||||
If I thought anyone cared, if I thought anyone would even be reading this, I'd
|
||||
probably make an effort to keep up appearances until the last possible
|
||||
moment. But no one does, and no one will. So I can pretty much say exactly
|
||||
what I think.
|
||||
|
||||
Oh, yes, the *acknowledgements.* I think not. I did it. I did it all,
|
||||
by myself.
|
||||
|
||||
Olin Shivers
|
||||
Cambridge
|
||||
September 4, 1994
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
%%
|
||||
%% This is file `/usr2/distrib/latex209/nfss/array.sty' generated
|
||||
%% on <1991/11/22> with the docstrip utility (v1.1k).
|
||||
%%
|
||||
%% The original source files were:
|
||||
%%
|
||||
%% /usr2/users/latex3/source/array/array.doc
|
||||
|
||||
%%
|
||||
%% Copyright (C) 1989,1990,1991 by Frank Mittelbach, Rainer Schoepf.
|
||||
%% All rights reserved.
|
||||
%%
|
||||
%% This file is part of the NFSS (New Font Selection Scheme) package.
|
||||
%%
|
||||
%% IMPORTANT NOTICE:
|
||||
%%
|
||||
%% You are not allowed to change this file. You may however copy this file
|
||||
%% to a file with a different name and then change the copy if you obey
|
||||
%% the restrictions on file changes described in readme.mz.
|
||||
%%
|
||||
%% You are allowed to distribute this file under the condition that it is
|
||||
%% distributed together with all files mentioned in readme.mz3. If you
|
||||
%% receive only some of these files from someone, complain!
|
||||
%%
|
||||
%% You are NOT ALLOWED to distribute this file alone. You are NOT ALLOWED
|
||||
%% to take money for the distribution or use of either this file or a
|
||||
%% changed version, except for a nominal charge for copying etc.
|
||||
%%
|
||||
%% For error reports in case of UNCHANGED versions see readme files.
|
||||
%%
|
||||
%% Please do not request updates from us directly. Distribution is done
|
||||
%% through Mail-Servers and TeX organizations.
|
||||
%%
|
||||
|
||||
\def\fileversion{v2.0e}
|
||||
\def\filedate{91/02/07}
|
||||
\def\docdate {90/08/20}
|
||||
|
||||
%% \CheckSum{681}
|
||||
%% \CharacterTable
|
||||
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
|
||||
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
|
||||
%% Digits \0\1\2\3\4\5\6\7\8\9
|
||||
%% Exclamation \! Double quote \" Hash (number) \#
|
||||
%% Dollar \$ Percent \% Ampersand \&
|
||||
%% Acute accent \' Left paren \( Right paren \)
|
||||
%% Asterisk \* Plus \+ Comma \,
|
||||
%% Minus \- Point \. Solidus \/
|
||||
%% Colon \: Semicolon \; Less than \<
|
||||
%% Equals \= Greater than \> Question mark \?
|
||||
%% Commercial at \@ Left bracket \[ Backslash \\
|
||||
%% Right bracket \] Circumflex \^ Underscore \_
|
||||
%% Grave accent \` Left brace \{ Vertical bar \|
|
||||
%% Right brace \} Tilde \~}
|
||||
%%
|
||||
\@ifundefined{d@llar}{}{\endinput}
|
||||
\typeout{Style-Option: `array' \fileversion
|
||||
\space\space <\filedate> (F.M.)}
|
||||
\typeout{English documentation dated \space <\docdate> (F.M.)}
|
||||
\def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}}
|
||||
\def\@testpach#1{\@chclass
|
||||
\ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
|
||||
\ifnum \@lastchclass=7 5 \else
|
||||
\ifnum \@lastchclass=8 \tw@ \else
|
||||
\ifnum \@lastchclass=9 \thr@@
|
||||
\else \z@
|
||||
\ifnum \@lastchclass = 10 \else
|
||||
\@chnum
|
||||
\if #1c\z@ \else
|
||||
\if #1l\@ne \else
|
||||
\if #1r\tw@ \else
|
||||
\z@ \@chclass
|
||||
\if#1|\@ne \else
|
||||
\if #1!6 \else
|
||||
\if #1@7 \else
|
||||
\if #1<8 \else
|
||||
\if #1>9 \else
|
||||
10
|
||||
\@chnum
|
||||
\if #1m\thr@@\else
|
||||
\if #1p4 \else
|
||||
\if #1b5 \else
|
||||
\z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
|
||||
\fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
|
||||
\def\@xexpast#1*#2#3#4\@@{%
|
||||
\@tempcnta #2
|
||||
\toks@={#1}\@temptokena={#3}%
|
||||
\let\the@toksz\relax \let\the@toks\relax
|
||||
\def\@tempa{\the@toksz}%
|
||||
\ifnum\@tempcnta >0 \@whilenum\@tempcnta >0\do
|
||||
{\edef\@tempa{\@tempa\the@toks}\advance \@tempcnta \m@ne}%
|
||||
\let \@tempb \@xexpast \else
|
||||
\let \@tempb \@xexnoop \fi
|
||||
\def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}%
|
||||
\edef\@tempa{\@tempa}%
|
||||
\expandafter \@tempb \@tempa #4\@@}
|
||||
\def\prepnext@tok{\advance \count@ \@ne
|
||||
\toks\count@={}}
|
||||
\def\save@decl{\toks\count@ \expandafter{\@nextchar}}
|
||||
\def\insert@column{%
|
||||
\the@toks \the \@tempcnta
|
||||
{\ignorespaces \@sharp \unskip}%
|
||||
\the@toks \the \count@ \relax}
|
||||
\newdimen\col@sep
|
||||
\def\@acol{\@addtopreamble{\hskip\col@sep}}
|
||||
\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
|
||||
\let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax
|
||||
\@xexpast #1*0x\@@
|
||||
\count@\m@ne
|
||||
\let\the@toks\relax
|
||||
\prepnext@tok
|
||||
\expandafter \@tfor \expandafter \@nextchar
|
||||
\expandafter :\expandafter =\@tempa \do
|
||||
{\@testpach\@nextchar
|
||||
\ifcase \@chclass \@classz \or \@classi \or \@classii
|
||||
\or \save@decl \or \or \@classv \or \@classvi
|
||||
\or \@classvii \or \@classviii \or \@classix
|
||||
\or \@classx \fi
|
||||
\@lastchclass\@chclass}%
|
||||
\ifcase\@lastchclass
|
||||
\@acol \or
|
||||
\or
|
||||
\@acol \or
|
||||
\@preamerr \thr@@ \or
|
||||
\@preamerr \tw@ \@addtopreamble\@sharp \or
|
||||
\or
|
||||
\else \@preamerr \@ne \fi
|
||||
\def\the@toks{\the\toks}}
|
||||
\def\@classx{%
|
||||
\ifcase \@lastchclass
|
||||
\@acolampacol \or
|
||||
\@addamp \@acol \or
|
||||
\@acolampacol \or
|
||||
\or
|
||||
\@acol \@firstampfalse \or
|
||||
\@addamp
|
||||
\fi}
|
||||
\def\@classz{\@classx
|
||||
\@tempcnta \count@
|
||||
\prepnext@tok
|
||||
\@addtopreamble{\ifcase \@chnum
|
||||
\hfil
|
||||
\d@llar
|
||||
\insert@column
|
||||
\d@llar \hfil \or
|
||||
\d@llar \insert@column \d@llar \hfil \or
|
||||
\hfil\kern\z@ \d@llar \insert@column \d@llar \or
|
||||
$\vcenter
|
||||
\@startpbox{\@nextchar}\insert@column \@endpbox $\or
|
||||
\vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
|
||||
\vbox \@startpbox{\@nextchar}\insert@column \@endpbox
|
||||
\fi}\prepnext@tok}
|
||||
\def\@classix{\ifnum \@lastchclass = \thr@@
|
||||
\@preamerr \thr@@ \fi
|
||||
\@classx}
|
||||
\def\@classviii{\ifnum \@lastchclass >\z@
|
||||
\@preamerr 4\@chclass 6 \@classvi \fi}
|
||||
\def\@arrayrule{\@addtopreamble \vline}
|
||||
\def\@classvii{\ifnum \@lastchclass = \thr@@
|
||||
\@preamerr \thr@@ \fi}
|
||||
\def\@classvi{\ifcase \@lastchclass
|
||||
\@acol \or
|
||||
\@addtopreamble{\hskip \doublerulesep}\or
|
||||
\@acol \or
|
||||
\@classvii
|
||||
\fi}
|
||||
\def\@classii{\advance \count@ \m@ne
|
||||
\save@decl\prepnext@tok}
|
||||
\def\@classv{\save@decl
|
||||
\@addtopreamble{\d@llar\the@toks\the\count@\relax\d@llar}%
|
||||
\prepnext@tok}
|
||||
\def\@classi{\@classvi
|
||||
\ifcase \@chnum \@arrayrule \or
|
||||
\@classv \fi}
|
||||
\def\@startpbox#1{\bgroup
|
||||
\hsize #1 \@arrayparboxrestore
|
||||
\vrule \@height \ht\@arstrutbox \@width \z@}
|
||||
\def\@endpbox{\vrule \@width \z@ \@depth \dp \@arstrutbox \egroup}
|
||||
\def\@array[#1]#2{%
|
||||
\@tempdima \ht \strutbox
|
||||
\advance \@tempdima by\extrarowheight
|
||||
\setbox \@arstrutbox \hbox{\vrule
|
||||
\@height \arraystretch \@tempdima
|
||||
\@depth \arraystretch \dp \strutbox
|
||||
\@width \z@}%
|
||||
\begingroup
|
||||
\@mkpream{#2}%
|
||||
\xdef\@preamble{\ialign \@halignto
|
||||
\bgroup \@arstrut \@preamble
|
||||
\tabskip \z@ \cr}%
|
||||
\endgroup
|
||||
\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
|
||||
\bgroup
|
||||
\let \@sharp ##\let \protect \relax
|
||||
\lineskip \z@
|
||||
\baselineskip \z@
|
||||
\m@th
|
||||
\let\\ \@arraycr \let\par\@empty \@preamble}
|
||||
\newdimen \extrarowheight
|
||||
\extrarowheight=0pt
|
||||
\def\@arstrut{\unhcopy\@arstrutbox}
|
||||
\def\@arraycr{{\ifnum 0=`}\fi
|
||||
\@ifstar \@xarraycr \@xarraycr}
|
||||
\def\@xarraycr{\@ifnextchar [%
|
||||
\@argarraycr {\ifnum 0=`{\fi}\cr}}
|
||||
\def\@argarraycr[#1]{\ifnum0=`{\fi}\ifdim #1>\z@
|
||||
\@xargarraycr{#1}\else \@yargarraycr{#1}\fi}
|
||||
\def\@xargarraycr#1{\unskip
|
||||
\@tempdima #1\advance\@tempdima \dp\@arstrutbox
|
||||
\vrule \@depth\@tempdima \@width\z@ \cr}
|
||||
\def\@yargarraycr#1{\cr\noalign{\vskip #1}}
|
||||
\def\multicolumn#1#2#3{%
|
||||
\multispan{#1}\begingroup
|
||||
\def\@addamp{\if@firstamp \@firstampfalse \else
|
||||
\@preamerr 5\fi}%
|
||||
\@mkpream{#2}\@addtopreamble\@empty
|
||||
\endgroup
|
||||
\def\@sharp{#3}%
|
||||
\@arstrut \@preamble \ignorespaces}
|
||||
\def\array{\col@sep\arraycolsep
|
||||
\def\d@llar{$}\gdef\@halignto{}%
|
||||
\@tabarray}
|
||||
\def\@tabarray{\@ifnextchar[{\@array}{\@array[c]}}
|
||||
\def\tabular{\gdef\@halignto{}\@tabular}
|
||||
\expandafter\def\csname tabular*\endcsname#1{%
|
||||
\gdef\@halignto{to#1}\@tabular}
|
||||
\def\@tabular{%
|
||||
\leavevmode
|
||||
\hbox \bgroup $\col@sep\tabcolsep \let\d@llar\@empty
|
||||
\@tabarray}
|
||||
\def\endarray{\crcr \egroup \egroup \gdef\@preamble{}}
|
||||
\def\endtabular{\endarray $\egroup}
|
||||
\expandafter\let\csname endtabular*\endcsname=\endtabular
|
||||
\let\@ampacol=\relax \let\@expast=\relax
|
||||
\let\@arrayclassiv=\relax \let\@arrayclassz=\relax
|
||||
\let\@tabclassiv=\relax \let\@tabclassz=\relax
|
||||
\let\@arrayacol=\relax \let\@tabacol=\relax
|
||||
\let\@tabularcr=\relax \let\@@endpbox=\relax
|
||||
\let\@argtabularcr=\relax \let\@xtabularcr=\relax
|
||||
\def\@preamerr#1{\def\@tempd{{..} at wrong position: }%
|
||||
\@latexerr{%
|
||||
\ifcase #1 Illegal pream-token (\@nextchar): `c' used\or %0
|
||||
Missing arg: token ignored\or %1
|
||||
Empty preamble: `l' used\or %2
|
||||
>\@tempd token ignored\or %3
|
||||
<\@tempd changed to !{..}\or %4
|
||||
Only one colum-spec. allowed.\fi}\@ehc} %5
|
||||
\def\@tfor#1:=#2\do#3{\def\@fortmp{#2}\ifx\@fortmp\@empty
|
||||
\else\@tforloop#2\@nil\@nil\@@#1{#3}\fi}
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `/usr2/distrib/latex209/nfss/array.sty'.
|
|
@ -29,48 +29,10 @@ The field parsers can be applied to arbitrary strings (one common use is
|
|||
splitting environment variables such as \ex{\$PATH} at colons into its
|
||||
component elements).
|
||||
|
||||
\subsection{Reading delimited strings}
|
||||
These procedures read in strings from ports delimited by characters
|
||||
belonging to a specific set.
|
||||
See section~\ref{sec:char-sets} for information on character set manipulation.
|
||||
|
||||
\defun{read-delimited}{char-set [port]} {{\str} or eof}
|
||||
\begin{desc}
|
||||
Read until we encounter one of the chars in \var{char-set} or eof.
|
||||
The terminating character is not included in the string returned,
|
||||
nor is it removed from the input stream; the next input operation will
|
||||
encounter it. If we get a string back, then \ex{(eof-object? (peek-char))}
|
||||
tells if the string was terminated by a delimiter or eof.
|
||||
|
||||
The \var{char-set} argument may be a charset, a string, a character, or a
|
||||
character predicate; it is coerced to a charset.
|
||||
|
||||
This operation is likely to be implemented very efficiently. In
|
||||
the Scheme 48 implementation, the Unix port case is implemented directly
|
||||
in C, and is much faster than the equivalent operation performed
|
||||
in Scheme with \ex{peek-char} and \ex{read-char}.
|
||||
\end{desc}
|
||||
|
||||
\defun{read-delimited!} {char-set buf [port start end]} {nchars or eof or \#f}
|
||||
\begin{desc}
|
||||
A side-effecting variant of \ex{read-delimited}.
|
||||
|
||||
The data is written into the string \var{buf} at the indices in the
|
||||
half-open interval $[\var{start},\var{end})$; the default interval is the
|
||||
whole string: $\var{start}=0$ and $\var{end}=\ex{(string-length
|
||||
\var{buf})}$. The values of \var{start} and \var{end} must specify a
|
||||
well-defined interval in \var{str}, \ie, $0 \le \var{start} \le \var{end}
|
||||
\le \ex{(string-length \var{buf})}$.
|
||||
|
||||
It returns \var{nbytes}, the number of bytes read. If the buffer filled up
|
||||
without a delimiter character being found, \ex{\#f} is returned. If
|
||||
the port is at eof when the read starts, the eof object is returned.
|
||||
|
||||
If an integer is returned, then
|
||||
\ex{(eof-object (peek-char port))}
|
||||
tells if the string was terminated by a delimiter or eof.
|
||||
\end{desc}
|
||||
|
||||
The general delimited-input procedures described in
|
||||
chapter~\ref{chapt:rdelim} are also useful for reading simple records,
|
||||
such as single lines, paragraphs of text, or strings terminated by specific
|
||||
characters.
|
||||
|
||||
\subsection{Reading records}
|
||||
|
||||
|
@ -79,21 +41,22 @@ See section~\ref{sec:char-sets} for information on character set manipulation.
|
|||
Returns a procedure that reads records from a port. The
|
||||
procedure is invoked as follows:
|
||||
%
|
||||
\codex{(\var{reader} \var{[port]}) $\longrightarrow$ \emph{{\str} or eof}}
|
||||
\codex{(\var{reader} \var{[port]}) $\longrightarrow$
|
||||
\textrm{\textit{{\str} or eof}}}
|
||||
%
|
||||
A record is a sequence of characters terminated by one of the characters
|
||||
in \var{delims} or eof. If \var{elide-delims?} is true, then a contiguous
|
||||
sequence of delimiter chars are taken as a single record delimiter. If
|
||||
\var{elide-delims?} is false, then a delimiter char coming immediately
|
||||
after a delimiter char produces an empty string record. The reader
|
||||
after a delimiter char produces an empty-string record. The reader
|
||||
consumes the delimiting char(s) before returning from a read.
|
||||
|
||||
The \var{delims} set defaults to the set $\{\rm newline\}$.
|
||||
The \var{delims} set defaults to the set $\{\mbox{newline}\}$.
|
||||
It may be a charset, string, character, or character predicate,
|
||||
and is coerced to a charset.
|
||||
The \var{elide-delims?} flag defaults to \ex{\#f}.
|
||||
|
||||
The \var{handle-delim} controls what is done with the record's
|
||||
The \var{handle-delim} argument controls what is done with the record's
|
||||
terminating delimiter.
|
||||
\begin{inset}
|
||||
\begin{tabular}{lp{0.6\linewidth}}
|
||||
|
@ -111,22 +74,10 @@ See section~\ref{sec:char-sets} for information on character set manipulation.
|
|||
a string or eof.
|
||||
\end{desc}
|
||||
|
||||
\defun{read-paragraph} {[port delimiter?]} {{\str} or eof}
|
||||
\begin{desc}
|
||||
This procedure skips blank lines,
|
||||
then reads text from a port until a blank line or eof is found.
|
||||
A ``blank line'' is a (possibly empty) line composed only of white space.
|
||||
If \var{delimiter?} is true, the terminating blank line is included in the
|
||||
return string; it defaults to \ex{\#f}. When the delimiter is included,
|
||||
\verb|(match-string "\n[ \t]*\n$" paragraph)|
|
||||
can be used to determine if the paragraph was terminated by a blank line
|
||||
or by eof.
|
||||
\end{desc}
|
||||
|
||||
|
||||
\subsection{Parsing fields}
|
||||
|
||||
\defun {field-splitter} {[regexp num-fields]} \proc
|
||||
\defun {field-splitter} {[field num-fields]} \proc
|
||||
\defunx {infix-splitter} {[delim num-fields handle-delim]} \proc
|
||||
\defunx {suffix-splitter} {[delim num-fields handle-delim]} \proc
|
||||
\defunx {sloppy-suffix-splitter} {[delim num-fields handle-delim]} \proc
|
||||
|
@ -156,10 +107,10 @@ These functions return a parser function that can be used as follows:
|
|||
Defaults:
|
||||
\begin{tightinset}
|
||||
\begin{tabular}{l@{\quad=\quad }ll}
|
||||
\var{delim} & \verb!"[ \t\n]+|$"! & (suffix delimiter: white space or eos) \\
|
||||
\multicolumn{1}{l}{} & \verb|"[ \t\n]+"| & (infix delimiter: white space) \\
|
||||
|
||||
\var{re} & \verb|"[^ \t\n]+"| & (non-white-space) \\
|
||||
\var{delim} & \ex{(rx (| (+ white) eos))} & (suffix delimiter: white space or eos) \\
|
||||
\multicolumn{1}{l}{} & \ex{(rx (+ white))} & (infix delimiter: white space) \\
|
||||
|
||||
\var{field} & \verb|(rx (+ (~ white)))| & (non-white-space) \\
|
||||
|
||||
\var{num-fields} & \verb|#f| & (as many fields as possible) \\
|
||||
|
||||
|
@ -169,21 +120,36 @@ These functions return a parser function that can be used as follows:
|
|||
{\ldots}which means: break the string at white space, discarding the
|
||||
white space, and parse as many fields as possible.
|
||||
|
||||
The regular expression \var{delim} is used to match field delimiters.
|
||||
It can be either a string or a compiled regexp structure (see the
|
||||
\ex{make-regexp} procedure). In the separator case, it defaults to a
|
||||
regular expression matching white space; in the terminator case,
|
||||
The \var{delim} parameter is a regular expression matching the text
|
||||
that occurs between fields.
|
||||
See chapter~\ref{chapt:sre} for information on regular expressions,
|
||||
and the \ex{rx} form used to specify them.
|
||||
In the separator case,
|
||||
it defaults to a pattern matching white space;
|
||||
in the terminator case,
|
||||
it defaults to white space or end-of-string.
|
||||
|
||||
The regular expression \var{re} is a regular expression used
|
||||
The \var{field} parameter is a regular expression used
|
||||
to match fields. It defaults to non-white-space.
|
||||
|
||||
The \var{delim} patterns may also be given as a string,
|
||||
character, or char-set, which are coerced to regular expressions.
|
||||
So the following expressions are all equivalent,
|
||||
each producing a function that splits strings apart at colons:
|
||||
\begin{inset}
|
||||
\begin{verbatim}
|
||||
(infix-splitter (rx ":"))
|
||||
(infix-splitter ":")
|
||||
(infix-splitter #\:)
|
||||
(infix-splitter (char-set #\:))\end{verbatim}
|
||||
\end{inset}
|
||||
|
||||
The boolean \var{handle-delim} determines what to do with delimiters.
|
||||
\begin{tightinset}\begin{tabular}{ll}
|
||||
\ex{'trim} & Delimiters are thrown away after parsing. (default) \\
|
||||
\ex{'concat} & Delimiters are appended to the field preceding them. \\
|
||||
\ex{'split} & Delimiters are returned as separate elements in
|
||||
the field vector.
|
||||
the field list.
|
||||
\end{tabular}
|
||||
\end{tightinset}
|
||||
|
||||
|
@ -193,7 +159,7 @@ These functions return a parser function that can be used as follows:
|
|||
error if there are more or fewer than $n$ fields in the record. If
|
||||
\var{num-fields} is a negative integer or zero, then $|n|$ fields
|
||||
are parsed, and the remainder of the string is returned in the last
|
||||
element of the field vector; it is an error if fewer than $|n|$ fields
|
||||
element of the field list; it is an error if fewer than $|n|$ fields
|
||||
can be parsed.
|
||||
|
||||
The field parser produced is a procedure that can be employed as
|
||||
|
@ -227,7 +193,7 @@ These functions return a parser function that can be used as follows:
|
|||
|
||||
It is an error if a non-empty record does not end with a delimiter.
|
||||
To make the last delimiter optional, make sure the delimiter regexp
|
||||
matches the end-of-string \verb|(regexp "$")|.
|
||||
matches the end-of-string (sre \ex{eos}).
|
||||
|
||||
\item [\ex{infix-splitter}]
|
||||
Delimiters are interpreted as element \emph{separators}. If comma is the
|
||||
|
@ -246,17 +212,17 @@ These functions return a parser function that can be used as follows:
|
|||
\end{tabular}
|
||||
\end{inset}
|
||||
|
||||
Note that separator semantics doesn't really allow for empty records --
|
||||
the straightforward grammar (\ie, \synvar{real-infix-record}) parses
|
||||
an empty string as a singleton list whose one field is the empty string,
|
||||
\ex{("")}, not as the empty record \ex{()}. This is unfortunate,
|
||||
Note that separator semantics doesn't really allow for empty
|
||||
records---the straightforward grammar (\ie, \synvar{real-infix-record})
|
||||
parses an empty string as a singleton list whose one field is the empty
|
||||
string, \ex{("")}, not as the empty record \ex{()}. This is unfortunate,
|
||||
since it means that infix string parsing doesn't make \ex{string-append}
|
||||
and \ex{vector-append} isomorphic. For example,
|
||||
and \ex{append} isomorphic. For example,
|
||||
\codex{((infix-splitter ":") (string-append \var{x} ":" \var{y}))}
|
||||
doesn't always equal
|
||||
\begin{code}
|
||||
(vector-append ((infix-splitter ":") \var{x})
|
||||
((infix-splitter ":") \var{y}))\end{code}
|
||||
(append ((infix-splitter ":") \var{x})
|
||||
((infix-splitter ":") \var{y}))\end{code}
|
||||
It fails when \var{x} or \var{y} are the empty string.
|
||||
Terminator semantics \emph{does} preserve a similar isomorphism.
|
||||
|
||||
|
@ -271,7 +237,8 @@ These functions return a parser function that can be used as follows:
|
|||
initial delimiter string if the string begins with one instead of parsing
|
||||
an initial empty field. This can be used, for example, to field-split a
|
||||
sequence of English text at white-space boundaries, where the string may
|
||||
begin or end with white space, by using regex \verb!"[ \t]+|$"!.
|
||||
begin or end with white space, by using regex
|
||||
\begin{code}{(rx (| (+ white) eos))}\end{code}
|
||||
(But you would be better off using \ex{field-splitter} in this case.)
|
||||
\end{description}
|
||||
\end{desc}
|
||||
|
@ -322,7 +289,7 @@ Record & : suffix & \verb!:|$! suffix & : infix & non-: field \\
|
|||
\subsection{Field readers}
|
||||
|
||||
\defun{field-reader} {[field-parser rec-reader]} \proc
|
||||
|
||||
\begin{desc}
|
||||
This utility returns a procedure that reads records with field structure
|
||||
from a port.
|
||||
The reader's interface is designed to make it useful in the \ex{awk}
|
||||
|
@ -347,10 +314,11 @@ Record & : suffix & \verb!:|$! suffix & : infix & non-: field \\
|
|||
For example, if port \ex{p} is open on \ex{/etc/passwd}, then
|
||||
\codex{((field-reader (infix-splitter ":" 7)) p)}
|
||||
returns two values:
|
||||
\begin{code}
|
||||
{\small
|
||||
\begin{widecode}
|
||||
"dalbertz:mx3Uaqq0:107:22:David Albertz:/users/dalbertz:/bin/csh"
|
||||
("dalbertz" "mx3Uaqq0" "107" "22" "David Albertz" "/users/dalbertz"
|
||||
"/bin/csh")\end{code}
|
||||
"/bin/csh")\end{widecode}}
|
||||
The \var{field-parser} defaults to the value of \ex{(field-splitter)},
|
||||
a parser that picks out sequences of non-white-space strings.
|
||||
|
||||
|
@ -366,37 +334,41 @@ Record & : suffix & \verb!:|$! suffix & : infix & non-: field \\
|
|||
; wandy:3xuncWdpKhR.:73:22:Wandy Saetan:/usr/wandy:/bin/csh
|
||||
|
||||
;;; Two ls -l output readers
|
||||
(field-reader (infix-splitter "[ \\t]+" 8))
|
||||
(field-reader (infix-splitter "[ \\t]+" -7))
|
||||
(field-reader (infix-splitter (rx (+ white)) 8))
|
||||
(field-reader (infix-splitter (rx (+ white)) -7))
|
||||
; -rw-r--r-- 1 shivers 22880 Sep 24 12:45 scsh.scm
|
||||
|
||||
;;; Internet hostname reader
|
||||
(field-reader (field-splitter "[^.]+"))
|
||||
(field-reader (field-splitter (rx (+ (~ ".")))))
|
||||
; stat.sinica.edu.tw
|
||||
|
||||
;;; Internet IP address reader
|
||||
(field-reader (field-splitter "[^.]+" 4))
|
||||
(field-reader (field-splitter (rx (+ (~ "."))) 4))
|
||||
; 18.24.0.241
|
||||
|
||||
;;; Line of integers
|
||||
(let ((parser (field-splitter "[+-]?[0-9]+")))
|
||||
(let ((parser (field-splitter (rx (? ("+-")) (+ digit)))))
|
||||
(field-reader (\l{s} (map string->number (parser s))))
|
||||
; 18 24 0 241
|
||||
|
||||
;;; Same as above.
|
||||
(let ((reader (field-reader (field-splitter "[+-]?[0-9]+"))))
|
||||
(let ((reader (field-reader (field-splitter (rx (? ("+-"))
|
||||
(+ digit))))))
|
||||
(\lx{maybe-port} (map string->number (apply reader maybe-port))))
|
||||
; Yale beat harvard 26 to 7.\end{centercode}
|
||||
\caption{Some examples of \protect\ex{field-reader}}
|
||||
\label{fig:field-readers}
|
||||
\end{boxedfigure}
|
||||
|
||||
\end{desc}
|
||||
|
||||
\subsection{Forward-progress guarantees and empty string matches}
|
||||
|
||||
\subsection{Forward-progress guarantees and empty-string matches}
|
||||
A loop that pulls text off a string by repeatedly matching a regexp
|
||||
against that string can conceivably get stuck in an infinite loop if
|
||||
the regexp matches the empty string. For example, the regexps \verb|^|,
|
||||
\verb|$|, \verb|.*|, and \verb!foo|[^f]*! can all match the empty string.
|
||||
the regexp matches the empty string. For example, the SREs
|
||||
\ex{bos}, \ex{eos}, \ex{(* any)}, and \ex{(| "foo" (* (~ "f")))}
|
||||
can all match the empty string.
|
||||
|
||||
The routines in this package that iterate through strings with regular
|
||||
expressions are careful to handle this empty-string case.
|
||||
|
@ -415,10 +387,10 @@ progress, and the loop is guaranteed to terminate.
|
|||
This has the effect you want with field parsing. For example, if you split
|
||||
a string with the empty pattern, you will explode the string into its
|
||||
individual characters:
|
||||
\codex{((suffix-splitter "") "foo") {\evalto} ("" "f" "o" "o")}
|
||||
\codex{((suffix-splitter (rx)) "foo") {\evalto} ("" "f" "o" "o")}
|
||||
However, even though this boundary case is handled correctly, we don't
|
||||
recommend using it. Say what you mean---just use a field splitter:
|
||||
\codex{((field-splitter ".") "foo") {\evalto} ("f" "o" "o")}
|
||||
\codex{((field-splitter (rx any)) "foo") {\evalto} ("f" "o" "o")}
|
||||
Or, more efficiently,
|
||||
\codex{((\l{s} (map string (string->list s))) "foo")}
|
||||
|
||||
|
@ -438,7 +410,7 @@ Unix doesn't support peeking ahead into input streams.
|
|||
Scsh provides a loop macro and a set of field parsers that can
|
||||
be used to perform text processing very similar to the Awk programming
|
||||
language.
|
||||
These basic functionality of Awk is factored in scsh into its component
|
||||
The basic functionality of Awk is factored in scsh into its component
|
||||
parts.
|
||||
The control structure is provided by the \ex{awk} loop macro;
|
||||
the text I/O and parsers are provided by the field-reader subroutine library
|
||||
|
@ -477,7 +449,7 @@ these values are bound to the variables given in the
|
|||
The first value returned is assumed to be the record;
|
||||
when it is the end-of-file object, the loop terminates.
|
||||
|
||||
For example, let's suppose we want to read items from \etc{/etc/password},
|
||||
For example, let's suppose we want to read items from \ex{/etc/password},
|
||||
and we use the \ex{field-reader} procedure to define a record parser for
|
||||
\ex{/etc/passwd} entries:
|
||||
\codex{(define read-passwd (field-reader (infix-splitter ":" 7)))}
|
||||
|
@ -524,24 +496,34 @@ it checks them all.
|
|||
|
||||
The \var{test} form can be one of:
|
||||
\begin{inset}
|
||||
\begin{tabular}{lp{0.8\linewidth}}
|
||||
integer: & The test is true for that iteration of the loop.
|
||||
\begin{tabular}{lp{0.6\linewidth}}
|
||||
\var{integer}: & The test is true for that iteration of the loop.
|
||||
The first iteration is \#1. \\
|
||||
|
||||
string: & The string is a regular expression. The test is
|
||||
true if the regexp matches the record.\\
|
||||
\var{sre}: & A regular expression, in SRE notation
|
||||
(see chapter~\ref{chapt:sre}) can be used as
|
||||
a test. The test is successful if the pattern
|
||||
matches the record.
|
||||
In particular, note that any string is an SRE. \\
|
||||
|
||||
expression & If not an integer or a string, the test form is
|
||||
a Scheme expression that is evaluated.
|
||||
\ex{(when \var{expr})}: &
|
||||
The body of a \ex{when} test is evaluated as a
|
||||
Scheme boolean expression in the inner scope of the
|
||||
\ex{awk} form. \\
|
||||
|
||||
\var{expr}: & If the form is none of the above, it is treated as
|
||||
a Scheme expression---in practice, the \ex{when}
|
||||
keyword is only needed in cases where SRE/Scheme
|
||||
expression ambiguity might occur.
|
||||
\end{tabular}
|
||||
\end{inset}
|
||||
|
||||
|
||||
\itum{\begin{tabular}[t]{l}
|
||||
\ex{(range \var{start-test} \var{stop-test} \vari{body}1 \ldots)} \\
|
||||
\ex{(:range \var{start-test} \var{stop-test} \vari{body}1 \ldots)} \\
|
||||
\ex{(range: \var{start-test} \var{stop-test} \vari{body}1 \ldots)} \\
|
||||
\ex{(:range: \var{start-test} \var{stop-test} \vari{body}1 \ldots)}
|
||||
\ex{(range\ \ \ \var{start-test} \var{stop-test} \vari{body}1 \ldots)} \\
|
||||
\ex{(:range\ \ \var{start-test} \var{stop-test} \vari{body}1 \ldots)} \\
|
||||
\ex{(range:\ \ \var{start-test} \var{stop-test} \vari{body}1 \ldots)} \\
|
||||
\ex{(:range:\ \var{start-test} \var{stop-test} \vari{body}1 \ldots)}
|
||||
\end{tabular}}
|
||||
%
|
||||
These clauses become activated when \var{start-test} is true;
|
||||
|
@ -554,10 +536,10 @@ it checks them all.
|
|||
The colons control whether or not the start and stop lines
|
||||
are processed by the clause. For example:
|
||||
\begin{inset}\begin{tabular}{l@{\qquad}l}
|
||||
\ex{(range 1 5 \ldots)} & Lines \phantom{1} 2 3 4 \\
|
||||
\ex{(:range 1 5 \ldots)} & Lines 1 2 3 4 \\
|
||||
\ex{(range: 1 5 \ldots)} & Lines \phantom{1} 2 3 4 5 \\
|
||||
\ex{(:range: 1 5 \ldots)} & Lines 1 2 3 4 5
|
||||
\ex{(range\ \ \ 1 5\ \ \ldots)} & Lines \phantom{1} 2 3 4 \\
|
||||
\ex{(:range\ \ 1 5\ \ \ldots)} & Lines 1 2 3 4 \\
|
||||
\ex{(range:\ \ 1 5\ \ \ldots)} & Lines \phantom{1} 2 3 4 5 \\
|
||||
\ex{(:range: 1 5\ \ \ldots)} & Lines 1 2 3 4 5
|
||||
\end{tabular}
|
||||
\end{inset}
|
||||
|
||||
|
@ -572,7 +554,7 @@ it checks them all.
|
|||
\itum{\ex{(\var{test} => \var{exp})}}
|
||||
If evaluating \ex{test} produces a true value,
|
||||
apply \var{exp} to that value.
|
||||
If \var{test} is a regular-expression string, then \var{exp} is applied
|
||||
If \var{test} is a regular expression, then \var{exp} is applied
|
||||
to the match data structure returned by the regexp match routine.
|
||||
|
||||
\itum{\ex{(after \vari{body}1 \ldots)}}
|
||||
|
@ -590,7 +572,7 @@ Here are some examples of \ex{awk} being used to process various types
|
|||
of input stream.
|
||||
|
||||
\begin{code}
|
||||
(define $ vector-ref) ; Saves typing.
|
||||
(define $ nth) ; Saves typing.
|
||||
|
||||
;;; Print out the name and home-directory of everyone in /etc/passwd:
|
||||
(let ((read-passwd (field-reader (infix-splitter ":" 7))))
|
||||
|
@ -608,14 +590,15 @@ of input stream.
|
|||
(call-with-input-file "/etc/passwd"
|
||||
(lambda (port)
|
||||
(awk (read-passwd port) (record fields) ()
|
||||
("^S" (format #t "~a's home directory is ~a~%"
|
||||
($ fields 0)
|
||||
($ fields 5)))))))\end{code}
|
||||
((: bos "S")
|
||||
(format #t "~a's home directory is ~a~%"
|
||||
($ fields 0)
|
||||
($ fields 5)))))))\end{code}
|
||||
|
||||
\begin{code}
|
||||
;;; Read a series of integers from stdin. This expression evaluates
|
||||
;;; to the number of positive numbers were read. Note our "record-reader"
|
||||
;;; is the standard Scheme READ procedure.
|
||||
;;; to the number of positive numbers that were read. Note our
|
||||
;;; "record-reader" is the standard Scheme READ procedure.
|
||||
(awk (read) (i) ((npos 0))
|
||||
((> i 0) (+ npos 1)))\end{code}
|
||||
|
||||
|
@ -627,8 +610,8 @@ of input stream.
|
|||
\begin{code}
|
||||
;;; Count the number of non-comment lines of code in my Scheme source.
|
||||
(awk (read-line) (line) ((nlines 0))
|
||||
("^[ \\t]*;" nlines) ; A comment line.
|
||||
(else (+ nlines 1))) ; Not a comment line.\end{code}
|
||||
((: bos (* white) ";") nlines) ; A comment line.
|
||||
(else (+ nlines 1))) ; Not a comment line.\end{code}
|
||||
|
||||
\begin{code}
|
||||
;;; Read numbers, counting the evens and odds.
|
||||
|
@ -646,10 +629,10 @@ of input stream.
|
|||
(#t (max max-len (string-length line))))\end{code}
|
||||
|
||||
\begin{code}
|
||||
;;; (This could also be done with REDUCE-PORT:)
|
||||
(reduce-port (current-input-port) read-line
|
||||
(lambda (line maxlen) (max (string-length line) maxlen))
|
||||
0)\end{code}
|
||||
;;; (This could also be done with PORT-FOLD:)
|
||||
(port-fold (current-input-port) read-line
|
||||
(lambda (line maxlen) (max (string-length line) maxlen))
|
||||
0)\end{code}
|
||||
|
||||
\begin{code}
|
||||
;;; Print every line longer than 80 chars.
|
||||
|
@ -661,7 +644,7 @@ of input stream.
|
|||
\begin{code}
|
||||
;;; Strip blank lines from input.
|
||||
(awk (read-line) (line) ()
|
||||
("." (display line) (newline)))\end{code}
|
||||
((~ white) (display line) (newline)))\end{code}
|
||||
|
||||
\begin{code}
|
||||
;;; Sort the entries in /etc/passwd by login name.
|
||||
|
@ -675,3 +658,14 @@ of input stream.
|
|||
;;; Prefix line numbers to the input stream.
|
||||
(awk (read-line) (line) lineno ()
|
||||
(#t (format #t "~d:\\t~a~%" lineno line)))\end{code}
|
||||
|
||||
|
||||
\section{Backwards compatibility}
|
||||
|
||||
Previous scsh releases provided an \ex{awk} form with a different syntax,
|
||||
designed around regular expressions written in Posix notation as strings,
|
||||
rather than SREs.
|
||||
|
||||
This form is still available in a separate module for old code.
|
||||
It'll be documented in the next release of this manual. Dig around
|
||||
in the sources for it.
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
% boxedminipage.sty
|
||||
%
|
||||
% adds the boxedminipage environment---just like minipage, but has a
|
||||
% box round it!
|
||||
%
|
||||
% The thickneess of the rules around the box is controlled by
|
||||
% \fboxrule, and the distance between the rules and the edges of the
|
||||
% inner box is governed by \fboxsep.
|
||||
%
|
||||
% This code is based on Lamport's minipage code.
|
||||
|
||||
\def\boxedminipage{\@ifnextchar [{\@iboxedminipage}{\@iboxedminipage[c]}}
|
||||
|
||||
\def\@iboxedminipage[#1]#2{\leavevmode \@pboxswfalse
|
||||
\if #1b\vbox
|
||||
\else \if #1t\vtop
|
||||
\else \ifmmode \vcenter
|
||||
\else \@pboxswtrue $\vcenter
|
||||
\fi
|
||||
\fi
|
||||
\fi\bgroup % start of outermost vbox/vtop/vcenter
|
||||
\hsize #2
|
||||
\hrule\@height\fboxrule
|
||||
\hbox\bgroup % inner hbox
|
||||
\vrule\@width\fboxrule \hskip\fboxsep \vbox\bgroup % innermost vbox
|
||||
\advance\hsize -2\fboxrule \advance\hsize-2\fboxsep
|
||||
\textwidth\hsize \columnwidth\hsize
|
||||
\@parboxrestore
|
||||
\def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
|
||||
\let\@footnotetext\@mpfootnotetext
|
||||
\let\@listdepth\@mplistdepth \@mplistdepth\z@
|
||||
\@minipagerestore\@minipagetrue
|
||||
\everypar{\global\@minipagefalse\everypar{}}}
|
||||
|
||||
\def\endboxedminipage{%
|
||||
\par\vskip-\lastskip
|
||||
\ifvoid\@mpfootins\else
|
||||
\vskip\skip\@mpfootins\footnoterule\unvbox\@mpfootins\fi
|
||||
\egroup % ends the innermost \vbox
|
||||
\hskip\fboxsep \vrule\@width\fboxrule
|
||||
\egroup % ends the \hbox
|
||||
\hrule\@height\fboxrule
|
||||
\egroup% ends the vbox/vtop/vcenter
|
||||
\if@pboxsw $\fi}
|
||||
|
|
@ -0,0 +1,297 @@
|
|||
%&latex -*- latex -*-
|
||||
|
||||
\chapter{Changes from previous releases}
|
||||
\label{sec:changes}
|
||||
|
||||
\newcommand{\itam}[1]{\item {#1} \\}
|
||||
|
||||
\section{Changes from the previous release}
|
||||
|
||||
This section details changes that have been made in scsh since
|
||||
the previous release.
|
||||
|
||||
Scsh is now much more robust.
|
||||
All known bugs have been fixed.
|
||||
There have been many improvements and extensions made.
|
||||
These new features and changes are listed below, in no particular order;
|
||||
the relevant sections of the manual give the full details.
|
||||
|
||||
Scsh now supports complete {\Posix}, including signal handlers.
|
||||
Early autoreaping of child processes is now handled by a \ex{SIGCHLD}
|
||||
signal handler, so children are reaped as early as possible with no
|
||||
user intervention required.
|
||||
|
||||
A functional static heap linker is included in this release.
|
||||
It is ugly, limited in functionality, and extremely slow, but it works.
|
||||
It can be used to build scsh binaries that start up instantly.
|
||||
|
||||
The regular expression system has been sped up.
|
||||
Regular-expression compilation is now provided,
|
||||
and the \ex{awk} macro has been rewritten to pre-compile
|
||||
regexps used in rules outside the loop.
|
||||
It is still, however, slower than it should be.
|
||||
|
||||
Execing programs should be faster in this release, since we now use the
|
||||
\ex{CLOEXEC} status bit to get automatic closing of unrevealed
|
||||
port file descriptors.
|
||||
|
||||
{scm}'s floating point support was inadvertently omitted from the last
|
||||
release. It has been reinstated.
|
||||
|
||||
There is now a new command-line switch, \ex{-sfd \var{num}},
|
||||
which causes scsh to read its script from file descriptor \var{num}.
|
||||
|
||||
|
||||
\section{Changes from the penultimate release}
|
||||
|
||||
This section details changes that have been made in scsh since
|
||||
the penultimate release.
|
||||
|
||||
Scsh is now much more robust.
|
||||
All known bugs have been fixed.
|
||||
There have been many improvements and extensions made.
|
||||
We have also made made some incompatible changes.
|
||||
|
||||
The sections below briefly describe these new features and changes;
|
||||
the relevant sections of the manual give the full details.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{New features}
|
||||
This release incorporates several new features into scsh.
|
||||
|
||||
\begin{itemize}
|
||||
\itam{Control of buffered I/O}
|
||||
Scsh now allows you to control the buffering policy used for doing I/O
|
||||
on a Scheme port.
|
||||
|
||||
\itam{Here-strings}
|
||||
Scsh now has a new lexical feature, \verb|#<<|, that provides
|
||||
the ability to enter long, multi-line string constants in scsh programs.
|
||||
Such a string is called a ``here string,'' by analogy to the common
|
||||
shell ``here document'' \ex{<<} redirection.
|
||||
|
||||
\itam{Delimited readers and read-line}
|
||||
Scsh now has a powerful set of delimited readers.
|
||||
These can be used to read input delimited by
|
||||
a newline character (\ex{read-line}),
|
||||
a blank line (\ex{read-paragraph}),
|
||||
or the occurrence of any character in an arbitrary set (\ex{read-delimited}).
|
||||
|
||||
While these procedures can be applied to any Scheme input port,
|
||||
there is native-code support for performing delimited reads on
|
||||
Unix input sources, so doing block input with these procedures should be
|
||||
much faster than the equivalent character-at-a-time Scheme code.
|
||||
|
||||
\itam{New system calls}
|
||||
With the sole exception of signal handlers, scsh now has all of {\Posix}.
|
||||
This release introduces
|
||||
\begin{itemize}
|
||||
\item \ex{select},
|
||||
\item full terminal device control,
|
||||
\item support for pseudo-terminal ``pty'' devices,
|
||||
\item file locking,
|
||||
\item process timing,
|
||||
\item \ex{set-file-times},
|
||||
\item \ex{seek} and \ex{tell}.
|
||||
\end{itemize}
|
||||
|
||||
Note that having \ex{select}, pseudo-terminals, and tty device control means
|
||||
that it is now possible to implement interesting network protocols, such as
|
||||
telnet servers and clients, directly in Scheme.
|
||||
|
||||
\itam{New command-line switches}
|
||||
There is a new set of command-line switches that make it possible
|
||||
to write shell scripts using the {\scm} module system.
|
||||
Scripts can use the new command-line switches to open dependent
|
||||
modules and load dependent source code.
|
||||
Scripts can also be written in the {\scm} module language,
|
||||
which allows you to use it both as a standalone shell script,
|
||||
and as a code module that can be loaded and used by other Scheme programs.
|
||||
|
||||
\itam{Static heap linking}
|
||||
There is a new facility that allows you to compile a heap image
|
||||
to a \ex{.o} file that can be linked with the scsh virtual machine.
|
||||
This produces a standalone executable binary, makes startup time
|
||||
near-instantaneous, and greatly improves memory performance---the
|
||||
initial heap image is placed in the process' text pages,
|
||||
where it is shared by different scsh processes, and does not occupy
|
||||
space in the run-time heap.
|
||||
|
||||
\oops{The static heap linker was not documented and installed in time
|
||||
for this release.}
|
||||
|
||||
|
||||
\end{itemize}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Incompatible improvements}
|
||||
Some features of scsh have been improved in ways that are
|
||||
not backwards-compatible with previous releases.
|
||||
These changes should not affect most code;
|
||||
however, please note the changes and modify your code accordingly.
|
||||
|
||||
\begin{itemize}
|
||||
\itam{New process-object data-type returned by \ex{fork}}
|
||||
Previous releases were prone to fill up the kernel's process table
|
||||
if a program forked large numbers of processes and subsequently failed
|
||||
to use \ex{wait} to reclaim the entries in the kernel's process table.
|
||||
(This is a problem in standard C environments, as well.)
|
||||
|
||||
Scsh 0.4 introduces a new mechanism for automatically managing subprocesses.
|
||||
Processes are no longer represented by an integer process id,
|
||||
which is impossible to garbage-collect, but by an
|
||||
abstract process data type that encapsulates the process id.
|
||||
All processes are represented using the new data structures;
|
||||
see the relevant section of the manual for further details.
|
||||
|
||||
\itam{Better stdio/current-port synchronisation}
|
||||
The \ex{(begin \ldots)} process form now does a \ex{stdio->stdports}
|
||||
call before executing its body.
|
||||
This means that the Scheme code in the body ``sees'' any external
|
||||
redirections.
|
||||
For example, it means that if a \ex{begin} form in the middle of a pipeline
|
||||
performs I/O on the current input and output ports, it will be communicating
|
||||
with its upstream and downstream pipes.
|
||||
\Eg, this code works as intended without the need for explicit synchronisation:
|
||||
\begin{verbatim}
|
||||
(run (| (gunzip)
|
||||
;; Kill line 1 and insert doubled-sided
|
||||
;; code at head of Postscript.
|
||||
(begin (read-line) ; Eat first line.
|
||||
(display "%!PS-Adobe-2.0\\n")
|
||||
(display "statusdict /setduplexmode known ")
|
||||
(display "{statusdict begin true ")
|
||||
(display "setduplexmode end} if\n")
|
||||
(exec-epf (cat)))
|
||||
(lpr))
|
||||
(< paper.ps))\end{verbatim}
|
||||
Arranging for the \ex{begin} process form to synchronise
|
||||
the current I/O ports with stdio means that all process forms now
|
||||
see their epf's redirections.
|
||||
|
||||
\itam{\ex{file-match} more robust}
|
||||
The \ex{file-match} procedure now catches any error condition
|
||||
signalled by a match procedure,
|
||||
and treats it as if the procedure had simply returned {\sharpf},
|
||||
\ie, match failure.
|
||||
This means \ex{file-match} no longer gets blown out of the water by
|
||||
trying to apply a function like \ex{file-directory?} to a dangling symlink,
|
||||
and other related OS errors.
|
||||
|
||||
\itam{Standard input now unbuffered}
|
||||
Scsh's startup code now makes the initial current input port
|
||||
(corresponding to file descriptor 0) unbuffered.
|
||||
This keeps the shell from ``stealing'' input meant for subprocesses.
|
||||
However, it does slow down character-at-a-time input processing.
|
||||
If you are writing a program that is tolerant of buffered input,
|
||||
and wish the efficiency gains, you can reset the buffering policy
|
||||
yourself.
|
||||
|
||||
\itam{``writeable'' now spelled ``writable''}
|
||||
We inconsistently spelled \ex{file-writable?} and \ex{file-not-writable?}
|
||||
in the manual and the implementation.
|
||||
We have now standardised on the common spelling ``writable'' in both.
|
||||
The older bindings still exist in release 0.4, but will go away in future
|
||||
releases.
|
||||
|
||||
\itam{\protect\ex{char-set-member?} replaced}
|
||||
We have de-released the \ex{char-set-member?} procedure.
|
||||
The scsh 0.3 version of this procedure took arguments
|
||||
in the following order:
|
||||
\codex{(char-set-member? \var{char} \var{char-set})}
|
||||
This argument order is in accordance with standard mathematical useage
|
||||
(\ie, $x \in S$), and also consistent with the R4RS
|
||||
\ex{member}, \ex{memq} and \ex{memv} procedures.
|
||||
It is, however, exactly opposite from the argument order
|
||||
used by the \ex{char-set-member?} in MIT Scheme's character-set library.
|
||||
If we left things as they were, we risked problems with code
|
||||
ported over from MIT Scheme.
|
||||
On the other hand, changing to conformance with MIT Scheme meant
|
||||
inconsistency with common mathematical notation and other long-standing
|
||||
Scheme procedures.
|
||||
Either way was bound to introduce confusion.
|
||||
|
||||
We've taken the approach of simply removing the \ex{char-set-member?}
|
||||
procedure altogether, and replacing it with a new procedure:
|
||||
\codex{(char-set-contains? \var{cset} \var{char})}
|
||||
Note that the argument order is consistent with the name.
|
||||
|
||||
\itam{\ex{file-attributes} now \ex{file-info}}
|
||||
In keeping with the general convention in scsh of naming procedures
|
||||
that retrieve information about system resources \ex{\ldots-info}
|
||||
(\eg, \ex{tty-info}, \ex{user-info}, \ex{group-info}),
|
||||
the \ex{file-attributes} procedure is now named \ex{file-info}.
|
||||
|
||||
We continue to export a \ex{file-attributes} binding for the current
|
||||
release, but it will go away in future releases.
|
||||
|
||||
\itam{Renaming of I/O synchronisation procedures}
|
||||
The \ex{(stdio->stdports \var{thunk})} procedure has been
|
||||
renamed \ex{with-stdio-ports*};
|
||||
there is now a corresponding \ex{with-stdio-ports} special form.
|
||||
The \ex{stdio->stdports} procedure is now a nullary procedure
|
||||
that side-effects the current set of current I/O port bindings.
|
||||
|
||||
\itam{New meta-arg line-two syntax}
|
||||
Scsh now uses a simplified grammar for describing command-line
|
||||
arguments read by the ``meta-arg'' switch from line two of a shell script.
|
||||
If you were using this feature in previous releases, the three incompatible
|
||||
changes of which to be aware are:
|
||||
(1) tab is no longer allowed as an argument delimiter,
|
||||
(2) a run of space characters is not equivalent to a single space,
|
||||
(3) empty arguments are written a different way.
|
||||
\end{itemize}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Backwards-compatible improvements}
|
||||
|
||||
Some existing features in scsh have been improved in ways that will
|
||||
not effect existing code.
|
||||
|
||||
\begin{itemize}
|
||||
\itam{Improved error reporting}
|
||||
Exception handlers that print out error messages and warnings now
|
||||
print their messages on the error output port,
|
||||
instead of the current output port.
|
||||
Previous releases used the current output port,
|
||||
a problem inherited from Scheme 48.
|
||||
|
||||
Previous scsh releases flushed the Scheme 48 debugging tables when
|
||||
creating the standard scsh heap image.
|
||||
This trimmed the size of the heap image, but made error messages much
|
||||
less comprehensible.
|
||||
We now retain the debugging tables.
|
||||
This bloats the heap image up by about 600kb. And worth it, too.
|
||||
|
||||
(We also have some new techniques for eliminating the run-time memory
|
||||
penalty imposed by these large heap images.
|
||||
Scsh's new static-heap technology allows for this data to be linked
|
||||
into the text pages of the vm's binary, where it will not be touched
|
||||
by the GC or otherwise affect the memory system until it is referenced.)
|
||||
|
||||
Finally, scsh now generates more informative error messages for syscall
|
||||
errors.
|
||||
For example, a file-open error previously told you what the error was
|
||||
(\eg, ``Permission denied,'' or ``No such file or directory''),
|
||||
but not which file you had tried to open.
|
||||
We've improved this.
|
||||
|
||||
\itam{Closing a port twice allowed}
|
||||
Scsh used to generate an error if you attempted to close a port
|
||||
that had already been closed.
|
||||
This is now allowed.
|
||||
The close procedure returns a boolean to indicate whether the port had
|
||||
already been closed or not.
|
||||
|
||||
\itam{Better time precision}
|
||||
The \ex{time+ticks} procedure now returns sub-second precision on OS's
|
||||
that support it.
|
||||
|
||||
\itam{Nicer print-methods for basic data-types}
|
||||
Scsh's standard record types now print more informatively.
|
||||
For example, a process object includes the process id in its
|
||||
printed representation: the process object for process id 2653
|
||||
prints as \verb|#{proc 2653}|.
|
||||
|
||||
\end{itemize}
|
|
@ -0,0 +1,296 @@
|
|||
% code.sty: -*- latex -*-
|
||||
% Latex macros for a "weak" verbatim mode.
|
||||
% -- like verbatim, except \, {, and } have their usual meanings.
|
||||
|
||||
% Environments: code, tightcode, codeaux, codebox, centercode
|
||||
% Commands: \dcd, \cddollar, \cdmath, \cd, \codeallowbreaks, \codeskip, \^
|
||||
% Already defined in LaTeX, but of some relevance: \#, \$, \%, \&, \_, \{, \}
|
||||
|
||||
% Changelog at the end of the file.
|
||||
|
||||
% These commands give you an environment, code, that is like verbatim
|
||||
% except that you can still insert commands in the middle of the environment:
|
||||
% \begin{code}
|
||||
% for(x=1; x<loop_bound; x++)
|
||||
% y += x^3; /* {\em Add in {\tt x} cubed} */
|
||||
% \end{code}
|
||||
%
|
||||
% All characters are ordinary except \{}. To get \{} in your text,
|
||||
% you use the commands \\, \{, and \}.
|
||||
|
||||
% These macros mess with the definition of the special chars (e.g., ^_~%).
|
||||
% The characters \{} are left alone, so you can still have embedded commands:
|
||||
% \begin{code} f(a,b,\ldots,y,z) \end{code}
|
||||
% However, if your embedded commands use the formerly-special chars, as in
|
||||
% \begin{code} x := x+1 /* \mbox{\em This is $y^3$} */ \end{code}
|
||||
% then you lose. The $ and ^ chars are scanned in as non-specials,
|
||||
% so they don't work. If the chars are scanned *outside* the code env,
|
||||
% then you have no problem:
|
||||
% \def\ycube{$y^3$}
|
||||
% \begin{code} x := x+1 /* {\em This is \ycube} */ \end{code}
|
||||
% If you must put special chars inside the code env, you do it by
|
||||
% prefixing them with the special \dcd ("decode") command, that
|
||||
% reverts the chars to back to special status:
|
||||
% \begin{code} x := x+1 /* {\dcd\em This is $y^3$} */ \end{code}
|
||||
% \dcd's scope is bounded by its enclosing braces. It is only defined within
|
||||
% the code env. You can also turn on just $ with the \cddollar command;
|
||||
% you can turn on just $^_ with the \cdmath command. See below.
|
||||
%
|
||||
% Alternatively, just use \(...\) for $...$, \sp for ^, and \sb for _.
|
||||
|
||||
% WARNING:
|
||||
% Like \verb, you cannot put a \cd{...} inside an argument to a macro
|
||||
% or a command. If you try, for example,
|
||||
% \mbox{\cd{$x^y$}}
|
||||
% you will lose. That is because the text "\cd{$x^y$}" gets read in
|
||||
% as \mbox's argument before the \cd executes. But the \cd has to
|
||||
% have a chance to run before LaTeX ever reads the $x^y$ so it can
|
||||
% turn off the specialness of $ and ^. So, \cd has to appear at
|
||||
% top level, not inside an argument. Similarly, you can't have
|
||||
% a \cd or a \code inside a macro (Although you could use \gdef to
|
||||
% define a macro *inside* a \cd, which you could then use outside.
|
||||
% Don't worry about this if you don't understand it.)
|
||||
|
||||
% BUG: In the codebox env, the effect of a \dcd, \cddollar, or \cdmath
|
||||
% command is reset at the end of each line. This can be hacked by
|
||||
% messing with the \halign's preamble, if you feel up to it.
|
||||
|
||||
% Useage note: the initial newline after the \begin{code} or
|
||||
% \begin{codebox} is eaten, but the last newline is not.
|
||||
% So,
|
||||
% \begin{code}
|
||||
% foo
|
||||
% bar
|
||||
% \end{code}
|
||||
% leaves one more blank line after bar than does
|
||||
% \begin{code}
|
||||
% foo
|
||||
% bar\end{code}
|
||||
% Moral: get in the habit of terminating code envs without a newline
|
||||
% (as in the second example).
|
||||
%
|
||||
|
||||
% All this stuff tweaks the meaning of space, tab, and newline.
|
||||
%===============================================================================
|
||||
% \cd@obeyspaces
|
||||
% Turns all spaces into non-breakable spaces.
|
||||
% Note: this is like \@vobeyspaces except without spurious space in defn.
|
||||
% @xobeysp is basically a space; it's defined in latex.tex.
|
||||
%
|
||||
{\catcode`\ =\active\gdef\cd@obeyspaces{\catcode`\ =\active\let =\@xobeysp}}
|
||||
|
||||
|
||||
|
||||
% \cd@obeytabs
|
||||
% Turns all tabs into 8 non-breakable spaces (which is bogus).
|
||||
%
|
||||
{\catcode`\^^I=\active %
|
||||
\gdef\cd@obeytabs{\catcode`\^^I=\active\let^^I=\cd@tab}}
|
||||
|
||||
\def\cd@tab{\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp}
|
||||
|
||||
|
||||
|
||||
% \cd@obeylines
|
||||
% Turns all cr's into linebreaks. Pagebreaks are not permitted between lines.
|
||||
% This is copied from lplain.tex's \obeylines, with the cr def'n changed.
|
||||
%
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\cd@obeylines{\catcode`\^^M=\active\let^^M=\cd@cr}}
|
||||
|
||||
% What ^M turns into. This def'n keeps blank lines from being compressed out.
|
||||
\def\cd@cr{\par\penalty10000\leavevmode} % TeX magicness
|
||||
%\def\cd@cr{\par\penalty10000\mbox{}} % LaTeX
|
||||
|
||||
|
||||
% \codeallowbreaks
|
||||
% Same as \cd@obeylines, except pagebreaks are allowed.
|
||||
% Put this command inside a code env to allow pagebreaks.
|
||||
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\codeallowbreaks{\catcode`\^^M\active\let^^M\cd@crbr}}
|
||||
|
||||
%\def\cd@crbr{\leavevmode\endgraf} % What ^M turns into.
|
||||
\def\cd@crbr{\par\leavevmode} % What ^M turns into.
|
||||
|
||||
|
||||
% \cd@obeycrsp
|
||||
% Turns cr's into non-breakable spaces. Used by \cd.
|
||||
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\cd@obeycrsp{\catcode`\^^M=\active\let^^M=\@xobeysp}}
|
||||
|
||||
% =============================================================================
|
||||
|
||||
% Set up code environment, in which most of the common special characters
|
||||
% appearing in code are treated verbatim, namely: $&#^_~%
|
||||
% \ { } are still enabled so that macros can be called in this
|
||||
% environment. Use \\, \{, and \} to use these characters verbatim
|
||||
% in this environment.
|
||||
%
|
||||
% Inside a group, you can make
|
||||
% all the hacked chars special with the \dcd command
|
||||
% $ special with the \cddollar command
|
||||
% $^_ special with the \cdmath command.
|
||||
% If you have a bunch of math $..$'s in your code env, then a global \cddollar
|
||||
% or \cdmath at the beginning of the env can save a lot of trouble.
|
||||
% When chars are special (e.g., after a \dcd), you can still get #$%&_{} with
|
||||
% \#, \$, \%, \&, \_, \{, and \} -- this is standard LaTeX.
|
||||
% Additionally, \\ gives \ inside the code env, and when \cdmath
|
||||
% makes ^ special, it also defines \^ to give ^.
|
||||
|
||||
%The hacked characters can be made special again
|
||||
% within a group by using the \dcd command.
|
||||
|
||||
% Note: this environment allows no breaking of lines whatsoever; not
|
||||
% at spaces or hypens. To arrange for a break use the standard \- command,
|
||||
% or a \discretionary{}{}{} which breaks, but inserts nothing. This is useful,
|
||||
% for example for allowing hypenated identifiers to be broken, e.g.
|
||||
% \def\={\discretionary{}{}{}} %optional break
|
||||
% FOO-\=BAR.
|
||||
|
||||
\def\setupcode{\parsep=0pt\parindent=0pt%
|
||||
\normalfont\ttfamily\frenchspacing\catcode``=13\@noligs%
|
||||
\def\\{\char`\\}%
|
||||
\let\dcd=\cd@dcd\let\cddollar=\cd@dollarspecial\let\cdmath=\cd@mathspecial%
|
||||
\@makeother\$\@makeother\&\@makeother\#%
|
||||
\@makeother\^\@makeother\_\@makeother\~%
|
||||
\@makeother\%\cd@obeytabs\cd@obeyspaces}
|
||||
% other: $&#^_~%
|
||||
% left special: \{}
|
||||
% unnecessary: @`'"
|
||||
|
||||
|
||||
%% codebox, centercode
|
||||
%%=============================================================================
|
||||
%% The codebox env makes a box exactly as wide as it needs to be
|
||||
%% (i.e., as wide as the longest line of code is). This is useful
|
||||
%% if you want to center a chunk of code, or flush it right, or
|
||||
%% something like that. The optional argument to the environment,
|
||||
%% [t], [c], or [b], specifies how to vertically align the codebox,
|
||||
%% just as with arrays or other boxes. Default is [c].
|
||||
|
||||
%% Must be a newline immediately after "\begin{codebox}[t]"!
|
||||
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\cd@obeycr{\catcode`\^^M=\active\let^^M=\cr}}
|
||||
|
||||
% If there is a [<letter>] option, then the following newline will
|
||||
% be read *after* ^M is bound to \cr, so we're cool. If there isn't
|
||||
% an option given (i.e., default to [c]), then the @\ifnextchar will
|
||||
% gobble up the newline as it gobbles whitespace. So we insert the
|
||||
% \cr explicitly. Isn't TeX fun?
|
||||
\def\codebox{\leavevmode\@ifnextchar[{\@codebox}{\@codebox[c]\cr}} %]
|
||||
|
||||
\def\@codebox[#1]%
|
||||
{\hbox\bgroup$\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi\bgroup%
|
||||
\tabskip\z@\setupcode\cd@obeycr% just before cd@obey
|
||||
\halign\bgroup##\hfil\span}
|
||||
|
||||
\def\endcodebox{\crcr\egroup\egroup\m@th$\egroup}
|
||||
|
||||
% Center the box on the page:
|
||||
\newenvironment{centercode}%
|
||||
{\begin{center}\begin{codebox}[c]}%
|
||||
{\end{codebox}\end{center}}
|
||||
|
||||
|
||||
%% code, codeaux, tightcode
|
||||
%%=============================================================================
|
||||
%% Code environment as described above. Lines are kept on one page.
|
||||
%% This actually works by setting a huge penalty for breaking
|
||||
%% between lines of code. Code is indented same as other displayed paras.
|
||||
%% Note: to increase left margin, use \begin{codeaux}{\leftmargin=1in}.
|
||||
|
||||
% To allow pagebreaks, say \codeallowbreaks immediately inside the env.
|
||||
% You can allow breaks at specific lines with a \pagebreak form.
|
||||
|
||||
%% N.B.: The \global\@ignoretrue command must be performed just inside
|
||||
%% the *last* \end{...} before the following text. If not, you will
|
||||
%% get an extra space on the following line. Blech.
|
||||
|
||||
%% This environment takes two arguments.
|
||||
%% The second, required argument is the \list parameters to override the
|
||||
%% \@listi... defaults.
|
||||
%% - Usefully set by clients: \topsep \leftmargin
|
||||
%% - Possible, but less useful: \partopsep
|
||||
%% The first, optional argument is the extra \parskip glue that you get around
|
||||
%% \list environments. It defaults to the value of \parskip.
|
||||
\def\codeaux{\@ifnextchar[{\@codeaux}{\@codeaux[\parskip]}} %]
|
||||
\def\@codeaux[#1]#2{%
|
||||
\bgroup\parskip#1%
|
||||
\begin{list}{}%
|
||||
{\parsep\z@\rightskip\z@\listparindent\z@\itemindent\z@#2}%
|
||||
\item[]\setupcode\cd@obeylines}%
|
||||
\def\endcodeaux{\end{list}\leavevmode\egroup\ignorespaces\global\@ignoretrue}
|
||||
|
||||
%% Code env is codeaux with the default margin and spacing \list params:
|
||||
\def\code{\codeaux{}} \let\endcode=\endcodeaux
|
||||
|
||||
%% Like code, but with no extra vertical space above and below.
|
||||
\def\tightcode{\codeaux[=0pt]{\topsep\z@}}%
|
||||
\let\endtightcode\endcodeaux
|
||||
% {\vspace{-1\parskip}\begin{codeaux}{\partopsep\z@\topsep\z@}}%
|
||||
% {\end{codeaux}\vspace{-1\parskip}}
|
||||
|
||||
|
||||
|
||||
% Reasonable separation between lines of code
|
||||
\newcommand{\codeskip}{\penalty0\vspace{2ex}}
|
||||
|
||||
|
||||
% \cd is used to build a code environment in the middle of text.
|
||||
% Note: only difference from display code is that cr's are taken
|
||||
% as unbreakable spaces instead of linebreaks.
|
||||
|
||||
\def\cd{\leavevmode\begingroup\ifmmode\let\startcode=\startmcode\else%
|
||||
\let\startcode\starttcode\fi%
|
||||
\setupcode\cd@obeycrsp\startcode}
|
||||
|
||||
\def\starttcode#1{#1\endgroup}
|
||||
\def\startmcode#1{\hbox{#1}\endgroup}
|
||||
|
||||
|
||||
% Restore $&#^_~% to their normal catcodes
|
||||
% Define \^ to give the ^ char.
|
||||
% \dcd points to this guy inside a code env.
|
||||
\def\cd@dcd{\catcode`\$=3\catcode`\&=4\catcode`\#=6\catcode`\^=7%
|
||||
\catcode`\_=8\catcode`\~=13\catcode`\%=14\def\^{\char`\^}}
|
||||
|
||||
% Selectively enable $, and $^_ as special.
|
||||
% \cd@mathspecial also defines \^ give the ^ char.
|
||||
% \cddollar and \cdmath point to these guys inside a code env.
|
||||
\def\cd@dollarspecial{\catcode`\$=3}
|
||||
\def\cd@mathspecial{\catcode`\$=3\catcode`\^=7\catcode`\_=8%
|
||||
\def\^{\char`\^}}
|
||||
|
||||
|
||||
% Change log:
|
||||
% Started off as some macros found in C. Rich's library.
|
||||
% Olin 1/90:
|
||||
% Removed \makeatletter, \makeatother's -- they shouldn't be there,
|
||||
% because style option files are read with makeatletter. The terminal
|
||||
% makeatother screwed things up for the following style options.
|
||||
% Olin 3/91:
|
||||
% Rewritten.
|
||||
% - Changed things so blank lines don't get compressed out (the \leavevmove
|
||||
% in \cd@cr and \cd@crwb).
|
||||
% - Changed names to somewhat less horrible choices.
|
||||
% - Added lots of doc, so casual hackers can more easily mess with all this.
|
||||
% - Removed `'"@ from the set of hacked chars, since they are already
|
||||
% non-special.
|
||||
% - Removed the bigcode env, which effect can be had with the \codeallowbreaks
|
||||
% command.
|
||||
% - Removed the \@noligs command, since it's already defined in latex.tex.
|
||||
% - Win big with the new \dcd, \cddollar, and \cdmath commands.
|
||||
% - Now, *only* the chars \{} are special inside the code env. If you need
|
||||
% more, use the \dcd command inside a group.
|
||||
% - \cd now works inside math mode. (But if you use it in a superscript,
|
||||
% it still comes out full size. You must explicitly put a \scriptsize\tt
|
||||
% inside the \cd: $x^{\cd{\scriptsize\tt...}}$. A \leavevmode was added
|
||||
% so that if you begin a paragraph with a \cd{...}, TeX realises you
|
||||
% are starting a paragraph.
|
||||
% - Added the codebox env. Tricky bit involving the first line hacked
|
||||
% with help from David Long.
|
||||
% Olin 8/94
|
||||
% Changed the font commands for LaTeX2e.
|
|
@ -0,0 +1,6 @@
|
|||
% Loads cmtt fonts in on \tt. -*- latex -*-
|
||||
% I prefer these to the Courier fonts that latex gives you w/postscript styles.
|
||||
% Courier is too spidery and too wide -- it's hard to get 80 chars on a line.
|
||||
% -Olin
|
||||
|
||||
\renewcommand{\ttdefault}{cmtt}
|
|
@ -0,0 +1,271 @@
|
|||
\makeatletter
|
||||
\def\ie{\mbox{\emph{i.e.}}} % \mbox keeps the last period from
|
||||
\def\Ie{\mbox{\emph{I.e.}}} % looking like an end-of-sentence.
|
||||
\def\eg{\mbox{\emph{e.g.}}}
|
||||
\def\Eg{\mbox{\emph{E.g.}}}
|
||||
\def\etc{{\em etc.}}
|
||||
|
||||
\def\Lisp{\textsc{Lisp}}
|
||||
\def\CommonLisp{\textsc{Common Lisp}}
|
||||
\def\Ascii{\textsc{Ascii}}
|
||||
\def\Ansi{\textsc{Ansi}}
|
||||
\def\Unix{{Unix}} % Not smallcaps, according to Bart.
|
||||
\def\Scheme{{Scheme}}
|
||||
\def\scm{{Scheme 48}}
|
||||
\def\R4RS{R4RS}
|
||||
\def\Posix{\textsc{Posix}}
|
||||
|
||||
\def\sharpf{\normalfont\texttt{\#f}}
|
||||
\def\sharpt{\normalfont\texttt{\#t}}
|
||||
\newcommand{\synteq}{\textnormal{::=}}
|
||||
|
||||
\def\maketildeother{\catcode`\~=12}
|
||||
\def\maketildeactive{\catcode`\~=13}
|
||||
\def\~{\char`\~}
|
||||
|
||||
% One-line code examples
|
||||
%\newcommand{\codex}[1]% One line, centred. Tight spacing.
|
||||
% {$$\abovedisplayskip=.75ex plus 1ex minus .5ex%
|
||||
% \belowdisplayskip=\abovedisplayskip%
|
||||
% \abovedisplayshortskip=0ex plus .5ex%
|
||||
% \belowdisplayshortskip=\abovedisplayshortskip%
|
||||
% \hbox{\ttt #1}$$}
|
||||
%\newcommand{\codex}[1]{\begin{tightinset}\ex{#1}\end{tightinset}\ignorespaces}
|
||||
\newcommand{\codex}[1]{\begin{leftinset}\ex{#1}\end{leftinset}\ignorespaces}
|
||||
|
||||
\def\widecode{\codeaux{\leftmargin=0pt\topsep=0pt}}
|
||||
\def\endwidecode{\endcodeaux}
|
||||
|
||||
% For multiletter vars in math mode:
|
||||
\newcommand{\var}[1]{\mbox{\frenchspacing\it{#1}}}
|
||||
\newcommand{\vari}[2]{\ensuremath{\mbox{\it{#1}}_{#2}}}
|
||||
|
||||
%% What you frequently want when you say \tt:
|
||||
\def\ttchars{\catcode``=13\@noligs\frenchspacing}
|
||||
\def\ttt{\normalfont\ttfamily\ttchars}
|
||||
|
||||
% Works in math mode; all special chars remain special; cheaper than \cd.
|
||||
% Will not be correct size in super and subscripts, though.
|
||||
\newcommand{\ex}[1]{{\normalfont\texttt{\ttchars #1}}}
|
||||
|
||||
\newenvironment{inset}
|
||||
{\bgroup\parskip=1ex plus 1ex\begin{list}{}%
|
||||
{\topsep=0pt\rightmargin\leftmargin}%
|
||||
\item[]}%
|
||||
{\end{list}\leavevmode\egroup\global\@ignoretrue}
|
||||
|
||||
\newenvironment{leftinset}
|
||||
{\bgroup\parskip=1ex plus 1ex\begin{list}{}%
|
||||
{\topsep=0pt}%
|
||||
\item[]}%
|
||||
{\end{list}\leavevmode\egroup\global\@ignoretrue}
|
||||
|
||||
\newenvironment{tightinset}
|
||||
{\bgroup\parskip=0pt\begin{list}{}%
|
||||
{\topsep=0pt\rightmargin\leftmargin}%
|
||||
\item[]}%
|
||||
{\end{list}\leavevmode\egroup\global\@ignoretrue}
|
||||
|
||||
\newenvironment{tightleftinset}
|
||||
{\bgroup\parskip=0pt\begin{list}{}%
|
||||
{\topsep=0pt}%
|
||||
\item[]}%
|
||||
{\end{list}\leavevmode\egroup\global\@ignoretrue}
|
||||
|
||||
\long\def\remark#1{\bgroup\small\begin{quote}\textsl{Remark: } #1\end{quote}\egroup}
|
||||
\newenvironment{remarkenv}{\bgroup\small\begin{quote}\textsl{Remark: }}%
|
||||
{\end{quote}\egroup}
|
||||
\newcommand{\oops}[1]{\bgroup\small\begin{quote}\textsl{Oops: } #1\end{quote}\egroup}
|
||||
|
||||
\newcommand{\note}[1]{\{Note #1\}}
|
||||
|
||||
\newcommand{\itum}[1]{\item{\bf #1}\\*}
|
||||
|
||||
% For use in code. The \llap magicness makes the lambda exactly as wide as
|
||||
% the other chars in \tt; the \hskip shifts it right a bit so it doesn't
|
||||
% crowd the left paren -- which is necessary if \tt is cmtt.
|
||||
% Note that (\l{x y} (+ x y)) uses the same number of columns in TeX form
|
||||
% as it produces when typeset. This makes it easy to line up the columns
|
||||
% in your input. \l is bound to some useless command in LaTeX, so we have to
|
||||
% define it w/renewcommand.
|
||||
\let\oldl\l %Save the old \l on \oldl
|
||||
\renewcommand{\l}[1]{\ \llap{$\lambda$\hskip-.05em}\ (#1)}
|
||||
|
||||
% This one is for the rare (lambda x ...) case -- it doesn't have the
|
||||
% column-invariant property. Oh, well.
|
||||
\newcommand{\lx}[1]{\ \llap{$\lambda$\hskip-.05em}\ {#1}}
|
||||
|
||||
% For subcaptions
|
||||
\newcommand{\subcaption}[1]
|
||||
{\unskip\vspace{-2mm}\begin{center}\unskip\em#1\end{center}}
|
||||
|
||||
%%% T release notes stuff
|
||||
\newlength{\notewidth}
|
||||
\setlength{\notewidth}{\textwidth}
|
||||
\addtolength{\notewidth}{-1.25in}
|
||||
|
||||
%\newcommand{\remark} [1]
|
||||
% {\par\vspace{\parskip}
|
||||
% \parbox[t]{.75in}{\sc Remark:}
|
||||
% \parbox[t]{\notewidth}{\em #1}
|
||||
% \vspace{\parskip}
|
||||
% }
|
||||
|
||||
\newenvironment{optiontable}%
|
||||
{\begin{tightinset}\renewcommand{\arraystretch}{1.5}%
|
||||
\begin{tabular}{@{}>{\ttt}ll@{}}}%
|
||||
{\end{tabular}\end{tightinset}}%
|
||||
|
||||
\newenvironment{desctable}[1]%
|
||||
{\begin{inset}\renewcommand{\arraystretch}{1.5}%
|
||||
\begin{tabular}{lp{#1}}}%
|
||||
{\end{tabular}\end{inset}}
|
||||
|
||||
\def\*{{\ttt *}}
|
||||
|
||||
% Names of things
|
||||
|
||||
\newcommand{\keyword} [1]{\index{#1}{\normalfont\textsf{#1}}}
|
||||
|
||||
\newcommand{\evalto}{$\Longrightarrow$\ }
|
||||
\renewcommand{\star}{$^*$\/}
|
||||
\newcommand{\+}{$^+$}
|
||||
|
||||
% Semantic domains, used to indicate the type of a value
|
||||
|
||||
\newcommand{\sem}{\normalfont\itshape} %semantic font
|
||||
\newcommand{\semvar}[1]{\textit{#1}} %semantic font
|
||||
\newcommand{\synvar}[1]{\textrm{\textit{$<$#1$>$}}} %syntactic font
|
||||
\newcommand{\type}{\sem}
|
||||
\newcommand{\zeroormore}[1]{{\sem #1$_1$ \ldots #1$_n$}}
|
||||
\newcommand{\oneormore}[1]{{\sem #1$_1$ #1$_2$ \ldots #1$_n$}}
|
||||
|
||||
\newcommand{\proc} {{\sem procedure}}
|
||||
\newcommand{\boolean} {{\sem boolean}}
|
||||
\newcommand{\true} {{\sem true}}
|
||||
\newcommand{\false} {{\sem false}}
|
||||
|
||||
\newcommand{\num} {{\sem number}}
|
||||
\newcommand{\fixnum} {{\sem fixnum}}
|
||||
\newcommand{\integer} {{\sem integer}}
|
||||
\newcommand{\real} {{\sem real}}
|
||||
|
||||
\newcommand{\character} {{\sem character}}
|
||||
\newcommand{\str} {{\sem string}}
|
||||
\newcommand{\sym} {{\sem symbol}}
|
||||
|
||||
\newcommand{\location} {{\sem location}}
|
||||
\newcommand{\object} {{\sem object}}
|
||||
|
||||
\newcommand{\error} {{\sem error}}
|
||||
\newcommand{\syntaxerror} {{\sem syntax error}}
|
||||
\newcommand{\readerror} {{\sem read error}}
|
||||
\newcommand{\undefined} {{\sem undefined}}
|
||||
\newcommand{\noreturn} {{\sem no return value}}
|
||||
|
||||
\newcommand{\port} {{\sem port}}
|
||||
|
||||
% semantic variables
|
||||
|
||||
\newcommand{\identifier} {{\sem identifier}}
|
||||
\newcommand{\identifiers} {\zeroormore{\<ident>}}
|
||||
\newcommand{\expr} {{\sem expression}}
|
||||
\newcommand{\body} {{\sem body}}
|
||||
\newcommand{\valueofbody} {{\sem value~of~body}}
|
||||
\newcommand{\emptylist} {{\sem empty~list}}
|
||||
\newcommand{\car} {\keyword{car}}
|
||||
\newcommand{\cdr} {\keyword{cdr}}
|
||||
|
||||
|
||||
% generally useful things
|
||||
|
||||
% For line-breaking \tt stuff.
|
||||
\renewcommand{\=}{\discretionary{-}{}{-}}
|
||||
\newcommand{\ob}{\discretionary{}{}{}} % Optional break.
|
||||
|
||||
\newcommand{\indx}[1]{#1 \index{ #1 }}
|
||||
%\newcommand{\gloss}[1]{#1 \glossary{ #1 }}
|
||||
|
||||
% This lossage produces #2 if #1 is zero length, otw #3.
|
||||
% We use it to conditionally add a space between the procedure and
|
||||
% the args in procedure prototypes, but only if there are any args--
|
||||
% we want to produce "(read)", not "(read )".
|
||||
\newlength{\voidlen}
|
||||
\newcommand{\testvoid}[3]{\settowidth\voidlen{#1}\ifdim\voidlen>0in{#3}\else{#2}\fi}
|
||||
|
||||
|
||||
% Typeset a definition prototype line, e.g.:
|
||||
% (cons <arg1> <arg2>) -> pair procedure
|
||||
%
|
||||
% Five args are: proc-name args ret-value(s) type index-entry
|
||||
\newcommand{\dfnix}[4]% FIVE args, really.
|
||||
{\hbox to \linewidth{\ttchars%
|
||||
{\ttt(#1\testvoid{#2}{}{\ }{\sem{#2}}\testvoid{#2}{}{\/})\hskip 1em minus
|
||||
0.5em$\longrightarrow$\hskip 1em minus 0.5em{\sem{#3}}\hfill\quad\textnormal{#4}}}\index}
|
||||
|
||||
\newcommand{\dfnx}[4] {\dfnix{#1}{#2}{#3}{#4}{#1@\texttt{#1}}}
|
||||
|
||||
\newcommand{\dfn} {\par\medskip\dfnx} % Takes 4 args, actually.
|
||||
\newcommand{\dfni} {\par\medskip\dfnix} % Takes 5 args, actually.
|
||||
|
||||
\newcommand{\defvar} {\par\medskip\defvarx} % Takes 4 args, actually.
|
||||
\newcommand{\defvarx}[2]%
|
||||
{\index{#1}
|
||||
\hbox to \linewidth{\ttchars{{\ttt{#1}} \hfill #2}}}%
|
||||
|
||||
% Typeset the protocol line, then do the following descriptive text indented.
|
||||
% If you want to group two procs together, do the first one with a \dfn,
|
||||
% then the second one, and the documentation, with a \defndescx.
|
||||
|
||||
% This one doesn't put whitespace above. Use it immediately after a \dfn
|
||||
% to group two prototype lines together.
|
||||
\newenvironment{dfndescx}[4]%
|
||||
{\dfnx{#1}{#2}{#3}{#4}\begin{desc}}{\end{desc}}
|
||||
|
||||
\newenvironment{dfndesc}[4] % This one puts whitespace above.
|
||||
{\par\medskip\begin{dfndescx}{#1}{#2}{#3}{#4}}
|
||||
{\end{dfndescx}}
|
||||
|
||||
\newenvironment{desc}%
|
||||
{\nopagebreak[2]%
|
||||
\smallskip
|
||||
\bgroup\begin{list}{}{\topsep=0pt\parskip=0pt}\item[]}
|
||||
{\end{list}\leavevmode\egroup\global\@ignoretrue}
|
||||
|
||||
\newcommand{\defun} [3] {\dfn{#1}{#2}{#3}{procedure}} % preskip
|
||||
\newcommand{\defunx}[3]{\dfnx{#1}{#2}{#3}{procedure}} % no skip
|
||||
|
||||
\newenvironment{defundescx}[3]%
|
||||
{\begin{dfndescx}{#1}{#2}{#3}{procedure}}
|
||||
{\end{dfndescx}}
|
||||
|
||||
\newenvironment{defundesc}[3]%
|
||||
{\begin{dfndesc}{#1}{#2}{#3}{procedure}}
|
||||
{\end{dfndesc}}
|
||||
|
||||
|
||||
\newenvironment{column}{\begin{tabular}[t]{@{}l@{}}}{\end{tabular}}
|
||||
|
||||
\newenvironment{exampletable}%
|
||||
{\begin{leftinset}%
|
||||
\newcommand{\header}[1]{\multicolumn{2}{@{}l@{}}{##1}\\}%
|
||||
\newcommand{\splitline}[2]%
|
||||
{\multicolumn{2}{@{}l@{}}{##1}\\\multicolumn{2}{@{}l@{}}{\qquad\evalto\quad{##2}}}
|
||||
\begin{tabular}{@{}l@{\quad\evalto\quad}l@{}}}%
|
||||
{\end{tabular}\end{leftinset}}
|
||||
|
||||
% Put on blank lines in a code env to allow a pagebreak.
|
||||
\newcommand{\cb}{\pagebreak[0]}
|
||||
|
||||
\newenvironment{boxedcode}
|
||||
{\begin{inset}\tabular{|l|}\hline}
|
||||
{\\ \hline \end{tabular}\end{inset}}
|
||||
|
||||
% A ragged-right decl that doesn't redefine \\ -- for use in tables.
|
||||
\newcommand{\raggedrightparbox}{\let\temp=\\\raggedright\let\\=\temp}
|
||||
|
||||
\newenvironment{boxedfigure}[1]%
|
||||
{\begin{figure}[#1]\begin{boxedminipage}{\linewidth}\vskip 1.5ex}
|
||||
{\end{boxedminipage}\end{figure}}
|
||||
|
||||
\makeatother
|
|
@ -0,0 +1,76 @@
|
|||
% Document style option "draftfooter"
|
||||
% -- usage: \documentstyle[...,draftfooter,...]{...}
|
||||
% -- puts "DRAFT" with date and time in page footer
|
||||
%
|
||||
% Olin Shivers 1/17/94
|
||||
% - Hacked from code I used in my dissertation and from code in a
|
||||
% drafthead.sty package written by Stephen Page sdpage@uk.ac.oxford.prg.
|
||||
%----------------------------------------------------------------------------
|
||||
|
||||
%
|
||||
% compute the time in hours and minutes; make new variables \timehh and \timemm
|
||||
%
|
||||
\newcount\timehh\newcount\timemm
|
||||
\timehh=\time
|
||||
\divide\timehh by 60 \timemm=\time
|
||||
\count255=\timehh\multiply\count255 by -60 \advance\timemm by \count255
|
||||
%
|
||||
|
||||
\def\draftbox{{\protect\small\bf \fbox{DRAFT}}}
|
||||
\def\drafttime{%
|
||||
{\protect\small\sl\today\ -- \ifnum\timehh<10 0\fi%
|
||||
\number\timehh\,:\,\ifnum\timemm<10 0\fi\number\timemm}}
|
||||
\def\drafttimer{\protect\makebox[0pt][r]{\drafttime}}
|
||||
\def\drafttimel{\protect\makebox[0pt][l]{\drafttime}}
|
||||
|
||||
\def\thepagel{\protect\makebox[0pt][l]{\rm\thepage}}
|
||||
\def\thepager{\protect\makebox[0pt][r]{\rm\thepage}}
|
||||
|
||||
% Header is empty.
|
||||
% Footer is "date DRAFT pageno"
|
||||
\def\ps@plain{
|
||||
\let\@mkboth\@gobbletwo
|
||||
\let\@oddhead\@empty \let\@evenhead\@empty
|
||||
|
||||
\def\@oddfoot{\reset@font\rm\drafttimel\hfil\draftbox\hfil\thepager}
|
||||
\if@twoside
|
||||
\def\@evenfoot{\reset@font\rm\thepagel\hfil\draftbox\hfil\drafttimer}
|
||||
\else \let\@evenfoot\@oddfoot
|
||||
\fi
|
||||
}
|
||||
|
||||
% Aux macro -- sets footer to be "date DRAFT".
|
||||
\def\@draftfooters{
|
||||
\def\@oddfoot{\reset@font\rm\drafttimel\hfil\draftbox}
|
||||
\if@twoside
|
||||
\def\@evenfoot{\reset@font\rm\draftbox\hfil\drafttimer}
|
||||
\else \let\@evenfoot\@oddfoot
|
||||
\fi
|
||||
}
|
||||
|
||||
% Header is empty.
|
||||
% Footer is "date DRAFT".
|
||||
\def\ps@empty{
|
||||
\let\@mkboth\@gobbletwo
|
||||
\let\@oddhead\@empty \let\@evenhead\@empty
|
||||
\@draftfooters
|
||||
}
|
||||
|
||||
% Header is defined by the document style (article, book, etc.).
|
||||
% Footer is "date DRAFT".
|
||||
\let\@draftoldhead\ps@headings
|
||||
\def\ps@headings{
|
||||
\@draftoldhead % Do the default \pagestyle{headings} stuff.
|
||||
\@draftfooters % Then define the draft footers:
|
||||
}
|
||||
|
||||
% Header is defined by the document style (article, book, etc.),
|
||||
% and filled in by user's \markboth and \markright commands.
|
||||
% Footer is "date DRAFT".
|
||||
\let\@draftoldmyhead\ps@myheadings
|
||||
\def\ps@myheadings{
|
||||
\@draftoldmyhead % Do the default \pagestyle{myheadings} stuff.
|
||||
\@draftfooters % Then define the draft footers:
|
||||
}
|
||||
|
||||
\ps@plain
|
|
@ -1,10 +1,9 @@
|
|||
%&latex -*- latex -*-
|
||||
|
||||
\title{Scsh Reference Manual}
|
||||
\subtitle{For Scsh release 0.3 \\
|
||||
December 25, 1994}
|
||||
\subtitle{For scsh release 0.5.3}
|
||||
\author{Olin Shivers and Brian D.~Carlstrom}
|
||||
\date{12/94}
|
||||
\date{September 1999}
|
||||
|
||||
\maketitle
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
% headings.tex -*- latex -*-
|
||||
% Quieter headings that the ones used in article.sty.
|
||||
% This is not a style option. Don't say [headings].
|
||||
% Instead, say \input{headings} after the \documentstyle.
|
||||
% -Olin 7/91
|
||||
|
||||
\makeatletter
|
||||
|
||||
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
|
||||
-.2ex}{2.3ex plus .2ex}{\large\normalfont\bfseries}}
|
||||
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus
|
||||
-.2ex}{1.5ex plus .2ex}{\normalsize\normalfont\bfseries}}
|
||||
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
|
||||
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\normalfont\bfseries}}
|
||||
|
||||
\makeatother
|
|
@ -3,16 +3,88 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\chapter{Introduction}
|
||||
|
||||
This is a draft manual for scsh, a {\Unix} shell that is embedded within
|
||||
{\Scheme}.
|
||||
Scsh comes built on top of {\scm}, and it has two components:
|
||||
This is the reference manual for scsh,
|
||||
a {\Unix} shell that is embedded within {\Scheme}.
|
||||
Scsh is a Scheme system designed for writing useful standalone Unix
|
||||
programs and shell scripts---it spans a wide range of application,
|
||||
from ``script'' applications usually handled with perl or sh,
|
||||
to more standard systems applications usually written in C.
|
||||
|
||||
Scsh comes built on top of {\scm}, and has two components:
|
||||
a process notation for running programs and setting up pipelines
|
||||
and redirections,
|
||||
and a complete syscall library for low-level access to the OS.
|
||||
and a complete syscall library for low-level access to the operating system.
|
||||
This manual gives a complete description of scsh.
|
||||
A general discussion of the design principles behind scsh can be found
|
||||
in a companion paper, ``A Scheme Shell.''
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Obtaining scsh}
|
||||
Scsh is distributed via net publication.
|
||||
We place new releases at well-known network sites,
|
||||
and allow them to propagate from there.
|
||||
We currently release scsh to the following Internet sites:
|
||||
\begin{inset}\begin{flushleft}
|
||||
\ex{ftp://ftp-swiss.ai.mit.edu/pub/su/} \\
|
||||
\ex{http://www-swiss.ai.mit.edu/scsh/scsh.html}
|
||||
\ex{http://www.cs.indiana.edu/scheme-repository/} \\
|
||||
\end{flushleft}
|
||||
\end{inset}
|
||||
These sites are
|
||||
the MIT Project Mac ftp server,
|
||||
the Scheme Shell home page, and
|
||||
the Indiana Scheme Repository home page,
|
||||
respectively.
|
||||
Each should have a compressed tar file of the entire scsh release,
|
||||
which includes all the source code and the manual,
|
||||
and a separate file containing just this manual in Postscript form,
|
||||
for those who simply wish to read about the system.
|
||||
|
||||
However, nothing is certain for long on the Net.
|
||||
Probably the best way to get a copy of scsh is to use a network
|
||||
resource-discovery tool, such as archie,
|
||||
to find ftp servers storing scsh tar files.
|
||||
Take the set of sites storing the most recent release of scsh,
|
||||
choose one close to your site, and download the tar file.
|
||||
|
||||
\section{Building scsh}
|
||||
Scsh currently runs on a fairly large set of Unix systems, including
|
||||
Linux, NetBSD, SunOS, Solaris, AIX, NeXTSTEP, Irix, and HP-UX.
|
||||
We use the Gnu project's autoconfig tool to generate self-configuring
|
||||
shell scripts that customise the scsh Makefile for different OS variants.
|
||||
This means that if you use one of the common Unix implementations,
|
||||
building scsh should require exactly the following steps:
|
||||
\begin{inset}
|
||||
\begin{tabular}{l@{\qquad}l}
|
||||
\ex{gunzip scsh.tar.gz} & \emph{Uncompress the release tar file.} \\
|
||||
\ex{untar xfv scsh.tar} & \emph{Unpack the source code.} \\
|
||||
\ex{cd scsh-0.5} & \emph{Move to the source directory.} \\
|
||||
\ex{./configure} & \emph{Examine host; build Makefile.} \\
|
||||
\ex{make} & \emph{Build system.}
|
||||
\end{tabular}
|
||||
\end{inset}
|
||||
When you are done, you should have a virtual machine compiled in
|
||||
file \ex{scshvm}, and a heap image in file \ex{scsh/scsh.image}.
|
||||
Typing
|
||||
\begin{code}
|
||||
make install
|
||||
\end{code}
|
||||
will install these programs in your installation directory
|
||||
(by default, \ex{/usr/local}), along with a small stub startup
|
||||
binary, \ex{scsh}.
|
||||
|
||||
If you don't have the patience to do this, you can start up
|
||||
a Scheme shell immediately after the initial make by simply
|
||||
saying
|
||||
\codex{./scshvm -o ./scshvm -i scsh/scsh.image}
|
||||
See chapter~\ref{chapt:running} for full details on installation
|
||||
locations and startup options.
|
||||
|
||||
It is not too difficult to port scsh to another Unix platform if your
|
||||
OS is not supported by the current release.
|
||||
See the release notes for more details on how to do this.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Caveats}
|
||||
|
||||
It is important to note what scsh is \emph{not}, as well as what it is.
|
||||
|
@ -20,23 +92,24 @@ Scsh, in the current release, is primarily designed for the writing of
|
|||
shell scripts---programming.
|
||||
It is not a very comfortable system for interactive command use:
|
||||
the current release lacks job control, command-line editing, a terse,
|
||||
convenient command syntax, and it can not be made to read in an initialisation
|
||||
convenient command syntax, and it does not read in an initialisation
|
||||
file analogous to \ex{.login} or \ex{.profile}.
|
||||
We hope to address all of these problems in future releases;
|
||||
We hope to address all of these issues in future releases;
|
||||
we even have designs for several of these features;
|
||||
but the system as-released does not currently address these issues.
|
||||
but the system as-released does not currently provide these features.
|
||||
|
||||
As a first release, the system has some rough edges.
|
||||
It is quite slow to start up; we hope to fix that by providing
|
||||
a static-heap linker in the next release.
|
||||
For now, the initial image load takes about a cpu second.
|
||||
In the current release, the system has some rough edges.
|
||||
It is quite slow to start up---loading the initial image into the
|
||||
{\scm} virtual machine takes about a cpu second.
|
||||
This can be fixed with the static heap linker provided with this release.
|
||||
|
||||
This manual is very, very rough: incomplete, inconsistent, and misleading.
|
||||
At some point, we will polish it up, finish it off, and re-typeset it
|
||||
This manual is very, very rough.
|
||||
At some point, we hope to polish it up, finish it off, and re-typeset it
|
||||
using markup, so we can generate html, info nodes, and {\TeX} output from
|
||||
the single source without having to deal with Texinfo.
|
||||
But it's all there is, for now.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Naming conventions}
|
||||
Scsh follows a general naming scheme that consistently employs a set of
|
||||
abbreviations.
|
||||
|
@ -90,11 +163,11 @@ Some of the common ones are:
|
|||
|
||||
\item[\ex{create-}]
|
||||
Procedures that create objects in the file system (files, directories,
|
||||
temp files, fifos, etc), begin with \ex{create-\ldots}.
|
||||
temp files, fifos, \etc), begin with \ex{create-\ldots}.
|
||||
|
||||
\item [\ex{delete-}]
|
||||
Procedures that delete objects from the file system (files,
|
||||
directories, temp files, fifos, etc), begin with \ex{delete-\ldots}.
|
||||
directories, temp files, fifos, \etc), begin with \ex{delete-\ldots}.
|
||||
|
||||
\item[ \ex{\var{record}:\var{field}} ]
|
||||
Procedures that access fields of a record are usually written
|
||||
|
@ -118,11 +191,13 @@ For example, the various {\Unix} signal integers have the names
|
|||
\ex{signal/cont}, \ex{signal/kill}, \ex{signal/int}, \ex{signal/hup},
|
||||
and so forth.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Lexical issues}
|
||||
Scsh's lexical syntax is just {\R4RS} {\Scheme}, with the following
|
||||
exceptions.
|
||||
|
||||
Scsh differs from {\R4RS} {\Scheme} in the following ways:
|
||||
\subsection{Extended symbol syntax}
|
||||
Scsh's symbol syntax differs from {\R4RS} {\Scheme} in the following ways:
|
||||
\begin{itemize}
|
||||
\item In scsh, symbol case is preserved by \ex{read} and is significant on
|
||||
symbol comparison. This means
|
||||
|
@ -132,10 +207,7 @@ Scsh differs from {\R4RS} {\Scheme} in the following ways:
|
|||
\item ``\ex{-}'' and ``\ex{+}'' are allowed to begin symbols.
|
||||
So the following are legitimate symbols:
|
||||
\codex{-O2 -geometry +Wn}
|
||||
\end{itemize}
|
||||
%
|
||||
Scsh also extends {\R4RS} lexical syntax in the following ways:
|
||||
\begin{itemize}
|
||||
|
||||
\item ``\ex{|}'' and ``\ex{.}'' are symbol constituents.
|
||||
This allows \ex{|} for the pipe symbol, and \ex{..} for the parent-directory
|
||||
symbol. (Of course, ``\ex{.}'' alone is not a symbol, but a
|
||||
|
@ -144,16 +216,119 @@ Scsh also extends {\R4RS} lexical syntax in the following ways:
|
|||
\item A symbol may begin with a digit.
|
||||
So the following are legitimate symbols:
|
||||
\codex{9x15 80x36-3+440}
|
||||
|
||||
\item Strings are allowed to contain the {\Ansi} C escape sequences
|
||||
such as \verb|\n| and \verb|\161|.
|
||||
|
||||
\item \ex{\#!} is a comment read-macro similar to \ex{;}.
|
||||
This is used to write shell scripts. When the reader
|
||||
encounters \ex{\#!}, it skips characters until it finds
|
||||
the sequence new\-line/{\ob}ex\-cla\-ma\-tion-{\ob}point/{\ob}sharp-{\ob}sign/{\ob}new\-line.
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Extended string syntax}
|
||||
Scsh strings are allowed to contain the {\Ansi} C escape sequences
|
||||
such as \verb|\n| and \verb|\161|.
|
||||
|
||||
\subsection{Block comments and executable interpreter-triggers}
|
||||
Scsh allows source files to begin with a header of the form
|
||||
\codex{\#!/usr/local/bin/scsh -s}
|
||||
The Unix operating system treats source files beginning with the headers
|
||||
of this form specially;
|
||||
they can be directly executed by the operating system
|
||||
(see chapter~\ref{chapt:running} for information on how to use this feature).
|
||||
The scsh interpreter ignores this special header by treating \ex{\#!} as a
|
||||
comment marker similar to \ex{;}.
|
||||
When the scsh reader encounters \ex{\#!}, it skips characters until it finds
|
||||
the closing sequence
|
||||
new\-line/{\ob}ex\-cla\-ma\-tion-{\ob}point/{\ob}sharp-{\ob}sign/{\ob}new\-line.
|
||||
|
||||
Although the form of the \ex{\#!} read-macro was chosen to support
|
||||
interpreter-triggers for executable Unix scripts,
|
||||
it is a general block-comment sequence and can be used as such
|
||||
anywhere in a scsh program.
|
||||
|
||||
\subsection{Here-strings}
|
||||
The read macro \ex{\#<} is used to introduce ``here-strings''
|
||||
in programs, similar to the \ex{<<} ``here document'' redirections
|
||||
provided by sh and csh.
|
||||
There are two kinds of here-string, character-delimited and line-delimited;
|
||||
they are both introduced by the \ex{\#<} sequence.
|
||||
|
||||
\subsubsection{Character-delimited here-strings}
|
||||
A \emph{character-delimited} here-string has the form
|
||||
\codex{\#<\emph{x}...stuff...\emph{x}}
|
||||
where \emph{x} is any single character
|
||||
(except \ex{<}, see below),
|
||||
which is used to delimit the string bounds.
|
||||
Some examples:
|
||||
\begin{inset}
|
||||
\begin{tabular}{ll}
|
||||
Here-string syntax & Ordinary string syntax \\ \hline
|
||||
\verb:#<|Hello, world.|: & \verb:"Hello, world.": \\
|
||||
\verb:#<!"Ouch," he said.!: & \verb:"\"Ouch,\" he said.":
|
||||
\end{tabular}
|
||||
\end{inset}
|
||||
%
|
||||
There is no interpretation of characters within the here-string;
|
||||
the characters are all copied verbatim.
|
||||
|
||||
\subsubsection{Line-delimited here-strings}
|
||||
If the sequence begins "\ex{\#<<}" then it introduces a \emph{line-delimited}
|
||||
here-string.
|
||||
These are similar to the ``here documents'' of sh and csh.
|
||||
Line-delimited here-strings are delimited by the rest of the text line that
|
||||
follows the "\ex{\#<<}" sequence.
|
||||
For example:
|
||||
|
||||
\begin{code}
|
||||
#<<FOO
|
||||
Hello, there.
|
||||
This is read by Scheme as a string,
|
||||
terminated by the first occurrence
|
||||
of newline-F-O-O-newline or newline-F-O-O-eof.
|
||||
FOO\end{code}
|
||||
%
|
||||
Thus,
|
||||
\begin{code}
|
||||
#<<foo
|
||||
Hello, world.
|
||||
foo\end{code}
|
||||
%
|
||||
is the same thing as
|
||||
\codex{"Hello, world."}
|
||||
|
||||
Line-delimited here-strings are useful for writing down long, constant
|
||||
strings---such as long, multi-line \ex{format} strings,
|
||||
or arguments to Unix programs, \eg,
|
||||
\begin{code}
|
||||
;; Free up some disk space for my netnews files.
|
||||
(run (csh -c #<<EOF
|
||||
cd /urops
|
||||
rm -rf *
|
||||
echo All done.
|
||||
|
||||
EOF
|
||||
))\end{code}
|
||||
|
||||
The advantage they have over the double-quote syntax
|
||||
(\eg, \ex{"Hello, world."})
|
||||
is that there is no need to backslash-quote special characters internal
|
||||
to the string, such as the double-quote or backslash characters.
|
||||
|
||||
The detailed syntax of line-delimited here-strings is as follows.
|
||||
The characters "\ex{\#<<}" begin the here-string.
|
||||
The characters between the "\ex{\#<<}" and the next newline are the
|
||||
\emph{delimiter line}.
|
||||
All characters between the "\ex{\#<<}" and the next newline comprise the
|
||||
delimiter line---including any white space.
|
||||
The body of the string begins on the following line,
|
||||
and is terminated by a line of text which exactly matches the
|
||||
delimiter line.
|
||||
This terminating line can be ended by either a newline or end-of-file.
|
||||
Absolutely no interpretation is done on the input string.
|
||||
Control characters, white space, quotes, backslash---everything
|
||||
is copied as-is.
|
||||
The newline immediately preceding the terminating delimiter line is
|
||||
not included in the result string
|
||||
(leave an extra blank line if you need to put a final
|
||||
newline in the here-string---see the example above).
|
||||
If EOF is encountered before reading the end of the here-string,
|
||||
an error is signalled.
|
||||
|
||||
\subsection{Dot}
|
||||
It is unfortunate that the single-dot token, ``\ex{.}'', is both
|
||||
a fundamental {\Unix} file name and a deep, primitive syntactic token
|
||||
in {\Scheme}---it means the following will not parse correctly in scsh:
|
||||
|
@ -161,6 +336,76 @@ in {\Scheme}---it means the following will not parse correctly in scsh:
|
|||
You must instead quote the dot:
|
||||
\codex{(run/strings (find "." -name *.c -print))}
|
||||
|
||||
When you write shell scripts that manipulate the file system,
|
||||
keep in mind the special status of the dot token.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Record types and the \texttt{define-record} form}
|
||||
\label{sec:defrec}
|
||||
\index{define-record@\texttt{define-record}}
|
||||
|
||||
Scsh's interfaces occasionally provide data in structured record types;
|
||||
an example is the \ex{file-info} record whose various fields describe the size,
|
||||
protection, last date of modification, and other pertinent data for a
|
||||
particular file.
|
||||
These record types are described in this manual using the \ex{define-record}
|
||||
notation, which looks like the following:
|
||||
%
|
||||
\begin{code}
|
||||
(define-record ship
|
||||
x
|
||||
y
|
||||
(size 100))\end{code}
|
||||
%
|
||||
This form defines a \var{ship} record, with three fields:
|
||||
its x and y coordinates, and its size.
|
||||
The values of the \var{x} and \var{y} fields are specified as parameters
|
||||
to the ship-building procedure, \ex{(make-ship \var{x} \var{y})},
|
||||
and the \var{size} field is initialised to 100.
|
||||
All told, the \ex{define-record} form above defines the following procedures:
|
||||
%
|
||||
\begin{center}
|
||||
\begin{tabular}{|ll|}
|
||||
\multicolumn{1}{l}{Procedure} & \multicolumn{1}{l}{Definition} \\
|
||||
\hline
|
||||
(make-ship \var{x} \var{y}) & Create a new \var{ship} record. \\
|
||||
\hline
|
||||
(ship:x \var{ship}) & Retrieve the \var{x} field. \\
|
||||
(ship:y \var{ship}) & Retrieve the \var{y} field. \\
|
||||
(ship:size \var{ship}) & Retrieve the \var{size} field. \\
|
||||
\hline
|
||||
(set-ship:x \var{ship} \var{new-x}) & Assign the \var{x} field. \\
|
||||
(set-ship:y \var{ship} \var{new-y}) & Assign the \var{x} field. \\
|
||||
(set-ship:size \var{ship} \var{new-size}) & Assign the \var{size} field. \\
|
||||
\hline
|
||||
(ship? \var{object}) & Type predicate. \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
%
|
||||
|
||||
An implementation of \ex{define-record} is available as a macro for Scheme
|
||||
programmers to define their own record types;
|
||||
the syntax is accessed by opening the package \ex{defrec-package}, which
|
||||
exports the single syntax form \ex{define-record}.
|
||||
|
||||
You must open this package to access the form.
|
||||
Scsh does not export a record-definition package by default as there are
|
||||
several from which to choose.
|
||||
Besides the \ex{define-record} macro, which Shivers prefers\footnote{He wrote
|
||||
it.}, you might instead wish to employ the notationally-distinct
|
||||
\ex{define-record-type} macro that Jonathan Rees
|
||||
prefers,\footnote{He wrote it.}
|
||||
or the identically named but wholly different \ex{define-record-type}
|
||||
macro that Richard Kelsey prefers.\footnote{He wrote it.}
|
||||
The former can be found in file \ex{rts/jar-defrecord.scm} and package
|
||||
\ex{define-record-types}; the latter can be found in file
|
||||
\ex{big/defrecord.scm} and package \ex{defrecord}.
|
||||
|
||||
Alternatively, you may define your own, of course.
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{A word about {\Unix} standards}
|
||||
``The wonderful thing about {\Unix} standards is that there are so many
|
||||
to choose from.''
|
||||
|
@ -185,5 +430,8 @@ supports all of it.
|
|||
The guerilla PC {\Unix} implementations that have been springing up on
|
||||
the net (\eg, NetBSD, Linux, FreeBSD, and so forth) are only recently coming
|
||||
into compliance with the standard---although they are getting there.
|
||||
We've found a few small problems with NeXTSTEP's {\Posix} support that
|
||||
we had to work around.
|
||||
We have been able to implement scsh completely on all of these systems,
|
||||
however---the single exception is NeXTSTEP, whose buggy {\Posix} libraries
|
||||
restricts us to partial support (these lacunae are indicated where relevant
|
||||
in the rest of the manual).\footnote{Feel like porting scsh from {\Posix} to
|
||||
NeXT's BSD API? Send us your fixes; we'll fold them in.}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
%&latex -*- latex -*-
|
||||
|
||||
% This is the reference manual for the Scheme Shell.
|
||||
|
||||
\documentclass[twoside]{report}
|
||||
\usepackage{code,boxedminipage,makeidx,palatino,ct,
|
||||
headings,mantitle,array,matter,mysize10}
|
||||
|
||||
\usepackage[dvipdfm,hyperindex,hypertex,
|
||||
pdftitle={scsh manual, release 0.5.3},
|
||||
pdfauthor={Olin Shivers and Brian D.~Carlstrom}
|
||||
colorlinks=true,linkcolor=blue,pagecolor=blue,urlcolor=blue,
|
||||
pdfstartview=FitH,pdfview=FitH]{hyperref}
|
||||
|
||||
% These fonts are good choices for screen-readable pdf, but the man needs
|
||||
% a pass over the layout, since the this tt font will blow out the width
|
||||
% of some examples, making them wrap and generally screwing them up. Maybe this
|
||||
% should also be a LaTeX option, so we can get palatino on the hardcopy
|
||||
% runs and these fonts on pdf runs...
|
||||
%\renewcommand{\rmdefault}{phv}
|
||||
%\renewcommand{\sfdefault}{phv}
|
||||
%\renewcommand{\ttdefault}{pcr}
|
||||
|
||||
% Style issues
|
||||
\parskip = 3pt plus 3pt
|
||||
\sloppy
|
||||
|
||||
%\includeonly{syscalls}
|
||||
|
||||
\input{decls}
|
||||
\makeindex
|
||||
%%% End preamble
|
||||
|
||||
\begin{document}
|
||||
|
||||
\frontmatter
|
||||
\include{front}
|
||||
|
||||
\mainmatter
|
||||
\include{intro}
|
||||
\include{procnotation}
|
||||
\include{syscalls}
|
||||
\include{network}
|
||||
\include{strings}
|
||||
\include{sre}
|
||||
\include{rdelim}
|
||||
\include{awk}
|
||||
\include{miscprocs}
|
||||
\include{running}
|
||||
\include{changes}
|
||||
\include{todo}
|
||||
|
||||
\backmatter
|
||||
\printindex
|
||||
|
||||
\end{document}
|
||||
|
||||
% General things to do when converting ASCII text to LaTeX:
|
||||
% Build a set of \breakondash, \breakondot, \breakonslash commands
|
||||
% that will enable breaking in \tt. This is better than \=, etc.
|
||||
%
|
||||
% Check for ..., quote char, double-dashes --
|
||||
% Double-word check
|
||||
% lambda -> \l
|
|
@ -0,0 +1,75 @@
|
|||
% This is the title page style stolen from the Texinfo design,
|
||||
% and expressed as a LaTeX style option. It is useful for manuals.
|
||||
%
|
||||
% Note that I play some *really* revolting games here to override
|
||||
% the vertical and horizontal margins temporarily for the title page.
|
||||
% The layout assumes you have 8.5" x 11" paper. You'd have to redo this
|
||||
% for A4 or another size.
|
||||
% -Olin 7/94
|
||||
|
||||
|
||||
% Fonts for title page:
|
||||
\DeclareFixedFont{\titlefont}%
|
||||
{\encodingdefault}{\familydefault}{bx}{\shapedefault}{20.5pt}
|
||||
\DeclareFixedFont{\authorfnt}%
|
||||
{\encodingdefault}{\familydefault}{bx}{\shapedefault}{14.4pt}
|
||||
\DeclareFixedFont{\subtitlefnt}%
|
||||
{\encodingdefault}{\familydefault}{m}{\shapedefault}{11}
|
||||
|
||||
%\def\authorrm{\normalfont\selectfont\fontseries{bx}\fontsize{14.4}{14.4}}
|
||||
%\def\subtitlefnt{\normalfont\selectfont\fontsize{11}{11}}
|
||||
|
||||
\newskip\titlepagetopglue \titlepagetopglue = 2.5in
|
||||
|
||||
|
||||
\newlength{\widewidth}
|
||||
\setlength{\widewidth}{6.5in}
|
||||
\newlength{\negwidemargin}
|
||||
\setlength{\negwidemargin}{-\oddsidemargin} % Reset the margin
|
||||
\addtolength{\negwidemargin}{-1in} % to edge of page
|
||||
\addtolength{\negwidemargin}{1in} % Then move right one inch.
|
||||
|
||||
%\def\wideline#1{\hbox to 0pt{\hspace\negwidemargin\hbox to\widewidth{#1}}}
|
||||
\def\wideline#1{\hbox{\makebox[0pt][l]{\hspace\negwidemargin\hbox to\widewidth{#1}}}}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\def\maketitle{\begin{titlepage}
|
||||
\thispagestyle{empty}
|
||||
\let\footnotesize\small \let\footnoterule\relax
|
||||
\null
|
||||
\parindent=0pt
|
||||
\def\subtitlefont{\normalbaselineskip = 13pt \normalbaselines \subtitlefnt}%
|
||||
\def\authorfont{\normalbaselineskip = 16pt \normalbaselines \authorfnt}%
|
||||
%
|
||||
% Leave some space at the very top of the page.
|
||||
\vspace*{-1in}\vspace*{-\topmargin}\vspace*{-\headheight}\vspace*{-\headsep}
|
||||
\vglue\titlepagetopglue
|
||||
%
|
||||
\wideline{\titlefont \@title \hfill} % title
|
||||
% \vskip4pt
|
||||
\vskip -0.3\baselineskip
|
||||
\wideline{\leaders\hrule height 4pt\hfill}
|
||||
\wideline{\hfill\subtitlefont\begin{tabular}[t]{@{}r@{}}\@subtitle%
|
||||
\end{tabular}\hskip 1in} % subtitle
|
||||
%
|
||||
% author
|
||||
\vskip 0pt plus 1filll
|
||||
\wideline{\authorfont \begin{tabular}[t]{@{}c@{}}\@author
|
||||
\end{tabular}\hfill}
|
||||
%
|
||||
% \vskip4pt
|
||||
\vskip -0.3\baselineskip
|
||||
\wideline{\leaders\hrule height 2pt\hfill}
|
||||
|
||||
% This weirdness puts the bottom line 2.75 in from the bottom of
|
||||
% an 11in page.
|
||||
\vskip \textheight \vskip \headsep \vskip \headheight
|
||||
\vskip \topmargin \vskip 1in \vskip -11in \vskip 2.75in
|
||||
|
||||
\gdef\@author{}\gdef\@title{}\gdef\@subtitle{}\let\maketitle\relax
|
||||
\end{titlepage}
|
||||
\setcounter{page}{2}
|
||||
}
|
||||
|
||||
\def\subtitle#1{\gdef\@subtitle{#1}}
|
||||
\def\@subtitle{}
|
|
@ -0,0 +1,16 @@
|
|||
%&latex -*- latex -*-
|
||||
% Implement the \frontmatter, \mainmatter, and \backmatter macros,
|
||||
% so I can use them in reports, not just books.
|
||||
|
||||
\newif\if@mainmatter \@mainmattertrue
|
||||
|
||||
\newcommand\frontmatter{%
|
||||
\cleardoublepage\@mainmatterfalse\pagenumbering{roman}}
|
||||
|
||||
\newcommand\mainmatter{%
|
||||
\cleardoublepage\@mainmattertrue%
|
||||
\pagenumbering{arabic}\setcounter{page}{1}}
|
||||
|
||||
\newcommand\backmatter{%
|
||||
\if@openright\cleardoublepage\else\clearpage\fi%
|
||||
\@mainmatterfalse}
|
|
@ -3,6 +3,7 @@
|
|||
\chapter{Miscellaneous routines}
|
||||
|
||||
\section{Integer bitwise ops}
|
||||
\label{sec:bitwise}
|
||||
\defun{arithmetic-shift} {i j} \integer
|
||||
\defunx {bitwise-and} {i j} \integer
|
||||
\defunx {bitwise-ior} {i j} \integer
|
||||
|
@ -39,4 +40,6 @@ from the lists returned by the field-readers (chapter~\ref{chapt:fr-awk}).
|
|||
and want to be able to recover your shell state, you can
|
||||
fork off a subshell with the following form:
|
||||
\codex{(run (begin (repl)))}
|
||||
{\ldots}or, rephrased for the proceduralists:
|
||||
\codex{(wait (fork repl))}
|
||||
\end{desc}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
%&latex -*- latex -*-
|
||||
\if@twoside
|
||||
\oddsidemargin 44pt
|
||||
\evensidemargin 82pt
|
||||
\marginparwidth 107pt
|
||||
\else
|
||||
\oddsidemargin 63pt
|
||||
\evensidemargin 63pt
|
||||
\marginparwidth 90pt
|
||||
\fi
|
||||
\marginparsep 11pt
|
||||
|
||||
\topmargin 27pt
|
||||
\headheight 12pt
|
||||
\headsep 25pt
|
||||
\topskip = 10pt
|
||||
\footskip 30pt
|
||||
|
||||
\textheight = 43\baselineskip
|
||||
\advance\textheight by \topskip
|
||||
\textwidth 345pt
|
||||
\endinput
|
|
@ -9,23 +9,21 @@ standard).
|
|||
However, Berkeley sockets are a \emph{de facto} standard,
|
||||
being found on most Unix workstations and PC operating systems.
|
||||
|
||||
Future releases of scsh will contain more high-level support for
|
||||
networking applications.
|
||||
We have Scheme implementations for the ftp, telnet, smtp, finger, and
|
||||
http protocols, as well as an html parser.
|
||||
When this code is included in a future release, this chapter
|
||||
will describe the interfaces.
|
||||
We are also contemplating a tail-recursive RPC mechanism,
|
||||
but have done no development work.
|
||||
It is fairly straightforward to add higher-level network protocols
|
||||
such as smtp, telnet, or http on top of the the basic socket-level
|
||||
support scsh provides.
|
||||
The Scheme Underground has also released a network library with
|
||||
many of these protocols as a companion to the current release of scsh.
|
||||
See this code for examples showing the use of the sockets interface.
|
||||
|
||||
\section{High-level interface}
|
||||
|
||||
For convenience, and too avoid some of the messy details of the socket
|
||||
For convenience, and to avoid some of the messy details of the socket
|
||||
interface, we provide a high level socket interface. These routines
|
||||
attempt to make it easy to write simple clients and servers without
|
||||
having to think of many of the details of initiating socket connections.
|
||||
We welcome suggested improvements to this interface, including better
|
||||
names, which right now are solely descriptions of the procedure's action..
|
||||
names, which right now are solely descriptions of the procedure's action.
|
||||
This might be fine for people who already understand sockets,
|
||||
but does not help the new networking programmer.
|
||||
|
||||
|
@ -184,8 +182,7 @@ than an empty string for addresses in the {\Unix} address-family.
|
|||
|
||||
The procedures in this section are presented in the order in which a
|
||||
typical program will use them. Consult a text on network systems
|
||||
programming for more information on sockets.
|
||||
\footnote{
|
||||
programming for more information on sockets.\footnote{
|
||||
Some recommended ones are:
|
||||
|
||||
\begin{itemize}
|
||||
|
@ -273,12 +270,18 @@ shutdown/sends+receives\end{code}
|
|||
\section{Performing input and output on sockets}
|
||||
|
||||
\defun {receive-message} {socket length [flags]} {[string-or-\sharpf socket-address]}
|
||||
\defunx {receive-message!} {socket string [start] [end] [flags]} {[count-or-\sharpf socket-address]}
|
||||
\defunx {receive-message/partial} {socket length [flags]} {[string-or-\sharpf socket-address]}
|
||||
\defunx {receive-message!/partial} {socket string [start] [end] [flags]} {[count-or-\sharpf socket-address]}
|
||||
|
||||
\defun {send-message} {socket string [start] [end] [flags] [socket-address]} \undefined
|
||||
\defunx {send-message/partial} {socket string [start] [end] [flags] [socket-address]} {count}
|
||||
\dfnix {receive-message!} {socket string [start] [end] [flags]}
|
||||
{[count-or-\sharpf socket-address]}{procedure}
|
||||
{receive-message"!@\texttt{receive-message"!}}
|
||||
\defunx {receive-message/partial} {socket length [flags]}
|
||||
{[string-or-\sharpf socket-address]}
|
||||
\dfnix {receive-message!/partial} {socket string [start] [end] [flags]}
|
||||
{[count-or-\sharpf socket-address]}{procedure}
|
||||
{receive-message"!/partial@\texttt{receive-message"!/partial}}
|
||||
\defun {send-message} {socket string [start] [end] [flags] [socket-address]}
|
||||
\undefined
|
||||
\defunx {send-message/partial}
|
||||
{socket string [start] [end] [flags] [socket-address]} {count}
|
||||
|
||||
\begin{desc}
|
||||
For most uses, standard input and output routines such as
|
||||
|
|
|
@ -105,7 +105,7 @@ It is equivalent to the three redirections:
|
|||
(= 2 ,(error-output-port))\end{code}
|
||||
%
|
||||
The redirections are done in the indicated order. This will cause an error if
|
||||
the one of current i/o ports isn't a {\Unix} port (\eg, if one is a string
|
||||
one of the current i/o ports isn't a {\Unix} port (\eg, if one is a string
|
||||
port).
|
||||
This {\Scheme}/{\Unix} i/o synchronisation can also be had in {\Scheme} code
|
||||
(as opposed to a redirection spec) with the \ex{(stdports->stdio)}
|
||||
|
@ -169,6 +169,11 @@ The second clause \ex{(3 1)} causes \vari{pf}{\!1}'s file descriptor 3 to be
|
|||
connected to \vari{pf}{\!2}'s file descriptor 1.
|
||||
%---this is unusual, and not expected to occur very often.
|
||||
|
||||
The \ex{begin} process form does a \ex{stdio->stdports} synchronisation
|
||||
in the child process before executing the body of the form.
|
||||
This guarantees that the \ex{begin} form, like all other process forms,
|
||||
``sees'' the effects of any associated I/O redirections.
|
||||
|
||||
Note that {\R4RS} does not specify whether or not \ex{|} and \ex{|+}
|
||||
are readable symbols. Scsh does.
|
||||
|
||||
|
@ -182,15 +187,16 @@ There are three basic {\Scheme} forms that use extended process forms:
|
|||
\ex{exec-epf}, \cd{&}, and \ex{run}.
|
||||
|
||||
\dfn {exec-epf} {. \var{epf}} {\noreturn} {syntax}
|
||||
\dfnx {\&} {. \var{epf}} {\integer} {syntax}
|
||||
\dfnx {run} {. \var{epf}} {\integer} {syntax}
|
||||
\dfnx {\&} {. \var{epf}} {proc} {syntax}
|
||||
\dfnx {run} {. \var{epf}} {proc} {syntax}
|
||||
\begin{desc}
|
||||
\index{exec-epf} \index{\&} \index{run}
|
||||
The \ex{(exec-epf . \var{epf})} form nukes the current process: it establishes
|
||||
the i/o redirections and then overlays the current process with the requested
|
||||
computation.
|
||||
|
||||
The \ex{(\& . \var{epf})} form is similar, except that the process is forked
|
||||
off in background. The form returns the subprocess' pid.
|
||||
off in background. The form returns the subprocess' process object.
|
||||
|
||||
The \ex{(run . \var{epf})} form runs the process in foreground:
|
||||
after forking off the computation, it waits for the subprocess to exit,
|
||||
|
@ -235,7 +241,7 @@ Having a solid procedural foundation also allows for general notational
|
|||
experimentation using {\Scheme}'s macros.
|
||||
For example, the programmer can build his own pipeline notation on top of the
|
||||
\ex{fork} and \ex{fork/pipe} procedures.
|
||||
Chapter~\ref{chapter:syscalls} gives the full story on all the procedures
|
||||
Chapter~\ref{chapt:syscalls} gives the full story on all the procedures
|
||||
in the syscall library.
|
||||
|
||||
\subsection{Interfacing process output to {\Scheme}}
|
||||
|
@ -251,7 +257,9 @@ to capture the output of processes as {\Scheme} data.
|
|||
\dfnx{run/sexps} {. \var{epf}} {list} {syntax}
|
||||
\begin{desc}
|
||||
These forms all fork off subprocesses, collecting the process' output
|
||||
to stdout in some form or another.
|
||||
to stdout in some form or another.
|
||||
The subprocess runs with file descriptor 1 and the current output port
|
||||
bound to a pipe.
|
||||
\begin{desctable}{0.7\linewidth}
|
||||
\ex{run/port} & Value is a port open on process's stdout.
|
||||
Returns immediately after forking child. \\
|
||||
|
@ -316,12 +324,12 @@ run/sexp* $\equiv$ read $\circ$ run/port*
|
|||
run/sexps* $\equiv$ port->sexp-list $\circ$ run/port*\end{code}
|
||||
\end{desc}
|
||||
|
||||
\defun{reduce-port}{port reader op . seeds} {\object\star}
|
||||
\defun{port-fold}{port reader op . seeds} {\object\star}
|
||||
\begin{desc}
|
||||
This procedure can be used to perform a variety of iterative operations
|
||||
over an input stream.
|
||||
It repeatedly uses \var{reader} to read an object from \var{port}.
|
||||
If the first read returns eof, then the entire \ex{reduce-port}
|
||||
If the first read returns eof, then the entire \ex{port-fold}
|
||||
operation returns the seeds as multiple values.
|
||||
If the first read operation returns some other value $v$, then
|
||||
\var{op} is applied to $v$ and the seeds:
|
||||
|
@ -332,11 +340,15 @@ reading a new value from the port, and so forth.
|
|||
|
||||
For example, \ex{(port->list \var{reader} \var{port})}
|
||||
could be defined as
|
||||
\codex{(reverse (reduce-port \var{port} \var{reader} cons '()))}
|
||||
\codex{(reverse (port-fold \var{port} \var{reader} cons '()))}
|
||||
|
||||
An imperative way to look at \ex{reduce-port} is to say that it
|
||||
An imperative way to look at \ex{port-fold} is to say that it
|
||||
abstracts the idea of a loop over a stream of values read from
|
||||
some port, where the seed values express the loop state.
|
||||
|
||||
\remark{This procedure was formerly named \texttt{\indx{reduce-port}}.
|
||||
The old binding is still provided, but is deprecated and will
|
||||
probably vanish in a future release.}
|
||||
\end{desc}
|
||||
|
||||
|
||||
|
@ -349,23 +361,27 @@ for manipulating processes.
|
|||
|
||||
|
||||
\subsection{Pids and ports together}
|
||||
\dfn {run/port+pid} {. \var{epf}} {[port fixnum]} {syntax}
|
||||
\defunx {run/port+pid*} {thunk} {[port fixnum]}
|
||||
\dfn {run/port+proc} {. \var{epf}} {[port proc]} {syntax}
|
||||
\defunx {run/port+proc*} {thunk} {[port proc]}
|
||||
\begin{desc}
|
||||
This special form and its analogous procedure can be used
|
||||
if the programmer also wishes access to the process' pid, exit status,
|
||||
or other information.
|
||||
They both fork off a subprocess, returning two values:
|
||||
a port open on the process' stdout, and the subprocess's pid.
|
||||
a port open on the process' stdout (and current output port),
|
||||
and the subprocess's process object.
|
||||
A process object encapsulates the subprocess' process id and exit code;
|
||||
it is the value passed to the \ex{wait} system call.
|
||||
|
||||
|
||||
For example, to uncompress a tech report, reading the uncompressed
|
||||
data into scsh, and also be able to track the exit status of
|
||||
the decompression process, use the following:
|
||||
\begin{code}
|
||||
(receive (port pid) (run/port+pid (zcat tr91-145.tex.Z))
|
||||
(receive (port child) (run/port+proc (zcat tr91-145.tex.Z))
|
||||
(let* ((paper (port->string port))
|
||||
(status (wait pid)))
|
||||
{\rm\ldots{}use \ex{paper}, \ex{status}, and \ex{pid} here\ldots}))\end{code}
|
||||
(status (wait child)))
|
||||
{\rm\ldots{}use \ex{paper}, \ex{status}, and \ex{child} here\ldots}))\end{code}
|
||||
%
|
||||
Note that you must \emph{first} do the \ex{port->string} and
|
||||
\emph{then} do the wait---the other way around may lock up when the
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
%&latex -*- latex -*-
|
||||
|
||||
\chapter{Reading delimited strings}
|
||||
\label{chapt:rdelim}
|
||||
|
||||
Scsh provides a set of procedures that read delimited strings from
|
||||
input ports.
|
||||
There are procedures to read a single line of text
|
||||
(terminated by a newline character),
|
||||
a single paragraph (terminated by a blank line),
|
||||
and general delimited strings
|
||||
(terminated by a character belonging to an arbitrary character set).
|
||||
|
||||
These procedures can be applied to any Scheme input port.
|
||||
However, the scsh virtual machine has native-code support for performing
|
||||
delimited reads on Unix ports, and these input operations should be
|
||||
particularly fast---much faster than doing the equivalent character-at-a-time
|
||||
operation from Scheme code.
|
||||
|
||||
All of the delimited input operations described below take a \ex{handle-delim}
|
||||
parameter, which determines what the procedure does with the terminating
|
||||
delimiter character.
|
||||
There are four possible choices for a \ex{handle-delim} parameter:
|
||||
\begin{inset}
|
||||
\begin{tabular}{|l|l|} \hline
|
||||
\ex{handle-delim} & Meaning \\ \hline\hline
|
||||
\ex{'trim} & Ignore delimiter character. \\
|
||||
\ex{'peek} & Leave delimiter character in input stream. \\
|
||||
\ex{'concat} & Append delimiter character to returned value. \\
|
||||
\ex{'split} & Return delimiter as second value. \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{inset}
|
||||
The first case, \ex{'trim}, is the standard default for all the routines
|
||||
described in this section.
|
||||
The last three cases allow the programmer to distinguish between strings
|
||||
that are terminated by a delimiter character, and strings that are
|
||||
terminated by an end-of-file.
|
||||
|
||||
|
||||
\begin{defundesc} {read-line} {[port handle-newline]} {{\str} or eof-object}
|
||||
Reads and returns one line of text; on eof, returns the eof object.
|
||||
A line is terminated by newline or eof.
|
||||
|
||||
\var{handle-newline} determines what \ex{read-line} does with the
|
||||
newline or EOF that terminates the line; it takes the general set
|
||||
of values described for the general \ex{handle-delim} case above,
|
||||
and defaults to \ex{'trim} (discard the newline).
|
||||
Using this argument allows one to tell whether or not the last line of
|
||||
input in a file is newline terminated.
|
||||
\end{defundesc}
|
||||
|
||||
\defun{read-paragraph} {[port handle-delim]} {{\str} or eof}
|
||||
\begin{desc}
|
||||
This procedure skips blank lines,
|
||||
then reads text from a port until a blank line or eof is found.
|
||||
A ``blank line'' is a (possibly empty) line composed only of white space.
|
||||
The \var{handle-delim} parameter determines how the terminating
|
||||
blank line is handled.
|
||||
It is described above, and defaults to \ex{'trim}.
|
||||
The \ex{'peek} option is not available.
|
||||
\end{desc}
|
||||
|
||||
|
||||
The following procedures read in strings from ports delimited by characters
|
||||
belonging to a specific set.
|
||||
See section~\ref{sec:char-sets} for information on character set manipulation.
|
||||
|
||||
\defun{read-delimited}{char-set [port handle-delim]} {{\str} or eof}
|
||||
\begin{desc}
|
||||
Read until we encounter one of the chars in \var{char-set} or eof.
|
||||
The \var{handle-delim} parameter determines how the terminating character
|
||||
is handled. It is described above, and defaults to \ex{'trim}.
|
||||
|
||||
The \var{char-set} argument may be a charset, a string, a character, or a
|
||||
character predicate; it is coerced to a charset.
|
||||
\end{desc}
|
||||
|
||||
\dfni{read-delimited!} {char-set buf [port handle-delim start end]}
|
||||
{nchars or eof or \#f}{procedure}
|
||||
{read-delimited"!@\texttt{read-delimited"!}}
|
||||
\begin{desc}
|
||||
A side-effecting variant of \ex{read-delimited}.
|
||||
|
||||
The data is written into the string \var{buf} at the indices in the
|
||||
half-open interval $[\var{start},\var{end})$; the default interval is the
|
||||
whole string: $\var{start}=0$ and $\var{end}=\ex{(string-length
|
||||
\var{buf})}$. The values of \var{start} and \var{end} must specify a
|
||||
well-defined interval in \var{str}, \ie, $0 \le \var{start} \le \var{end}
|
||||
\le \ex{(string-length \var{buf})}$.
|
||||
|
||||
It returns \var{nbytes}, the number of bytes read. If the buffer filled up
|
||||
without a delimiter character being found, \ex{\#f} is returned. If
|
||||
the port is at eof when the read starts, the eof object is returned.
|
||||
|
||||
If an integer is returned (\ie, the read is successfully terminated by
|
||||
reading a delimiter character), then the \var{handle-delim} parameter
|
||||
determines how the terminating character is handled.
|
||||
It is described above, and defaults to \ex{'trim}.
|
||||
\end{desc}
|
||||
|
||||
|
||||
|
||||
\dfni{\%read-delimited!} {char-set buf gobble? [port start end]}
|
||||
{[char-or-eof-or-\#f \integer]}{procedure}
|
||||
{"%read-delimited"!@\verb:"%read-delimited"!:}
|
||||
\begin{desc}
|
||||
This low-level delimited reader uses an alternate interface.
|
||||
It returns two values: \var{terminator} and \var{num-read}.
|
||||
\begin{description}
|
||||
\item [terminator]
|
||||
A value describing why the read was terminated:
|
||||
\begin{flushleft}
|
||||
\begin{tabular}{l@{\qquad$\Rightarrow$\qquad}l}
|
||||
Character or eof-object & Read terminated by this value. \\
|
||||
\ex{\#f} & Filled buffer without finding a delimiter.
|
||||
\end{tabular}
|
||||
\end{flushleft}
|
||||
|
||||
\item [num-read]
|
||||
Number of characters read into \var{buf}.
|
||||
\end{description}
|
||||
|
||||
If the read is successfully terminated by reading a delimiter character,
|
||||
then the \var{gobble?} parameter determines what to do with the terminating
|
||||
character.
|
||||
If true, the character is removed from the input stream;
|
||||
if false, the character is left in the input stream where a subsequent
|
||||
read operation will retrieve it.
|
||||
In either case, the character is also the first value returned by
|
||||
the procedure call.
|
||||
\end{desc}
|
||||
|
||||
%Note:
|
||||
%- Invariant: TERMINATOR = #f => NUM-READ = END - START.
|
||||
%- Invariant: TERMINATOR = eof-object and NUM-READ = 0 => at EOF.
|
||||
%- When determining the TERMINATOR return value, ties are broken
|
||||
% favoring character or the eof-object over #f. That is, if the buffer
|
||||
% fills up, %READ-DELIMITED! will peek at one more character from the
|
||||
% input stream to determine if it terminates the input. If so, that
|
||||
% is returned, not #f.
|
||||
|
||||
\begin{defundesc} {skip-char-set} {skip-chars [port]} {\integer}
|
||||
Skip characters occurring in the set \var{skip-chars};
|
||||
return the number of characters skipped.
|
||||
The \var{skip-chars} argument may be a charset, a string, a character, or a
|
||||
character predicate; it is coerced to a charset.
|
||||
\end{defundesc}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,15 @@
|
|||
% -*- latex -*-
|
||||
\chapter{Strings and characters}
|
||||
|
||||
Scsh provides a set of procedures for processing strings and characters.
|
||||
The procedures provided match regular expressions, search strings,
|
||||
parse file-names, and manipulate sets of characters.
|
||||
|
||||
Also see chapter \ref{chapt:fr-awk} on record I/O, field parsing,
|
||||
and the awk loop.
|
||||
The procedures documented there allow you to read character-delimited
|
||||
records from ports, use regular expressions to split the records into fields
|
||||
Also see chapters \ref{chapt:sre}, \ref{chapt:rdelim} and \ref{chapt:fr-awk}
|
||||
on regular-expressions, record I/O, field parsing, and the awk loop.
|
||||
The procedures documented there allow you to search and pattern-match strings,
|
||||
read character-delimited records from ports,
|
||||
use regular expressions to split the records into fields
|
||||
(for example, splitting a string at every occurrence of colon or white-space),
|
||||
and loop over streams of these records in a convenient way.
|
||||
|
||||
|
@ -18,135 +20,7 @@ and loop over streams of these records in a convenient way.
|
|||
Strings are the basic communication medium for {\Unix} processes, so a
|
||||
shell language must have reasonable facilities for manipulating them.
|
||||
|
||||
\subsection{Regular expressions}
|
||||
\label{sec:regexps}
|
||||
|
||||
The following functions perform regular expression matching.
|
||||
The code uses Henry Spencer's regular expression package.
|
||||
|
||||
\begin{defundesc}{string-match} {regexp string [start]} {match or false}
|
||||
Search \var{string} starting at position \var{start}, looking for a match
|
||||
for \var{regexp}. If a match is found, return a match structure describing
|
||||
the match, otherwise {\sharpf}. \var{Start} defaults to 0.
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {regexp-match?} {obj} \boolean
|
||||
Is the object a regular expression match?
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {match:start} {match [match-number]} \fixnum
|
||||
Returns the start position of the match denoted by \var{match-number}
|
||||
The whole regexp is 0. Each further number represents positions
|
||||
enclosed by \ex{(\ldots)} sections. \var{Match-number} defaults to 0.
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {match:end} {match [match-number]} \fixnum
|
||||
Returns the end position of the match denoted by \var{match-number}.
|
||||
\var{Match-number} defaults to 0 (the whole match).
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {match:substring} {match [match-number]} \str
|
||||
Returns the substring matched by match \var{match-number}.
|
||||
\var{Match-number} defaults to 0 (the whole match).
|
||||
\end{defundesc}
|
||||
|
||||
\remark{
|
||||
What do these guys do when there is no match corresponding to
|
||||
\var{match-number}?
|
||||
Return {\sharpf} or signal error? {\sharpf} probably best.}
|
||||
|
||||
Regular expression matching compiles patterns into special data
|
||||
structures which can be efficiently used to match against strings.
|
||||
The overhead of compiling patterns that will be used for multiple
|
||||
searches can be avoided by these lower-level routines:
|
||||
%
|
||||
\begin{defundesc} {make-regexp} {str} {re}
|
||||
Generate a compiled regular expression from the given string.
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {regexp?} {obj} \boolean
|
||||
Is the object a regular expression?
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {regexp-exec} {regexp str [start]} {match or false}
|
||||
Apply the regular expression \var{regexp} to the string \var{str} starting
|
||||
at position \var{start}. If the match succeeds it returns a regexp-match,
|
||||
otherwise {\sharpf}. \var{Start} defaults to 0.
|
||||
\end{defundesc}
|
||||
|
||||
\begin{remarkenv}
|
||||
The truth: S48 doesn't have the facilities for extending the garbage
|
||||
collector to malloc'd C storage (unlike elk). So we do not really export
|
||||
regular expression compilation. What we currently do is this:
|
||||
\begin{tightcode}
|
||||
(define regexp? string?)
|
||||
(define (make-regexp str) str)
|
||||
(define (regexp-exec regexp str [start])
|
||||
(string-match regexp str [start]))\end{tightcode}
|
||||
%
|
||||
This could be improved upon in another implementation (like elk).
|
||||
\end{remarkenv}
|
||||
|
||||
|
||||
\defun{regexp-quote}{str}{\str}
|
||||
\begin{desc}
|
||||
Returns a regular expression that matches the string \var{str} exactly.
|
||||
In other words, it quotes the regular expression, prepending backslashes
|
||||
to all the special regexp characters in \var{str}.
|
||||
\begin{code}
|
||||
(regexp-quote "*Hello* world.")
|
||||
{\evalto}"\\*Hello\\* world\\."\end{code}
|
||||
\end{desc}
|
||||
|
||||
\oops{Scsh regex matching doesn't currently flag un-matched subexpressions
|
||||
in the \ex{match:begin}, \ex{match:end}, and \ex{match:substring} functions.
|
||||
This needs to be fixed.}
|
||||
|
||||
\subsection{Other string manipulation facilities}
|
||||
|
||||
\defun {index} {string char [start]} {{\fixnum} or false}
|
||||
\defunx {rindex} {string char [start]} {{\fixnum} or false}
|
||||
\begin{desc}
|
||||
These procedures search through \var{string} looking for an occurrence
|
||||
of character \var{char}. \ex{index} searches left-to-right; \ex{rindex}
|
||||
searches right-to-left.
|
||||
|
||||
\ex{index} returns the smallest index $i$ of \var{string} greater
|
||||
than or equal to \var{start} such that $\var{string}[i] = \var{char}$.
|
||||
The default for \var{start} is zero. If there is no such match,
|
||||
\ex{index} returns false.
|
||||
|
||||
\ex{rindex} returns the largest index $i$ of \var{string} less than
|
||||
\var{start} such that $\var{string}[i] = \var{char}$.
|
||||
The default for \var{start} is \ex{(string-length \var{string})}.
|
||||
If there is no such match, \ex{rindex} returns false.
|
||||
\end{desc}
|
||||
|
||||
I should probably snarf all the MIT Scheme string functions, and stick them
|
||||
in a package. {\Unix} programs need to mung character strings a lot.
|
||||
|
||||
MIT string match commands:
|
||||
\begin{tightcode}
|
||||
[sub]string-match-{forward,backward}[-ci]
|
||||
[sub]string-{prefix,suffix}[-ci]?
|
||||
[sub]string-find-{next,previous}-char[-ci]
|
||||
[sub]string-find-{next,previous}-char-in-set
|
||||
[sub]string-replace[!]
|
||||
\ldots\etc\end{tightcode}
|
||||
These are not currently provided.
|
||||
|
||||
\begin{defundesc} {substitute-env-vars} {fname} \str
|
||||
Replace occurrences of environment variables with their values.
|
||||
An environment variable is denoted by a dollar sign followed by
|
||||
alphanumeric chars and underscores, or is surrounded by braces.
|
||||
|
||||
\begin{exampletable}
|
||||
\splitline{\ex{(substitute-env-vars "\$USER/.login")}}
|
||||
{\ex{"shivers/.login"}} \\
|
||||
\cd{(substitute-env-vars "$\{USER\}_log")} & \cd{"shivers_log"}
|
||||
\end{exampletable}
|
||||
\end{defundesc}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Manipulating file-names}
|
||||
\label{sec:filenames}
|
||||
|
||||
|
@ -191,8 +65,8 @@ slashes to a single slash.
|
|||
|
||||
A file-name in \emph{directory form} is either a file-name terminated by
|
||||
a slash, \eg, ``\ex{/src/des/}'', or the empty string, ``''.
|
||||
The empty string corresponds to the current working directory, who's
|
||||
file-name is dot (``\ex{.}'').
|
||||
The empty string corresponds to the current working directory,
|
||||
whose file-name is dot (``\ex{.}'').
|
||||
Working backwards from the append-a-slash rule,
|
||||
we extend the syntax of {\Posix} file-names to define the empty string
|
||||
to be a file-name form of the root directory ``\ex{/}''.
|
||||
|
@ -223,6 +97,27 @@ interpreted in file-name form, \ie, as root.
|
|||
|
||||
\subsubsection{Procedures}
|
||||
|
||||
\defun {file-name-directory?} {fname} \boolean
|
||||
\defunx {file-name-non-directory?} {fname} \boolean
|
||||
\begin{desc}
|
||||
These predicates return true if the string is in directory form, or
|
||||
file-name form (see the above discussion of these two forms).
|
||||
Note that they both return true on the ambiguous case of empty string,
|
||||
which is both a directory (current working directory), and a file name
|
||||
(the file-system root).
|
||||
\begin{center}
|
||||
\begin{tabular}{lll}
|
||||
File name & \ex{\ldots-directory?} & \ex{\ldots-non-directory?} \\
|
||||
\hline
|
||||
\ex{"src/des"} & \ex{\sharpf} & \ex{\sharpt} \\
|
||||
\ex{"src/des/"} & \ex{\sharpt} & \ex{\sharpf} \\
|
||||
\ex{"/"} & \ex{\sharpt} & \ex{\sharpf} \\
|
||||
\ex{"."} & \ex{\sharpf} & \ex{\sharpt} \\
|
||||
\ex{""} & \ex{\sharpt} & \ex{\sharpt}
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\end{desc}
|
||||
|
||||
\begin{defundesc} {file-name-as-directory} {fname} \str
|
||||
Convert a file-name to directory form.
|
||||
Basically, add a trailing slash if needed:
|
||||
|
@ -425,6 +320,15 @@ interpreted in file-name form, \ie, as root.
|
|||
Resolve and simplify the file-name.
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {absolute-file-name} {fname [dir]} \str
|
||||
Convert file-name \var{fname} into an absolute file name,
|
||||
relative to directory \var{dir}, which defaults to the current
|
||||
working directory. The file name is simplified before being
|
||||
returned.
|
||||
|
||||
This procedure does not treat a leading tilde character specially.
|
||||
\end{defundesc}
|
||||
|
||||
\begin{defundesc} {home-dir} {[user]} \str
|
||||
\ex{home-dir} returns \var{user}'s home directory.
|
||||
\var{User} defaults to the current user.
|
||||
|
@ -450,6 +354,53 @@ defined in the previous section,
|
|||
is also frequently useful for expanding file-names.
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Other string manipulation facilities}
|
||||
|
||||
\defun {index} {string char [start]} {{\fixnum} or false}
|
||||
\defunx {rindex} {string char [start]} {{\fixnum} or false}
|
||||
\begin{desc}
|
||||
These procedures search through \var{string} looking for an occurrence
|
||||
of character \var{char}. \ex{index} searches left-to-right; \ex{rindex}
|
||||
searches right-to-left.
|
||||
|
||||
\ex{index} returns the smallest index $i$ of \var{string} greater
|
||||
than or equal to \var{start} such that $\var{string}[i] = \var{char}$.
|
||||
The default for \var{start} is zero. If there is no such match,
|
||||
\ex{index} returns false.
|
||||
|
||||
\ex{rindex} returns the largest index $i$ of \var{string} less than
|
||||
\var{start} such that $\var{string}[i] = \var{char}$.
|
||||
The default for \var{start} is \ex{(string-length \var{string})}.
|
||||
If there is no such match, \ex{rindex} returns false.
|
||||
\end{desc}
|
||||
|
||||
I should probably snarf all the MIT Scheme string functions, and stick them
|
||||
in a package. {\Unix} programs need to mung character strings a lot.
|
||||
|
||||
MIT string match commands:
|
||||
\begin{tightcode}
|
||||
[sub]string-match-{forward,backward}[-ci]
|
||||
[sub]string-{prefix,suffix}[-ci]?
|
||||
[sub]string-find-{next,previous}-char[-ci]
|
||||
[sub]string-find-{next,previous}-char-in-set
|
||||
[sub]string-replace[!]
|
||||
\ldots\etc\end{tightcode}
|
||||
These are not currently provided.
|
||||
|
||||
\begin{defundesc} {substitute-env-vars} {fname} \str
|
||||
Replace occurrences of environment variables with their values.
|
||||
An environment variable is denoted by a dollar sign followed by
|
||||
alphanumeric chars and underscores, or is surrounded by braces.
|
||||
|
||||
\begin{exampletable}
|
||||
\splitline{\ex{(substitute-env-vars "\$USER/.login")}}
|
||||
{\ex{"shivers/.login"}} \\
|
||||
\cd{(substitute-env-vars "$\{USER\}_log")} & \cd{"shivers_log"}
|
||||
\end{exampletable}
|
||||
\end{defundesc}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{ASCII encoding}
|
||||
|
||||
|
@ -465,16 +416,68 @@ is also frequently useful for expanding file-names.
|
|||
\label{sec:char-sets}
|
||||
|
||||
Scsh provides a \ex{char-set} type for expressing sets of characters.
|
||||
These sets are used by some of the delimited input procedures
|
||||
These sets are used by some of the delimited-input procedures
|
||||
(section~\ref{sec:field-reader}).
|
||||
The character set package that scsh uses was taken from Project Mac's
|
||||
MIT Scheme.
|
||||
Scsh's character set package was adapted and extended from
|
||||
Project Mac's MIT Scheme package.
|
||||
Note that the character type used in the current implementation corresponds
|
||||
to the ASCII character set---but you would be wise not to build this
|
||||
assumption into your code if you can help it.\footnote{
|
||||
Actually, it's slightly uglier than that, albeit somewhat more
|
||||
useful. The current character type corresponds to an eight-bit
|
||||
superset of ASCII. The \ex{ascii->char} and \ex{char->ascii}
|
||||
functions will preserve this eighth bit. However, none of the
|
||||
the high 128 characters appear in any of the standard character
|
||||
sets defined in section~\ref{sec:std-csets}, except for
|
||||
\ex{char-set:full}. If someone would email the authors a listing
|
||||
of the full Latin-1 definition, we'll be happy to upgrade these
|
||||
sets' definitions to make them Latin-1 compliant.}
|
||||
|
||||
\defun{char-set?}{x}\boolean
|
||||
\begin{desc}
|
||||
Returns true if the object \ex{x} is a character set.
|
||||
Is the object \var{x} a character set?
|
||||
\end{desc}
|
||||
|
||||
\defun{char-set=}{\vari{cs}1 \vari{cs}2\ldots}\boolean
|
||||
\begin{desc}
|
||||
Are the character sets equal?
|
||||
\end{desc}
|
||||
|
||||
\defun{char-set<=}{\vari{cs}1 \vari{cs}2\ldots}\boolean
|
||||
\begin{desc}
|
||||
Returns true if every character set \vari{cs}{i} is
|
||||
a subset of character set \vari{cs}{i+1}.
|
||||
\end{desc}
|
||||
|
||||
\defun{char-set-fold}{kons knil cs}\object
|
||||
\begin{desc}
|
||||
This is the fundamental iterator for character sets.
|
||||
Applies the function \var{kons} across the character set \var{cs} using
|
||||
initial state value \var{knil}.
|
||||
That is, if \var{cs} is the empty set, the procedure returns \var{knil}.
|
||||
Otherwise, some element \var{c} of \var{cs} is chosen; let \var{cs'} be
|
||||
the remaining, unchosen characters.
|
||||
The procedure returns
|
||||
\begin{tightcode}
|
||||
(char-set-fold \var{kons} (\var{kons} \var{c} \var{knil}) \var{cs'})\end{tightcode}
|
||||
For example, we could define \ex{char-set-members} (see below)
|
||||
as
|
||||
\begin{tightcode}
|
||||
(lambda (cs) (char-set-fold cons '() cs))\end{tightcode}
|
||||
|
||||
\remark{This procedure was formerly named \texttt{\indx{reduce-char-set}}.
|
||||
The old binding is still provided, but is deprecated and will
|
||||
probably vanish in a future release.}
|
||||
\end{desc}
|
||||
|
||||
\defun{char-set-for-each}{p cs}{\undefined}
|
||||
\begin{desc}
|
||||
Apply procedure \var{p} to each character in the character set \var{cs}.
|
||||
Note that the order in which \var{p} is applied to the characters in the
|
||||
set is not specified, and may even change from application to application.
|
||||
\end{desc}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Creating character sets}
|
||||
|
||||
\defun{char-set}{\vari{char}1\ldots}{char-set}
|
||||
|
@ -501,60 +504,223 @@ Returns a character set containing every character \var{c} such that
|
|||
\defun{ascii-range->char-set}{lower upper}{char-set}
|
||||
\begin{desc}
|
||||
Returns a character set containing every character whose {\Ascii}
|
||||
code lies in the range $[\var{lower},\var{upper}]$ inclusive.
|
||||
code lies in the half-open range $[\var{lower},\var{upper})$.
|
||||
\end{desc}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Querying character sets}
|
||||
\defun {char-set-members}{char-set}{character-list}
|
||||
\begin{desc}
|
||||
This procedure returns a list of the members of \var{char-set}.
|
||||
\end{desc}
|
||||
|
||||
\defunx{char-set-member?}{char char-set}\boolean
|
||||
\defunx{char-set-contains?}{char-set char}\boolean
|
||||
\begin{desc}
|
||||
This procedure tests \var{char} for membership in set \var{char-set}.
|
||||
\remark{Previous releases of scsh called this procedure \ex{char-set-member?},
|
||||
reversing the order of the arguments.
|
||||
This made sense, but was unfortunately the reverse order in which the
|
||||
arguments appear in MIT Scheme.
|
||||
A reasonable argument order was not backwards-compatible with MIT Scheme;
|
||||
on the other hand, the MIT Scheme argument order was counter-intuitive
|
||||
and at odds with common mathematical notation and the \ex{member} family
|
||||
of R4RS procedures.
|
||||
|
||||
We sought to escape the dilemma by shifting to a new name.}
|
||||
\end{desc}
|
||||
|
||||
\subsection{Character set algebra}
|
||||
\defun{char-set-size}{cs}\integer
|
||||
\begin{desc}
|
||||
Returns the number of elements in character set \var{cs}.
|
||||
\end{desc}
|
||||
|
||||
\defun{char-set-every?}{pred cs}\boolean
|
||||
\defunx{char-set-any?}{pred cs}\object
|
||||
\begin{desc}
|
||||
The \ex{char-set-every?} procedure returns true if predicate \var{pred}
|
||||
returns true of every character in the character set \var{cs}.
|
||||
|
||||
Likewise, \ex{char-set-any?} applies \var{pred} to every character in
|
||||
character set \var{cs}, and returns the first true value it finds.
|
||||
If no character produces a true value, it returns false.
|
||||
|
||||
The order in which these procedures sequence through the elements of
|
||||
\var{cs} is not specified.
|
||||
\end{desc}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Character-set algebra}
|
||||
\defun {char-set-invert}{char-set}{char-set}
|
||||
\defunx{char-set-union}{\vari{char-set}1 \vari{char-set}2}{char-set}
|
||||
\defunx{char-set-intersection}{\vari{char-set}1 \vari{char-set}2}{char-set}
|
||||
\defunx{char-set-difference}{\vari{char-set}1 \vari{char-set}2}{char-set}
|
||||
\defunx{char-set-union}{\vari{char-set}1\ldots}{char-set}
|
||||
\defunx{char-set-intersection}{\vari{char-set}1 \vari{char-set}2\ldots}{char-set}
|
||||
\defunx{char-set-difference}{\vari{char-set}1 \vari{char-set}2\ldots}{char-set}
|
||||
\begin{desc}
|
||||
These procedures implement set complement, union, intersection, and difference
|
||||
for character sets.
|
||||
The union, intersection, and difference operations are n-ary, associating
|
||||
to the left; the difference function requires at least one argument, while
|
||||
union and intersection may be applied to zero arguments.
|
||||
\end{desc}
|
||||
|
||||
\defun {char-set-adjoin}{cs \vari{char}1\ldots}{char-set}
|
||||
\defunx{char-set-delete}{cs \vari{char}1\ldots}{char-set}
|
||||
\begin{desc}
|
||||
Add/delete the \vari{char}i characters to/from character set \var{cs}.
|
||||
\end{desc}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Standard character sets}
|
||||
\label{sec:std-csets}
|
||||
Several character sets are predefined for convenience:
|
||||
|
||||
\begin{center}
|
||||
\newcommand{\entry}[1]{\ex{#1}\index{#1}}
|
||||
\begin{tabular}{|ll|}
|
||||
\hline
|
||||
\entry{char-set:upper-case} & A--Z \\
|
||||
\entry{char-set:lower-case} & a--z \\
|
||||
\entry{char-set:numeric} & 0--9 \\
|
||||
\entry{char-set:whitespace} & space, newline, tab, linefeed, page,
|
||||
return \\
|
||||
\entry{char-set:not-whitespace} & Complement of \ex{char-set:whitespace} \\
|
||||
\entry{char-set:alphabetic} & A--Z and a--z \\
|
||||
\entry{char-set:lower-case} & Lower-case alphabetic chars \\
|
||||
\entry{char-set:upper-case} & Upper-case alphabetic chars \\
|
||||
\entry{char-set:alphabetic} & Alphabetic chars \\
|
||||
\entry{char-set:numeric} & Decimal digits: 0--9 \\
|
||||
\entry{char-set:alphanumeric} & Alphabetic or numeric \\
|
||||
\entry{char-set:graphic} & Printing characters and space \\
|
||||
\entry{char-set:graphic} & Printing characters except space \\
|
||||
\entry{char-set:printing} & Printing characters including space \\
|
||||
\entry{char-set:whitespace} & Whitespace characters \\
|
||||
\entry{char-set:control} & Control characters \\
|
||||
\entry{char-set:punctuation} & Punctuation characters \\
|
||||
\entry{char-set:hex-digit} & A hexadecimal digit: 0--9, A--F, a--f \\
|
||||
\entry{char-set:blank} & Blank characters \\
|
||||
\entry{char-set:ascii} & A character in the ASCII set. \\
|
||||
\entry{char-set:empty} & Empty set \\
|
||||
\entry{char-set:full} & All characters \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
The first eleven of these correspond to the character classes defined in
|
||||
Posix.
|
||||
Note that there may be characters in \ex{char-set:alphabetic} that are
|
||||
neither upper or lower case---this might occur in implementations that
|
||||
use a character type richer than ASCII, such as Unicode.
|
||||
A ``graphic character'' is one that would put ink on your page.
|
||||
While the exact composition of these sets may vary depending upon the
|
||||
character type provided by the Scheme system upon which scsh is running,
|
||||
here are the definitions for some of the sets in an ASCII character set:
|
||||
\begin{center}
|
||||
\newcommand{\entry}[1]{\ex{#1}\index{#1}}
|
||||
\begin{tabular}{|ll|}
|
||||
\hline
|
||||
char-set:alphabetic & A--Z and a--z \\
|
||||
char-set:lower-case & a--z \\
|
||||
char-set:upper-case & A--Z \\
|
||||
char-set:graphic & Alphanumeric + punctuation \\
|
||||
char-set:whitespace & Space, newline, tab, page,
|
||||
vertical tab, carriage return \\
|
||||
char-set:blank & Space and tab \\
|
||||
char-set:control & ASCII 0--31 and 127 \\
|
||||
char-set:punctuation & \verb|!"#$%&'()*+,-./:;<=>|\verb#?@[\]^_`{|}~# \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
|
||||
\defun {char-upper-case?}\character\boolean
|
||||
\defun {char-alphabetic?}\character\boolean
|
||||
\defunx{char-lower-case?}\character\boolean
|
||||
\defunx{char-upper-case?}\character\boolean
|
||||
\defunx{char-numeric? }\character\boolean
|
||||
\defunx{char-whitespace?}\character\boolean
|
||||
\defunx{char-alphabetic?}\character\boolean
|
||||
\defunx{char-alphanumeric?}\character\boolean
|
||||
\defunx{char-graphic?}\character\boolean
|
||||
\defunx{char-printing?}\character\boolean
|
||||
\defunx{char-whitespace?}\character\boolean
|
||||
\defunx{char-blank?}\character\boolean
|
||||
\defunx{char-control?}\character\boolean
|
||||
\defunx{char-punctuation?}\character\boolean
|
||||
\defunx{char-hex-digit?}\character\boolean
|
||||
\defunx{char-ascii?}\character\boolean
|
||||
\begin{desc}
|
||||
These predicates are defined in terms of the above character sets.
|
||||
\end{desc}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Linear-update character-set operations}
|
||||
These procedures have a hybrid pure-functional/side-effecting semantics:
|
||||
they are allowed, but not required, to side-effect one of their parameters
|
||||
in order to construct their result.
|
||||
An implementation may legally implement these procedures as pure,
|
||||
side-effect-free functions, or it may implement them using side effects,
|
||||
depending upon the details of what is the most efficient or simple to
|
||||
implement in terms of the underlying representation.
|
||||
|
||||
What this means is that clients of these procedures \emph{may not} rely
|
||||
upon these procedures working by side effect.
|
||||
For example, this is not guaranteed to work:
|
||||
\begin{verbatim}
|
||||
(let ((cs (char-set #\a #\b #\c)))
|
||||
(char-set-adjoin! cs #\d)
|
||||
cs) ; Could be either {a,b,c} or {a,b,c,d}.
|
||||
\end{verbatim}
|
||||
However, this is well-defined:
|
||||
\begin{verbatim}
|
||||
(let ((cs (char-set #\a #\b #\c)))
|
||||
(char-set-adjoin! cs #\d)) ; {a,b,c,d}
|
||||
\end{verbatim}
|
||||
So clients of these procedures write in a functional style, but must
|
||||
additionally be sure that, when the procedure is called, there are no
|
||||
other live pointers to the potentially-modified character set (hence the term
|
||||
``linear update'').
|
||||
|
||||
There are two benefits to this convention:
|
||||
\begin{itemize}
|
||||
\item Implementations are free to provide the most efficient possible
|
||||
implementation, either functional or side-effecting.
|
||||
\item Programmers may nonetheless continue to assume that character sets
|
||||
are purely functional data structures: they may be reliably shared
|
||||
without needing to be copied, uniquified, and so forth.
|
||||
\end{itemize}
|
||||
|
||||
In practice, these procedures are most useful for efficiently constructing
|
||||
character sets in a side-effecting manner, in some limited local context,
|
||||
before passing the character set outside the local construction scope to be
|
||||
used in a functional manner.
|
||||
|
||||
Scsh provides no assistance in checking the linearity of the potentially
|
||||
side-effected parameters passed to these functions --- there's no linear
|
||||
type checker or run-time mechanism for detecting violations.
|
||||
|
||||
\defun{char-set-copy}{cs}{char-set}
|
||||
\begin{desc}
|
||||
Returns a copy of the character set \var{cs}.
|
||||
``Copy'' means that if either the input parameter or the
|
||||
result value of this procedure is passed to one of the linear-update
|
||||
procedures described below, the other character set is guaranteed
|
||||
not to be altered.
|
||||
(A system that provides pure-functional implementations of the rest of
|
||||
the linear-operator suite could implement this procedure as the
|
||||
identity function.)
|
||||
\end{desc}
|
||||
|
||||
\defun{char-set-adjoin!}{cs \vari{char}1\ldots}{char-set}
|
||||
\begin{desc}
|
||||
Add the \vari{char}i characters to character set \var{cs}, and
|
||||
return the result.
|
||||
This procedure is allowed, but not required, to side-effect \var{cs}.
|
||||
\end{desc}
|
||||
|
||||
\defun{char-set-delete!}{cs \vari{char}1\ldots}{char-set}
|
||||
\begin{desc}
|
||||
Remove the \vari{char}i characters to character set \var{cs}, and
|
||||
return the result.
|
||||
This procedure is allowed, but not required, to side-effect \var{cs}.
|
||||
\end{desc}
|
||||
|
||||
\defun {char-set-invert!}{char-set}{char-set}
|
||||
\defunx{char-set-union!}{\vari{char-set}1 \vari{char-set}2\ldots}{char-set}
|
||||
\defunx{char-set-intersection!}{\vari{char-set}1 \vari{char-set}2\ldots}{char-set}
|
||||
\defunx{char-set-difference!}{\vari{char-set}1 \vari{char-set}2\ldots}{char-set}
|
||||
\begin{desc}
|
||||
These procedures implement set complement, union, intersection, and difference
|
||||
for character sets.
|
||||
They are allowed, but not required, to side-effect their first parameter.
|
||||
The union, intersection, and difference operations are n-ary, associating
|
||||
to the left.
|
||||
\end{desc}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,33 @@
|
|||
%&latex -*- latex -*-
|
||||
|
||||
\documentclass{report}
|
||||
\usepackage{code,boxedminipage,draftfooters,palatino,ct,makeidx,
|
||||
headings,mantitle,array,matter,mysize10}
|
||||
|
||||
\parskip = 3pt plus 3pt
|
||||
\sloppy
|
||||
|
||||
\input{decls}
|
||||
%%% End preamble
|
||||
|
||||
\begin{document}
|
||||
|
||||
\begin{tabular}{ll}
|
||||
{\begin{codebox}[b]
|
||||
define structure web server
|
||||
open scsh
|
||||
scheme
|
||||
net-hax
|
||||
|
||||
file web\end{codebox}}
|
||||
&
|
||||
{\begin{codebox}[b]
|
||||
(define-structure web-server
|
||||
(open scheme
|
||||
scsh
|
||||
net-hax
|
||||
\vdots)
|
||||
(file web))\end{codebox}}\\
|
||||
\end{tabular}
|
||||
|
||||
\end{document}
|
|
@ -1,52 +1,49 @@
|
|||
%&latex -*- latex -*-
|
||||
|
||||
\chapter{Todo}
|
||||
{\parindent 0pt
|
||||
|
||||
The {\LaTeX} hackery needs yet another serious pass. Most importantly,
|
||||
long procedure ``declarations'' need to be broken across two lines.
|
||||
There are always many, many improvements and extensions that could be
|
||||
made to scsh.
|
||||
We invite interested hackers to do any of them, and send us the code;
|
||||
we'll put you on the team.
|
||||
Visit the Scheme Underground Web page for more information on good hacks at
|
||||
\begin{tightinset}\verb|http://www.ai.mit.edu/projects/su/|
|
||||
\end{tightinset}
|
||||
Scsh is a tool that lets you write fun programs that do real things in
|
||||
an elegant language; go wild.
|
||||
|
||||
Fix up 0-or-more and 1-or-more parameter typesetting, with subscripts.
|
||||
\begin{itemize}
|
||||
\item Threads.
|
||||
\item An X gui interface. (Needs threads.)
|
||||
\item A better C function/data-structure interface. This is not easy.
|
||||
\item More network protocols. Telnet and ftp would be the most important.
|
||||
\item An ILU interface.
|
||||
\item An RPC system, with ``tail-recursion.''
|
||||
\item Interfaces to relational db's.
|
||||
This would be quite useful for Web servers.
|
||||
An s-expression embedding of SQL would be a key design component
|
||||
of such a system, along the lines of scsh's process notation or
|
||||
\ex{awk} notation.
|
||||
\item Port Edwin, and emacs text editor written in MIT Scheme, to scsh.
|
||||
Combine it with scsh's OS interfaces to make a visual shell.
|
||||
\item An \ex{expect} knock-off.
|
||||
\item A \ex{make} replacement, using scsh's process notation in the build
|
||||
rules.
|
||||
|
||||
Parameter subscripts need to be made real subscripts.
|
||||
\item Manual hacking.
|
||||
\begin{itemize}
|
||||
\item The {\LaTeX} hackery needs yet another serious pass. Most importantly,
|
||||
long procedure ``declarations'' need to be broken across two lines.
|
||||
|
||||
Job control, after \ex{jcontrol.scm}
|
||||
\item Soup up the markup processor, and redo manual in markup. Generate
|
||||
{\LaTeX}, HTML, and info versions. Alternatively, persuade some kind
|
||||
soul to hand-port manual to HTML or info.
|
||||
\end{itemize}
|
||||
|
||||
Static heaps; fast startup.
|
||||
\item Job control, after \ex{jcontrol.scm}
|
||||
|
||||
Gnu readline lib.
|
||||
\item Better static heap linker.
|
||||
|
||||
Interrupt system.
|
||||
\item Gnu readline lib.
|
||||
|
||||
Make it all coexist with S48 threads as well as can be done for Unix.
|
||||
The DEC SRC tech report gives a good discussion of the issues.
|
||||
|
||||
Support for file locking: \ex{(lock-file fd op)}, \ex{with-file-locked}, \ldots
|
||||
|
||||
Testing broken symlinks -- new value for \var{chase?} flag?
|
||||
|
||||
Interactive flag machinery
|
||||
|
||||
Rename and release \ex{ensure-file-name-is-\{non,\}directory}.
|
||||
|
||||
More informative errno exception packets \& documentation for them.
|
||||
|
||||
Other things should be available: hash tables, sort, list utils, pattern
|
||||
matchers. But things start to overload. The module system is the appropriate
|
||||
way to use these.
|
||||
|
||||
Support for writing scripts that use the module language.
|
||||
|
||||
Need calls to control port i/o buffering.
|
||||
|
||||
Need to do file-control (\ie, \ex{fcntl()}).
|
||||
\ex{fcntl} is ugly.
|
||||
Better to have a procedure for each different operation.
|
||||
|
||||
Tty stuff and control tty.
|
||||
|
||||
More documentation for the \ex{wait()} machinery.
|
||||
|
||||
We need a general time/date parser, that can convert strings like
|
||||
``Thursday after Christmas'' into date records.
|
||||
}
|
||||
\end{itemize}
|
||||
|
|
|
@ -0,0 +1,751 @@
|
|||
%&latex -*- latex -*-
|
||||
% Fix OXTABS footnote bug
|
||||
% Figures should be dumped out earlier? Pack two to a page?
|
||||
|
||||
\section{Terminal device control}
|
||||
\label{sect:tty}
|
||||
|
||||
\newcommand{\fr}[1]{\makebox[0pt][r]{#1}}
|
||||
|
||||
% \ex{#1} and also generates an index entry.
|
||||
\newcommand{\exi}[1]{\index{#1@\texttt{#1}}\ex{#1}}
|
||||
\newcommand{\indextt}[1]{\index{#1@\texttt{#1}}}
|
||||
|
||||
Scsh provides a complete set of routines for manipulating terminal
|
||||
devices---putting them in ``raw'' mode, changing and querying their
|
||||
special characters, modifying their i/o speeds, and so forth.
|
||||
The scsh interface is designed both for generality and portability
|
||||
across different Unix platforms, so you don't have to rewrite your
|
||||
program each time you move to a new system.
|
||||
We've also made an effort to use reasonable, Scheme-like names for
|
||||
the multitudinous named constants involved, so when you are reading
|
||||
code, you'll have less likelihood of getting lost in a bewildering
|
||||
maze of obfuscatory constants named \ex{ICRNL}, \ex{INPCK}, \ex{IUCLC},
|
||||
and \ex{ONOCR}.
|
||||
|
||||
This section can only lay out the basic functionality of the terminal
|
||||
device interface.
|
||||
For further details, see the termios(3) man page on your system,
|
||||
or consult one of the standard {\Unix} texts.
|
||||
|
||||
\subsection{Portability across OS variants}
|
||||
Terminal-control software is inescapably complex, ugly, and low-level.
|
||||
Unix variants each provide their own way of controlling terminal
|
||||
devices, making it difficult to provide interfaces that are
|
||||
portable across different Unix systems.
|
||||
Scsh's terminal support is based primarily upon the {\Posix} termios
|
||||
interface.
|
||||
Programs that can be written using only the {\Posix} interface are likely
|
||||
to be widely portable.
|
||||
|
||||
The bulk of the documentation that follows consists of several pages worth
|
||||
of tables defining different named constants that enable and disable different
|
||||
features of the terminal driver.
|
||||
Some of these flags are {\Posix}; others are taken from the two common
|
||||
branches of Unix development, SVR4 and 4.3+ Berkeley.
|
||||
Scsh guarantees that the non-{\Posix} constants will be bound identifiers.
|
||||
\begin{itemize}
|
||||
\item If your OS supports a particular non-{\Posix} flag,
|
||||
its named constant will be bound to the flag's value.
|
||||
\item If your OS doesn't support the flag, its named constant
|
||||
will be present, but bound to \sharpf.
|
||||
\end{itemize}
|
||||
This means that if you want to use SVR4 or Berkeley features in a program,
|
||||
your program can portably test the values of the flags before using
|
||||
them---the flags can reliably be referenced without producing OS-dependent
|
||||
``unbound variable'' errors.
|
||||
|
||||
Finally, note that although {\Posix}, SVR4, and Berkeley cover the lion's
|
||||
share of the terminal-driver functionality,
|
||||
each operating system inevitably has non-standard extensions.
|
||||
While a particular scsh implementation may provide these extensions,
|
||||
they are not portable, and so are not documented here.
|
||||
|
||||
\subsection{Miscellaneous procedures}
|
||||
\defun{tty?}{fd/port}{\boolean}
|
||||
\begin{desc}
|
||||
Return true if the argument is a tty.
|
||||
\end{desc}
|
||||
|
||||
\defun{tty-file-name}{fd/port}{\str}
|
||||
\begin{desc}
|
||||
The argument \var{fd/port} must be a file descriptor or port open on a tty.
|
||||
Return the file-name of the tty.
|
||||
\end{desc}
|
||||
|
||||
\subsection{The tty-info record type}
|
||||
|
||||
The primary data-structure that describes a terminal's mode is
|
||||
a \ex{tty-info} record, defined as follows:
|
||||
\index{tty-info record type}
|
||||
\indextt{tty-info:control-chars}
|
||||
\indextt{tty-info:input-flags}
|
||||
\indextt{tty-info:output-flags}
|
||||
\indextt{tty-info:control-flags}
|
||||
\indextt{tty-info:local-flags}
|
||||
\indextt{tty-info:input-speed}
|
||||
\indextt{tty-info:output-speed}
|
||||
\indextt{tty-info:min}
|
||||
\indextt{tty-info:time}
|
||||
\indextt{tty-info?}
|
||||
\begin{code}
|
||||
(define-record tty-info
|
||||
control-chars ; String: Magic input chars
|
||||
input-flags ; Int: Input processing
|
||||
output-flags ; Int: Output processing
|
||||
control-flags ; Int: Serial-line control
|
||||
local-flags ; Int: Line-editting UI
|
||||
input-speed ; Int: Code for input speed
|
||||
output-speed ; Int: Code for output speed
|
||||
min ; Int: Raw-mode input policy
|
||||
time) ; Int: Raw-mode input policy\end{code}
|
||||
|
||||
\subsubsection{The control-characters string}
|
||||
The \ex{control-chars} field is a character string;
|
||||
its characters may be indexed by integer values taken from
|
||||
table~\ref{table:ttychars}.
|
||||
|
||||
As discussed above,
|
||||
only the {\Posix} entries in table~\ref{table:ttychars} are guaranteed
|
||||
to be legal, integer indices.
|
||||
A program can reliably test the OS to see if the non-{\Posix}
|
||||
characters are supported by checking the index constants.
|
||||
If the control-character function is supported by the terminal driver,
|
||||
then the corresponding index will be bound to an integer;
|
||||
if it is not supported, the index will be bound to \sharpf.
|
||||
|
||||
To disable a given control-character function, set its corresponding
|
||||
entry in the \ex{tty-info:control-chars} string to the
|
||||
special character \exi{disable-tty-char}
|
||||
(and then use the \ex{(set-tty-info \var{fd/port} \var{info})} procedure
|
||||
to update the terminal's state).
|
||||
|
||||
\subsubsection{The flag fields}
|
||||
The \ex{tty-info} record's \ex{input-flags}, \ex{output-flags},
|
||||
\ex{control-flags}, and \ex{local-flags} fields are all bit sets
|
||||
represented as two's-complement integers.
|
||||
Their values are composed by or'ing together values taken from
|
||||
the named constants listed in tables~\ref{table:ttyin}
|
||||
through \ref{table:ttylocal}.
|
||||
|
||||
As discussed above,
|
||||
only the {\Posix} entries listed in these tables are guaranteed
|
||||
to be legal, integer flag values.
|
||||
A program can reliably test the OS to see if the non-{\Posix}
|
||||
flags are supported by checking the named constants.
|
||||
If the feature is supported by the terminal driver,
|
||||
then the corresponding flag will be bound to an integer;
|
||||
if it is not supported, the flag will be bound to \sharpf.
|
||||
|
||||
%%%%% I managed to squeeze this into the DEFINE-RECORD's comments.
|
||||
% Here is a small table classifying the four flag fields by
|
||||
% the kind of features they determine:
|
||||
% \begin{center}
|
||||
% \begin{tabular}{|ll|}\hline
|
||||
% Field & Affects \\ \hline \hline
|
||||
% \ex{input-flags} & Processing of input chars \\
|
||||
% \ex{output-flags} & Processing of output chars \\
|
||||
% \ex{control-flags} & Controlling of terminal's serial line \\
|
||||
% \ex{local-flags} & Details of the line-editting user interface \\
|
||||
% \hline
|
||||
% \end{tabular}
|
||||
% \end{center}
|
||||
|
||||
%%%
|
||||
%%% The figures used to go here.
|
||||
%%%
|
||||
|
||||
\subsubsection{The speed fields}
|
||||
The \ex{input-speed} and \ex{output-speed} fields determine the
|
||||
I/O rate of the terminal's line.
|
||||
The value of these fields is an integer giving the speed
|
||||
in bits-per-second.
|
||||
The following speeds are supported by {\Posix}:
|
||||
\begin{center}
|
||||
\begin{tabular}{rrrr}
|
||||
0 & 134 & 600 & 4800 \\
|
||||
50 & 150 & 1200 & 9600 \\
|
||||
75 & 200 & 1800 & 19200 \\
|
||||
110 & 300 & 2400 & 38400 \\
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
Your OS may accept others; it may also allow the special symbols
|
||||
\ex{'exta} and \ex{'extb}.
|
||||
|
||||
\subsubsection{The min and time fields}
|
||||
The integer \ex{min} and \ex{time} fields determine input blocking
|
||||
behaviour during non-canonical (raw) input; otherwise, they are ignored.
|
||||
See the termios(3) man page for further details.
|
||||
|
||||
Be warned that {\Posix} allows the base system call's representation
|
||||
of the \ex{tty-info} record to share storage for the \ex{min} field
|
||||
and the \ex{ttychar/eof} element of the control-characters string,
|
||||
and for the \ex{time} field and the \ex{ttychar/eol} element
|
||||
of the control-characters string.
|
||||
Many implementations in fact do this.
|
||||
|
||||
To stay out of trouble, set the \ex{min} and \ex{time} fields only
|
||||
if you are putting the terminal into raw mode;
|
||||
set the eof and eol control-characters only if you are putting
|
||||
the terminal into canonical mode.
|
||||
It's ugly, but it's {\Unix}.
|
||||
|
||||
\subsection{Using tty-info records}
|
||||
|
||||
\defun{make-tty-info}{if of cf lf ispeed ospeed min time}
|
||||
{tty-info-record}
|
||||
\defunx{copy-tty-info}{tty-info-record}{tty-info-record}
|
||||
\begin{desc}
|
||||
These procedures make it possible to create new \ex{tty-info} records.
|
||||
The typical method for creating a new record is to copy one retrieved
|
||||
by a call to the \ex{tty-info} procedure, then modify the copy as desired.
|
||||
Note that the \ex{make-tty-info} procedure does not take a parameter
|
||||
to define the new record's control characters.\footnote{
|
||||
Why? Because the length of the string varies from Unix to Unix.
|
||||
For example, the word-erase control character (typically control-w)
|
||||
is provided by most Unixes, but not part of the {\Posix} spec.}
|
||||
Instead, it simply returns a \ex{tty-info} record whose control-character
|
||||
string has all elements initialised to {\Ascii} nul.
|
||||
You may then install the special characters by assigning to the string.
|
||||
Similarly, the control-character string in the record produced by
|
||||
\ex{copy-tty-info} does not share structure with the string in the record
|
||||
being copied, so you may mutate it freely.
|
||||
\end{desc}
|
||||
|
||||
|
||||
\defun{tty-info}{[fd/port/fname]}{tty-info-record}
|
||||
\begin{desc}
|
||||
The \var{fd/port/fname} parameter is an integer file descriptor or
|
||||
Scheme I/O port opened on a terminal device,
|
||||
or a file-name for a terminal device; it defaults to the current input port.
|
||||
This procedure returns a \ex{tty-info} record describing the terminal's
|
||||
current mode.
|
||||
\end{desc}
|
||||
|
||||
\defun {set-tty-info/now} {fd/port/fname info}{no-value}
|
||||
\defunx{set-tty-info/drain}{fd/port/fname info}{no-value}
|
||||
\defunx{set-tty-info/flush}{fd/port/fname info}{no-value}
|
||||
\begin{desc}
|
||||
The \var{fd/port/fname} parameter is an integer file descriptor or
|
||||
Scheme I/O port opened on a terminal device,
|
||||
or a file-name for a terminal device.
|
||||
The procedure chosen determines when and how the terminal's mode is altered:
|
||||
\begin{center}
|
||||
\begin{tabular}{|ll|} \hline
|
||||
Procedure & Meaning \\ \hline \hline
|
||||
\ex{set-tty-info/now} & Make change immediately. \\
|
||||
\ex{set-tty-info/drain} & Drain output, then change. \\
|
||||
\ex{set-tty-info/flush} & Drain output, flush input, then change. \\ \hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\oops{If I had defined these with the parameters in the reverse order,
|
||||
I could have made \var{fd/port/fname} optional. Too late now.}
|
||||
\end{desc}
|
||||
|
||||
\subsection{Other terminal-device procedures}
|
||||
\defun{send-tty-break}{[fd/port/fname duration]}{no-value}
|
||||
\begin{desc}
|
||||
The \var{fd/port/fname} parameter is an integer file descriptor or
|
||||
Scheme I/O port opened on a terminal device,
|
||||
or a file-name for a terminal device; it defaults to the current output port.
|
||||
Send a break signal to the designated terminal.
|
||||
A break signal is a sequence of continuous zeros on the terminal's transmission
|
||||
line.
|
||||
|
||||
The \var{duration} argument determines the length of the break signal.
|
||||
A zero value (the default) causes a break of between
|
||||
0.25 and 0.5 seconds to be sent;
|
||||
other values determine a period in a manner that will depend upon local
|
||||
community standards.
|
||||
\end{desc}
|
||||
|
||||
\defun{drain-tty}{[fd/port/fname]}{no-value}
|
||||
\begin{desc}
|
||||
The \var{fd/port/fname} parameter is an integer file descriptor or
|
||||
Scheme I/O port opened on a terminal device,
|
||||
or a file-name for a terminal device; it defaults to the current output port.
|
||||
|
||||
This procedure waits until all the output written to the
|
||||
terminal device has been transmitted to the device.
|
||||
If \var{fd/port/fname} is an output port with buffered I/O
|
||||
enabled, then the port's buffered characters are flushed before
|
||||
waiting for the device to drain.
|
||||
\end{desc}
|
||||
|
||||
\defun {flush-tty/input} {[fd/port/fname]}{no-value}
|
||||
\defunx{flush-tty/output}{[fd/port/fname]}{no-value}
|
||||
\defunx{flush-tty/both} {[fd/port/fname]}{no-value}
|
||||
\begin{desc}
|
||||
The \var{fd/port/fname} parameter is an integer file descriptor or
|
||||
Scheme I/O port opened on a terminal device,
|
||||
or a file-name for a terminal device; it defaults to the current input
|
||||
port (\ex{flush-tty/input} and \ex{flush-tty/both}),
|
||||
or output port (\ex{flush-tty/output}).
|
||||
|
||||
These procedures discard the unread input chars or unwritten
|
||||
output chars in the tty's kernel buffers.
|
||||
\end{desc}
|
||||
|
||||
\defun {start-tty-output}{[fd/port/fname]} {no-value}
|
||||
\defunx{stop-tty-output} {[fd/port/fname]} {no-value}
|
||||
\defunx{start-tty-input} {[fd/port/fname]} {no-value}
|
||||
\defunx{stop-tty-input} {[fd/port/fname]} {no-value}
|
||||
\begin{desc}
|
||||
These procedures can be used to control a terminal's input and output flow.
|
||||
The \var{fd/port/fname} parameter is an integer file descriptor or
|
||||
Scheme I/O port opened on a terminal device,
|
||||
or a file-name for a terminal device; it defaults to the current input
|
||||
or output port.
|
||||
|
||||
The \ex{stop-tty-output} and \ex{start-tty-output} procedures suspend
|
||||
and resume output from a terminal device.
|
||||
The \ex{stop-tty-input} and \ex{start-tty-input} procedures transmit
|
||||
the special STOP and START characters to the terminal with the intention
|
||||
of stopping and starting terminal input flow.
|
||||
\end{desc}
|
||||
|
||||
% --- Obsolete ---
|
||||
% \defun {encode-baud-rate}{speed}{code}
|
||||
% \defunx{decode-baud-rate}{code}{speed}
|
||||
% \begin{desc}
|
||||
% These procedures can be used to map between the special codes
|
||||
% that are legal values for the \ex{tty-info:input-speed} and
|
||||
% \ex{tty-info:output-speed} fields, and actual integer bits-per-second speeds.
|
||||
% The codes are the values bound to the
|
||||
% \ex{baud/4800}, \ex{baud/9600}, and other named constants defined above.
|
||||
% For example:
|
||||
% \begin{code}
|
||||
% (decode-baud-rate baud/9600) {\evalto} 9600
|
||||
%
|
||||
% ;;; These two expressions are identical:
|
||||
% (set-tty-info:input-speed ti baud/14400)
|
||||
% (set-tty-info:input-speed ti (encode-baud-rate 14400))\end{code}
|
||||
% \end{desc}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Control terminals, sessions, and terminal process groups}
|
||||
|
||||
\defun{open-control-tty}{tty-name [flags]}{port}
|
||||
\begin{desc}
|
||||
This procedure opens terminal device \var{tty-name} as the process'
|
||||
control terminal
|
||||
(see the \ex{termios} man page for more information on control terminals).
|
||||
The \var{tty-name} argument is a file-name such as \ex{/dev/ttya}.
|
||||
The \var{flags} argument is a value suitable as the second argument
|
||||
to the \ex{open-file} call; it defaults to \ex{open/read+write}, causing
|
||||
the terminal to be opened for both input and output.
|
||||
|
||||
The port returned is an input port if the \var{flags} permit it,
|
||||
otherwise an output port.
|
||||
\R4RS/\scm/scsh do not have input/output ports,
|
||||
so it's one or the other.
|
||||
However, you can get both read and write ports open on a terminal
|
||||
by opening it read/write, taking the result input port,
|
||||
and duping it to an output port with \ex{dup->outport}.
|
||||
|
||||
This procedure guarantees to make the opened terminal the
|
||||
process' control terminal only if the process does not have
|
||||
an assigned control terminal at the time of the call.
|
||||
If the scsh process already has a control terminal, the results are undefined.
|
||||
|
||||
To arrange for the process to have no control terminal prior to calling
|
||||
this procedure, use the \ex{become-session-leader} procedure.
|
||||
|
||||
%\oops{The control terminal code was added just before release time
|
||||
% for scsh release 0.4. Control terminals are one of the less-standardised
|
||||
% elements of Unix. We can't guarantee that the terminal is definitely
|
||||
% attached as a control terminal; we were only able to test this out
|
||||
% on HP-UX. If you intend to use this feature on your OS, you should
|
||||
% test it out first. If your OS requires the use of the \ex{TIOCSCTTY}
|
||||
% \ex{ioctl}, uncomment the appropriate few lines of code in the
|
||||
% file \ex{tty1.c} and send us email.}
|
||||
\end{desc}
|
||||
|
||||
\defun{become-session-leader}{}{\integer}
|
||||
\begin{desc}
|
||||
This is the C \ex{setsid()} call.
|
||||
{\Posix} job-control has a three-level hierarchy:
|
||||
session/process-group/process.
|
||||
Every session has an associated control terminal.
|
||||
This procedure places the current process into a brand new session,
|
||||
and disassociates the process from any previous control terminal.
|
||||
You may subsequently use \ex{open-control-tty} to open a new control
|
||||
terminal.
|
||||
|
||||
It is an error to call this procedure if the current process is already
|
||||
a process-group leader.
|
||||
One way to guarantee this is not the case is only to call this procedure
|
||||
after forking.
|
||||
\end{desc}
|
||||
|
||||
|
||||
\defun {tty-process-group}{fd/port/fname}{\integer}
|
||||
\defunx{set-tty-process-group}{fd/port/fname pgrp}{\undefined}
|
||||
\begin{desc}
|
||||
This pair of procedures gets and sets the process group of a given
|
||||
terminal.
|
||||
\end{desc}
|
||||
|
||||
\defun{control-tty-file-name}{}{\str}
|
||||
\begin{desc}
|
||||
Return the file-name of the process' control tty.
|
||||
On every version of Unix of which we are aware, this is just the string
|
||||
\ex{"/dev/tty"}.
|
||||
However, this procedure uses the official Posix interface, so it is more
|
||||
portable than simply using a constant string.
|
||||
\end{desc}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\subsection{Pseudo-terminals}
|
||||
Scsh implements an interface to Berkeley-style pseudo-terminals.
|
||||
|
||||
\defun{fork-pty-session}{thunk}{[process pty-in pty-out tty-name]}
|
||||
\begin{desc}
|
||||
This procedure gives a convenient high-level interface to pseudo-terminals.
|
||||
It first allocates a pty/tty pair of devices, and then forks a child
|
||||
to execute procedure \var{thunk}.
|
||||
In the child process
|
||||
\begin{itemize}
|
||||
\item Stdio and the current I/O ports are bound to the terminal device.
|
||||
\item The child is placed in its own, new session
|
||||
(see \ex{become\=session\=leader}).
|
||||
\item The terminal device becomes the new session's controlling terminal
|
||||
(see \ex{open-control-tty}).
|
||||
\item The \ex{(error-output-port)} is unbuffered.
|
||||
\end{itemize}
|
||||
|
||||
The \ex{fork-pty-session} procedure returns four values:
|
||||
the child's process object, two ports open on the controlling pty device,
|
||||
and the name of the child's corresponding terminal device.
|
||||
\end{desc}
|
||||
|
||||
\defun{open-pty}{}{pty-inport tty-name}
|
||||
\begin{desc}
|
||||
This procedure finds a free pty/tty pair, and opens the pty device
|
||||
with read/write access.
|
||||
It returns a port on the pty,
|
||||
and the name of the corresponding terminal device.
|
||||
|
||||
The port returned is an input port---Scheme doesn't allow input/output
|
||||
ports.
|
||||
However, you can easily use \ex{(dup->outport \var{pty-inport})}
|
||||
to produce a matching output port.
|
||||
You may wish to turn off I/O buffering for this output port.
|
||||
\end{desc}
|
||||
|
||||
|
||||
\defun {pty-name->tty-name}{pty-name}{tty-name}
|
||||
\defunx{tty-name->pty-name}{tty-name}{pty-name}
|
||||
\begin{desc}
|
||||
These two procedures map between corresponding terminal and pty controller
|
||||
names.
|
||||
For example,
|
||||
\begin{code}
|
||||
(pty-name->tty-name "/dev/ptyq3") {\evalto} "/dev/ttyq3"
|
||||
(tty-name->pty-name "/dev/ttyrc") {\evalto} "/dev/ptyrc"\end{code}
|
||||
|
||||
\remark{This is rather Berkeley-specific. SVR4 ptys are rare enough that
|
||||
I've no real idea if it generalises across the Unix gap. Experts
|
||||
are invited to advise. Users feel free to not worry---the predominance
|
||||
of current popular Unix systems use Berkeley ptys.}
|
||||
\end{desc}
|
||||
|
||||
\defunx{make-pty-generator}{}{\proc}
|
||||
\begin{desc}
|
||||
This procedure returns a generator of candidate pty names.
|
||||
Each time the returned procedure is called, it produces a
|
||||
new candidate.
|
||||
Software that wishes to search through the set of available ptys
|
||||
can use a pty generator to iterate over them.
|
||||
After producing all the possible ptys, a generator returns {\sharpf}
|
||||
every time it is called.
|
||||
Example:
|
||||
\begin{code}
|
||||
(define pg (make-pty-generator))
|
||||
(pg) {\evalto} "/dev/ptyp0"
|
||||
(pg) {\evalto} "/dev/ptyp1"
|
||||
\vdots
|
||||
(pg) {\evalto} "/dev/ptyqe"
|
||||
(pg) {\evalto} "/dev/ptyqf" \textit{(Last one)}
|
||||
(pg) {\evalto} {\sharpf}
|
||||
(pg) {\evalto} {\sharpf}
|
||||
\vdots\end{code}
|
||||
\end{desc}
|
||||
|
||||
|
||||
% Flag tables
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% Control-chars indices
|
||||
%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\begin{table}[p]
|
||||
\begin{center}
|
||||
\begin{tabular}{|lll|} \hline
|
||||
Scsh & C & Typical char \\
|
||||
\hline\hline
|
||||
{\Posix} & & \\
|
||||
\exi{ttychar/delete-char} & \ex{ERASE} & del \\
|
||||
\exi{ttychar/delete-line} & \ex{KILL} & \verb|^U| \\
|
||||
\exi{ttychar/eof} & \ex{EOF} & \verb|^D| \\
|
||||
\exi{ttychar/eol} & \ex{EOL} & \\
|
||||
\exi{ttychar/interrupt} & \ex{INTR} & \verb|^C| \\
|
||||
\exi{ttychar/quit} & \ex{QUIT} & \verb|^\| \\
|
||||
\exi{ttychar/suspend} & \ex{SUSP} & \verb|^Z| \\
|
||||
\exi{ttychar/start} & \ex{START} & \verb|^Q| \\
|
||||
\exi{ttychar/stop} & \ex{STOP} & \verb|^S| \\
|
||||
|
||||
\hline\hline
|
||||
{SVR4 and 4.3+BSD} & & \\
|
||||
\exi{ttychar/delayed-suspend} & \ex{DSUSP} & \verb|^Y| \\
|
||||
\exi{ttychar/delete-word} & \ex{WERASE} & \verb|^W| \\
|
||||
\exi{ttychar/discard} & \ex{DISCARD} & \verb|^O| \\
|
||||
\exi{ttychar/eol2} & \ex{EOL2} & \\
|
||||
\exi{ttychar/literal-next} & \ex{LNEXT} & \verb|^V| \\
|
||||
\exi{ttychar/reprint} & \ex{REPRINT} & \verb|^R| \\
|
||||
|
||||
\hline\hline
|
||||
{4.3+BSD} & & \\
|
||||
\exi{ttychar/status} & \ex{STATUS} & \verb|^T| \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\caption{Indices into the \protect\ex{tty-info} record's
|
||||
\protect\var{control-chars} string,
|
||||
and the character traditionally found at each index.
|
||||
Only the indices for the {\Posix} entries are guaranteed to
|
||||
be non-\sharpf.}
|
||||
\label{table:ttychars}
|
||||
\end{table}
|
||||
|
||||
% Input flags
|
||||
%%%%%%%%%%%%%
|
||||
\begin{table}[p]
|
||||
\begin{center}\small
|
||||
\begin{tabular}{|lll|} \hline
|
||||
Scsh & C & Meaning \\
|
||||
\hline\hline
|
||||
\Posix & & \\
|
||||
\exi{ttyin/check-parity}
|
||||
& \ex{INPCK} & Check parity. \\
|
||||
\exi{ttyin/ignore-bad-parity-chars}
|
||||
& \ex{IGNPAR} & Ignore chars with parity errors. \\
|
||||
\exi{ttyin/mark-parity-errors}
|
||||
& \ex{PARMRK} & Insert chars to mark parity errors.\\
|
||||
\exi{ttyin/ignore-break}
|
||||
& \ex{IGNBRK} & Ignore breaks. \\
|
||||
\exi{ttyin/interrupt-on-break}
|
||||
& \ex{BRKINT} & Signal on breaks. \\
|
||||
\exi{ttyin/7bits}
|
||||
& \ex{ISTRIP} & Strip char to seven bits. \\
|
||||
\exi{ttyin/cr->nl}
|
||||
& \ex{ICRNL} & Map carriage-return to newline. \\
|
||||
\exi{ttyin/ignore-cr}
|
||||
& \ex{IGNCR} & Ignore carriage-returns. \\
|
||||
\exi{ttyin/nl->cr}
|
||||
& \ex{INLCR} & Map newline to carriage-return. \\
|
||||
\exi{ttyin/input-flow-ctl}
|
||||
& \ex{IXOFF} & Enable input flow control. \\
|
||||
\exi{ttyin/output-flow-ctl}
|
||||
& \ex{IXON} & Enable output flow control. \\
|
||||
|
||||
\hline\hline
|
||||
{SVR4 and 4.3+BSD} & & \\
|
||||
\exi{ttyin/xon-any} & \ex{IXANY} & Any char restarts after stop. \\
|
||||
\exi{ttyin/beep-on-overflow} & \ex{IMAXBEL} & Ring bell when queue full. \\
|
||||
|
||||
\hline\hline
|
||||
{SVR4} & & \\
|
||||
\exi{ttyin/lowercase} & \ex{IUCLC} & Map upper case to lower case. \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\caption{Input-flags. These are the named flags for the \protect\ex{tty-info}
|
||||
record's \protect\var{input-flags} field.
|
||||
These flags generally control the processing of input chars.
|
||||
Only the {\Posix} entries are guaranteed to be non-\sharpf.
|
||||
}
|
||||
\label{table:ttyin}
|
||||
\end{table}
|
||||
|
||||
% Output flags
|
||||
%%%%%%%%%%%%%%
|
||||
\begin{table}[p]
|
||||
\begin{center}%\small
|
||||
\begin{tabular}{|lll|} \hline
|
||||
Scsh & C & Meaning \\ \hline\hline
|
||||
|
||||
\multicolumn{3}{|l|}{\Posix} \\
|
||||
\exi{ttyout/enable} & \ex{OPOST} & Enable output processing. \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{SVR4 and 4.3+BSD} \\
|
||||
\exi{ttyout/nl->crnl} & \ex{ONLCR} & Map nl to cr-nl. \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{4.3+BSD} \\
|
||||
\exi{ttyout/discard-eot} & \ex{ONOEOT} & Discard EOT chars. \\
|
||||
\exi{ttyout/expand-tabs} & \ex{OXTABS}\footnote{
|
||||
Note this is distinct from the SVR4-equivalent
|
||||
\ex{ttyout/tab-delayx} flag defined in
|
||||
table~\ref{table:ttydelays}.}
|
||||
& Expand tabs. \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{SVR4} \\
|
||||
\exi{ttyout/cr->nl} & \ex{OCRNL} & Map cr to nl. \\
|
||||
\exi{ttyout/nl-does-cr} & \ex{ONLRET}& Nl performs cr as well. \\
|
||||
\exi{ttyout/no-col0-cr} & \ex{ONOCR} & No cr output in column 0. \\
|
||||
\exi{ttyout/delay-w/fill-char} & \ex{OFILL} & Send fill char to delay. \\
|
||||
\exi{ttyout/fill-w/del} & \ex{OFDEL} & Fill char is {\Ascii} DEL. \\
|
||||
\exi{ttyout/uppercase} & \ex{OLCUC} & Map lower to upper case. \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
\caption{Output-flags. These are the named flags for the \protect\ex{tty-info}
|
||||
record's \protect\var{output-flags} field.
|
||||
These flags generally control the processing of output chars.
|
||||
Only the {\Posix} entries are guaranteed to be non-\sharpf.}
|
||||
\label{table:ttyout}
|
||||
\end{table}
|
||||
|
||||
% Delay flags
|
||||
%%%%%%%%%%%%%
|
||||
\begin{table}[p]
|
||||
\begin{tabular}{r|ll|} \cline{2-3}
|
||||
& Value & Comment \\ \cline{2-3}
|
||||
{Backspace delay} & \exi{ttyout/bs-delay} & Bit-field mask \\
|
||||
& \exi{ttyout/bs-delay0} & \\
|
||||
& \exi{ttyout/bs-delay1} & \\
|
||||
|
||||
\cline{2-3}
|
||||
{Carriage-return delay} & \exi{ttyout/cr-delay} & Bit-field mask \\
|
||||
& \exi{ttyout/cr-delay0} & \\
|
||||
& \exi{ttyout/cr-delay1} & \\
|
||||
& \exi{ttyout/cr-delay2} & \\
|
||||
& \exi{ttyout/cr-delay3} & \\
|
||||
|
||||
\cline{2-3}
|
||||
{Form-feed delay} & \exi{ttyout/ff-delay} & Bit-field mask \\
|
||||
& \exi{ttyout/ff-delay0} & \\
|
||||
& \exi{ttyout/ff-delay1} & \\
|
||||
|
||||
\cline{2-3}
|
||||
{Horizontal-tab delay} & \exi{ttyout/tab-delay} & Bit-field mask \\
|
||||
& \exi{ttyout/tab-delay0} & \\
|
||||
& \exi{ttyout/tab-delay1} & \\
|
||||
& \exi{ttyout/tab-delay2} & \\
|
||||
& \exi{ttyout/tab-delayx} & Expand tabs \\
|
||||
|
||||
\cline{2-3}
|
||||
{Newline delay} & \exi{ttyout/nl-delay} & Bit-field mask \\
|
||||
& \exi{ttyout/nl-delay0} & \\
|
||||
& \exi{ttyout/nl-delay1} & \\
|
||||
|
||||
\cline{2-3}
|
||||
{Vertical tab delay} & \exi{ttyout/vtab-delay} & Bit-field mask \\
|
||||
& \exi{ttyout/vtab-delay0} & \\
|
||||
& \exi{ttyout/vtab-delay1} & \\
|
||||
|
||||
\cline{2-3}
|
||||
{All} & \exi{ttyout/all-delay} & Total bit-field mask \\
|
||||
\cline{2-3}
|
||||
\end{tabular}
|
||||
|
||||
\caption{Delay constants. These are the named flags for the
|
||||
\protect\ex{tty-info} record's \protect\var{output-flags} field.
|
||||
These flags control the output delays associated with printing
|
||||
special characters.
|
||||
They are non-{\Posix}, and have non-{\sharpf} values
|
||||
only on SVR4 systems.}
|
||||
\label{table:ttydelays}
|
||||
\end{table}
|
||||
|
||||
% Control flags
|
||||
%%%%%%%%%%%%%%%
|
||||
\begin{table}[p]
|
||||
\begin{center}%\small
|
||||
\begin{tabular}{|lll|} \hline
|
||||
Scsh & C & Meaning \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{\Posix} \\
|
||||
\exi{ttyc/char-size} & \ex{CSIZE} & Character size mask \\
|
||||
\exi{ttyc/char-size5} & \ex{CS5} & 5 bits \\
|
||||
\exi{ttyc/char-size6} & \ex{CS6} & 6 bits \\
|
||||
\exi{ttyc/char-size7} & \ex{CS7} & 7 bits \\
|
||||
\exi{ttyc/char-size8} & \ex{CS8} & 8 bits \\
|
||||
\exi{ttyc/enable-parity}& \ex{PARENB} & Generate and detect parity. \\
|
||||
\exi{ttyc/odd-parity} & \ex{PARODD} & Odd parity. \\
|
||||
\exi{ttyc/enable-read} & \ex{CREAD} & Enable reception of chars. \\
|
||||
\exi{ttyc/hup-on-close} & \ex{HUPCL} & Hang up on last close. \\
|
||||
\exi{ttyc/no-modem-sync}& \ex{LOCAL} & Ignore modem lines. \\
|
||||
\exi{ttyc/2-stop-bits} & \ex{CSTOPB} & Send two stop bits. \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{4.3+BSD} \\
|
||||
\exi{ttyc/ignore-flags} & \ex{CIGNORE} & Ignore control flags. \\
|
||||
\exi{ttyc/CTS-output-flow-ctl} & \verb|CCTS_OFLOW| & CTS flow control of output \\
|
||||
\exi{ttyc/RTS-input-flow-ctl} & \verb|CRTS_IFLOW| & RTS flow control of input \\
|
||||
\exi{ttyc/carrier-flow-ctl} & \ex{MDMBUF} & \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
\caption{Control-flags. These are the named flags for the \protect\ex{tty-info}
|
||||
record's \protect\var{control-flags} field.
|
||||
These flags generally control the details of the terminal's
|
||||
serial line.
|
||||
Only the {\Posix} entries are guaranteed to be non-\sharpf.}
|
||||
\label{table:ttyctl}
|
||||
\end{table}
|
||||
|
||||
% Local flags
|
||||
%%%%%%%%%%%%%
|
||||
\begin{table}[p]
|
||||
\begin{center}\small
|
||||
\begin{tabular}{|lll|} \hline
|
||||
Scsh & C & Meaning \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{\Posix} \\
|
||||
\exi{ttyl/canonical} & \ex{ICANON} & Canonical input processing. \\
|
||||
\exi{ttyl/echo} & \ex{ECHO} & Enable echoing. \\
|
||||
\exi{ttyl/echo-delete-line} & \ex{ECHOK} & Echo newline after line kill. \\
|
||||
\exi{ttyl/echo-nl} & \ex{ECHONL} & Echo newline even if echo is off. \\
|
||||
\exi{ttyl/visual-delete}& \ex{ECHOE} & Visually erase chars. \\
|
||||
\exi{ttyl/enable-signals} & \ex{ISIG} & Enable \verb|^|C, \verb|^|Z signalling. \\
|
||||
\exi{ttyl/extended} & \ex{IEXTEN} & Enable extensions. \\
|
||||
\exi{ttyl/no-flush-on-interrupt}
|
||||
& \ex{NOFLSH} & Don't flush after interrupt. \\
|
||||
\exi{ttyl/ttou-signal} & \ex{ITOSTOP} & \ex{SIGTTOU} on background output. \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{SVR4 and 4.3+BSD} \\
|
||||
\exi{ttyl/echo-ctl} & \ex{ECHOCTL}
|
||||
& Echo control chars as ``\verb|^X|''. \\
|
||||
\exi{ttyl/flush-output} & \ex{FLUSHO} & Output is being flushed. \\
|
||||
\exi{ttyl/hardcopy-delete} & \ex{ECHOPRT} & Visual erase for hardcopy. \\
|
||||
\exi{ttyl/reprint-unread-chars} & \ex{PENDIN} & Retype pending input. \\
|
||||
\exi{ttyl/visual-delete-line} & \ex{ECHOKE} & Visually erase a line-kill. \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{4.3+BSD} \\
|
||||
\exi{ttyl/alt-delete-word} & \ex{ALTWERASE} & Alternate word erase algorithm \\
|
||||
\exi{ttyl/no-kernel-status} & \ex{NOKERNINFO} & No kernel status on \verb|^T|. \\
|
||||
|
||||
\hline\hline
|
||||
\multicolumn{3}{|l|}{SVR4} \\
|
||||
\exi{ttyl/case-map} & \ex{XCASE} & Canonical case presentation \\
|
||||
\hline
|
||||
\end{tabular}
|
||||
\end{center}
|
||||
|
||||
\caption{Local-flags. These are the named flags for the \protect\ex{tty-info}
|
||||
record's \protect\var{local-flags} field.
|
||||
These flags generally control the details of the line-editting
|
||||
user interface.
|
||||
Only the {\Posix} entries are guaranteed to be non-\sharpf.}
|
||||
\label{table:ttylocal}
|
||||
\end{table}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@ -0,0 +1,38 @@
|
|||
%&latex -*- latex -*-
|
||||
|
||||
% This is the reference manual for the Scheme Shell.
|
||||
|
||||
\documentclass[twoside]{report}
|
||||
\usepackage{code,boxedminipage,draftfooters,makeidx,palatino,ct,
|
||||
headings,mantitle,array,matter,a4}
|
||||
|
||||
% Style issues
|
||||
\parskip = 3pt plus 3pt
|
||||
\sloppy
|
||||
|
||||
\input{decls}
|
||||
\makeindex
|
||||
%%% End preamble
|
||||
|
||||
\begin{document}
|
||||
|
||||
\frontmatter
|
||||
\include{front}
|
||||
|
||||
\mainmatter
|
||||
\include{intro}
|
||||
\include{procnotation}
|
||||
\include{syscalls}
|
||||
\include{network}
|
||||
\include{strings}
|
||||
\include{rdelim}
|
||||
\include{awk}
|
||||
\include{miscprocs}
|
||||
\include{running}
|
||||
\include{changes}
|
||||
\include{todo}
|
||||
|
||||
\backmatter
|
||||
\printindex
|
||||
|
||||
\end{document}
|
|
@ -3522,7 +3522,7 @@ Fr(,)j(17\(10\):685\261700,)e(October)1047 2987 y(1987.)299
|
|||
Fo(MIT)h(Scheme)f(Refer)n(ence)f(Manual.)911 3554 y Fr(MIT)55
|
||||
b(Arti\256cial)e(Intelligence)e(Laboratory)i(T)-8 b(echnical)52
|
||||
b(Report)1047 3666 y(1281,)42 b(January)e(1991.)e(\(Also)h(URL)g
|
||||
Fn(http://martigny.ai.)1047 3779 y(mit.edu/emacs-html.local/)o(sche)o(me)p
|
||||
Fn(http://zurich.ai.)1047 3779 y(mit.edu/emacs-html.local/)o(sche)o(me)p
|
||||
2539 3779 29 4 v 28 w(toc.html)p Fr(\))299 4120 y([Nelson])263
|
||||
b(Gr)n(eg)22 b(Nelson,)g(ed.)911 4233 y Fo(Systems)f(Pr)n(ogramming)g(with)i
|
||||
(Modula-3.)911 4346 y Fr(Pr)n(entice)f(Hall,)f(Englewood)h(Clif)n(fs,)g(New)h
|
||||
|
|
|
@ -1794,7 +1794,7 @@ the unix-haters list helped a great deal to maintain my perspective.
|
|||
MIT Artificial Intelligence Laboratory Technical Report 1281,
|
||||
January 1991.
|
||||
(Also URL
|
||||
{\tt http://martigny\.ai\.mit\.edu\=emacs-html\.local\=scheme\_toc.html})
|
||||
` {\tt http://zurich\.ai\.mit\.edu\=emacs-html\.local\=scheme\_toc.html})
|
||||
|
||||
\Bibitem[Nelson]{Nelson} Greg Nelson, ed. \\
|
||||
{\em Systems Programming with Modula-3.} \\
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
We are pleased to release version 0.5 of scsh, the Scheme shell.
|
||||
|
||||
* Scsh
|
||||
------
|
||||
|
||||
Scsh is a Scheme system designed for systems programming and high-level
|
||||
scripting of Unix applications. It includes
|
||||
|
||||
- a complete Posix interface from Scheme, including complete
|
||||
sockets support, signal handlers, and tty control;
|
||||
|
||||
- a uniform interface to other generally-universal Unix features,
|
||||
such as symlinks and pseudo-terminals;
|
||||
|
||||
- a library of generally useful tools for scripting applications,
|
||||
such as regular expressions;
|
||||
|
||||
- macro support for a high-level process notation, allowing one to
|
||||
build pipelines of programs and redirect I/O, similar to Unix shells
|
||||
such as sh and csh;
|
||||
|
||||
- a full R5RS-compliant Scheme, with important extensions: record types,
|
||||
exceptions, and modules;
|
||||
|
||||
- command-line interface designed for writing scripts that are invoked
|
||||
with #! triggers on their first line.
|
||||
|
||||
Scsh runs on most Unix platforms, including Linux, various BSD systems,
|
||||
Solaris, AIX, and Irix. It is implemented as an extension of Scheme 48,
|
||||
a portable, byte-code interpreter Scheme implementation.
|
||||
|
||||
* Obtaining scsh
|
||||
----------------
|
||||
|
||||
You may obtain the new release at the scsh web page
|
||||
|
||||
http://www-swiss.ai.mit.edu/scsh/
|
||||
|
||||
which points to the following file, retrievable by anonymous ftp:
|
||||
|
||||
ftp://ftp-swiss.ai.mit.edu/pub/su/scsh/scsh.tar.gz
|
||||
|
||||
The tar file includes full sources, a detailed manual and a paper
|
||||
describing the design of the system.
|
||||
|
||||
For the lazily curious, we also have the manual separately available as
|
||||
ftp://ftp-swiss.ai.mit.edu/pub/su/scsh/scsh-manual.ps
|
||||
Just click 'n view.
|
||||
|
||||
You should be able to build scsh for your system by simply ftping
|
||||
the release file, and doing the following:
|
||||
gunzip < scsh.tar.gz | tar xf -
|
||||
cd scsh-0.5
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
* New in this release
|
||||
---------------------
|
||||
Our last release had a lot of new code, and some elements were pretty
|
||||
flaky. Scsh is now much more robust. All known bugs have been fixed.
|
||||
|
||||
Scsh now supports complete Posix, including signal handlers.
|
||||
Early autoreaping of child processes is now handled by a SIGCHLD
|
||||
signal handler, so children are reaped as early as possible with no
|
||||
user intervention required.
|
||||
|
||||
A functional static heap linker is included in this release.
|
||||
It is ugly, limited in functionality, and extremely slow, but it works.
|
||||
It can be used to build scsh binaries that start up instantly.
|
||||
|
||||
There is a new command-line switch,
|
||||
-sfd <num>
|
||||
which causes scsh to read its script from file descriptor <num>.
|
||||
|
||||
Scheme 48's floating-point support was inadvertently omitted from the last
|
||||
release. It has been reinstated.
|
||||
|
||||
The regular expression system has been sped up. Regular-expression
|
||||
compilation is now provided, and the AWK macro has been rewritten to
|
||||
pre-compile regexps used in rules outside the loop. It is still, however,
|
||||
slower than it should be.
|
||||
|
||||
We have introduced two new procedures for performing regexp-directed
|
||||
string substitutions:
|
||||
regexp-substitute
|
||||
regexp-substitute/global
|
||||
The design differs from what one finds in systems such as sed or perl,
|
||||
and is quite powerful.
|
||||
|
||||
Execing programs should be faster in this release, since we now use the
|
||||
CLOEXEC status bit to get automatic closing of unrevealed port file
|
||||
descriptors.
|
||||
|
||||
* Thanks
|
||||
--------
|
||||
|
||||
We received many bug reports, improvements, fixes and suggestions from scsh
|
||||
users. In particular, we'd like to thank Alan Bawden, Michael Becker, Jim
|
||||
Blandy, Jin Choi, Sean Doran, Lutz Euler, Kevin Esler, Rolf-Thomas Happe,
|
||||
David Hull, Shriram Krishnamurthi, Tod Olson, Michel Schinz, Bill Sommerfeld,
|
||||
Mike Sperber, and Victor Zandy for their contributions to this release.
|
||||
|
||||
Thanks, guys; we really appreciate the feedback.
|
||||
|
||||
Olin Shivers Brian D. Carlstrom
|
||||
Cambridge, Mass. Santa Clara, Ca.
|
||||
|
||||
May, 1997
|
|
@ -0,0 +1,4 @@
|
|||
These are extra style files needed to process scsh-paper.tex in
|
||||
LaTeX 2e.
|
||||
-Olin
|
||||
3/12/98
|
|
@ -0,0 +1,45 @@
|
|||
% boxedminipage.sty
|
||||
%
|
||||
% adds the boxedminipage environment---just like minipage, but has a
|
||||
% box round it!
|
||||
%
|
||||
% The thickneess of the rules around the box is controlled by
|
||||
% \fboxrule, and the distance between the rules and the edges of the
|
||||
% inner box is governed by \fboxsep.
|
||||
%
|
||||
% This code is based on Lamport's minipage code.
|
||||
|
||||
\def\boxedminipage{\@ifnextchar [{\@iboxedminipage}{\@iboxedminipage[c]}}
|
||||
|
||||
\def\@iboxedminipage[#1]#2{\leavevmode \@pboxswfalse
|
||||
\if #1b\vbox
|
||||
\else \if #1t\vtop
|
||||
\else \ifmmode \vcenter
|
||||
\else \@pboxswtrue $\vcenter
|
||||
\fi
|
||||
\fi
|
||||
\fi\bgroup % start of outermost vbox/vtop/vcenter
|
||||
\hsize #2
|
||||
\hrule\@height\fboxrule
|
||||
\hbox\bgroup % inner hbox
|
||||
\vrule\@width\fboxrule \hskip\fboxsep \vbox\bgroup % innermost vbox
|
||||
\advance\hsize -2\fboxrule \advance\hsize-2\fboxsep
|
||||
\textwidth\hsize \columnwidth\hsize
|
||||
\@parboxrestore
|
||||
\def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
|
||||
\let\@footnotetext\@mpfootnotetext
|
||||
\let\@listdepth\@mplistdepth \@mplistdepth\z@
|
||||
\@minipagerestore\@minipagetrue
|
||||
\everypar{\global\@minipagefalse\everypar{}}}
|
||||
|
||||
\def\endboxedminipage{%
|
||||
\par\vskip-\lastskip
|
||||
\ifvoid\@mpfootins\else
|
||||
\vskip\skip\@mpfootins\footnoterule\unvbox\@mpfootins\fi
|
||||
\egroup % ends the innermost \vbox
|
||||
\hskip\fboxsep \vrule\@width\fboxrule
|
||||
\egroup % ends the \hbox
|
||||
\hrule\@height\fboxrule
|
||||
\egroup% ends the vbox/vtop/vcenter
|
||||
\if@pboxsw $\fi}
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
% code.sty: -*- latex -*-
|
||||
% Latex macros for a "weak" verbatim mode.
|
||||
% -- like verbatim, except \, {, and } have their usual meanings.
|
||||
|
||||
% Environments: code, tightcode, codeaux, codebox, centercode
|
||||
% Commands: \dcd, \cddollar, \cdmath, \cd, \codeallowbreaks, \codeskip, \^
|
||||
% Already defined in LaTeX, but of some relevance: \#, \$, \%, \&, \_, \{, \}
|
||||
|
||||
% Changelog at the end of the file.
|
||||
|
||||
% These commands give you an environment, code, that is like verbatim
|
||||
% except that you can still insert commands in the middle of the environment:
|
||||
% \begin{code}
|
||||
% for(x=1; x<loop_bound; x++)
|
||||
% y += x^3; /* {\em Add in {\tt x} cubed} */
|
||||
% \end{code}
|
||||
%
|
||||
% All characters are ordinary except \{}. To get \{} in your text,
|
||||
% you use the commands \\, \{, and \}.
|
||||
|
||||
% These macros mess with the definition of the special chars (e.g., ^_~%).
|
||||
% The characters \{} are left alone, so you can still have embedded commands:
|
||||
% \begin{code} f(a,b,\ldots,y,z) \end{code}
|
||||
% However, if your embedded commands use the formerly-special chars, as in
|
||||
% \begin{code} x := x+1 /* \mbox{\em This is $y^3$} */ \end{code}
|
||||
% then you lose. The $ and ^ chars are scanned in as non-specials,
|
||||
% so they don't work. If the chars are scanned *outside* the code env,
|
||||
% then you have no problem:
|
||||
% \def\ycube{$y^3$}
|
||||
% \begin{code} x := x+1 /* {\em This is \ycube} */ \end{code}
|
||||
% If you must put special chars inside the code env, you do it by
|
||||
% prefixing them with the special \dcd ("decode") command, that
|
||||
% reverts the chars to back to special status:
|
||||
% \begin{code} x := x+1 /* {\dcd\em This is $y^3$} */ \end{code}
|
||||
% \dcd's scope is bounded by its enclosing braces. It is only defined within
|
||||
% the code env. You can also turn on just $ with the \cddollar command;
|
||||
% you can turn on just $^_ with the \cdmath command. See below.
|
||||
%
|
||||
% Alternatively, just use \(...\) for $...$, \sp for ^, and \sb for _.
|
||||
|
||||
% WARNING:
|
||||
% Like \verb, you cannot put a \cd{...} inside an argument to a macro
|
||||
% or a command. If you try, for example,
|
||||
% \mbox{\cd{$x^y$}}
|
||||
% you will lose. That is because the text "\cd{$x^y$}" gets read in
|
||||
% as \mbox's argument before the \cd executes. But the \cd has to
|
||||
% have a chance to run before LaTeX ever reads the $x^y$ so it can
|
||||
% turn off the specialness of $ and ^. So, \cd has to appear at
|
||||
% top level, not inside an argument. Similarly, you can't have
|
||||
% a \cd or a \code inside a macro (Although you could use \gdef to
|
||||
% define a macro *inside* a \cd, which you could then use outside.
|
||||
% Don't worry about this if you don't understand it.)
|
||||
|
||||
% BUG: In the codebox env, the effect of a \dcd, \cddollar, or \cdmath
|
||||
% command is reset at the end of each line. This can be hacked by
|
||||
% messing with the \halign's preamble, if you feel up to it.
|
||||
|
||||
% Useage note: the initial newline after the \begin{code} or
|
||||
% \begin{codebox} is eaten, but the last newline is not.
|
||||
% So,
|
||||
% \begin{code}
|
||||
% foo
|
||||
% bar
|
||||
% \end{code}
|
||||
% leaves one more blank line after bar than does
|
||||
% \begin{code}
|
||||
% foo
|
||||
% bar\end{code}
|
||||
% Moral: get in the habit of terminating code envs without a newline
|
||||
% (as in the second example).
|
||||
%
|
||||
|
||||
% All this stuff tweaks the meaning of space, tab, and newline.
|
||||
%===============================================================================
|
||||
% \cd@obeyspaces
|
||||
% Turns all spaces into non-breakable spaces.
|
||||
% Note: this is like \@vobeyspaces except without spurious space in defn.
|
||||
% @xobeysp is basically a space; it's defined in latex.tex.
|
||||
%
|
||||
{\catcode`\ =\active\gdef\cd@obeyspaces{\catcode`\ =\active\let =\@xobeysp}}
|
||||
|
||||
|
||||
|
||||
% \cd@obeytabs
|
||||
% Turns all tabs into 8 non-breakable spaces (which is bogus).
|
||||
%
|
||||
{\catcode`\^^I=\active %
|
||||
\gdef\cd@obeytabs{\catcode`\^^I=\active\let^^I=\cd@tab}}
|
||||
|
||||
\def\cd@tab{\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp\@xobeysp}
|
||||
|
||||
|
||||
|
||||
% \cd@obeylines
|
||||
% Turns all cr's into linebreaks. Pagebreaks are not permitted between lines.
|
||||
% This is copied from lplain.tex's \obeylines, with the cr def'n changed.
|
||||
%
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\cd@obeylines{\catcode`\^^M=\active\let^^M=\cd@cr}}
|
||||
|
||||
% What ^M turns into. This def'n keeps blank lines from being compressed out.
|
||||
\def\cd@cr{\par\penalty10000\leavevmode} % TeX magicness
|
||||
%\def\cd@cr{\par\penalty10000\mbox{}} % LaTeX
|
||||
|
||||
|
||||
% \codeallowbreaks
|
||||
% Same as \cd@obeylines, except pagebreaks are allowed.
|
||||
% Put this command inside a code env to allow pagebreaks.
|
||||
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\codeallowbreaks{\catcode`\^^M\active\let^^M\cd@crbr}}
|
||||
|
||||
%\def\cd@crbr{\leavevmode\endgraf} % What ^M turns into.
|
||||
\def\cd@crbr{\par\leavevmode} % What ^M turns into.
|
||||
|
||||
|
||||
% \cd@obeycrsp
|
||||
% Turns cr's into non-breakable spaces. Used by \cd.
|
||||
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\cd@obeycrsp{\catcode`\^^M=\active\let^^M=\@xobeysp}}
|
||||
|
||||
% =============================================================================
|
||||
|
||||
% Set up code environment, in which most of the common special characters
|
||||
% appearing in code are treated verbatim, namely: $&#^_~%
|
||||
% \ { } are still enabled so that macros can be called in this
|
||||
% environment. Use \\, \{, and \} to use these characters verbatim
|
||||
% in this environment.
|
||||
%
|
||||
% Inside a group, you can make
|
||||
% all the hacked chars special with the \dcd command
|
||||
% $ special with the \cddollar command
|
||||
% $^_ special with the \cdmath command.
|
||||
% If you have a bunch of math $..$'s in your code env, then a global \cddollar
|
||||
% or \cdmath at the beginning of the env can save a lot of trouble.
|
||||
% When chars are special (e.g., after a \dcd), you can still get #$%&_{} with
|
||||
% \#, \$, \%, \&, \_, \{, and \} -- this is standard LaTeX.
|
||||
% Additionally, \\ gives \ inside the code env, and when \cdmath
|
||||
% makes ^ special, it also defines \^ to give ^.
|
||||
|
||||
%The hacked characters can be made special again
|
||||
% within a group by using the \dcd command.
|
||||
|
||||
% Note: this environment allows no breaking of lines whatsoever; not
|
||||
% at spaces or hypens. To arrange for a break use the standard \- command,
|
||||
% or a \discretionary{}{}{} which breaks, but inserts nothing. This is useful,
|
||||
% for example for allowing hypenated identifiers to be broken, e.g.
|
||||
% \def\={\discretionary{}{}{}} %optional break
|
||||
% FOO-\=BAR.
|
||||
|
||||
\def\setupcode{\parsep=0pt\parindent=0pt%
|
||||
\normalfont\ttfamily\frenchspacing\catcode``=13\@noligs%
|
||||
\def\\{\char`\\}%
|
||||
\let\dcd=\cd@dcd\let\cddollar=\cd@dollarspecial\let\cdmath=\cd@mathspecial%
|
||||
\@makeother\$\@makeother\&\@makeother\#%
|
||||
\@makeother\^\@makeother\_\@makeother\~%
|
||||
\@makeother\%\cd@obeytabs\cd@obeyspaces}
|
||||
% other: $&#^_~%
|
||||
% left special: \{}
|
||||
% unnecessary: @`'"
|
||||
|
||||
|
||||
%% codebox, centercode
|
||||
%%=============================================================================
|
||||
%% The codebox env makes a box exactly as wide as it needs to be
|
||||
%% (i.e., as wide as the longest line of code is). This is useful
|
||||
%% if you want to center a chunk of code, or flush it right, or
|
||||
%% something like that. The optional argument to the environment,
|
||||
%% [t], [c], or [b], specifies how to vertically align the codebox,
|
||||
%% just as with arrays or other boxes. Default is [c].
|
||||
|
||||
%% Must be a newline immediately after "\begin{codebox}[t]"!
|
||||
|
||||
{\catcode`\^^M=\active % these lines must end with %
|
||||
\gdef\cd@obeycr{\catcode`\^^M=\active\let^^M=\cr}}
|
||||
|
||||
% If there is a [<letter>] option, then the following newline will
|
||||
% be read *after* ^M is bound to \cr, so we're cool. If there isn't
|
||||
% an option given (i.e., default to [c]), then the @\ifnextchar will
|
||||
% gobble up the newline as it gobbles whitespace. So we insert the
|
||||
% \cr explicitly. Isn't TeX fun?
|
||||
\def\codebox{\leavevmode\@ifnextchar[{\@codebox}{\@codebox[c]\cr}} %]
|
||||
|
||||
\def\@codebox[#1]%
|
||||
{\hbox\bgroup$\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi\bgroup%
|
||||
\tabskip\z@\setupcode\cd@obeycr% just before cd@obey
|
||||
\halign\bgroup##\hfil\span}
|
||||
|
||||
\def\endcodebox{\crcr\egroup\egroup\m@th$\egroup}
|
||||
|
||||
% Center the box on the page:
|
||||
\newenvironment{centercode}%
|
||||
{\begin{center}\begin{codebox}[c]}%
|
||||
{\end{codebox}\end{center}}
|
||||
|
||||
|
||||
%% code, codeaux, tightcode
|
||||
%%=============================================================================
|
||||
%% Code environment as described above. Lines are kept on one page.
|
||||
%% This actually works by setting a huge penalty for breaking
|
||||
%% between lines of code. Code is indented same as other displayed paras.
|
||||
%% Note: to increase left margin, use \begin{codeaux}{\leftmargin=1in}.
|
||||
|
||||
% To allow pagebreaks, say \codeallowbreaks immediately inside the env.
|
||||
% You can allow breaks at specific lines with a \pagebreak form.
|
||||
|
||||
%% N.B.: The \global\@ignoretrue command must be performed just inside
|
||||
%% the *last* \end{...} before the following text. If not, you will
|
||||
%% get an extra space on the following line. Blech.
|
||||
|
||||
%% This environment takes two arguments.
|
||||
%% The second, required argument is the \list parameters to override the
|
||||
%% \@listi... defaults.
|
||||
%% - Usefully set by clients: \topsep \leftmargin
|
||||
%% - Possible, but less useful: \partopsep
|
||||
%% The first, optional argument is the extra \parskip glue that you get around
|
||||
%% \list environments. It defaults to the value of \parskip.
|
||||
\def\codeaux{\@ifnextchar[{\@codeaux}{\@codeaux[\parskip]}} %]
|
||||
\def\@codeaux[#1]#2{%
|
||||
\bgroup\parskip#1%
|
||||
\begin{list}{}%
|
||||
{\parsep\z@\rightskip\z@\listparindent\z@\itemindent\z@#2}%
|
||||
\item[]\setupcode\cd@obeylines}%
|
||||
\def\endcodeaux{\end{list}\leavevmode\egroup\ignorespaces\global\@ignoretrue}
|
||||
|
||||
%% Code env is codeaux with the default margin and spacing \list params:
|
||||
\def\code{\codeaux{}} \let\endcode=\endcodeaux
|
||||
|
||||
%% Like code, but with no extra vertical space above and below.
|
||||
\def\tightcode{\codeaux[=0pt]{\topsep\z@}}%
|
||||
\let\endtightcode\endcodeaux
|
||||
% {\vspace{-1\parskip}\begin{codeaux}{\partopsep\z@\topsep\z@}}%
|
||||
% {\end{codeaux}\vspace{-1\parskip}}
|
||||
|
||||
|
||||
|
||||
% Reasonable separation between lines of code
|
||||
\newcommand{\codeskip}{\penalty0\vspace{2ex}}
|
||||
|
||||
|
||||
% \cd is used to build a code environment in the middle of text.
|
||||
% Note: only difference from display code is that cr's are taken
|
||||
% as unbreakable spaces instead of linebreaks.
|
||||
|
||||
\def\cd{\leavevmode\begingroup\ifmmode\let\startcode=\startmcode\else%
|
||||
\let\startcode\starttcode\fi%
|
||||
\setupcode\cd@obeycrsp\startcode}
|
||||
|
||||
\def\starttcode#1{#1\endgroup}
|
||||
\def\startmcode#1{\hbox{#1}\endgroup}
|
||||
|
||||
|
||||
% Restore $&#^_~% to their normal catcodes
|
||||
% Define \^ to give the ^ char.
|
||||
% \dcd points to this guy inside a code env.
|
||||
\def\cd@dcd{\catcode`\$=3\catcode`\&=4\catcode`\#=6\catcode`\^=7%
|
||||
\catcode`\_=8\catcode`\~=13\catcode`\%=14\def\^{\char`\^}}
|
||||
|
||||
% Selectively enable $, and $^_ as special.
|
||||
% \cd@mathspecial also defines \^ give the ^ char.
|
||||
% \cddollar and \cdmath point to these guys inside a code env.
|
||||
\def\cd@dollarspecial{\catcode`\$=3}
|
||||
\def\cd@mathspecial{\catcode`\$=3\catcode`\^=7\catcode`\_=8%
|
||||
\def\^{\char`\^}}
|
||||
|
||||
|
||||
% Change log:
|
||||
% Started off as some macros found in C. Rich's library.
|
||||
% Olin 1/90:
|
||||
% Removed \makeatletter, \makeatother's -- they shouldn't be there,
|
||||
% because style option files are read with makeatletter. The terminal
|
||||
% makeatother screwed things up for the following style options.
|
||||
% Olin 3/91:
|
||||
% Rewritten.
|
||||
% - Changed things so blank lines don't get compressed out (the \leavevmove
|
||||
% in \cd@cr and \cd@crwb).
|
||||
% - Changed names to somewhat less horrible choices.
|
||||
% - Added lots of doc, so casual hackers can more easily mess with all this.
|
||||
% - Removed `'"@ from the set of hacked chars, since they are already
|
||||
% non-special.
|
||||
% - Removed the bigcode env, which effect can be had with the \codeallowbreaks
|
||||
% command.
|
||||
% - Removed the \@noligs command, since it's already defined in latex.tex.
|
||||
% - Win big with the new \dcd, \cddollar, and \cdmath commands.
|
||||
% - Now, *only* the chars \{} are special inside the code env. If you need
|
||||
% more, use the \dcd command inside a group.
|
||||
% - \cd now works inside math mode. (But if you use it in a superscript,
|
||||
% it still comes out full size. You must explicitly put a \scriptsize\tt
|
||||
% inside the \cd: $x^{\cd{\scriptsize\tt...}}$. A \leavevmode was added
|
||||
% so that if you begin a paragraph with a \cd{...}, TeX realises you
|
||||
% are starting a paragraph.
|
||||
% - Added the codebox env. Tricky bit involving the first line hacked
|
||||
% with help from David Long.
|
||||
% Olin 8/94
|
||||
% Changed the font commands for LaTeX2e.
|
|
@ -0,0 +1,6 @@
|
|||
% Loads cmtt fonts in on \tt. -*- latex -*-
|
||||
% I prefer these to the Courier fonts that latex gives you w/postscript styles.
|
||||
% Courier is too spidery and too wide -- it's hard to get 80 chars on a line.
|
||||
% -Olin
|
||||
|
||||
\renewcommand{\ttdefault}{cmtt}
|
|
@ -0,0 +1,84 @@
|
|||
% LCS note style modification of title -*- latex -*-
|
||||
%
|
||||
% To use this, you should have the companion postscript file mitlogo.ps
|
||||
% somewhere latex can find it. If you can't do it, then just say \nologo
|
||||
% and you'll get logo-less alternative.
|
||||
|
||||
% This is useful for a little paper or note you're writing that isn't
|
||||
% a T.R. or a conference submission, just a paper. Maybe an early draft.
|
||||
% Something to hand out to your friends for comments. That kind of thing.
|
||||
% An example is the three "Scheme Flow-Analysis Working Notes" I wrote
|
||||
% that later got folded into my dissertation.
|
||||
% -Olin
|
||||
|
||||
\typeout{LCS Note style option -- 12 August 1994}
|
||||
|
||||
\newcount\notenumber
|
||||
\newif\if@logo \@logotrue
|
||||
|
||||
%
|
||||
% Here are the basic parameters and their defaults
|
||||
% Note that \author, \title, and \date still work, too.
|
||||
% To get the time in the date, try \date{\Time, \today}
|
||||
%
|
||||
\def\notenum#1{\notenumber=#1}
|
||||
\def\project#1{\def\@project{#1}}
|
||||
\def\dept#1{\def\@dept{#1}}
|
||||
\def\university#1{\def\@univ{#1}}
|
||||
|
||||
\def\@project{Personal Information Architecture Project}
|
||||
\def\@dept{Laboratory for Computer Science}
|
||||
\def\@note{Note}
|
||||
% The 'tute:
|
||||
\def\@univ{\normalfont\scshape massachusetts institute of technology}
|
||||
|
||||
%
|
||||
% The following "Time" macro will return the current (24 hour) time.
|
||||
%
|
||||
\def\Time{{\count1=\time \count2=\count1 \divide\count1 by 60
|
||||
\the\count1 :\multiply \count1 by 60 \advance\count2 by -\count1
|
||||
\count1=\count2 \divide\count1 by 10 \the\count1
|
||||
\multiply \count1 by 10 \advance\count2 by -\count1 \the\count2}}
|
||||
|
||||
\def\@logofile{mitlogo.ps}
|
||||
\def\nologo{\@logofalse}
|
||||
|
||||
|
||||
\def\@maketitle{
|
||||
\newdimen\noteheadwidth
|
||||
\noteheadwidth = \textwidth
|
||||
\def\@headline##1{\hbox to\noteheadwidth{##1}}
|
||||
|
||||
\newpage
|
||||
\null
|
||||
\vskip -\topmargin \vskip -0.5in
|
||||
\vskip -\headsep
|
||||
\vskip -\headheight
|
||||
|
||||
\if@logo
|
||||
\@headline{\fontsize{11}{11}\selectfont\@univ\hfil}%
|
||||
\kern .72in
|
||||
\@headline{\fontsize{17}{17}\selectfont\special{psfile=\@logofile}
|
||||
\hskip 23mm plus 1fil
|
||||
{\@dept}
|
||||
\hskip 23mm plus 1fil minus 23mm}
|
||||
\else
|
||||
\hbox to\textwidth{\hfill {\LARGE {\bf \@univ}} \hfill}
|
||||
\vskip.5em
|
||||
\hbox to\textwidth{\hfill {\Large {\bf \@dept}} \hfill}
|
||||
\fi
|
||||
|
||||
\vskip 1.5em
|
||||
\@headline{\@project\ \@note\ \the\notenumber \hfill \@date}
|
||||
\vskip 0.5em
|
||||
\hrule width \noteheadwidth
|
||||
\bigskip
|
||||
\begin{center}
|
||||
{\LARGE \@title \par}
|
||||
\vskip .5em
|
||||
{\lineskip .5em
|
||||
{\em \begin{tabular}[t]{c} \@author \end{tabular}}
|
||||
\par}
|
||||
\vskip 1em
|
||||
\end{center}
|
||||
\par \vskip 1.5em}
|
|
@ -0,0 +1,613 @@
|
|||
%!
|
||||
/m {moveto} def % x y m -
|
||||
|
||||
/l {lineto} def % x y l -
|
||||
|
||||
/S {stroke} def % - S -
|
||||
|
||||
/s {closepath S} def % - s -
|
||||
|
||||
/c {curveto} def % x1 y1 x2 y2 x3 y3 c -
|
||||
|
||||
/v {currentpoint 6 2 roll curveto} def % x2 y2 x3 y3 v -
|
||||
|
||||
/y {2 copy curveto} def % x1 y1 x2 y2 y -
|
||||
|
||||
/j {setlinejoin} def % linejoin j -
|
||||
|
||||
/J {setlinecap} def % linecap J -
|
||||
|
||||
/w {setlinewidth} def % linewidth w -
|
||||
|
||||
/b {closepath B} def % - b -
|
||||
|
||||
/B {gsave F grestore S} def % - B -
|
||||
|
||||
/F {fill} def % - F -
|
||||
|
||||
/f {closepath F} def % - f -
|
||||
|
||||
.8125 .75 scale
|
||||
-242 -314 translate
|
||||
|
||||
0 -3.5 translate
|
||||
|
||||
%%Note:
|
||||
newpath
|
||||
272.8118 317.4634 m
|
||||
272.8118 328.6408 l
|
||||
257.9086 328.6408 l
|
||||
257.9086 317.4634 l
|
||||
272.8118 317.4634 l
|
||||
s
|
||||
265.3602 323.0521 m
|
||||
S
|
||||
271.8804 328.6408 m
|
||||
271.8804 331.8585 l
|
||||
261.6344 331.8585 l
|
||||
261.6344 328.6408 l
|
||||
271.8804 328.6408 l
|
||||
s
|
||||
266.7574 330.2496 m
|
||||
S
|
||||
263.1163 339.9452 m
|
||||
265.0215 339.9452 l
|
||||
S
|
||||
265.0215 339.9452 m
|
||||
268.7473 339.9452 l
|
||||
268.7473 336.4734 l
|
||||
256.9772 336.4734 l
|
||||
261.6344 331.8585 l
|
||||
S
|
||||
268.7473 336.4734 m
|
||||
272.8118 336.4734 l
|
||||
272.8118 331.8585 l
|
||||
271.8804 331.8585 l
|
||||
S
|
||||
257.9086 317.4634 m
|
||||
245.8421 317.4634 l
|
||||
251.4732 322.798 l
|
||||
251.4732 335.2456 l
|
||||
257.9086 335.2456 l
|
||||
257.9086 328.6408 l
|
||||
S
|
||||
251.4732 322.798 m
|
||||
251.4732 322.798 l
|
||||
256.3421 319.1569 l
|
||||
S
|
||||
265.0215 341.9351 m
|
||||
265.5719 341.9774 l
|
||||
266.08 342.0407 l
|
||||
266.609 342.1891 l
|
||||
267.0538 342.2948 l
|
||||
267.5195 342.4855 l
|
||||
268.5356 343.0992 l
|
||||
269.488 343.8613 l
|
||||
269.7421 344.1153 l
|
||||
269.9114 344.3694 l
|
||||
269.9538 344.7081 l
|
||||
269.9538 357.7483 l
|
||||
S
|
||||
265.0215 356.2032 m
|
||||
265.0215 339.9452 l
|
||||
S
|
||||
263.1163 339.9452 m
|
||||
260.0256 339.9452 l
|
||||
257.7816 338.8444 l
|
||||
260.3219 336.4734 l
|
||||
S
|
||||
260.3219 336.4734 m
|
||||
S
|
||||
263.1163 355.187 m
|
||||
263.1305 339.9452 l
|
||||
263.1305 341.9879 l
|
||||
262.5801 342.0313 l
|
||||
262.0724 342.0956 l
|
||||
261.5433 342.245 l
|
||||
261.0989 342.3517 l
|
||||
260.6335 342.543 l
|
||||
259.6188 343.1588 l
|
||||
258.6677 343.9229 l
|
||||
258.414 344.1773 l
|
||||
258.245 344.4317 l
|
||||
258.2033 344.7704 l
|
||||
258.205 358.5741 l
|
||||
270.3985 366.2797 l
|
||||
273.5316 367.4229 274.7763 365.4245 274.9287 365.2213 c
|
||||
275.1828 364.8826 278.4184 359.9652 272.9388 357.6427 c
|
||||
266.588 357.6427 l
|
||||
265.4026 355.9068 260.6183 353.8322 258.205 354.1286 c
|
||||
S
|
||||
258.205 350.1274 m
|
||||
S
|
||||
252.8703 317.421 m
|
||||
253.7594 318.2678 l
|
||||
254.7332 317.421 l
|
||||
S
|
||||
251.4732 335.2456 m
|
||||
249.1445 335.2456 l
|
||||
254.4369 357.9814 l
|
||||
S
|
||||
257.9086 328.9371 m
|
||||
257.8663 327.4129 256.4691 317.8021 255.2836 317.4634 c
|
||||
255.707 317.4634 l
|
||||
S
|
||||
274.8441 358.4894 m
|
||||
272.8118 336.4734 l
|
||||
272.8118 357.7274 l
|
||||
S
|
||||
267.0538 364.2052 m
|
||||
267.0538 368.9471 l
|
||||
265.8683 371.445 262.9469 371.4027 261.8885 369.9632 c
|
||||
261.1816 369.0019 260.4066 368.0579 260.3643 366.2797 c
|
||||
260.3148 364.2055 260.0466 364.2261 261.8461 362.4269 c
|
||||
263.0316 362.1305 l
|
||||
263.2433 362.0882 263.7514 362.2576 v
|
||||
264.2594 362.4269 264.7675 362.7233 y
|
||||
S
|
||||
263.0316 362.1305 m
|
||||
S
|
||||
258.205 358.5741 m
|
||||
257.5022 358.1057 256.4942 357.871 254.4369 357.9814 c
|
||||
248.5095 361.4108 254.3099 365.8987 v
|
||||
255.1143 366.2797 255.7917 366.2374 v
|
||||
260.3643 366.2374 l
|
||||
S
|
||||
1 J 1 j
|
||||
254.4369 357.9814 m
|
||||
252.0236 359.8443 250.7534 361.3261 250.076 363.9088 c
|
||||
249.3986 366.4914 248.7212 370.7676 250.7534 373.9007 c
|
||||
253.8587 378.6883 257.6607 378.7801 258.1837 378.9813 c
|
||||
258.1627 366.2797 l
|
||||
S
|
||||
0 j
|
||||
258.1837 378.9813 m
|
||||
262.8622 378.9813 l
|
||||
262.8622 377.0337 l
|
||||
S
|
||||
0 J
|
||||
262.7776 373.2233 m
|
||||
261.8038 373.562 260.7453 373.816 259.8562 374.9591 c
|
||||
260.6816 382.8341 l
|
||||
259.0304 382.8341 l
|
||||
260.4913 389.3966 l
|
||||
261.4227 390.0317 264.9368 391.3442 267.5618 390.1163 c
|
||||
269.34 389.0579 269.5941 386.6022 v
|
||||
269.8481 384.1466 268.959 380.7595 269.5517 380.0398 c
|
||||
270.1445 379.32 271.9227 379.32 273.3622 379.0236 c
|
||||
274.8017 378.7273 276.1989 377.3724 276.7916 376.7374 c
|
||||
277.3844 376.1023 280.6868 371.6991 279.84 366.068 c
|
||||
278.9932 360.437 275.0557 359.2515 274.8441 358.8282 c
|
||||
S
|
||||
262.9893 370.7676 m
|
||||
262.9893 375.1285 l
|
||||
265.1062 375.1285 l
|
||||
265.1062 370.7253 l
|
||||
S
|
||||
260.2796 378.4732 m
|
||||
260.576 377.6265 262.3118 376.9067 262.7776 376.7797 c
|
||||
263.2433 376.6527 263.7933 376.5714 264.7675 376.6527 c
|
||||
265.7836 376.7374 266.3049 377.0141 266.5457 377.2878 c
|
||||
267.4771 378.3462 267.0961 378.9813 267.1808 379.32 c
|
||||
267.9005 379.447 l
|
||||
267.9005 374.3664 l
|
||||
267.5195 374.1124 266.3763 373.3079 265.0638 373.2233 c
|
||||
S
|
||||
0.6774 w
|
||||
260.0256 387.2797 m
|
||||
260.8723 387.3643 261.4651 387.322 261.9731 387.0256 c
|
||||
S
|
||||
260.6606 387.2797 m
|
||||
S
|
||||
0.3387 w
|
||||
261.1897 386.377 m
|
||||
261.3055 386.377 261.3993 386.5917 261.3993 386.8563 c
|
||||
261.3993 387.1208 261.3055 387.3352 261.1897 387.3352 c
|
||||
261.0738 387.3352 260.98 387.1208 260.98 386.8563 c
|
||||
260.98 386.5917 261.0738 386.377 261.1897 386.377 c
|
||||
b
|
||||
261.1897 386.8563 m
|
||||
B
|
||||
0.6774 w
|
||||
260.4913 389.3966 m
|
||||
262.3118 389.5659 262.7352 388.7615 263.1163 388.4651 c
|
||||
263.4973 388.1688 263.963 388.0418 264.1747 386.4329 c
|
||||
264.2594 381.4579 l
|
||||
264.5558 380.3995 264.8945 380.1031 265.0215 380.0608 c
|
||||
265.8104 379.7976 266.0376 379.574 267.6042 379.4894 c
|
||||
269.9751 379.4894 l
|
||||
269.9751 365.9834 l
|
||||
S
|
||||
263.2856 388.3381 m
|
||||
264.3864 388.4651 265.4449 388.4228 266.461 388.2958 c
|
||||
267.4771 388.1688 268.832 387.4914 269.3824 387.1103 c
|
||||
S
|
||||
262.8622 390.2857 m
|
||||
264.3441 390.1163 264.5134 389.1426 264.8098 388.7192 c
|
||||
265.1062 388.2958 265.4872 387.576 265.4872 387.195 c
|
||||
265.4872 381.7333 l
|
||||
265.9953 380.3148 266.207 380.6325 266.5034 380.3785 c
|
||||
266.7997 380.1244 269.4247 379.574 269.9751 379.4894 c
|
||||
S
|
||||
264.6828 390.5821 m
|
||||
265.9106 390.4551 266.1647 389.4813 266.4187 389.2272 c
|
||||
266.6727 388.9732 266.8844 387.576 266.9267 387.1526 c
|
||||
266.9267 382.9611 l
|
||||
266.8844 380.5902 267.6465 380.4632 268.1969 380.2091 c
|
||||
269.0078 379.8348 269.7604 379.5131 269.9751 379.4894 c
|
||||
S
|
||||
267.1808 390.2434 m
|
||||
267.9852 389.3119 268.1969 388.7192 268.1969 388.5075 c
|
||||
268.1969 388.2958 268.2392 386.8986 y
|
||||
268.2392 383.2152 l
|
||||
267.8159 379.9974 269.297 379.9209 269.9114 379.6374 c
|
||||
S
|
||||
267.6042 379.4894 m
|
||||
269.6364 379.4894 l
|
||||
S
|
||||
269.9751 365.9834 m
|
||||
S
|
||||
267.9429 379.4894 m
|
||||
269.9751 379.4894 l
|
||||
S
|
||||
270.3138 365.9834 m
|
||||
S
|
||||
1 J
|
||||
267.0538 367.8886 m
|
||||
266.08 368.3543 265.5719 368.82 264.1747 368.7777 c
|
||||
S
|
||||
267.0538 364.7342 m
|
||||
266.295 365.097 265.2437 365.6558 264.1747 365.6233 c
|
||||
S
|
||||
267.0114 366.2584 m
|
||||
266.2527 366.6212 265.2014 367.18 264.1324 367.1475 c
|
||||
S
|
||||
266.168 363.6575 m
|
||||
265.4097 364.0202 265.1167 364.2163 264.0477 364.1838 c
|
||||
S
|
||||
258.205 357.1346 m
|
||||
262.7352 359.5056 l
|
||||
S
|
||||
258.205 356.1185 m
|
||||
262.7776 357.939 l
|
||||
S
|
||||
258.205 354.9753 m
|
||||
262.8622 356.5842 l
|
||||
S
|
||||
0 J 0.3387 w
|
||||
252.9974 376.568 m
|
||||
252.8703 373.3503 257.1889 370.7676 258.1627 374.6204 c
|
||||
S
|
||||
252.6163 376.2293 m
|
||||
252.574 372.6305 253.4207 368.2273 258.1203 369.6245 c
|
||||
S
|
||||
251.0498 374.197 m
|
||||
250.7957 370.3019 253.124 366.4108 258.1627 366.9148 c
|
||||
S
|
||||
249.6103 366.0257 m
|
||||
249.8609 366.1354 251.7584 367.4821 256.2998 366.9148 c
|
||||
S
|
||||
270.0175 378.1769 m
|
||||
270.9066 375.3825 274.5477 372.5035 276.7916 376.7374 c
|
||||
S
|
||||
277.469 375.7636 m
|
||||
277.5496 372.1692 275.9486 368.378 270.0598 368.9047 c
|
||||
S
|
||||
279.967 367.9309 m
|
||||
278.1041 369.4551 275.9449 369.4975 273.8703 369.2858 c
|
||||
S
|
||||
278.8239 362.808 m
|
||||
278.1464 366.1527 276.5376 368.2696 273.4045 369.1588 c
|
||||
S
|
||||
1.0161 w
|
||||
292.5839 335.7113 m
|
||||
298.0879 335.7113 l
|
||||
295.717 330.2073 294.9549 323.4331 301.8137 317.6751 c
|
||||
294.2774 317.6751 l
|
||||
292.0758 323.0944 291.4831 327.4976 292.5839 335.7113 c
|
||||
s
|
||||
1 J 1 j
|
||||
297.6645 322.9251 m
|
||||
293.6 319.3686 l
|
||||
S
|
||||
0 J 0 j
|
||||
295.6533 317.6751 m
|
||||
296.4367 318.3735 l
|
||||
297.2835 317.6327 l
|
||||
S
|
||||
305.7089 335.7113 m
|
||||
311.2129 335.7113 l
|
||||
308.8419 330.2073 308.0798 323.4331 314.9387 317.6751 c
|
||||
307.4024 317.6751 l
|
||||
305.2008 323.0944 304.6081 327.4976 305.7089 335.7113 c
|
||||
s
|
||||
1 J 1 j
|
||||
310.7895 322.9251 m
|
||||
306.725 319.3686 l
|
||||
S
|
||||
0 J 0 j
|
||||
308.7782 317.6751 m
|
||||
309.5617 318.3735 l
|
||||
310.4084 317.6327 l
|
||||
S
|
||||
301.0093 317.6751 m
|
||||
307.8258 317.6751 l
|
||||
S
|
||||
300.7976 359.5902 m
|
||||
300.7552 339.0137 l
|
||||
300.7552 337.0888 300.0494 336.3518 298.0879 335.7113 c
|
||||
290.0436 335.7113 l
|
||||
288.9004 357.2193 l
|
||||
S
|
||||
2 J
|
||||
289.9166 337.7012 m
|
||||
296.6907 337.7012 l
|
||||
299.0194 338.294 298.723 339.8181 298.7653 340.1568 c
|
||||
298.7653 365.687 l
|
||||
302.7452 365.687 l
|
||||
290.2976 365.687 l
|
||||
302.7452 365.687 l
|
||||
302.7452 365.687 l
|
||||
302.7452 365.687 l
|
||||
302.7452 365.687 l
|
||||
302.7452 365.687 l
|
||||
S
|
||||
0 J
|
||||
311.2129 335.7113 m
|
||||
S
|
||||
305.7089 335.7113 m
|
||||
S
|
||||
303.9306 362.0459 m
|
||||
S
|
||||
1 J 2 j
|
||||
304.6081 361.8765 m
|
||||
304.6236 338.947 l
|
||||
304.561 337.0231 304.8909 336.5632 306.8307 335.8593 c
|
||||
311.5726 335.8593 l
|
||||
306.3863 361.9189 l
|
||||
S
|
||||
0 J 0 j
|
||||
299.2311 336.177 m
|
||||
305.6242 336.177 l
|
||||
300.6706 336.177 l
|
||||
S
|
||||
300.6706 338.1246 m
|
||||
304.6081 338.1246 l
|
||||
S
|
||||
304.6081 338.5056 m
|
||||
300.7129 343.7133 l
|
||||
S
|
||||
310.7895 337.6165 m
|
||||
307.6988 337.6165 l
|
||||
306.5556 338.0399 306.8097 338.675 306.725 339.4794 c
|
||||
306.725 360.0983 l
|
||||
S
|
||||
302.7452 374.07 m
|
||||
302.7452 360.9451 l
|
||||
298.9347 358.4894 l
|
||||
S
|
||||
302.7452 362.3846 m
|
||||
322.8983 362.3846 l
|
||||
S
|
||||
314.0072 362.3846 m
|
||||
314.0072 374.07 l
|
||||
302.7452 374.07 l
|
||||
302.7452 362.3846 l
|
||||
314.0072 362.3846 l
|
||||
s
|
||||
308.3762 368.2273 m
|
||||
S
|
||||
316.1241 362.3846 m
|
||||
316.1241 360.8604 l
|
||||
311.975 358.5741 l
|
||||
311.975 362.3846 l
|
||||
311.975 359.7596 l
|
||||
307.3177 357.0499 l
|
||||
S
|
||||
302.8298 378.6426 m
|
||||
300.0355 365.687 l
|
||||
300.0355 382.1144 l
|
||||
301.221 382.1144 l
|
||||
300.7976 385.1204 l
|
||||
300.7976 385.1204 l
|
||||
S
|
||||
304.5234 378.2192 m
|
||||
303.5073 374.07 l
|
||||
S
|
||||
298.6807 359.4209 m
|
||||
296.4791 356.7112 288.2654 357.3886 287.2492 358.1507 c
|
||||
286.2331 358.9128 281.7452 360.9451 282.4226 367.6346 c
|
||||
283.0628 373.9562 285.0283 375.5102 291.3137 378.3039 c
|
||||
S
|
||||
294.3621 379.4047 m
|
||||
300.0355 365.687 l
|
||||
S
|
||||
300.6706 385.1627 m
|
||||
302.1948 385.1627 303.0415 386.0095 303.3379 386.6869 c
|
||||
303.6343 387.3643 303.5073 387.7877 303.3379 388.2111 c
|
||||
303.1685 388.6345 302.5758 389.3542 301.8984 389.5236 c
|
||||
301.221 389.693 300.9246 389.7353 300.4165 389.7353 c
|
||||
289.7896 389.7353 l
|
||||
286.5295 389.7353 286.2331 383.4692 289.5779 383.4692 c
|
||||
290.3823 383.4692 290.594 383.4692 v
|
||||
290.8057 383.4692 291.7371 383.7656 y
|
||||
S
|
||||
287.0799 376.1446 m
|
||||
288.9004 377.6265 289.9166 377.8382 290.848 378.939 c
|
||||
291.7795 380.0398 291.7371 380.6748 291.7795 381.5216 c
|
||||
291.8218 382.3684 291.7795 384.697 291.7795 385.0781 c
|
||||
291.7795 385.4591 291.7795 385.8825 y
|
||||
S
|
||||
1 J 0.6774 w
|
||||
289.9589 377.9228 m
|
||||
291.1444 378.4732 292.7109 379.1083 293.6 379.4047 c
|
||||
294.4891 379.7011 294.7855 379.7857 295.3359 379.9974 c
|
||||
295.8863 380.2091 296.6061 380.8019 296.7331 381.0982 c
|
||||
296.8601 381.3946 297.1697 383.0468 297.2411 384.6123 c
|
||||
297.2835 385.5438 297.1565 385.8401 y
|
||||
S
|
||||
0 J 1.0161 w
|
||||
300.0355 379.2777 m
|
||||
301.094 379.2777 307.0637 378.4309 308.7996 374.0277 c
|
||||
S
|
||||
0.6774 w
|
||||
295.844 385.8825 m
|
||||
295.844 384.443 295.8016 381.2252 295.5899 380.6748 c
|
||||
295.3783 380.1244 294.0234 379.7434 293.219 379.3623 c
|
||||
292.4145 378.9813 290.7633 378.2615 290.4246 378.1345 c
|
||||
S
|
||||
294.5315 385.8401 m
|
||||
294.5315 384.951 294.5315 381.1829 294.4468 380.8019 c
|
||||
294.3621 380.4208 293.7694 379.6587 293.219 379.3623 c
|
||||
S
|
||||
293.1343 385.8401 m
|
||||
293.1343 384.8664 293.1766 380.7595 293.0496 380.2938 c
|
||||
292.9226 379.8281 292.5416 379.2777 291.9488 378.9813 c
|
||||
291.3561 378.6849 290.2976 378.0922 y
|
||||
S
|
||||
1 J
|
||||
299.4428 377.4571 m
|
||||
298.7653 378.1769 298.723 379.1083 299.1887 380.6325 c
|
||||
299.4004 381.3733 l
|
||||
S
|
||||
0 J
|
||||
298.1303 380.8442 m
|
||||
S
|
||||
296.7754 381.3523 m
|
||||
296.5214 381.1829 296.3944 380.2938 v
|
||||
296.2674 379.4047 296.0557 379.1083 296.352 378.3886 c
|
||||
296.6484 377.6688 296.9024 377.2031 297.4528 377.0337 c
|
||||
298.0032 376.8644 298.1303 376.7374 298.85 376.8644 c
|
||||
299.5698 376.9914 299.9932 377.4571 y
|
||||
S
|
||||
1 J
|
||||
298.85 376.8644 m
|
||||
298.1726 377.4148 l
|
||||
297.4952 378.1345 297.4528 379.066 297.9186 380.5902 c
|
||||
297.9186 380.5902 l
|
||||
S
|
||||
300.5859 387.1526 m
|
||||
300.7552 385.8825 l
|
||||
291.6525 385.8825 l
|
||||
291.6101 387.1526 l
|
||||
300.5859 387.1526 l
|
||||
s
|
||||
296.0343 386.5386 m
|
||||
S
|
||||
1.0161 w
|
||||
300.8399 384.697 m
|
||||
300.6282 385.7978 l
|
||||
S
|
||||
0.6774 w
|
||||
291.6101 386.0518 m
|
||||
291.0174 385.4168 l
|
||||
290.6363 385.1204 l
|
||||
290.2976 384.951 l
|
||||
S
|
||||
291.6525 387.0256 m
|
||||
291.3137 387.195 l
|
||||
290.9327 387.5337 l
|
||||
290.5093 387.9994 l
|
||||
S
|
||||
299.6968 387.1526 m
|
||||
300.2048 387.1526 l
|
||||
300.5859 387.1526 l
|
||||
300.4589 387.9571 l
|
||||
S
|
||||
0.3387 w
|
||||
314.0072 373.816 m
|
||||
316.9709 373.816 l
|
||||
314.0072 362.3846 l
|
||||
316.7169 372.8422 l
|
||||
319.4266 372.8422 l
|
||||
314.0072 362.3846 l
|
||||
318.7068 371.4027 l
|
||||
321.2048 371.4027 l
|
||||
314.0072 362.3846 l
|
||||
319.8923 369.7092 l
|
||||
322.0092 369.7092 l
|
||||
314.0072 362.3846 l
|
||||
322.7713 367.5499 l
|
||||
319.7653 367.5499 l
|
||||
314.0072 362.3846 l
|
||||
319.2149 365.433 l
|
||||
322.856 365.433 l
|
||||
314.1766 362.4693 l
|
||||
S
|
||||
302.7028 367.2112 m
|
||||
308.5455 367.2112 l
|
||||
308.3338 366.3644 l
|
||||
311.7633 366.3644 l
|
||||
311.7633 362.4269 l
|
||||
S
|
||||
311.7419 365.433 m
|
||||
307.3811 365.433 l
|
||||
S
|
||||
311.7633 364.5015 m
|
||||
307.4447 364.5015 l
|
||||
S
|
||||
311.7419 363.5911 m
|
||||
307.3811 363.5911 l
|
||||
S
|
||||
308.3338 366.3644 m
|
||||
305.3278 366.3644 l
|
||||
S
|
||||
285.7674 375.2132 m
|
||||
285.8944 373.1386 286.6565 371.7837 290.2976 371.8684 c
|
||||
S
|
||||
2 J 1.0161 w
|
||||
290.2976 365.687 m
|
||||
290.2976 376.2716 l
|
||||
297.7492 365.687 l
|
||||
300.0355 365.687 l
|
||||
291.3137 378.3039 l
|
||||
S
|
||||
0.3387 w
|
||||
290.5517 365.56 m
|
||||
288.3924 364.7979 282.592 365.1789 283.3964 371.9531 c
|
||||
S
|
||||
290.1706 365.6023 m
|
||||
288.9851 363.2737 286.1908 360.7334 282.719 364.1205 c
|
||||
S
|
||||
290.2553 365.2636 m
|
||||
290.0436 362.5963 289.3238 359.8443 287.1222 358.6588 c
|
||||
S
|
||||
291.2291 374.8321 m
|
||||
292.1605 373.3079 293.3037 367.9309 292.7956 365.7293 c
|
||||
S
|
||||
291.9912 365.56 m
|
||||
292.6686 363.7394 293.2613 359.6749 291.9912 357.5157 c
|
||||
S
|
||||
293.8541 365.6023 m
|
||||
297.1002 355.1677 291.077 348.8786 289.4508 347.8625 c
|
||||
S
|
||||
295.717 365.6023 m
|
||||
298.8226 356.2851 296.7744 339.7077 295.6746 337.7435 c
|
||||
S
|
||||
0.6774 w
|
||||
299.7815 385.3321 m
|
||||
299.3533 385.4445 299.1792 385.4733 298.8287 385.3954 c
|
||||
S
|
||||
299.5061 384.6333 m
|
||||
299.6466 384.6333 299.7605 384.8074 299.7605 385.0225 c
|
||||
299.7605 385.2376 299.6466 385.4117 299.5061 385.4117 c
|
||||
299.3655 385.4117 299.2517 385.2376 299.2517 385.0225 c
|
||||
299.2517 384.8074 299.3655 384.6333 299.5061 384.6333 c
|
||||
f
|
||||
299.5061 385.0225 m
|
||||
F
|
||||
0 J 2 j 0.3387 w
|
||||
304.4387 367.2112 m
|
||||
303.6129 367.2112 l
|
||||
302.7452 366.1951 l
|
||||
302.9779 366.9781 l
|
||||
S
|
||||
1 J 0.6774 w
|
||||
302.7452 363.3584 m
|
||||
303.7823 362.4056 l
|
||||
S
|
||||
297.9186 380.5902 m
|
||||
298.2359 381.3733 l
|
||||
S
|
||||
|
||||
%showpage
|
68
dynload.c
68
dynload.c
|
@ -5,7 +5,7 @@
|
|||
#include "sysdep.h"
|
||||
#include "scheme48.h"
|
||||
|
||||
/*
|
||||
/*
|
||||
Hey folks, please help us out with conditions under which the
|
||||
ANCIENT_DYNLOAD and/or HAVE_DLOPEN code might work. About all we
|
||||
know is that ANCIENT_DYNLOAD worked once upon a time on the DEC
|
||||
|
@ -29,24 +29,24 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __NetBSD__
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__)
|
||||
#include <nlist.h>
|
||||
#include <link.h>
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBGEN_H
|
||||
#if defined(HAVE_LIBGEN) && defined(HAVE_LIBGEN_H)
|
||||
#include <libgen.h>
|
||||
/* if we have pathfind, get the file name with $LD_LIBRARY_PATH or $S48_EXTERN_PATH */
|
||||
static char *shared_object_name(char *name)
|
||||
{
|
||||
char *res=0;
|
||||
res = pathfind(getenv("LD_LIBRARY_PATH"), name, "r");
|
||||
if (res)
|
||||
if (res)
|
||||
return res;
|
||||
res = pathfind(getenv("S48_EXTERN_PATH"), name, "r");
|
||||
if (res)
|
||||
if (res)
|
||||
return res;
|
||||
return name;
|
||||
} /* end of shared_object_name */
|
||||
|
@ -64,7 +64,7 @@ static char *shared_object_name(char *name)
|
|||
/* SunoS5 & SVR4 define RTLD_NOW */
|
||||
#ifdef RTLD_NOW
|
||||
#define S48_DLOPEN_MODE RTLD_NOW
|
||||
#else
|
||||
#else
|
||||
/* SunOS4 just says that mode should be 1 ie RTLD_LAZY */
|
||||
#define S48_DLOPEN_MODE 1
|
||||
#endif /*RTLD_NOW*/
|
||||
|
@ -96,7 +96,7 @@ dynamic_load(char*sharedobjname)
|
|||
return -1;
|
||||
};
|
||||
newhandle=dlopen(pathname, S48_DLOPEN_MODE);
|
||||
#if defined(__NetBSD__)
|
||||
#if defined(__NetBSD__) || defined(__FreeBSD__)
|
||||
if (newhandle == -1) {
|
||||
fprintf(stderr, " dynamic_load of %s can't dlopen %s",
|
||||
sharedobjname, pathname);
|
||||
|
@ -112,7 +112,7 @@ dynamic_load(char*sharedobjname)
|
|||
dlopened_handle[rank] = newhandle;
|
||||
#ifdef DLDEBUG
|
||||
printf(" %s:%d %s sharedobjname='%s' pathname='%s' handle %#x rank=%d \n",
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
sharedobjname, pathname, newhandle, rank);
|
||||
#endif /*DLDEBUG*/
|
||||
return 0;
|
||||
|
@ -125,6 +125,25 @@ lookup_dlsym(char *name, long *location)
|
|||
void *adr;
|
||||
static void *selfhandle;
|
||||
int rank;
|
||||
|
||||
#if defined(USCORE) && defined(DLSYM_ADDS_USCORE)
|
||||
name++;
|
||||
#endif
|
||||
|
||||
/* find the name in the self process image - ie original scheme48
|
||||
executable file */
|
||||
if (!selfhandle)
|
||||
selfhandle=dlopen((char*)0, S48_DLOPEN_MODE);
|
||||
if (adr=dlsym(selfhandle, name)) {
|
||||
*location = (long) adr;
|
||||
#ifdef DLDEBUG
|
||||
printf(" %s:%d %s name='%s' in self at adr=%#x\n",
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
name, (long) adr);
|
||||
#endif /*DLDEBUG*/
|
||||
return 1;
|
||||
};
|
||||
|
||||
/* perhaps i should scan the dlopened_handle from last to first,
|
||||
to find newest incarnation of symbol? in practice it should be faster
|
||||
to go from first (oldest) to last,
|
||||
|
@ -135,28 +154,15 @@ lookup_dlsym(char *name, long *location)
|
|||
*location = (long) adr;
|
||||
#ifdef DLDEBUG
|
||||
printf(" %s:%d %s name='%s' in rank=%d at adr=%#x\n",
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
name, rank, (long) adr);
|
||||
#endif /*DLDEBUG*/
|
||||
return 1;
|
||||
};
|
||||
/* find the name in the self process image - ie original scheme48
|
||||
executable file */
|
||||
if (!selfhandle)
|
||||
selfhandle=dlopen((char*)0, S48_DLOPEN_MODE);
|
||||
if (adr=dlsym(selfhandle, name)) {
|
||||
*location = (long) adr;
|
||||
#ifdef DLDEBUG
|
||||
printf(" %s:%d %s name='%s' in self at adr=%#x\n",
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
name, (long) adr);
|
||||
#endif /*DLDEBUG*/
|
||||
return 1;
|
||||
};
|
||||
/* can't find name so return 0 */
|
||||
#ifdef DLDEBUG
|
||||
printf(" %s:%d %s name='%s' not found\n",
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
__FILE__, __LINE__, __FUNCTION__,
|
||||
name);
|
||||
#endif /*DLDEBUG*/
|
||||
return 0;
|
||||
|
@ -194,7 +200,7 @@ struct exec { /* an exec-like structure for the MIPS */
|
|||
#define TEXT_OFFSET(output_file_header) \
|
||||
(long) N_TXTOFF(output_file_header)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
extern char *object_file; /* specified via a command line argument */
|
||||
|
@ -217,9 +223,9 @@ dynamic_load( char *user_args )
|
|||
fprintf(stderr, "aborting dynamic load\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
new_reloc_file = (char *) malloc(L_tmpnam);
|
||||
|
||||
|
||||
tmpnam(new_reloc_file);
|
||||
|
||||
if (-1 == really_dynamic_load(old_reloc_file, new_reloc_file,
|
||||
|
@ -307,7 +313,7 @@ really_dynamic_load( char *reloc_info_file, char *output_file, char *user_args )
|
|||
abort_load(command, NULL, NULL);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/* move the storage pointer to the next page boundary */
|
||||
end_of_memory = (long) sbrk(page_size - end_of_memory % page_size);
|
||||
|
||||
|
@ -318,7 +324,7 @@ really_dynamic_load( char *reloc_info_file, char *output_file, char *user_args )
|
|||
}
|
||||
|
||||
load_point = (long) sbrk(0); /* no malloc or printf after this */
|
||||
|
||||
|
||||
if (load_point < 0 || 0 != load_point % page_size) {
|
||||
fprintf(stderr, "couldn't align sbrk on page boundary\n");
|
||||
abort_load(command, NULL, NULL);
|
||||
|
@ -357,7 +363,7 @@ really_dynamic_load( char *reloc_info_file, char *output_file, char *user_args )
|
|||
free(command);
|
||||
|
||||
/* open the output file */
|
||||
output_file_desc = fopen(output_file, "r");
|
||||
output_file_desc = fopen(output_file, "rb");
|
||||
if (output_file_desc == NULL ) {
|
||||
fprintf(stderr, "unable to open output file\n");
|
||||
abort_load(NULL, NULL, output_file);
|
||||
|
@ -399,7 +405,7 @@ really_dynamic_load( char *reloc_info_file, char *output_file, char *user_args )
|
|||
abort_load(NULL, output_file_desc, output_file);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/* go to beginning of text */
|
||||
if (fseek(output_file_desc, TEXT_OFFSET(output_file_header), 0)
|
||||
< 0) {
|
||||
|
@ -467,7 +473,7 @@ s48_dynamic_load( long nargs, scheme_value *argv )
|
|||
if (nargs != 1) return(SCHFALSE);
|
||||
|
||||
arg = argv[0];
|
||||
|
||||
|
||||
if (!STRINGP(arg)) return(SCHFALSE);
|
||||
|
||||
if (0 == dynamic_load(&STRING_REF(arg, 0)))
|
||||
|
|
|
@ -569,7 +569,7 @@
|
|||
(newline port)
|
||||
(write-line "Copyright (c) 1993, 1994 by Richard Kelsey and Jonathan Rees."
|
||||
port)
|
||||
(write-line "Please report bugs to scheme-48-bugs@martigny.ai.mit.edu."
|
||||
(write-line "Please report bugs to scheme-48-bugs@zurich.ai.mit.edu."
|
||||
port)
|
||||
(if (not (batch-mode?))
|
||||
(write-line "Type ,? (comma question-mark) for help." port))))
|
||||
|
|
|
@ -290,9 +290,11 @@
|
|||
tower ;?
|
||||
(delay (let ((p (eval `(a-package ((for-syntax ,id)) ,@clauses)
|
||||
config)))
|
||||
(ensure-loaded (make-structure p
|
||||
(lambda () (make-simple-interface #f '()))
|
||||
'for-syntax))
|
||||
(really-ensure-loaded
|
||||
(and (not (batch-mode?)) (current-output-port))
|
||||
(make-structure p
|
||||
(lambda () (make-simple-interface #f '()))
|
||||
'for-syntax))
|
||||
(cons eval p))))))
|
||||
config))
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ extended_vm (long key, scheme_value value)
|
|||
FILE *new_stream;
|
||||
|
||||
if (pstream == NULL) return UNDEFINED;
|
||||
new_stream = fdopen(fd, key == 24 ? "r" : "w");
|
||||
new_stream = fdopen(fd, key == 24 ? "rb" : "wb");
|
||||
if (new_stream == NULL) return UNDEFINED;
|
||||
fclose(*pstream);
|
||||
*pstream = new_stream;
|
||||
|
|
1477
initial.debug
1477
initial.debug
File diff suppressed because it is too large
Load Diff
BIN
initial.image
BIN
initial.image
Binary file not shown.
|
@ -384,6 +384,7 @@
|
|||
enabled-interrupts
|
||||
one-second
|
||||
all-interrupts
|
||||
with-interrupts ; For scsh
|
||||
with-interrupts-allowed
|
||||
with-interrupts-inhibited
|
||||
interrupt-before-heap-overflow!
|
||||
|
@ -732,6 +733,7 @@
|
|||
(export scan-forms
|
||||
scan-file
|
||||
really-scan-file
|
||||
really-scan-port ; for scsh
|
||||
scan-structures ;load-package.scm, link/link.scm
|
||||
really-scan-structures
|
||||
scan-package
|
||||
|
@ -762,6 +764,7 @@
|
|||
(define-interface compiler-interface
|
||||
(export compile
|
||||
compile-and-run-file ;for LOAD
|
||||
compile-and-run-port ;for LOAD (in scsh)
|
||||
compile-and-run-forms ;for EVAL
|
||||
compile-and-run-scanned-forms ;for eval.scm / ensure-loaded
|
||||
compile-file ;link/link.scm
|
||||
|
|
91
main.c
91
main.c
|
@ -15,8 +15,8 @@
|
|||
** the top. -Olin
|
||||
*/
|
||||
#if !defined(DEFAULT_HEAP_SIZE)
|
||||
/* 2.5 megacell = 10 megabytes (5 meg per semispace) */
|
||||
#define DEFAULT_HEAP_SIZE 2500000L
|
||||
/* 4 megacell = 16 megabytes (8 meg per semispace) */
|
||||
#define DEFAULT_HEAP_SIZE 4000000L
|
||||
#endif
|
||||
|
||||
#if !defined(DEFAULT_STACK_SIZE)
|
||||
|
@ -35,38 +35,24 @@
|
|||
|
||||
#endif /* STATIC_AREAS */
|
||||
|
||||
#define streq(a,b) (strcmp((a),(b))==0)
|
||||
|
||||
char *object_file; /* specified via a command line argument */
|
||||
char *reloc_file; /* dynamic loading will set this */
|
||||
|
||||
static char *prog_name;
|
||||
char *prog_name;
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [meta-arg] [vm-option+] [end-option scheme-args]\n"
|
||||
"meta-arg: \\ <script file name>\n"
|
||||
"\n"
|
||||
"vm-option: -h <total heap size in words>\n"
|
||||
" -s <stack size in words>\n"
|
||||
" -o <object file name>\n"
|
||||
"\n"
|
||||
"end-option: -i <image file name>\n"
|
||||
" -- (Terminates vm args.)\n"
|
||||
" -a (Terminates vm args. Obsolete.)\n",
|
||||
prog_name);
|
||||
}
|
||||
|
||||
static void bad_args(void) { usage(); exit(1); }
|
||||
char ** process_args(char **argv,
|
||||
long *heap_size,
|
||||
long *stack_size,
|
||||
char **object_file,
|
||||
char **image_name);
|
||||
|
||||
main(argc, argv)
|
||||
int argc; char **argv;
|
||||
{
|
||||
extern char **process_meta_arg(char **);
|
||||
char **argp;
|
||||
char *image_name = DEFAULT_IMAGE_NAME;
|
||||
long heap_size = DEFAULT_HEAP_SIZE; /* in numbers of cells */
|
||||
long stack_size = DEFAULT_STACK_SIZE; /* in numbers of cells */
|
||||
char **argp;
|
||||
long return_value;
|
||||
extern void sysdep_init();
|
||||
extern long required_init_space();
|
||||
|
@ -88,62 +74,11 @@ main(argc, argv)
|
|||
prog_name = *argv++; /* Save program name. */
|
||||
|
||||
object_file = reloc_file = NULL;
|
||||
|
||||
argv=process_args(argv,
|
||||
&heap_size, &stack_size,
|
||||
&object_file, &image_name);
|
||||
|
||||
/* Handle an initial \ <fname> meta-arg expansion. */
|
||||
while ( *argv && streq(*argv, "\\") ) {
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
argv = process_meta_arg(argv);
|
||||
if( !argv ) {
|
||||
fprintf(stderr, "%s: \\ <fname> expansion failed.\n",
|
||||
prog_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
for (; *argv; argv++)
|
||||
if( argv[0][0] != '-' )
|
||||
bad_args(); /* die */
|
||||
else
|
||||
switch (argv[0][1]) {
|
||||
default:
|
||||
bad_args(); /* die */
|
||||
break;
|
||||
|
||||
case 'h': /* heapsize */
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
heap_size = atoi(*argv);
|
||||
if( heap_size <= 0 ) bad_args();
|
||||
break;
|
||||
|
||||
case 's':
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
stack_size = atoi(*argv);
|
||||
if (stack_size <= 0) bad_args();
|
||||
break;
|
||||
|
||||
case 'o': /* object file */
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
object_file = *argv;
|
||||
break;
|
||||
|
||||
/* These switches terminate arg scanning. */
|
||||
case 'i':
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
image_name = *argv++;
|
||||
goto args_done;
|
||||
|
||||
case '-':
|
||||
case 'a':
|
||||
argv++;
|
||||
goto args_done;
|
||||
}
|
||||
|
||||
args_done:
|
||||
for(argc=0, argp=argv; *argp; argc++, argp++); /* Recompute argc. */
|
||||
|
||||
sysdep_init();
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
; sort of annoying)
|
||||
|
||||
;;;;
|
||||
;;;; $Id: psd-s48.scm,v 1.1 1995/10/14 03:33:08 bdc Exp $
|
||||
;;;; $Id: psd-s48.scm,v 1.1.1.1 1995/10/14 03:33:08 bdc Exp $
|
||||
;;;;
|
||||
;;;; psd -- a portable Scheme debugger, version 1.1
|
||||
;;;; Copyright (C) 1992 Pertti Kellomaki, pk@cs.tut.fi
|
||||
|
@ -46,8 +46,8 @@
|
|||
;;;; See file COPYING in the psd distribution.
|
||||
;;;;
|
||||
;;;; $Log: psd-s48.scm,v $
|
||||
;;;; Revision 1.1 1995/10/14 03:33:08 bdc
|
||||
;;;; *** empty log message ***
|
||||
;;;; Revision 1.1.1.1 1995/10/14 03:33:08 bdc
|
||||
;;;; scsh 0.4.x prerelease
|
||||
;;;;
|
||||
# Revision 1.1 1994/07/13 04:28:45 bdc
|
||||
# Initial revision
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
;Date: Wed, 29 Dec 1993 13:54:52 +0100
|
||||
;From: Olivier Danvy <danvy@daimi.aau.dk>
|
||||
;To: jar@martigny.ai.mit.edu
|
||||
;To: jar@zurich.ai.mit.edu
|
||||
;Subject: little Christmas gift
|
||||
;Reply-To: danvy@daimi.aau.dk
|
||||
;
|
||||
|
|
153
proc2.c
153
proc2.c
|
@ -55,31 +55,32 @@
|
|||
** comment character when it begins to scan the second line.
|
||||
**
|
||||
** Arguments are parsed from the second line as follows:
|
||||
** Arguments are white-space separated. The only special character is \,
|
||||
** the knock-down character. \nnn, for three octal digits n, reads as the
|
||||
** char whose ASCII code is nnn. \n is newline. \ followed by anything else
|
||||
** is just that character -- including \, space, tab, and newline. It is an
|
||||
** error if \ is followed by just 1 or 2 octal digits: \3Q doesn't mean
|
||||
** "3Q" -- it's an error.
|
||||
**
|
||||
** The argument line is terminated by newline or end-of-file.
|
||||
** - The only special chars are space, tab, newline, and \.
|
||||
** - Every space char terminates an argument.
|
||||
** Multiple spaces therefore introduce empty-string arguments.
|
||||
** - A newline terminates an argument, and also terminates the argument list.
|
||||
** This means that an empty line parses to the singleton list whose one
|
||||
** element is the empty string: (""). The grammar doesn't admit the empty
|
||||
** list.
|
||||
** - Tab is not allowed.
|
||||
** This is to prevent you from being screwed by thinking you had several
|
||||
** spaces where you really had a tab, and vice-versa.
|
||||
** - The only other special character is \, the knock-down character.
|
||||
** \ escapes \, space, tab, and newline, turning off their special
|
||||
** functions. The ANSI C escape sequences (\b, \n, \r and \t) are
|
||||
** supported; these also produce argument-constituents -- \n doesn't act
|
||||
** like a terminating newline. \nnn for *exactly* three octal digits reads
|
||||
** as the char whose ASCII code is nnn. It is an error if \ is followed by
|
||||
** just 1 or 2 octal digits: \3Q is an error. Octal-escapes are always
|
||||
** constituent chars. \ followed by other chars is not allowed (so we can
|
||||
** extend the escape-code space later if we like).
|
||||
**
|
||||
** Nul bytes & empty strings -- completeness at all costs:
|
||||
** Not that it is very useful, but how does one get empty arguments ("")
|
||||
** with this syntax? Well, ASCII nuls are taken to terminate arguments
|
||||
** -- this is a fairly deeply-embedded property of UNIX. Each nul
|
||||
** encountered on the argument line immediately terminates the current
|
||||
** argument. So, three nuls surrounded by whitespace produces 3 empty
|
||||
** arguments in series. This nul termination happens after \nnn processing,
|
||||
** so you can use a line like
|
||||
** #!/bin/interpreter \
|
||||
** foo \000bar \000\000baz\000 quux
|
||||
** to generate the arg list ("foo" "" "bar" "" "" "baz" "quux").
|
||||
** The rule is: a run of whitespace terminates an argument,
|
||||
** but *each* individual nul terminates an argument.
|
||||
** You have to construct these line-2 arg lines carefully. For example,
|
||||
** beware of trailing spaces at the end of the line. They'll give you
|
||||
** extra trailing empty-string args.
|
||||
**
|
||||
** \ followed by a nul is an error (it's not possible to knock-down nul
|
||||
** in UNIX).
|
||||
** You should also beware of including nul bytes into your arguments, since
|
||||
** C's pathetic excuse for a string data-type will lose if you try this.
|
||||
**
|
||||
**
|
||||
** Another way to get this sort of multiple-argument functionality, with
|
||||
|
@ -148,11 +149,13 @@ static void *maybe_grow_vec(void *vec, int *lenptr, int index, int elt_size)
|
|||
return realloc(vec, len*elt_size);
|
||||
}
|
||||
|
||||
/* This is a stmt, so no semicolon. The vec parameter better not be mgv_tmp! */
|
||||
/* The do ... while(0) is a trick to make this macro accept a terminating
|
||||
** semicolon.
|
||||
*/
|
||||
#define Maybe_Grow_Vec(vec, size, index, elt_t, lose) \
|
||||
{elt_t *mgv_tmp =(elt_t*)maybe_grow_vec((void*)vec, &size, \
|
||||
index, sizeof(elt_t)); \
|
||||
if(mgv_tmp) vec = mgv_tmp; else goto lose;}
|
||||
do {elt_t *mgv_tmp =(elt_t*)maybe_grow_vec((void*)vec, &size, \
|
||||
index, sizeof(elt_t)); \
|
||||
if(mgv_tmp) vec = mgv_tmp; else goto lose;} while (0);
|
||||
|
||||
|
||||
/* process_meta_arg(fname, av)
|
||||
|
@ -165,20 +168,20 @@ static void *maybe_grow_vec(void *vec, int *lenptr, int index, int elt_size)
|
|||
** argument following the \ switch, i.e., the <fname> argument.
|
||||
*/
|
||||
|
||||
static char* read_arg(FILE*, int*);
|
||||
static char* read_arg(FILE*);
|
||||
|
||||
char **process_meta_arg(char **av)
|
||||
{
|
||||
char **argv, *arg, **ap;
|
||||
int c;
|
||||
FILE *script;
|
||||
int error_code; /* So ugly. */
|
||||
char *fname;
|
||||
int av_len;
|
||||
int argv_i=0, argv_len=100;
|
||||
|
||||
if( !*av ) return NULL;
|
||||
fname = *av;
|
||||
script = fopen(fname, "r");
|
||||
script = fopen(fname, "rb");
|
||||
if( !script ) return NULL;
|
||||
|
||||
/* Skip line 1. */
|
||||
|
@ -188,12 +191,14 @@ char **process_meta_arg(char **av)
|
|||
argv = Malloc(char*, argv_len);
|
||||
if( !argv ) goto lose3;
|
||||
|
||||
while( (arg=read_arg(script, &error_code)) ) {
|
||||
Maybe_Grow_Vec(argv, argv_len, argv_i, char*, lose1)
|
||||
do {
|
||||
char *arg;
|
||||
arg = read_arg(script);
|
||||
if( !arg ) goto lose2;
|
||||
Maybe_Grow_Vec(argv, argv_len, argv_i, char*, lose1);
|
||||
argv[argv_i++] = arg;
|
||||
}
|
||||
|
||||
if( error_code ) goto lose2;
|
||||
while( EOF != (c=getc(script)) && '\n' != c );
|
||||
|
||||
for(av_len=0; av[av_len]; av_len++); /* Compute length of av. */
|
||||
|
||||
|
@ -218,64 +223,75 @@ char **process_meta_arg(char **av)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static char *read_arg(FILE *f, int *status_ptr)
|
||||
/* Read in one arg, but not its terminating space or newline.
|
||||
** Return a newly-allocated string containing the arg;
|
||||
** NULL if there's an error.
|
||||
*/
|
||||
static char *read_arg(FILE *f)
|
||||
{
|
||||
char *buf, *tmp;
|
||||
int buflen, i;
|
||||
int c;
|
||||
|
||||
*status_ptr = 0;
|
||||
|
||||
/* Skip whitespace. */
|
||||
while( EOF != (c=getc(f)) )
|
||||
if( c=='\n' ) return NULL;
|
||||
else if( !isspace(c) )
|
||||
{ungetc(c,f); break;}
|
||||
|
||||
if( c == EOF ) return NULL;
|
||||
|
||||
/* Allocate a buffer for the arg. */
|
||||
i = 0;
|
||||
buflen=20;
|
||||
if( !(buf = Malloc(char, buflen)) ) {
|
||||
*status_ptr = -1;
|
||||
return NULL;
|
||||
}
|
||||
if( !(buf = Malloc(char, buflen)) ) return NULL;
|
||||
|
||||
/* Read in the arg. */
|
||||
while( EOF != (c=getc(f)) && !isspace(c) ) {
|
||||
while(1) {
|
||||
int c = getc(f);
|
||||
|
||||
if( c == EOF || c == ' ' || c == '\n' ) {ungetc(c, f); break;}
|
||||
|
||||
/* Do knock-down processing. */
|
||||
if( c == '\\' ) {
|
||||
int c1, c2, c3;
|
||||
if( EOF == (c1 = getc(f)) ) goto lose;
|
||||
if( isodigit(c1) ) {
|
||||
switch (c1=getc(f)) {
|
||||
case EOF:
|
||||
goto lose;
|
||||
|
||||
/* \nnn octal escape. */
|
||||
case '0': case '1':
|
||||
case '2': case '3':
|
||||
case '4': case '5':
|
||||
case '6': case '7':
|
||||
if( EOF == (c2=getc(f)) || !isodigit(c2) ) goto lose;
|
||||
if( EOF == (c3=getc(f)) || !isodigit(c3) ) goto lose;
|
||||
c = ((c1-'0')<<6) | ((c2-'0')<<3) | (c3-'0');
|
||||
break;
|
||||
|
||||
/* ANSI C escapes. */
|
||||
case 'n': c='\n'; break;
|
||||
case 'r': c='\r'; break;
|
||||
case 't': c='\t'; break;
|
||||
case 'b': c='\b'; break;
|
||||
|
||||
/* Simple knock-down: \, space, tab, newline. */
|
||||
case '\\': case ' ':
|
||||
case '\t': case '\n':
|
||||
c=c1; break;
|
||||
|
||||
/* Nothing else allowed. */
|
||||
default: goto lose;
|
||||
}
|
||||
else if( c1 == 'n' ) c='\n';
|
||||
else c=c1;
|
||||
}
|
||||
|
||||
Maybe_Grow_Vec(buf, buflen, i, char, lose)
|
||||
/* No tab allowed. */
|
||||
else if( c == '\t' ) goto lose;
|
||||
|
||||
Maybe_Grow_Vec(buf, buflen, i, char, lose);
|
||||
buf[i++] = c;
|
||||
if( c == '\0' ) break; /* nul terminates args. */
|
||||
}
|
||||
|
||||
if( isspace(c) ) ungetc(c,f); /* Must preserve newline for next call. */
|
||||
|
||||
/* Null terminate the arg if it hasn't been done already. */
|
||||
if( c != '\0' ) {
|
||||
Maybe_Grow_Vec(buf, buflen, i, char, lose)
|
||||
buf[i++] = '\0';
|
||||
}
|
||||
/* Null terminate the arg. */
|
||||
Maybe_Grow_Vec(buf, buflen, i, char, lose);
|
||||
buf[i++] = '\0';
|
||||
|
||||
/* Precisely re-size buf and return. */
|
||||
if( tmp=Realloc(char,buf,i) ) return tmp;
|
||||
|
||||
lose:
|
||||
Free(buf);
|
||||
*status_ptr = -1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -354,11 +370,8 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
args_done:
|
||||
if( *argv ) fputs(*argv++, stdout);
|
||||
while( *argv ) {
|
||||
putchar(' ');
|
||||
fputs(*argv++, stdout);
|
||||
}
|
||||
if( *argv ) printf("\"%s\"", *argv++);
|
||||
while( *argv ) printf(" \"%s\"", *argv++);
|
||||
if( !n_flag ) putchar('\n');
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#include <stdio.h>
|
||||
|
||||
extern char *prog_name;
|
||||
|
||||
#define streq(a,b) (strcmp((a),(b))==0)
|
||||
|
||||
static void usage(void) {
|
||||
fprintf(stderr, "Usage: %s [meta-arg] [vm-option+] [end-option scheme-args]\n"
|
||||
"meta-arg: \\ <script file name>\n"
|
||||
"\n"
|
||||
"vm-option: -h <total heap size in words>\n"
|
||||
" -s <stack size in words>\n"
|
||||
" -o <object file name>\n"
|
||||
"\n"
|
||||
"end-option: -i <image file name>\n"
|
||||
" -- (Terminates vm args.)\n"
|
||||
" -a (Terminates vm args. Obsolete.)\n",
|
||||
prog_name);}
|
||||
|
||||
static void bad_args(void) {
|
||||
usage();
|
||||
exit(1); }
|
||||
|
||||
char ** process_args(char **argv,
|
||||
long *pheap_size,
|
||||
long *pstack_size,
|
||||
char **pobject_file,
|
||||
char **pimage_name) {
|
||||
extern char **process_meta_arg(char **);
|
||||
/* Handle an initial \ <fname> meta-arg expansion. */
|
||||
while ( *argv && streq(*argv, "\\") ) {
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
argv = process_meta_arg(argv);
|
||||
if( !argv ) {
|
||||
fprintf(stderr, "%s: \\ <fname> expansion failed.\n",
|
||||
prog_name);
|
||||
exit(1);}}
|
||||
|
||||
for (; *argv; argv++)
|
||||
if( argv[0][0] != '-' )
|
||||
bad_args(); /* die */
|
||||
else
|
||||
switch (argv[0][1]) {
|
||||
default:
|
||||
bad_args(); /* die */
|
||||
break;
|
||||
|
||||
case 'h': /* heapsize */
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
*pheap_size = atoi(*argv);
|
||||
if( *pheap_size <= 0 ) bad_args();
|
||||
break;
|
||||
|
||||
case 's':
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
*pstack_size = atoi(*argv);
|
||||
if (*pstack_size <= 0) bad_args();
|
||||
break;
|
||||
|
||||
case 'o': /* object file */
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
*pobject_file = *argv;
|
||||
break;
|
||||
|
||||
/* These switches terminate arg scanning. */
|
||||
case 'i':
|
||||
argv++;
|
||||
if( !*argv ) bad_args(); /* die */
|
||||
*pimage_name = *argv++;
|
||||
return argv;
|
||||
|
||||
case '-':
|
||||
case 'a':
|
||||
argv++;
|
||||
return argv;}
|
||||
return argv;}
|
18
rts/arch.scm
18
rts/arch.scm
|
@ -194,6 +194,24 @@
|
|||
(alarm ; order matters - higher priority first
|
||||
keyboard
|
||||
memory-shortage
|
||||
chld ; From here down are the scsh/Unix interrupts.
|
||||
cont
|
||||
hup
|
||||
quit
|
||||
term
|
||||
tstp
|
||||
usr1
|
||||
usr2
|
||||
info
|
||||
io
|
||||
poll
|
||||
prof
|
||||
pwr
|
||||
urg
|
||||
vtalrm
|
||||
winch
|
||||
xcpu
|
||||
xfsz
|
||||
))
|
||||
|
||||
; Options for op/time
|
||||
|
|
11
rts/eval.scm
11
rts/eval.scm
|
@ -25,11 +25,12 @@
|
|||
|
||||
; For scsh.
|
||||
|
||||
(define (load-quietly filename p)
|
||||
(compile-and-run-file filename p
|
||||
(lambda (template)
|
||||
(invoke-template template p))
|
||||
#f))
|
||||
(define (load-quietly from p)
|
||||
((if (string? from) compile-and-run-file compile-and-run-port)
|
||||
from p
|
||||
(lambda (template)
|
||||
(invoke-template template p))
|
||||
#f))
|
||||
|
||||
; Evaluate forms as if they came from the given file.
|
||||
|
||||
|
|
19
scheme48vm.c
19
scheme48vm.c
|
@ -2680,7 +2680,7 @@ long Tinterpret()
|
|||
goto extract_string;
|
||||
extract_string_return_0:
|
||||
spec_167X = extract_string_return_value;
|
||||
port_168X = ps_open(spec_167X, "w");
|
||||
port_168X = ps_open(spec_167X, "wb");
|
||||
if ((NULL == port_168X)) {
|
||||
merged_arg0K0 = 0;
|
||||
merged_arg1K1 = arg3_164X;
|
||||
|
@ -3480,7 +3480,14 @@ long Tinterpret()
|
|||
RSstackS = SstackS;
|
||||
RScode_pointerS = Scode_pointerS;
|
||||
RSenvS = SenvS;
|
||||
post_gc_fdports(); /* Hack for scsh's i/o system. Olin. */
|
||||
/* Do NOT put a call to the scsh I/O gc hook post_gc_fdports() here.
|
||||
** This GC is not for real -- it's for writing images, and will be
|
||||
** aborted. But the part of post_gc_fdports that updates the fdports[]
|
||||
** elements to point into new-space *won't* be aborted, and oops, we're
|
||||
** pointing into hyperspace. This whole thing is a mess; we need to port
|
||||
** to a newer Scheme 48 release that gives us structured GC hooks.
|
||||
** -Olin
|
||||
*/
|
||||
close_untraced_portsB_return_tag = 0;
|
||||
goto close_untraced_portsB;
|
||||
close_untraced_portsB_return_0:
|
||||
|
@ -3705,7 +3712,7 @@ long Tinterpret()
|
|||
goto extract_string;
|
||||
extract_string_return_1:
|
||||
spec_341X = extract_string_return_value;
|
||||
arg2K0 = (ps_open(spec_341X, "w"));
|
||||
arg2K0 = (ps_open(spec_341X, "wb"));
|
||||
goto L21208;}
|
||||
else {
|
||||
merged_arg1K0 = filename_340X;
|
||||
|
@ -3713,7 +3720,7 @@ long Tinterpret()
|
|||
goto extract_string;
|
||||
extract_string_return_2:
|
||||
spec_342X = extract_string_return_value;
|
||||
arg2K0 = (ps_open(spec_342X, "r"));
|
||||
arg2K0 = (ps_open(spec_342X, "rb"));
|
||||
goto L21208;}}}
|
||||
L21413: {
|
||||
if ((1 == (RSvalS))) {
|
||||
|
@ -6677,7 +6684,7 @@ long read_image(unsigned char *filename_764X, long startup_space_765X)
|
|||
long new_hp_792X;
|
||||
long delta_793X;
|
||||
|
||||
{port_766X = ps_open(filename_764X, "r");
|
||||
{port_766X = ps_open(filename_764X, "rb");
|
||||
if ((NULL == port_766X)) {
|
||||
TTerror("Can't open heap image file", 0, 0, 0, 0);
|
||||
goto L10206;}
|
||||
|
@ -6860,7 +6867,7 @@ long check_image_header(unsigned char *filename_794X)
|
|||
FILE * out_803X;
|
||||
unsigned char Kchar_804X;
|
||||
|
||||
{port_795X = ps_open(filename_794X, "r");
|
||||
{port_795X = ps_open(filename_794X, "rb");
|
||||
if ((NULL == port_795X)) {
|
||||
out_796X = Scurrent_output_portS;
|
||||
fputs("Can't open heap image file", out_796X);
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
Summary: Scheme shell
|
||||
Name: scsh
|
||||
Version: 0.5.3
|
||||
Release: 1
|
||||
Copyright: Massachusetts Institute of Technology
|
||||
Packager: Francisco Vides Fernandez <pvides@dedalo-ing.com>
|
||||
Group: Shells
|
||||
Source0: ftp://ftp-swiss.ai.mit.edu/pub/su/scsh/scsh.tar.gz
|
||||
URL: http://www.swiss.ai.mit.edu/projects/scheme/index.html
|
||||
ExclusiveArch: i386
|
||||
%description
|
||||
Scsh is a broad-spectrum systems-programming environment for Unix embedded in R4RS Scheme. It is brought to you by the Scheme underground.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
./configure --prefix=/usr
|
||||
make
|
||||
|
||||
%install
|
||||
make install
|
||||
strip /usr/bin/scsh
|
||||
|
||||
%files
|
||||
%doc COPYING Changes Error-log INSTALL NEWS NEWS.s48-0.36 README README.s48-0.36 RELEASE TODO TODO.s48-0.36
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/awk.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/changes.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/decls.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/front.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/intro.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/man.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/miscprocs.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/network.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/procnotation.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/rdelim.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/running.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/sre.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/strings.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/syscalls.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/test.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/todo.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/tty.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-manual/xman.tex
|
||||
%doc /usr/lib/scsh/doc/big-scheme.txt
|
||||
%doc /usr/lib/scsh/doc/call-back.txt
|
||||
%doc /usr/lib/scsh/doc/cheat.txt
|
||||
%doc /usr/lib/scsh/doc/external.txt
|
||||
%doc /usr/lib/scsh/doc/hacking.txt
|
||||
%doc /usr/lib/scsh/doc/install.s48-0.36.txt
|
||||
%doc /usr/lib/scsh/doc/install.txt
|
||||
%doc /usr/lib/scsh/doc/no-leaf-env.txt
|
||||
%doc /usr/lib/scsh/doc/olins-changes.txt
|
||||
%doc /usr/lib/scsh/doc/package.txt
|
||||
%doc /usr/lib/scsh/doc/scsh-src-roadmap.txt
|
||||
%doc /usr/lib/scsh/doc/threads.txt
|
||||
%doc /usr/lib/scsh/doc/type.txt
|
||||
%doc /usr/lib/scsh/doc/user-guide.txt
|
||||
%doc /usr/lib/scsh/doc/code.tex
|
||||
%doc /usr/lib/scsh/doc/latex-stuff.tex
|
||||
%doc /usr/lib/scsh/doc/meeting.tex
|
||||
%doc /usr/lib/scsh/doc/module.tex
|
||||
%doc /usr/lib/scsh/doc/scsh-paper.tex
|
||||
%doc /usr/lib/scsh/doc/summary.tex
|
||||
%doc /usr/lib/scsh/doc/meeting.ps
|
||||
%doc /usr/lib/scsh/doc/module.ps
|
||||
%doc /usr/lib/scsh/doc/scsh-manual.ps
|
||||
%doc /usr/lib/scsh/doc/scsh-paper.ps
|
||||
/usr/man/man1/scsh.1
|
||||
/usr/bin/scsh
|
||||
/usr/lib/scsh/big
|
||||
/usr/lib/scsh/cig
|
||||
/usr/lib/scsh/env
|
||||
/usr/lib/scsh/libscshvm.a
|
||||
/usr/lib/scsh/link
|
||||
/usr/lib/scsh/misc
|
||||
/usr/lib/scsh/opt
|
||||
/usr/lib/scsh/rts
|
||||
/usr/lib/scsh/scsh
|
||||
/usr/lib/scsh/scsh.image
|
||||
/usr/lib/scsh/scshvm
|
||||
/usr/lib/scsh/vm
|
||||
/usr/include/scheme48.h
|
|
@ -0,0 +1,6 @@
|
|||
scsh.image
|
||||
scsh
|
||||
endian.scm
|
||||
static.scm
|
||||
scsh.vm
|
||||
.,*
|
|
@ -3,9 +3,6 @@ AIX_P = exportlist.aix
|
|||
exportlist.aix: $(OBJS)
|
||||
$(RM) exportlist.aix
|
||||
for f in $(OBJS); do \
|
||||
/usr/ccs/bin/nm -e $$f | grep '^\..*|extern|' | \
|
||||
sed -e 's/^\.//;s/|//\'| awk '{print $$1}' >> exportlist.aix; \
|
||||
/usr/ccs/bin/nm -B -e $$f | grep ' T [^ ][^ ]*$$' | \
|
||||
sed -e 's/^.* T \.*\([^ ][^ ]*\)$$/\1/' >> exportlist.aix; \
|
||||
done;
|
||||
|
||||
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue