TinyLogo
© 1999 Timothy Lipetz
Built-in Procedures
Topics on this page: Program Flow, Logic, Arithmetic, Lists and Words, Turtle and Bitmap Graphics, Icon Definition Files , Sound, Program I/O, TinyLogo Workspace.
See also: TinyLogo Main, Beginners Guide, Advanced Information, Built-in Procedures, Samples
Program Flow
|
|
#Args |
Returns |
Comments |
|
|
1 |
_ |
Returns its arg to the calling procedure |
|
|
0 |
_ |
Returns to calling procedure with no return value |
|
|
0 |
_ |
Stops command execution |
|
|
1 |
_ |
Executes its argument(list) |
|
|
2 |
_ |
If the first arg (logic) evaluates to true, executes its 2nd arg (list) |
|
|
3 |
_ |
If the first arg (logic) evaluates to true, executes its 2nd arg (list) otherwise executes its 3rd arg (list) |
|
|
2 |
_ |
Executes its 2nd arg (list) n times where n is its 1st arg (number) |
|
|
0 |
number |
Within a repeat list, gives the current repetition count, starting at zero |
make |
mk |
2 | _ | Associates value of 2nd arg (any)
with the global make-variable name given in its 1st arg (word).
You must use thing to dereference the make-variable (the ":"
notation is not supported.) There is a limit of 50 symbol names for the
combination of make-variables and user-defined procedures. |
thing |
thg |
1 | any | Returns current value of the global make-variable
with name given in its 1st arg (word). See make
|
Logic
|
|
#Args |
Returns |
Comments |
|
|
2 |
logic ("true / "false) |
Returns true if both args(logic) are true, else returns false |
|
|
2 |
logic |
Returns true if either args(logic) is true, else returns false |
|
|
2 |
logic |
Returns true if the 1st arg (number, word) is > the 2nd. |
|
|
2 |
logic |
Returns true if the 1st arg (number, word) is >= the 2nd. |
|
|
2 |
logic |
Returns true if the 1st arg (number, word) is < the 2nd. |
|
|
2 |
logic |
Returns true if the 1st arg (number, word) is <= the 2nd. |
|
|
2 |
logic |
Returns true if the 1st arg (number, word, list) is equal to the 2nd. Note: for lists this should only be used to test against the empty list []. |
|
|
2 |
logic |
Returns true if the 1st arg (number, word, list) is not equal to the 2nd. Note: for lists this should only be used to test against the empty list []. |
|
|
1 |
logic |
Returns the opposite of its arg (logic) |
|
|
0 |
"false |
Constant false |
|
|
0 |
"true |
Constant true |
|
|
1 |
logic |
Returns true if its arg is a number |
|
|
1 |
logic |
Returns true if its arg is a word |
|
|
1 |
logic |
Returns true if its arg is a list |
Arithmetic
|
|
#Args |
Returns |
Comments |
|
|
2 |
number |
Returns 1st arg plus 2nd (numbers) |
|
|
2 |
number |
Returns 1st arg minus 2nd (numbers) |
|
|
2 |
number |
Returns 1st arg times 2nd (numbers) |
|
|
2 |
number |
Returns 1st arg divided by 2nd (numbers) |
|
|
2 |
number |
Returns the remainder of 1st arg divided by 2nd (numbers) |
|
|
1 |
number |
Returns a random number less than its arg (number) and greater than or equal to 0. |
|
|
1 |
number |
Returns its arg (number) plus one |
|
|
1 |
number |
Returns its arg (number) minus one |
Lists and Words
|
|
#Args |
Returns |
Comments |
|
|
1 |
word / any | Returns the first letter of a word, or the first item in a list |
|
|
1 |
word / any | Returns the last letter of a word, or the last item in a list |
|
|
1 |
word / list | Returns all but the first letter of a word, or all but the first item in a list |
|
|
1 |
word / list | Returns all but the last letter of a word, or all but the last item in a list |
|
|
1 |
number | Returns the number of letters in a word or the number of items in a list |
|
|
2 |
list | Returns a list formed by its two args (any) |
|
|
2 |
word | Returns the concatenation of its two args (words or numbers). Numbers are converted to text. |
|
|
1 |
number | Returns the numeric value of its arg (word) This is useful with readline. |
Turtle and Bitmap Graphics
|
|
#Args |
Returns |
Comments |
|
|
0 |
_ | Enters Turtle Mode |
|
|
0 |
_ | Leaves Turtle Mode |
|
|
0 |
_ | Clears screen (in Turtle Mode) |
|
|
0 |
_ | Move Turtle to center screen (0,0) and heading up (90 degrees) |
|
|
0 |
_ | Displays Turtle triangle |
|
|
0 |
_ | Hides Turtle triangle |
|
|
0 |
_ | Pen is down - Turtle will leave trail |
|
|
0 |
_ | Pen is up - Turtle will not leave trail |
|
|
0 |
_ | Pen writes in black |
|
|
0 |
_ | Pen writes in white |
|
|
0 |
_ | Pen reverses black and white |
|
|
0 |
number | Returns X location of turtle. Where center screen is 0, left is -80, right is +80. |
|
|
0 |
number | Returns Y location of turtle. Where center screen is 0, bottom is -80, top is +80. |
|
|
0 |
number | Returns Turtle heading in degrees. Where right is 0, up is 90, etc. |
|
|
1 |
_ | Turtle moves forward arg (number) pixels |
|
|
1 |
_ | Turtle moves backward arg (number) pixels |
|
|
1 |
_ | Turtle turns left arg (number) degrees |
|
|
1 |
_ | Turtle turns right arg (number) degrees |
|
|
1 |
_ | Turtle turns to face arg (number) heading (see th) |
|
|
1 |
_ | Turtle moves in X to arg (number) location, drawing if pen is down. |
|
|
1 |
_ | Turtle moves in Y to arg (number) location, drawing if pen is down. |
|
|
2 |
_ | Turtle moves in X and Y to args (numbers) location, drawing if pen is down. |
box |
_ |
4 | _ | Draws a filled rectangle. Args are X, Y, Width,
Height, where the X, Y is upper left corner. The rectangle is filled based
on current penmode (pennormal, ) |
printtext |
pt |
3 | _ | Displays 1st arg (word or list) at X, Y of 2nd and 3rd args (numbers). |
icon |
_ | 3 | _ | Displays icon with ID 1st arg (number) at X,
Y of 2nd and 3rd args (numbers). Icon IDs are 0-49 See loadicons. |
loadicons |
li |
1 | _ |
Loads an icon definition memo with arg (word) as its title. Be sure to
quote " the memo name. - Do not use if a memo is currently openned
with mopen or mnew. See Also see Icon File Format below. |
Note:the word, "pen," in the procedure names of the above section refers to the drawing point on the screen, not the implement for writing on a Palm computer.
Icon File Format
The icon file used by loadicons
, has a strict format.
An example of an icon definition would be (from PocketC manual):
Example: A 10x4 rectangle "0affc804804ffc"
8 4 2 1 8 4 2 1 8 4 2 1
X X X X X X X X X X 0 0 = ffc
X 0 0 0 0 0 0 0 0 X 0 0 = 804
X 0 0 0 0 0 0 0 0 X 0 0 = 804
X X X X X X X X X X 0 0 = ffc
A simple example icon definition file, called "myicons", would be these three lines:
myicons
icon 5 is a small rectangle
05_0affc804804ffc.
If you would like help in creating icon definitions, try the following (all are freeware and available from www.palmgear.com):
Sound
|
|
#Args |
Returns |
Comments |
|
|
2 |
_ | Plays a tone of 1st arg (number) Hz. for 2nd arg (number) / 100 seconds. |
|
|
1 |
_ |
Plays the Palm defined system sound, based on arg (number). Sounds are info[1], warning[2], error[3], startup[4], alarm[5], confirmation[6], and click[7]. |
|
|
2 |
_ | Plays a music note for 2nd arg (number) / 100 seconds. The notes are a diatonic scale with 1st arg (number) = 0 for middle C, = 1 for C#, = 2 for D, ..., = 12 for high C, etc. On my PalmPilot, the usable range seems to be 9 octaves from -48 to 60. (Although the low notes do rattle!) |
Program Input/Output
|
|
#Args |
Returns |
Comments |
|
|
1 |
_ | Displays its arg (any) followed by a space. In Turtle Mode, this uses a popup dialog which blocks until user selects "Okay." Otherwise, it is non-blocking. |
|
|
1 |
_ | Displays its arg (any) followed by a newline. In Turtle Mode, this uses a popup dialog which blocks until user selects "Okay." Otherwise, it is non-blocking. |
|
|
1 |
list of words | Presents user with a popup dialog showing its arg (list or word) as a prompt. It blocks waiting for input, then returns input as a list of words. (see tonum, above) |
ask |
_ | 1 | logic | Presents user with a popup dialog showing its arg (list or word) as a prompt and "Yes" and "No" buttons. Returns true if user picks "Yes" else returns false. |
|
|
0 |
_ | Blocks, waiting for user to tap screen, then continues. (see penx, peny) While waiting for input in Turtle Mode, it will show a "??" prompt in bottom left corner. |
pen |
_ | 0 |
logic |
Returns true immediately if the Palm screen detects a pen, else returns false immediately. Sets penx and peny if true (see penx, peny) |
|
|
0 |
number | Returns the X location of the Palm pen at the last readpen or (true) pen |
|
|
0 |
number | Returns the Y location of the Palm pen at the last readpen or (true) pen |
in |
_ | 4 | logic | Returns true if the last set penx and peny are within the rectangle defined by args (numbers) X, Y, Width, Height. |
mopen |
_ | 1 | _ | Opens an existing Palm memo with arg (word or list) as a title. |
mnew |
_ | 1 | _ | Creates a new Palm memo with arg (word or list) as a title. |
mclose |
_ | 0 | _ | Closes the currently open memo. |
mprint |
mp |
1 | _ | Prints arg (any) followed by a space to end of open memo. |
mprintline |
mpl |
1 | _ | Prints arg (any) followed by a newline to end of open memo. |
mreadline |
mrl |
0 | list | Returns current memo line as a list of words, then advances to next line. |
meof |
_ | _ | logic | Returns true if read buffer is at end of current memo. |
Note:the word, "pen," in the procedure names of the above section refers to the implement for writing on a Palm computer, not the drawing point on the screen.
TinyLogo Workspace
|
|
#Args |
Returns |
Comments |
|
|
1 |
_ | Loads a TinyLogo memo from the Palm memopad. The memo's first line must be "TL_" followed by the arg (word). The memo should contain TinyLogo procedure definitions. - Be sure to quote " the memo name. - Do not use if a memo is currently openned with mopen or mnew. |
|
|
1 |
_ | Displays the definition of a user defined procedure named as arg (word). - Be sure to quote " the procedure name. |
|
|
2 |
_ | Appends the procedure named in 1st arg (word) to memo named in 2nd arg (word), where 2nd arg should not contain the implied "TL_" prefix.- Be sure to quote " both args. - Do not use if a memo is currently openned with mopen or mnew. |
|
|
0 |
_ | Displays the names of all user defined procedures in TinyLogo. |
|
|
0 |
_ | Displays the names of all Palm memos starting "TL_" |
|
|
0 |
number | Returns the number of nodes available for use at that moment. |
garbagecollect |
gc |
0 | _ | Forces a garbage collection at the next opportunity. |
|
|
0 |
_ | Displays names and aliases for all built-in procedures |
|
|
0 |
_ | Starts procedure definition. There is a limit of 50 symbol names for the combination of make-variables and user-defined procedures. |
|
|
0 |
_ | Ends procedure definition |
See also: TinyLogo Main, Beginners Guide, Advanced Information, Built-in Procedures, Samples