*popsh: Scripting with Poplog and Pop-11

popsh is an attempt to facilitate the use of pop-11, and other poplog
supported languages as scripting languages like perl, tcl, python and
bash.  Presently it is a saved image which understands the Unix
convention for executing interpretors, the #! syntax.  It's quite
simple and does not do much to help actual scripting along, that's
because I have never scripted in pop-11 so I don't know what I need
yet.  Hopefully, we can figure out what we need and build it.

*Where to get popsh

You can grab a copy of everything you need to build your own popsh
from: 

http://www.red-bean.com/~craig/popsh

*How to install popsh

Grab the tarball from the previously mentioned location.  unpack it
and you should get a "popsh" subdir.   Make sure that your poplog
environment variables are set up correctly, and then "cd" into the
"popsh" subdir.  Then you should just type "make" and when it's done
you will have a popsh.psv in that directory.  To install the image in
your $popsavelib, "make install".

1. <Make sure poplog environment is properly configured>
2. tar xzvf popsh-<VERSION>.tgz
3. cd popsh
4. make
5. make install


*How to write a popsh script:

In popsh the characters sequence "#!" opens up a comment, and "!#"
closes a comment.  Either '#' or '!' by themselves will be treated as
"sign" itemtypes (see POP REF * SYNTAX).  This allows us to use put #!
like Unix wants us too, at the beginning of a script.  Then we need to
close the comment, but ON THE NEXT LINE.  If we put the close of the
comment on the first line, it will be passed as an argument to pop11,
and it will be very confused.

Here is an example:

#!/usr/bin/pop11 +/usr/local/poplog/v15.53/pop/lib/psv/popsh.psv
!#
pr('Hello World');


*Gotchas

Notice how long and ugly the path for the image is.  This is not
necessary if you know that your script will always run in an
environment properly set up for pop, ie with $popsavepath set.
Hopefully in the near future we can wean poplog from i's
over-dependence on environment variables, but until then it might be
easy just to put the save image in an directory that is easier to
type.

readline() and some other pop-11 function assume that they have a tty
to attach too.  This means that you cannot use them to get input from
the user of a script unless you want to initialize a tty for them.  At
least this is my understanding so far, please correct me if I'm wrong.


*Credits

Well, there really isn't much here yet for anyone to take credit for,
but let's get the formalities out of the way:

Craig Brozefsky <craig@red-bean.com>