Verbs for thinker

Once you have the nouns, then choosing the verbs leaves little more to do than lay out the commands in a style similar to ARexx. So here we present what could be considered a reference manual for this design.

Get [ marker | text | style | behavior | option | window ]
Get returns a string via result. Options are for the window the string was sent to, and includes all options. Get text selects the indicated text as if the user had done it via the mouse; "get text current 0" indicates no text is selected. Style gets the style text will be inserted in next.
Set [ marker | link | text | style | behavior | option | window | clipboard ] string
Set takes a single string as an argument to the command. Marker and link change the current statement, without changing what's displayed in any window associated with that port. Behavior and options set the values as indicated. Text changes the currently selected text to the given string, or inserts it at the current marker if there is no text selected. If there is text selected, style sets the text to the indicated style; otherwise it sets the style for any text to be added in the future. Setting the "target" behavior on makes the current window the jump target; setting that behavior off clears any jump targets.
Jump [ link | marker ]
Jump changes the current statement, making it the anchor statement of the window associated with the Rexx port if it's not visible in the window.
Open [ port | window | file ]
Window takes an optional string argument as returned by window; otherwise Thinker does "the right thing." File takes a filename. Open port may only be sent to the global thinker port, and returns in RESULT a private port for the macro. Open window is an error if a window is already open for this port. Open file is an error unless the file has been closed.
Close [ port | window | file ]
No arguments are needed, as there is only one port/window/file for each running script. Close port terminates the script as far as thinker is concerned. Close file saves the file to disk, and allows an "open file" to be issued for this window/port. A "close file" reverts to the default current marker as if the port had just been opened.
Get [ branch | group | plex ] stem
This returns the text of the statements in the branch/group in the stem.
Add [ branch | group | plex ] [ after | before ] [ link | marker ] stem
This adds the branch/group either before or after the statement indicated with link/marker. A plex is identical to a group, it is included in the command for completeness.
Save [ file { as string } | options ]
Saves the current file, without doing a close, or saves the options for the current window for use with that file.
Sort [ branch | group | plex ] options
Sort the indicated objects, using the values given by options to indicated the sort criteria.
Spell { [ init | save | merge | free | stop | accept | user | continue | replace string ] }
Init, save, merge and free take the action indicated with the dictionary. With no arguments, it starts the "spell loop". In this loop, any command except "spell" is an error, and the spell command must hvae one of the last five arguments. If spell finds a word not in it's dictionary, it returns a result string with that word in it. The next command indicates the action to be taken by the spell loop - stop the loop, accept the word now and for the rest of the document, bring up the thinker spell gadget for the user to deal with, continue leaving the word as is, or replace the word with the given string. When spell returns a null string as a result, the spell loop is complete.
Print [ branch | group | plex | window ] { as filename } options
This sends the contents of the selected branch/group/plex - or the contents visible in the window - to either the printer or a file (if "as filename" is specified). The display options for the currently selected window are used; the options at the end of the print command are used to select various formatting styles for the text.
Import file [ marker | link ] options
Imports the text in the named file after the given marker or link, using options to control how the text is interpreted.
Close unneeded
Close any files thinker has open that aren't currently being displayed.
Revert
Undoes any changes made since the last save command.
Index
Invokes the "Make Index" thinker command, and sets the current statement to the "Index" branch, as if via a "get" command.

On to solitare,, back to the verbs, or up to the design.

Mike W. Meyer