1/* Part of ClioPatria SeRQL and SPARQL server 2 3 Author: Jan Wielemaker 4 E-mail: J.Wielemaker@cs.vu.nl 5 WWW: http://www.swi-prolog.org 6 Copyright (C): 2010, University of Amsterdam, 7 VU University Amsterdam 8 9 This program is free software; you can redistribute it and/or 10 modify it under the terms of the GNU General Public License 11 as published by the Free Software Foundation; either version 2 12 of the License, or (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public 20 License along with this library; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 23 As a special exception, if you link this library with other files, 24 compiled with a Free Software compiler, to produce an executable, this 25 library does not by itself cause the resulting executable to be covered 26 by the GNU General Public License. This exception does not however 27 invalidate any other reasons why the executable file might be covered by 28 the GNU General Public License. 29*/ 30 31:- module(bundle, 32 [ use_bundle/1 33 ]). 34 35/** <module> Import bundles 36 37This module provides an interface that is similar to the Ciao package 38interface. Bundles are Prolog files that are included. Typically, they 39contain multiple use_module/1 calls. 40 41At least for now, the system has been named bundle because the name 42package is already used as a package of software. 43*/ 44 45:- multifile 46 user:file_search_path/2, 47 system:term_expansion/2, 48 emacs_prolog_colours:goal_colours/2. 49 50user:file_search_path(bundle, library(bundles)). 51 52%% use_bundle(+Term) 53% 54% Include a bundle of declarations. Typically, these declarations 55% are a set of :- use_module(Library). calls. 56 57use_bundle(Package) :- 58 throw(error(context_error(nodirective, use_bundle(Package)), _)). 59 60systemterm_expansion((:- use_bundle(Package)), 61 (:- include(bundle(Package)))). 62 63 64emacs_prolog_colours:goal_colours(use_bundle(Pkg), 65 built_in - [ Class ]) :- 66 ( absolute_file_name(bundle(Pkg), File, 67 [ file_type(prolog), 68 file_errors(fail) 69 ]) 70 -> Class = file(File) 71 ; Class = nofile 72 )