:- module(prolog_detect,[prolog/1]).

%
% SWI-Prolog's exception/3 handling mechanism
%
/*
user:exception(undefined_predicate,prolog_detect:prolog_flag/2,Action) :-
	dynamic(prolog_detect:prolog_flag/2),
	Action=fail.
*/
%
% check for the presence of "eclipse" module in ECLiPSe
%
prolog(eclipse) :-
	current_module(eclipse),
	!.

%
% check for prolog_flag(quintus_directory,_) in Quintus
%
prolog(quintus)	:-
	prolog_flag(quintus_directory,_),
	!.

%
% check for prolog_flag/2 in SICStus
%
prolog(sicstus) :-
	prolog_flag(_,_),
	!.

%
% if all fail, then it is SWI
%
prolog(swi).

