Block Protocol Listing

  1. Command protocol:

A command definition statement of the form:

Command <name> <arglist> { <body> }

Here { <body> } is a block.

  1. Do protocol:

An iteration statement of the following general form:

Do

<initializations>

<exit condition>

<return statement>

{ <body> }

Here { <body> } is a block.

  1. If...Then...Else protocol:

A branch-on-conditions statement of the following form:

If <condition> then { <conclusions> } else { <alternatives> }or simply,

If <condition> then { <conclusions> }

Here, { <conclusions> } and { <alternatives> } are blocks.

  1. Local protocol:

A type declaration and a local binding statement:

Local <arglist> { <body> }

Here { <body> } is a block.

  1. Program protocol:

That is a program definition statement of the form:

Program <name> <arglist> { <body> }

Here { <body> } is a block.

  1. Repeat protocol:

That is, an iteration statement of the following form:

Repeat <number of times> { <body> }

Here { <body> } is a block.

  1. LISP protocol:

That is, an iteration statement of the following form:

LISP <s-expression> ;

Here s-expression is a LISP expression

  1. Delay Protocol
    Delays the execution of a block.

    The form is:

    DELAY <count>

    { <statement>;

    <statement>;

    ...

    <statement>

    }

    The <count> is any Mathscript expression that evaluates to a positive integer.

    The time unit is tenths of a second, and <statement> is any MathScript

    command or Protocol except COMMAND or PROGRAM.

    Simultaneous delays are not allowed. During the delay, the user has full control of the system.

    Example:

    Let a be text("counter");

    Delay a {let f(x) be value text("fnbox"); graph f;}

  2. GLDraw Protocol

Use GLDRAW to define an OpenGL Actor or Animation The form is:

GLDRAW {

<statement1> ;

<statement2>; ...

<statementN>;

}

The <statements> are any Mathscript expressions including OpenGL statements.

Nested GLDRAWS are not allowed.

After the compilation, OpenGL has a temporary display list and actor. The temporary actor is removed with the Refresh command.

Example: GLDraw { color(255,0,0,255); Solidcube(10); }