1/*****************************************************************************
    2 * This file is part of the Prolog Development Tool (PDT)
    3 * 
    4 * WWW: http://sewiki.iai.uni-bonn.de/research/pdt/start
    5 * Mail: pdt@lists.iai.uni-bonn.de
    6 * Copyright (C): 2014, CS Dept. III, University of Bonn
    7 * 
    8 * All rights reserved. This program is  made available under the terms
    9 * of the Eclipse Public License v1.0 which accompanies this distribution,
   10 * and is available at http://www.eclipse.org/legal/epl-v10.html
   11 * 
   12 ****************************************************************************/
   13
   14:- module(compatibility,[
   15	pdt_source_file/2
   16]).   17
   18:- if((current_prolog_flag(version_data, Version), Version @>= swi(7, 1, 15, []))).   19
   20:- meta_predicate(pdt_source_file(:, ?)).   21pdt_source_file(PI, File) :-
   22	source_file(PI, File).
   23
   24:- else.   25
   26pdt_source_file(M:Head, File) :-
   27	nonvar(M),
   28	nonvar(Head),
   29	!,
   30	(	M == user
   31	->	source_file(Head, File)
   32	;	source_file(M:Head, File)
   33	).
   34
   35pdt_source_file(PI, File) :-
   36	source_file(Head, File),
   37	(	Head = _:_
   38	->	PI = Head
   39	;	PI = user:Head
   40	).
   41
   42:- endif.