1 # Copyright 2003 Dave Abrahams
2 # Copyright 2003, 2006 Rene Rivera
3 # Copyright 2003, 2006 Vladimir Prus
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7 # This module is the plug-in handler for the --help and --help-.*
11 import doc : do-scan set-option set-output set-output-file print-help-usage print-help-top ;
20 # List of possible modules, but which really aren't.
23 boost-build bootstrap site-config test user-config
24 -tools allyourbase boost-base features python stlport testing unit-tests ;
26 # The help system options are parsed here and handed off to the doc
27 # module to translate into documentation requests and actions. The
28 # understood options are:
30 # --help-disable-<option>
32 # --help-enable-<option>
36 # --help-output <type>
37 # --help-output-file <file>
38 # --help [<module-or-class>]
42 : values * # The values, starting after the "=".
45 assert.result --help : MATCH ^(--help).* : $(command) ;
49 case --help-internal :
50 local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ;
51 path-to-modules ?= . ;
52 local possible-modules = [ GLOB $(path-to-modules) : *\\.jam ] ;
53 local not-modules = [ GLOB $(path-to-modules) : *$(.not-modules)\\.jam ] ;
54 local modules-to-list =
55 [ sequence.insertion-sort
56 [ set.difference $(possible-modules:D=:S=) : $(not-modules:D=:S=) ] ] ;
57 local modules-to-scan ;
58 for local m in $(modules-to-list)
60 local module-files = [ GLOB $(path-to-modules) : $(m)\\.jam ] ;
61 modules-to-scan += $(module-files[1]) ;
63 do-scan $(modules-to-scan) : print-help-all ;
66 case --help-enable-* :
67 local option = [ MATCH --help-enable-(.*) : $(command) ] ; option = $(option:L) ;
68 set-option $(option) : enabled ;
71 case --help-disable-* :
72 local option = [ MATCH --help-disable-(.*) : $(command) ] ; option = $(option:L) ;
73 set-option $(option) ;
77 set-output $(values[1]) ;
80 case --help-output-file :
81 set-output-file $(values[1]) ;
84 case --help-doc-options :
85 local doc-module-spec = [ split-symbol doc ] ;
86 do-scan $(doc-module-spec[1]) : print-help-options ;
94 local spec = $(values[1]) ;
97 local spec-parts = [ split-symbol $(spec) ] ;
102 do-scan $(spec-parts[1]) : print-help-classes $(spec-parts[2]) ;
103 do-scan $(spec-parts[1]) : print-help-rules $(spec-parts[2]) ;
104 do-scan $(spec-parts[1]) : print-help-variables $(spec-parts[2]) ;
108 do-scan $(spec-parts[1]) : print-help-module ;
113 EXIT "Unrecognized help option '"$(command)" "$(spec)"'." ;
120 # First print documentation from the current Jamfile, if any.
121 # FIXME: Generally, this duplication of project.jam logic is bad.
122 local names = [ modules.peek project : JAMROOT ]
123 [ modules.peek project : JAMFILE ] ;
124 local project-file = [ path.glob . : $(names) ] ;
127 project-file = [ path.glob-in-parents . : $(names) ] ;
130 for local p in $(project-file)
132 do-scan $(p) : print-help-project $(p) ;
135 # Next any user-config help.
136 local user-path = [ os.home-directories ] [ os.environ BOOST_BUILD_PATH ] ;
137 local user-config = [ GLOB $(user-path) : user-config.jam ] ;
140 do-scan $(user-config[1]) : print-help-config user $(user-config[1]) ;
143 # Next any site-config help.
144 local site-config = [ GLOB $(user-path) : site-config.jam ] ;
147 do-scan $(site-config[1]) : print-help-config site $(site-config[1]) ;
150 # Then the overall help.
163 # Split a reference to a symbol into module and symbol parts.
165 local rule split-symbol (
166 symbol # The symbol to split.
169 local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ;
170 path-to-modules ?= . ;
171 local module-name = $(symbol) ;
172 local symbol-name = ;
176 local module-path = [ GLOB $(path-to-modules) : $(module-name)\\.jam ] ;
179 # The 'module-name' in fact refers to module. Return the full
180 # module path and a symbol within it. If 'symbol' passed to this
181 # rule is already module, 'symbol-name' will be empty. Otherwise,
182 # it's initialized on the previous loop iteration.
183 # In case there are several modules by this name,
185 result = $(module-path[1]) $(symbol-name) ;
189 if ! $(module-name:S)
195 local next-symbol-part = [ MATCH ^.(.*) : $(module-name:S) ] ;
198 symbol-name = $(next-symbol-part).$(symbol-name) ;
202 symbol-name = $(next-symbol-part) ;
204 module-name = $(module-name:B) ;