HP 3000 Manuals

Compiling and Running Programs [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

Compiling and Running Programs 

You can run the compiler from the interpreter or from the operating
system.  The commands are slightly different, but the steps are the same.
Figure 9-1 shows how a BSVXL file becomes an executing program (files are
boxed and steps are in capital letters).

                      |--------------------------|
                      |                          |
                      |       BASIC SAVE file    |
                      |       (BSVXL)            |
                      |--------------------------|
                                   |
                                   v
                            COMPILATION STEP
                                   |
                                   v
                      |--------------------------|
                      |                          |
                      | Relocatable Object file  |
                      | (NMOBJ or RL)            |
                      |--------------------------|
                                   |
                                   v
                               LINK STEP
                                   |
                                   v
                      |--------------------------|
                      |                          |
                      |     NMPROG file          |
                      |     (NMPRG)              |
                      |--------------------------|
                                   |
                                   v
                                RUN STEP
                                   |
                                   v
                      |--------------------------|
                      |                          |
                      |     Executing            |
                      |     Program              |
                      |                          |
                      |--------------------------|

          Figure 9-1.  Steps to Compile and Run a Program 

The compilation step translates a BASIC SAVE file into object code,
machine instructions in binary form, and stores those instructions in a
relocatable object module in a specially formatted disk file with file
code NMOBJ. See the HPLink Editor/XL Reference Manual for more
information about linking object files.

The running step binds the program to referenced externals from an
Executable Library, moves the program and its data stack into main
memory, and initiates execution.


NOTE The difference between a BASIC SAVE file and a program file is important. A BASIC SAVE file contains HP Business BASIC/XL program source code in a special format. The GET command can make that program the current program in the interpreter. A program file contains executable program code and runs under the operating system.
The compiling, linking, and running steps can be performed individually, or the first step and successive steps can be performed with a single command. Table 9-6 gives the syntax of every command that performs one or more steps of the compilation process. It also gives the type of the default operating system file $OLDPASS if the command is successful. (See the MPE XL Commands Reference Manual for more information on $OLDPASS, and the :RUN MPE XL command.) Explanations of the command parameters follow Table 9-6. Table 9-6. Compilation Process Commands -------------------------------------------------------------------------------------------------- | | | | | | Step(s) | Command from Interpreter | Command from | Effect on | | | | Operating System | $OLDPASS | | | | | | -------------------------------------------------------------------------------------------------- | | | | | | Compilation | | :BBXLCOMP [text =] | If objfile is not | | | | infile [,[obj=] | specified and | | | COMPILE [ infile] | objfile [,[list=] | command succeeds, | | | | listfile] ] | then $OLDPASS is | | | { ,} | | the NMOBJ | | | [ { ;} OBJ[ =]objfile ] | | relocatable | | | [ ] | | object file. | | | [ { ,} ] | | | | | [ { ;} LIST[ =]listfile] | | | | | | | | | | | | | -------------------------------------------------------------------------------------------------- | | | | | | Compilation | | :BBXLLK [text =] | If progfile is | | Linking | | infile [,[prog=] | not specified and | | | COMPLINK [ infile] | progfile [,[list=] | command succeeds, | | | | listfile] ] | then $OLDPASS is | | | { ,} | | the program file. | | | [ { ;} PROG[ =]progfile] | | | | | [ ] | | | | | [ { ,} ] | | | | | [ { ;} LIST[ =] ] | | | | | [ listfile ] | | | | | | | | -------------------------------------------------------------------------------------------------- | | | | | | Compilation | | :BBXLGO [text =] | If the command | | Linking Running | | infile [,[list=] | succeeds, then | | | COMPGO [ infile] | listfile [,[xl=] | $OLDPASS is the | | | | xlfile ] ] | program file. | | | [ { ,} ] | | | | | [ { ;} LIST[ =]listfile] | | | | | | | | | | | | | | | | | | -------------------------------------------------------------------------------------------------- | | | | | | Linking | Use the SYSTEM command. | :LINK FROM=objfile | None | | | | TO=progfile | | | | | [;cap=cap_list] | | | | | | | -------------------------------------------------------------------------------------------------- | | | | | | Running | SYSTEMRUN | :RUN progfile | None | | | progfile[;xl=`xlfile'] | [;xl='xlfile'] | | | | | | | -------------------------------------------------------------------------------------------------- Table 9-6 Notes 1. COMPLINK and COMPGO link the program with the default capabilities of IA and BA, and any additional capabilities MR, DH, and PH that are consistent with the capabilities of the user. 2. infile, objfile, listfile, and progfile are fnames (see chapter 6). 3. OBJ, LIST, and PROG can be in any order. 4. All but SYSTEMRUN are command-only statements.


MPE/iX 5.0 Documentation