In SWI-Prolog, I am using code such as at the beginning of a module text file:
:- module(foo, [bar/2]).
:- use_module(library(jack)).
I don't want to change my code. How can I neverthelss use
ECLiPSe Prolog (*). Is there some library that defines a
module/2
directive in ECLiPSe Prolog?
Best Regards
The following code defines a macro that maps module/2 into module/3 directives:
:- export macro((:-)/1, translate_directive/2, [top_only]).
translate_directive(
(:- module(Module, Exports)),
(:- module(Module, Exports, [swi]))
).
Compile (or import) this before compiling the module written for SWI. Note that the 3rd argument of module/3 must contain a language module, corresponding to the dialect your module is written in. I have used swi
here, other choices would be quintus
, iso
or ECLiPSe's native eclipse_language
.