From: Matthew Pollack
Subject: Lisp interpreter/compiler written in the bourn shell
Date:
Message-ID: <378FCE36.31976BF6@hotmail.com>
I wrote one recently, on a lark, really. It compiles lambda-expressions
to shell scripts in a fairly simple-minded (read "silly") way, but it
works, and supports macros and garbage collection. I had just read
McCarthy's 1959 article and was inspired.
It just struck me that someone out there in usenet might think it's kind
of cute and have fun tinkering with it.
If this is so, please answer this message, and I'll post it. I dont
want to post however may kilobytes of shar file uninvited.
mp
Matthew Pollack wrote:
>
> I wrote one recently, on a lark, really. It compiles lambda-expressions
> to shell scripts in a fairly simple-minded (read "silly") way, but it
> works, and supports macros and garbage collection. I had just read
> McCarthy's 1959 article and was inspired.
>
> It just struck me that someone out there in usenet might think it's kind
> of cute and have fun tinkering with it.
>
> If this is so, please answer this message, and I'll post it. I dont
> want to post however may kilobytes of shar file uninvited.
>
> mp
I am not sure I get it, but I would like to take a look...
Aleks
From: Matthew Pollack
Subject: Re: Lisp interpreter/compiler written in the bourn shell
Date:
Message-ID: <379175F3.AB8E78D7@hotmail.com>
This is a multi-part message in MIME format.
--------------543BC091FEE910FAB5B1C937
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
The attached file is a bit big. It's a shar file (unfortunately, the
name got dos-chopped).
Run it in a new directory and enjoy.
mp
--------------543BC091FEE910FAB5B1C937
Content-Type: text/plain; charset=us-ascii; name="Ships.dis"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Ships.dis"
#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1999-07-18 01:29 EDT by <·······@molly>.
# Source directory was `/home/matthew/ships/bin'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 919 -rw-rw-r-- CHANGES
# 5744 -rw-rw-r-- DOCUMENTATION
# 634 -rw-rw-r-- LEGAL
# 2171 -rw-rw-r-- README
# 339 -rwxrw-r-- among
# 357 -rwxrw-r-- append
# 211 -rwxrw-r-- append-1
# 460 -rwxrw-r-- apply
# 447 -rwxrw-r-- apply.old
# 293 -rwxrw-r-- atom
# 307 -rwxrw-r-- atom-novalue
# 349 -rwxrw-r-- backward
# 294 -rwxrw-r-- backward-1
# 353 -rwxrw-r-- backward-list
# 75 -rwxrw-r-- caaar
# 75 -rwxrw-r-- caadr
# 50 -rwxrw-r-- caar
# 75 -rwxrw-r-- cadar
# 75 -rwxrw-r-- caddr
# 50 -rwxrw-r-- cadr
# 222 -rwxrw-r-- car
# 75 -rwxrw-r-- cdaar
# 75 -rwxrw-r-- cdadr
# 52 -rwxrw-r-- cdar
# 75 -rwxrw-r-- cddar
# 75 -rwxrw-r-- cdddr
# 50 -rwxrw-r-- cddr
# 156 -rwxrw-r-- cdr
# 572 -rwxrw-r-- compiled/labelled13682
# 368 -rwxrw-r-- compiled/labelled14069
# 399 -rwxrw-r-- compiled/labelled14479
# 466 -rwxrw-r-- compiled/labelled14907
# 431 -rwxrw-r-- compiled/labelled15327
# 751 -rwxrw-r-- compiled/labelled15719
# 213 -rwxrw-r-- compiled-existp
# 179 -rwxrw-r-- compiled-existp-novalue
# 165 -rwxrw-r-- compiled-make
# 290 -rwxrw-r-- compiled-make-unique
# 235 -rwxrw-r-- compiled-name
# 223 -rwxrw-r-- compiled-name.old
# 204 -rwxrw-r-- compiled-setq
# 145 -rwxrw-r-- compiledp
# 302 -rwxrw-r-- complain
# 276 -rwxrw-r-- cons
# 156 -rwxrw-r-- constantp
# 187 -rwxrw-r-- copy
# 162 -rwxrw-r-- eq
# 181 -rwxrw-r-- eq-novalue
# 591 -rwxrw-r-- equal
# 1324 -rwxrw-r-- evalxxx
# 1192 -rwxrw-r-- evalxxx.old
# 836 -rwxrw-r-- evcond
# 264 -rwxrw-r-- evlis
# 208 -rwxrw-r-- ff
# 245 -rwxrw-r-- ffsilly
# 1674 -rwxrw-r-- garbage
# 230 -rwxrw-r-- gensym
# 351 -rwxrw-r-- greater-than
# 86 -rw-rw-r-- gsed1
# 72 -rw-rw-r-- gsed2
# 111 -rw-rw-r-- gsed3
# 3982 -rw-rw-r-- image
# 5480 -rw-rw-r-- image.bak
# 131 -rwxrw-r-- integer-make
# 126 -rwxrw-r-- integerp
# 125 -rwxrw-r-- integerp-novalue
# 545 -rwxrw-r-- label
# 1122 -rwxrw-r-- lambda-compile
# 3014 -rwxrw-r-- lambda-compile-1
# 2667 -rwxrw-r-- lambda-compile-1.old
# 583 -rwxrw-r-- lambda-compile-cond
# 518 -rwxrw-r-- lambda-compile-list
# 227 -rwxrw-r-- lambda-variable
# 124 -rwxrw-r-- lambda-variable-initialize
# 116 -rwxrw-r-- length
# 156 -rwxrw-r-- length-1
# 226 -rwxrw-r-- list
# 196 -rwxrw-r-- listp
# 209 -rwxrw-r-- listp-novalue
# 468 -rwxrw-r-- lock-dc-fifo
# 235 -rwxrw-r-- macro-compiled
# 156 -rwxrw-r-- macro-make
# 186 -rwxrw-r-- macro-setq
# 11 -rwxrw-r-- macrodef
# 118 -rwxrw-r-- macrop
# 2499 -rwxrw-r-- makeimage
# 365 -rwxrw-r-- member
# 319 -rwxrw-r-- member-novalue
# 569 -rwxrw-r-- minus
# 200 -rwxrw-r-- notatom
# 187 -rwxrw-r-- notnull
# 173 -rwxrw-r-- null
# 187 -rwxrw-r-- null-novalue
# 312 -rwxrw-r-- numeq
# 3 -rw-rw-r-- numfile
# 191 -rwxrw-r-- orderp
# 644 -rwxrw-r-- pairs
# 305 -rwxrw-r-- plus
# 241 -rwxrw-r-- pname
# 202 -rwxrw-r-- pname-safe
# 343 -rwxrw-r-- print
# 1064 -rwxrw-r-- print-atom
# 228 -rwxrw-r-- print-car
# 246 -rwxrw-r-- print-cdr
# 222 -rwxrw-r-- print-cons
# 64 -rwxrw-r-- prog2
# 163 -rwxrw-r-- progn
# 805 -rw-rw-r-- progs/useful.ships
# 189 -rw-rw-r-- progs/fib.ships
# 619 -rw-rw-r-- progs/integer.ships
# 884 -rw-rw-r-- progs/animal.ships
# 107 -rw-rw-r-- progs/stupidihateeveryone.ships
# 343 -rw-rw-r-- progs/sort.ships
# 282 -rwxrw-r-- read-1
# 238 -rwxrw-r-- read-1-loop
# 787 -rwxrw-r-- read-atom
# 439 -rwxrw-r-- read-cdr
# 300 -rwxrw-r-- read-list
# 694 -rwxrw-r-- read-loop
# 130 -rwxrw-r-- read-quote
# 106 -rwxrw-r-- read-test
# 692 -rwxrw-r-- readxxx
# 239 -rwxrw-r-- robust-car
# 154 -rwxrw-r-- robust-cdr
# 274 -rwxrw-r-- rplaca
# 176 -rwxrw-r-- rplacd
# 265 -rwxrw-r-- setq
# 151 -rwxrw-r-- setxxx
# 439 -rwxrw-r-- ships.run
# 282 -rwxrw-r-- ships.run.once
# 66 -rwxrw-r-- si
# 1062 -rw-rw-r-- sspace
# 1062 -rw-rw-r-- sspace.bak
# 808 -rwxrw-r-- sublis
# 606 -rwxrw-r-- sublis-destructive
# 293 -rwxrw-r-- subst
# 242 -rwxrw-r-- subst-1
# 539 -rwxrw-r-- subst-destructive
# 159 -rwxrw-r-- symbol-existp
# 265 -rwxrw-r-- symbol-lookup
# 346 -rwxrw-r-- symbol-make
# 246 -rwxrw-r-- symbol-pname
# 235 -rwxrw-r-- symbol-set
# 146 -rwxrw-r-- symbol-symbol
# 159 -rwxrw-r-- symbol-value
# 125 -rwxrw-r-- symbolp
# 137 -rwxrw-r-- symbolp-novalue
# 91 -rwxrw-r-- symbols
# 218 -rwxrw-r-- value
# 165 -rwxrw-r-- valuep
# 162 -rwxrw-r-- valuep-novalue
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
if test "$gettext_dir" = FAILED && test -f $dir/gettext \
&& ($dir/gettext --version >/dev/null 2>&1)
then
set `$dir/gettext --version 2>&1`
if test "$3" = GNU
then
gettext_dir=$dir
fi
fi
if test "$locale_dir" = FAILED && test -f $dir/shar \
&& ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
then
locale_dir=`$dir/shar --print-text-domain-dir`
fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
echo=echo
else
TEXTDOMAINDIR=$locale_dir
export TEXTDOMAINDIR
TEXTDOMAIN=sharutils
export TEXTDOMAIN
echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
shar_touch=touch
else
shar_touch=:
echo
$echo 'WARNING: not restoring timestamps. Consider getting and'
$echo "installing GNU \`touch', distributed in GNU File Utilities..."
echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh16939; then
$echo 'x -' 'creating lock directory'
else
$echo 'failed to create lock directory'
exit 1
fi
# ============= CHANGES ==============
if test -f 'CHANGES' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'CHANGES' '(file already exists)'
else
$echo 'x -' extracting 'CHANGES' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'CHANGES' &&
Mon May 31 09:04:34 EDT 1999
X
I have finished rewriting the compiler. It is now pretty different.
X
The following functions were totally rewritten:
X lambda-compile
X lambda-compile-1
X label
The following functions were changed a little:
X lambda-compile-list
X lambda-compile-cond
Also, I...
Added functions member and member-novalue to main package
Added functions compiled-make-unique,
X compiled-existp,
X compiled-existp-novalue.
Added function listp-novalue
Changed evalxxx - added nil argument to lambda, label
Changed apply - does not append $SHIPS when calling thingies.
Changed print-atom - whines a little if it sees a #argument
Removed functions lambda-compile-subst-args
X lambda-compile-make-argslist
X subst-destructive-except-quote
X sublis-destructive-except-quote
X
___
X
Sun Jul 18 00:57:20 EDT 1999
X
Added the functions valuep and valuep-novalue
X
Fixed lambda-compile-1 so it deals correctly with macros.
SHAR_EOF
$shar_touch -am 0718005899 'CHANGES' &&
chmod 0664 'CHANGES' ||
$echo 'restore of' 'CHANGES' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'CHANGES:' 'MD5 check failed'
bcb55a05a716a2abdb94c4edc83b593a CHANGES
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'CHANGES'`"
test 919 -eq "$shar_count" ||
$echo 'CHANGES:' 'original size' '919,' 'current size' "$shar_count!"
fi
fi
# ============= DOCUMENTATION ==============
if test -f 'DOCUMENTATION' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'DOCUMENTATION' '(file already exists)'
else
$echo 'x -' extracting 'DOCUMENTATION' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'DOCUMENTATION' &&
This program looks a lot bigger than it is.
X
The files you're looking at break down in the following way:
(the following list is not perfect, might as well skip it)
X
progs/*.ships
X
#some programs to demonstrate to full power of the ships system
#useful.ships has some useful stuff (mostly macros) and is run
#automatically by makeimage
X
CHANGES
X
#some changes between "versions"
X
README
X
#the readme file
X
DOCUMENTATION
X
#this file
X
LEGAL
X
#the ships name-length license
X
[a long list of functions]
X
#useful functions built on basic lisp functions,
#and some of their children (named parent-1).
#these vary in robustness.
#an unidentified proper subset of these is used by
#important parts of ships.
X
apply
evalxxx
label
lambda-compile
print
readxxx
garbage
X
#the main ingredients of the read-eval-print loop
#the xxx's are there to avoid conflicts with shell commands
X
evcond
evlis
lambda-compile-1
lambda-compile-cond
lambda-compile-list
pname-safe
print-atom
print-car
print-cdr
print-cons
read-1
read-atom
read-cdr
read-list
read-quote
read-test
X
#these are daughter functions of functions of the above set
X
atom
compiledp
constantp
X
#some type predicates
X
car
cdr
cons
eq
null
rplaca
rplacd
X
#these are the basic lisp functions
#in principal, these are the 'methods' of
#the conses, and only they have proprietary knowledge.
#in practice, I've opted for speed over consistency in many cases.
X
atom-novalue
compiled-make
compiled-make-unique
compiled-name
compiled-existp
compiled-existp-novalue
eq-novalue
gsed1
gsed2
gsed3
lambda-variable
lambda-variable-initialize
notatom
notnull
null-novalue
read-loop
X
#these functions are not appropriate - they do not get and return
#s-exprs. They are used by certain functions and systems of functions.
X
compiled-setq
integer-make
lock-dc-fifo
makeimage
pname
setq
si
symbols
X
#these are inappropriate but useful on the command line
#some were created with further extensions of the system in mind
#Notice that setq is not the real thing, but merely mimics it
#from the command line.
X
complain
X
#this function penalizes the user for entering bad information
X
image
X
#the cons space
X
sspace
X
#the symbol space
X
ships.run
ships.run.once
X
#the read-eval-print loop
X
symbol-existp
symbol-lookup
symbol-make
symbol-pname
symbol-set
symbol-symbol
symbol-value
symbolp-novalue
X
#inappropriate functions which deal with symbols
X
setxxx
symbolp
value
X
#appropriate functions which deal with symbols.
X
---
X
How ships works:
X
Ships is a pretty simple lisp interpreter and compiler.
X
It interprets non-lambda s-exprs, and compiles lambda and label
expressions to shell programs which it places in the directory
$SHIPS/compiled and creates objects for them in the image. This seemed
like a nifty way to avoid implementing a stack, and means that programs
wont be too ridiculously slow.
X
Ships uses the following atomic types (including special forms and magic):
X
nil t symbol integer
X
quote setq lambda label cond defun compiled
X
(note - the argument data type as been uncreated)
X
Everything works just about the way you'd expect it to, masked with the
following features:
X
1)read: Read can accept any just about any formatting which does not
split up atoms: newlines spaces and tabs are fine anywhere, but are
necessary only between atoms. The READ function (the file readxxx)
accepts 1 s-expr plus a newline, followed by an EOF, and discards anything
past the first s-expr. The read-loop shell command (used by ships.run
and ships.run.once) accepts 0 or more s-expressions, and reads them
in sequence.
X
2)error messages: while proper input should always yield flawless output,
improper input may yield strange and unpredictable error messages and
overall strange behavior. A few functions (car and cdr) come with more
robust replacements, performing extra comparisons and using complain.
Many higher-level functions use complain, and do not cause strange
behavior in themselves.
X
3)complain: those functions which check for errors do not attempt to
fix them, preferring instead to penalize the programmer. The complain
function prints a helpful error message then kills every process it can
find named /bin/ash. This is to avoid strange behavior when parent
functions do not get the expected return value from their children.
If you are not using /bin/ash (you might not have it), but rather some
other bourn-compatible shell, make sure that it is not the same as your
login shell, or every detected error will log you out.
X
4)debugging information: print returns its argument: Before it does this,
it prints its argument to stderr. This is the last thing you see, in the
read-eval-print loop. Before this, you may see anywhere between a couple
of lines to a seemingly non-terminating string of debugging messages.
Don't be alarmed, they are perfectly harmless, as they are printed to
standard error.
X
5)argument-passing conventions: As one might expect, all appropriate
functions are reference-passed. In more detail: A function may take
zero or more arguments, which are passed to it on the command line, and
are represented as $1 $2 $3 etc in a shell script. A function returns
exactly one value, to standard output. In writing shell programs to
extend ships, one must be very sure only one thing is being printed to
standard output for any given function call. Return values must not
leak more than one level: this creates strange errors. Redirection to
/dev/null is occasionally necessary.
X
6)garbage collector: the function GARBAGE (the shell script
garbage) is a complete garbage collector. It assumes knowledge
of the conventions of the compiler. It changes image, sspace,
and any file in $SHIPS/compiled which it does not destroy. It is
done when it prints 'all done' to the screen.
SHAR_EOF
$shar_touch -am 0718012699 'DOCUMENTATION' &&
chmod 0664 'DOCUMENTATION' ||
$echo 'restore of' 'DOCUMENTATION' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'DOCUMENTATION:' 'MD5 check failed'
359ecdf300c04794a87f1f03e3d9037e DOCUMENTATION
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'DOCUMENTATION'`"
test 5744 -eq "$shar_count" ||
$echo 'DOCUMENTATION:' 'original size' '5744,' 'current size' "$shar_count!"
fi
fi
# ============= LEGAL ==============
if test -f 'LEGAL' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'LEGAL' '(file already exists)'
else
$echo 'x -' extracting 'LEGAL' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'LEGAL' &&
Ships (or any renamed variant) comes with a guarantee of uselessness
for any particular purpose. Let me repeat: ships does not do anything.
Any appearence of useful or even deterministic behavior on the part
of ships is hereby declared statistical noise, and the author takes no
responsibility for such behavior.
X
The author extends to anyone the right to change ships (or any renamed
variant) in any way, provided that it is redistributed with a new name
one character longer than its current name, and that this file remain
unchanged in the new distribution.
X
Matthew Pollack
·············@hotmail.com
Sun Jul 18 01:24:15 EDT 1999
SHAR_EOF
$shar_touch -am 0718012499 'LEGAL' &&
chmod 0664 'LEGAL' ||
$echo 'restore of' 'LEGAL' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'LEGAL:' 'MD5 check failed'
01ca12c0c8013968c39f0542b50443d2 LEGAL
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'LEGAL'`"
test 634 -eq "$shar_count" ||
$echo 'LEGAL:' 'original size' '634,' 'current size' "$shar_count!"
fi
fi
# ============= README ==============
if test -f 'README' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'README' '(file already exists)'
else
$echo 'x -' extracting 'README' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'README' &&
Ships stands for Shell Lisp, though rather loosely.
X
I have attempted to remain true to the original Lisp 1.0 in terms of
both speed and robustness.
X
This is what english comes with ships.
X
Do the following before you run ships:
X
Set the shell variable SHIPS (all caps) to the directory where
you just unpacked the whole thing, where all the source lives.
No trailing /
X
export SHIPS
X
You're also going to have to add the ships directory to your path,
or at least to add . to your path and run ships from withing ships.
Sorry, this was a real oversight
X
make sure the following files exist in SHIPS:
X
image
sspace
numfile
compiled (a directory)
X
If compiled does not exist, create it
X
X
The program lambda-variable-initialize makes numfile or wipes clean
the current one. It is run automatically by ships.run.
X
If image or sspace dont exist, or if they get corrupted,
run the program makeimage.
X
It is useful to change makeimage if you decide to add wonderful things to
ships.
X
To run ships from stdin to stderr, type ships.run
X
You can put as many spaces, tabs, and newlines as you please withing each
s-expr, as long as you dont break up atoms.
X
Also, you may enter as many s-exprs as you wish at a time, as long as
the last one is terminated by a newline then an EOF. They will be
evaluated in turn and then printed in turn.
X
Remember the EOF! If you neglect to ctrl-D after your expressions,
the computer will continue to stare at you stupidly.
X
You will see icky gobs of debugging information. It may assure you that
something is actually happening. Or you may comment it out of the source.
X
To quit, send an interrupt, say ctrl-c.
X
To run ships from a file, type ships.run.once <file. This works perfectly.
X
Some notes:
X
All but a few of the source files begins with the line
X
#!/bin/ash
X
Ash is just this shell. It's got some problems (I'm pretty sure),
but it's faster than bash and it's the only other one on my computer.
I think all the code is pretty standard bourn shell,
so feel free to change this.
X
Do Not do
X
ships.run <file
X
This will just go forever and ever.
X
See DOCUMENTATION for more documentation.
X
Matthew Pollack
X
·············@hotmail.com
SHAR_EOF
$shar_touch -am 0718010999 'README' &&
chmod 0664 'README' ||
$echo 'restore of' 'README' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'README:' 'MD5 check failed'
81aa0b523f7ab17299cc67a07a560dec README
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'README'`"
test 2171 -eq "$shar_count" ||
$echo 'README:' 'original size' '2171,' 'current size' "$shar_count!"
fi
fi
# ============= among ==============
if test -f 'among' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'among' '(file already exists)'
else
$echo 'x -' extracting 'among' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'among' &&
#!/bin/ash
X
#among: as defined in McCarthy 1960
X
#$1 and $2 are both addresses
#demands that $2 be a list, and is robust in this regard
#returns true, 2 if true, false, 1 otherwise
X
case `car $2` in
"#n")
X echo 1
X exec false ;;
"#"*)
X complain "$0: second argument is not a list!" ;;
$1)
X exec echo 2 ;;
*)
X exec among $1 `cdr $2` ;;
esac
SHAR_EOF
$shar_touch -am 0513213199 'among' &&
chmod 0764 'among' ||
$echo 'restore of' 'among' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'among:' 'MD5 check failed'
98a1bec9aa9603722b90d325740c7767 among
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'among'`"
test 339 -eq "$shar_count" ||
$echo 'among:' 'original size' '339,' 'current size' "$shar_count!"
fi
fi
# ============= append ==============
if test -f 'append' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'append' '(file already exists)'
else
$echo 'x -' extracting 'append' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'append' &&
#!/bin/ash
X
#append: as in McCarty 1960
X
#$1 and $2 are both addresses
#returns a list which is $2 with all the elements of $1 tacked on at
#the beginning
X
#requires that both $1 be a list,
#and that $2 not be an atom, and is robust in this regard
X
if atom-novalue $2 && notnull $2
then
X complain "$0: arguments must be lists"
else
X exec append-1 $1 $2
fi
SHAR_EOF
$shar_touch -am 0518211799 'append' &&
chmod 0764 'append' ||
$echo 'restore of' 'append' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'append:' 'MD5 check failed'
4f2d4deb30f26e84e0a453c59001e8f9 append
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'append'`"
test 357 -eq "$shar_count" ||
$echo 'append:' 'original size' '357,' 'current size' "$shar_count!"
fi
fi
# ============= append-1 ==============
if test -f 'append-1' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'append-1' '(file already exists)'
else
$echo 'x -' extracting 'append-1' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'append-1' &&
#!/bin/ash
X
#append-1: daughter function to append
X
case `car $1` in
"#n")
X exec echo $2 ;;
"#"*)
X complain "$0: first argument must be a list" ;;
*)
X BAR=`cdr $1`
X exec cons `car $1` `append-1 $BAR $2` ;;
esac
SHAR_EOF
$shar_touch -am 0513213299 'append-1' &&
chmod 0764 'append-1' ||
$echo 'restore of' 'append-1' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'append-1:' 'MD5 check failed'
71752ca382372bb80e913d35e6a48d25 append-1
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'append-1'`"
test 211 -eq "$shar_count" ||
$echo 'append-1:' 'original size' '211,' 'current size' "$shar_count!"
fi
fi
# ============= apply ==============
if test -f 'apply' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'apply' '(file already exists)'
else
$echo 'x -' extracting 'apply' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'apply' &&
#!/bin/ash
X
echo apply "$1" >&2
X
#apply: as described in my greatest ambitions
#$1 is a compiled-function - makes sure of this
#$2 is a list
#executes $1, passing the elements of $2 as arguments to it
X
ARGS=$2
unset CSTYLE
X
case "`car $1`" in
"#compiled" | "#macro")
X until null-novalue $ARGS
X do
X CSTYLE="$CSTYLE `car $ARGS`"
X ARGS=`cdr $ARGS`
X done
X
X exec `compiled-name $1` $CSTYLE ;;
*)
X complain "$0: first argument must be a compiled function" ;;
esac
SHAR_EOF
$shar_touch -am 0621215599 'apply' &&
chmod 0764 'apply' ||
$echo 'restore of' 'apply' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'apply:' 'MD5 check failed'
c18d0a2dd9bb9c45efb989ec7982255f apply
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'apply'`"
test 460 -eq "$shar_count" ||
$echo 'apply:' 'original size' '460,' 'current size' "$shar_count!"
fi
fi
# ============= apply.old ==============
if test -f 'apply.old' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'apply.old' '(file already exists)'
else
$echo 'x -' extracting 'apply.old' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'apply.old' &&
#!/bin/ash
X
echo apply "$1" >&2
X
#apply: as described in my greatest ambitions
#$1 is a compiled-function - makes sure of this
#$2 is a list
#executes $1, passing the elements of $2 as arguments to it
X
ARGS=$2
unset CSTYLE
X
case `car $1` in
"#compiled")
X until null-novalue $ARGS
X do
X CSTYLE="$CSTYLE `car $ARGS`"
X ARGS=`cdr $ARGS`
X done
X
X exec `compiled-name $1` $CSTYLE ;;
*)
X complain "$0: first argument must be a compiled function" ;;
esac
SHAR_EOF
$shar_touch -am 0531023399 'apply.old' &&
chmod 0764 'apply.old' ||
$echo 'restore of' 'apply.old' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'apply.old:' 'MD5 check failed'
71415e5cad034ea967f0cead9860b882 apply.old
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'apply.old'`"
test 447 -eq "$shar_count" ||
$echo 'apply.old:' 'original size' '447,' 'current size' "$shar_count!"
fi
fi
# ============= atom ==============
if test -f 'atom' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'atom' '(file already exists)'
else
$echo 'x -' extracting 'atom' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'atom' &&
#!/bin/ash
X
#atom: as described in McCarthy 1960
X
#$1 is an address.
#returns 2 if $1 is an atom
#returns 1 if $1 is not an atom
X
#'is an atom', in this case, means that the first character of
#the line as a #
X
case "`sed -n $1p <$SHIPS/image`" in
"#"*)
X exec echo '2' ;;
*)
X echo '1' ;;
esac
SHAR_EOF
$shar_touch -am 0514173499 'atom' &&
chmod 0764 'atom' ||
$echo 'restore of' 'atom' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'atom:' 'MD5 check failed'
bed1f354b0c2173fe5856f18593f27b8 atom
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'atom'`"
test 293 -eq "$shar_count" ||
$echo 'atom:' 'original size' '293,' 'current size' "$shar_count!"
fi
fi
# ============= atom-novalue ==============
if test -f 'atom-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'atom-novalue' '(file already exists)'
else
$echo 'x -' extracting 'atom-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'atom-novalue' &&
#!/bin/ash
X
#atom-novaule: for use in shell "if" switches
X
#$1 is an address.
#returns true if $1 is an atom
#returns flase if $1 is not an atom
X
#'is an atom', in this case, means that the first character of
#the line as a #
X
case "`sed -n $1p <$SHIPS/image`" in
"#"*)
X exec true ;;
*)
X exec false ;;
esac
SHAR_EOF
$shar_touch -am 0514173499 'atom-novalue' &&
chmod 0764 'atom-novalue' ||
$echo 'restore of' 'atom-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'atom-novalue:' 'MD5 check failed'
dd412e4e9309f57d3d60b4a31e67550b atom-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'atom-novalue'`"
test 307 -eq "$shar_count" ||
$echo 'atom-novalue:' 'original size' '307,' 'current size' "$shar_count!"
fi
fi
# ============= backward ==============
if test -f 'backward' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'backward' '(file already exists)'
else
$echo 'x -' extracting 'backward' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'backward' &&
#!/bin/ash
X
#backward: returns a list which is the retrograde of the argument list
X
#$1 is an address
#$1 is a list, but this is not very robust
#retuns a list with the elements of $1 backwards
#I wanted a way to do this without append or list
#this is it
X
if atom-novalue $1
then
X complain "$0: argument must be list"
else
X exec backward-1 $1 1
fi
SHAR_EOF
$shar_touch -am 0514174899 'backward' &&
chmod 0764 'backward' ||
$echo 'restore of' 'backward' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'backward:' 'MD5 check failed'
a2aee2d3754f011ff8de134f24071f58 backward
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'backward'`"
test 349 -eq "$shar_count" ||
$echo 'backward:' 'original size' '349,' 'current size' "$shar_count!"
fi
fi
# ============= backward-1 ==============
if test -f 'backward-1' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'backward-1' '(file already exists)'
else
$echo 'x -' extracting 'backward-1' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'backward-1' &&
#!/bin/ash
X
#backward-1: daughter function of backward
X
#$1 is the list we're working on
#$2 is what to put in your cons
#returns the new list
#wow, this one took some work. Pretty late now.
X
if null-novalue $1
then
X exec echo $2
else
X FOO=`car $1`
X exec backward-1 `cdr $1` `cons $FOO $2`
fi
SHAR_EOF
$shar_touch -am 0514174899 'backward-1' &&
chmod 0764 'backward-1' ||
$echo 'restore of' 'backward-1' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'backward-1:' 'MD5 check failed'
f6a2bcdddbecec6323c1d3e31da5a063 backward-1
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'backward-1'`"
test 294 -eq "$shar_count" ||
$echo 'backward-1:' 'original size' '294,' 'current size' "$shar_count!"
fi
fi
# ============= backward-list ==============
if test -f 'backward-list' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'backward-list' '(file already exists)'
else
$echo 'x -' extracting 'backward-list' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'backward-list' &&
#!/bin/ash
X
#backward-list: list of arguments in retrograde
X
#arguments 1 through the shell limit are addresses
#a list containing them in the opposite order is returned
X
#how do I use all the options in reverse order, without
#all sorts of extra overhead?
X
#never mind - I figured it out.
X
FOO=1
X
for I in $*
do
X FOO=`cons $I $FOO`
done
exec echo $FOO
SHAR_EOF
$shar_touch -am 0513213299 'backward-list' &&
chmod 0764 'backward-list' ||
$echo 'restore of' 'backward-list' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'backward-list:' 'MD5 check failed'
a806f93184eac19227f0e2457b24306e backward-list
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'backward-list'`"
test 353 -eq "$shar_count" ||
$echo 'backward-list:' 'original size' '353,' 'current size' "$shar_count!"
fi
fi
# ============= caaar ==============
if test -f 'caaar' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'caaar' '(file already exists)'
else
$echo 'x -' extracting 'caaar' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'caaar' &&
#!/bin/bash
X
#caaar: car(car(car))
X
HAPPY=`car $1`
exec car `car $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'caaar' &&
chmod 0764 'caaar' ||
$echo 'restore of' 'caaar' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'caaar:' 'MD5 check failed'
10ac1d8a853a3ee7c1fd18001524753a caaar
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'caaar'`"
test 75 -eq "$shar_count" ||
$echo 'caaar:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= caadr ==============
if test -f 'caadr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'caadr' '(file already exists)'
else
$echo 'x -' extracting 'caadr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'caadr' &&
#!/bin/bash
X
#caadr: car(car(cdr))
X
HAPPY=`cdr $1`
exec car `car $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'caadr' &&
chmod 0764 'caadr' ||
$echo 'restore of' 'caadr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'caadr:' 'MD5 check failed'
02d081d97b90fa33025f9922177e13f6 caadr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'caadr'`"
test 75 -eq "$shar_count" ||
$echo 'caadr:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= caar ==============
if test -f 'caar' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'caar' '(file already exists)'
else
$echo 'x -' extracting 'caar' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'caar' &&
#!/bin/ash
X
#caar: car(car $1)
X
exec car `car $1`
SHAR_EOF
$shar_touch -am 0513213399 'caar' &&
chmod 0764 'caar' ||
$echo 'restore of' 'caar' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'caar:' 'MD5 check failed'
25cd891d532f1483b9d97a7467cb6864 caar
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'caar'`"
test 50 -eq "$shar_count" ||
$echo 'caar:' 'original size' '50,' 'current size' "$shar_count!"
fi
fi
# ============= cadar ==============
if test -f 'cadar' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cadar' '(file already exists)'
else
$echo 'x -' extracting 'cadar' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cadar' &&
#!/bin/bash
X
#cadar: car(cdr(car))
X
HAPPY=`car $1`
exec car `cdr $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'cadar' &&
chmod 0764 'cadar' ||
$echo 'restore of' 'cadar' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cadar:' 'MD5 check failed'
f1491241f7f8183960a3bd0dd52fe5b7 cadar
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cadar'`"
test 75 -eq "$shar_count" ||
$echo 'cadar:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= caddr ==============
if test -f 'caddr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'caddr' '(file already exists)'
else
$echo 'x -' extracting 'caddr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'caddr' &&
#!/bin/bash
X
#caddr: car(cdr(cdr))
X
HAPPY=`cdr $1`
exec car `cdr $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'caddr' &&
chmod 0764 'caddr' ||
$echo 'restore of' 'caddr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'caddr:' 'MD5 check failed'
cdde3d45f6a5a337aaa54a9af0bb5e4e caddr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'caddr'`"
test 75 -eq "$shar_count" ||
$echo 'caddr:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= cadr ==============
if test -f 'cadr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cadr' '(file already exists)'
else
$echo 'x -' extracting 'cadr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cadr' &&
#!/bin/ash
X
#cadr: car(cdr $1)
X
exec car `cdr $1`
SHAR_EOF
$shar_touch -am 0513213399 'cadr' &&
chmod 0764 'cadr' ||
$echo 'restore of' 'cadr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cadr:' 'MD5 check failed'
bc76500bc3406a6ffb9527f109b20234 cadr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cadr'`"
test 50 -eq "$shar_count" ||
$echo 'cadr:' 'original size' '50,' 'current size' "$shar_count!"
fi
fi
# ============= car ==============
if test -f 'car' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'car' '(file already exists)'
else
$echo 'x -' extracting 'car' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'car' &&
#!/bin/ash
X
#car: low-level stuff
X
#$1 is an address
#returns the car
#not robust - use robust-car for that
#notice - every line, even lines 1 and 2, must have tabs for this to work
X
exec sed -n "$1s/ .*//p" <$SHIPS/image
SHAR_EOF
$shar_touch -am 0513213399 'car' &&
chmod 0764 'car' ||
$echo 'restore of' 'car' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'car:' 'MD5 check failed'
365fe41ac1ee9b5e58bb238353511d24 car
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'car'`"
test 222 -eq "$shar_count" ||
$echo 'car:' 'original size' '222,' 'current size' "$shar_count!"
fi
fi
# ============= cdaar ==============
if test -f 'cdaar' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cdaar' '(file already exists)'
else
$echo 'x -' extracting 'cdaar' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cdaar' &&
#!/bin/bash
X
#cdaar: cdr(car(car))
X
HAPPY=`car $1`
exec cdr `car $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'cdaar' &&
chmod 0764 'cdaar' ||
$echo 'restore of' 'cdaar' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cdaar:' 'MD5 check failed'
f09b2c8d7dd4dfaf2e15a1152ca55907 cdaar
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cdaar'`"
test 75 -eq "$shar_count" ||
$echo 'cdaar:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= cdadr ==============
if test -f 'cdadr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cdadr' '(file already exists)'
else
$echo 'x -' extracting 'cdadr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cdadr' &&
#!/bin/bash
X
#cdadr: cdr(car(cdr))
X
HAPPY=`cdr $1`
exec cdr `car $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'cdadr' &&
chmod 0764 'cdadr' ||
$echo 'restore of' 'cdadr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cdadr:' 'MD5 check failed'
e5708e5221e887d67d4dc6f833ec2ef4 cdadr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cdadr'`"
test 75 -eq "$shar_count" ||
$echo 'cdadr:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= cdar ==============
if test -f 'cdar' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cdar' '(file already exists)'
else
$echo 'x -' extracting 'cdar' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cdar' &&
#!/bin/ash
X
#cdar: (cdr(car $1))
X
exec cdr `car $1`
SHAR_EOF
$shar_touch -am 0513213399 'cdar' &&
chmod 0764 'cdar' ||
$echo 'restore of' 'cdar' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cdar:' 'MD5 check failed'
4170d5600235adec5f51951629fcd273 cdar
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cdar'`"
test 52 -eq "$shar_count" ||
$echo 'cdar:' 'original size' '52,' 'current size' "$shar_count!"
fi
fi
# ============= cddar ==============
if test -f 'cddar' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cddar' '(file already exists)'
else
$echo 'x -' extracting 'cddar' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cddar' &&
#!/bin/bash
X
#cddar: cdr(cdr(car))
X
HAPPY=`car $1`
exec cdr `cdr $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'cddar' &&
chmod 0764 'cddar' ||
$echo 'restore of' 'cddar' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cddar:' 'MD5 check failed'
08bb309f00612bdfd22db0d680e42c66 cddar
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cddar'`"
test 75 -eq "$shar_count" ||
$echo 'cddar:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= cdddr ==============
if test -f 'cdddr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cdddr' '(file already exists)'
else
$echo 'x -' extracting 'cdddr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cdddr' &&
#!/bin/bash
X
#cdddr: cdr(cdr(cdr))
X
HAPPY=`cdr $1`
exec cdr `cdr $HAPPY `
X
SHAR_EOF
$shar_touch -am 0513223099 'cdddr' &&
chmod 0764 'cdddr' ||
$echo 'restore of' 'cdddr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cdddr:' 'MD5 check failed'
675fa2c920d487fc7202afcf409ffdcd cdddr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cdddr'`"
test 75 -eq "$shar_count" ||
$echo 'cdddr:' 'original size' '75,' 'current size' "$shar_count!"
fi
fi
# ============= cddr ==============
if test -f 'cddr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cddr' '(file already exists)'
else
$echo 'x -' extracting 'cddr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cddr' &&
#!/bin/ash
X
#cddr: cdr(cdr $1)
X
exec cdr `cdr $1`
SHAR_EOF
$shar_touch -am 0513213399 'cddr' &&
chmod 0764 'cddr' ||
$echo 'restore of' 'cddr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cddr:' 'MD5 check failed'
612575841a0376b01e32896a61b3464c cddr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cddr'`"
test 50 -eq "$shar_count" ||
$echo 'cddr:' 'original size' '50,' 'current size' "$shar_count!"
fi
fi
# ============= cdr ==============
if test -f 'cdr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cdr' '(file already exists)'
else
$echo 'x -' extracting 'cdr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cdr' &&
#!/bin/ash
X
#cdr: low-leve stuff
X
#$1 is address of argument
#returns the cdr
#not robust - use robust-cdr for that
X
exec sed -n "$1s/.* //p" <$SHIPS/image
SHAR_EOF
$shar_touch -am 0513213399 'cdr' &&
chmod 0764 'cdr' ||
$echo 'restore of' 'cdr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cdr:' 'MD5 check failed'
390f93dae50e5d5d77e0900ec9a36337 cdr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cdr'`"
test 156 -eq "$shar_count" ||
$echo 'cdr:' 'original size' '156,' 'current size' "$shar_count!"
fi
fi
# ============= compiled/labelled13682 ==============
if test ! -d 'compiled'; then
$echo 'x -' 'creating directory' 'compiled'
mkdir 'compiled'
fi
if test -f 'compiled/labelled13682' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled/labelled13682' '(file already exists)'
else
$echo 'x -' extracting 'compiled/labelled13682' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled/labelled13682' &&
MAPCAR=157
F=${1}
L=${2}
if
VAR26=`$SHIPS/value 76`
VAR25=`compiled-name ${VAR26}`
VAR24=`${VAR25} $L`
notnull ${VAR24}
then
VAR28=1
VAR23=${VAR28}
elif
VAR29=2
notnull ${VAR29}
then
VAR32=`$SHIPS/value 56`
VAR38=`$SHIPS/value 34`
VAR37=`compiled-name ${VAR38}`
VAR36=`${VAR37} $L`
VAR34=`compiled-name ${F}`
VAR33=`${VAR34} $VAR36`
VAR46=`$SHIPS/value 48`
VAR45=`compiled-name ${VAR46}`
VAR44=`${VAR45} $L`
VAR41=`compiled-name ${MAPCAR}`
VAR40=`${VAR41} $F $VAR44`
VAR31=`compiled-name ${VAR32}`
VAR30=`${VAR31} $VAR33 $VAR40`
VAR23=${VAR30}
fi
exec echo ${VAR23}
SHAR_EOF
$shar_touch -am 0718010899 'compiled/labelled13682' &&
chmod 0764 'compiled/labelled13682' ||
$echo 'restore of' 'compiled/labelled13682' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled/labelled13682:' 'MD5 check failed'
13cd74b89ea5fb4526e367287ab106bc compiled/labelled13682
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled/labelled13682'`"
test 572 -eq "$shar_count" ||
$echo 'compiled/labelled13682:' 'original size' '572,' 'current size' "$shar_count!"
fi
fi
# ============= compiled/labelled14069 ==============
if test -f 'compiled/labelled14069' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled/labelled14069' '(file already exists)'
else
$echo 'x -' extracting 'compiled/labelled14069' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled/labelled14069' &&
DEFMACRO=158
NAME=${1}
ARGLIST=${2}
FORM=${3}
VAR50=`$SHIPS/value 72`
VAR51=138
VAR54=`$SHIPS/value 72`
VAR55=102
VAR58=`$SHIPS/value 72`
VAR59=8
VAR57=`compiled-name ${VAR58}`
VAR56=`${VAR57} $VAR59 $NAME $ARGLIST $FORM`
VAR53=`compiled-name ${VAR54}`
VAR52=`${VAR53} $VAR55 $VAR56`
VAR49=`compiled-name ${VAR50}`
VAR48=`${VAR49} $VAR51 $VAR52`
exec echo ${VAR48}
SHAR_EOF
$shar_touch -am 0718010899 'compiled/labelled14069' &&
chmod 0764 'compiled/labelled14069' ||
$echo 'restore of' 'compiled/labelled14069' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled/labelled14069:' 'MD5 check failed'
1faace05aec416e078b4b216c99a6cfd compiled/labelled14069
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled/labelled14069'`"
test 368 -eq "$shar_count" ||
$echo 'compiled/labelled14069:' 'original size' '368,' 'current size' "$shar_count!"
fi
fi
# ============= compiled/labelled14479 ==============
if test -f 'compiled/labelled14479' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled/labelled14479' '(file already exists)'
else
$echo 'x -' extracting 'compiled/labelled14479' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled/labelled14479' &&
IF=159
A=${1}
B=${2}
C=${3}
VAR65=`$SHIPS/value 72`
VAR66=7
VAR69=`$SHIPS/value 72`
VAR72=`$SHIPS/value 72`
VAR71=`compiled-name ${VAR72}`
VAR70=`${VAR71} $A $B`
VAR77=`$SHIPS/value 72`
VAR78=2
VAR76=`compiled-name ${VAR77}`
VAR75=`${VAR76} $VAR78 $C`
VAR68=`compiled-name ${VAR69}`
VAR67=`${VAR68} $VAR70 $VAR75`
VAR64=`compiled-name ${VAR65}`
VAR63=`${VAR64} $VAR66 $VAR67`
exec echo ${VAR63}
SHAR_EOF
$shar_touch -am 0718010899 'compiled/labelled14479' &&
chmod 0764 'compiled/labelled14479' ||
$echo 'restore of' 'compiled/labelled14479' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled/labelled14479:' 'MD5 check failed'
c31c83cfd23523a868ce3aa45936591d compiled/labelled14479
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled/labelled14479'`"
test 399 -eq "$shar_count" ||
$echo 'compiled/labelled14479:' 'original size' '399,' 'current size' "$shar_count!"
fi
fi
# ============= compiled/labelled14907 ==============
if test -f 'compiled/labelled14907' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled/labelled14907' '(file already exists)'
else
$echo 'x -' extracting 'compiled/labelled14907' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled/labelled14907' &&
LET=160
LETLIST=${1}
FORM=${2}
VAR82=`$SHIPS/value 56`
VAR85=`$SHIPS/value 72`
VAR86=5
VAR89=`$SHIPS/value 141`
VAR90=`$SHIPS/value 34`
VAR88=`compiled-name ${VAR89}`
VAR87=`${VAR88} $VAR90 $LETLIST`
VAR84=`compiled-name ${VAR85}`
VAR83=`${VAR84} $VAR86 $VAR87 $FORM`
VAR95=`$SHIPS/value 141`
VAR96=`$SHIPS/value 32`
VAR94=`compiled-name ${VAR95}`
VAR93=`${VAR94} $VAR96 $LETLIST`
VAR81=`compiled-name ${VAR82}`
VAR80=`${VAR81} $VAR83 $VAR93`
exec echo ${VAR80}
SHAR_EOF
$shar_touch -am 0718010999 'compiled/labelled14907' &&
chmod 0764 'compiled/labelled14907' ||
$echo 'restore of' 'compiled/labelled14907' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled/labelled14907:' 'MD5 check failed'
a15e0dd17ef22e67ffe9adccb427c301 compiled/labelled14907
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled/labelled14907'`"
test 466 -eq "$shar_count" ||
$echo 'compiled/labelled14907:' 'original size' '466,' 'current size' "$shar_count!"
fi
fi
# ============= compiled/labelled15327 ==============
if test -f 'compiled/labelled15327' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled/labelled15327' '(file already exists)'
else
$echo 'x -' extracting 'compiled/labelled15327' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled/labelled15327' &&
AND=161
A=${1}
B=${2}
VAR100=`$SHIPS/value 72`
VAR101=7
VAR104=`$SHIPS/value 72`
VAR107=`$SHIPS/value 72`
VAR106=`compiled-name ${VAR107}`
VAR105=`${VAR106} $A $B`
VAR112=`$SHIPS/value 72`
VAR113=2
VAR114=1
VAR111=`compiled-name ${VAR112}`
VAR110=`${VAR111} $VAR113 $VAR114`
VAR103=`compiled-name ${VAR104}`
VAR102=`${VAR103} $VAR105 $VAR110`
VAR99=`compiled-name ${VAR100}`
VAR98=`${VAR99} $VAR101 $VAR102`
exec echo ${VAR98}
SHAR_EOF
$shar_touch -am 0718010999 'compiled/labelled15327' &&
chmod 0764 'compiled/labelled15327' ||
$echo 'restore of' 'compiled/labelled15327' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled/labelled15327:' 'MD5 check failed'
24440b0691ad8a54e8fac912d776f29d compiled/labelled15327
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled/labelled15327'`"
test 431 -eq "$shar_count" ||
$echo 'compiled/labelled15327:' 'original size' '431,' 'current size' "$shar_count!"
fi
fi
# ============= compiled/labelled15719 ==============
if test -f 'compiled/labelled15719' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled/labelled15719' '(file already exists)'
else
$echo 'x -' extracting 'compiled/labelled15719' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled/labelled15719' &&
OR=162
A=${1}
B=${2}
VAR117=`$SHIPS/value 72`
VAR118=152
VAR121=`$SHIPS/value 72`
VAR124=`$SHIPS/value 72`
VAR125=156
VAR123=`compiled-name ${VAR124}`
VAR122=`${VAR123} $VAR125 $A`
VAR120=`compiled-name ${VAR121}`
VAR119=`${VAR120} $VAR122`
VAR129=`$SHIPS/value 72`
VAR130=7
VAR133=`$SHIPS/value 72`
VAR136=`$SHIPS/value 72`
VAR137=156
VAR138=156
VAR135=`compiled-name ${VAR136}`
VAR134=`${VAR135} $VAR137 $VAR138`
VAR141=`$SHIPS/value 72`
VAR142=2
VAR140=`compiled-name ${VAR141}`
VAR139=`${VAR140} $VAR142 $B`
VAR132=`compiled-name ${VAR133}`
VAR131=`${VAR132} $VAR134 $VAR139`
VAR128=`compiled-name ${VAR129}`
VAR127=`${VAR128} $VAR130 $VAR131`
VAR116=`compiled-name ${VAR117}`
VAR115=`${VAR116} $VAR118 $VAR119 $VAR127`
exec echo ${VAR115}
SHAR_EOF
$shar_touch -am 0718010999 'compiled/labelled15719' &&
chmod 0764 'compiled/labelled15719' ||
$echo 'restore of' 'compiled/labelled15719' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled/labelled15719:' 'MD5 check failed'
2b32fb4bdb6bcee57fc6944c6b3eff19 compiled/labelled15719
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled/labelled15719'`"
test 751 -eq "$shar_count" ||
$echo 'compiled/labelled15719:' 'original size' '751,' 'current size' "$shar_count!"
fi
fi
# ============= compiled-existp ==============
if test -f 'compiled-existp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled-existp' '(file already exists)'
else
$echo 'x -' extracting 'compiled-existp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled-existp' &&
#!/bin/ash
X
#compiled-existp: returns true if a compiled function with filename $1 exists
#does not check if the file exists
X
if fgrep "#compiled $1" $SHIPS/image >/dev/null
then
X exec echo 2
else
X exec echo 1
fi
SHAR_EOF
$shar_touch -am 0601205699 'compiled-existp' &&
chmod 0764 'compiled-existp' ||
$echo 'restore of' 'compiled-existp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled-existp:' 'MD5 check failed'
9b57669c9c912fe2e8899b9bccffe3ef compiled-existp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled-existp'`"
test 213 -eq "$shar_count" ||
$echo 'compiled-existp:' 'original size' '213,' 'current size' "$shar_count!"
fi
fi
# ============= compiled-existp-novalue ==============
if test -f 'compiled-existp-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled-existp-novalue' '(file already exists)'
else
$echo 'x -' extracting 'compiled-existp-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled-existp-novalue' &&
#!/bin/ash
X
#compiled-existp-novalue: returns true if a compiled function with filename $1 exists
#does not check if the file exists
X
fgrep "#compiled $1" $SHIPS/image >/dev/null
SHAR_EOF
$shar_touch -am 0601214299 'compiled-existp-novalue' &&
chmod 0764 'compiled-existp-novalue' ||
$echo 'restore of' 'compiled-existp-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled-existp-novalue:' 'MD5 check failed'
501727f71e37c5b9bf564897f673dbc5 compiled-existp-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled-existp-novalue'`"
test 179 -eq "$shar_count" ||
$echo 'compiled-existp-novalue:' 'original size' '179,' 'current size' "$shar_count!"
fi
fi
# ============= compiled-make ==============
if test -f 'compiled-make' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled-make' '(file already exists)'
else
$echo 'x -' extracting 'compiled-make' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled-make' &&
#!/bin/ash
X
#compiled-make: low-level stuff
#$1 is a character string
#returns a compiled-function which is described by the program
#$1
X
exec cons "#compiled" "$1"
SHAR_EOF
$shar_touch -am 0530203599 'compiled-make' &&
chmod 0764 'compiled-make' ||
$echo 'restore of' 'compiled-make' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled-make:' 'MD5 check failed'
97352f7a4d6201a5160c0d4a8b7a1541 compiled-make
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled-make'`"
test 165 -eq "$shar_count" ||
$echo 'compiled-make:' 'original size' '165,' 'current size' "$shar_count!"
fi
fi
# ============= compiled-make-unique ==============
if test -f 'compiled-make-unique' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled-make-unique' '(file already exists)'
else
$echo 'x -' extracting 'compiled-make-unique' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled-make-unique' &&
#!/bin/ash
X
#compiled-make-uniqe: makes a uniqe compiled function
#$1, if given, is taken as a file-name prefix
X
PREFIX=${1-compiled}
NUMBER=$$
while compiled-existp-novalue $SHIPS/compiled/$PREFIX$NUMBER
do
X NUMBER=`expr $NUMBER + 1`
done
exec compiled-make $SHIPS/compiled/$PREFIX$NUMBER
SHAR_EOF
$shar_touch -am 0524214299 'compiled-make-unique' &&
chmod 0764 'compiled-make-unique' ||
$echo 'restore of' 'compiled-make-unique' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled-make-unique:' 'MD5 check failed'
299212e85361c39ed8777455a9f4320c compiled-make-unique
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled-make-unique'`"
test 290 -eq "$shar_count" ||
$echo 'compiled-make-unique:' 'original size' '290,' 'current size' "$shar_count!"
fi
fi
# ============= compiled-name ==============
if test -f 'compiled-name' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled-name' '(file already exists)'
else
$echo 'x -' extracting 'compiled-name' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled-name' &&
#!/bin/ash
X
#compiled-name: robustly finds the name of the file which descrives $1
#$1 is a compiled-function
X
case "`car $1`" in
"#compiled" | "#macro" )
X exec cdr $1 ;;
*)
X complain "$0: $1: argument must be compiled-function";
esac
SHAR_EOF
$shar_touch -am 0621214399 'compiled-name' &&
chmod 0764 'compiled-name' ||
$echo 'restore of' 'compiled-name' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled-name:' 'MD5 check failed'
3f4a42c6311f7f4fbf09494cf41546d4 compiled-name
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled-name'`"
test 235 -eq "$shar_count" ||
$echo 'compiled-name:' 'original size' '235,' 'current size' "$shar_count!"
fi
fi
# ============= compiled-name.old ==============
if test -f 'compiled-name.old' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled-name.old' '(file already exists)'
else
$echo 'x -' extracting 'compiled-name.old' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled-name.old' &&
#!/bin/ash
X
#compiled-name: robustly finds the name of the file which descrives $1
#$1 is a compiled-function
X
case "`car $1`" in
"#compiled")
X exec cdr $1 ;;
*)
X complain "$0: $1: argument must be compiled-function";
esac
SHAR_EOF
$shar_touch -am 0601194399 'compiled-name.old' &&
chmod 0764 'compiled-name.old' ||
$echo 'restore of' 'compiled-name.old' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled-name.old:' 'MD5 check failed'
39d33c45c31e06509d878d969b11c48f compiled-name.old
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled-name.old'`"
test 223 -eq "$shar_count" ||
$echo 'compiled-name.old:' 'original size' '223,' 'current size' "$shar_count!"
fi
fi
# ============= compiled-setq ==============
if test -f 'compiled-setq' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiled-setq' '(file already exists)'
else
$echo 'x -' extracting 'compiled-setq' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiled-setq' &&
#!/bin/ash
X
#compiled-setq: a conveniance function
#$1 and $2 are character-strings
#sets the symbol with pname=$1 to the compiled-function described
#by the file $2
X
exec setq "$1" `compiled-make "$2"`
SHAR_EOF
$shar_touch -am 0530203799 'compiled-setq' &&
chmod 0764 'compiled-setq' ||
$echo 'restore of' 'compiled-setq' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiled-setq:' 'MD5 check failed'
0ba661c4adc05e4884538ff1e708c6fe compiled-setq
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiled-setq'`"
test 204 -eq "$shar_count" ||
$echo 'compiled-setq:' 'original size' '204,' 'current size' "$shar_count!"
fi
fi
# ============= compiledp ==============
if test -f 'compiledp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'compiledp' '(file already exists)'
else
$echo 'x -' extracting 'compiledp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'compiledp' &&
#!/bin/ash
X
#compiledp: predicates compiled-functionness over $1
X
case "`car $1`" in
"#compiled")
X exec echo 2 ;;
*)
X echo 1
X exec false ;;
esac
SHAR_EOF
$shar_touch -am 0512015299 'compiledp' &&
chmod 0764 'compiledp' ||
$echo 'restore of' 'compiledp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'compiledp:' 'MD5 check failed'
a320f5ffcc831a74073b366c915a8d09 compiledp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'compiledp'`"
test 145 -eq "$shar_count" ||
$echo 'compiledp:' 'original size' '145,' 'current size' "$shar_count!"
fi
fi
# ============= complain ==============
if test -f 'complain' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'complain' '(file already exists)'
else
$echo 'x -' extracting 'complain' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'complain' &&
#!/bin/ash
X
#complain: print error message and quit
X
#takes one argument
#prints an appropriate, informative complaint message
#then kill every ash it can find except its own
X
echo "$1" >&2
echo "This sucks, beavis" >&2
X
#ps
X
kill `ps | grep ' ash\(\)' | sed '/complain/d
X s/^ *//
X s/ .*//'`
SHAR_EOF
$shar_touch -am 0510131299 'complain' &&
chmod 0764 'complain' ||
$echo 'restore of' 'complain' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'complain:' 'MD5 check failed'
5540681dd85cf846c34a515914dbeb9c complain
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'complain'`"
test 302 -eq "$shar_count" ||
$echo 'complain:' 'original size' '302,' 'current size' "$shar_count!"
fi
fi
# ============= cons ==============
if test -f 'cons' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'cons' '(file already exists)'
else
$echo 'x -' extracting 'cons' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'cons' &&
#!/bin/ash
X
#cons: low-level stuff
X
#$1 and $2 are literals
#retuns the address of a new cons in image
X
#cons in appended to end of image - no free memory
#notice that there is a [tab] between $1 and $2
X
echo "$1 $2" >>$SHIPS/image
exec wc -l $SHIPS/image | sed 's/[^0-9]//g'
SHAR_EOF
$shar_touch -am 0513213499 'cons' &&
chmod 0764 'cons' ||
$echo 'restore of' 'cons' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'cons:' 'MD5 check failed'
3a4f127cc27e5ce51b96086bdec9b1ea cons
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'cons'`"
test 276 -eq "$shar_count" ||
$echo 'cons:' 'original size' '276,' 'current size' "$shar_count!"
fi
fi
# ============= constantp ==============
if test -f 'constantp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'constantp' '(file already exists)'
else
$echo 'x -' extracting 'constantp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'constantp' &&
#!/bin/ash
X
#constantp: predicate determines if $1 is a constant
X
case `car $1` in
"#t" | "#n" | "#integer")
X exec echo 2 ;;
*)
X echo 1
X exec false ;;
esac
SHAR_EOF
$shar_touch -am 0513213499 'constantp' &&
chmod 0764 'constantp' ||
$echo 'restore of' 'constantp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'constantp:' 'MD5 check failed'
becce340325baf02a8e8896e46d7461d constantp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'constantp'`"
test 156 -eq "$shar_count" ||
$echo 'constantp:' 'original size' '156,' 'current size' "$shar_count!"
fi
fi
# ============= copy ==============
if test -f 'copy' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'copy' '(file already exists)'
else
$echo 'x -' extracting 'copy' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'copy' &&
#!/bin/ash
X
#copy: returns a copy of s-expr $1
X
echo copy $* >&2
X
if atom-novalue $1
then
X exec echo $1
else
X CAR1="`car $1`"
X CDR1="`cdr $1`"
X exec cons "`copy $CAR1`" "`copy $CDR1`"
fi
SHAR_EOF
$shar_touch -am 0514201499 'copy' &&
chmod 0764 'copy' ||
$echo 'restore of' 'copy' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'copy:' 'MD5 check failed'
a8b82a2f302f91c92db66ddd3ede878d copy
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'copy'`"
test 187 -eq "$shar_count" ||
$echo 'copy:' 'original size' '187,' 'current size' "$shar_count!"
fi
fi
# ============= eq ==============
if test -f 'eq' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'eq' '(file already exists)'
else
$echo 'x -' extracting 'eq' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'eq' &&
#!/bin/ash
X
#eq: low-level stuff. Compares stuff
X
#$1 and $2 are things
#test for their absolute equality
X
case "$1" in
"$2")
X exec echo 2 ;;
*)
X echo 1 ;;
esac
SHAR_EOF
$shar_touch -am 0514173599 'eq' &&
chmod 0764 'eq' ||
$echo 'restore of' 'eq' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'eq:' 'MD5 check failed'
d137db2c6d8147e48613582348c174e9 eq
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'eq'`"
test 162 -eq "$shar_count" ||
$echo 'eq:' 'original size' '162,' 'current size' "$shar_count!"
fi
fi
# ============= eq-novalue ==============
if test -f 'eq-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'eq-novalue' '(file already exists)'
else
$echo 'x -' extracting 'eq-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'eq-novalue' &&
#!/bin/ash
X
#eq-novalue: for use in "if" switches in shell scripts
X
#$1 and $2 are things
#test for their absolute equality
X
case "$1" in
"$2")
X exec true ;;
*)
X exec false ;;
esac
SHAR_EOF
$shar_touch -am 0514173599 'eq-novalue' &&
chmod 0764 'eq-novalue' ||
$echo 'restore of' 'eq-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'eq-novalue:' 'MD5 check failed'
f668c6b39b66a9bec548d4c321aaa686 eq-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'eq-novalue'`"
test 181 -eq "$shar_count" ||
$echo 'eq-novalue:' 'original size' '181,' 'current size' "$shar_count!"
fi
fi
# ============= equal ==============
if test -f 'equal' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'equal' '(file already exists)'
else
$echo 'x -' extracting 'equal' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'equal' &&
#!/bin/ash
X
#equal: as described in McCarthy 1960
#implemented slightly diferently
#code modified to bottom out _whenever_ $1 and $2 are eq
X
#$1 and $2 are addresses
#returns 2 and true if $1 and $2 are the same s-exprs:
#they have all the same atoms in the same places
#returns 1 and false otherwise
X
#weird syntax at end is needed to ensure exactly one "#t" or "#n"
#gets returned
X
if eq-novalue $1 $2
then
X exec echo 2
elif atom-novalue $1 || atom-novalue $2
then
X echo 1
X exec false
elif equal `car $1` `car $2` >/dev/null
then
X exec equal `cdr $1` `cdr $2`
else
X echo 1
X exec false
fi
SHAR_EOF
$shar_touch -am 0514174599 'equal' &&
chmod 0764 'equal' ||
$echo 'restore of' 'equal' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'equal:' 'MD5 check failed'
634a92999e646bb469180895329b532d equal
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'equal'`"
test 591 -eq "$shar_count" ||
$echo 'equal:' 'original size' '591,' 'current size' "$shar_count!"
fi
fi
# ============= evalxxx ==============
if test -f 'evalxxx' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'evalxxx' '(file already exists)'
else
$echo 'x -' extracting 'evalxxx' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'evalxxx' &&
#!/bin/ash
X
echo eval "$1" >&2
X
#evalxxx: eval, renamed to avoid conflict with shell
#$1 is an sexpr
#evaluates it as nested function calls,
#recognizes the special-forms quote, setq
#assumes more than it should, like print-atom and a couple of others
X
CAR1="`car $1`"
case "$CAR1" in
"#integer" | "#compiled" | "#n" | "#t")
# echo eval constant >&2
X exec echo $1 ;;
"#symbol")
# echo eval symbol >&2
X exec echo `value $1` ;;
"#"*)
X complain "$0: special forms do no good on their own" ;;
#quote
3)
# echo eval quote form >&2
X exec cadr $1 ;;
#setq
4)
# echo eval setq form>&2
X CADR1=`cadr $1`
X if symbolp-novalue $CADR1
X then
X CADDR1=`caddr $1`
X exec setxxx $CADR1 `evalxxx $CADDR1`
X else
X complain "$0: SETQ requires a symbol"
X fi ;;
#lambda
5)
X exec lambda-compile "`cadr $1`" "`caddr $1`" 1 ;;
#label
6)
X exec label "`cadr $1`" "`caddr $1`" 1;;
#cond
7)
X exec evcond `cadr $1` ;;
#defun
8)
X FNAME="`cadr $1`"
X REST="`cddr $1`"
X LEXPR="`cons 5 $REST`"
# echo "defun: FNAME = $FNAME , REST = $REST , LEXPR = $LEXPR" >&2
X setxxx "$FNAME" "`label $FNAME $LEXPR 1`" >/dev/null
X exec echo $FNAME ;;
*)
X CDR1=`cdr $1`
X EVCAR1=`evalxxx $CAR1`
X case "`car $EVCAR1`" in
X "#macro")
X echo macro eval $1 >&2
X exec evalxxx `apply $EVCAR1 $CDR1` ;;
X *)
X echo function eval $1 >&2
X exec apply $EVCAR1 `evlis $CDR1` ;;
X esac
esac
SHAR_EOF
$shar_touch -am 0621215899 'evalxxx' &&
chmod 0764 'evalxxx' ||
$echo 'restore of' 'evalxxx' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'evalxxx:' 'MD5 check failed'
c07bfe34af6dd69b4290ff7688d8de35 evalxxx
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'evalxxx'`"
test 1324 -eq "$shar_count" ||
$echo 'evalxxx:' 'original size' '1324,' 'current size' "$shar_count!"
fi
fi
# ============= evalxxx.old ==============
if test -f 'evalxxx.old' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'evalxxx.old' '(file already exists)'
else
$echo 'x -' extracting 'evalxxx.old' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'evalxxx.old' &&
#!/bin/ash
X
echo eval "$1" >&2
X
#evalxxx: eval, renamed to avoid conflict with shell
#$1 is an sexpr
#evaluates it as nested function calls,
#recognizes the special-forms quote, setq
#assumes more than it should, like print-atom and a couple of others
X
CAR1="`car $1`"
case "$CAR1" in
"#integer" | "#compiled" | "#n" | "#t")
# echo eval constant >&2
X exec echo $1 ;;
"#symbol")
# echo eval symbol >&2
X exec echo `value $1` ;;
"#"*)
X complain "$0: special forms do no good on their own" ;;
#quote
3)
# echo eval quote form >&2
X exec cadr $1 ;;
#setq
4)
# echo eval setq form>&2
X CADR1=`cadr $1`
X if symbolp-novalue $CADR1
X then
X CADDR1=`caddr $1`
X exec setxxx $CADR1 `evalxxx $CADDR1`
X else
X complain "$0: SETQ requires a symbol"
X fi ;;
#lambda
5)
X exec lambda-compile "`cadr $1`" "`caddr $1`" 1 ;;
#label
6)
X exec label "`cadr $1`" "`caddr $1`" 1;;
#cond
7)
X exec evcond `cadr $1` ;;
#defun
8)
X FNAME="`cadr $1`"
X REST="`cddr $1`"
X LEXPR="`cons 5 $REST`"
# echo "defun: FNAME = $FNAME , REST = $REST , LEXPR = $LEXPR" >&2
X setxxx "$FNAME" "`label $FNAME $LEXPR 1`" >/dev/null
X exec echo $FNAME ;;
*)
# echo generic eval >&2
X CDR1=`cdr $1`
X exec apply `evalxxx $CAR1` `evlis $CDR1` ;;
esac
SHAR_EOF
$shar_touch -am 0621210199 'evalxxx.old' &&
chmod 0764 'evalxxx.old' ||
$echo 'restore of' 'evalxxx.old' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'evalxxx.old:' 'MD5 check failed'
a7c2fca141a51c6904b512b5dff6d338 evalxxx.old
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'evalxxx.old'`"
test 1192 -eq "$shar_count" ||
$echo 'evalxxx.old:' 'original size' '1192,' 'current size' "$shar_count!"
fi
fi
# ============= evcond ==============
if test -f 'evcond' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'evcond' '(file already exists)'
else
$echo 'x -' extracting 'evcond' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'evcond' &&
#!/bin/ash
X
#echo evcond "$1" >&2
X
#evcond: daughter function of eval (evalxxx)
#$1 is a list of 2-element lists
#returns NIL if test fell all the way through. It _think_ this is correct.
#I can always change it to an error later.
X
#should-be tiny progarm bloated by robustness.
X
CAR1="`car $1`"
#echo CAR1 is "$CAR1" >&2
case "$CAR1" in
"#n")
X echo 1
X exec false ;;
"#"*)
X complain "$0: bad syntax for COND special form" ;;
*)
X CAAR1="`car $CAR1`"
# echo CAAR1 is "$CAAR1" >&2
X case "$CAAR1" in
X "#"*)
X complain "$0: bad syntax for COND special form" ;;
X *)
X CADAR1="`cadar $1`"
# echo CADAR1 is "$CADAR1" >&2
X case "$CADAR1" in
X "#"*)
X complain "$0: bad syntax for COND special form" ;;
X *)
X case `evalxxx $CAAR1` in
X 1)
X exec evcond "`cdr $1`" ;;
X *)
X exec evalxxx $CADAR1 ;;
X esac ;;
X esac ;;
X esac ;;
esac
SHAR_EOF
$shar_touch -am 0601220699 'evcond' &&
chmod 0764 'evcond' ||
$echo 'restore of' 'evcond' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'evcond:' 'MD5 check failed'
5b1ea698ae60bad1900f572f6453eb37 evcond
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'evcond'`"
test 836 -eq "$shar_count" ||
$echo 'evcond:' 'original size' '836,' 'current size' "$shar_count!"
fi
fi
# ============= evlis ==============
if test -f 'evlis' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'evlis' '(file already exists)'
else
$echo 'x -' extracting 'evlis' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'evlis' &&
#!/bin/ash
X
#echo evlis "$1" >&2
X
#evlis: daughter function of eval
X
#$1 is a list
#evals every member of $1 and returns the list of these results
X
if null-novalue $1
then
X exec echo 1
else
X CAR1=`car $1`
X CDR1=`cdr $1`
X exec cons `evalxxx $CAR1` `evlis $CDR1`
fi
SHAR_EOF
$shar_touch -am 0514174899 'evlis' &&
chmod 0764 'evlis' ||
$echo 'restore of' 'evlis' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'evlis:' 'MD5 check failed'
974f0b0f78eddff8c68daf9caf4726ae evlis
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'evlis'`"
test 264 -eq "$shar_count" ||
$echo 'evlis:' 'original size' '264,' 'current size' "$shar_count!"
fi
fi
# ============= ff ==============
if test -f 'ff' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'ff' '(file already exists)'
else
$echo 'x -' extracting 'ff' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'ff' &&
#!/bin/ash
X
#ff: as described in McCarthy 1960
X
#$1 is an address
#returns the first atom in the (theoretically) printed
#representation of $1
X
if atom-novalue $1
then
X exec echo $1
else
X exec ff `car $1`
fi
SHAR_EOF
$shar_touch -am 0514174699 'ff' &&
chmod 0764 'ff' ||
$echo 'restore of' 'ff' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'ff:' 'MD5 check failed'
4f22442bbac5cc6826adb5abd8f5658c ff
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ff'`"
test 208 -eq "$shar_count" ||
$echo 'ff:' 'original size' '208,' 'current size' "$shar_count!"
fi
fi
# ============= ffsilly ==============
if test -f 'ffsilly' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'ffsilly' '(file already exists)'
else
$echo 'x -' extracting 'ffsilly' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'ffsilly' &&
#!/bin/ash
X
#ffsilly: ff as described in McCarthy 1960
X
#$1 is an address
#returns the first atom (theoretically) resuling from print $1
#of course, to implement it that way would be silly
X
exec print $1 | sed 's/(//g
X s/^ *//' | cut -f 1 -d\
SHAR_EOF
$shar_touch -am 0513213799 'ffsilly' &&
chmod 0764 'ffsilly' ||
$echo 'restore of' 'ffsilly' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'ffsilly:' 'MD5 check failed'
9f47098eb460af4d35001399bdc27e30 ffsilly
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ffsilly'`"
test 245 -eq "$shar_count" ||
$echo 'ffsilly:' 'original size' '245,' 'current size' "$shar_count!"
fi
fi
# ============= garbage ==============
if test -f 'garbage' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'garbage' '(file already exists)'
else
$echo 'x -' extracting 'garbage' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'garbage' &&
#!/bin/bash
X
#the garbage collector
#assumes that the only functions worth worrying about are in $SHIPS/compiled
X
#see the /bin/bash? /bin/ash caused a segmentation fault when
#the image got big
X
cut -f 1,3 sspace | sed 's/ 0//
s/ /\
/' | sort | uniq >TFILE
X
echo '1
2
3
4
5
6
7
8'>FILE
echo -n >FUNCS
cat FILE TFILE | sort | uniq >CFILE
X
until cmp FILE CFILE >&2
do
X cat CFILE >FILE
X cat TFILE >OFILE
X echo -n >XFILE
X for i in `cat OFILE`
X do
#echo sed ${i}p $SHIPS/image >&2
X sed -n "${i}p" $SHIPS/image >>XFILE
X done
X sed '/^#/d
s/ /\
/' XFILE >TFILE
X
grep "^#compiled.*${SHIPS}/compiled/" XFILE | cut -f 2 >>FUNCS
grep "^#macro.*${SHIPS}/compiled/" XFILE | cut -f 2 >>FUNCS
X for i in `grep "^#compiled.*${SHIPS}/compiled/" XFILE | cut -f 2 | sort | uniq`
X do
X sed -f gsed1 $i >>TFILE
X done
X
X cat FILE TFILE | sort | uniq >CFILE
done
X
#now, FILE (and CFILE) hold a list of everything we want to save,
#ordered alphabetically
X
echo moving onwards >&2
X
sort -n CFILE | sed 's/^/\^/
s/$/ /' >FILE
nl -n ln $SHIPS/image | grep -f FILE >nimage
cut -f 2,3 nimage >cutimage
X
nl -n ln nimage | cut -f 1,2 >psss
sed -f gsed2 psss >scomm1
sed -f gsed3 psss >scomm2
mv $SHIPS/image image.bak
sed -f scomm1 cutimage >$SHIPS/image
mv sspace sspace.bak
sed -f scomm1 sspace.bak >sspace
sort FUNCS | uniq | sed 's/^.*\///'>funk
ls $SHIPS/compiled >sunk
for i in `comm -1 -3 funk sunk`
do
X rm $SHIPS/compiled/$i
done
for i in `cat funk`
do
X sed -f scomm2 $SHIPS/compiled/$i >$SHIPS/compiled/$i.new
X mv $SHIPS/compiled/$i.new $SHIPS/compiled/$i
X chmod u+x $SHIPS/compiled/$i
done
X
rm FILE CFILE TFILE OFILE FUNCS XFILE
rm nimage cutimage psss scomm1 scomm2 funk sunk
echo all done >&2
SHAR_EOF
$shar_touch -am 0717234599 'garbage' &&
chmod 0764 'garbage' ||
$echo 'restore of' 'garbage' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'garbage:' 'MD5 check failed'
68d284e5f9a210ccd6b49ce10ae0d1c4 garbage
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'garbage'`"
test 1674 -eq "$shar_count" ||
$echo 'garbage:' 'original size' '1674,' 'current size' "$shar_count!"
fi
fi
# ============= gensym ==============
if test -f 'gensym' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'gensym' '(file already exists)'
else
$echo 'x -' extracting 'gensym' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'gensym' &&
#!/bin/ash
X
#generates a symbol of the form $1n, where n is an integer
#makes sure it doesnt exist
X
NAME=${1-"SYMBOL"}
NUMBER=$$
while symbol-existp "$NAME$NUMBER"
do
X NUMBER=expr $NUMBER + 1
done
X
exec symbol-make "$NAME$NUMBER"
SHAR_EOF
$shar_touch -am 0601214099 'gensym' &&
chmod 0764 'gensym' ||
$echo 'restore of' 'gensym' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'gensym:' 'MD5 check failed'
34a734d1cf387eefd14cf3a5ac459f5c gensym
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'gensym'`"
test 230 -eq "$shar_count" ||
$echo 'gensym:' 'original size' '230,' 'current size' "$shar_count!"
fi
fi
# ============= greater-than ==============
if test -f 'greater-than' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'greater-than' '(file already exists)'
else
$echo 'x -' extracting 'greater-than' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'greater-than' &&
#!/bin/ash
X
#greater-than: > over exactly 2 arguments
X
case "`car $1`" in
"#integer")
X FIRST="`cdr $1`" ;;
*)
X complain: "$0: first arg is not an integer" ;;
esac
X
case "`car $2`" in
"#integer")
X SECOND="`cdr $2`" ;;
*)
X complain: "$0: second arg is not an integer" ;;
esac
X
if expr $FIRST \> $SECOND >/dev/null
then
X exec echo 2
else
X exec echo 1
fi
SHAR_EOF
$shar_touch -am 0606175099 'greater-than' &&
chmod 0764 'greater-than' ||
$echo 'restore of' 'greater-than' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'greater-than:' 'MD5 check failed'
f1e17f1db4dcb4aae531cbb9b9736587 greater-than
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'greater-than'`"
test 351 -eq "$shar_count" ||
$echo 'greater-than:' 'original size' '351,' 'current size' "$shar_count!"
fi
fi
# ============= gsed1 ==============
if test -f 'gsed1' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'gsed1' '(file already exists)'
else
$echo 'x -' extracting 'gsed1' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'gsed1' &&
#n
/value/{
s/.*value //
s/`//p
}
/=[0-9]/s/.*=//p
/setxxx/{
s/.*setxxx //
s/ .*//p
}
SHAR_EOF
$shar_touch -am 0601183799 'gsed1' &&
chmod 0664 'gsed1' ||
$echo 'restore of' 'gsed1' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'gsed1:' 'MD5 check failed'
f863fc3f4792413600e9629730f40195 gsed1
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'gsed1'`"
test 86 -eq "$shar_count" ||
$echo 'gsed1:' 'original size' '86,' 'current size' "$shar_count!"
fi
fi
# ============= gsed2 ==============
if test -f 'gsed2' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'gsed2' '(file already exists)'
else
$echo 'x -' extracting 'gsed2' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'gsed2' &&
s/\([0-9][0-9]*\).* \([0-9][0-9]*\).*/s\/\^\2 \/\1 \/\
s\/ \2\$\/ \1\//
SHAR_EOF
$shar_touch -am 0531154999 'gsed2' &&
chmod 0664 'gsed2' ||
$echo 'restore of' 'gsed2' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'gsed2:' 'MD5 check failed'
711d60031e1864a1d054b5882b8f51fb gsed2
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'gsed2'`"
test 72 -eq "$shar_count" ||
$echo 'gsed2:' 'original size' '72,' 'current size' "$shar_count!"
fi
fi
# ============= gsed3 ==============
if test -f 'gsed3' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'gsed3' '(file already exists)'
else
$echo 'x -' extracting 'gsed3' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'gsed3' &&
s/\([0-9][0-9]*\).* \([0-9][0-9]*\).*/s\/value \2`\/value \1`\/\
s\/setxxx \2 \/setxxx \1 \/\
s\/=\2\$\/=\1\//
SHAR_EOF
$shar_touch -am 0601184599 'gsed3' &&
chmod 0664 'gsed3' ||
$echo 'restore of' 'gsed3' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'gsed3:' 'MD5 check failed'
39dc24bd8cfca0dddee1e89dbcea614e gsed3
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'gsed3'`"
test 111 -eq "$shar_count" ||
$echo 'gsed3:' 'original size' '111,' 'current size' "$shar_count!"
fi
fi
# ============= image ==============
if test -f 'image' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'image' '(file already exists)'
else
$echo 'x -' extracting 'image' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'image' &&
#n
#t
#quote
#setq
#lambda
#label
#cond
#defun
#compiled /home/matthew/ships/bin/among
#symbol 1
#compiled /home/matthew/ships/bin/append
#symbol 2
#compiled /home/matthew/ships/bin/apply
#symbol 3
#compiled /home/matthew/ships/bin/atom
#symbol 4
#compiled /home/matthew/ships/bin/backward
#symbol 5
#compiled /home/matthew/ships/bin/backward-list
#symbol 6
#compiled /home/matthew/ships/bin/caaar
#symbol 7
#compiled /home/matthew/ships/bin/caadr
#symbol 8
#compiled /home/matthew/ships/bin/caar
#symbol 9
#compiled /home/matthew/ships/bin/cadar
#symbol 10
#compiled /home/matthew/ships/bin/caddr
#symbol 11
#compiled /home/matthew/ships/bin/cadr
#symbol 12
#compiled /home/matthew/ships/bin/car
#symbol 13
#compiled /home/matthew/ships/bin/cdaar
#symbol 14
#compiled /home/matthew/ships/bin/cdadr
#symbol 15
#compiled /home/matthew/ships/bin/cdar
#symbol 16
#compiled /home/matthew/ships/bin/cddar
#symbol 17
#compiled /home/matthew/ships/bin/cdddr
#symbol 18
#compiled /home/matthew/ships/bin/cddr
#symbol 19
#compiled /home/matthew/ships/bin/cdr
#symbol 20
#compiled /home/matthew/ships/bin/compiledp
#symbol 21
#compiled /home/matthew/ships/bin/complain
#symbol 22
#compiled /home/matthew/ships/bin/cond
#symbol 23
#compiled /home/matthew/ships/bin/cons
#symbol 24
#compiled /home/matthew/ships/bin/constantp
#symbol 25
#compiled /home/matthew/ships/bin/eq
#symbol 26
#compiled /home/matthew/ships/bin/equal
#symbol 27
#compiled /home/matthew/ships/bin/equal-slow
#symbol 28
#compiled /home/matthew/ships/bin/evlis
#symbol 29
#compiled /home/matthew/ships/bin/ff
#symbol 30
#compiled /home/matthew/ships/bin/ffsilly
#symbol 31
#compiled /home/matthew/ships/bin/list
#symbol 32
#compiled /home/matthew/ships/bin/list-silly
#symbol 33
#compiled /home/matthew/ships/bin/null
#symbol 34
#compiled /home/matthew/ships/bin/pairs
#symbol 35
#compiled /home/matthew/ships/bin/print
#symbol 36
#compiled /home/matthew/ships/bin/car
#symbol 37
#compiled /home/matthew/ships/bin/cdr
#symbol 38
#compiled /home/matthew/ships/bin/rplaca
#symbol 39
#compiled /home/matthew/ships/bin/rplacd
#symbol 40
#compiled /home/matthew/ships/bin/setq
#symbol 41
#compiled /home/matthew/ships/bin/si
#symbol 42
#compiled /home/matthew/ships/bin/space
#symbol 43
#compiled /home/matthew/ships/bin/sspace
#symbol 44
#compiled /home/matthew/ships/bin/subst
#symbol 45
#compiled /home/matthew/ships/bin/symbolp
#symbol 46
#compiled /home/matthew/ships/bin/value
#symbol 47
#compiled /home/matthew/ships/bin/setxxx
#symbol 48
#compiled /home/matthew/ships/bin/readxxx
#symbol 49
#compiled /home/matthew/ships/bin/evalxxx
#symbol 50
#compiled /home/matthew/ships/bin/lambda-compile
#symbol 51
#compiled /home/matthew/ships/bin/symbols
#symbol 52
#compiled /home/matthew/ships/bin/listp
#symbol 53
#compiled /home/matthew/ships/bin/sublis
#symbol 54
#compiled /home/matthew/ships/bin/sublis-destructive
#symbol 55
#compiled /home/matthew/ships/bin/garbage
#symbol 56
#compiled /home/matthew/ships/bin/pname-safe
#symbol 57
#compiled /home/matthew/ships/bin/plus
#symbol 58
#compiled /home/matthew/ships/bin/minus
#symbol 59
#compiled /home/matthew/ships/bin/numeq
#symbol 60
#compiled /home/matthew/ships/bin/prog2
#symbol 61
#compiled /home/matthew/ships/bin/progn
#symbol 62
#compiled /home/matthew/ships/bin/member
#symbol 63
#compiled /home/matthew/ships/bin/greater-than
#symbol 64
#compiled /home/matthew/ships/bin/macro-compiled
#symbol 65
#compiled /home/matthew/ships/bin/macrop
#symbol 66
#symbol 67
#symbol 68
#symbol 69
#symbol 70
#symbol 71
#symbol 72
#symbol 73
#symbol 74
#symbol 75
#symbol 76
#symbol 77
#symbol 78
#symbol 79
#symbol 80
#symbol 81
#symbol 82
#compiled /home/matthew/ships/bin/compiled/labelled13682
#macro /home/matthew/ships/bin/compiled/labelled14069
#macro /home/matthew/ships/bin/compiled/labelled14479
#macro /home/matthew/ships/bin/compiled/labelled14907
#macro /home/matthew/ships/bin/compiled/labelled15327
#macro /home/matthew/ships/bin/compiled/labelled15719
SHAR_EOF
$shar_touch -am 0718010899 'image' &&
chmod 0664 'image' ||
$echo 'restore of' 'image' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'image:' 'MD5 check failed'
ec51156a331eb164a1b7a413e52406f0 image
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'image'`"
test 3982 -eq "$shar_count" ||
$echo 'image:' 'original size' '3982,' 'current size' "$shar_count!"
fi
fi
# ============= image.bak ==============
if test -f 'image.bak' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'image.bak' '(file already exists)'
else
$echo 'x -' extracting 'image.bak' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'image.bak' &&
#n
#t
#quote
#setq
#lambda
#label
#cond
#defun
#compiled /home/matthew/ships/bin/among
#symbol 1
#compiled /home/matthew/ships/bin/append
#symbol 2
#compiled /home/matthew/ships/bin/apply
#symbol 3
#compiled /home/matthew/ships/bin/atom
#symbol 4
#compiled /home/matthew/ships/bin/backward
#symbol 5
#compiled /home/matthew/ships/bin/backward-list
#symbol 6
#compiled /home/matthew/ships/bin/caaar
#symbol 7
#compiled /home/matthew/ships/bin/caadr
#symbol 8
#compiled /home/matthew/ships/bin/caar
#symbol 9
#compiled /home/matthew/ships/bin/cadar
#symbol 10
#compiled /home/matthew/ships/bin/caddr
#symbol 11
#compiled /home/matthew/ships/bin/cadr
#symbol 12
#compiled /home/matthew/ships/bin/car
#symbol 13
#compiled /home/matthew/ships/bin/cdaar
#symbol 14
#compiled /home/matthew/ships/bin/cdadr
#symbol 15
#compiled /home/matthew/ships/bin/cdar
#symbol 16
#compiled /home/matthew/ships/bin/cddar
#symbol 17
#compiled /home/matthew/ships/bin/cdddr
#symbol 18
#compiled /home/matthew/ships/bin/cddr
#symbol 19
#compiled /home/matthew/ships/bin/cdr
#symbol 20
#compiled /home/matthew/ships/bin/compiledp
#symbol 21
#compiled /home/matthew/ships/bin/complain
#symbol 22
#compiled /home/matthew/ships/bin/cond
#symbol 23
#compiled /home/matthew/ships/bin/cons
#symbol 24
#compiled /home/matthew/ships/bin/constantp
#symbol 25
#compiled /home/matthew/ships/bin/eq
#symbol 26
#compiled /home/matthew/ships/bin/equal
#symbol 27
#compiled /home/matthew/ships/bin/equal-slow
#symbol 28
#compiled /home/matthew/ships/bin/evlis
#symbol 29
#compiled /home/matthew/ships/bin/ff
#symbol 30
#compiled /home/matthew/ships/bin/ffsilly
#symbol 31
#compiled /home/matthew/ships/bin/list
#symbol 32
#compiled /home/matthew/ships/bin/list-silly
#symbol 33
#compiled /home/matthew/ships/bin/null
#symbol 34
#compiled /home/matthew/ships/bin/pairs
#symbol 35
#compiled /home/matthew/ships/bin/print
#symbol 36
#compiled /home/matthew/ships/bin/car
#symbol 37
#compiled /home/matthew/ships/bin/cdr
#symbol 38
#compiled /home/matthew/ships/bin/rplaca
#symbol 39
#compiled /home/matthew/ships/bin/rplacd
#symbol 40
#compiled /home/matthew/ships/bin/setq
#symbol 41
#compiled /home/matthew/ships/bin/si
#symbol 42
#compiled /home/matthew/ships/bin/space
#symbol 43
#compiled /home/matthew/ships/bin/sspace
#symbol 44
#compiled /home/matthew/ships/bin/subst
#symbol 45
#compiled /home/matthew/ships/bin/symbolp
#symbol 46
#compiled /home/matthew/ships/bin/value
#symbol 47
#compiled /home/matthew/ships/bin/setxxx
#symbol 48
#compiled /home/matthew/ships/bin/readxxx
#symbol 49
#compiled /home/matthew/ships/bin/evalxxx
#symbol 50
#compiled /home/matthew/ships/bin/lambda-compile
#symbol 51
#compiled /home/matthew/ships/bin/symbols
#symbol 52
#compiled /home/matthew/ships/bin/listp
#symbol 53
#compiled /home/matthew/ships/bin/sublis
#symbol 54
#compiled /home/matthew/ships/bin/sublis-destructive
#symbol 55
#compiled /home/matthew/ships/bin/garbage
#symbol 56
#compiled /home/matthew/ships/bin/pname-safe
#symbol 57
#compiled /home/matthew/ships/bin/plus
#symbol 58
#compiled /home/matthew/ships/bin/minus
#symbol 59
#compiled /home/matthew/ships/bin/numeq
#symbol 60
#compiled /home/matthew/ships/bin/prog2
#symbol 61
#compiled /home/matthew/ships/bin/progn
#symbol 62
#compiled /home/matthew/ships/bin/member
#symbol 63
#compiled /home/matthew/ships/bin/greater-than
#symbol 64
#compiled /home/matthew/ships/bin/macro-compiled
#symbol 65
#compiled /home/matthew/ships/bin/macrop
#symbol 66
#symbol 67
#symbol 68
#symbol 69
143 1
142 144
143 1
76 146
1 1
147 148
143 1
34 150
151 1
142 152
143 1
48 154
155 1
142 156
141 157
158 1
153 159
56 160
161 1
2 162
163 1
149 164
165 1
7 166
167 1
145 168
141 169
8 170
#symbol 70
#symbol 71
#symbol 72
#symbol 73
175 1
174 176
173 177
138 1
3 179
102 1
3 181
8 1
3 183
175 1
174 185
173 186
184 187
72 188
189 1
182 190
72 191
192 1
180 193
72 194
195 1
178 196
172 197
8 198
172 1
138 200
#symbol 74
#symbol 75
#symbol 76
#symbol 77
205 1
204 206
203 207
7 1
3 209
204 1
203 211
72 212
205 1
2 214
72 215
216 1
213 217
72 218
219 1
210 220
72 221
222 1
208 223
202 224
172 225
#symbol 78
#symbol 79
175 1
228 229
5 1
3 231
228 1
34 233
141 234
175 1
235 236
232 237
72 238
228 1
32 240
141 241
242 1
239 243
56 244
245 1
230 246
227 247
172 248
#symbol 80
204 1
203 251
7 1
3 253
204 1
203 255
72 256
1 1
2 258
72 259
260 1
257 261
72 262
263 1
254 264
72 265
266 1
252 267
250 268
172 269
#symbol 81
204 1
203 272
227 1
3 274
#symbol 82
276 1
3 277
203 1
278 279
72 280
281 1
72 282
7 1
3 284
276 1
3 286
276 1
3 288
289 1
287 290
72 291
204 1
2 293
72 294
295 1
292 296
72 297
298 1
285 299
72 300
301 1
283 302
275 303
72 304
305 1
273 306
271 307
172 308
5 169
#compiled /home/matthew/ships/bin/compiled/labelled13682
141 1
143 312
142 313
5 197
#macro /home/matthew/ships/bin/compiled/labelled14069
172 1
175 317
174 318
173 319
316 1
222 1
208 322
202 323
8 324
325 1
102 326
327 1
138 328
5 323
#macro /home/matthew/ships/bin/compiled/labelled14479
202 1
205 332
204 333
203 334
202 1
331 1
245 1
230 338
227 339
8 340
341 1
102 342
343 1
138 344
5 339
#macro /home/matthew/ships/bin/compiled/labelled14907
227 1
175 348
228 349
227 1
347 1
266 1
252 353
250 354
8 355
356 1
102 357
358 1
138 359
5 354
#macro /home/matthew/ships/bin/compiled/labelled15327
250 1
204 363
203 364
250 1
362 1
305 1
273 368
271 369
8 370
371 1
102 372
373 1
138 374
5 369
#macro /home/matthew/ships/bin/compiled/labelled15719
271 1
204 378
203 379
271 1
377 1
SHAR_EOF
$shar_touch -am 0718010899 'image.bak' &&
chmod 0664 'image.bak' ||
$echo 'restore of' 'image.bak' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'image.bak:' 'MD5 check failed'
60690cf73e426632cf94a8830a44337a image.bak
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'image.bak'`"
test 5480 -eq "$shar_count" ||
$echo 'image.bak:' 'original size' '5480,' 'current size' "$shar_count!"
fi
fi
# ============= integer-make ==============
if test -f 'integer-make' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'integer-make' '(file already exists)'
else
$echo 'x -' extracting 'integer-make' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'integer-make' &&
#!/bin/ash
X
#integer-make: low level stuff
#returns integer with value of character-string $1
#not robust
X
exec cons "#integer" $1
SHAR_EOF
$shar_touch -am 0512202899 'integer-make' &&
chmod 0764 'integer-make' ||
$echo 'restore of' 'integer-make' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'integer-make:' 'MD5 check failed'
4593ce8511eb085b5a4887e7cb75fef0 integer-make
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'integer-make'`"
test 131 -eq "$shar_count" ||
$echo 'integer-make:' 'original size' '131,' 'current size' "$shar_count!"
fi
fi
# ============= integerp ==============
if test -f 'integerp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'integerp' '(file already exists)'
else
$echo 'x -' extracting 'integerp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'integerp' &&
#!/bin/ash
X
#integerp: predicates integerness over $1
X
case "`car $1`" in
"#integer")
X exec echo 2 ;;
*)
X exec echo 1 ;;
esac
SHAR_EOF
$shar_touch -am 0601185899 'integerp' &&
chmod 0764 'integerp' ||
$echo 'restore of' 'integerp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'integerp:' 'MD5 check failed'
d71b8a6ad3155daf5a6056fabd9373aa integerp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'integerp'`"
test 126 -eq "$shar_count" ||
$echo 'integerp:' 'original size' '126,' 'current size' "$shar_count!"
fi
fi
# ============= integerp-novalue ==============
if test -f 'integerp-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'integerp-novalue' '(file already exists)'
else
$echo 'x -' extracting 'integerp-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'integerp-novalue' &&
#!/bin/ash
X
#integerp-novalue: like it says on the sign
X
case "`car $1`" in
"#integer")
X exec true ;;
*)
X exec false ;;
esac
SHAR_EOF
$shar_touch -am 0601185899 'integerp-novalue' &&
chmod 0764 'integerp-novalue' ||
$echo 'restore of' 'integerp-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'integerp-novalue:' 'MD5 check failed'
e0bd42ee44580388b9c90c18de2034e6 integerp-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'integerp-novalue'`"
test 125 -eq "$shar_count" ||
$echo 'integerp-novalue:' 'original size' '125,' 'current size' "$shar_count!"
fi
fi
# ============= label ==============
if test -f 'label' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'label' '(file already exists)'
else
$echo 'x -' extracting 'label' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'label' &&
#!/bin/ash
X
#label: as in McCarthy 1960, interpreted locally
#man, that movie was a torture chamber! Never see Ronin. Bad movie.
X
#$1 is the label - a symbol
#$2 is a lambda expression
#$3 is the local environment
X
LABEL=$1
LEXPR=$2
LLIST=$3
X
case "`car $LEXPR`" in
#lambda
5) ;;
*)
X complain "$0: 2nd argument is not a lambda-expression." ;;
esac
X
CADR2="`cadr $LEXPR`"
if listp-novalue $LEXPR && listp-novalue "$CADR2"
then
X exec lambda-compile $CADR2 `caddr $LEXPR` $LLIST labelled $LABEL
else
X complain "$0: improper lambda expression"
fi
SHAR_EOF
$shar_touch -am 0531084799 'label' &&
chmod 0764 'label' ||
$echo 'restore of' 'label' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'label:' 'MD5 check failed'
563b790ed34776c6c6a5d8493e396a9b label
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'label'`"
test 545 -eq "$shar_count" ||
$echo 'label:' 'original size' '545,' 'current size' "$shar_count!"
fi
fi
# ============= lambda-compile ==============
if test -f 'lambda-compile' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lambda-compile' '(file already exists)'
else
$echo 'x -' extracting 'lambda-compile' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lambda-compile' &&
#!/bin/ash
X
#lambda-compile: compiles a function
X
#$1 is the arglist
#$2 is the form to be compiled
#$3 is the list of the current local variables - NOT OPTIONAL
#$4, optionally, is a filename prefix
#returns a new, unique compiled-function
#5, if it exists and is a symbol, labells the function as $5
#arguments take local precedence, incase of argument-label collisions
X
#the function pname-safe replaces - with h, for shell safety
X
echo lambda-compile $* >&2
X
ARGS=$1
FORM=$2
LLIST=$3
FUNCTION=`compiled-make-unique $4`
FILE="`compiled-name $FUNCTION`"
LABEL=$5
X
echo -n >"$FILE"
case $LABEL in
"") ;;
*)
X if symbolp-novalue $LABEL
X then
X echo "`pname-safe $LABEL`=$FUNCTION" >>$FILE
X LLIST=`cons $LABEL $LLIST`
X else
X complain "$0: label must be a symbol"
X fi ;;
esac
NUMBER=1
while notnull $ARGS
do
X ARG=`car $ARGS`
X NAME="`pname-safe $ARG`"
X echo "${NAME}=\${$NUMBER}" >>$FILE
X NUMBER=`expr $NUMBER + 1`
X ARGS=`cdr $ARGS`
done
ARGS=$1
LLIST=`append $ARGS $LLIST`
X
echo ARGS=$ARGS FORM=$FORM LLIST=$LLIST >&2
echo "exec echo \${`lambda-compile-1 $FORM "$FILE" $LLIST`}" >>$FILE
chmod u+x $FILE
exec echo $FUNCTION
SHAR_EOF
$shar_touch -am 0531200099 'lambda-compile' &&
chmod 0764 'lambda-compile' ||
$echo 'restore of' 'lambda-compile' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lambda-compile:' 'MD5 check failed'
87ac560074f953b2e615beb34d3b750f lambda-compile
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lambda-compile'`"
test 1122 -eq "$shar_count" ||
$echo 'lambda-compile:' 'original size' '1122,' 'current size' "$shar_count!"
fi
fi
# ============= lambda-compile-1 ==============
if test -f 'lambda-compile-1' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lambda-compile-1' '(file already exists)'
else
$echo 'x -' extracting 'lambda-compile-1' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lambda-compile-1' &&
#!/bin/ash
X
#lambda-compile-1: version number 2
#$1 is the form being compiled
#$2 is the file where all this is going
#$3 is the list of all symbols to be enterpreted locally
#$4, if it exists, signifies the label for lambda - clumsy magic
X
#note - anything which would be preserved by a garbage collector shows
#as a raw integer immediately following an = sign or the word "value"
#of the word '$SHIPS/setxxx' (unexpanded) in the file
X
#also of note - macros evaluate at compile time.
#also note - it doesnt work!
X
echo lambda-compile-1 $* >&2
X
FORM=$1
FILE=$2
LLIST=$3
VARIABLE=`lambda-variable`
X
CAR1="`car $FORM`"
case "$CAR1" in
#if symbol is in the local environment,
#returns its name as the name of the variable, not VARIABLE
"#symbol")
X if member-novalue $FORM $LLIST
X then
X exec pname-safe $FORM
X else
X echo "$VARIABLE=\`\$SHIPS/value $FORM\`" >>$FILE
X fi ;;
"#"*)
X echo "$VARIABLE=$FORM" >>$FILE;;
#quote
3)
X echo "$VARIABLE=`cadr $FORM`" >>$FILE;;
#setq
4)
X CADDR1="`caddr $FORM`"
X echo "$VARIABLE=\`\$SHIPS/setxxx `cadr $FORM` \${`lambda-compile-1 $CADDR1 $FILE $LLIST`}\`" >>$FILE ;;
#lambda
#very clever - compiled function modifies a premade template function
#IT WORKS!
5)
X CADR1="`cadr $FORM`"
X CADDR1="`caddr $FORM`"
X case "$4" in
X "")
X NEWLIST=$LLIST ;;
X *)
X NEWLIST=`cons $4 $LLIST` ;;
X esac
X FUNCTION=`lambda-compile $CADR1 $CADDR1 $NEWLIST`
X echo "$VARIABLE=\`\$SHIPS/compiled-make-unique temporary\`" >>$FILE
X echo "NEWFILE=\`\$SHIPS/compiled-name \${$VARIABLE}\`" >>$FILE
X case $4 in
X "")
X echo "echo -n >\$NEWFILE" >>$FILE ;;
X *)
X echo "echo `pname-safe $4`=\${$VARIABLE} >\$NEWFILE" >>$FILE ;;
X esac
X while notnull $LLIST
X do
X CARL=`car $LLIST`
X PNAME=`pname-safe $CARL`
X echo "echo ${PNAME}=\${$PNAME} >>\$NEWFILE" >>$FILE
X LLIST=`cdr $LLIST`
X done
X echo "DUMMY=$FUNCTION" >>$FILE
X echo "cat `compiled-name $FUNCTION` >>\$NEWFILE" >>$FILE
X echo "chmod u+x \$NEWFILE" >>$FILE ;;
X
#label
#returns the result of lambda rather than the current variable-hence exec
6)
X LABEL="`cadr $FORM`"
X LEXPR="`caddr $FORM`"
X exec lambda-compile-1 $LEXPR $FILE $LLIST $LABEL ;;
X
#cond
7)
X exec lambda-compile-cond `cadr $FORM` $FILE $LLIST $VARIABLE ;;
#defun
8)
X LABEL=`cadr $FORM`
X CDDR1=`cddr $FORM`
X LEXPR=`cons 5 $CDDR1`
X LABELEXPR=`list 6 $LABEL $LEXPR`
X echo "\$SHIPS/setxxx $LABEL \${`lambda-compile-1 $LABELEXPR $FILE $LLIST`} >/dev/null" >>$FILE
X echo "$VARIABLE=$LABEL" >>$FILE ;;
#a fucntion call
*)
X CDR1="`cdr $FORM`"
X
X VARIABLE2=`lambda-variable`
X
X if valuep-novalue $CAR1
X then
X V=`value $CAR1`
X case "`car $V`" in
X "#macro")
X #lets next lambda-compile-1 fall through, hence the exec
echo "lambda-compile-1 compiling a macro" >&2
X MACFORM=`apply $V $CDR1`
X exec lambda-compile-1 $MACFORM $FILE $LLIST;;
X esac
X fi
X COMMAND=`lambda-compile-1 $CAR1 $FILE $LLIST`
X
X LIST=`lambda-compile-list $CDR1 $FILE $LLIST`
X
X echo "$VARIABLE2=\`compiled-name \${$COMMAND}\`" >>$FILE
X echo "$VARIABLE=\`\${$VARIABLE2} $LIST\`" |
X sed 's/#/$/g' >>$FILE ;;
esac
exec echo "$VARIABLE"
SHAR_EOF
$shar_touch -am 0718005399 'lambda-compile-1' &&
chmod 0764 'lambda-compile-1' ||
$echo 'restore of' 'lambda-compile-1' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lambda-compile-1:' 'MD5 check failed'
ad4d759acca1ad24d036b17de4e67325 lambda-compile-1
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lambda-compile-1'`"
test 3014 -eq "$shar_count" ||
$echo 'lambda-compile-1:' 'original size' '3014,' 'current size' "$shar_count!"
fi
fi
# ============= lambda-compile-1.old ==============
if test -f 'lambda-compile-1.old' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lambda-compile-1.old' '(file already exists)'
else
$echo 'x -' extracting 'lambda-compile-1.old' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lambda-compile-1.old' &&
#!/bin/ash
X
#lambda-compile-1: version number 2
#$1 is the form being compiled
#$2 is the file where all this is going
#$3 is the list of all symbols to be enterpreted locally
#$4, if it exists, signifies the label for lambda - clumsy magic
X
#note - anything which would be preserved by a garbage collector shows
#as a raw integer immediately following an = sign or the word "value"
#of the word '$SHIPS/setxxx' (unexpanded) in the file
X
echo lambda-compile-1 $* >&2
X
FORM=$1
FILE=$2
LLIST=$3
VARIABLE=`lambda-variable`
X
CAR1="`car $FORM`"
case "$CAR1" in
#if symbol is in the local environment,
#returns its name as the name of the variable, not VARIABLE
"#symbol")
X if member-novalue $FORM $LLIST
X then
X exec pname-safe $FORM
X else
X echo "$VARIABLE=\`\$SHIPS/value $FORM\`" >>$FILE
X fi ;;
"#"*)
X echo "$VARIABLE=$FORM" >>$FILE;;
#quote
3)
X echo "$VARIABLE=`cadr $FORM`" >>$FILE;;
#setq
4)
X CADDR1="`caddr $FORM`"
X echo "$VARIABLE=\`\$SHIPS/setxxx `cadr $FORM` \${`lambda-compile-1 $CADDR1 $FILE $LLIST`}\`" >>$FILE ;;
#lambda
#very clever - compiled function modifies a premade template function
#probably wont work
5)
X CADR1="`cadr $FORM`"
X CADDR1="`caddr $FORM`"
X case "$4" in
X "")
X NEWLIST=$LLIST ;;
X *)
X NEWLIST=`cons $4 $LLIST` ;;
X esac
X FUNCTION=`lambda-compile $CADR1 $CADDR1 $NEWLIST`
X echo "$VARIABLE=\`\$SHIPS/compiled-make-unique temporary\`" >>$FILE
X echo "NEWFILE=\`\$SHIPS/compiled-name \${$VARIABLE}\`" >>$FILE
X case $4 in
X "")
X echo "echo -n >\$NEWFILE" >>$FILE ;;
X *)
X echo "echo `pname-safe $4`=\${$VARIABLE} >\$NEWFILE" >>$FILE ;;
X esac
X while notnull $LLIST
X do
X CARL=`car $LLIST`
X PNAME=`pname-safe $CARL`
X echo "echo ${PNAME}=\${$PNAME} >>\$NEWFILE" >>$FILE
X LLIST=`cdr $LLIST`
X done
X echo "DUMMY=$FUNCTION" >>$FILE
X echo "cat `compiled-name $FUNCTION` >>\$NEWFILE" >>$FILE
X echo "chmod u+x \$NEWFILE" >>$FILE ;;
X
#label
#returns the result of lambda rather than the current variable-hence exec
6)
X LABEL="`cadr $FORM`"
X LEXPR="`caddr $FORM`"
X exec lambda-compile-1 $LEXPR $FILE $LLIST $LABEL ;;
X
#cond
7)
X exec lambda-compile-cond `cadr $FORM` $FILE $LLIST $VARIABLE ;;
#defun
8)
X LABEL=`cadr $FORM`
X CDDR1=`cddr $FORM`
X LEXPR=`cons 5 $CDDR1`
X LABELEXPR=`list 6 $LABEL $LEXPR`
X echo "\$SHIPS/setxxx $LABEL \${`lambda-compile-1 $LABELEXPR $FILE $LLIST`} >/dev/null" >>$FILE
X echo "$VARIABLE=$LABEL" >>$FILE ;;
#a fucntion call
*)
X CDR1="`cdr $FORM`"
X
X VARIABLE2=`lambda-variable`
X
X COMMAND=`lambda-compile-1 $CAR1 $FILE $LLIST`
X LIST=`lambda-compile-list $CDR1 $FILE $LLIST`
X
X echo "$VARIABLE2=\`compiled-name \${$COMMAND}\`" >>$FILE
X echo "$VARIABLE=\`\${$VARIABLE2} $LIST\`" |
X sed 's/#/$/g' >>$FILE ;;
esac
exec echo "$VARIABLE"
SHAR_EOF
$shar_touch -am 0601183399 'lambda-compile-1.old' &&
chmod 0764 'lambda-compile-1.old' ||
$echo 'restore of' 'lambda-compile-1.old' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lambda-compile-1.old:' 'MD5 check failed'
9c366e3a3ca3630058cfa926f53c3e56 lambda-compile-1.old
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lambda-compile-1.old'`"
test 2667 -eq "$shar_count" ||
$echo 'lambda-compile-1.old:' 'original size' '2667,' 'current size' "$shar_count!"
fi
fi
# ============= lambda-compile-cond ==============
if test -f 'lambda-compile-cond' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lambda-compile-cond' '(file already exists)'
else
$echo 'x -' extracting 'lambda-compile-cond' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lambda-compile-cond' &&
#!/bin/ash
X
#lambda-compile-cond: daughter function of lambda-compile-1
X
#$1 is argument to cond
#$2 and $3 are as in lambda-compile-1
X
echo lambda-compile-cond $* >&2
X
ARGS=$1
SWITCH=if
VARIABLE=`lambda-variable`
X
while notatom $ARGS >/dev/null
do
X CAAR1=`caar $ARGS`
X CADAR1=`cadar $ARGS`
X echo lambda-compile-cond CAAR1 = $CAAR1, CADAR1 = $CADAR1 >&2
X echo "$SWITCH" >>$2
X echo "notnull \${`lambda-compile-1 $CAAR1 $2 $3`}" >>$2
X echo "then" >>$2
X echo "$VARIABLE=\${`lambda-compile-1 $CADAR1 $2 $3`}" >>$2
X SWITCH="elif"
X ARGS=`cdr $ARGS`
done
echo "fi" >>$2
exec echo $VARIABLE
SHAR_EOF
$shar_touch -am 0531084799 'lambda-compile-cond' &&
chmod 0764 'lambda-compile-cond' ||
$echo 'restore of' 'lambda-compile-cond' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lambda-compile-cond:' 'MD5 check failed'
b77eb471ec4e510c9915c9599587693e lambda-compile-cond
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lambda-compile-cond'`"
test 583 -eq "$shar_count" ||
$echo 'lambda-compile-cond:' 'original size' '583,' 'current size' "$shar_count!"
fi
fi
# ============= lambda-compile-list ==============
if test -f 'lambda-compile-list' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lambda-compile-list' '(file already exists)'
else
$echo 'x -' extracting 'lambda-compile-list' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lambda-compile-list' &&
#!/bin/ash
X
#lambda-compile-list: daughter function of lambda-compile-1
#returns a character string which is an argument list, with all
#the arguments starting with the character #
#this is for eventual replacement with $, and to avoid shell magic
#$1 $2 $3 same as for lambda-compile
X
echo lambda-compile-list $* >&2
X
ARGS="$1"
while case "$ARGS" in
X 1) false ;;
X *) true ;;
X esac
do
X CAR1="`car $ARGS`"
X ARGLINE="$ARGLINE #`lambda-compile-1 $CAR1 $2 $3`"
X ARGS="`cdr $ARGS`"
done
exec echo "$ARGLINE"
SHAR_EOF
$shar_touch -am 0531084799 'lambda-compile-list' &&
chmod 0764 'lambda-compile-list' ||
$echo 'restore of' 'lambda-compile-list' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lambda-compile-list:' 'MD5 check failed'
f7b342309ddd5f646f48e103a55953a2 lambda-compile-list
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lambda-compile-list'`"
test 518 -eq "$shar_count" ||
$echo 'lambda-compile-list:' 'original size' '518,' 'current size' "$shar_count!"
fi
fi
# ============= lambda-variable ==============
if test -f 'lambda-variable' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lambda-variable' '(file already exists)'
else
$echo 'x -' extracting 'lambda-variable' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lambda-variable' &&
#!/bin/ash
X
#lambda-variable: returns a character string unique since initialization
#said string can be used as a shell variable
X
FILE=$SHIPS/numfile
NUMBER=`cat $FILE`
echo -n `expr $NUMBER + 1` >$FILE
exec echo VAR${NUMBER}
SHAR_EOF
$shar_touch -am 0531084799 'lambda-variable' &&
chmod 0764 'lambda-variable' ||
$echo 'restore of' 'lambda-variable' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lambda-variable:' 'MD5 check failed'
edc5866e0143be3948b547f6f4beed2d lambda-variable
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lambda-variable'`"
test 227 -eq "$shar_count" ||
$echo 'lambda-variable:' 'original size' '227,' 'current size' "$shar_count!"
fi
fi
# ============= lambda-variable-initialize ==============
if test -f 'lambda-variable-initialize' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lambda-variable-initialize' '(file already exists)'
else
$echo 'x -' extracting 'lambda-variable-initialize' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lambda-variable-initialize' &&
#!/bin/ash
X
#lambda-variable-initialize: sets the number in the number file to 0
X
FILE=$SHIPS/numfile
exec echo -n 0 >$FILE
SHAR_EOF
$shar_touch -am 0531084799 'lambda-variable-initialize' &&
chmod 0764 'lambda-variable-initialize' ||
$echo 'restore of' 'lambda-variable-initialize' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lambda-variable-initialize:' 'MD5 check failed'
7ad0d23ce07769e0519f9b4c9fa20fa0 lambda-variable-initialize
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lambda-variable-initialize'`"
test 124 -eq "$shar_count" ||
$echo 'lambda-variable-initialize:' 'original size' '124,' 'current size' "$shar_count!"
fi
fi
# ============= length ==============
if test -f 'length' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'length' '(file already exists)'
else
$echo 'x -' extracting 'length' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'length' &&
#!/bin/ash
X
#length: length of list $1, not counting possigle ( ... . atom) at end
X
exec integer-make `length-1 $1`
SHAR_EOF
$shar_touch -am 0512203099 'length' &&
chmod 0764 'length' ||
$echo 'restore of' 'length' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'length:' 'MD5 check failed'
6fa3b727e0a04bf10fbfaf0734398dbf length
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'length'`"
test 116 -eq "$shar_count" ||
$echo 'length:' 'original size' '116,' 'current size' "$shar_count!"
fi
fi
# ============= length-1 ==============
if test -f 'length-1' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'length-1' '(file already exists)'
else
$echo 'x -' extracting 'length-1' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'length-1' &&
#!/bin/ash
X
#length-1: daughter function of make
#$1 is a list
X
if atom-novalue $1
then
X exec echo 0
else
X CDR1=`cdr $1`
X exec expr `length-1 $CDR1` + 1
fi
SHAR_EOF
$shar_touch -am 0514174699 'length-1' &&
chmod 0764 'length-1' ||
$echo 'restore of' 'length-1' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'length-1:' 'MD5 check failed'
7d1f1bb0185ecbd7a983577706797f0c length-1
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'length-1'`"
test 156 -eq "$shar_count" ||
$echo 'length-1:' 'original size' '156,' 'current size' "$shar_count!"
fi
fi
# ============= list ==============
if test -f 'list' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'list' '(file already exists)'
else
$echo 'x -' extracting 'list' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'list' &&
#!/bin/ash
X
#list: as defined in McCarty 1960
X
#recursive way, using newly discovered shift command
#this is, for some reason, (comparatively) very fast
X
if [ $# = 0 ]
then
X exec echo 1
else
X exec cons $1 `shift ; list $*`
fi
SHAR_EOF
$shar_touch -am 0514172499 'list' &&
chmod 0764 'list' ||
$echo 'restore of' 'list' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'list:' 'MD5 check failed'
01037cb68da93197418654d450304c89 list
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'list'`"
test 226 -eq "$shar_count" ||
$echo 'list:' 'original size' '226,' 'current size' "$shar_count!"
fi
fi
# ============= listp ==============
if test -f 'listp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'listp' '(file already exists)'
else
$echo 'x -' extracting 'listp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'listp' &&
#!/bin/ash
X
#listp: predicates listiness over $1
X
#echo '$1' = "$1" >&2
case "$1" in
1)
X exec echo 2 ;;
*)
X case "`car $1`" in
X "#"*)
X exec echo 1 ;;
X *)
X exec listp "`cdr $1`" ;;
X esac ;;
esac
SHAR_EOF
$shar_touch -am 0601220799 'listp' &&
chmod 0764 'listp' ||
$echo 'restore of' 'listp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'listp:' 'MD5 check failed'
66f3399e5bd3ea29cc91e6699b0932c1 listp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'listp'`"
test 196 -eq "$shar_count" ||
$echo 'listp:' 'original size' '196,' 'current size' "$shar_count!"
fi
fi
# ============= listp-novalue ==============
if test -f 'listp-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'listp-novalue' '(file already exists)'
else
$echo 'x -' extracting 'listp-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'listp-novalue' &&
#!/bin/ash
X
#listp-novalue: predicates listiness over $1
X
#echo '$1' = "$1" >&2
case "$1" in
1)
X exec true ;;
*)
X case "`car $1`" in
X "#"*)
X exec false ;;
X *)
X exec listp-novalue "`cdr $1`" ;;
X esac ;;
esac
SHAR_EOF
$shar_touch -am 0601221899 'listp-novalue' &&
chmod 0764 'listp-novalue' ||
$echo 'restore of' 'listp-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'listp-novalue:' 'MD5 check failed'
e1c07c6a5fff43dd400b3a9814fb5e2b listp-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'listp-novalue'`"
test 209 -eq "$shar_count" ||
$echo 'listp-novalue:' 'original size' '209,' 'current size' "$shar_count!"
fi
fi
# ============= lock-dc-fifo ==============
if test -f 'lock-dc-fifo' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'lock-dc-fifo' '(file already exists)'
else
$echo 'x -' extracting 'lock-dc-fifo' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'lock-dc-fifo' &&
#!/bin/ash
X
#creates a fifo, reads from it and sends what it sees to dc
#prints name of fifo it creates to stderr
#just leaves all the junk files around
X
#havent decided whether to use this or expr for arithmetic
#this is certainly more robust
X
#there's something wrong with the ash test command, hence the
#full thingymabob
X
FNAME=$SHIPS/dc-fifo.$$
X
while /usr/bin/test -e $FNAME
do
X FNAME=$FNAME.$$
done
X
mkfifo $FNAME
echo $FNAME >&2
X
while cat $FNAME
do
done | dc
SHAR_EOF
$shar_touch -am 0510184099 'lock-dc-fifo' &&
chmod 0764 'lock-dc-fifo' ||
$echo 'restore of' 'lock-dc-fifo' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'lock-dc-fifo:' 'MD5 check failed'
d70a96da12c6661f915cbaa316a31dc4 lock-dc-fifo
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'lock-dc-fifo'`"
test 468 -eq "$shar_count" ||
$echo 'lock-dc-fifo:' 'original size' '468,' 'current size' "$shar_count!"
fi
fi
# ============= macro-compiled ==============
if test -f 'macro-compiled' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'macro-compiled' '(file already exists)'
else
$echo 'x -' extracting 'macro-compiled' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'macro-compiled' &&
#!/bin/ash
X
#macro-compiled: destructively converts a compiled to a macro
#returns the (changed) function
X
case "`car $1`" in
"#compiled")
X exec rplaca $1 "#macro" ;;
*)
X complain "$0: first argument must be compiled function" ;;
esac
SHAR_EOF
$shar_touch -am 0621220299 'macro-compiled' &&
chmod 0764 'macro-compiled' ||
$echo 'restore of' 'macro-compiled' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'macro-compiled:' 'MD5 check failed'
5c9d7a641be07adefca74e7999b20b3b macro-compiled
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'macro-compiled'`"
test 235 -eq "$shar_count" ||
$echo 'macro-compiled:' 'original size' '235,' 'current size' "$shar_count!"
fi
fi
# ============= macro-make ==============
if test -f 'macro-make' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'macro-make' '(file already exists)'
else
$echo 'x -' extracting 'macro-make' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'macro-make' &&
#!/bin/ash
X
#macro-make: low-level stuff
#$1 is a character string
#returns a macro-function which is described by the program
#$1
X
exec cons "#macro" "$1"
SHAR_EOF
$shar_touch -am 0621214399 'macro-make' &&
chmod 0764 'macro-make' ||
$echo 'restore of' 'macro-make' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'macro-make:' 'MD5 check failed'
82f71f6926e2831a41c3477260abd1a0 macro-make
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'macro-make'`"
test 156 -eq "$shar_count" ||
$echo 'macro-make:' 'original size' '156,' 'current size' "$shar_count!"
fi
fi
# ============= macro-setq ==============
if test -f 'macro-setq' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'macro-setq' '(file already exists)'
else
$echo 'x -' extracting 'macro-setq' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'macro-setq' &&
#!/bin/ash
X
#macro-setq: a conveniance function
#$1 and $2 are character-strings
#sets the symbol with pname=$1 to the macro described
#by the file $2
X
exec setq "$1" `macro-make "$2"`
SHAR_EOF
$shar_touch -am 0621214399 'macro-setq' &&
chmod 0764 'macro-setq' ||
$echo 'restore of' 'macro-setq' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'macro-setq:' 'MD5 check failed'
e6691342bd26941a2d38849016f787fa macro-setq
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'macro-setq'`"
test 186 -eq "$shar_count" ||
$echo 'macro-setq:' 'original size' '186,' 'current size' "$shar_count!"
fi
fi
# ============= macrodef ==============
if test -f 'macrodef' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'macrodef' '(file already exists)'
else
$echo 'x -' extracting 'macrodef' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'macrodef' &&
#!/bin/ash
SHAR_EOF
$shar_touch -am 0621214399 'macrodef' &&
chmod 0764 'macrodef' ||
$echo 'restore of' 'macrodef' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'macrodef:' 'MD5 check failed'
a351cfcf9052bed070f8af6d238d5114 macrodef
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'macrodef'`"
test 11 -eq "$shar_count" ||
$echo 'macrodef:' 'original size' '11,' 'current size' "$shar_count!"
fi
fi
# ============= macrop ==============
if test -f 'macrop' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'macrop' '(file already exists)'
else
$echo 'x -' extracting 'macrop' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'macrop' &&
#!/bin/ash
X
#macrop: predicates macroness over $1
X
case "`car $1`" in
"#macro")
X exec echo 2;;
*)
X exec echo 1;;
esac
SHAR_EOF
$shar_touch -am 0621214399 'macrop' &&
chmod 0764 'macrop' ||
$echo 'restore of' 'macrop' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'macrop:' 'MD5 check failed'
011bdda90cc966271db9a0ebc90db82a macrop
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'macrop'`"
test 118 -eq "$shar_count" ||
$echo 'macrop:' 'original size' '118,' 'current size' "$shar_count!"
fi
fi
# ============= makeimage ==============
if test -f 'makeimage' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'makeimage' '(file already exists)'
else
$echo 'x -' extracting 'makeimage' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'makeimage' &&
mv $SHIPS/image /tmp/image.$$
mv $SHIPS/sspace /tmp/sspace.$$
echo '#n
#t
#quote
#setq
#lambda
#label
#cond
#defun '>$SHIPS/image
echo -n >$SHIPS/sspace
compiled-setq AMONG $SHIPS/among
compiled-setq APPEND $SHIPS/append
compiled-setq APPLY $SHIPS/apply
compiled-setq ATOM $SHIPS/atom
compiled-setq BACKWARD $SHIPS/backward
compiled-setq BACKWARD-LIST $SHIPS/backward-list
compiled-setq CAAAR $SHIPS/caaar
compiled-setq CAADR $SHIPS/caadr
compiled-setq CAAR $SHIPS/caar
compiled-setq CADAR $SHIPS/cadar
compiled-setq CADDR $SHIPS/caddr
compiled-setq CADR $SHIPS/cadr
compiled-setq CAR $SHIPS/car
compiled-setq CDAAR $SHIPS/cdaar
compiled-setq CDADR $SHIPS/cdadr
compiled-setq CDAR $SHIPS/cdar
compiled-setq CDDAR $SHIPS/cddar
compiled-setq CDDDR $SHIPS/cdddr
compiled-setq CDDR $SHIPS/cddr
compiled-setq CDR $SHIPS/cdr
compiled-setq COMPILEDP $SHIPS/compiledp
compiled-setq COMPLAIN $SHIPS/complain
compiled-setq COND $SHIPS/cond
compiled-setq CONS $SHIPS/cons
compiled-setq CONSTANTP $SHIPS/constantp
compiled-setq EQ $SHIPS/eq
compiled-setq EQUAL $SHIPS/equal
compiled-setq EQUAL-SLOW $SHIPS/equal-slow
compiled-setq EVLIS $SHIPS/evlis
compiled-setq FF $SHIPS/ff
compiled-setq FFSILLY $SHIPS/ffsilly
compiled-setq LIST $SHIPS/list
compiled-setq LIST-SILLY $SHIPS/list-silly
compiled-setq NULL $SHIPS/null
compiled-setq PAIRS $SHIPS/pairs
compiled-setq PRINT $SHIPS/print
compiled-setq ROBUST-CAR $SHIPS/car
compiled-setq ROBUST-CDR $SHIPS/cdr
compiled-setq RPLACA $SHIPS/rplaca
compiled-setq RPLACD $SHIPS/rplacd
compiled-setq SETQ $SHIPS/setq
compiled-setq SI $SHIPS/si
compiled-setq SPACE $SHIPS/space
compiled-setq SSPACE $SHIPS/sspace
compiled-setq SUBST $SHIPS/subst
compiled-setq SYMBOLP $SHIPS/symbolp
compiled-setq VALUE $SHIPS/value
compiled-setq SET $SHIPS/setxxx
compiled-setq READ $SHIPS/readxxx
compiled-setq EVAL $SHIPS/evalxxx
compiled-setq LAMBDA-COMPILE $SHIPS/lambda-compile
compiled-setq SYMBOLS $SHIPS/symbols
compiled-setq LISTP $SHIPS/listp
compiled-setq SUBLIS $SHIPS/sublis
compiled-setq SUBLIS-DESTRUCTIVE $SHIPS/sublis-destructive
compiled-setq GARBAGE $SHIPS/garbage
compiled-setq PNAME-SAFE $SHIPS/pname-safe
compiled-setq + $SHIPS/plus
compiled-setq - $SHIPS/minus
compiled-setq = $SHIPS/numeq
compiled-setq PROG2 $SHIPS/prog2
compiled-setq PROGN $SHIPS/progn
compiled-setq MEMBER $SHIPS/member
compiled-setq \> $SHIPS/greater-than
compiled-setq MACRO-COMPILED $SHIPS/macro-compiled
compiled-setq MACROP $SHIPS/macrop
X
ships.run.once <$SHIPS/progs/useful.ships
SHAR_EOF
$shar_touch -am 0621223199 'makeimage' &&
chmod 0764 'makeimage' ||
$echo 'restore of' 'makeimage' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'makeimage:' 'MD5 check failed'
304f6eb0a6ee33e07221878f952b47ba makeimage
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'makeimage'`"
test 2499 -eq "$shar_count" ||
$echo 'makeimage:' 'original size' '2499,' 'current size' "$shar_count!"
fi
fi
# ============= member ==============
if test -f 'member' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'member' '(file already exists)'
else
$echo 'x -' extracting 'member' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'member' &&
#!/bin/ash
X
#member: $1 is a member of list $2 - test is eq
#$1 is a an s-expr - anything other than an atom doesnt make much sense
#$2 is a list
#uses eq as test
X
if null-novalue $2
then
X exec echo 1
elif atom-novalue $2
then
X complain "$0: second argument is not a list"
else
X case $1 in
X "`car $2`")
X exec echo 2 ;;
X *)
X exec member $1 "`cdr $2`" ;;
X esac
fi
SHAR_EOF
$shar_touch -am 0524211299 'member' &&
chmod 0764 'member' ||
$echo 'restore of' 'member' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'member:' 'MD5 check failed'
9111d07bb0e33bf3eac0554a8489a42d member
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'member'`"
test 365 -eq "$shar_count" ||
$echo 'member:' 'original size' '365,' 'current size' "$shar_count!"
fi
fi
# ============= member-novalue ==============
if test -f 'member-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'member-novalue' '(file already exists)'
else
$echo 'x -' extracting 'member-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'member-novalue' &&
#!/bin/ash
X
#member-novalue: $1 is a member of list $2 - test is eq
#$1 is a an s-expr - anything other than an atom doesnt make much sense
#$2 is a list - does not check
#uses eq as test
X
case $2 in
1)
X exec false ;;
*)
X case $1 in
X "`car $2`")
X exec true ;;
X *)
X exec member-novalue $1 "`cdr $2`" ;;
X esac ;;
esac
SHAR_EOF
$shar_touch -am 0524211599 'member-novalue' &&
chmod 0764 'member-novalue' ||
$echo 'restore of' 'member-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'member-novalue:' 'MD5 check failed'
bc8f54ad2a10f12b5be975e45437fec8 member-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'member-novalue'`"
test 319 -eq "$shar_count" ||
$echo 'member-novalue:' 'original size' '319,' 'current size' "$shar_count!"
fi
fi
# ============= minus ==============
if test -f 'minus' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'minus' '(file already exists)'
else
$echo 'x -' extracting 'minus' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'minus' &&
#!/bin/ash
X
#minus: integer subtraction
#checks for integerness
#answers <0 are rounded up to zero (he he he)
X
case $# in
0)
X complain "$0: requires 1+ arguments" ;;
*)
X case "`car $1`" in
X "#integer")
X ELINE=`cdr $1`
X shift ;;
X *)
X complain "$0: arguments must be integers" ;;
X esac
X until [ $# = 0 ]
X do
X case "`car $1`" in
X "#integer")
X ELINE="$ELINE - `cdr $1`"
X shift ;;
X *)
X complain "$0: arguments must be integers" ;;
X esac
X done
X ANSWER=`expr $ELINE`
X case $ANSWER in
X -*)
X exec integer-make 0 ;;
X *)
X exec integer-make $ANSWER ;;
X esac ;;
esac
SHAR_EOF
$shar_touch -am 0601192199 'minus' &&
chmod 0764 'minus' ||
$echo 'restore of' 'minus' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'minus:' 'MD5 check failed'
211552952f946a97fb19d4717b88647b minus
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'minus'`"
test 569 -eq "$shar_count" ||
$echo 'minus:' 'original size' '569,' 'current size' "$shar_count!"
fi
fi
# ============= notatom ==============
if test -f 'notatom' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'notatom' '(file already exists)'
else
$echo 'x -' extracting 'notatom' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'notatom' &&
#!/bin/ash
X
#notatom: conveniance function used by lambda-compile-cond
#uses same convention as atom, does not call it
X
case "`sed -n $1p <$SHIPS/image`" in
"#"*)
X exec false ;;
*)
X exec true ;;
esac
SHAR_EOF
$shar_touch -am 0513224499 'notatom' &&
chmod 0764 'notatom' ||
$echo 'restore of' 'notatom' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'notatom:' 'MD5 check failed'
039b811007e57d646acad7b1808eff5a notatom
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'notatom'`"
test 200 -eq "$shar_count" ||
$echo 'notatom:' 'original size' '200,' 'current size' "$shar_count!"
fi
fi
# ============= notnull ==============
if test -f 'notnull' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'notnull' '(file already exists)'
else
$echo 'x -' extracting 'notnull' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'notnull' &&
#!/bin/ash
X
#notnull: very important function used in compiled functions
#which are created by lambda-compile-cond
X
#$1 is an s-expr
X
case "$1" in
1)
X exec false ;;
*)
X exec true ;;
esac
SHAR_EOF
$shar_touch -am 0513225299 'notnull' &&
chmod 0764 'notnull' ||
$echo 'restore of' 'notnull' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'notnull:' 'MD5 check failed'
57bd3fbed32b218a43fed7b8998d4091 notnull
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'notnull'`"
test 187 -eq "$shar_count" ||
$echo 'notnull:' 'original size' '187,' 'current size' "$shar_count!"
fi
fi
# ============= null ==============
if test -f 'null' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'null' '(file already exists)'
else
$echo 'x -' extracting 'null' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'null' &&
#!/bin/ash
X
#null: as described in McCarthy 1960
X
#$1 is an address
#returns 2 if argument is null
#returns 1 otherwise
X
case $1 in
1) exec echo '2' ;;
*) echo '1' ;;
esac
SHAR_EOF
$shar_touch -am 0514173399 'null' &&
chmod 0764 'null' ||
$echo 'restore of' 'null' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'null:' 'MD5 check failed'
694ba80870d62ed420a890c181cf1d75 null
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'null'`"
test 173 -eq "$shar_count" ||
$echo 'null:' 'original size' '173,' 'current size' "$shar_count!"
fi
fi
# ============= null-novalue ==============
if test -f 'null-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'null-novalue' '(file already exists)'
else
$echo 'x -' extracting 'null-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'null-novalue' &&
#!/bin/ash
X
#null-novalue: for use in shell "if" switches
X
#$1 is an address
#returns true if argument is null
#returns false otherwise
X
case $1 in
1) exec true ;;
*) exec false ;;
esac
SHAR_EOF
$shar_touch -am 0514173399 'null-novalue' &&
chmod 0764 'null-novalue' ||
$echo 'restore of' 'null-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'null-novalue:' 'MD5 check failed'
f103125de92618154c9d74569d2652c8 null-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'null-novalue'`"
test 187 -eq "$shar_count" ||
$echo 'null-novalue:' 'original size' '187,' 'current size' "$shar_count!"
fi
fi
# ============= numeq ==============
if test -f 'numeq' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'numeq' '(file already exists)'
else
$echo 'x -' extracting 'numeq' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'numeq' &&
#!/bin/ash
X
#numeq: the = function: compares 2 integers. Applies eq to non-integers.
#will not work if integers have trailing 0's - oooh
X
case "`car $1`" in
"#integer")
X case "`car $2`" in
X "#integer")
X if [ `cdr $1` = `cdr $2` ]
X then
X exec echo 2
X else
X exec echo 1
X fi ;;
X esac ;;
esac
exec eq $1 $2
SHAR_EOF
$shar_touch -am 0601193999 'numeq' &&
chmod 0764 'numeq' ||
$echo 'restore of' 'numeq' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'numeq:' 'MD5 check failed'
ecd45ff8d094a59f6a6c6064ab6fbce3 numeq
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'numeq'`"
test 312 -eq "$shar_count" ||
$echo 'numeq:' 'original size' '312,' 'current size' "$shar_count!"
fi
fi
# ============= numfile ==============
if test -f 'numfile' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'numfile' '(file already exists)'
else
$echo 'x -' extracting 'numfile' '(binary)'
sed 's/^X//' << 'SHAR_EOF' | uudecode &&
begin 600 numfile
#,30T
`
end
SHAR_EOF
$shar_touch -am 0718010899 'numfile' &&
chmod 0664 'numfile' ||
$echo 'restore of' 'numfile' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'numfile:' 'MD5 check failed'
0a09c8844ba8f0936c20bd791130d6b6 numfile
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'numfile'`"
test 3 -eq "$shar_count" ||
$echo 'numfile:' 'original size' '3,' 'current size' "$shar_count!"
fi
fi
# ============= orderp ==============
if test -f 'orderp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'orderp' '(file already exists)'
else
$echo 'x -' extracting 'orderp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'orderp' &&
#!/bin/ash
X
#orderp: put $1, $2 items in some kind of consistant order
#does _not_ respect integers - yeah yeah
#not currently used
X
if expr $1 \> $2 >>/dev/null
then
X echo 2
else
X echo 1
fi
SHAR_EOF
$shar_touch -am 0606175799 'orderp' &&
chmod 0764 'orderp' ||
$echo 'restore of' 'orderp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'orderp:' 'MD5 check failed'
ab50801a9b3af2a79f943da99fdb053d orderp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'orderp'`"
test 191 -eq "$shar_count" ||
$echo 'orderp:' 'original size' '191,' 'current size' "$shar_count!"
fi
fi
# ============= pairs ==============
if test -f 'pairs' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'pairs' '(file already exists)'
else
$echo 'x -' extracting 'pairs' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'pairs' &&
#!/bin/ash
X
#pairs: makes common-lips (lisp 1.5) style alist out of elements of two lists
#it does not care if the two lists are not the same length
X
#$1 and $2 are addresses
#if $1 and $2 are lists of the form:
#$1=(a1 a2 ... an) and $2=(b1 b2 ... bo)
#returns a list of the following form:
#((a1 . b1) (a2 . b2) ((n < o) ? (an . bn) : (ao . bo)))
#it is robust in regard to demanding that the arguments are lists
X
FOO1=`car $1`
FOO2=`car $2`
case "$FOO1#$FOO2" in
*"##n" | "#n#"*)
X exec echo 1;;
*"#"*"#"*)
X complain "$0: arguments must be lists" ;;
*)
X BAR1=`cdr $1`
X BAR2=`cdr $2`
X exec cons `cons $FOO1 $FOO2` `pairs $BAR1 $BAR2` ;;
esac
SHAR_EOF
$shar_touch -am 0514172699 'pairs' &&
chmod 0764 'pairs' ||
$echo 'restore of' 'pairs' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'pairs:' 'MD5 check failed'
236e7611dad99b900b3e76370a440d0b pairs
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pairs'`"
test 644 -eq "$shar_count" ||
$echo 'pairs:' 'original size' '644,' 'current size' "$shar_count!"
fi
fi
# ============= plus ==============
if test -f 'plus' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'plus' '(file already exists)'
else
$echo 'x -' extracting 'plus' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'plus' &&
#!/bin/ash
X
#plus: integer addition any number of arguments
#checks for integerness
#expected to be very slow
X
ELINE=0
until [ $# = 0 ]
do
X case "`car $1`" in
X "#integer")
X ELINE="$ELINE + `cdr $1`"
X shift ;;
X *)
X complain "$0: arguments must be integers" ;;
X esac
done
exec integer-make `expr $ELINE`
SHAR_EOF
$shar_touch -am 0601191799 'plus' &&
chmod 0764 'plus' ||
$echo 'restore of' 'plus' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'plus:' 'MD5 check failed'
8b339b85947977561d7ebc2ea74452f3 plus
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'plus'`"
test 305 -eq "$shar_count" ||
$echo 'plus:' 'original size' '305,' 'current size' "$shar_count!"
fi
fi
# ============= pname ==============
if test -f 'pname' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'pname' '(file already exists)'
else
$echo 'x -' extracting 'pname' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'pname' &&
#!/bin/ash
X
#pname: middle-level stuff
#$1 is a symbol
#returns the character-string pname of symbol
X
#is robust in demanding $1 be a symbol
X
if symbolp-novalue $1
then
X exec symbol-pname `cdr $1`
else
X complain "$0: $1 is not a symbol!"
fi
SHAR_EOF
$shar_touch -am 0514175099 'pname' &&
chmod 0764 'pname' ||
$echo 'restore of' 'pname' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'pname:' 'MD5 check failed'
5beb6cdb8006170f49c6c8bfc2ed50cc pname
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pname'`"
test 241 -eq "$shar_count" ||
$echo 'pname:' 'original size' '241,' 'current size' "$shar_count!"
fi
fi
# ============= pname-safe ==============
if test -f 'pname-safe' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'pname-safe' '(file already exists)'
else
$echo 'x -' extracting 'pname-safe' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'pname-safe' &&
#!/bin/ash
X
#pname-safe: returns pname with hyphen swithced to h
#clearly, there is room for abuse here, but only if
#lower-case characters are allowed
X
pname $1 | sed 's/-/h/g
s/+/p/g
s/>/g/g
s/</l/g'
SHAR_EOF
$shar_touch -am 0606181299 'pname-safe' &&
chmod 0764 'pname-safe' ||
$echo 'restore of' 'pname-safe' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'pname-safe:' 'MD5 check failed'
719ec49492a09b0bef4fde685364d276 pname-safe
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'pname-safe'`"
test 202 -eq "$shar_count" ||
$echo 'pname-safe:' 'original size' '202,' 'current size' "$shar_count!"
fi
fi
# ============= print ==============
if test -f 'print' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'print' '(file already exists)'
else
$echo 'x -' extracting 'print' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'print' &&
#!/bin/ash
X
#print: prints to stderr
X
#perpahs a little early to be writing this
#but it will make everything so easy
#expects the image to be error-free
#returns $1
X
#echo "print $1" >&2
X
#$1 in an address
#prints the s-expr at $1
X
if atom-novalue $1
then
X print-atom $1 >&2
else
X echo -n "( " >&2
X print-cons $1 >&2
fi
echo >&2
exec echo $1
SHAR_EOF
$shar_touch -am 0514174699 'print' &&
chmod 0764 'print' ||
$echo 'restore of' 'print' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'print:' 'MD5 check failed'
3c2631b32ff8dc960b89e8993943dd73 print
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'print'`"
test 343 -eq "$shar_count" ||
$echo 'print:' 'original size' '343,' 'current size' "$shar_count!"
fi
fi
# ============= print-atom ==============
if test -f 'print-atom' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'print-atom' '(file already exists)'
else
$echo 'x -' extracting 'print-atom' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'print-atom' &&
#!/bin/ash
X
#print-atom: daughter funciton of print, print_car, print_cdr
#for speed (?), assumes knowledge of any given conventions
#this is clearly "the wrong way", but more on that later
#does not call various predicates
#note - each printed item must have a space at the end
#the use of exec doesnt allow a echo -n " " command at the bottom
X
#echo "print-atom $1" >&2
X
#$1 is an address
#prints it as if it were an atom
X
case "`car $1`" in
"#n") echo -n "NIL " ;;
"#t") echo -n "T ";;
"#integer") exec echo -n "`cdr $1` " ;;
"#symbol") HAPPY=`cdr $1`
X exec echo -n "`symbol-pname $HAPPY` " ;;
"#compiled") exec echo -n "#<COMPILED-FUNCTION:`compiled-name $1`># " ;;
"#quote") exec echo -n "QUOTE " ;;
"#setq") exec echo -n "SETQ " ;;
"#label") exec echo -n "LABEL " ;;
"#lambda") exec echo -n "LAMBDA " ;;
"#cond") exec echo -n "COND " ;;
"#defun") exec echo -n "DEFUN " ;;
"#argument") exec echo -n "#<LAMBDA-ARGUMENT:`cdr $1`
***You are using an image from an old version of SHIPS***># " ;;
"#macro") exec echo -n "#<MACRO: `compiled-name $1`># " ;;
esac
SHAR_EOF
$shar_touch -am 0621222299 'print-atom' &&
chmod 0764 'print-atom' ||
$echo 'restore of' 'print-atom' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'print-atom:' 'MD5 check failed'
bfc4f30845b63269f2c5d0acf5d201a8 print-atom
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'print-atom'`"
test 1064 -eq "$shar_count" ||
$echo 'print-atom:' 'original size' '1064,' 'current size' "$shar_count!"
fi
fi
# ============= print-car ==============
if test -f 'print-car' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'print-car' '(file already exists)'
else
$echo 'x -' extracting 'print-car' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'print-car' &&
#!/bin/ash
X
#print-car: daughter function of print-cons
X
#echo "print-car $1" >&2
X
#$1 an address
#prints it as if it were the car of a cons
X
if atom-novalue $1
then
X exec print-atom $1
else
X echo -n "( "
X exec print-cons $1
fi
SHAR_EOF
$shar_touch -am 0514174699 'print-car' &&
chmod 0764 'print-car' ||
$echo 'restore of' 'print-car' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'print-car:' 'MD5 check failed'
b913a3b9e1d463a740cae6b966face6a print-car
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'print-car'`"
test 228 -eq "$shar_count" ||
$echo 'print-car:' 'original size' '228,' 'current size' "$shar_count!"
fi
fi
# ============= print-cdr ==============
if test -f 'print-cdr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'print-cdr' '(file already exists)'
else
$echo 'x -' extracting 'print-cdr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'print-cdr' &&
#!/bin/ash
X
#print-cdr: daughter function of print-cons
#prints $1 as if it were a cdr
X
#echo "print-cdr $1" >&2
X
case "`car $1`" in
"#n")
X exec echo -n ") " ;;
"#"*)
X echo -n ". "
X print-atom $1
X exec echo -n ") " ;;
*)
X exec print-cons $1
esac
SHAR_EOF
$shar_touch -am 0513212999 'print-cdr' &&
chmod 0764 'print-cdr' ||
$echo 'restore of' 'print-cdr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'print-cdr:' 'MD5 check failed'
d9105d2485ed12a69bf9b00e07c66224 print-cdr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'print-cdr'`"
test 246 -eq "$shar_count" ||
$echo 'print-cdr:' 'original size' '246,' 'current size' "$shar_count!"
fi
fi
# ============= print-cons ==============
if test -f 'print-cons' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'print-cons' '(file already exists)'
else
$echo 'x -' extracting 'print-cons' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'print-cons' &&
#!/bin/ash
X
#print-cons: daughter function of print
#invented to reduce unneeded atom testing
X
#echo "print-cons $1" >&2
X
#$1 is an address
#$1 gets printed as if it were a cons
X
print-car `car $1`
exec print-cdr `cdr $1`
SHAR_EOF
$shar_touch -am 0513212999 'print-cons' &&
chmod 0764 'print-cons' ||
$echo 'restore of' 'print-cons' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'print-cons:' 'MD5 check failed'
d5314138bf4aef164fced4e49b060c9f print-cons
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'print-cons'`"
test 222 -eq "$shar_count" ||
$echo 'print-cons:' 'original size' '222,' 'current size' "$shar_count!"
fi
fi
# ============= prog2 ==============
if test -f 'prog2' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'prog2' '(file already exists)'
else
$echo 'x -' extracting 'prog2' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'prog2' &&
#!/bin/ash
X
#prog2: returns the second argument
X
exec echo ${2}
SHAR_EOF
$shar_touch -am 0601203899 'prog2' &&
chmod 0764 'prog2' ||
$echo 'restore of' 'prog2' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'prog2:' 'MD5 check failed'
9f4dfde662b19834b7356489a1782181 prog2
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'prog2'`"
test 64 -eq "$shar_count" ||
$echo 'prog2:' 'original size' '64,' 'current size' "$shar_count!"
fi
fi
# ============= progn ==============
if test -f 'progn' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'progn' '(file already exists)'
else
$echo 'x -' extracting 'progn' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'progn' &&
#!/bin/ash
X
#progn: returns the last argument
#returns true if given no arguments
X
case $# in
0)
X exec echo 2;;
esac
until [ $# = 1 ]
do
X shift
done
X
exec echo $1
SHAR_EOF
$shar_touch -am 0601204799 'progn' &&
chmod 0764 'progn' ||
$echo 'restore of' 'progn' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'progn:' 'MD5 check failed'
51b9fa8aeb0e5d2f488cb663cdc6b964 progn
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'progn'`"
test 163 -eq "$shar_count" ||
$echo 'progn:' 'original size' '163,' 'current size' "$shar_count!"
fi
fi
# ============= progs/useful.ships ==============
if test ! -d 'progs'; then
$echo 'x -' 'creating directory' 'progs'
mkdir 'progs'
fi
if test -f 'progs/useful.ships' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'progs/useful.ships' '(file already exists)'
else
$echo 'x -' extracting 'progs/useful.ships' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'progs/useful.ships' &&
(defun mapcar (f l)
(cond (((null l) nil)
X (t (cons (f (car l)) (mapcar f (cdr l)))))))
X
;;;macros! very important.
;;;between eval and lambda-compile-1, ships knows how to use macros
;;;but without these, ships doesnt know how to make them
X
(defun defmacro (name arglist form)
X (list 'macro-compiled
X (list 'value
X (list 'defun name arglist form))))
;;;As we speak, defun returns a symbol. I think this is a poor choice.
X
(macro-compiled defmacro)
X
(defmacro if (a b c)
X (list 'cond (list (list a b) (list t c))))
X
(defmacro let (letlist form)
X (cons (list 'lambda (mapcar car letlist) form) (mapcar cadr letlist)))
X
(defmacro and (a b) (list 'cond (list (list a b) (list t nil))))
X
(defmacro or (a b)
X (list 'let (list (list 'happy a))
X (list 'cond (list (list 'happy 'happy) (list t b)))))
SHAR_EOF
$shar_touch -am 0718001299 'progs/useful.ships' &&
chmod 0664 'progs/useful.ships' ||
$echo 'restore of' 'progs/useful.ships' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'progs/useful.ships:' 'MD5 check failed'
451fec5fe55f5e22bb31a3f83fa90038 progs/useful.ships
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'progs/useful.ships'`"
test 805 -eq "$shar_count" ||
$echo 'progs/useful.ships:' 'original size' '805,' 'current size' "$shar_count!"
fi
fi
# ============= progs/fib.ships ==============
if test -f 'progs/fib.ships' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'progs/fib.ships' '(file already exists)'
else
$echo 'x -' extracting 'progs/fib.ships' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'progs/fib.ships' &&
(defun fib-list (n)
(cond (((= n 0) 0)
X (t (cons 0 (fib-list-1 0 1 n))))))
X
(defun fib-list-1 (f s n)
(cond (((= n 1) (list s))
X (t (cons s (fib-list-1 s (+ f s) (- n 1)))))))
X
SHAR_EOF
$shar_touch -am 0601202199 'progs/fib.ships' &&
chmod 0664 'progs/fib.ships' ||
$echo 'restore of' 'progs/fib.ships' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'progs/fib.ships:' 'MD5 check failed'
b7b05ea9f73fa774efc88facd5f38834 progs/fib.ships
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'progs/fib.ships'`"
test 189 -eq "$shar_count" ||
$echo 'progs/fib.ships:' 'original size' '189,' 'current size' "$shar_count!"
fi
fi
# ============= progs/integer.ships ==============
if test -f 'progs/integer.ships' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'progs/integer.ships' '(file already exists)'
else
$echo 'x -' extracting 'progs/integer.ships' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'progs/integer.ships' &&
X
;; an integer is represented as '(+/- . x)
;; where '+ means positive, '- means negative, and x is a whole number
X
(defun switch (x y)
(cond (((eq x '-) (switch-1 y))
X (t y))))
X
(defun switch-1 (y)
(cond (((eq y '+) '-)
X (t '+))))
X
(defun int+ (x y)
(cond (((> (cdr x) (cdr y)) (int+-1 x y))
X (t (int+-1 y x)))))
X
(defun int+-1 (x y)
(cons (car x) ((value (switch (car x) (car y))) (cdr x) (cdr y))))
X
(defun int> (x y)
(cond (((eq (car x) '+)
X (cond (((eq (car y) '+) (> (cdr x) (cdr y)))
X (t t))))
X (t
X (cond (((eq (car y) '-) (> (cdr y) (cdr x)))
X (t nil))))))))
SHAR_EOF
$shar_touch -am 0606183999 'progs/integer.ships' &&
chmod 0664 'progs/integer.ships' ||
$echo 'restore of' 'progs/integer.ships' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'progs/integer.ships:' 'MD5 check failed'
0b02d047993da4821adf7d7696b9fbd0 progs/integer.ships
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'progs/integer.ships'`"
test 619 -eq "$shar_count" ||
$echo 'progs/integer.ships:' 'original size' '619,' 'current size' "$shar_count!"
fi
fi
# ============= progs/animal.ships ==============
if test -f 'progs/animal.ships' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'progs/animal.ships' '(file already exists)'
else
$echo 'x -' extracting 'progs/animal.ships' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'progs/animal.ships' &&
;;;in playing animal, questions are lists, animals are symbols
X
(defun prog2 (a b) b)
(defun prog3 (a b c) c)
(setq animal-tree '((is it bigger than a toaster) (elephant) (mosquito)))
X
(defun animal () (ask animal-tree))
X
(defun ask (node)
X (cond (((atom (car node))
X (prog2 (print (append '(is it a) node))
X (ask-2 node (read))))
X (t (prog2 (print (car node))
X (ask-1 node (read)))))))
X
(defun ask-1 (node yn)
X (ask (cond (((null yn) (caddr node)) (t (cadr node))))))
X
(defun ask-2 (node yn)
X (cond (((null yn) (prog2 (print '(what was your animal))
X (ask-3 node (read))))
X (t 'good))))
X
(defun ask-3 (node a)
X (prog2 (print (list 'what 'question 'would 'answer
'yes 'for 'a (car node) 'and 'no 'for 'a a))
X (ask-4 node a (read))))
X
(defun ask-4 (node a q)
X (prog2
X (rplacd node (list (list (car node)) (list a)))
X (rplaca node q)))
SHAR_EOF
$shar_touch -am 0606192399 'progs/animal.ships' &&
chmod 0664 'progs/animal.ships' ||
$echo 'restore of' 'progs/animal.ships' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'progs/animal.ships:' 'MD5 check failed'
b1e55660db983e221b11aba10b3717a1 progs/animal.ships
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'progs/animal.ships'`"
test 884 -eq "$shar_count" ||
$echo 'progs/animal.ships:' 'original size' '884,' 'current size' "$shar_count!"
fi
fi
# ============= progs/stupidihateeveryone.ships ==============
if test -f 'progs/stupidihateeveryone.ships' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'progs/stupidihateeveryone.ships' '(file already exists)'
else
$echo 'x -' extracting 'progs/stupidihateeveryone.ships' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'progs/stupidihateeveryone.ships' &&
(defun or (a b)
X (list 'let (list (list 'happy a))
X (list 'cond (list (list 'happy 'happy) (list t b)))))
SHAR_EOF
$shar_touch -am 0718000699 'progs/stupidihateeveryone.ships' &&
chmod 0664 'progs/stupidihateeveryone.ships' ||
$echo 'restore of' 'progs/stupidihateeveryone.ships' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'progs/stupidihateeveryone.ships:' 'MD5 check failed'
510f32d61fd12eb9b18d9c7d04fb56a2 progs/stupidihateeveryone.ships
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'progs/stupidihateeveryone.ships'`"
test 107 -eq "$shar_count" ||
$echo 'progs/stupidihateeveryone.ships:' 'original size' '107,' 'current size' "$shar_count!"
fi
fi
# ============= progs/sort.ships ==============
if test -f 'progs/sort.ships' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'progs/sort.ships' '(file already exists)'
else
$echo 'x -' extracting 'progs/sort.ships' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'progs/sort.ships' &&
;;;x is a list of wholes. constructs a new, properly ordered list.
;;;probably pessimal
(defun sort-wholes (x)
X (cond (((null x) nil)
X (t (insert (car x) (sort-wholes (cdr x)))))))
X
(defun insert (x l)
X (cond (((null l) (list x))
X ((> (car l) x) (cons x l))
X (t (cons (car l) (insert x (cdr l)))))))
SHAR_EOF
$shar_touch -am 0606184899 'progs/sort.ships' &&
chmod 0664 'progs/sort.ships' ||
$echo 'restore of' 'progs/sort.ships' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'progs/sort.ships:' 'MD5 check failed'
6a34b313f12784664091a449ac55116d progs/sort.ships
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'progs/sort.ships'`"
test 343 -eq "$shar_count" ||
$echo 'progs/sort.ships:' 'original size' '343,' 'current size' "$shar_count!"
fi
fi
# ============= read-1 ==============
if test -f 'read-1' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-1' '(file already exists)'
else
$echo 'x -' extracting 'read-1' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-1' &&
#!/bin/ash
X
#read-1: daughter function of read
X
read HAPPY
X
#echo "$0: reading word $HAPPY"
X
case "$HAPPY" in
"")
X exit 0 ;;
"(")
X exec read-list ;;
")")
X complain "$0: ): it takes a tough man
to make a tender chicken" ;;
\')
X exec read-quote ;;
*)
X exec read-atom "$HAPPY" ;;
esac
SHAR_EOF
$shar_touch -am 0518220599 'read-1' &&
chmod 0764 'read-1' ||
$echo 'restore of' 'read-1' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-1:' 'MD5 check failed'
42f1b2a137fa7927f663f4370be5e8a4 read-1
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-1'`"
test 282 -eq "$shar_count" ||
$echo 'read-1:' 'original size' '282,' 'current size' "$shar_count!"
fi
fi
# ============= read-1-loop ==============
if test -f 'read-1-loop' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-1-loop' '(file already exists)'
else
$echo 'x -' extracting 'read-1-loop' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-1-loop' &&
#!/bin/ash
X
#read-1-loop: daughter function of read
X
while read HAPPY
do
X #echo "$0: reading word $HAPPY" >&2
X
X case "$HAPPY" in
X "")
X exit 0 ;;
X "(")
X read-list ;;
X ")")
X ;;
X \')
X read-quote ;;
X *)
X read-atom "$HAPPY" ;;
X esac
done
SHAR_EOF
$shar_touch -am 0531200899 'read-1-loop' &&
chmod 0764 'read-1-loop' ||
$echo 'restore of' 'read-1-loop' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-1-loop:' 'MD5 check failed'
93925ededf43fdb1f90319aff0f12ca7 read-1-loop
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-1-loop'`"
test 238 -eq "$shar_count" ||
$echo 'read-1-loop:' 'original size' '238,' 'current size' "$shar_count!"
fi
fi
# ============= read-atom ==============
if test -f 'read-atom' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-atom' '(file already exists)'
else
$echo 'x -' extracting 'read-atom' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-atom' &&
#!/bin/bash
X
#read-atom: daughter function of readxxx, read-1, read-cdr
#good, general-purpose constructor function
#takes one argument
X
#mandates following thingies:
# integers are strings of digits
# symbols are strings of characters which do not start with
# a "#" or a digit
case "$1" in
[0-9]*)
X case "$1" in
X *[!0-9]*)
X complain "$0: what the hell is $1?" ;;
X *)
X exec cons "#integer" $1 ;;
X esac ;;
"#"*)
X complain "$0: $1: it's no use trying to cheat the system" ;;
*)
X WORD=`echo "$1" | tr '[:lower:]' '[:upper:]'`
X case "$WORD" in
X NIL)
X exec echo 1 ;;
X T)
X exec echo 2 ;;
X QUOTE)
X exec echo 3 ;;
X SETQ)
X exec echo 4 ;;
X LAMBDA)
X exec echo 5 ;;
X LABEL)
X exec echo 6 ;;
X COND)
X exec echo 7 ;;
X DEFUN)
X exec echo 8 ;;
X *)
X exec symbol-lookup "$WORD" ;;
X esac ;;
esac
SHAR_EOF
$shar_touch -am 0518181399 'read-atom' &&
chmod 0764 'read-atom' ||
$echo 'restore of' 'read-atom' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-atom:' 'MD5 check failed'
08d45d3b3204cd5053b147569023f8d7 read-atom
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-atom'`"
test 787 -eq "$shar_count" ||
$echo 'read-atom:' 'original size' '787,' 'current size' "$shar_count!"
fi
fi
# ============= read-cdr ==============
if test -f 'read-cdr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-cdr' '(file already exists)'
else
$echo 'x -' extracting 'read-cdr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-cdr' &&
#!/bin/ash
X
#read-cdr: daughter function of readxxx, read-1
X
read WORD
X
case "$WORD" in
"(")
X THING=`read-list` ;;
")")
X complain "$0: bad syntax: missing cdr" ;;
".")
X complain "$0: bad syntax: elipses in psuedo-M-expression only" ;;
"")
X complain "$0: premature EOF" ;;
\')
X THING=`read-quote` ;;
*)
X THING=`read-atom $WORD` ;;
esac
X
read WORD
X
case "$WORD" in
")")
X exec echo $THING ;;
*)
X complain "$0: bad syntax: run-on cdr" ;;
esac
SHAR_EOF
$shar_touch -am 0518232099 'read-cdr' &&
chmod 0764 'read-cdr' ||
$echo 'restore of' 'read-cdr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-cdr:' 'MD5 check failed'
02ddd72bb465e67ab7b171354d746fb7 read-cdr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-cdr'`"
test 439 -eq "$shar_count" ||
$echo 'read-cdr:' 'original size' '439,' 'current size' "$shar_count!"
fi
fi
# ============= read-list ==============
if test -f 'read-list' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-list' '(file already exists)'
else
$echo 'x -' extracting 'read-list' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-list' &&
#!/bin/ash
X
#read-list: daughter function of read-1
X
read WORD
X
case "$WORD" in
"(")
X exec cons `read-list` `read-list` ;;
")")
X exec echo 1 ;;
".")
X exec read-cdr ;;
"")
X complain "$0: premature EOF" ;;
\')
X exec cons `read-quote` `read-list`;;
*)
X exec cons `read-atom "$WORD"` `read-list` ;;
esac
SHAR_EOF
$shar_touch -am 0518231999 'read-list' &&
chmod 0764 'read-list' ||
$echo 'restore of' 'read-list' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-list:' 'MD5 check failed'
bd758fc202b5c86f8e5fb1d9054ef7ee read-list
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-list'`"
test 300 -eq "$shar_count" ||
$echo 'read-list:' 'original size' '300,' 'current size' "$shar_count!"
fi
fi
# ============= read-loop ==============
if test -f 'read-loop' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-loop' '(file already exists)'
else
$echo 'x -' extracting 'read-loop' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-loop' &&
#!/bin/ash
X
#read-loop: Reads multiple forms up to eof and yeilds mutiple output
#macro conventions are the same as for readxxx
X
#macro code is commented out cause it's so damn slow
X
THINGS=`sed 's/;.*//
X s/(/ ( /g
X s/)/ ) /g
X s/\./ . /g
X s/'\''/ '\'' /g
X s/ / /g
X s/ /\
/g' | sed '/^$/d' | read-1-loop`
X
echo $THINGS
X
#if symbol-existp '*READER-EXTENSIONS*'
#then
#for THING in $THINGS
# do
# EXTE=`symbol-lookup '*READER-EXTENSIONS*'`
# EXTE=`value $EXTE`
# while notnull $EXTE
# do
# CARE=`car $EXTE`
# FUN=`value $CARE`
# LTHING=`list $THING`
# THING=`apply $FUN $LTHING`
# EXTE=`cdr $EXTE`
# done
# echo $THING
# done
#else
# echo nothing to do here >&2
# echo $THINGS
#fi
SHAR_EOF
$shar_touch -am 0606174999 'read-loop' &&
chmod 0764 'read-loop' ||
$echo 'restore of' 'read-loop' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-loop:' 'MD5 check failed'
cd37b68907b9004b5a7e20246a0a9eef read-loop
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-loop'`"
test 694 -eq "$shar_count" ||
$echo 'read-loop:' 'original size' '694,' 'current size' "$shar_count!"
fi
fi
# ============= read-quote ==============
if test -f 'read-quote' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-quote' '(file already exists)'
else
$echo 'x -' extracting 'read-quote' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-quote' &&
#!/bin/ash
X
#read-quote: daughter function of read-1, read-car, read-cdr
X
HAPPY=`read-1`
FUNKY=`cons $HAPPY 1`
exec cons 3 $FUNKY
SHAR_EOF
$shar_touch -am 0518220599 'read-quote' &&
chmod 0764 'read-quote' ||
$echo 'restore of' 'read-quote' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-quote:' 'MD5 check failed'
8970b74324653b2a81c647989bf09a29 read-quote
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-quote'`"
test 130 -eq "$shar_count" ||
$echo 'read-quote:' 'original size' '130,' 'current size' "$shar_count!"
fi
fi
# ============= read-test ==============
if test -f 'read-test' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'read-test' '(file already exists)'
else
$echo 'x -' extracting 'read-test' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'read-test' &&
#!/bin/ash
X
exec sed 's/(/ ( /g
X s/)/ ) /g
X s/\./ . /g
X s/'\''/ '\'' /g
X s/ / /g
X s/ /\
/g' | sed '/^$/d'
SHAR_EOF
$shar_touch -am 0518215699 'read-test' &&
chmod 0764 'read-test' ||
$echo 'restore of' 'read-test' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'read-test:' 'MD5 check failed'
5b20c4c7cc304f9f475784a6026e3d2a read-test
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'read-test'`"
test 106 -eq "$shar_count" ||
$echo 'read-test:' 'original size' '106,' 'current size' "$shar_count!"
fi
fi
# ============= readxxx ==============
if test -f 'readxxx' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'readxxx' '(file already exists)'
else
$echo 'x -' extracting 'readxxx' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'readxxx' &&
#!/bin/ash
X
#readxxx: the read function. Renamed to avoid conflict with shell read
#*reader-extensions* stands for a list of symbols, each of which
#stands for a function on a single argument - the item read
X
#macro code commented out
X
THING=`sed 's/;.*//
X s/(/ ( /g
X s/)/ ) /g
X s/\./ . /g
X s/'\''/ '\'' /g
X s/ / /g
X s/ /\
/g' | sed '/^$/d' | read-1`
X
exec echo $THING
X
#if symbol-existp '*READER-EXTENSIONS*'
#then
# EXTE=`symbol-lookup '*READER-EXTENSIONS*'`
# EXTE=`value $EXTE`
# while notnull $EXTE
# do
# CARE=`car $EXTE`
# FUN=`value $CARE`
# LTHING=`list $THING`
# THING=`apply $FUN $LTHING`
# EXTE=`cdr $EXTE`
# done
#else
# echo nothing to do here >&2
#fi
#exec echo $THING
SHAR_EOF
$shar_touch -am 0606175099 'readxxx' &&
chmod 0764 'readxxx' ||
$echo 'restore of' 'readxxx' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'readxxx:' 'MD5 check failed'
1121e1eaac40d95c13deae8b9e27e8ad readxxx
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'readxxx'`"
test 692 -eq "$shar_count" ||
$echo 'readxxx:' 'original size' '692,' 'current size' "$shar_count!"
fi
fi
# ============= robust-car ==============
if test -f 'robust-car' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'robust-car' '(file already exists)'
else
$echo 'x -' extracting 'robust-car' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'robust-car' &&
#!/bin/ash
X
#robust-car: a car fit for everyday use
X
#$1 is an address in image
#returns the car
#requires that $1 be a cons, and is robust in this regard
X
if atom-novalue $1
then
X complain "$0: argument may not be atomic"
else
X car $1
fi
SHAR_EOF
$shar_touch -am 0514174699 'robust-car' &&
chmod 0764 'robust-car' ||
$echo 'restore of' 'robust-car' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'robust-car:' 'MD5 check failed'
18f68c5e87cda32dbfb2b2297bd1de00 robust-car
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'robust-car'`"
test 239 -eq "$shar_count" ||
$echo 'robust-car:' 'original size' '239,' 'current size' "$shar_count!"
fi
fi
# ============= robust-cdr ==============
if test -f 'robust-cdr' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'robust-cdr' '(file already exists)'
else
$echo 'x -' extracting 'robust-cdr' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'robust-cdr' &&
#!/bin/ash
X
#robust-cdr: a robust cdr
X
#demands that $1 not be atomic
X
if atom-novalue $1
then
X complain "$0: argument may not be atomic"
else
X cdr $1
fi
SHAR_EOF
$shar_touch -am 0514174799 'robust-cdr' &&
chmod 0764 'robust-cdr' ||
$echo 'restore of' 'robust-cdr' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'robust-cdr:' 'MD5 check failed'
b179f14063f225de67cf34ae0ce8b32b robust-cdr
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'robust-cdr'`"
test 154 -eq "$shar_count" ||
$echo 'robust-cdr:' 'original size' '154,' 'current size' "$shar_count!"
fi
fi
# ============= rplaca ==============
if test -f 'rplaca' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'rplaca' '(file already exists)'
else
$echo 'x -' extracting 'rplaca' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'rplaca' &&
#!/bin/ash
X
#rplaca: destructively replaces the car of $1 with $2. low level
#returns (the changed) $1
#compares $1 with $2 first, to avoid costly calls to ed
#not robust
X
X
case "`car $1`" in
"$2")
X ;;
*)
X echo "$1s/.* /$2 /
w" | ed $SHIPS/image 2>/dev/null ;;
esac
echo $1
SHAR_EOF
$shar_touch -am 0621221799 'rplaca' &&
chmod 0764 'rplaca' ||
$echo 'restore of' 'rplaca' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'rplaca:' 'MD5 check failed'
66390c6637a659500352b5a3a35a933a rplaca
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'rplaca'`"
test 274 -eq "$shar_count" ||
$echo 'rplaca:' 'original size' '274,' 'current size' "$shar_count!"
fi
fi
# ============= rplacd ==============
if test -f 'rplacd' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'rplacd' '(file already exists)'
else
$echo 'x -' extracting 'rplacd' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'rplacd' &&
#!/bin/ash
X
#rplacd: destructively replaces the cdr of $1 with $2. low level
#returns the (changed) $1
#not robust
X
echo "$1s/ .*/ $2/
w" | ed $SHIPS/image 2>/dev/null
echo $1
SHAR_EOF
$shar_touch -am 0512021599 'rplacd' &&
chmod 0764 'rplacd' ||
$echo 'restore of' 'rplacd' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'rplacd:' 'MD5 check failed'
6d2eef58bf39ceb13364358e68b3ed4e rplacd
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'rplacd'`"
test 176 -eq "$shar_count" ||
$echo 'rplacd:' 'original size' '176,' 'current size' "$shar_count!"
fi
fi
# ============= setq ==============
if test -f 'setq' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'setq' '(file already exists)'
else
$echo 'x -' extracting 'setq' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'setq' &&
#!/bin/ash
X
#setq: a special nuesnace/conveniance
X
#$1 is a print name
#$2 is a value
X
#returns $2 such that the symbol which is nammed $1 has value=$2
#REMEMBER SETXXX!!!!!!!!!!!!!!
#THIS WAS THE MISTERIOUS BUG IN THIS PROGRAM!!!
X
setxxx `symbol-lookup "$1"` "$2"
SHAR_EOF
$shar_touch -am 0601213999 'setq' &&
chmod 0764 'setq' ||
$echo 'restore of' 'setq' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'setq:' 'MD5 check failed'
bbbe44abacade9f81bf5c779396ccb0d setq
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'setq'`"
test 265 -eq "$shar_count" ||
$echo 'setq:' 'original size' '265,' 'current size' "$shar_count!"
fi
fi
# ============= setxxx ==============
if test -f 'setxxx' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'setxxx' '(file already exists)'
else
$echo 'x -' extracting 'setxxx' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'setxxx' &&
#!/bin/ash
X
#setxxx: the set function, renamed to avoid clashes with shell set
X
#sets the value of symbol $1 to $2
#returns $2
X
symbol-set `cdr $1` $2
SHAR_EOF
$shar_touch -am 0512000199 'setxxx' &&
chmod 0764 'setxxx' ||
$echo 'restore of' 'setxxx' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'setxxx:' 'MD5 check failed'
cba51e8d36f0b9f7a1a0e984051517e7 setxxx
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'setxxx'`"
test 151 -eq "$shar_count" ||
$echo 'setxxx:' 'original size' '151,' 'current size' "$shar_count!"
fi
fi
# ============= ships.run ==============
if test -f 'ships.run' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'ships.run' '(file already exists)'
else
$echo 'x -' extracting 'ships.run' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'ships.run' &&
#ships.run: read-eval-print: in three words, lisp
#now it works!
X
lambda-variable-initialize
X
TEMP1=/tmp/happy.$$
TEMP2=/tmp/sad.$$
MAXSIZE=600
X
trap 'rm $TEMP1 $TEMP2 ; exit' 1 2 15
X
while true
do
read-loop >$TEMP1
for i in `cat $TEMP1`
do
X evalxxx $i
done >$TEMP2
for i in `cat $TEMP2`
do
X print $i
done 1>/dev/null
if expr `wc -l $SHIPS/image | sed s/[^0-9]//g` \> $MAXSIZE >/dev/null
then
X echo Collecting Garbage >&2
X garbage
fi
done
SHAR_EOF
$shar_touch -am 0601230099 'ships.run' &&
chmod 0764 'ships.run' ||
$echo 'restore of' 'ships.run' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'ships.run:' 'MD5 check failed'
7ed1a654461c8786fc996ca4c2a9bf4b ships.run
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ships.run'`"
test 439 -eq "$shar_count" ||
$echo 'ships.run:' 'original size' '439,' 'current size' "$shar_count!"
fi
fi
# ============= ships.run.once ==============
if test -f 'ships.run.once' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'ships.run.once' '(file already exists)'
else
$echo 'x -' extracting 'ships.run.once' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'ships.run.once' &&
#/bin/ash
X
#ships.run.once: reads, evals, prints exactly one file
#needed to process files
X
TEMP1=/tmp/happy.$$
TEMP2=/tmp/sad.$$
X
read-loop >$TEMP1
for i in `cat $TEMP1`
do
X evalxxx $i
done >$TEMP2
for i in `cat $TEMP2`
do
X print $i
done 1>/dev/null
X
rm $TEMP1 $TEMP2 /tmp/sspace*
SHAR_EOF
$shar_touch -am 0601201299 'ships.run.once' &&
chmod 0764 'ships.run.once' ||
$echo 'restore of' 'ships.run.once' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'ships.run.once:' 'MD5 check failed'
9862663013cd392a86ee313e2c90e3bb ships.run.once
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ships.run.once'`"
test 282 -eq "$shar_count" ||
$echo 'ships.run.once:' 'original size' '282,' 'current size' "$shar_count!"
fi
fi
# ============= si ==============
if test -f 'si' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'si' '(file already exists)'
else
$echo 'x -' extracting 'si' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'si' &&
if [ ! -e $1 ]
then
X echo '#!/bin/ash' >$1
X chmod u+x $1
fi
vi $1
SHAR_EOF
$shar_touch -am 0512000299 'si' &&
chmod 0764 'si' ||
$echo 'restore of' 'si' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'si:' 'MD5 check failed'
0ae017393f898f3270de1e856895ba32 si
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'si'`"
test 66 -eq "$shar_count" ||
$echo 'si:' 'original size' '66,' 'current size' "$shar_count!"
fi
fi
# ============= sspace ==============
if test -f 'sspace' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'sspace' '(file already exists)'
else
$echo 'x -' extracting 'sspace' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'sspace' &&
10 AMONG 9
12 APPEND 11
14 APPLY 13
16 ATOM 15
18 BACKWARD 17
20 BACKWARD-LIST 19
22 CAAAR 21
24 CAADR 23
26 CAAR 25
28 CADAR 27
30 CADDR 29
32 CADR 31
34 CAR 33
36 CDAAR 35
38 CDADR 37
40 CDAR 39
42 CDDAR 41
44 CDDDR 43
46 CDDR 45
48 CDR 47
50 COMPILEDP 49
52 COMPLAIN 51
54 COND 53
56 CONS 55
58 CONSTANTP 57
60 EQ 59
62 EQUAL 61
64 EQUAL-SLOW 63
66 EVLIS 65
68 FF 67
70 FFSILLY 69
72 LIST 71
74 LIST-SILLY 73
76 NULL 75
78 PAIRS 77
80 PRINT 79
82 ROBUST-CAR 81
84 ROBUST-CDR 83
86 RPLACA 85
88 RPLACD 87
90 SETQ 89
92 SI 91
94 SPACE 93
96 SSPACE 95
98 SUBST 97
100 SYMBOLP 99
102 VALUE 101
104 SET 103
106 READ 105
108 EVAL 107
110 LAMBDA-COMPILE 109
112 SYMBOLS 111
114 LISTP 113
116 SUBLIS 115
118 SUBLIS-DESTRUCTIVE 117
120 GARBAGE 119
122 PNAME-SAFE 121
124 + 123
126 - 125
128 = 127
130 PROG2 129
132 PROGN 131
134 MEMBER 133
136 > 135
138 MACRO-COMPILED 137
140 MACROP 139
141 MAPCAR 157
142 F 0
143 L 0
144 DEFMACRO 158
145 NAME 0
146 ARGLIST 0
147 FORM 0
148 IF 159
149 A 0
150 B 0
151 C 0
152 LET 160
153 LETLIST 0
154 AND 161
155 OR 162
156 HAPPY 0
SHAR_EOF
$shar_touch -am 0718010899 'sspace' &&
chmod 0664 'sspace' ||
$echo 'restore of' 'sspace' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'sspace:' 'MD5 check failed'
10706e9ad83f0a25edad2b67b68c095a sspace
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'sspace'`"
test 1062 -eq "$shar_count" ||
$echo 'sspace:' 'original size' '1062,' 'current size' "$shar_count!"
fi
fi
# ============= sspace.bak ==============
if test -f 'sspace.bak' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'sspace.bak' '(file already exists)'
else
$echo 'x -' extracting 'sspace.bak' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'sspace.bak' &&
10 AMONG 9
12 APPEND 11
14 APPLY 13
16 ATOM 15
18 BACKWARD 17
20 BACKWARD-LIST 19
22 CAAAR 21
24 CAADR 23
26 CAAR 25
28 CADAR 27
30 CADDR 29
32 CADR 31
34 CAR 33
36 CDAAR 35
38 CDADR 37
40 CDAR 39
42 CDDAR 41
44 CDDDR 43
46 CDDR 45
48 CDR 47
50 COMPILEDP 49
52 COMPLAIN 51
54 COND 53
56 CONS 55
58 CONSTANTP 57
60 EQ 59
62 EQUAL 61
64 EQUAL-SLOW 63
66 EVLIS 65
68 FF 67
70 FFSILLY 69
72 LIST 71
74 LIST-SILLY 73
76 NULL 75
78 PAIRS 77
80 PRINT 79
82 ROBUST-CAR 81
84 ROBUST-CDR 83
86 RPLACA 85
88 RPLACD 87
90 SETQ 89
92 SI 91
94 SPACE 93
96 SSPACE 95
98 SUBST 97
100 SYMBOLP 99
102 VALUE 101
104 SET 103
106 READ 105
108 EVAL 107
110 LAMBDA-COMPILE 109
112 SYMBOLS 111
114 LISTP 113
116 SUBLIS 115
118 SUBLIS-DESTRUCTIVE 117
120 GARBAGE 119
122 PNAME-SAFE 121
124 + 123
126 - 125
128 = 127
130 PROG2 129
132 PROGN 131
134 MEMBER 133
136 > 135
138 MACRO-COMPILED 137
140 MACROP 139
141 MAPCAR 311
142 F 0
143 L 0
172 DEFMACRO 316
173 NAME 0
174 ARGLIST 0
175 FORM 0
202 IF 331
203 A 0
204 B 0
205 C 0
227 LET 347
228 LETLIST 0
250 AND 362
271 OR 377
276 HAPPY 0
SHAR_EOF
$shar_touch -am 0718010899 'sspace.bak' &&
chmod 0664 'sspace.bak' ||
$echo 'restore of' 'sspace.bak' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'sspace.bak:' 'MD5 check failed'
a3750acc12635a70903f3993af5dbd9c sspace.bak
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'sspace.bak'`"
test 1062 -eq "$shar_count" ||
$echo 'sspace.bak:' 'original size' '1062,' 'current size' "$shar_count!"
fi
fi
# ============= sublis ==============
if test -f 'sublis' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'sublis' '(file already exists)'
else
$echo 'x -' extracting 'sublis' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'sublis' &&
#!/bin/ash
X
#sublis: as described in McCaty 1960, using lisp 1.5-style alist
#$1 is an alist, as if made by pairs or something like it
#the cars of each cons in $1 are symbols - no checking is done
#$2 is an s-expr
#returns the new s-expr
X
#c-style controll is chosen instead of end-recursion
#notice _exec_ in loop avoids replacing the same thing twice:
#(sublis ((a . b) (b . c)) a) should return b , not c .
X
echo sublis $* >&2
X
CAR2="`car $2`"
case "$CAR2" in
"#symbol")
X PAIRS=$1
X echo sublis: loop car PAIRS = $PAIRS >&2
X while case $PAIRS in
X 1) false ;;
X *) true ;;
X esac
X do
X case $2 in
X "`caar $PAIRS`")
X exec cdar $PAIRS ;;
X esac
X PAIRS="`cdr $PAIRS`"
X done
X exec echo $2 ;;
"#"*)
X exec echo $2 ;;
*)
X CDR2="`cdr $2`"
X exec cons `sublis $1 $CAR2` `sublis $1 $CDR2` ;;
esac
SHAR_EOF
$shar_touch -am 0518194399 'sublis' &&
chmod 0764 'sublis' ||
$echo 'restore of' 'sublis' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'sublis:' 'MD5 check failed'
6190d5532cc1b0a174005e6732746b6b sublis
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'sublis'`"
test 808 -eq "$shar_count" ||
$echo 'sublis:' 'original size' '808,' 'current size' "$shar_count!"
fi
fi
# ============= sublis-destructive ==============
if test -f 'sublis-destructive' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'sublis-destructive' '(file already exists)'
else
$echo 'x -' extracting 'sublis-destructive' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'sublis-destructive' &&
#!/bin/ash
X
#sublis-destructive: a destructive sublis
#$1 is an alist of symbols - no checking is done
#$2 is an s-expr
#returns the new s-expr, either $2 or a new atom
X
echo sublis $* >&2
X
CAR2="`car $2`"
case "$CAR2" in
"#symbol")
X PAIRS=$1
X echo sublis: loop car PAIRS = $PAIRS >&2
X while case $PAIRS in
X 1) false ;;
X *) true ;;
X esac
X do
X case $2 in
X "`caar $PAIRS`")
X exec cdar $PAIRS ;;
X esac
X PAIRS="`cdr $PAIRS`"
X done
X exec echo $2 ;;
"#"*)
X exec echo $2 ;;
*)
X CDR2="`cdr $2`"
X rplaca $2 `sublis-destructive $1 $CAR2`
X exec rplacd $2 `sublis-destructive $1 $CDR2` ;;
esac
SHAR_EOF
$shar_touch -am 0518203499 'sublis-destructive' &&
chmod 0764 'sublis-destructive' ||
$echo 'restore of' 'sublis-destructive' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'sublis-destructive:' 'MD5 check failed'
75e216ec48eede840fbe855d7dbf307f sublis-destructive
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'sublis-destructive'`"
test 606 -eq "$shar_count" ||
$echo 'sublis-destructive:' 'original size' '606,' 'current size' "$shar_count!"
fi
fi
# ============= subst ==============
if test -f 'subst' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'subst' '(file already exists)'
else
$echo 'x -' extracting 'subst' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'subst' &&
#!/bin/ash
X
#subst: as in McCarty 1960
X
#$1, $2, $3 are all addresses
#$2 is an atom - this function is robust in this regard
#replaces the atomic symbol $2 with $1 in its every occurence in $3
X
if atom-novalue $2
then
X subst-1 $1 $2 $3
else
X complain "$0 : second argument must be atomic"
fi
SHAR_EOF
$shar_touch -am 0514174799 'subst' &&
chmod 0764 'subst' ||
$echo 'restore of' 'subst' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'subst:' 'MD5 check failed'
e281ccb59cffd5b5bdeb9a9449f51090 subst
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'subst'`"
test 293 -eq "$shar_count" ||
$echo 'subst:' 'original size' '293,' 'current size' "$shar_count!"
fi
fi
# ============= subst-1 ==============
if test -f 'subst-1' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'subst-1' '(file already exists)'
else
$echo 'x -' extracting 'subst-1' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'subst-1' &&
#!/bin/ash
X
#subst-1: daughter function of subst
#takes the same three arguments
X
if atom-novalue $3
then
X if [ $3 = $2 ]
X then
X echo $1
X else
X echo $3
X fi
else
X FOO=`car $3`
X BAR=`cdr $3`
X cons `subst-1 $1 $2 $FOO` `subst-1 $1 $2 $BAR`
fi
SHAR_EOF
$shar_touch -am 0514174799 'subst-1' &&
chmod 0764 'subst-1' ||
$echo 'restore of' 'subst-1' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'subst-1:' 'MD5 check failed'
b04235ac313c1e3638149fcc951da160 subst-1
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'subst-1'`"
test 242 -eq "$shar_count" ||
$echo 'subst-1:' 'original size' '242,' 'current size' "$shar_count!"
fi
fi
# ============= subst-destructive ==============
if test -f 'subst-destructive' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'subst-destructive' '(file already exists)'
else
$echo 'x -' extracting 'subst-destructive' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'subst-destructive' &&
#!/bin/ash
X
#echo subst-destructive "$1 $2 $3" >&2
X
#subst-destructive: a destructive subst
#$1 is an atom (though it doesnt check. it just makes sense)
#$2 is an s-expr
#$3 is another s-expr
#replaces every occurence of $1 in $3 with $3, using rplaca and rplacd
X
if atom-novalue "$3"
then
X case $3 in
X $1)
X exec echo $2 ;;
X *)
X exec echo $3 ;;
X esac
else
X CAR3=`car $3`
X CDR3=`cdr $3`
X rplaca $3 `subst-destructive $1 $2 $CAR3` >/dev/null
X exec rplacd $3 `subst-destructive $1 $2 $CDR3`
fi
#remember rplaca and rplacd's return values!
SHAR_EOF
$shar_touch -am 0514174799 'subst-destructive' &&
chmod 0764 'subst-destructive' ||
$echo 'restore of' 'subst-destructive' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'subst-destructive:' 'MD5 check failed'
c1e575451ee8996380d288df2e5eef24 subst-destructive
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'subst-destructive'`"
test 539 -eq "$shar_count" ||
$echo 'subst-destructive:' 'original size' '539,' 'current size' "$shar_count!"
fi
fi
# ============= symbol-existp ==============
if test -f 'symbol-existp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbol-existp' '(file already exists)'
else
$echo 'x -' extracting 'symbol-existp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbol-existp' &&
#!/bin/ash
X
#low-level stuff used by gensym
#$1 is a character sting
#predicates the existence of a symbol with name $1
X
fgrep " $1 " $SHIPS/sspace >/dev/null
SHAR_EOF
$shar_touch -am 0601214099 'symbol-existp' &&
chmod 0764 'symbol-existp' ||
$echo 'restore of' 'symbol-existp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbol-existp:' 'MD5 check failed'
cbb55d5a37c2ab955300abeb7b2584b7 symbol-existp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbol-existp'`"
test 159 -eq "$shar_count" ||
$echo 'symbol-existp:' 'original size' '159,' 'current size' "$shar_count!"
fi
fi
# ============= symbol-lookup ==============
if test -f 'symbol-lookup' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbol-lookup' '(file already exists)'
else
$echo 'x -' extracting 'symbol-lookup' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbol-lookup' &&
#!/bin/ash
X
#symbol-lookup: low-level stuff for use by read
X
#$1 is a character-string
#returns the symbol with pname=$1
#makes it if it doesnt exist
X
TEMP=/tmp/sspace.$$
if fgrep " $1 " $SHIPS/sspace >$TEMP
then
X exec cut -f 1 $TEMP
else
X exec symbol-make "$1"
fi
SHAR_EOF
$shar_touch -am 0601205799 'symbol-lookup' &&
chmod 0764 'symbol-lookup' ||
$echo 'restore of' 'symbol-lookup' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbol-lookup:' 'MD5 check failed'
c9ab01c021cd5e5bde0d2e852482b5af symbol-lookup
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbol-lookup'`"
test 265 -eq "$shar_count" ||
$echo 'symbol-lookup:' 'original size' '265,' 'current size' "$shar_count!"
fi
fi
# ============= symbol-make ==============
if test -f 'symbol-make' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbol-make' '(file already exists)'
else
$echo 'x -' extracting 'symbol-make' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbol-make' &&
#!/bin/ash
X
#symbol-make: low level symbol stuff. used (only) by symbol-lookup
X
#$1 is a character-string
#returns a new symbol with pname=$1, value undefined (=0)
#sets its value to 0 (undefined)
X
LLINE=`wc -l $SHIPS/sspace | sed 's/[^0-9]//g'`
NLINE=`expr $LLINE + 1`
FOO=`cons "#symbol" $NLINE`
echo "$FOO $1 0" >>$SHIPS/sspace
exec echo $FOO
SHAR_EOF
$shar_touch -am 0512020999 'symbol-make' &&
chmod 0764 'symbol-make' ||
$echo 'restore of' 'symbol-make' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbol-make:' 'MD5 check failed'
7d22b7a71c88df9a1785677cd9808924 symbol-make
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbol-make'`"
test 346 -eq "$shar_count" ||
$echo 'symbol-make:' 'original size' '346,' 'current size' "$shar_count!"
fi
fi
# ============= symbol-pname ==============
if test -f 'symbol-pname' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbol-pname' '(file already exists)'
else
$echo 'x -' extracting 'symbol-pname' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbol-pname' &&
#!/bin/ash
X
#symbol-pname: low-level stuff. used by pname
#(which is Common Lisp's "symbol-pname")
X
#$1 is a sspace-address
#returns the character-string pname of the symbol described by $1
X
exec sed -n "$1s/^[^ ]* //
X $1s/ .*//p" <$SHIPS/sspace
SHAR_EOF
$shar_touch -am 0512021099 'symbol-pname' &&
chmod 0764 'symbol-pname' ||
$echo 'restore of' 'symbol-pname' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbol-pname:' 'MD5 check failed'
e63b897e96f7f00b789725f9c3a6631e symbol-pname
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbol-pname'`"
test 246 -eq "$shar_count" ||
$echo 'symbol-pname:' 'original size' '246,' 'current size' "$shar_count!"
fi
fi
# ============= symbol-set ==============
if test -f 'symbol-set' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbol-set' '(file already exists)'
else
$echo 'x -' extracting 'symbol-set' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbol-set' &&
#!/bin/ash
X
#symbol-set: low level stuff, used by set (setxxx)
X
#$1 is a sspace-address
#makes the symbol described by $1 value=$2
#returns $2
X
TEMP=/tmp/sspace.$$
X
echo "$1s/ [^ ]*$/ $2/
w" | ed $SHIPS/sspace 2>/dev/null
exec echo $2
SHAR_EOF
$shar_touch -am 0512021499 'symbol-set' &&
chmod 0764 'symbol-set' ||
$echo 'restore of' 'symbol-set' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbol-set:' 'MD5 check failed'
e7f5fc3345d398e9fb6d612af1543d15 symbol-set
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbol-set'`"
test 235 -eq "$shar_count" ||
$echo 'symbol-set:' 'original size' '235,' 'current size' "$shar_count!"
fi
fi
# ============= symbol-symbol ==============
if test -f 'symbol-symbol' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbol-symbol' '(file already exists)'
else
$echo 'x -' extracting 'symbol-symbol' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbol-symbol' &&
#!/bin/ash
X
#symbol-symbol: low level stuff
X
#$1 is a sspace-address
#returns the symbol described by $1
X
exec sed -n "$1s/ .*//p" <$SHIPS/sspace
SHAR_EOF
$shar_touch -am 0512021199 'symbol-symbol' &&
chmod 0764 'symbol-symbol' ||
$echo 'restore of' 'symbol-symbol' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbol-symbol:' 'MD5 check failed'
d723ef3cbe1cd70b46fdc3fa82dedbc6 symbol-symbol
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbol-symbol'`"
test 146 -eq "$shar_count" ||
$echo 'symbol-symbol:' 'original size' '146,' 'current size' "$shar_count!"
fi
fi
# ============= symbol-value ==============
if test -f 'symbol-value' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbol-value' '(file already exists)'
else
$echo 'x -' extracting 'symbol-value' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbol-value' &&
#!/bin/ash
X
#symbol-value: low-level stuff
X
#$1 is an sspace-address
#returns the value of the symbol described by $1
X
exec sed -n "$1s/.* //p" <$SHIPS/sspace
SHAR_EOF
$shar_touch -am 0512021299 'symbol-value' &&
chmod 0764 'symbol-value' ||
$echo 'restore of' 'symbol-value' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbol-value:' 'MD5 check failed'
b83c29b6ada6d6a3892b4ebcbe3b08d2 symbol-value
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbol-value'`"
test 159 -eq "$shar_count" ||
$echo 'symbol-value:' 'original size' '159,' 'current size' "$shar_count!"
fi
fi
# ============= symbolp ==============
if test -f 'symbolp' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbolp' '(file already exists)'
else
$echo 'x -' extracting 'symbolp' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbolp' &&
#!/bin/ash
X
#symbolp: predicate tests if $1 is a symbol
X
case `car $1` in
"#symbol") exec echo 2 ;;
*) exec echo 1 ;;
esac
SHAR_EOF
$shar_touch -am 0514173699 'symbolp' &&
chmod 0764 'symbolp' ||
$echo 'restore of' 'symbolp' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbolp:' 'MD5 check failed'
16341d0972af0d5a7f3b0c9eabd02e32 symbolp
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbolp'`"
test 125 -eq "$shar_count" ||
$echo 'symbolp:' 'original size' '125,' 'current size' "$shar_count!"
fi
fi
# ============= symbolp-novalue ==============
if test -f 'symbolp-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbolp-novalue' '(file already exists)'
else
$echo 'x -' extracting 'symbolp-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbolp-novalue' &&
#!/bin/ash
X
#symbolp-novalue: for use in "if" switches in shell scripts
X
case `car $1` in
"#symbol") exec true ;;
*) exec false ;;
esac
SHAR_EOF
$shar_touch -am 0514173799 'symbolp-novalue' &&
chmod 0764 'symbolp-novalue' ||
$echo 'restore of' 'symbolp-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbolp-novalue:' 'MD5 check failed'
41a1c5acbbaf278d160a5e916125f2aa symbolp-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbolp-novalue'`"
test 137 -eq "$shar_count" ||
$echo 'symbolp-novalue:' 'original size' '137,' 'current size' "$shar_count!"
fi
fi
# ============= symbols ==============
if test -f 'symbols' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'symbols' '(file already exists)'
else
$echo 'x -' extracting 'symbols' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'symbols' &&
#!/bin/ash
X
#symbols: list all symbols names to standard-error
X
cut -f 2 $SHIPS/sspace >&2
SHAR_EOF
$shar_touch -am 0513211999 'symbols' &&
chmod 0764 'symbols' ||
$echo 'restore of' 'symbols' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'symbols:' 'MD5 check failed'
e7f2df8c2e848113d80f8a2d372b8b7e symbols
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'symbols'`"
test 91 -eq "$shar_count" ||
$echo 'symbols:' 'original size' '91,' 'current size' "$shar_count!"
fi
fi
# ============= value ==============
if test -f 'value' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'value' '(file already exists)'
else
$echo 'x -' extracting 'value' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'value' &&
#!/bin/ash
X
#value: returns the value (as an address) of symbol $1
#not robust - for use with eval
X
FANCY=`cdr $1`
HAPPY=`symbol-value $FANCY`
case $HAPPY in
0) complain "$0: $1 has no value" ;;
*) echo $HAPPY ;;
esac
SHAR_EOF
$shar_touch -am 0512005499 'value' &&
chmod 0764 'value' ||
$echo 'restore of' 'value' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'value:' 'MD5 check failed'
0c4c0286de624be33315ce73666944ba value
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'value'`"
test 218 -eq "$shar_count" ||
$echo 'value:' 'original size' '218,' 'current size' "$shar_count!"
fi
fi
# ============= valuep ==============
if test -f 'valuep' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'valuep' '(file already exists)'
else
$echo 'x -' extracting 'valuep' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'valuep' &&
#!/bin/ash
X
X
#valuep : returns true is $1 is a symbol with a value
X
FANCY=`cdr $1`
HAPPY=`symbol-value $FANCY`
case $HAPPY in
0) exec echo 1;;
*) exec echo 2;;
esac
SHAR_EOF
$shar_touch -am 0718004599 'valuep' &&
chmod 0764 'valuep' ||
$echo 'restore of' 'valuep' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'valuep:' 'MD5 check failed'
f2a8fc9761559208493afa0a0d882f06 valuep
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'valuep'`"
test 165 -eq "$shar_count" ||
$echo 'valuep:' 'original size' '165,' 'current size' "$shar_count!"
fi
fi
# ============= valuep-novalue ==============
if test -f 'valuep-novalue' && test "$first_param" != -c; then
$echo 'x -' SKIPPING 'valuep-novalue' '(file already exists)'
else
$echo 'x -' extracting 'valuep-novalue' '(text)'
sed 's/^X//' << 'SHAR_EOF' > 'valuep-novalue' &&
#!/bin/ash
X
X
#valuep : returns true is $1 is a symbol with a value
X
FANCY=`cdr $1`
HAPPY=`symbol-value $FANCY`
case $HAPPY in
0) exec false;;
*) exec true;;
esac
SHAR_EOF
$shar_touch -am 0718004699 'valuep-novalue' &&
chmod 0764 'valuep-novalue' ||
$echo 'restore of' 'valuep-novalue' 'failed'
if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
&& ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
md5sum -c << SHAR_EOF >/dev/null 2>&1 \
|| $echo 'valuep-novalue:' 'MD5 check failed'
401759c0a5c051b6c26ae867ead5a28d valuep-novalue
SHAR_EOF
else
shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'valuep-novalue'`"
test 162 -eq "$shar_count" ||
$echo 'valuep-novalue:' 'original size' '162,' 'current size' "$shar_count!"
fi
fi
rm -fr _sh16939
exit 0
--------------543BC091FEE910FAB5B1C937--
Matthew Pollack wrote in message <·················@hotmail.com>...
>The attached file is a bit big. It's a shar file (unfortunately, the
>name got dos-chopped).
>Run it in a new directory and enjoy.
>
>mp
>
I tried to run it on my RH 6.0 box but get errors....
'hips.dis: syntax error near unexpected token `do
'hips.dis: Ships.dis: line 172: `do
Any hints? I'm using bash (bash-1.14.7-16).
Damond