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,
   37          [ doc_collect/1,              % +Bool
   38
   39            pldoc_loading/0             % True if we are loading
   40          ]).   41:- dynamic
   42    pldoc_loading/0.   43
   44pldoc_loading.
   45
   46:- dynamic   user:file_search_path/2.   47:- multifile user:file_search_path/2.   48
   49user:file_search_path(pldoc, library(pldoc)).
   50user:file_search_path(package_documentation, swi('doc/packages')).
   51
   52:- multifile
   53    tag_order/2.                    % +Tag, -Order
   54
   55:- create_prolog_flag(pldoc_collecting, false, []).   56
   57doc_collect(OnOff) :-
   58    set_prolog_flag(pldoc_collecting, OnOff).
   59
   60:- doc_collect(true).   61
   62:- load_files([ pldoc(doc_process),
   63                pldoc(doc_register),
   64                pldoc(doc_modes),
   65                pldoc(doc_wiki),
   66                library(debug),
   67                library(option),
   68                library(lists),
   69                library(operators),
   70                library(prolog_source)
   71              ],
   72              [ silent(true),
   73                if(not_loaded)
   74              ]).   75
   76                 /*******************************
   77                 *        DOCUMENTATION         *
   78                 *******************************/

Process source documentation

The pldoc module processes structured comments in Prolog source files. These comments can be saved to file. During development the documentation system can start a web-server to view the documentation of loaded sources through your browser. The server is defined in the file doc_http.pl and started through doc_server/1.

During development, a typical scenario is to first start the documentation server and start a browser at http://localhost:4000. Note that by default the web-pages allow for starting an editor only if the connection comes from localhost. See doc_server/2 to realise a different setup.

:- doc_server(4000).
:- [application].
author
- Jan Wielemaker
See also
- doc_server/1, doc_server/2, doc_collect/1. */
license
- LGPL
 doc_collect(+Bool) is det
Switch collecting comments true/false. This autoload predicate can be used to force loading the pldoc library. In a typical development setup loading pldoc is normally triggered using doc_server/1.
 pldoc_loading is semidet
True if we are loading the PlDoc libraries. Required internally to avoid undefined predicates while re-loading and document itself.
 tag_order(?Tag, ?Order) is semidet
Hook that allows for defining additional tags.
See also
- pldoc_wiki:tag_order/2 for the default definition.
  124                 /*******************************
  125                 *           FINISH UP          *
  126                 *******************************/
  127
  128:- retract(pldoc_loading),
  129   process_stored_comments.