2.1.2. The PROMULA Main Menu. Great Migrations LLC PROMULA Application Development System
Reklama
Reklama
Promula Application Development System User's Manual
2
.
RUN COMPILER "myprog.prm" LIST=DISK "myprog.lst" PAUSE=ON
PROMULA
This will load PROMULA and compile the statements in the file myprog.prm
. The statements in myprog.prm
and any output they generate will be saved on disk in the file myprog.lst
. After compiling the file, PROMULA will be in command mode.
3
.
PROMULA RUN PROGRAM "myprog.xeq"
This will load PROMULA and start the PROMULA application contained in the file myprog.xeq
.
2.1.2. The PROMULA Main Menu
If you start PROMULA with no command line statement, PROMULA will load into memory and display its Main Menu.
The PROMULA Main Menu is designed to give you direct access to a variety of program development functions.
PROMULA V3.00 (09/01/91) IBM PC Version
Main Menu
Key Function
F1 Exit PROMULA
F2 Restart PROMULA
F3 Run the PROMULA Tutorial
F4 Edit a source file
F5 Compile a source program
F6 Run a program from the console
F7 Resume an interrupted program
F8 Run a program from a disk file
F9 Run a menu of applications
F10 Use the PROMULA Language
Press desired key or move bounce bar and press [ENTER]
Copyright 1988-91 PROMULA Development Corporation, ALL RIGHTS RESERVED
Application Management System
To begin the desired function, simply press the corresponding function key. On the IBM Personal Computer the function keys are the ten shaded keys at the left (or at the top) of the keyboard. Alternatively, you may press the numeric keys on your keyboard or highlight the desired option and press the Enter key.
2.1.2.1. F1 -- Exit PROMULA
Selecting Main Menu option 1 gets you out of PROMULA and returns control to the operating system. All PROMULA files which are open at this time are automatically closed. Any PROMULA information contained within the memory of the computer which has not been saved on a disk file, is lost. In addition to closing its open files, PROMULA clears the screen before ending.
8
Promula Application Development System User's Manual
2.1.2.2. F2 -- Restart PROMULA
Selecting Main Menu option 2 restarts PROMULA. Before the restart, PROMULA closes all application files, clears all application information from the memory of the computer, and clears the screen.
This is a convenient feature to use when you wish to move from one PROMULA application to another without having to go back to the operating system.
2.1.2.3. F3 -- Run the PROMULA Tutorial
The PROMULA Tutorial is the reference chapter of this User's Manual in on-line, menu-driven form. The program that controls the tutorial is called PROMULA.TUT.
You can use the Tutorial in various ways:
1.
Browse through the entire Tutorial once to obtain an overview of PROMULA.
2.
Select a particular topic in the Tutorial when you have a particular question.
To get to the Tutorial while executing a program, press the Esc key to suspend the program and display the Main Menu; then select Main Menu option 3 to browse the Tutorial and the topic of interest. When you wish to leave the tutorial, press the End key; this returns you to the Main Menu. You may then return to the interrupted program by selecting Main Menu option 7.
2.1.2.4. F4 -- Edit a Source File
This clears the screen and initiates the PROMULA Text Editor, which is a fast, full-screen text editor that may be used from the Main Menu, from command mode, and from inside your applications via the RUN EDITOR statement.
On-line help for the editor is in the dialog file EDITOR.TUT and is accessible by pressing Alt-H.
For example, to edit the demo file
DEMO.PRM
shown in Figure 2-2, simply press Alt-E and enter the file name
DEMO.PRM
.
2.1.2.5. F5 -- Compile a Source Program
PROMULA accepts statements in either of two modes: direct and indirect. Main Menu option 5 is used to put PROMULA into indirect mode. In indirect, or compilation mode, PROMULA converts the statements of an entire "source" file to an
"executable" form, which may be saved on disk for later execution.
Use Main Menu option 5 when you wish to compile a file containing the PROMULA source code. If the results of the compilation are saved in a segment file, it can be executed either interactively (i.e., directly from the console), using Main
Menu option 6, or in batch mode from a text input file using Main Menu option 8 .
"Compiling a program" means converting it from source instructions to executable instructions. Source instructions are the statements of a program as you write them for PROMULA to understand and compile, i.e., convert to executable instructions. Executable instructions in turn are instructions that PROMULA converts to machine instructions which the computer can execute at run time.
To compile the demo program
DEMO.PRM
, select Main Menu option 5 and respond to the system prompts, as shown in the dialog below:
Enter the filename of the program to be compiled
? DEMO.PRM
Where do you want the compilation listing? N)one, C)onsole, P)rinter, or D)isk
? P
9
Promula Application Development System User's Manual
Do you want the compiler to pause on errors? Y)es or N)o
? Y
The dialog above tells PROMULA to compile the source program stored in file
DEMO.PRM
, to list the results of the compilation on the printer, and to pause if any errors are detected.
In the dialog above, the questions are issued by PROMULA while the responses (following the ? prompt) are entered by the user.
The first question asks for the name of the file containing the source code to be compiled. Any filename which is valid for the operating system is a valid entry for this question. The default extension for source file names is .PRM.
The second question asks where PROMULA should send the compilation listing. The listing may be viewed on the screen, sent to the printer, saved in a file on disk, or turned off. Viewing the listing on the screen or printer may slow the compilation down but may make it easier to understand compilation errors. If the listing is sent to the printer, then the printer needs to be turned on and ready to go before the response to this question is entered. PROMULA does not check to ensure that this is true and will compile the program without sending it to the printer if you fail to turn the printer on. If the listing is to be saved on a disk file, you must specify the name of the disk file in response to the next question, as shown in the second example below. If you want the code to compile as fast as possible, and do not need to view the listing as the program is compiled enter N for the
N)one
option.
The third question asks whether or not PROMULA should pause when a compilation error is encountered:
1.
If you respond Y for "yes" to the question, then each time an error is encountered, PROMULA will display the appropriate error message and will pause with the following message:
Press any key to continue
At this point, if you press the Esc key, the compilation will end and you will return to the Main Menu. If you press any other key, the compilation will continue.
2.
If you respond N for "no" to the question, then an error message will be displayed for each error, but PROMULA will continue compiling. Note that the result of any compilation which was continued despite an error will probably not be well formed.
A similar dialog occurs if you wish to save the compilation output on a disk file:
Enter the filename of the program to be compiled
? DEMO.PRM
Where do you want the compilation listing? N)one, C)onsole, P)rinter, or D)isk
? D
Enter a filename for the compilation listing
? DEMO.LST
Do you want the compiler to pause on errors? Y)es or N)o
? Y
The objectives of this example are to compile the source program
DEMO.PRM
and to save the compilation listing on a disk file named
DEMO.LST
for later viewing or printing.
In the compilation example shown above, three files are involved:
1.
The program source file,
DEMO.PRM
10
Promula Application Development System User's Manual
2.
The compilation listing saved on file
DEMO.LST
3.
The executable file resulting from the compilation was saved on file
DEMO.XEQ
, as specified in the OPEN SEGMENT statement of the source file. It is this file that you may execute interactively, using Main Menu option 6, or execute in batch mode, using Main Menu option 8.
2.1.2.6. F6 -- Run a Program from the Console
An executable program may be run in one of two ways: interactively or in batch. Interactive execution proceeds as follows: the program issues prompts via menus, ASK statements, and other interactive commands on the console and expects a response from the user before it continues execution. In batch mode, on the other hand, program execution proceeds without pausing for user input from the keyboard. In this mode, all of your responses are expected to have been saved in a disk file, called the "batch input file".
Main Menu option 6 is used to execute a compiled PROMULA program interactively, i.e., directly from the console and the keyboard. Selecting Main Menu option 6 results in a dialog such as the one shown below:
Enter the filename of the program to be executed
? DEMO.XEQ
DEMO.XEQ
is the name of the executable program that was produced by compiling the
DEMO.PRM
source program using
Main Menu option 5. The default extension for executable file names is .XEQ. Execution of
DEMO.XEQ
results in the following dialogue:
Please enter the monthly sales figures.
? 13200 12100 14800 16200 15200 17200 18060 18960 19900 20900
? 21950 23050
Please enter the monthly cost figures.
? 9200 8600 10400 11300 10700 12100 12700 13350 14000 14700
? 15440 16210
Monthly Profit and Loss Figures ($)
Sales Costs Profit
January
February
March
April
May
June
July
August
September
October
November
December
13,200
12,100
14,800
16,200
15,200
17,200
18,060
18,960
19,900
20,900
21,950
23,050
Average monthly Profit ($) 5,235.00
9,200
8,600
10,400
11,300
10,700
12,100
12,700
13,350
14,000
14,700
15,440
16,210
4,000
3,500
4,400
4,900
4,500
5,100
5,360
5,610
5,900
6,200
6,510
6,840
Figure 2-3: Dialog produced by DEMO.XEQ
11
Promula Application Development System User's Manual
While running an application in interactive mode, you may suspend program execution by pressing the Esc key at a program pause. To resume execution at the point where you exited, select option 7 from the Main Menu.
2.1.2.7. F7 -- Resume an Interrupted Program
You can interrupt an executing program by pressing the Esc key in response to any program prompt. This gets you out of the program and returns you to the Main Menu. At this point, you have direct access to the program information and procedures. From the Main Menu you can perform a number of useful operations, like using the editor or using PROMULA in direct mode (by selecting Main Menu option 10) to perform diagnostic or debugging operations. In direct mode, you may audit the contents of the program selectively or make other adjustments before resuming execution. This is a very useful feature for developing and testing programs.
To return to the precise point of execution where you exited the program select option 7 off the Main Menu.
2.1.2.8. F8 -- Run a Program from a Disk File
An executable program may be run in one of two ways: interactively or in batch mode. Interactive execution proceeds as follows: the program issues prompts, pauses after each prompt, and expects a response from you before continuing execution. The program issues its prompts on the console and you enter your responses with the keyboard or mouse, one at a time. In batch mode, on the other hand, program execution proceeds without pause for user input from the keyboard. In this mode, all of your responses are expected to have been saved "in batch" on a text file, called the batch input file. For more information about preparing batch input files, see the section entitled Running Interactive Programs in Batch.
It is often inconvenient to execute a program directly from the console. It might be that the program is executed very often with minor or no data changes. Alternatively, the program might execute very slowly, or an exact record of each execution might be desired. Whatever the reason, batch execution provides the capability to execute a program in a non-interactive, file-driven mode. During batch execution, your program reads from a batch input file. The batch input file is a standard text file produced by any text editor. It contains the responses to the various program prompts in the precise order and form that they would be entered directly on the keyboard.
Main Menu option 8 is used to execute a compiled PROMULA program in batch mode, i.e., via commands in a "batch input file" on disk. In contrast, Main Menu option 6 is used to execute a compiled PROMULA program interactively, i.e., directly from the console. Selecting Main Menu option 8 results in the sample dialog shown below:
Enter the filename of the batch input file
? DEMO.INP
Where do you want the batch output listing? C)onsole, P)rinter, D)isk
? D
Enter a filename for the batch output listing
? DEMO.OUT
Enter the filename of the program to be executed
? DEMO.XEQ
DEMO.INP
is a file containing the responses required by the program
DEMO.XEQ
and its contents are shown below:
13200 12100 14800 16200 15200 17200 18060 18960 19900 20900 21950 23050
9200 8600 10400 11300 10700 12100 12700 13350 14000 14700 15440 16210
DEMO.OUT
is the disk file where the output is saved. This file is shown in Figure 2-4 and can be printed later or browsed using a text editor. The "batch" output shown here is the same as the output produced by running
DEMO.XEQ
interactively and spooling the run directly to the file
DEMO.OUT
.
12
Promula Application Development System User's Manual
Please enter the monthly sales figures.
? 13200 12100 14800 16200 15200 17200 18060 18960 19900 20900
? 21950 23050
Please enter the monthly cost figures.
? 9200 8600 10400 11300 10700 12100 12700 13350 14000 14700
? 15440 16210
Monthly Profit and Loss Figures ($)
Sales Costs Profit
January
February
March
April
May
June
July
August
September
October
November
December
13,200
12,100
14,800
16,200
15,200
17,200
18,060
18,960
19,900
20,900
21,950
23,050
Average monthly Profit ($) 5,235.00
9,200
8,600
10,400
11,300
10,700
12,100
12,700
13,350
14,000
14,700
15,440
16,210
4,000
3,500
4,400
4,900
4,500
5,100
5,360
5,610
5,900
6,200
6,510
6,840
Figure 2-4: Contents of File DEMO.OUT
2.1.2.9. F9 -- Run a Menu of Applications
Main Menu option 9 is used to start the application PROMULA.XEQ. A default PROMULA.XEQ program is distributed with PROMULA. This application displays a menu from which you may access either the PROMULA course or any of the sample programs provided with your PROMULA package. The sample programs and the course can help you learn to write and use your own PROMULA programs.
PROMULA.XEQ is a standard PROMULA executable (its source code is contained in the file PRMDEMO.PRM) and it may be replaced by a program you create that supports a menu of your own applications. To do this, create a PROMULA executable called PROMULA.XEQ. Note that the name of the executable file launched by selecting Main Menu option 9 is hardwired in the system and must be PROMULA.XEQ.
2.1.2.10. F10 -- Use the PROMULA Language
Selecting Main Menu option 10 (numeric key 0) puts PROMULA into direct or Command Mode. In this mode,
PROMULA accepts a single statement of source instructions, converts it to executable instructions which are executed by the computer, and proceeds to the next statement.
Pressing the Esc key or entering the STOP statement gets you out of direct mode and returns you to the Main Menu.
In direct mode, PROMULA issues the prompt
PROMULA?
and expects you to enter a statement on the same line of the screen. To enter a statement, simply type it in and press the
Enter key. After entering a statement, PROMULA will execute it and prompt you again for a new statement.
13
Stiahnuť
Reklama