Power LOGO Release 1.0 by Gary Teachout DISTRIBUTION * * * * * * * * * * * * * * * * * * * * * * Copyright 1990 by Gary Teachout This program is freeware, and may be distributed freely. It may be distributed on any media, and included with other freely distributable software. It may not be distributed in any modified form. It may not be sold for profit, or included as part of a commercial software product. No donations are required but they would be appreciated. DISCLAIMER * * * * * * * * * * * * * * * * * * * * * * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ITS FITNESS FOR ANY PARTICULAR PURPOSE. This software is experimental and IT HAS DEFECTS, if you do not accept all of the risks and responsibilities of using defective software, then DO NOT USE THIS. POWER LOGO? * * * * * * * * * * * * * * * * * * * * * * Power LOGO is an experimental programming language based on Lisp and LOGO. It is versatile, highly interactive, organizes programs as collections of procedures, and includes lists as first-class data objects. My goal is to develop a language with the power and versatility of Lisp, the readablity of LOGO, plus access to the features of the Amiga. Some features of Power LOGO: Case sensitive. Demons (exceptions) triggered by keyboard, menus, mouse. Extra primitives: arithmetic (frac, log, power...). control (cond, dowhile, whenmenu, while...). graphics (openscreen, closescreen, openwindow...). words and lists (items, repitem, represt...). Menus under program control. Not line sensitive. Procedures are just a special type of list. Procedures may have optional inputs. Properties are just a special type of list. Screens and windows under program control. Turtles, as many as you like. With the following important exceptions Power LOGO is highly compatible with traditional LOGO. Procedures are just a special type of list, no "to" or "end" primitive. This allows procedures to be processed as data. Prefix (Polish) syntax only, no infix arithmetic, no special delimiters, no exeptions. Spaces are never optional. Spaces must be used to separate words, list brackets, and parenthesis. It is case sensitive, all primitives and keywords are lower case. Graphic objects (screens, windows, and turtles) must be opened before use, and accessed through pointers. No built-in text editor. To define procedures, you may type them at the command window, or use your favorite text editor and the "load" command. GETTING STARTED * * * * * * * * * * * * * * * * * * * * * * LOGO may be run in the usual way from the WorkBench or the CLI. You may exit LOGO by entering the quit command. If the current directory contains a file called LOGO-Startup it is loaded to initialize LOGO. This file contains LOGO code that may be used to configure LOGO the way you like, and to load your own frequently used procedures, and data. LOGO opens a window on the workbench screen as its command input and output window. You may enter and edit LOGO commands with these special keys. Backspace Delete character to the left of the cursor. Cursor Right Move cursor right one space. Cursor Left Move cursor left one space. Cursor Up Move backward through the command history. Cursor Down Move forward through the command history. Control-G Stop program, return to top level. Control-K Delete from cursor to end of line. Control-U Delete from cursor to start of line. Control-X Delete the line. Delete Delete character under the cursor. Return Enter list or instructions. Shift Cursor Right Move cursor to end of line. Shift Cursor Left Move cursor to start of line. The "? " prompt means LOGO is waiting for a command. If the command line contains an open list (an open bracket " [ " without a closing bracket " ] ") you will see the "1 > " prompt allowing you to continue the list on another line. PROGRAMMING * * * * * * * * * * * * * * * * * * * * * * In the Power LOGO programming environment, everything is either a word or a list. Words can be any sequence of characters. Words are separated from each other by blank spaces, to include a space (or a backslash) in a word it must be preceded by a backslash (\). Numbers are just a special type of word. Lists can be any sequence of objects, which may be ether words or lists. Lists are identified by enclosing them in brackets "[]". This-is-a-word! [ This is a list! ] Words and lists may be either data or instructions. An instruction is a procedure name followed by any inputs the procedure may require. When LOGO tries to evaluate a word it may treat it in one of three ways, as a literal, as a variable, or as a procedure. Words preceded by a quote (") character (called quoted words) are literal and evaluate as the word itself. For words that happen to be numbers or pointers the quote is not needed. Words preceded by a colon (:) character (called dotted words) refer to the contents (binding) of a variable name. A word by itself (no dots or quote) is evaluated as a procedure (unless it is a number or pointer). ? print 123 123 Here "print" is a procedure, and the number "123" is its input. The "print" procedure simply prints its inputs on next line in the command window. ? print [ This is a list! ] This is a list! In this example the list (everything between the brackets) is the input to the "print" command. ? print "This-is-a-word! This-is-a-word! In this example the quote (") identifies the input as a literal word. The inputs to a procedure need not be literal, they may be the contents of a variable, or the output of another instruction. Instructions may be nested as inputs within other instructions. ? pr * 7 6 42 Here "*" is another procedure "6" and "7" are its inputs. "*" outputs the product of its inputs to pr ("pr" is just an abbreviation for "print") which prints it on the next line. ? make "x 100 ? pr :x 100 In the first line the "make" procedure assigns 100 as the contents of the variable "x". In the second line ":x" refers to the contents of "x". Each procedure has some number of required inputs (zero or more), and some number of optional inputs (zero or more). To include optional inputs the entire instruction must be enclosed in parenthesis, if only the required inputs are used the parenthesis are not needed. Print requires one input but may have many. ? ( pr "PI "= 3.1415 ) PI = 3.1415 In this instruction "pr" has three inputs. ? ( pr [ And the answer is ] * 4 ( + 1 2 3 ) ) And the answer is 24 This entire line is one instruction where "pr" has two inputs, the first is the list "[ And the answer is ]", the second is the instruction "* 4 ( + 1 2 3 )". This second instruction "*" has two inputs "4" and another instruction "( + 1 2 3 )". Primitives are the procedures that are bult-in to LOGO. You may define your own procedures and add them to LOGO. In Power LOGO a procedure is just a variable that contains a special type of list, and may be defined using the "make" primitive. The first item in a procedure definition list is the word procedure. The second item is a list of lists of names of the inputs and local variables used by the procedure (the names list). The rest of the items in the definition are the instructions executed by the procedure. ? make "hello [ procedure [ ] pr [ Hello World ! ] ] ? hello Hello World ! Because this example procedure uses no inputs or local variables the names list may be empty. The first item of the variable names list is a list of required inputs. The second item is a list of optional inputs or a name to receive a list of optional inputs. The third item is a list of names of local variables. Local variables and unused optional inputs contain the empty list at the start. ? make "hello [ 1 > procedure [ [ ] [ :n ] ] 1 > repeat if numberp :n [ :n ] [ 1 ] [ 2 > pr [ Hello World ! ] ] ] ? hello Hello World ! ? ( hello 3 ) Hello World ! Hello World ! Hello World ! ? ( hello 0 ) This example uses one optional input. See the example files for other forms of names lists. Global, free, and local variables all work as they would in lisp. All variable names in a procedure names list are local within each call to that procedure. They are free variables to all procedures called from within that procedure or at a lower level. A procedure that includes a call to itself is called a recursive procedure. ? make "factorial [ 1 > procedure [ [ :f ] ] 1 > output if < 1 :f [ * :f factorial - :f 1 ] [ :f ] ] ? factorial 5 120 This procedure uses recursion to compute the factorial of its input. A procedure in which the recursive call is the last instruction is called tail recursive. Tail recursion is handeled differently by LOGO because the local variables need not be preserved. Two cases are reccognized as tail recursion, a recursive call as the input to an "output" command, or a recursive call followed by a "stop" command. ? make "count100 [ 1 > procedure [ [ :x ] ] 1 > pr :x 1 > if < :x 100 [ output count100 + :x 1 ] [ output :x ] ] ? make "count [ 1 > procedure [ [ :x ] ] 1 > pr :x 1 > count + :x 1 1 > stop ] In the second example the "stop" command is never executed, but it is necessary for LOGO to recognize the call to "count" as tail recursion, without it "count" would run out of memory. FILES * * * * * * * * * * * * * * * * * * * * * * Primitives are provided to save and load the contents of variables (including procedures), read and write data, save and load IFF images, as well as get a filename through a file requester. The "save" and "asave" primitives save the contents of variables to a file as "make" commands. The "load" command executes a text file as if it were typed at the command window except that comments are ignored (a comment is everything from a semicolon ";" to the end of the line). To read or write a data file it must first be opened with "open" (a new file to be writen), or "openold" (an existing file to be read or appended). Each of these outputs a file-pointer (a BCPL pointer to an AmigaDOS file handle) which must later be closed using "close". The primitives for reading and writing files accept a file-pointer as input and work much like their command window counterparts. The "saveimage", and "loadimage" primitives copy the contents of a window to or from an IFF ILBM file. For these to work the "ILBM.Library" by Software Dissidents must be in the LIBS: directory. The "filerequest" primitive outputs an AmigaDOS file name selected with the PathMaster file selector by Justin V. McCormick. "filerequest" may be used as input to any procedure that requires a file name. GRAPHICS * * * * * * * * * * * * * * * * * * * * * * Much of the Amiga graphics capability is available in Power LOGO. Primitives are provided to open custom intuition screens and windows, draw lines, patterned lines, text, flood fills, and copy regions. Graphics are rendered into windows which must first be opened with "openwindow". The window graphics primitives require a window-pointer as an input. Coordinates within windows start with (0,0) in the upper left corner and count pixels to the right and down. TURTLES * * * * * * * * * * * * * * * * * * * * * * Turtles are graphics tools based on reletive movement. You may open many turtles, each is opened onto a window, has its own coordinate system, and has its own sense of location, distance, and direction, as well as its own foreground pen, background pen, draw mode, and line pattern. By default the turtle commands control all active turtles, but may be directed to control specific turtles (active or not). Turtle operations output information about one specified turtle. DEMONS * * * * * * * * * * * * * * * * * * * * * * A demon may be thought of as a process separate from your main program, that keeps testing for a particular kind of event. When the event is detected the demon interupts the main program and runs a special procedure. When the procedure is complete the main program will resume. There are four types of events that may trigger demons, menu selection, left mouse button, key stroke, and window close gadget. For each of these there is an event queue, when the event queue is not empty, the demon procedure will be run. The demon procedure must execute the appropriate get operation to remove the event from the queue, or the demon will run again and again. For a simple example of demons in action load the file Mouse-Paint. For examples of menu demons see the files LOGO-Startup, and Mandelbrot. ERRORS * * * * * * * * * * * * * * * * * * * * * * Errors in syntax, or anything the interpreter does not recognize as valid LOGO instructions, should produce meaningful error messages. Primitives that expect a pointer as input may cause LOGO to crash (guru) if passed a bad pointer. The primitives "repitem", and "represt" destructively change an existing list and must be used carefully. If there is more than one reference to the list all references will be changed. They can also result in circular lists which appear infinite, and may cause LOGO to get stuck in a loop. RECOMMENDED READING * * * * * * * * * * * * * * * * * * * * * * This document file describes the differences between Power LOGO and traditional versions of LOGO, these books will provide more background about LOGO. Two of these books, Computer Science Logo Style volume 1, and Visual Modeling with LOGO, include sections that may be helpful to beginners. There are many books available about programming in LOGO for beginners, the ones that I have read are real losers, and none are listed here. Computer Science Logo Style Volume 1: Intermediate Programming, 1985. Volume 2: Projects, Styles, amd Techniques, 1986. Volume 3: Advanced Topics, 1987. Brian Harvey MIT Press. These are excellent books for anyone interested in programming, and computer science. Mindstorms: Children, Computers, and Powerful Ideas. Seymour Papert Basic Books, 1980 This book is about education and how computers and programming may be used by children, parents, and teachers. Required reading for parents, and teachers interested in how children can make use of computers. Turtle Geometry: The Computer as a Medium for Exploring Mathematics. Harold Abelson, and Andrea diSessa MIT Press 1981 About turtles as a tool for the study of mathematics, geometry, and topology. Visual Modeling with LOGO: A Structural Approach to Seeing. James Clayson MIT Press, 1988 About using LOGO and turtle graphics for exploring visual ideas and relationships. LOGO PRIMITIVES * * * * * * * * * * * * * * * * * * * * * * Types of inputs or outputs: angle Number representing an angle. file-name AmigaDOS file name. file-pointer Pointer to a file obtained from open or openold. list Any list. name Variable name. name-list List of variable names. number A word that is a number. object Any word or list. pointer A word that is a pointer (machine address). position-list List containing X Y coordinates. predicate Something that evaluates as true or false. predicate-list Run-list containing a predicate. property Name of an object in a property list. run-list List of LOGO instructions. screen-pointer Pointer to a screen obtained from openscreen. turtle-pointer Pointer to a turtle obtained from openturtle. window-pointer Pointer to a window obtained from openwindow. word A word, a string of characters. X Number representing a pixel coordinate. Y Number representing a pixel coordinate. + number number (...) sum Addition, output number + number + ... - number number (...) difference Subtraction, output number - number - ... * number number (...) product Multiplication, output number * number * ... / number number (...) quotient Division, output number / number / ... +- number negate Output -number, change sign of number. > number number (...) Output true if first number is more than all others. < number number (...) Output true if first number is less than all others. >= number number (...) Output true if first number is more than or equal to all others. <= number number (...) Output true if first number is less than or equal to all others. =0 number (...) Output true if all numbers are equal to zero. <0 number (...) Output true if all numbers are less than zero. >0 number (...) Output true if all numbers are more than zero. abs number Output absolute value number. alphap word word Output true if words are in alphabetical order. and predicate predicate (...) Output true if all inputs are true. asave file-name name (...) file-name name-list (...) Append save. Add names and their bindings to end of file. ascii word Output ASCII number of first character in word. atan number Output angle of tangent. Where number is the tangent of angle. back distance ( turtle-pointer ... ) bk distance ( turtle-pointer-list ) Move turtles backward distance. buriedp object Output true if word is a buried name. burylist Output list of names that are buried. bury name (...) name-list (...) Hide and protect input names (from make, erase, namelist, etc.). butfirst object bf Output object with first item removed. butlast object bl Output object with last item removed. catch word run-list Set trap for errors or throw. char number Output word containing ASCII character. Where ( 1 <= number < 255 ). clean ( turtle-pointer ... ) ( turtle-pointer-list ) Blank turtles windows. cleartext Blank the command window. closep Output true if window-close queue is not empty. close file-pointer (...) Close files. closescreen screen-pointer (...) Close screens. closeturtle turtle-pointer (...) Close turtles. closewindow window-pointer (...) Close windows. conditional conditional-list cond Execute run-list following first true predicate. Conditional-list: [ predicate-list run-list ... ] copyrect window-pointer X Y window-pointer X Y width height Copy a region from window to window. cos angle Output cosine of angle. count object Output number of items in object. cursor Output position-list of command window text cursor. degrees Interpret angles as degrees. doscommand AmigaDOS-command-line-list Run list as AmigaDOS command (as if typed at the CLI). dot ( turtle-pointer ... ) ( turtle-pointer-list ) Write pixel at turtles position. dowhile run-list predicate-list Execute run-list while predicate-list is true. downp turtle-pointer Output true if turtles pen is down. draw window-pointer X Y Draw from a windows graphics cursor position to position X Y. emptyp object Output true if object is the empty list or word. eqp object object (...) Output true if all inputs refer to the same object. equalp object object (...) = Output true if objects are identical. erase name (...) name-list (...) Remove bindings of input names that are not buried. Or remove bindings of all input names. error Output error info list. exor predicate predicate Output true if one input is true and one is false. filelist Output list of pointers to all open files. filerequest ( word ) Output file path name selected from file requester. Input word is the requester title. This is the PathMaster file selector by Justin V. McCormick. first object Output first item of object. firstput object object fput Output object made by adding first input to beginning of second input. floodol window-pointer X Y Flood fill to outline. forward distance ( turtle-pointer ... ) fd distance ( turtle-pointer-list ) Move turtle forward. fprint file-pointer object (...) Print object to file. fprintout file-pointer name (...) file-pointer name-list (...) Print names and their bindings file. frac number Output fractional portion of number. freadlist file-pointer Output list read from file (or eof for End Of File). fshow file-pointer object (...) Print object to file. ftype file-pointer object (...) Print object to file. getclose Output next window-pointer in the window close event queue, wait if the event queue is empty. getmenu Output list containing the window-pointer, menu number, item number, and subitem number of the next item from the menu event queue, wait if the menu event queue is empty. getmouse Output list containing the window-pointer, X position, and Y position where the mouse was when the button was pressed, wait if the mouse event queue is empty. getprop name property gprop Output property of name. heading turtle-pointer Output turtles heading. home ( turtle-pointer ... ) ( turtle-pointer-list ) Move turtle to position [ 0 0 ] set heading 0. if predicate run-list run-list If predicate is true execute first run-list, if false execute second run-list. Both run-lists are required, if one case is not used, use the empty list [ ]. int number Output integer portion of number. intuition number pointer ( ?... ) Modify screens, windows, and menus. 1 screen-pointer X Y Move screen (screen-pointer = @0 for workbench screen). 2 window-pointer X Y Move window (window-pointer = @0 for command window). 3 window-pointer menu item subitem Off menu (window-pointer = @0 for command window). 4 window-pointer menu item subitem On menu (window-pointer = @0 for command window). 5 screen-pointer Screen to back (screen-pointer = @0 for workbench screen). 6 screen-pointer Screen to front (screen-pointer = @0 for workbench screen). 7 screen-pointer number Show screen title (number <> 0) hide title (number = 0). 8 window-pointer X Y Size window (window-pointer = @0 for command window). 9 window-pointer MinWidth MinHeight MaxWidth MaxHeight Set window limits (window-pointer = @0 for command window). 10 window-pointer Window to back (window-pointer = @0 for command window). 11 window-pointer Window to front (window-pointer = @0 for command window). item number object Output numbered item from object. items number number object Output numbered items from object. keyp Output true if character queue is not empty. last object Output last item from object. lastput object object lput Output object made by adding first input to end of second input. left angle ( turtle-pointer ... ) lt angle ( turtle-pointer-list ) Rotate turtle left. linep Output true if line queue is not empty. listp object Output true if object is a list. list object object (...) Output list of input objects. load file-name (...) Load file, runs a text file as if it were typed at the keybord. loadimage window-pointer file-name Load a window from an IFF ILBM file. Requires "ilbm.library" from Dissidents Software. BUG: sometimes loads entire screen. log base number Output logarithm of number. make name object Bind object to name. Make is the LOGO assignment operator. memberp object object Output true if second object contains first object. menup Output true if menu queue is not empty. mousep Output true if mouse-button queue is not empty. mouse window-pointer Output list containing the X position, Y position and button position of the mouse reletive to the window. move window-pointer X Y Move a windows graphics cursor to position X Y. namelist Output list of names in use. namep object Output true if object is a name with a value. new Remove bindings of all names (erase), close all files, close all turtles, close all windows, close all screens, clear all menus, clear all demons, flush all input queues, return to top level. not predicate Output true if input is false output false if input is true. numberp object Output true if object is a number. open file-name Create or open file to be written, output file-pointer. openold file-name Open existing file to be read or written, output file-pointer. openscreen view-modes ( screen-data ) screen-data-list Open custom graphics screen, output screen-pointer. Screen-data: View Modes, sum of: 1 = hires 2 = lace 4 = extra half brite Depth, number of bitplanes ( 1 - 6 ) Title, text-list Left Edge Top Edge Width Height Detial Pen Block Pen Default screen-data-list: [ 0 2 [ ] 0 0 320 200 0 1 ] if View Modes = hires then default Width = 640 if View Modes = lace then default Height = 400 if View Modes = extra half brite then default Depth = 6 openturtle window-pointer ( turtle-data ) turtle-data-list Open a turtle, output turtle-pointer. turtle-data: window-pointer scale or magnification aspect ratio, pixel width / height X position of home Y position of home heading of home sign, >= 0 clockwise, < 0 counterclockwise Default: scale: lores 1.8 hires 3.2 This means it takes 200 steps to go from the left edge to the right edge of the full screen. aspect: lores 0.88 hires 0.44 lores lace 1.76 hires lace 0.88 This makes circles look round and squares look square. home X Y: The current center of the window. heading: 0 Straight up. sign: 0 Clockwise. openwindow screen-pointer ( window-data ) window-data-list Open custom graphics window, output window-pointer. Window-data: screen-pointer, @0 for workbench screen. Flags, sum of 1 = drag gadget 2 = depth gadget 4 = close gadget 8 = size gadget 16 = give me zero zero 32 = backdrop 64 = borderless 128 = activate Title, text list Left Edge Top Edge Width Height Detial Pen Block Pen Min Width Min Height Max Width Max Height Default window-data-list WorkBench screen: [ @0 3 [ ] 0 0 320 200 0 1 30 30 640 400 ] Default window for custom screen: Backdrop borderless window to fit the screen. or predicate predicate (...) Output true if any inputs are true. output object op Exit procedure return object. pd ( turtle-pointer ... ) ( turtle-pointer-list ) Turtle pen down. peek bytes address Output number at address. Address may be a number or a pointer. bytes = 0 32 bit pointer 1 8 bit unsigned number -1 8 bit signed number 2 16 bit unsigned number -2 16 bit signed number 4 32 bit unsigned number -4 32 bit signed number 8 64 bit IEEE double number pen window-pointer ( number ) Output the windows pen number (window-pointer = @0 for command window). number = 0 foreground pen (default) number = 1 background pen number = 2 area outline pen poerror Print out error message. pointerp object Output true if object is a pointer. poke bytes address number (...) Write number or pointer to address. Address may be a number or a pointer. bytes = 1 8 bit number 2 16 bit number 4 32 bit number or pointer 8 64 bit IEEE double number power number number Output first number to the power of second number. precision ( number ) Sets or outputs precision used by print, fprint, type, ftype, and text when printing numbers. primitivep object Output true if object is a primitive. print object (...) pr Print object to command window. printout name (...) po name-list (...) Print names and their bindings to command window. procedurep object Output true if object is a procedure. psum address number (...) Output pointer sum of address and numbers. Address may be a number or a pointer. pu ( turtle-pointer ... ) ( turtle-pointer-list ) Turtle pen up. putprop name property object pprop Assign object to property of name. quit Exit LOGO return to WorkBench or CLI. radians Interpret angles as radians. rand Output random fraction from zero to less than one. random number Output random integer from zero to less than number. readchar rc Output one character word typed at keybord. Reads characters from windows other than the command window. Waits if character event queue is empty. readlist rl Output line typed at keybord as a list. Reads lines from the command window. Waits if line queue is empty. readpixel window-pointer X Y Output pen number of pixel at position X Y. rectfill window-pointer X Y X Y Fill rectangle from X Y to X Y. recycle ( number ) Without an input, recycles memory and frees any unused blocks. With an input, just recycles memory. remainder number number Output remainder after division. remprop name property Remove property from name. repeat number run-list Execute run-list number of times. repitem number list object Replace numbered item of list with object. This is similar to "rplaca" in Lisp. WARNING: repitem destructively changes an existing list and you may obtain unexpected results if there is more than one reference to the list. represt number list object Replace rest of list after numbered item with object. This is similar to "rplacd" in Lisp. WARNING: represt destructively changes an existing list and you may obtain unexpected results if there is more than one reference to the list. restof number object Output rest of object following numbered item. rgb screen-pointer number Output color list. right angle ( turtle-pointer ... ) rt angle ( turtle-pointer-list ) Rotate turtle right. round number Output number rounded to nearest integer. run run-list Execute run-list. save file-name name (...) file-name name-list (...) Save names and their bindings to file. saveimage window-pointer file-name Save a window to an IFF ILBM file. Requires "ilbm.library" from Dissidents Software. BUG: sometimes saves entire screen. screenlist Output list of pointers to all open screens. seconds Output system time in seconds. seedrand ( number ) Re-seed random number generator. seekend file-pointer Move to end of file. seekstart file-pointer Move to start of file. sentence object object (...) se Output list of input objects. Lists in the input to sentence will have their outer brackets removed. setafpt window-pointer pattern-list Set area fill pattern. Pattern-list is a list of up to 16 words, each 16 characters long where "x" is an on pixel, any other character is an off pixel. setcursor position-list Set command window text cursor position. setdrmode window-pointer mode Set a windows draw mode (window-pointer = @0 for command window). Mode, sum of: 0 = JAM1 1 = JAM2 2 = COMPLEMENT 4 = INVERSVID setfont window-pointer font-name font-height Set a windows text font (window-pointer = @0 for command window). seth angle ( turtle-pointer ... ) angle ( turtle-pointer-list ) Set turtles heading. setlinept window-pointer pattern Set a windows line pattern. Where pattern is a word 16 characters long where "x" is an on pixel, any other character is an off pixel. setmenu window-pointer menu-list Attach a menu strip to the window (window-pointer = @0 for command window). menu-list: (where "K" is a keybord short cut) [ menu-name-1 [ item-1-1 K ] [ item-1-2 [ subitem-1-2-1 K ] [ subitem-1-2-2 K ] ] menu-name-2 [ item-2-1 ] [ item-2-2 ] ] setpen window-pointer pen ( number ) Set a windows pen number (window-pointer = @0 for command window). number = 0 foreground pen (default) number = 1 background pen number = 2 area outline pen setrgb screen-pointer number [ r g b ] Set a screens color register number to [ r g b ]. setstyle window-pointer style Set the text render style (window-pointer = @0 for command window). Style, sum of: 0 = plain 1 = underlined 2 = bold 4 = italic settdm mode ( turtle-pointer ... ) mode ( turtle-pointer-list ) Set turtles draw mode (window-pointer = @0 for command window). Mode, sum of: 0 = JAM1 1 = JAM2 2 = COMPLEMENT 4 = INVERSVID settlp pattern ( turtle-pointer ... ) pattern ( turtle-pointer-list ) Set turtle line pattern. Where pattern is a word 16 characters long where "x" is an on pixel, any other character is an off pixel. settpn pen number ( turtle-pointer ... ) pen number ( turtle-pointer-list ) Set turtles pen number. number = 0 foreground pen number = 1 background pen settpos position-list ( turtle-pointer ... ) position-list ( turtle-pointer-list ) Set turtles position. show object (...) Print object to command window. sin angle Output sine of angle. sleep Wait for an event (mouse, menu, keyboard, or window close). sqrt number Output square root of number. stick Output list containing the X position, Y position and button position of a joystick in port number two. stop Exit procedure. system number ( ? ) Control memory, libraries, and demons. 1 Output the amount of memory LOGO tries to hold in reserve. 2 bytes Set the amount of memory LOGO tries to hold in reserve. 3 bytes Allocate memory, output pointer to block. 4 bytes Allocate chip memory, output pointer to block. 5 pointer Free memory. 6 Output list of pointers to allocated memory blocks. 7 Open Diskfont library. 8 Close Diskfont library. 9 Open ILBM library. 10 Close ILBM library. 11 Enable demons. 12 Disable demons. tan angle Output tangent of angle. tell turtle-pointer (...) turtle-pointer-list Make these the active turtles. text window-pointer object Print text to a window. thing name Output object bound to name (contents of variable). throw word Escape to matching catch. toplevel Exit program return to top level. toward position-list turtle-pointer Output heading to point turtle toward position. tpen turtle-pointer ( number ) Output the turtles pen number. number = 0 foreground pen number = 1 background pen tpos turtle-pointer Output the turtles position-list. turtlelist Output list of all open turtles. turtleoff ( turtle-pointer ... ) ( turtle-pointer-list ) Deactivate turtles. turtleon ( turtle-pointer ... ) ( turtle-pointer-list ) Activate turtles. twpos turtle-pointer Output Turtles position-list in window coordinates. type object (...) Print object to command window. unbury name (...) name-list (...) Make input names accessable. wait number Pause for number of seconds. whenchar run-list Set demon to run when key stroke is detected. Run-list must execute a "readchar" to clear the character queue. whenclose run-list Set demon to run when window-close is detected. Run-list must execute a "getclose" to clear the window-close queue. whenmenu run-list Set demon to run when menu item is selected. Run-list must execute a "getmenu" to clear the menu-selection queue. whenmouse run-list Set demon to run when mouse-button is pressed. Run-list must execute a "getmouse" to clear the mouse-button queue. while predicate-list run-list While predicate-list is true, execute run-list. window ( turtle-pointer ... ) ( turtle-pointer-list ) Allow turtle to cross edge of window. windowlist Output list of pointers to all open windows. word word word (...) Output word made up of input words. wordp object Output true if object is a word. wrap ( turtle-pointer ... ) ( turtle-pointer-list ) Make turtle wrap around at edge of window. writepixel window-pointer X Y Set pixel X Y to the pen color. wtpos turtle-pointer Output windows position-list in turtle coordinates. PLEASE HELP ME * * * * * * * * * * * * * * * * * * * * * * Help me to improve this version of LOGO. Please contact me with any comments or bug reports. Gary Teachout 10532 66 Place, W Everett, WA 98204 USA