Sie sind auf Seite 1von 14

Raptor symbols

The six symbols used in Raptor are displayed in the Symbol Window in the upper left corner of the main
window:

Assignment
The assignment symbol is used to change the value of a variable. The right hand side of the assignment is
evaluated, and the resulting value is placed in the variable on the left hand side. For example, consider the
case where the value of x is currently 5, and the assignment "x <- x + 1" is executed. First "x+1" is
evaluated, yielding the result 6. Then the value of x is changed to be 6. Note that assignment is very different
from mathematical equality. The statement should be read "Set x to x+1" instead of "x equals x+1". The
assignment symbol can also be used to assign a string expression to a string variable (see String Variables &
Assignment).
Call
The call symbol is used to invoke procedures such as graphics routines and other instructor-provided
procedures. The call symbol is also used to run subcharts included in a Raptor program..
Input
The input symbol is used to ask the user for a number or string while the flowchart is executing. When an
input symbol is executed, the user will be prompted with a dialog to enter a value that can be interpreted as
either a number or string, depending on what the user types (see String vs. Numeric Input). The user can
also override the source for input by specifying a text file to be used in place of the keyboard (see Inputting
from a File)
Output
The output symbol is used to either write a number or text to the Master Console window. The user can also
override the destination for output by specifying a text file to be used instead of the Master Console (see
Outputting to a File).
Selection
The selection structure is used for decision making. The programmer enters in the diamond an expression
that evaluates to Yes (True) or No (False). Such expressions are formally referred to as Boolean expressions.
Based on the result of the expression in the diamond, control of the program will branch either left (Yes, or
True) or right (No, or False). For more information, see Boolean Expressions.
Loop Control

The loop structure is used to repeat a sequence of symbols until a certain condition is met. When execution
reaches the bottom of the loop, it starts over again at the top. The loop is exited when the diamond symbol is
executed and the Boolean expression in the diamond evaluates to Yes (True). Again, more information can
be found in Boolean Expressions.

Watch window
The Watch Window gives the user feedback on the values of all variables and arrays as a flowchart executes.
Variables are arranged in the Watch Window in the order in which they are encountered as the flowchart
executes. The variable being changed by the statement currently executing in the flowchart is shown in red.
Arrays are initially displayed minimized. To view the value of individual elements of an array, the user should
click on the "+" symbol to the left of the array name. The values can be later hidden by clicking on the "-"
symbol.

Note: nothing is displayed in the Watch Window until a variable or array is encountered during the execution
of a flowchart.
The image below is an example of how a two-dimensional array will appear in the Watch Window. Each row
receives its own "+" sign that can be changed into a "-" sign (and vice versa) by clicking on the sign. The row
number is indicated in brackets ("<1>", "<2>", etc.).
When the row has been expanded so that the "-" sign is showing, the number of columns is indicated next to
the word "Size", followed by the individual values that have been assigned for that row. The "column" number
precedes the value and is indicated in brackets. For example, the Watch Window displayed below indicates
that the value of Test_Scores[2,4] is 92 (in other words, 92 is the value at row 2 and column 4 of array
Test_Scores). Also note that the array name, row, and column for Test_Scores[2,4] is highlighted in red,
which indicates that this value is being changed by the statement currently executing in the flowchart.

Raptor workspace
The Workspace is where flowcharts are built and executed. Initially, each flowchart contains just a Start and
End block in a "main" tab. The programmer may add subcharts, and these subcharts will initially contain just a
Start and End block. The Start and End blocks may not be deleted from any chart or subchart.

To construct a flowchart, click on one of the six symbols to the left of the Workspace and then click (not drag)
an insertion point somewhere in the existing flowchart.
An insertion point is indicated when the cursor changes to
. The symbol is then added to the existing
flowchart in place. Alternatively, you can right click on an insertion point and insert a symbol by selecting from
the menu.
As the flowchart grows in size, scrollbars will appear that enable you to look at portions of the flowchart that
are off screen. You may also change the scale factor for the flowchart to view more (or less) of the flowchart
at one time.
Once symbols have been added, they may be edited in several ways. Right-clicking on a symbol provides
several editing options to the user:

Double-clicking a symbol allows the user to change what will happen when that symbol is executed (i.e.
change the assignment, procedure call, boolean expression, etc.)
Multiple symbols can be selected at one time by left-click dragging a selection box over several symbols. The
selected symbols are displayed in red. The selected symbols may then be edited using the menu, toolbar, or
pop-up menu.

