⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 help.jam

📁 C++的一个好库。。。现在很流行
💻 JAM
字号:
# (C) Copyright David Abrahams, 2003.
# (C) Copyright Rene Rivera, 2003.
#
# See accompanying license for terms and conditions of use.
#

# This module is the plug-in handler for the --help and --help-.*
# command-line options
import modules ;
import assert ;
import doc : do-scan set-option set-output set-output-file print-help-usage print-help-top ;
import sequence ;
import set ;


# List of possible modules, but which really aren't.
#
.not-modules =
    boost-build bootstrap site-config test user-config
    -tools allyourbase boost-base features python stlport testing unit-tests ;

# The help system options are parsed here and handed off to the doc
# module to translate into documentation requests and actions. The
# understood options are::
#
#    --help-all
#    --help-enable-<option>
#    --help-disable-<option>
#    --help-output <type>
#    --help-output-file <file>
#    --help-options
#    --help-usage
#    --help [<module-or-class>]
#
rule process (
    command # The option.
    : values * # The values, starting after the "=".
    )
{
    assert.result --help : MATCH ^(--help).* : $(command) ;
    local did-help = ;
    switch $(command)
    {
        case --help-all :
        local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ;
        path-to-modules ?= . ;
        local possible-modules = [ GLOB $(path-to-modules) : *\\.jam ] ;
        local not-modules = [ GLOB $(path-to-modules) : *$(.not-modules)\\.jam ] ;
        local modules-to-list =
            [ sequence.insertion-sort
                [ set.difference $(possible-modules:D=:S=) : $(not-modules:D=:S=) ] ] ;
        local modules-to-scan ;
        for local m in $(modules-to-list)
        {
            local module-files = [ GLOB $(path-to-modules) : $(m)\\.jam ] ;
            modules-to-scan += $(module-files[1]) ;
        }
        do-scan $(modules-to-scan[1--2]) ;
        do-scan $(modules-to-scan[-1]) : print-help-all ;
        did-help = true ;
        
        case --help-enable-* :
        local option = [ MATCH --help-enable-(.*) : $(command) ] ; option = $(option:L) ;
        set-option $(option) : enabled ;
        did-help = true ;
        
        case --help-disable-* :
        local option = [ MATCH --help-disable-(.*) : $(command) ] ; option = $(option:L) ;
        set-option $(option) ;
        did-help = true ;
        
        case --help-output :
        set-output $(values[1]) ;
        did-help = true ;
        
        case --help-output-file :
        set-output-file $(values[1]) ;
        did-help = true ;
        
        case --help-options :
        local doc-module-spec = [ split-symbol doc ] ;
        do-scan $(doc-module-spec[1]) : print-help-options ;
        did-help = true ;
        
        case --help-usage :
        print-help-usage ;
        did-help = true ;
        
        case --help :
        local spec = $(values[1]) ;
        if $(spec)
        {
            local spec-parts = [ split-symbol $(spec) ] ;
            if $(spec-parts)
            {
                if $(spec-parts[2])
                {
                    do-scan $(spec-parts[1]) : print-help-classes $(spec-parts[2]) ;
                    do-scan $(spec-parts[1]) : print-help-rules $(spec-parts[2]) ;
                    do-scan $(spec-parts[1]) : print-help-variables $(spec-parts[2]) ;
                }
                else
                {
                    do-scan $(spec-parts[1]) : print-help-module ;
                }
            }
            else
            {
                EXIT "Unrecognized help option '"$(command)" "$(spec)"'." ;
            }
        }
        else
        {
            print-help-top ;
        }
        did-help = true ;
    }
    if $(did-help)
    {
        UPDATE all ;
    }
    return $(did-help) ;
}

# Split a reference to a symbol into module and symbol parts.
#
local rule split-symbol (
    symbol # The symbol to split.
    )
{
    local path-to-modules = [ modules.peek : BOOST_BUILD_PATH ] ;
    path-to-modules ?= . ;
    local module-name = $(symbol) ;
    local symbol-name = ;
    local result = ;
    while ! $(result)
    {
        local module-path = [ GLOB $(path-to-modules) : $(module-name)\\.jam ] ;
        if $(module-path)
        {
            # The 'module-name' in fact refers to module. Return the full 
            # module path and a symbol within it. If 'symbol' passed to this 
            # rule is already module, 'symbol-name' will be empty. Otherwise, 
            # it's initialized on the previous loop iteration. 
            # In case there are several modules by this name, 
            # use the first one.
            result = $(module-path[1]) $(symbol-name) ;
        }
        else
        {
            if ! $(module-name:S)
            {
                result = - ;
            }
            else
            {
                local next-symbol-part = [ MATCH ^.(.*) : $(module-name:S) ] ;
                if $(symbol-name)
                {
                    symbol-name = $(next-symbol-part).$(symbol-name) ;
                }
                else
                {
                    symbol-name = $(next-symbol-part) ;
                }
                module-name = $(module-name:B) ;
            }
        }
    }
    if $(result) != -
    {
        return $(result) ;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -