# BASIC

Updated: 9/7/2021, 1:14:21 PM
Created: 9/7/2021, 1:14:21 PM
Last Updated By: Mike Street
Read Time: 4 minute(s)

BASIC -v -wn -Ipath FileName Itemlist (On En Wn Ipath Qq
1
Option Description
-v verbose mode
-wn set the warning level to 0, 1, 2 or 3. See later
-Ipath path for include files
-DDef Definition to pass to the compiler (used with #ifdef / #ifndef constructs to execute specific sections of code, see example below)
(On optimize the code, see below
(En optimize the code. As the (O) option
(Wn set warning level to 0, 1, 2 or 3, see below
(Ipath path for include files
(V allow persistent variables in subroutines
(Qq specifies that the source code contains embedded SQL statements, see below

If the record key selection is omitted, BASIC will use any preceding select list. If the BASIC command has no select list, it will use all records in the specified file. When processing the list of record keys, the BASIC command will ignore $ and ! prefixes and .o or .obj suffixes and build up a list of source names. Using this mechanism, you can safely use BASIC on all records in a file, and it will only process the sources you intended.

# Note

To copy binary object files such as $PROG or PROG.o from Hash files to directories or vice versa use the "(B" option of the jBASE COPY command. This will ensure conversion of attribute mark characters to new line and vice versa is suppressed rather than invalidating the binary object.

The following example illustrates the use of the -D option:

PROGRAM DEFTEST
#ifdef TEST
   CRT "Testing"
#endif
1
2
3
4
BASIC -DTEST BP DEFTEST
CATALOG BP DEFTEST
1
2

When the DEFTEST program is run, it will display the string "Testing". If the program was not compiled with that specific -D option then the string would not display.

The #ifdef compiler directive can also be used to insert block comments into source code by using an undefined symbol, e.g.

C:\home\bp>type block_comment.jabba
    print "Example of a block comment."
#ifdef DOOMSDAY
    Hesiod's famous description of Askra, the village he lived in:

    Bad in winter,
        godawful in summer,
            nice never.
#endif
    print "End of example."
1
2
3
4
5
6
7
8
9
10

When this program is compiled, the lines between the #ifdef and #endif are ignored because DOOMSDAY is undefined.
Running the program will produce the following output:

Example of a block comment.
End of example.
1
2

# Optimization

There are 4 levels of optimization.

Level Description
1 No code optimizations are performed and debug information is produced for both the C debugger and the jBASE debugger.
2 Debug information is produced for the jBC debugger but not for the C debugger. Minimal optimization occurs. This is the default optimization level.
3 Debug information is produced for the jBC debugger. Optimization of jBC occurs and matrix boundary checking is removed. The C code is optimized by the standard optimizations of the resident C compiler.
4 Full optimization. No debugging information is produced. The jBC code is fully optimized and no run time checking is done on array boundaries and the like. All symbol information is removed from the final executable and all available (safe) optimizations are performed by the resident C compiler.

# Compiler Warnings

The default level is level 1.

The four levels are:

Level Type Description
0 none no warnings generated at all
1 reasonable reports likely coding errors
2 pedantic reports level 1 warnings and bad practice
3 very pedantic reports every transgression of the rules

The following source code can be used to show the different warning levels in action. Each warning level will produce a different set of warning messages. The higher the warning level the more warning messages will be generated.

SUBROUTINE abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
varx = 1
COMMON varx
vary = varz
FOR I = 1 TO 10
NEXT L
BREAK
CONTINUE
format = varx "L#10" "L#20" "L#30"
RETURN
1
2
3
4
5
6
7
8
9
10

# Embedded SQL

The Qq option is used to specify that the source code contains embedded SQL statements. The values for q can be:

Option Description
i Ingres
m Microsoft SQL
o Oracle
x Informix

Back to Compilation