When a program is executing, the Workspace window displays the currently executing instruction in green.

Using the menu


The top-level menu contains seven choices:

File Edit Scale View Run Window Help


The File menu contains the following submenu:

New creates a new flowchart.


Open opens a previously saved flowchart from disk.
Save saves the current flowchart to disk.
Save As saves the current flowchart as a different name to disk.
Compile If compile is selected, then the user will be prompted for a filename to save the compiled flowchart.
A compiled flowchart cannot be viewed or edited, only run. The compiled version of a program runs much
faster than a graphical version, but it cannot be executed symbol by symbol, it cannot be paused, and it
doesn't display variables in the watch window. If you ask to compile your flowchart, be sure you do not
overwrite the non-compiled version with the compiled version, because compilation cannot be undone.
Page Setup customizes the display for printing.
Print Preview displays a preview of how the flowchart will appear when printed.
Print prints the current flowchart.
Print to Clipboard saves a bitmap image of the current flowchart to the clipboard, allowing easy pasting of
the image into other applications.
Exit exits the program.
A history list of the last several flowchart files accessed is also displayed in the File menu.

The Edit menu contains the following submenu:

Undo reverts the flowchart back before the last change was made.
Redo cancels the previous undo operation.
Comment allows the user to add a comment to a symbol.

Cut, Copy, and Delete all function as expected on any selected symbols (those currently colored red)
Paste can be performed only after the user has specified an insertion point with a left mouse click. Note that
when the cursor is at an insertion point, the cursor will change to
. After the insertion point identification
and selection of Edit-Paste, the symbol(s) earlier copied or cut to the clipboard will be inserted.
Select All allows the user to select the entire program for copying, cutting, etc.

The Scale menu allows the user to change to scaling factor of the Workspace.

The View menu contains the following submenu:

All Text forces all text in each symbol to be displayed completely.


Truncated only displays the amount of text that will fit inside each symbol.
No text hides the text in each symbol.
Comments toggles the display of comments in the Workspace window.
Variables toggles the display of the watch window. For faster execution, turn off variables and move the
slider on the toolbar to the far right. For fastest execution, run a compiled version of the program.
Expand all expands all loop and selection structures which had been collapsed.
Collapse all collapses all loop and selection structures to minimize the size of the chart.

The Run menu contains the following submenu:

Step executes through one shape in a flowchart. Pressing F10 will also execute the current shape.
Execute to Completion runs the entire program until it terminates.
Reset halts program execution and clears the value of all variables.
Reset/Execute halts program execution, clears the value of all variables, and restarts execution from the
beginning.

Pause temporarily halts the execution of a program until execution is resumed by the user.
Clear all Breakpoints removes all currently set breakpoints to allow the current program to execute until it
terminates.

The Window menu contains the following submenu:

Tile Vertical puts the Raptor Workspace Window and the Raptor Master Console window side-by-side on the
Windows desktop.
Tile Horizontal puts the Raptor Workspace Window above the Raptor Master Console window on the
Windows desktop.

The Help menu contains the following submenu:

About gives the version of Raptor currently running.


General Help opens the Raptor Help Window.
Show Log displays a history of all editing and saving activity on the current Raptor program.
Count Symbols displays in the Master Console the number of symbols in the current Raptor program.

Using the toolbar


The toolbar implements many of same functions found in the main menu or in pop-up menus. Hovering the
mouse over a single button will display the tooltip for that button.

The New button creates a new flowchart.


The Open button opens a previously saved flowchart from disk.
The Save button saves the current flowchart to disk.
The Cut, Copy, and Paste buttons all function as expected on the currently selected symbols
(those currently colored red).

The Print button prints the current flowchart.


The Undo button reverts the flowchart back before the last change was made.
The Redo button cancels the previous undo operation.
The Execute to Completion button runs the entire program until it terminates.
The Pause button temporarily halts execution of a program until execution is resumed by the user.
The Stop and Reset to Beginning button halts program execution and clears the value of all variables.
The Step to Next Shape button executes one shape in a flowchart.
The slider bar on the toolbar adjusts the speed of execution of a flowchart. Move the bar to
the left to slow execution. Move the bar to the right to speed up execution. When the slider is positioned to
the far right, Raptor will no longer highlight in green the symbol currently being executed. This makes the
execution run much faster. To run even faster, use the view menu to turn off the display of variables in the
watch window. For fastest execution, use a compiled version of your program.
The drop down box on the right of the toolbar adjusts the scaling factor for the Workspace window.

