Using Executive Commands
Executive commands are summarized in
Executive Commands.
.CON
The .CON command continues execution of a program that has stopped because of an error, a STOP statement, or a keyboard interrupt. PV‑WAVE saves the location of the beginning of the last statement executed before an error. If it is possible to correct the error condition in the interactive mode, the offending statement may be re-executed by typing .CON. After STOP statements, .CON continues execution at the next statement.
note | Execution of a program interrupted by typing <Control>-C may also be resumed at the point of interruption with the .CON command. |
.GO
The .GO command starts execution at the beginning of a previously compiled main program.
.LOCALS
The syntax of the .LOCALS command is:
.LOCALS local_vars common_symbols
The .LOCALS command is similar to the .SIZE command, in that it resizes the data area (the data area is described in the previous section, Using .SIZE). The .LOCALS command, however, lets you specify the data area size in terms of local variables and common block symbols rather than in bytes. This command affects the size of the data area for the $MAIN$-level (commands entered from the WAVE> prompt), and the initial size of the data area for compiled procedures and functions.
The two parameters are positional, but not required. If you execute .LOCALS with no parameters, the data area is set back to its default value, which is 500 local variables. If you want to use 700 variables at the $MAIN$ level, enter:
.LOCALS 700
.LOCALS clears and frees the current $MAIN$ data area and code area. It then allocates a new code area of the same size as the previous one and a new data area of the specified size.
For compiled procedures and functions, the compiler initially allocates code and data areas of the same size as those that $MAIN$ is currently using. If you get compiler error messages stating that the code and/or data area of a procedure or function is full, you must first make the $MAIN$ code and/or data areas larger with the .SIZE or .LOCALS executive command. Then when you recompile the procedure or function, the compiler starts with the larger code and/or data areas.
..LOCALS
The syntax of the ..LOCALS compiler directive is:
..LOCALS local_vars common_symbols
This command is useful when you want to place the EXECUTE function inside a procedure or function. EXECUTE takes a string parameter containing a PV‑WAVE command. This command argument is compiled and executed at runtime, allowing the possibility for command options to be specified by the user. Because the data area is compressed after compilation, there may not be enough room for additional local variables and common block symbols created by EXECUTE. The ..LOCALS command provides a method of allocating extra space for these additional items.
The ..LOCALS compiler directive is similar to the .LOCALS executive command, except:
..LOCALS is only used inside procedures and functions.
Its arguments specify the number of
additional local variables and common block symbols that will be needed at “interpreter” time (when the already-compiled instructions are interpreted).
It is used in conjunction with the EXECUTE function, which can create new local variables and common block symbols at runtime.
.RNEW
The .RNEW command compiles and saves procedures and programs in the same manner as .RUN. However, all variables in the main program unit, including those in common blocks, are erased. The –t, –l, and -c switches have the same effect as with .RUN. See the examples below. Its syntax is:
.RNEW file1, ..., filen
.RUN
The .RUN command compiles procedures, functions and main programs. The .RUN command also executes main programs. The command may be followed by a list of files, up to 11, to be compiled. Separate the filenames with blanks or commas:
.RUN file1, ..., file11
If no files are specified with the .RUN command, input is accepted from the keyboard at the WAVE> prompt until a complete program unit is entered. The values of all the variables are retained.
Files containing PV‑WAVE procedures, programs, and functions are assumed to have the filename extension (suffix) .pro. If the filename is the same as the actual function or procedure name, the function or procedure is compiled and executed.
The command arguments –t for terminal listing, or –l for listing to a named file, may be used after the command name, and before the program file names, to produce a numbered program listing directed to the terminal or to a file. For instance, to see a listing on the screen as a result of compiling a procedure contained in a file named analyze.pro:
.RUN -t analyze
To compile the same procedure and save the listing in a file named: analyze.lis:
.RUN -l analyze.lis ana1yze
In listings produced by PV‑WAVE, the line number of each statement is printed at the left margin. This number is the same as that printed in error statements, simplifying location of the statement causing the error.
Each level of block nesting is indented four spaces to the right of the preceding block level to improve the legibility of the program’s structure.
note | Use the command argument -c after .RUN to compile a main program without executing it. |
Sample Usage of .RUN and .RNEW
Some examples of the .RUN and .RNEW commands are:
; Accept a program from the keyboard (WAVE> prompt). Retain the
; present variables.
.RUN
; Compile file myfile.pro. If myfile.pro is not found in current
; directory, PV‑WAVE looks for file in the directory search path.
.RUN myfile
; Compiles files a.pro, b.pro, and c.pro. Lists programs on the
; terminal.
.RUN -t a, b, c
; Erases all variables. Compiles files myfile.pro and
; yourfile.pro. Produces a listing of myfile in the file
; myfile.lis.
.RNEW -l myfile.lis myfi1e, yourfile
.SKIP
The .SKIP command skips one or more statements and then single steps. This is useful for continuing over a program statement which caused an error. If the optional argument n is present, it gives the number of statements to skip, otherwise, a single statement is skipped. The syntax is:
.SKIP [n]
For example, consider the following program segment:
... ... ...
OPENR, 1, 'missing'
READF, 1, xxx, ..., ...
... ... ...
If the OPENR procedure fails because the specified file does not exist, program execution will halt with the OPENR procedure as the current procedure. Execution may not be resumed with the executive command .CON because it attempts to re-execute the offending OPENR procedure, causing the same error.
The remainder of the program can be executed by:
Opening correct file manually by typing in a valid OPENR procedure.
Entering
.SKIP, which skips over the incorrect OPENR procedure.
Entering
.CON, which resumes execution of the program at the READF procedure.
.SIZE
The syntax of the .SIZE command is:
.SIZE code_size data_size
The .SIZE command resizes the code area and data area. These memory areas are used when PV‑WAVE programs are compiled. The code area holds internal instruction codes that the compiler generates. The data area, also used by the compiler, contains variable name, common block, and keyword information for each compiled function, procedure, and main program.
After successful compilation, a new memory area of the required size is allocated to hold the newly compiled program unit.
By default, the size of the code area is about 800 bytes, and it grows dynamically as needed to accommodate the activity of your session. The initial size of the data area is 8,000 bytes (enough space to hold 500 local variables).
note | Resizing the code and data areas erases the currently compiled main program and all main program variables. |
For example, to extend the code and data areas to 40,000 and 10,000 bytes respectively:
.SIZE 40000 10000
The upper limit for both code_size and data_size is over 2 billion bytes.
.STEP
The .STEP command executes one or more statements in the current program starting at the current position, stops, and returns control to the interactive mode. This command is useful in debugging programs. If the optional argument n is present, it gives the number of statements to execute, otherwise, a single statement is executed. The syntax of the .STEP command is:
.STEP [n]
or:
.S [n]
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.