# Compilation

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

Tags: compilation of basic programs

# Description

The BASIC command is provided as a front end program to the jBASE jbc compiler. The jbc compiler converts the BASIC code into "C" and invokes the native "C" compiler to convert the "C" source code into a machine native object file.

BASIC BP PROGRAM1 SUB1

The BASIC command creates the object record as $PROGRAM1 in file BP. The BP file can be any file type supported by jBASE, whether it is a hashed file, directory and so on.

The steps used by BASIC command are as follows:

  • Any supplied record keys with a dollar/pound prefix or a .o or .obj suffix are ignored.
  • The source is moved to the current working directory as a temporary file called BASIC_nn.c, where nn is the users port number.
  • The source is compiled using the jcompile command.
  • The .o or .obj file is then moved back to the original source file with a dollar/pound prefix and the .o or .obj suffix removed.
  • The command then cleans up any scratch files it created.

# Note

If the original record key had a .b suffix then the .o or .obj suffix is not removed and the dollar/pound prefix not prepended.
If an OBJECT data section exists for the BP file, then all object code is automatically stored there rather than with the source code.

A jBASE utility jCompileFile is available which invokes the BASIC compiler and produces an output and summary report, together with warnings and error lists. The syntax of jCompileFile is as follows:

jCompileFile -Options SourceFileName
1

where option may be:

  • -p to direct output and report to printer,
  • -v to direct output and report to screen

The conversion report, output, warning lists and error lists are stored in the PortSave directory as jbc_rep_FileName, jbc_out_FileName,   jbc_warn_FileName and jbc_err_FileName respectively. The jbc_err_FileName can be used to create a select list to supply to jED to enable correction of errors or problems. If executed again the jCompileFile will only attempt to compile records in the jbc_err_FileName list else the jbc_warn_FileName if either list is not empty. e.g.

FORM-LIST PortSave jbc_err_FileName
JED FileName
jCompileFile -v FileName
1
2
3

Back to Compilation