Source, Output, and Listing Files [ VIRTUOSO CODE GENERATOR Reference Manual ] MPE/iX 5.0 Documentation
VIRTUOSO CODE GENERATOR Reference Manual
Source, Output, and Listing Files
The generator listing file (GENLIST) lists the VG statements and user
text processed during generation. The listing file contains the input
source lines as well as information on any errors encountered. Execution
of the generator terminates after 100 errors. If errors occur during
generation, the output file (GENOUT) is not created.
Preceding each input line in the listing file are the line numbers of the
listing file and the current source file line number. The listing file
number is incremented for each input line printed. The current input
file line number is taken from the VG source file for the line currently
being processed if the file is numbered. If the file is unnumbered, then
the line number is assigned by incrementing by one from the first input
line. Matching #IF, #ELSE, and #ENDIF constructs are always printed, but
code not executed in an #IF or #ELSE block is not printed.
After the generator completes execution, it returns one of the following
JCW's:
JCW = FATAL means that there were fatal generator errors in the
source.
JCW = WARN means that there were no fatal errors; however, there
were generator warning messages in the source.
JCW = OK means that there were no generator errors in the source.
Example Listing File
Here is an example of a Virtuoso source program, the macros it calls, and
its listing file.
Virtuoso Source Program
#let var-1 = "Hello"
#if var-1="HELLO"
Error, the generator does
case-sensitive comparisons
#else
Correct, the generator does
case-sensitive comparisons
#endif
#macro01 keyword1="ABCD" keyword2=999
#for record="ORDERINFO" element=? &
# relclass="contains"
element retrieved is !element
#endfor
Source for macro01
# MACRO MACRO01 KEYWORD1=STRING KEYWORD2=NUMERIC
KEYWORD1=!KEYWORD1
KEYWORD2=!KEYWORD2
# ENDMACRO
Listing File (GENLIST)
VIRTUOSO/3000 HP30422A.00.00 COPYRIGHT (C) HEWLETT-PACKARD CO. 1987
1 1.000 #let var-1 = "Hello"
2 2.000 #if var-1="HELLO"
3 3.000 #else
4 6.000 Correct, the generator
5 7.000 does case-sensitive comparisons
6 8.000 #endif
7 9.000
8 10.000 #macro01 keyword1="ABCD" keyword2=999
9 1.000 KEYWORD1 = !KEYWORD1
10 2.000 KEYWORD2 = !KEYWORD2
11 3.000 # ENDMACRO
12 11.000
13 12.000 #for record="ORDERINFO" element=? &
14 13.000 # relclass="contains"
15 14.000 element retrieved is !element
16 15.000 #endfor
17 14.000 element retrieved is !element
18 15.000 #endfor
19 14.000 element retrieved is !element
20 15.000 #endfor
21 14.000 element retrieved is !element
22 15.000 #endfor
NUMBER OF ERRORS = 0 NUMBER OF WARNINGS = 0
PROCESSOR TIME 0: 0: 2 ELAPSED TIME 0: 0:30
NUMBER OF INPUT LINES = 15 OUTPUT LINES/MINUTE = 300.0
NUMBER OF OUTPUT LINES = 10 OUTPUT / INPUT LINES = 0.6
The first column in the listing is the line number within the listing
file itself.
The second column shows the line numbers from the Virtuoso source code.
Notice that lines 3.000, 4.000 and 5.000 do not appear. This is because
those lines did not execute, since the #if construct was false. Now look
at line 10.000. This is where the macro macro01 is invoked. The source
code from the macro appears below line 10.000, and it is numbered 1.000,
2.000, 3.000, corresponding to the line numbers of the macro source.
Whenever an included file or macro appears in the source code, the
numbering reflects the line numbers of the include file source or macro
source.
Notice the repetition of lines 14.000 and 15.000. This is the
#for/#endfor loop, and the lines are repeated for each repetition of the
loop. The listing file also shows the code which was generated during
each loop. Note that #for is listed only for the first iteration of the
loop, while #endfor is listed for each iteration. Also, the #else is not
printed. When the #if construct evaluates false, as it did in this case,
only the lines which are executed after the #else appear in the listing.
The #else itself is not listed.
The last column is the source code itself. As mentioned earlier, only
those lines which are executed appear in the listing.
There are some other features of Virtuoso listing files which do not
appear in the above example. #entry/#endentry source code is not sorted
in the listing file, only in the generated code. Also, indentation of
macros does not appear in the listing file.
Error Messages and Handling
Error messages in the Virtuoso listing are preceded by "****". Error
messages are reported immediately following the line where the error
occurred. Virtuoso error messages are contained on one line. However,
System Dictionary error messages are contained on two lines. The first
line is the Virtuoso error message, and the second line is the System
Dictionary error message. User error messages (from #printerror) are
also two lines. Refer to Chapter 3 for more information on #printerror.
Syntax checking is somewhat different when using the generator to process
a Source Macro File. When the generator is run with MP=ON, the generator
checks that a reserved VG word (generator construct name) is not used to
name a macro, checks for duplicate macros in the Processed Macro File,
and checks for matching #macro/#endmacro pairs. However, all of the
statements in the macro body are passed directly through to the output
file (the Processed Macro File). No syntax checking or error reporting
is performed on the macro body statements. This checking is performed
later, when the macro is invoked at generation time. Any errors
encountered are reported at that time.
Note that the Virtuoso Code Generator does not check the generated code
for valid syntax. This is normally done by the language compiler. For
example, if you are generating COBOL code, the language syntax of that
code is not checked by Virtuoso. This is done by the COBOL compiler.
Thus, even if your Virtuoso source code is error-free in the generation
process, there may still be language syntax errors. The generated code
must still be compiled, prepped, and debugged.
Refer to Appendix A for a complete listing and explanation of Virtuoso
error and warning messages.
MPE/iX 5.0 Documentation