[Oberon] Conditional compilation using IF const THEN
chris at cfbsoftware.com
Sat Aug 11 08:14:03 CEST 2018
In the microcontroller-specific MCU CONST modules I mentioned here recently
I have included definitions to help you determine at compile-time which MCU
module is actually being referenced via the search paths. e.g the LPC1769
MCU module has the following:
LPC1759* = FALSE;
LPC1769* = TRUE;
LPC1788* = FALSE;
You can then write microcontroller-specific sections in a common
higher-level module e.g.
IF MCU.LPC1759 THEN
ELSIF MCU.LPC1769 THEN
Some compilers I use (e.g. the original ETH 4-pass Modula-2 compiler,
Gardens Point Component Pascal etc.) actually suppress the generation of
IF FALSE THEN ...
i.e. it behaves like conditional compilation directives (e.g. #IFDEF debug)
on other systems.
I have tried to work out how the authors of ETH-M2 and GPCP achieved this
but have been unsuccessful so far. Does anybody have any ideas how the 'IF
const THEN - ELSIF const ELSE END' statement could be optimised in this way
in the Project Oberon RISC5 compiler?
More information about the Oberon