%if 0

Extensions for lDebug relocation check macros

Copyright (C) 2008-2023 E. C. Masloch

Usage of the works is permitted provided that this
instrument is retained with the works, so that any entity
that uses the works is notified of this instrument.

DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

%endif

%ifndef ELDCHECK_MAC
%define ELDCHECK_MAC 1

%assign ELDSTRICT 0
%assign ELDSTRICTCOUNTER 0

	%imacro eldstrict 1.nolist
%ifidni %1, on
 %assign ELDSTRICT 1
 [warning +error=reloc-abs]
 [warning +reloc-abs]
%elifidni %1, off
 %assign ELDSTRICT 0
 [warning -reloc-abs]
%else
 %error Unknown keyword
%endif
	%endmacro

	%imacro reloc 1+.nolist
%if ELDSTRICT
 %if ELDSTRICTCOUNTER
  %error Missing relocation
 %endif
 [warning -reloc-abs]
 %assign ELDSTRICTCOUNTER 1
%endif
%1
	%endmacro

	%imacro reloc2 1+.nolist
%if ELDSTRICT
 %if ELDSTRICTCOUNTER
  %error Missing relocation
 %endif
 [warning -reloc-abs]
 %assign ELDSTRICTCOUNTER 2
%endif
%1
	%endmacro

	%imacro eldstrictcheck 0.nolist
%if ELDSTRICT
 %ifn ELDSTRICTCOUNTER
  %error Unexpected relocation
 %else
  %assign ELDSTRICTCOUNTER ELDSTRICTCOUNTER - 1
  %ifn ELDSTRICTCOUNTER
   [warning +reloc-abs]
  %endif
 %endif
%endif
	%endmacro

%endif

