[Oberon] Conditional compilation using IF const THEN
Chris Burrows
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:
CONST
LPC1759* = FALSE;
LPC1769* = TRUE;
LPC1788* = FALSE;
Etc.
You can then write microcontroller-specific sections in a common
higher-level module e.g.
IMPORT MCU;
...
...
IF MCU.LPC1759 THEN
...
ELSIF MCU.LPC1769 THEN
...
etc.
Some compilers I use (e.g. the original ETH 4-pass Modula-2 compiler,
Gardens Point Component Pascal etc.) actually suppress the generation of
code following:
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?
Regards,
Chris
Chris Burrows
CFB Software
http://www.astrobe.com/RISC5
More information about the Oberon
mailing list