View source with raw comments or as raw
    1/*  Part of SWI-Prolog
    2
    3    Author:        Jan Wielemaker
    4    E-mail:        J.Wielemaker@vu.nl
    5    WWW:           http://www.swi-prolog.org
    6    Copyright (c)  2006-2013, University of Amsterdam,
    7                              VU University Amsterdam
    8    All rights reserved.
    9
   10    Redistribution and use in source and binary forms, with or without
   11    modification, are permitted provided that the following conditions
   12    are met:
   13
   14    1. Redistributions of source code must retain the above copyright
   15       notice, this list of conditions and the following disclaimer.
   16
   17    2. Redistributions in binary form must reproduce the above copyright
   18       notice, this list of conditions and the following disclaimer in
   19       the documentation and/or other materials provided with the
   20       distribution.
   21
   22    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   23    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   24    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   25    FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   26    COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   27    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   28    BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   29    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   30    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   31    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
   32    ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   33    POSSIBILITY OF SUCH DAMAGE.
   34*/
   35
   36:- module(pldoc_library,
   37          [ doc_load_library/0
   38          ]).
 doc_load_library
Load the SWI-Prolog library, so we can access all comments from the library.
   45doc_load_library :-
   46    set_prolog_flag(verbose_load, false),
   47    absolute_file_name(swi(library), Dir, [file_type(directory)]),
   48    load_all(Dir).
   49
   50
   51load_all([]) :- !.
   52load_all([H|T]) :-
   53    load_all(H),
   54    !,
   55    load_all(T).
   56load_all(Dir0) :-
   57    atom(Dir0),
   58    expand_file_name(Dir0, [Dir1]),
   59    downcase_atom(Dir1, Dir),       % Deal with Windows
   60    \+ ( blocked(Blocked),
   61         sub_atom(Dir, _, _, 0, Blocked)
   62       ),
   63    exists_directory(Dir),
   64    !,
   65    atom_concat(Dir, '/*', Pattern),
   66    expand_file_name(Pattern, Contents),
   67    load_all(Contents).
   68load_all(File) :-
   69    atom(File),
   70    file_name_extension(_, pl, File),
   71    downcase_atom(File, LwrCase),
   72    \+ ( blocked(Blocked),
   73         sub_atom(LwrCase, _, _, 0, Blocked)
   74       ),
   75    !,
   76    use_module(File, []).
   77load_all(Spec) :-
   78    compound(Spec),
   79    !,
   80    forall(absolute_file_name(Spec, Path,
   81                              [ access(read),
   82                                file_errors(fail)
   83                              ]),
   84           load_all(Path)).
   85load_all(_).
 blocked(+Path) is semidet
True if file or directory should not be loaded. Note that file from the directory chr are already loaded by chr.pl. Similar arguments apply for a few others.
bug
- We force lowercase to make it also work on Windows
   95blocked('/theme/dark.pl').
   96blocked('/chr').
   97blocked('/clpq').
   98blocked('/clpr').
   99blocked('/pldoc').
  100blocked('/ciao').
  101blocked('/latex2html').
  102blocked('/checkselect.pl').
  103blocked('/tabling.pl').                 % deprecated file
  104blocked('/checklast.pl').
  105blocked('/clp/clp_distinct.pl').        % deprecated file
  106%blocked('/jpl.pl').                    % should be added
  107blocked('/pldoc.pl').
  108blocked('/index.pl').
  109
  110blocked('/ciao.pl').                    % is an include-file.  We must
  111                                        % find a more general solution here
  112blocked('/commons.pl').
  113blocked('/swipl-lfr.pl').
  114blocked('/dcg_basics.pl').              % deprecated file
  115blocked('/readline.pl').                % conflicts with editline.pl