Building a flowchart
To build a flowchart, left click on a symbol in the Symbol Window. Move the mouse to the place in the
flowchart where the symbol belongs. You may need to move the cursor slightly to find an insertion point.
When the cursor is at an insertion point, the cursor will change to
. When the left mouse button is clicked at
an insertion point, the selected symbol is added to the existing flowchart at the specified location.
If symbols are incorrectly placed, select Undo, Delete, or Cut from the Edit or Right Mouse Button menu.
Symbols may also be copied and pasted in another area of a flowchart.
Once a symbol has been correctly placed, double click the symbol to edit its contents.

Executing a flowchart
A flowchart may be executed using the Run Menu/Execute option or the toolbar. The symbol being executed
is highlighted in green. Any variables changed by the execution of a symbol are highlighted in red in the
Watch window.
Step executes through one shape in a flowchart. Pressing F10 will also execute the current shape.
Execute to Completion runs the entire program until it terminates.
Reset halts program execution and clears the value of all variables in preparation for a subsequent
execution.

Reset/Execute halts program execution, clears the value of all variables, and restarts execution from the
beginning. Pressing F5 will also perform this function.
Pause temporarily halts the execution of a program until execution is resumed by the user.
Speed Slider sets the speed of program execution. When the slider is entirely to the right
(maximum speed), the Watch Window is not updated and flowchart symbols are not highlighted during
execution.

Editing Symbols
Double click a symbol placed in a flowchart to edit its contents.
Assignment
The following dialog appears when editing an assignment symbol:

In the box following "Set", enter a variable. In the box following "to", enter an expression whose value will be
stored in the given variable. If the variable is a string variable, the expression on the right must be a string
expression (see String Variables & Assignment).
Input Symbol
The following dialog appears when editing an input symbol:

Enter a prompt to the user in the first textbox. The prompt will appear in the pop-up window in which the user
will enter a value for the variable whose name is specified in the second textbox. You may select the
Expression radio button if you want the prompt to be a string expression that contains a string variable or

concatenation of several string expressions. Depending on what the user enters during program execution,
the variable (in the above example, Age) may be treated as a number or string (see String vs. Numeric Input).
Output Symbol

The Output Symbol specifies what will be output to the Master Console (or, in some cases, to a file; see
Outputting to a File). First select whether an Expression or Text is to be output. An expression can be a
number, a string literal in double quotes, a variable, a math expression, or a string expression. Select Text to
output a text message containing no variables or math; no quotes are required. If the "End current line"
checkbox at the bottom of the dialog is checked, the MasterConsole output after this one will start on the next
line.
Selection Symbol
The following dialog appears when editing the decision diamond for a selection structure:

Enter in this textbox a Boolean expression that will be evaluated for this symbol. If the Boolean expression is
true, the left branch of the selection will be taken. Otherwise, the right branch will be taken.
Loop Symbol
The following dialog appears when editing the decision diamond for a loop structure:

Enter in the textbox a Boolean expression that will be evaluated for this symbol. If the Boolean expression is
true, the loop is exited. Otherwise, flow continues on the "No" branch below the diamond and eventually to the

top of the loop.

Using the MasterConsole


The MasterConsole window displays all user input and output. Input and output is achieved using the input or
output symbol.

The small textbox at the bottom of the MasterConsole window allows the user to directly input statements and
commands during execution. For example, the user may want to see what a RaptorGraph operation will do by
typing in a procedure call in this textbox (e.g. "Open_Graph_Window(300,300)").
The Clear button clears the MasterConsole window.

Reducing Displayed Chart Size


As Raptor flowcharts grow, it can sometimes be difficult to see the desired portions of a flowchart in the editing
window. One way to address this potential problem is to collapse the view of loops and selections. When the
views of these structures are collapsed, the individual steps in the selection or loop are hidden. The view of a
loop or selection is collapsed by clicking on the
For a
selection,
the view
goes
from this:

symbol next to the diamond.


to
this:

select_collapsed.bmp

select_before_collapse.bmp

You can tell the selection is collapsed by the


clicking on the

symbol.

For a loop, the view


goes from this:

Again, the
clicking on the

symbol next to the diamond. The view can be expanded by

loop_before_collapse.bmp

to this:

loop_collapsed.bmp

symbol next to the diamond shows that the view is collapsed. The view can be expanded by
symbol.

Das könnte Ihnen auch gefallen