[comp.sources.unix] v10i026: Logo interpreter for Unix, Part06/06

rs@uunet.UU.NET (Rich Salz) (06/27/87)

Submitted by: Brian Harvey <bh@mit-amt>
Mod.Sources: Volume 10, Number 26
Archive-Name: logo/Part06

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 6 (of 6)."
# Contents:  logoman.2
# Wrapped by rsalz@pineapple.bbn.com on Wed Jun 24 14:27:02 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f logoman.2 -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"logoman.2\"
else
echo shar: Extracting \"logoman.2\" \(36119 characters\)
sed "s/^X//" >logoman.2 <<'END_OF_logoman.2'
X\f3pendown\f1 \(em Command, no inputs.  Abbreviation: \f3pd\f1
X.IN
XThis command tells the turtle to lower its pen, so that
Xlater commands will draw lines when the turtle moves.
X.OU
X\f3penerase\f1 \(em Command, no inputs.  Abbreviation: \f3pe\f1
X.IN
XThis command tells the turtle to "lower its eraser", so that lines
Xpreviously drawn will be erased when retraced by the turtle.  It
Xonly works with the display turtle.  The commands \f3penup\f1,
X\f3pendown\f1, \f3penerase\f1, and \f3penreverse\f1
Xare mutually exclusive; whichever
Xwas most recently used is the one which affects the turtle.  (Graphics
Xterminals which cannot selectively erase lines, such as Tektronix
Xdisplays, will treat \f3penerase\f1 as \f3pendown\f1.)
X.OU
X\f3penreverse\f1 \(em Command, no inputs.  Abbreviation: \f3px\f1
X.IN
XThis command tells the display turtle to lower its "reversing pen";
Xthereafter, when the turtle moves, it turns on any points which were
Xoff, and turns off any points which were on.  The commands \f3penup\f1,
X\f3pendown\f1, \f3penerase\f1, and \f3penreverse\f1 are mutually
Xexclusive; whichever was most recently used is the one which affects the
Xturtle.  (Note:  Graphics terminals which cannot penreverse will treat
Xthis command as \f3pendown\f1.)
X.OU
X\f3penmode\f1 \(em Operation, no inputs.
X.IN
XThis operation applies to the floor or the display turtle.  It outputs one
Xof the words \f3penup\f1, \f3pendown\f1, \f3penerase\f1, or
X\f3penreverse\f1, depending on the current state of the turtle's pen.
X.OU
X\f3lampon\f1 \(em Command, no inputs.  Abbreviation: \f3lon\f1
X.IN
XThis command applies only to the floor turtle; it turns on the
Xheadlamps on the front of the turtle.
X.OU
X\f3lampoff\f1 \(em Command, no inputs.  Abbreviation: \f3loff\f1
X.IN
XThis command turns off the floor turtle's headlamps.
X.OU
X\f3hitoot\f1 \(em Command, one input.  Abbreviation: \f3hit\f1
X.IN
XThis command applies only to the floor turtle.  It sounds the
Xturtle's horn at the higher of its two pitches.  The input is
Xa number which indicates the number of quarter-seconds to toot
Xthe horn.  Note: large numbers are likely to lead to violent
Xbehavior on the part of other computer users.
X.OU
X\f3lotoot\f1 \(em Command, one input.  Abbreviation: \f3lot\f1
X.IN
XThis command sounds the floor turtle's horn at the lower of
Xits two pitches.  The input is the duration of the toot.
X.OU
X\f3ftouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3fto\f1
X.IN
XThis operation can be used only with the floor turtle.  It has as its
Xoutput the word \f3true\f1 if the front of the turtle is touching an
Xobstacle; otherwise it has the word \f3false\f1 as its output.
X.OU
X\f3btouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3bto\f1
X.IN
XThis operation can be used only with the floor turtle.  It has as its
Xoutput the word \f3true\f1 if the back of the turtle is touching an
Xobstacle; otherwise it has the word \f3false\f1 as its output.
X.OU
X\f3ltouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3lto\f1
X.IN
XThis operation can be used only with the floor turtle.  It has as its
Xoutput the word \f3true\f1 if the left side of the turtle is touching an
Xobstacle; otherwise it has the word \f3false\f1 as its output.
X.OU
X\f3rtouch\f1 \(em Operation (predicate), no inputs.  Abbreviation: \f3rto\f1
X.IN
XThis operation can be used only with the floor turtle.  It has as its
Xoutput the word \f3true\f1 if the right side of the turtle is touching an
Xobstacle; otherwise it has the word \f3false\f1 as its output.
X.OU
X\f3clearscreen\f1 \(em Command, no inputs.  Abbreviation: \f3cs\f1
X.IN
XThis command applies only to the display turtle.  It erases everything
Xon the TV screen, and restores the turtle to its initial position and
Xheading (center of the screen, facing toward the top edge).
X.OU
X\f3wipeclean\f1 \(em Command, no inputs.  Abbreviation: \f3clean\f1
X.IN
XThis command applies only to the display turtle.  It erases everything
Xon the TV screen, but does not change the turtle's position or heading.
X.OU
X\f3fullscreen\f1 \(em Command, no inputs.  Abbreviation: \f3full\f1
X.IN
XThis command applies only to the Atari display turtle.  It eliminates the
Xuse of the bottom four lines of the screen to display the commands
Xyou type; instead, the entire screen is available to show the
Xpicture drawn by the turtle.  However, you can no longer see
Xwhat you're typing.  The command may be used after the picture is
Xalready drawn; the part "hidden" by the text at the bottom of
Xthe screen will become visible.  On other displays, \f3fullscreen\f1 and
X\f3splitscreen\f1 are equivalent; they make the entire screen available
Xfor graphics, and text appears on the bottom line (Gigis) or superimposed
X(ADMs), or somewhere.
X.OU
X\f3splitscreen\f1 \(em Command, no inputs.  Abbreviation: \f3split\f1
X.IN
XThis command applies only to the Atari display turtle.  It restores the
Xnormal text display at the bottom of the screen, undoing the
Xeffect of the \f3full\f1 command.  On other displays, \f3fullscreen\f1 and
X\f3splitscreen\f1 are equivalent; they make the entire screen available
Xfor graphics, with text superimposed in a display-dependent area.
X.OU
X\f3textscreen\f1 \(em Command, no inputs.  Abbreviation: \f3text\f1
X.IN
XThis command applies only to the display turtle.  It temporarily
Xremoves the turtle display from the screen, making the entire
Xscreen available for text display.  The commands \f3fullscreen\f1 and
X\f3splitscreen\f1 will restore the graphics display.  Note:  On the Atari
Xdisplay, the picture on the screen is remembered, so that when you return
Xto \f3fullscreen\f1 or \f3splitscreen\f1 mode, the picture returns to the
Xscreen.  On other displays, the picture is forgotten, and you return to
Xan empty graphics screen.
X.OU
X\f3hideturtle\f1 \(em Command, no inputs.  Abbreviation: \f3ht\f1
X.IN
XThis command applies only to the display turtle.  It erases the
Xdisplay of the turtle itself from the screen, so that only the
Xlines drawn when the turtle moves are visible.  The display is
Xfaster when the turtle is hidden (only slightly faster on the Atari,
Xbut much faster on other terminals).  Also, once a graphics
Xprogram is debugged, it may be prettier to watch without the
Xturtle visible.  (Note:  On the Tektronix display, the turtle is
Xnever visible, because the terminal cannot erase selectively.)
X.OU
X\f3showturtle\f1 \(em Command, no inputs.  Abbreviation: \f3st\f1
X.IN
XThis command applies only to the display turtle.  It restores
Xthe display of the turtle, after the \f3hideturtle\f1 command
Xhas been used.  (Note:  On the Tektronix display, the turtle is
Xnever visible.)
X.OU
X\f3shownp\f1 \(em Operation (predicate), no inputs.
X.IN
XThis predicate applies only to the display turtle.  It outputs the word
X\f3true\f1 if the turtle is visible on the TV screen, \f3false\f1 otherwise.
X.OU
X\f3pencolor\f1 \(em Command, one input.  Abbreviation: \f3penc\f1
X.IN
XThis command applies only to the display turtle.  Its effect is different
Xdepending on how each type of terminal supports color.  For the Atari, the
Xinput must be
Xan integer between 0 and 6.  An input of 0 enters black-and-white
Xdisplay mode (which is the turtle's initial mode), in which lines
Xare as thin as possible but there is no control of color.  Any other
Xinput selects color mode, in which lines are twice as thick, so the
Xeffective size of the screen is smaller, but colors can be used.  There
Xare, in color mode, three possible pen colors, numbered 1 to 3.  There
Xare 256 possible colors, but only three can be on the screen at a time;
Xthe \f3setcolor\f1 command is used to decide which pen draws in which
Xactual color.  If the input is 4, 5, or 6, the color is that of pen
X1, 2, or 3, respectively, but lines are drawn in "fill mode": for each
Xpoint inked, all points to its right are also inked until a point is
Xreached which was already inked.  On the Gigi, there is only one mode, and
Xthere is no loss of resolution in using color.  The input must be between
X0 and 7; 0 means black, 7 means white.  The ADM, Tektronix, and Sun displays
Xdo not have multi-color drawing.
X.OU
X\f3setcolor\f1 \(em Command, two inputs.  Abbreviation: \f3setc\f1
X.IN
XThis command applies only to the Atari display turtle.  The first input
Xmust be an integer between 0 and 3.  If the input is nonzero, the
Xsecond input specifies the color for the pen selected by the first
Xinput.  If the first input is zero, the second input specifies the
Xbackground color for the color graphics display.  The second input
Xis either an integer between 0 and 15, which is a color number, or
Xa list of two integers, in which case the first is a color number
Xand the second is an intensity number, an integer between 0 and 7.
X.OU
X\f3setxy\f1 \(em Command, two inputs.
X.IN
XThe two inputs must be numbers.  The turtle is moved to the point
Xon the screen whose x (horizontal) coordinate is the first input,
Xand whose y (vertical) coordinate is the second input.  The center
Xof the screen, where the turtle starts, has both coordinates zero.
XIf the pen is down, this command draws a line.  This command
Xapplies only to the display turtle.
X.OU
X\f3setheading\f1 \(em Command, one input.  Abbreviation: \f3seth\f1
X.IN
XThe input must be a number.  The turtle's heading is set to the
Xinput, taken in degrees.  Zero points straight up, as the turtle
Xstarts out; positive headings are clockwise from zero.  This command
Xapplies only to the display turtle.
X.OU
X\f3towardsxy\f1 \(em Operation, two inputs.
X.IN
XThis operation applies only to the display turtle.  The two inputs must
Xbe numbers, which are the x and y coordinates of a point on the TV
Xscreen.  The output is a number which is the heading to which the turtle
Xmust be set, in order to point towards that point from its current
Xposition.  Note: this operation does not actually move or turn the
Xturtle.  You must use it as the input to \f3setheading\f1 if that is
Xwhat you want.
X.OU
X\f3xcor\f1 \(em Operation, no inputs.
X.IN
XThe output is the turtle's current x (horizontal) coordinate.  The
Xoperation works only with the display turtle.
X.OU
X\f3ycor\f1 \(em Operation, no inputs.
X.IN
XThe output is the turtle's current y (vertical) coordinate.  This
Xoperation works only with the display turtle.
X.OU
X\f3heading\f1 \(em Operation, no inputs.
X.IN
XThe output is the turtle's current heading in degrees.  This operation
Xworks only with the display turtle.
X.OU
X\f3getpen\f1 \(em Operation, no inputs.
X.IN
XThe output is the turtle's current pen color, or (on the Atari) zero
Xif in black-and-white
Xmode.  This operation works only with the display turtle.
X.OU
X\f3setscrunch\f1 \(em Command, one input.  Abbreviation: \f3setscrun\f1
X.IN
XThis command is used only for display turtles.  The
Xinput must be a number.  The vertical component of turtle motion is
Xmultiplied by this number before each motion is taken.  If squares come
Xout too wide on your screen, you should increase the number; if too tall,
Xyou should decrease it.  (You can also use \f3setscrunch\f1 to deform the
Xturtle's motion on purpose, so for example a circle program will draw
Xan ellipse instead.)  The initial scrunch value depends on the terminal
Xyou are using: for the Atari and the Gigi, it is around 0.8 (your particular
Xcomputer center will adjust this for the particular TV monitors you use),
Xbut for the ADM, Tektronix, and Sun, it is 1.0 because these terminals
Xdisplay the same size steps horizontally and vertically.
X.OU
X\f3scrunch\f1 \(em Operation, no inputs.
X.IN
XThis operation is used only for display turtles.  It outputs a number, which
Xis the scrunch factor (or aspect ratio) by which vertical motion is
Xmultiplied before it is displayed.  This number is changed using the
X\f3setscrunch\f1 command.
X.OU
X.ti +5
X.UB "Primitive procedures for arithmetic."
XSeveral procedures
Xare available for arithmetic operations on numbers.  In all
Xcases, the inputs to these procedures must be numbers, except
Xas otherwise indicated in the individual descriptions.
X.PP
XIn general, procedures are used in Logo by typing first the name
Xof the procedure, then its inputs.  This is true of arithmetic
Xprocedures also, e.g.
X.EX
Xsum 3 2
X.EC
XHowever, for some arithmetic operations, Logo also recognizes the
Xmore traditional \f2infix\f1 notation, with the operation between
Xthe two inputs:
X.EX
X3 + 2
X.EC
XBe warned, though, that the use of infix forms makes it difficult
Xfor Logo to know how to group operations, unless parentheses are
Xused.  If you stick to the standard (in Logo) prefix notation,
Xthe grouping is always unambiguous.  For example, the first two of
Xthese three instructions are equivalent, but the third is not:
X.EX
Xif equalp count "hello 5 [print "Yes.]
Xif (count "hello) = 5 [print "Yes.]
Xif count "hello = 5 [print "Yes.]
X.EC
XThe reason for the error message produced by the last of those three
Xinstructions is that Logo interprets it as
X.EX
Xif count equalp "hello 5 [print "Yes.]
X.EC
XThat is, the equality test is done first, on the word \f3hello\f1
Xitself, rather than first taking the count of \f3hello\f1 as
Xwas intended.
X.sp 1
X\f3sum\f1 \(em Operation, two inputs.  Infix: \f3+\f1
X.IN
XThe output of this procedure is the sum of the two inputs.
X.OU
X\f3difference\f1 \(em Operation, two inputs.  Abbreviation: \f3diff\f1  Infix: \f3-\f1
X.IN
XThe output of this procedure is the difference of the two inputs.
X.OU
X\f3product\f1 \(em Operation, two inputs.  Infix: \f3*\f1
X.IN
XThe output of this procedure is the product of the two inputs.
X.OU
X\f3quotient\f1 \(em Operation, two inputs.  Infix: \f3/\f1
X.IN
XThe output of this procedure is the quotient of the two inputs.
X.OU
X\f3remainder\f1 \(em Operation, two inputs.  Abbreviation: \f3mod\f1  Infix: \f3\\\f1
X.IN
XThe inputs to this procedure must be integers.  The output is also an
Xinteger, and is the remainder of dividing the first input by the
Xsecond.
X.OU
X\f3maximum\f1 \(em Operation, two inputs.  Abbreviation: \f3max\f1
X.IN
XThe output of this procedure is equal to whichever of the two inputs
Xis numerically greater.
X.OU
X\f3minimum\f1 \(em Operation, two inputs.  Abbreviation: \f3min\f1
X.IN
XThe output of this procedure is equal to whichever of the two inputs
Xis numerically smaller.
X.OU
X\f3greaterp\f1 \(em Operation (predicate), two inputs.  Infix: \f3>\f1
X.IN
XThe output of this procedure is the word \f3true\f1 if the first input
Xis numerically strictly greater than the second input.  Otherwise the
Xoutput is the word \f3false\f1.
X.OU
X\f3lessp\f1 \(em Operation (predicate), two inputs.  Infix: \f3<\f1
X.IN
XThe output of this procedure is the word \f3true\f1 if the first input
Xis numerically strictly less than the second input.  Otherwise the
Xoutput is the word \f3false\f1.
X.OU
X\f3equalp\f1 \(em Operation (predicate), two inputs.  Infix: \f3=\f1
X.IN
XThe two inputs to this procedure may be any Logo objects.  If they
Xare numbers, then the output is the word \f3true\f1 if they are
Xnumerically equal, \f3false\f1 if they are numerically unequal.  If
Xeither input is not a number, then the output is the same as for the
Xprocedure \f3is\f1: it is \f3true\f1 if the two inputs are identical,
X\f3false\f1 if not.  For example, the numbers \f32\f1 and \f32.0\f1 are
Xnumerically equal, but not identical.
X.OU
X\f3numberp\f1 \(em Operation (predicate), one input.
X.IN
XThe input may be any Logo object.  The output is the word \f3true\f1 if
Xthe input is a number, \f3false\f1 if not.
X.OU
X\f3zerop\f1 \(em Operation (predicate), one input.
X.IN
XThe input must be a number.  The output is the word \f3true\f1 if the
Xinput is numerically equal to zero, \f3false\f1 otherwise.
X.OU
X\f3random\f1 \(em Operation, one input.  Abbreviation: \f3rnd\f1
X.IN
XThe input must be a positive integer.  The output is a randomly
Xselected integer between 0 and one less than the input.
X.OU
X\f3sqrt\f1 \(em Operation, one input.
X.IN
XThe input must be a nonnegative number.  The output is its square root.
X.OU
X\f3pow\f1 \(em Operation, two inputs.
X.IN
XThe inputs must be numbers.  If the first is negative, the second must
Xbe an integer.  The output is the first number raised to the power of
Xthe second input.
X.OU
X\f3sin\f1 \(em Operation, one input.
X.IN
XThe input must be numeric.  The output is the sine of the input, taken
Xin degrees, not radians.
X.OU
X\f3cos\f1 \(em Operation, one input.
X.IN
XThe input must be numeric.  The output is the cosine of the input, taken
Xin degrees, not radians.
X.OU
X\f3arctan\f1 \(em Operation, one input.  Abbreviation: \f3atan\f1
X.IN
XThe input must be numeric.  The output is the arctangent, in degrees, of
Xthe input.
X.OU
X.ti +5
X.UB "Primitive procedures for conditional execution."
XThe predicates
X(like \f3wordp\f1) which we've mentioned above can be used to carry out
Xsome command only if a condition is met.  The basic command for the
Xpurpose is \f3if\f1:
X.sp 1
X\f3if\f1 \(em Command or operation, two or three inputs.
X.IN
XThe first input to the \f3if\f1 procedure must be either the word \f3true\f1 or
Xthe word \f3false\f1.  Typically, it is the output from a predicate.  The second
Xand (optional) third inputs are lists containing instruction lines.  The second
Xinput is executed if the first input is \f3true\f1.  The third input, if any,
Xis executed if the first input is \f3false\f1:
X.sp 1
X.nf
X\f3to greet :person
Xif equalp :person [Ronald Reagan] [print [Hi, turkey!]] \\
X	[print sentence "Hi, :person]
Xend\f1
X.fi
X.sp 1
XIn that example, the first input to \f3if\f1 is the output from the expression
X.br
X\f3equalp :person [Ronald Reagan]\f1.
X.sp 1
XThe \f3if\f1 procedure can be used as an operation, producing a value.  In this
Xcase, the third input is required:
X.sp 1
X.nf
X\f3print if equalp :person "Reagan ["Loser] ["Winner]\f1
X.fi
X.OU
X\f3test\f1 \(em Command, one input.
X.IN
XThe input must be the word \f3true\f1 or the word \f3false\f1.  The command
Xremembers its input for use in a later \f3iftrue\f1 or \f3iffalse\f1
Xcommand.  This is an alternative to \f3if\f1 which is useful if several
Xinstructions are to be made conditional on the same condition.  The
Xremembered truth value is local to the current procedure, if any.
X.OU
X\f3iftrue\f1 \(em Command, one input.  Abbreviation: \f3ift\f1
X.IN
XThe input must be an instruction list.  It is run if the most recent
X\f3test\f1 command saved a \f3true\f1 value.
X.OU
X\f3iffalse\f1 \(em Command, one input.  Abbreviation: \f3iff\f1
X.IN
XThe input must be an instruction list.  It is run if the most recent
X\f3test\f1 command saved a \f3false\f1 value.
X.OU
X\f3both\f1 \(em Operation (predicate), two inputs.  Abbreviation: \f3and\f1
X.IN
XThe two inputs must both be either \f3true\f1 or \f3false\f1.  The output
Xis \f3true\f1 if both inputs are \f3true\f1; otherwise the output is
X\f3false\f1.
X.OU
X\f3either\f1 \(em Operation (predicate), two inputs.  Abbreviation: \f3or\f1
X.IN
XThe two inputs must be either \f3true\f1 or \f3false\f1.  The output
Xis \f3true\f1 if at least one of the inputs is \f3true\f1; otherwise
Xthe output is \f3false\f1.
X.OU
X\f3not\f1 \(em Operation (predicate), one input.
X.IN
XThe input must be either \f3true\f1 or \f3false\f1.  The output is
X\f3true\f1 if the input is \f3false\f1, and vice versa.
X.OU
X.ti +5
X.UB "Primitive procedures for file input and output."
XIn the Unix
Xoperating system, there are two steps in reading or writing files: first,
Xthe file must be \f2opened\f1, thereby associating a "file descriptor"
X(an integer) with the file name; second, the file descriptor is used
Xto specify the file for each read or write operation.  Logo has
Xprimitive procedures for each of these steps.
X.sp 1
X\f3openread\f1 \(em Operation, one input.  Abbreviation: \f3openr\f1
X.IN
XThe input to this procedure is a word, which must be a Unix filename.  It
Xcan contain slashes to indicate directory names.  If the file can be
Xopened for reading, the output from the procedure is a file descriptor,
Xwhich should be stored in a variable for use in reading the file.  If the
Xfile cannot be opened, an error results.
X.OU
X\f3fileread\f1 \(em Operation, one input.  Abbreviation: \f3fird\f1
X.IN
XThe input must be a file descriptor, previously output by \f3openread\f1.  The
Xprocedure reads one line from the file.  The output is the line, in the form
Xof a list.  (That is, the output is the file line as if enclosed in square
Xbrackets in a program.)  If the end of the file has been reached, the output
Xis the empty word.  If the file line contains mismatched brackets, trouble
Xmay result.
X.OU
X\f3fileword\f1 \(em Operation, one input.  Abbreviation: \f3fiwd\f1
X.IN
XThe input must be a file descriptor, open for reading.  The procedure
Xreads one line from the file.  The output is that line, in the form of
Xa single word, including spaces and punctuation characters.  If the end
Xof the file has been reached, the output is the empty list.
X.OU
X\f3openwrite\f1 \(em Operation, one input.  Abbreviation: \f3openw\f1
X.IN
XThe input must be a Unix filename.  The file is opened for writing
X(replacing any previous version), if allowed, and the output is a file
Xdescriptor, for use by file printing commands below.  If the file
Xcannot be opened, an error results.
X.OU
X.nf
X\f3fileprint\f1 \(em Command, two inputs.  Abbreviation: \f3fip\f1
X\f3filetype\f1 \(em Command, two inputs.  Abbreviation: \f3fity\f1
X\f3filefprint\f1 \(em Command, two inputs.  Abbreviation: \f3fifp\f1
X\f3fileftype\f1 \(em Command, two inputs.  Abbreviation: \f3fifty\f1
X.fi
X.IN
XThe first input must be a file descriptor previously output by
X\f3openwrite\f1.  The second input is any object.  The second input
Xis printed (typed, fprinted, ftyped) into the file.
X.OU
X\f3close\f1 \(em Command, one input.
X.IN
XThe input must be a file descriptor.  The file is closed.  This must
Xbe done when you've finished reading or writing the file.
X.sp 1
XSample program:
X.sp 1
X.nf
X\f3make "fd openwrite "outfile
Xfileprint :fd "Hello.
Xclose :fd\f1
X.fi
X.sp 1
XThis will create a file named \f3outfile\f1 containing the word \f3Hello.\f1
X.OU
X.ti +5
X.UB "Primitive procedures for procedure exit."
XA procedure written by
Xa user, in Logo, can be a command or an operation.  If it is an operation,
Xyou must, in the procedure, say what its output should be.  If it is a
Xcommand, it can simply stop at the end of the procedure, or you can explicitly
Xmake it stop before the end.
X.sp 1
X\f3output\f1 \(em Command, one input.  Abbreviation: \f3op\f1
X.IN
XThis command is used in a user procedure which is meant to be an
Xoperation.  The input to this command becomes the output from the
Xuser procedure.  Please don't be confused by the fact that the user
Xprocedure is an operation, while the \f3output\f1 primitive
Xprocedure is a command used in that procedure.  Example:
X.sp 1
X.nf
X\f3to nickname :person
Xif equalp :person [Peter Parker] [output "Spiderman]
Xif equalp :person [Lamont Cranston] [output "Shadow]
Xoutput first :person
Xend\f1
X.fi
X.OU
X\f3stop\f1 \(em Command, no inputs.
X.IN
XThis command is used in user procedures which are meant to be
Xcommands.  It stops the user procedure.  (Note that it does not
Xstop all running procedures.  If user procedure A runs user procedure
XB, a \f3stop\f1 command in procedure B returns to procedure A, which
Xcontinues after the point where procedure B was invoked.)
X.OU
X\f3toplevel\f1 \(em Command, no inputs.
X.IN
XThis command stops all running procedures.  The user at the terminal
Xis prompted to type another command.  This can be used when a user
Xprocedure discovers some error condition and wants to abort the entire
Xprogram, for example.
X.OU
X.ti +5
X.UB "Property lists."
XIt is possible to associate with any name a list
Xof "properties".  A property list contains property names and property
Xvalues.  For example:
X.IN
X.nf
X.sp 1
X\f3pprop "bh "firstname "Brian
Xpprop "bh "lastname "Harvey\f1
X.fi
X.OU
XThe form of a property list is
X.EX
X[name1 val1 name2 val2 name3 val3]
X.EC
XAlthough this data structure could be created using other Logo primitives,
Xspecial property list primitives are provided because they are faster.  The
Xproperty lists do not share storage with Logo variables, so you can change
Xthe value of any property without having to recopy the entire property list
Xas you would ordinarily.  The following primitives manipulate property lists.
X.sp 1
X\f3pprop\f1 \(em Command, three inputs.
X.IN
XThe first input, which must be a word, is a name with which a property list
Xis associated.  The second input, which must be a word, is the name of a
Xproperty.  The third input can be any Logo object.  It becomes the value
Xof the specified property of the specified name.
X.OU
X\f3gprop\f1 \(em Operation, two inputs.
X.IN
XBoth inputs must be words.  The first is a name, and the second is a
Xproperty name.  The output is the value of the indicated property of the
Xindicated object.  It is not an error if there is no such property;
Xthe output in that case is the empty list.
X.OU
X\f3remprop\f1 \(em Command, two inputs.
X.IN
XThe inputs must be words, as for \f3gprop\f1.  The specified property
Xis removed from the specified name.
X.OU
X\f3plist\f1 \(em Operation, one input.
X.IN
XThe input must be a word, which is a name.  The output is the property
Xlist of the specified name.  Note: the output is actually a copy of the
Xproperty list.  The real property list is not a Logo list.  Any later
Xchanges to the properties of the specified name will not change the
Xlist which was output by an earlier \f3plist\f1.
X.OU
X\f3pps\f1 \(em Command, no inputs.
X.IN
XAll properties of all names are listed on your terminal.
X.OU
X.ti +5
X.UB "Pausing."
XWhen you are debugging a complicated Logo program, it is
Xvery helpful to be able to stop in the middle of a procedure, so that you
Xcan give interactive commands to examine its inputs and other local
Xvariables.  This is different from stopping a procedure, which destroys
Xits local environment.  There are three ways a procedure can pause:  (1) You
Xcan include the command \f3pause\f1 in the procedure definition, to make the
Xprocedure pause at a particular place you choose in advance; (2) you can
Xdecide to pause a procedure while it is running by typing the system
X"interrupt" character (this is control-C at Lincoln-Sudbury but is different
Xon other systems); or (3) you can arrange for an error in the processing of
Xthe procedure to pause instead of stopping as it usually does.
X.PP
XNote that when you type the system "quit" character (control-G at
XLincoln-Sudbury) Logo does not pause, but returns to toplevel.  All
Xinformation about the local state of your active procedures is lost.
X.PP
XWhen you are paused, Logo accepts instructions from your terminal as it
Xdoes at toplevel, but local variables can be examined or modified.  To let
Xyou know that you are paused, Logo prompts with the characters "\f3-?\f1"
Xinstead of just "\f3?\f1" as usual.  It is possible to pause within a
Xprocedure within a pause; in this case your prompt is "\f3--?\f1" to
Xindicate two levels of pause.  This can be continued to higher levels.
X.PP
XTo get out of a pause, there are three things you can do.  You can give the
Xcommand \f3toplevel\f1, which stops all pending procedures and returns to
Xinteractive top level.  You can give the command \f3stop\f1 or the command
X\f3output\f1 with an input, which will terminate the current procedure
X(without or with an output respectively) and return to its calling
Xprocedure.  Or you can give the command \f3continue\f1, which will resume
Xthe procedure at the point where you paused.
X.sp 1
X\f3pause\f1 \(em Command, no inputs.
X.IN
XThis command is meaningful only within a procedure.  It causes a pause.
X.OU
X\f3continue\f1 \(em Command, no inputs.  Abbreviation: \f3co\f1
X.IN
XThis command is meaningful only when typed during an interactive pause.  It
Xcontinues the current procedure from where it was paused.
X.OU
X\f3errpause\f1 \(em Command, no inputs.
X.IN
XThis command tells Logo that any errors which happen during procedure
Xexecution from now on should cause a pause, rather than a return to
Xtoplevel.
X.OU
X\f3errquit\f1 \(em Command, no inputs.
X.IN
XThis command tells Logo that any errors which happen during procedure
Xexecution from now on should return to toplevel, rather than pausing.  This
Xis the initial state of affairs when you start Logo.
X.OU
X\f3setqpause\f1 \(em Command, no inputs.
X.IN
XThis command tells Logo that from now on, the system quit character should
Xpause, and the system interrupt character should return to toplevel.  This
Xis the reverse of the usual interpretation.  This command is provided for
Xpeople whose systems or keyboards make one of these characters easier to
Xtype than the other.  In particular, under Eunice there is only an interrupt
Xcharacter, not a quit character.
X.OU
X\f3setipause\f1 \(em Command, no inputs.
X.IN
XThis command tells Logo that from now on, the system interrupt character
Xshould pause, and the system quit character should return to toplevel.  This
Xis the initial state of affairs when you start Logo.
X.OU
X.ti +5
X.UB "Miscellaneous primitives."
XThe remaining primitives are one
Xof a kind, or very obscure, or both.
X.sp 1
X\f3goodbye\f1 \(em Command, no inputs.  Abbreviation: \f3bye\f1
X.IN
XThis command is used to leave Logo.  It is the only way out, unless
Xthere is a bug somewhere.
X.OU
X\f3thing\f1 \(em Operation, one input.
X.IN
XThe input must be a word, and must be the name of a variable.  The
Xoutput is the value of the variable.  These are equivalent:
X.sp 1
X.nf
X\f3:foo
Xthing "foo\f1
X.fi
X.OU
X\f3namep\f1 \(em Operation (predicate), one input.
X.IN
XThe input must be a word.  The output is \f3true\f1 if that word is the
Xname of a variable which has a value assigned to it, \f3false\f1 otherwise.
X.OU
X\f3wait\f1 \(em Command, one input.
X.IN
XThe input must be a positive integer.  Logo waits that many seconds
Xbefore continuing.
X.OU
X\f3trace\f1 \(em Command, no inputs.
X.IN
XThis command is used for debugging your Logo programs.  After you use
Xthis command, every time a user-defined procedure starts or stops, a
Xmessage is typed at your terminal naming the procedure and its inputs
Xor its output, if any.  The message is indented according to the depth
Xin procedure calls.
X.OU
X\f3untrace\f1 \(em Command, no inputs.
X.IN
XThis command turns off the trace messages started by the \f3trace\f1
Xcommand.
X.OU
X\f3unix\f1 \(em Command, one input.
X.IN
XThe input must be a Unix shell command, which is carried out in a
Xforked shell.  (/bin/sh is used, not csh.)  Example:
X.sp 1
X.nf
X\f3to whois :user
Xunix (sentence "grep (word "'^ :user ":') "/etc/inquir)
Xend\f1
X.fi
X.OU
X\f3run\f1 \(em Command or operation, one input.
X.IN
XThe input must be a list, containing a Logo instruction line.  The list is
Xrun as if you typed it directly to Logo.  Example:
X.sp 1
X.nf
X\f3to while :condition :cmd
Xif not run :condition [stop]
Xrun :cmd
Xwhile :condition :cmd
Xend
X.sp 1
Xmake "number 1
Xwhile [:number < 5] [print :number; make "number :number+1]\f1
X.fi
X.sp 1
XThe \f3run\f1 procedure can be used as an operation, if its input is a Logo
Xexpression which produces a value, instead of a complete instruction:
X.sp 1
X\f3print run [sum 2 3]\f1
X.OU
X\f3repeat\f1 \(em Command, two inputs.
X.IN
XThe first input must be a positive number.  The second is an instruction list,
Xas for the \f3run\f1 command.  The list is run repeatedly, the number of times
Xspecified by the first input:
X.sp 1
X\f3repeat 5 [print "hello]\f1
X.OU
X\f3repcount\f1 \(em Operation, no inputs.
X.IN
XThis operation may be used only within the range of a \f3repeat\f1 command.  It
Xoutputs the number of repetitions which have been done, including the current
Xone.  That is, it outputs 1 the first time through, 2 the second time, and
Xso on.
X.OU
X\f3break\f1 \(em Command, no inputs.
X.IN
XThis command is only meaningful within the range of an \f3if\f1 command
Xwithin the range of a \f3repeat\f1 command.  It terminates the repeat
Ximmediately.  If used in other contexts, the results may be strange.
X.OU
X\f3cbreak\f1 \(em Command, one input.
X.IN
XThe input must be either the word \f3on\f1 or the word \f3off\f1.  If
Xthe input is \f3on\f1, your terminal is placed in cbreak mode, which
Xmeans that what you type is made available to your program every
Xcharacter, rather than every line.  This must be done before the
X\f3readchar\f1 procedure, below, will work.  This facility is good for
Xwriting video game programs or text editors.  While in cbreak mode, echo
Xis turned off also.
X.OU
X\f3readchar\f1 \(em Operation, no inputs.  Abbreviation: \f3rc\f1
X.IN
XThis operation waits for you to type a single character at your terminal.  The
Xoutput is a word containing only that character.  This works only if you
Xhave turned on cbreak mode; see above.
X.OU
X\f3keyp\f1 \(em Operation (predicate), no inputs.
X.IN
XThis procedure outputs \f3true\f1 if there is a character waiting to
Xbe read from the terminal, if you are in cbreak mode.  If not, it
Xoutputs \f3true\f1 if there is an entire line waiting to be read.
X.OU
X\f3cleartext\f1 \(em Command, no inputs.  Abbreviation: \f3ct\f1
X.IN
XThis command clears the screen.  It uses termlib to be terminal-independent.
X.OU
X\f3setcursorxy\f1 \(em Command, two inputs.  Abbreviation: \f3setcxy\f1
X.IN
XThis command positions the terminal cursor to the column and row specified
Xby the two inputs, which must be integers.  It uses termlib to support a
Xwide variety of terminals, but not every terminal is capable of cursor
Xaddressing.  There is a library procedure setcursor that takes one input,
Xa list of two numbers, column and row.
X.OU
X\f3oflush\f1 \(em Command, no inputs.
X.IN
XNormally, when you tell Logo to print something, the printing is not done
Xright away.  Instead, Logo remembers everything you tell it to print, and the
Xprinting is done all at once the next time Logo is waiting for you to type
Xsomething.  This arrangement makes Logo much faster than it would be if
Xeverything were printed immediately.  The \f3oflush\f1 command tells Logo to
Xprint whatever you've previously asked for right away, without waiting.
X.OU
X\f3help\f1 \(em Command, no inputs.
X.IN
XThis command types at your terminal a brief message about Logo and
Xhow to use it.
X.OU
X\f3describe\f1 \(em Command, one input.
X.IN
XThe input must be the name of a Logo primitive procedure.  A brief
Xexplanation of that primitive is typed at your terminal.
X.OU
X\f3go\f1 \(em Command, one input.
X.IN
XThis command can be used only inside a procedure.  The input must be a
Xnumber.  The same number must appear at the beginning of some line in
Xthe same procedure.  (This line number is otherwise ignored.)
XThe next command executed will be
Xthe one on the indicated line in the definition.  Note: there is always
Xa better way to do it.  If you have previously programmed in BASIC, your
Xonly hope of ever really learning how to program computers is NEVER EVER
Xto use the \f3go\f1 command!
X.OU
X\f3debquit\f1 \(em Command, no inputs.
X.IN
XThis command is meant to be used only for debugging Logo itself.  It is
Xexplained here only for completeness.  After this command is used, the
XQUIT signal is not caught by Logo, so it will cause a core dump.
X.OU
X\f3memtrace\f1 \(em Command, no inputs.
X.IN
XThis command is meant to be used only for debugging Logo itself.  It is
Xexplained here only for completeness.  After this command is used, every
Xallocation or deallocation of memory, and every character parsed by the
Xinterpreter, types an incomprehensible message at your terminal.
X.OU
X\f3yaccdebug\f1 \(em Command, no inputs.
X.IN
XThis command is meant to be used only for debugging Logo itself.  It is
Xexplained here only for completeness.  After this command is used, every
Xstate transition in the yacc parser types an incomprehensible message
Xat your terminal.
X.OU
X.ti +5
X.UB "The Logo library."
XThe directory /usr/lib/logo contains Logo
Xprocedures which are available to all users.  They are not listed by
X\f3pots\f1, but can be thought of as pseudo-primitives which happen to
Xbe written in Logo.  Some of these procedures are only useful in conjunction
Xwith the teaching units used in Introduction to Computers, but others are
Xgenerally useful.  This manual does not fully document the Logo
Xlibrary, because it changes
Xtoo often.  Look through the /usr/lib/logo directory yourself if you want.
XThe procedures \f3setcursor\f1,
X\f3listp\f1, \f3home\f1, \f3pos\f1, \f3setpos\f1, \f3towards\f1, \f3setx\f1,
Xand \f3sety\f1 in the library are provided for partial compatibility with
XApple Logo.
X
END_OF_logoman.2
if test 36119 -ne `wc -c <logoman.2`; then
    echo shar: \"logoman.2\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 6 \(of 6\).
cp /dev/null ark6isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    echo "Now see the README"
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
*******