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-2020, University of Amsterdam 7 VU University Amsterdam 8 CWI, Amsterdam 9 All rights reserved. 10 11 Redistribution and use in source and binary forms, with or without 12 modification, are permitted provided that the following conditions 13 are met: 14 15 1. Redistributions of source code must retain the above copyright 16 notice, this list of conditions and the following disclaimer. 17 18 2. Redistributions in binary form must reproduce the above copyright 19 notice, this list of conditions and the following disclaimer in 20 the documentation and/or other materials provided with the 21 distribution. 22 23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 27 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 28 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 29 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 33 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 POSSIBILITY OF SUCH DAMAGE. 35*/ 36 37:- module(pldoc, 38 [ doc_collect/1, % +Bool 39 40 pldoc_loading/0 % True if we are loading 41 ]). 42:- dynamic 43 pldoc_loading/0. 44 45pldoc_loading. 46 47:- dynamic user:file_search_path/2. 48:- multifile user:file_search_path/2. 49 50user:file_search_path(pldoc, library(pldoc)). 51user:file_search_path(package_documentation, swi('doc/packages')). 52 53:- multifile 54 tag_order/2. % +Tag, -Order 55 56:- create_prolog_flag(pldoc_collecting, false, []). 57 58doc_collect(OnOff) :- 59 set_prolog_flag(pldoc_collecting, OnOff). 60 61:- doc_collect(true). 62 63:- use_module(pldoc(doc_process)). 64:- use_module(pldoc(doc_register)). 65:- use_module(pldoc(doc_modes)). 66:- use_module(pldoc(doc_wiki)). 67:- use_module(library(debug)). 68:- use_module(library(option)). 69:- use_module(library(lists)). 70:- use_module(library(operators)). 71:- use_module(library(prolog_source)). 72 73 74 /******************************* 75 * DOCUMENTATION * 76 *******************************/
121 /******************************* 122 * FINISH UP * 123 *******************************/ 124 125finish :- 126 ( retract(pldoc_loading) 127 -> process_stored_comments 128 ; true 129 ). 130 131:- initialization(finish).
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.