Preprocessor for BASIC

 

Most BASICs do not have a pre-processor. ARMbasic  does not include one as part of the standard language, but a version of the CPP has been included as part of the utilites. 

These are the most common directives that apply to use with ARMbasic:  Unlike ARMbasic these keywords and any parameters used in them ARE CASE SENSITIVE.  The pre-processor is run on the PC, so it is nor available when using the builtin compiler of the ARMweb. However the compiler with preprocessor can be used to generate files that can be downloaded to the ARMweb (use the Save Intermediates check box in the Files menu of BASICtools).

#include "filename"

#include <filename> 

#define

#ifdef

#ifndef

#if

#if (defined   )

#else

#elif

#endif

#undef

#error

#warning

The CPP (C preprocessor) is a very powerful tool, most users use just a fraction of the features,  but if you want the full story check this 90+ page document from the Free Software Foundation.

CPP operation

The CPP is a multi-step process carried out automatically by the BASICtools program.  All operations are done in a temp file directory created at c:/Program Files/Coridium/temp. All files in this directory will be deleted when a File>>Load is performed by BASICtools.

It starts with your source file, and it will be copied into the c:/Program Files/Coridium/temp directory.  When copied all comments will be stripped.  All included files will be also copied into this temp directory.  Then the CPP will be run on the files in that temp directory creating a __temp.bpp file that is the result of all the pre-processor operations.  This __temp.bpp file will be combined with other information as __temp.bas and then compiled by ARMbasic.exe and its output is __temp.out.   This __temp.out file is a modified Intel hex format of the code generated by the source BASIC program.  __temp.out will be downloaded to the ARMexpress or ARMmite.

In addition __temp.bat and __errors.tmp files will be created.  __temp.bat is a batch file used in the compilation process.  Errors from the compile or any of its steps will be contained in __errors.tmp.