http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/doc.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/util/doc.jam b/ext/kenlm/jam-files/boost-build/util/doc.jam deleted file mode 100644 index 7ff2df4..0000000 --- a/ext/kenlm/jam-files/boost-build/util/doc.jam +++ /dev/null @@ -1,1002 +0,0 @@ -# Copyright 2002, 2005 Dave Abrahams -# Copyright 2002, 2003, 2006 Rene Rivera -# Copyright 2003 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - -# Documentation system, handles --help requests. -# It defines rules that attach documentation to modules, rules, and variables. -# Collects and generates documentation for the various parts of the build -# system. The documentation is collected from comments integrated into the code. - -import modules ; -import print ; -import set ; -import container ; -import "class" ; -import sequence ; -import path ; - - -# The type of output to generate. -# "console" is formated text echoed to the console (the default); -# "text" is formated text appended to the output file; -# "html" is HTML output to the file. -# -help-output = console ; - - -# The file to output documentation to when generating "text" or "html" help. -# This is without extension as the extension is determined by the type of -# output. -# -help-output-file = help ; - -# Whether to include local rules in help output. -# -.option.show-locals ?= ; - -# When showing documentation for a module, whether to also generate -# automatically the detailed docs for each item in the module. -# -.option.detailed ?= ; - -# Generate debug output as the help is generated and modules are parsed. -# -.option.debug ?= ; - -# Enable or disable a documentation option. -# -local rule set-option ( - option # The option name. - : value ? # Enabled (non-empty), or disabled (empty) -) -{ - .option.$(option) = $(value) ; -} - - -# Set the type of output. -# -local rule set-output ( type ) -{ - help-output = $(type) ; -} - - -# Set the output to a file. -# -local rule set-output-file ( file ) -{ - help-output-file = $(file) ; -} - - -# Extracts the brief comment from a complete comment. The brief comment is the -# first sentence. -# -local rule brief-comment ( - docs * # The comment documentation. -) -{ - local d = $(docs:J=" ") ; - local p = [ MATCH ".*([.])$" : $(d) ] ; - if ! $(p) { d = $(d)"." ; } - d = $(d)" " ; - local m = [ MATCH "^([^.]+[.])(.*)" : $(d) ] ; - local brief = $(m[1]) ; - while $(m[2]) && [ MATCH "^([^ ])" : $(m[2]) ] - { - m = [ MATCH "^([^.]+[.])(.*)" : $(m[2]) ] ; - brief += $(m[1]) ; - } - return $(brief:J="") ; -} - - -# Specifies the documentation for the current module. -# -local rule set-module-doc ( - module-name ? # The name of the module to document. - : docs * # The documentation for the module. -) -{ - module-name ?= * ; - - $(module-name).brief = [ brief-comment $(docs) ] ; - $(module-name).docs = $(docs) ; - - if ! $(module-name) in $(documented-modules) - { - documented-modules += $(module-name) ; - } -} - - -# Specifies the documentation for the current module. -# -local rule set-module-copyright ( - module-name ? # The name of the module to document. - : copyright * # The copyright for the module. -) -{ - module-name ?= * ; - - $(module-name).copy-brief = [ brief-comment $(copyright) ] ; - $(module-name).copy-docs = $(docs) ; - - if ! $(module-name) in $(documented-modules) - { - documented-modules += $(module-name) ; - } -} - - -# Specifies the documentation for a rule in the current module. If called in the -# global module, this documents a global rule. -# -local rule set-rule-doc ( - name # The name of the rule. - module-name ? # The name of the module to document. - is-local ? # Whether the rule is local to the module. - : docs * # The documentation for the rule. -) -{ - module-name ?= * ; - - $(module-name).$(name).brief = [ brief-comment $(docs) ] ; - $(module-name).$(name).docs = $(docs) ; - $(module-name).$(name).is-local = $(is-local) ; - - if ! $(name) in $($(module-name).rules) - { - $(module-name).rules += $(name) ; - } -} - - -# Specify a class, will turn a rule into a class. -# -local rule set-class-doc ( - name # The name of the class. - module-name ? # The name of the module to document. - : super-name ? # The super class name. -) -{ - module-name ?= * ; - - $(module-name).$(name).is-class = true ; - $(module-name).$(name).super-name = $(super-name) ; - $(module-name).$(name).class-rules = - [ MATCH "^($(name)[.].*)" : $($(module-name).rules) ] ; - $(module-name).$($(module-name).$(name).class-rules).is-class-rule = true ; - - $(module-name).classes += $(name) ; - $(module-name).class-rules += $($(module-name).$(name).class-rules) ; - $(module-name).rules = - [ set.difference $($(module-name).rules) : - $(name) $($(module-name).$(name).class-rules) ] ; -} - - -# Set the argument call signature of a rule. -# -local rule set-rule-arguments-signature ( - name # The name of the rule. - module-name ? # The name of the module to document. - : signature * # The arguments signature. -) -{ - module-name ?= * ; - - $(module-name).$(name).signature = $(signature) ; -} - - -# Specifies the documentation for an argument of a rule. -# -local rule set-argument-doc ( - name # The name of the argument. - qualifier # Argument syntax qualifier, "*", "+", etc. - rule-name # The name of the rule. - module-name ? # THe optional name of the module. - : docs * # The documentation. -) -{ - module-name ?= * ; - - $(module-name).$(rule-name).args.$(name).qualifier = $(qualifier) ; - $(module-name).$(rule-name).args.$(name).docs = $(docs) ; - - if ! $(name) in $($(module-name).$(rule-name).args) - { - $(module-name).$(rule-name).args += $(name) ; - } -} - - -# Specifies the documentation for a variable in the current module. If called in -# the global module, the global variable is documented. -# -local rule set-variable-doc ( - name # The name of the variable. - default # The default value. - initial # The initial value. - module-name ? # The name of the module to document. - : docs * # The documentation for the variable. -) -{ - module-name ?= * ; - - $(module-name).$(name).brief = [ brief-comment $(docs) ] ; - $(module-name).$(name).default = $(default) ; - $(module-name).$(name).initial = $(initial) ; - $(module-name).$(name).docs = $(docs) ; - - if ! $(name) in $($(module-name).variables) - { - $(module-name).variables += $(name) ; - } -} - - -# Generates a general description of the documentation and help system. -# -local rule print-help-top ( ) -{ - print.section "General command line usage" ; - - print.text " b2 [options] [properties] [targets] - - Options, properties and targets can be specified in any order. - " ; - - print.section "Important Options" ; - - print.list-start ; - print.list-item "--clean Remove targets instead of building" ; - print.list-item "-a Rebuild everything" ; - print.list-item "-n Don't execute the commands, only print them" ; - print.list-item "-d+2 Show commands as they are executed" ; - print.list-item "-d0 Supress all informational messages" ; - print.list-item "-q Stop at first error" ; - print.list-item "--reconfigure Rerun all configuration checks" ; - print.list-item "--debug-configuration Diagnose configuration" ; - print.list-item "--debug-building Report which targets are built with what properties" ; - print.list-item "--debug-generator Diagnose generator search/execution" ; - print.list-end ; - - print.section "Further Help" - The following options can be used to obtain additional documentation. - ; - - print.list-start ; - print.list-item "--help-options Print more obscure command line options." ; - print.list-item "--help-internal Boost.Build implementation details." ; - print.list-item "--help-doc-options Implementation details doc formatting." ; - print.list-end ; -} - - -# Generate Jam/Boost.Jam command usage information. -# -local rule print-help-usage ( ) -{ - print.section "Boost.Build Usage" - "b2 [ options... ] targets..." - ; - print.list-start ; - print.list-item -a; - Build all targets, even if they are current. ; - print.list-item -fx; - Read '"x"' as the Jamfile for building instead of searching for the - Boost.Build system. ; - print.list-item -jx; - Run up to '"x"' commands concurrently. ; - print.list-item -n; - Do not execute build commands. Instead print out the commands as they - would be executed if building. ; - print.list-item -ox; - Output the used build commands to file '"x"'. ; - print.list-item -q; - Quit as soon as a build failure is encountered. Without this option - Boost.Jam will continue building as many targets as it can. ; - print.list-item -sx=y; - Sets a Jam variable '"x"' to the value '"y"', overriding any value that - variable would have from the environment. ; - print.list-item -tx; - Rebuild the target '"x"', even if it is up-to-date. ; - print.list-item -v; - Display the version of b2. ; - print.list-item --x; - Any option not explicitly handled by Boost.Build remains available to - build scripts using the '"ARGV"' variable. ; - print.list-item --abbreviate-paths; - Use abbreviated paths for targets. ; - print.list-item --hash; - Shorten target paths by using an MD5 hash. ; - print.list-item -dn; - Enables output of diagnostic messages. The debug level '"n"' and all - below it are enabled by this option. ; - print.list-item -d+n; - Enables output of diagnostic messages. Only the output for debug level - '"n"' is enabled. ; - print.list-end ; - print.section "Debug Levels" - Each debug level shows a different set of information. Usually with - higher levels producing more verbose information. The following levels - are supported: ; - print.list-start ; - print.list-item 0; - Turn off all diagnostic output. Only errors are reported. ; - print.list-item 1; - Show the actions taken for building targets, as they are executed. ; - print.list-item 2; - Show "quiet" actions and display all action text, as they are executed. ; - print.list-item 3; - Show dependency analysis, and target/source timestamps/paths. ; - print.list-item 4; - Show arguments of shell invocations. ; - print.list-item 5; - Show rule invocations and variable expansions. ; - print.list-item 6; - Show directory/header file/archive scans, and attempts at binding to targets. ; - print.list-item 7; - Show variable settings. ; - print.list-item 8; - Show variable fetches, variable expansions, and evaluation of '"if"' expressions. ; - print.list-item 9; - Show variable manipulation, scanner tokens, and memory usage. ; - print.list-item 10; - Show execution times for rules. ; - print.list-item 11; - Show parsing progress of Jamfiles. ; - print.list-item 12; - Show graph for target dependencies. ; - print.list-item 13; - Show changes in target status (fate). ; - print.list-end ; -} - - -# Generates description of options controlling the help system. This -# automatically reads the options as all variables in the doc module of the form -# ".option.*". -# -local rule print-help-options ( - module-name # The doc module. -) -{ - print.section "Help Options" - These are all the options available for enabling or disabling to control - the help system in various ways. Options can be enabled or disabled with - '"--help-enable-<option>"', and "'--help-disable-<option>'" - respectively. - ; - local options-to-list = [ MATCH ^[.]option[.](.*) : $($(module-name).variables) ] ; - if $(options-to-list) - { - print.list-start ; - for local option in [ sequence.insertion-sort $(options-to-list) ] - { - local def = disabled ; - if $($(module-name)..option.$(option).default) != "(empty)" - { - def = enabled ; - } - print.list-item $(option): $($(module-name)..option.$(option).docs) - Default is $(def). ; - } - print.list-end ; - } -} - - -# Generate brief documentation for all the known items in the section for a -# module. Possible sections are: "rules", and "variables". -# -local rule print-help-module-section ( - module # The module name. - section # rules or variables. - : section-head # The title of the section. - section-description * # The detailed description of the section. -) -{ - if $($(module).$(section)) - { - print.section $(section-head) $(section-description) ; - print.list-start ; - for local item in [ sequence.insertion-sort $($(module).$(section)) ] - { - local show = ; - if ! $($(module).$(item).is-local) - { - show = yes ; - } - if $(.option.show-locals) - { - show = yes ; - } - if $(show) - { - print.list-item $(item): $($(module).$(item).brief) ; - } - } - print.list-end ; - } -} - - -# Generate documentation for all possible modules. We attempt to list all known -# modules together with a brief description of each. -# -local rule print-help-all ( - ignored # Usually the module name, but is ignored here. -) -{ - print.section "Modules" - "These are all the known modules. Use --help <module> to get more" - "detailed information." - ; - if $(documented-modules) - { - print.list-start ; - for local module-name in [ sequence.insertion-sort $(documented-modules) ] - { - # The brief docs for each module. - print.list-item $(module-name): $($(module-name).brief) ; - } - print.list-end ; - } - # The documentation for each module when details are requested. - if $(documented-modules) && $(.option.detailed) - { - for local module-name in [ sequence.insertion-sort $(documented-modules) ] - { - # The brief docs for each module. - print-help-module $(module-name) ; - } - } -} - - -# Generate documentation for a module. Basic information about the module is -# generated. -# -local rule print-help-module ( - module-name # The module to generate docs for. -) -{ - # Print the docs. - print.section "Module '$(module-name)'" $($(module-name).docs) ; - - # Print out the documented classes. - print-help-module-section $(module-name) classes : "Module '$(module-name)' classes" - Use --help $(module-name).<class-name> to get more information. ; - - # Print out the documented rules. - print-help-module-section $(module-name) rules : "Module '$(module-name)' rules" - Use --help $(module-name).<rule-name> to get more information. ; - - # Print out the documented variables. - print-help-module-section $(module-name) variables : "Module '$(module-name)' variables" - Use --help $(module-name).<variable-name> to get more information. ; - - # Print out all the same information but indetailed form. - if $(.option.detailed) - { - print-help-classes $(module-name) ; - print-help-rules $(module-name) ; - print-help-variables $(module-name) ; - } -} - - -# Generate documentation for a set of rules in a module. -# -local rule print-help-rules ( - module-name # Module of the rules. - : name * # Optional list of rules to describe. -) -{ - name ?= $($(module-name).rules) ; - if [ set.intersection $(name) : $($(module-name).rules) $($(module-name).class-rules) ] - { - # Print out the given rules. - for local rule-name in [ sequence.insertion-sort $(name) ] - { - if $(.option.show-locals) || ! $($(module-name).$(rule-name).is-local) - { - local signature = $($(module-name).$(rule-name).signature:J=" ") ; - signature ?= "" ; - print.section "Rule '$(module-name).$(rule-name) ( $(signature) )'" - $($(module-name).$(rule-name).docs) ; - if $($(module-name).$(rule-name).args) - { - print.list-start ; - for local arg-name in $($(module-name).$(rule-name).args) - { - print.list-item $(arg-name): $($(module-name).$(rule-name).args.$(arg-name).docs) ; - } - print.list-end ; - } - } - } - } -} - - -# Generate documentation for a set of classes in a module. -# -local rule print-help-classes ( - module-name # Module of the classes. - : name * # Optional list of classes to describe. -) -{ - name ?= $($(module-name).classes) ; - if [ set.intersection $(name) : $($(module-name).classes) ] - { - # Print out the given classes. - for local class-name in [ sequence.insertion-sort $(name) ] - { - if $(.option.show-locals) || ! $($(module-name).$(class-name).is-local) - { - local signature = $($(module-name).$(class-name).signature:J=" ") ; - signature ?= "" ; - print.section "Class '$(module-name).$(class-name) ( $(signature) )'" - $($(module-name).$(class-name).docs) - "Inherits from '"$($(module-name).$(class-name).super-name)"'." ; - if $($(module-name).$(class-name).args) - { - print.list-start ; - for local arg-name in $($(module-name).$(class-name).args) - { - print.list-item $(arg-name): $($(module-name).$(class-name).args.$(arg-name).docs) ; - } - print.list-end ; - } - } - - # Print out the documented rules of the class. - print-help-module-section $(module-name) $(class-name).class-rules : "Class '$(module-name).$(class-name)' rules" - Use --help $(module-name).<rule-name> to get more information. ; - - # Print out all the rules if details are requested. - if $(.option.detailed) - { - print-help-rules $(module-name) : $($(module-name).$(class-name).class-rules) ; - } - } - } -} - - -# Generate documentation for a set of variables in a module. -# -local rule print-help-variables ( - module-name ? # Module of the variables. - : name * # Optional list of variables to describe. -) -{ - name ?= $($(module-name).variables) ; - if [ set.intersection $(name) : $($(module-name).variables) ] - { - # Print out the given variables. - for local variable-name in [ sequence.insertion-sort $(name) ] - { - print.section "Variable '$(module-name).$(variable-name)'" $($(module-name).$(variable-name).docs) ; - if $($(module-name).$(variable-name).default) || - $($(module-name).$(variable-name).initial) - { - print.list-start ; - if $($(module-name).$(variable-name).default) - { - print.list-item "default value:" '$($(module-name).$(variable-name).default:J=" ")' ; - } - if $($(module-name).$(variable-name).initial) - { - print.list-item "initial value:" '$($(module-name).$(variable-name).initial:J=" ")' ; - } - print.list-end ; - } - } - } -} - - -# Generate documentation for a project. -# -local rule print-help-project ( - unused ? - : jamfile * # The project Jamfile. -) -{ - if $(jamfile<$(jamfile)>.docs) - { - # Print the docs. - print.section "Project-specific help" - Project has jamfile at $(jamfile) ; - - print.lines $(jamfile<$(jamfile)>.docs) "" ; - } -} - - -# Generate documentation for a config file. -# -local rule print-help-config ( - unused ? - : type # The type of configuration file user or site. - config-file # The configuration Jamfile. -) -{ - if $(jamfile<$(config-file)>.docs) - { - # Print the docs. - print.section "Configuration help" - Configuration file at $(config-file) ; - - print.lines $(jamfile<$(config-file)>.docs) "" ; - } -} - - -ws = " " ; - -# Extract the text from a block of comments. -# -local rule extract-comment ( - var # The name of the variable to extract from. -) -{ - local comment = ; - local line = $($(var)[1]) ; - local l = [ MATCH "^[$(ws)]*(#)(.*)$" : $(line) ] ; - while $(l[1]) && $($(var)) - { - if $(l[2]) { comment += [ MATCH "^[$(ws)]?(.*)$" : $(l[2]) ] ; } - else { comment += "" ; } - $(var) = $($(var)[2-]) ; - line = $($(var)[1]) ; - l = [ MATCH "^[$(ws)]*(#)(.*)$" : $(line) ] ; - } - return $(comment) ; -} - - -# Extract s single line of Jam syntax, ignoring any comments. -# -local rule extract-syntax ( - var # The name of the variable to extract from. -) -{ - local syntax = ; - local line = $($(var)[1]) ; - while ! $(syntax) && ! [ MATCH "^[$(ws)]*(#)" : $(line) ] && $($(var)) - { - local m = [ MATCH "^[$(ws)]*(.*)$" : $(line) ] ; - if $(m) - { - syntax = $(m) ; - } - $(var) = $($(var)[2-]) ; - line = $($(var)[1]) ; - } - return $(syntax) ; -} - - -# Extract the next token, this is either a single Jam construct or a comment as -# a single token. -# -local rule extract-token ( - var # The name of the variable to extract from. -) -{ - local parts = ; - while ! $(parts) - { - parts = [ MATCH "^[$(ws)]*([^$(ws)]+)[$(ws)]*(.*)" : $($(var)[1]) ] ; - if ! $(parts) - { - $(var) = $($(var)[2-]) ; - } - } - local token = ; - if [ MATCH "^(#)" : $(parts[1]) ] - { - token = $(parts:J=" ") ; - $(var) = $($(var)[2-]) ; - } - else - { - token = $(parts[1]) ; - $(var) = $(parts[2-]:J=" ") $($(var)[2-]) ; - } - return $(token) ; -} - - -# Scan for a rule declaration as the next item in the variable. -# -local rule scan-rule ( - syntax ? # The first part of the text which contains the rule declaration. - : var # The name of the variable to extract from. -) -{ - local rule-parts = - [ MATCH "^[$(ws)]*(rule|local[$(ws)]*rule)[$(ws)]+([^$(ws)]+)[$(ws)]*(.*)" : $(syntax:J=" ") ] ; - if $(rule-parts[1]) - { - # Mark as doc for rule. - local rule-name = $(rule-parts[2]) ; - if $(scope-name) - { - rule-name = $(scope-name).$(rule-name) ; - } - local is-local = [ MATCH "^(local).*" : $(rule-parts[1]) ] ; - if $(comment-block) - { - set-rule-doc $(rule-name) $(module-name) $(is-local) : $(comment-block) ; - } - # Parse args of rule. - $(var) = $(rule-parts[3-]) $($(var)) ; - set-rule-arguments-signature $(rule-name) $(module-name) : [ scan-rule-arguments $(var) ] ; - # Scan within this rules scope. - local scope-level = [ extract-token $(var) ] ; - local scope-name = $(rule-name) ; - while $(scope-level) - { - local comment-block = [ extract-comment $(var) ] ; - local syntax-block = [ extract-syntax $(var) ] ; - if [ scan-rule $(syntax-block) : $(var) ] - { - } - else if [ MATCH "^(\\{)" : $(syntax-block) ] - { - scope-level += "{" ; - } - else if [ MATCH "^[^\\}]*([\\}])[$(ws)]*$" : $(syntax-block) ] - { - scope-level = $(scope-level[2-]) ; - } - } - - return true ; - } -} - - -# Scan the arguments of a rule. -# -local rule scan-rule-arguments ( - var # The name of the variable to extract from. -) -{ - local arg-syntax = ; - local token = [ extract-token $(var) ] ; - while $(token) != "(" && $(token) != "{" - { - token = [ extract-token $(var) ] ; - } - if $(token) != "{" - { - token = [ extract-token $(var) ] ; - } - local arg-signature = ; - while $(token) != ")" && $(token) != "{" - { - local arg-name = ; - local arg-qualifier = " " ; - local arg-doc = ; - if $(token) = ":" - { - arg-signature += $(token) ; - token = [ extract-token $(var) ] ; - } - arg-name = $(token) ; - arg-signature += $(token) ; - token = [ extract-token $(var) ] ; - if [ MATCH "^([\\*\\+\\?])" : $(token) ] - { - arg-qualifier = $(token) ; - arg-signature += $(token) ; - token = [ extract-token $(var) ] ; - } - if $(token) = ":" - { - arg-signature += $(token) ; - token = [ extract-token $(var) ] ; - } - if [ MATCH "^(#)" : $(token) ] - { - $(var) = $(token) $($(var)) ; - arg-doc = [ extract-comment $(var) ] ; - token = [ extract-token $(var) ] ; - } - set-argument-doc $(arg-name) $(arg-qualifier) $(rule-name) $(module-name) : $(arg-doc) ; - } - while $(token) != "{" - { - token = [ extract-token $(var) ] ; - } - $(var) = "{" $($(var)) ; - arg-signature ?= "" ; - return $(arg-signature) ; -} - - -# Scan for a variable declaration. -# -local rule scan-variable ( - syntax ? # The first part of the text which contains the variable declaration. - : var # The name of the variable to extract from. -) -{ - # [1] = name, [2] = value(s) - local var-parts = - [ MATCH "^[$(ws)]*([^$(ws)]+)[$(ws)]+([\\?\\=]*)[$(ws)]+([^\\;]*)\\;" : $(syntax) ] ; - if $(var-parts) - { - local value = [ MATCH "^(.*)[ ]$" : $(var-parts[3-]:J=" ") ] ; - local default-value = "" ; - local initial-valie = "" ; - if $(var-parts[2]) = "?=" - { - default-value = $(value) ; - default-value ?= "(empty)" ; - } - else - { - initial-value = $(value) ; - initial-value ?= "(empty)" ; - } - if $(comment-block) - { - set-variable-doc $(var-parts[1]) $(default-value) $(initial-value) $(module-name) : $(comment-block) ; - } - return true ; - } -} - - -# Scan a class declaration. -# -local rule scan-class ( - syntax ? # The syntax text for the class declaration. -) -{ - # [1] = class?, [2] = name, [3] = superclass - local class-parts = - [ MATCH "^[$(ws)]*([^$(ws)]+)[$(ws)]+([^$(ws)]+)[$(ws)]+:*[$(ws)]*([^$(ws);]*)" : $(syntax) ] ; - if $(class-parts[1]) = "class" || $(class-parts[1]) = "class.class" - { - set-class-doc $(class-parts[2]) $(module-name) : $(class-parts[3]) ; - } -} - - -# Scan a module file for documentation comments. This also invokes any actions -# assigned to the module. The actions are the rules that do the actual output of -# the documentation. This rule is invoked as the header scan rule for the module -# file. -# -rule scan-module ( - target # The module file. - : text * # The text in the file, one item per line. - : action * # Rule to call to output docs for the module. -) -{ - if $(.option.debug) { ECHO "HELP:" scanning module target '$(target)' ; } - local module-name = $(target:B) ; - local module-documented = ; - local comment-block = ; - local syntax-block = ; - # This is a hack because we can not get the line of a file if it happens to - # not have a new-line termination. - text += "}" ; - while $(text) - { - comment-block = [ extract-comment text ] ; - syntax-block = [ extract-syntax text ] ; - if $(.option.debug) - { - ECHO "HELP:" comment block; '$(comment-block)' ; - ECHO "HELP:" syntax block; '$(syntax-block)' ; - } - if [ scan-rule $(syntax-block) : text ] { } - else if [ scan-variable $(syntax-block) : text ] { } - else if [ scan-class $(syntax-block) ] { } - else if [ MATCH .*([cC]opyright).* : $(comment-block:J=" ") ] - { - # mark as the copy for the module. - set-module-copyright $(module-name) : $(comment-block) ; - } - else if $(action[1]) in "print-help-project" "print-help-config" - && ! $(jamfile<$(target)>.docs) - { - # special module docs for the project jamfile. - jamfile<$(target)>.docs = $(comment-block) ; - } - else if ! $(module-documented) - { - # document the module. - set-module-doc $(module-name) : $(comment-block) ; - module-documented = true ; - } - } - if $(action) - { - $(action[1]) $(module-name) : $(action[2-]) ; - } -} - - -# Import scan-module to global scope, so that it is available during header -# scanning phase. -# -IMPORT $(__name__) : scan-module : : doc.scan-module ; - - -# Read in a file using the SHELL builtin and return the individual lines as -# would be done for header scanning. -# -local rule read-file ( - file # The file to read in. -) -{ - file = [ path.native [ path.root [ path.make $(file) ] [ path.pwd ] ] ] ; - if ! $(.file<$(file)>.lines) - { - local content ; - switch [ modules.peek : OS ] - { - case NT : - content = [ SHELL "TYPE \"$(file)\"" ] ; - - case * : - content = [ SHELL "cat \"$(file)\"" ] ; - } - local lines ; - local nl = " -" ; - local << = "([^$(nl)]*)[$(nl)](.*)" ; - local line+ = [ MATCH "$(<<)" : "$(content)" ] ; - while $(line+) - { - lines += $(line+[1]) ; - line+ = [ MATCH "$(<<)" : "$(line+[2])" ] ; - } - .file<$(file)>.lines = $(lines) ; - } - return $(.file<$(file)>.lines) ; -} - - -# Add a scan action to perform to generate the help documentation. The action -# rule is passed the name of the module as the first argument. The second -# argument(s) are optional and passed directly as specified here. -# -local rule do-scan ( - modules + # The modules to scan and perform the action on. - : action * # The action rule, plus the secondary arguments to pass to the action rule. -) -{ - if $(help-output) = text - { - print.output $(help-output-file).txt plain ; - ALWAYS $(help-output-file).txt ; - DEPENDS all : $(help-output-file).txt ; - } - if $(help-output) = html - { - print.output $(help-output-file).html html ; - ALWAYS $(help-output-file).html ; - DEPENDS all : $(help-output-file).html ; - } - for local module-file in $(modules[1--2]) - { - scan-module $(module-file) : [ read-file $(module-file) ] ; - } - scan-module $(modules[-1]) : [ read-file $(modules[-1]) ] : $(action) ; -}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/indirect.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/util/indirect.jam b/ext/kenlm/jam-files/boost-build/util/indirect.jam deleted file mode 100644 index 40884da..0000000 --- a/ext/kenlm/jam-files/boost-build/util/indirect.jam +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2003 Dave Abrahams -# Copyright 2003 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import modules ; -import numbers ; - - -# The pattern that indirect rules must match: module%rule -.pattern = ^([^%]*)%([^%]+)$ ; - - -# -# Type checking rules. -# -local rule indirect-rule ( x ) -{ - if ! [ MATCH $(.pattern) : $(x) ] - { - return "expected a string of the form module%rule, but got \""$(x)"\" for argument" ; - } -} - - -# Make an indirect rule which calls the given rule. If context is supplied it is -# expected to be the module in which to invoke the rule by the 'call' rule -# below. Otherwise, the rule will be invoked in the module of this rule's -# caller. -# -rule make ( rulename bound-args * : context ? ) -{ - context ?= [ CALLER_MODULE ] ; - context ?= "" ; - return $(context)%$(rulename) $(bound-args) ; -} - - -# Make an indirect rule which calls the given rule. 'rulename' may be a -# qualified rule; if so it is returned unchanged. Otherwise, if frames is not -# supplied, the result will be invoked (by 'call', below) in the module of the -# caller. Otherwise, frames > 1 specifies additional call frames to back up in -# order to find the module context. -# -rule make-qualified ( rulename bound-args * : frames ? ) -{ - if [ MATCH $(.pattern) : $(rulename) ] - { - return $(rulename) $(bound-args) ; - } - else - { - frames ?= 1 ; - # If the rule name includes a Jamfile module, grab it. - local module-context = [ MATCH ^(Jamfile<[^>]*>)\\..* : $(rulename) ] ; - - if ! $(module-context) - { - # Take the first dot-separated element as module name. This disallows - # module names with dots, but allows rule names with dots. - module-context = [ MATCH ^([^.]*)\\..* : $(rulename) ] ; - } - module-context ?= [ CALLER_MODULE $(frames) ] ; - return [ make $(rulename) $(bound-args) : $(module-context) ] ; - } -} - - -# Returns the module name in which the given indirect rule will be invoked. -# -rule get-module ( [indirect-rule] x ) -{ - local m = [ MATCH $(.pattern) : $(x) ] ; - if ! $(m[1]) - { - m = ; - } - return $(m[1]) ; -} - - -# Returns the rulename that will be called when x is invoked. -# -rule get-rule ( [indirect-rule] x ) -{ - local m = [ MATCH $(.pattern) : $(x) ] ; - return $(m[2]) ; -} - - -# Invoke the given indirect-rule. -# -rule call ( [indirect-rule] r args * : * ) -{ - return [ modules.call-in [ get-module $(r) ] : [ get-rule $(r) ] $(args) : - $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) : $(10) : $(11) : - $(12) : $(13) : $(14) : $(15) : $(16) : $(17) : $(18) : $(19) ] ; -} - - -rule __test__ -{ - import assert ; - - rule foo-barr! ( x ) - { - assert.equal $(x) : x ; - } - - assert.equal [ get-rule [ make foo-barr! ] ] : foo-barr! ; - assert.equal [ get-module [ make foo-barr! ] ] : [ CALLER_MODULE ] ; - - call [ make foo-barr! ] x ; - call [ make foo-barr! x ] ; - call [ make foo-barr! : [ CALLER_MODULE ] ] x ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/numbers.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/util/numbers.jam b/ext/kenlm/jam-files/boost-build/util/numbers.jam deleted file mode 100644 index 665347d..0000000 --- a/ext/kenlm/jam-files/boost-build/util/numbers.jam +++ /dev/null @@ -1,218 +0,0 @@ -# Copyright 2001, 2002 Dave Abrahams -# Copyright 2002, 2003 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - -import errors ; - - -rule trim-leading-zeroes ( value ) -{ - return [ CALC $(value) + 0 ] ; -} - - -rule check ( numbers * ) -{ - for local n in $(numbers) - { - switch $(n) - { - case *[^0-9]* : - errors.error $(n) "in" $(numbers) : is not a number ; - } - } -} - - -rule increment ( number ) -{ - return [ CALC $(number) + 1 ] ; -} - - -rule decrement ( number ) -{ - return [ CALC $(number) - 1 ] ; -} - - -rule range ( start finish ? : step ? ) -{ - if ! $(finish) - { - finish = $(start) ; - start = 1 ; - } - step ?= 1 ; - - check $(start) $(finish) $(step) ; - - if $(finish) != 0 - { - local result ; - while [ less $(start) $(finish) ] || $(start) = $(finish) - { - result += $(start) ; - start = [ CALC $(start) + $(step) ] ; - } - return $(result) ; - } -} - - -rule less ( n1 n2 ) -{ - switch [ CALC $(n2) - $(n1) ] - { - case [1-9]* : return true ; - } -} - - -rule log10 ( number ) -{ - switch $(number) - { - case *[^0-9]* : errors.error $(number) is not a number ; - case 0 : errors.error can't take log of zero ; - case [1-9] : return 0 ; - case [1-9]? : return 1 ; - case [1-9]?? : return 2 ; - case [1-9]??? : return 3 ; - case [1-9]???? : return 4 ; - case [1-9]????? : return 5 ; - case [1-9]?????? : return 6 ; - case [1-9]??????? : return 7 ; - case [1-9]???????? : return 8 ; - case [1-9]????????? : return 9 ; - case * : - { - import sequence ; - import string ; - local chars = [ string.chars $(number) ] ; - while $(chars[1]) = 0 - { - chars = $(chars[2-]) ; - } - if ! $(chars) - { - errors.error can't take log of zero ; - } - else - { - return [ decrement [ sequence.length $(chars) ] ] ; - } - } - } -} - - -rule __test__ ( ) -{ - import assert ; - - assert.result 1 : increment 0 ; - assert.result 2 : increment 1 ; - assert.result 1 : decrement 2 ; - assert.result 0 : decrement 1 ; - assert.result 50 : increment 49 ; - assert.result 49 : decrement 50 ; - assert.result 99 : increment 98 ; - assert.result 99 : decrement 100 ; - assert.result 100 : increment 99 ; - assert.result 999 : decrement 1000 ; - assert.result 1000 : increment 999 ; - - assert.result 1 2 3 : range 3 ; - assert.result 1 2 3 4 5 6 7 8 9 10 11 12 : range 12 ; - assert.result 3 4 5 6 7 8 9 10 11 : range 3 11 ; - assert.result : range 0 ; - assert.result 1 4 7 10 : range 10 : 3 ; - assert.result 2 4 6 8 10 : range 2 10 : 2 ; - assert.result 25 50 75 100 : range 25 100 : 25 ; - - assert.result 0 : trim-leading-zeroes 0 ; - assert.result 1234 : trim-leading-zeroes 1234 ; - assert.result 123456 : trim-leading-zeroes 0000123456 ; - assert.result 1000123456 : trim-leading-zeroes 1000123456 ; - assert.result 10000 : trim-leading-zeroes 10000 ; - assert.result 10000 : trim-leading-zeroes 00010000 ; - - assert.true less 1 2 ; - assert.true less 1 12 ; - assert.true less 1 21 ; - assert.true less 005 217 ; - assert.false less 0 0 ; - assert.false less 03 3 ; - assert.false less 3 03 ; - assert.true less 005 217 ; - assert.true less 0005 217 ; - assert.true less 5 00217 ; - - # TEMPORARY disabled, because nested "try"/"catch" do not work and I do no - # have the time to fix that right now. - if $(0) - { - try ; - { - decrement 0 ; - } - catch can't decrement zero! ; - - try ; - { - check foo ; - } - catch : not a number ; - - try ; - { - increment foo ; - } - catch : not a number ; - - try ; - { - log10 0 ; - } - catch can't take log of zero ; - - try ; - { - log10 000 ; - } - catch can't take log of zero ; - - } - - assert.result 0 : log10 1 ; - assert.result 0 : log10 9 ; - assert.result 1 : log10 10 ; - assert.result 1 : log10 99 ; - assert.result 2 : log10 100 ; - assert.result 2 : log10 101 ; - assert.result 2 : log10 125 ; - assert.result 2 : log10 999 ; - assert.result 3 : log10 1000 ; - assert.result 10 : log10 12345678901 ; - - for local x in [ range 75 110 : 5 ] - { - for local y in [ range $(x) 111 : 3 ] - { - if $(x) != $(y) - { - assert.true less $(x) $(y) ; - } - } - } - - for local x in [ range 90 110 : 2 ] - { - for local y in [ range 80 $(x) : 4 ] - { - assert.false less $(x) $(y) ; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/option.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/util/option.jam b/ext/kenlm/jam-files/boost-build/util/option.jam deleted file mode 100644 index f6dc375..0000000 --- a/ext/kenlm/jam-files/boost-build/util/option.jam +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) 2005 Vladimir Prus. -# -# Use, modification and distribution is subject to the Boost Software -# License Version 1.0. (See accompanying file LICENSE_1_0.txt or -# http://www.boost.org/LICENSE_1_0.txt) - -import modules ; - -# Set a value for a named option, to be used when not overridden on the command -# line. -rule set ( name : value ? ) -{ - .option.$(name) = $(value) ; -} - -rule get ( name : default-value ? : implied-value ? ) -{ - local m = [ MATCH --$(name)=(.*) : [ modules.peek : ARGV ] ] ; - if $(m) - { - return $(m[1]) ; - } - else - { - m = [ MATCH (--$(name)) : [ modules.peek : ARGV ] ] ; - if $(m) && $(implied-value) - { - return $(implied-value) ; - } - else if $(.option.$(name)) - { - return $(.option.$(name)) ; - } - else - { - return $(default-value) ; - } - } -} - - -# Check command-line args as soon as possible. For each option try to load -# module named after option. Is that succeeds, invoke 'process' rule in the -# module. The rule may return "true" to indicate that the regular build process -# should not be attempted. -# -# Options take the general form of: --<name>[=<value>] [<value>] -# -rule process ( ) -{ - local ARGV = [ modules.peek : ARGV ] ; - local BOOST_BUILD_PATH = [ modules.peek : BOOST_BUILD_PATH ] ; - - local dont-build ; - local args = $(ARGV) ; - while $(args) - { - local arg = [ MATCH ^--(.*) : $(args[1]) ] ; - while $(args[2-]) && ! $(arg) - { - args = $(args[2-]) ; - arg = [ MATCH ^--(.*) : $(args[1]) ] ; - } - args = $(args[2-]) ; - - if $(arg) - { - local split = [ MATCH ^(([^-=]+)[^=]*)(=?)(.*)$ : $(arg) ] ; - local full-name = $(split[1]) ; - local prefix = $(split[2]) ; - local values ; - - if $(split[3]) - { - values = $(split[4]) ; - } - if $(args) && ! [ MATCH ^(--).* : $(args[1]) ] - { - values += $(args[1]) ; - args = $(args[2-]) ; - } - - # Jook in options subdirectories of BOOST_BUILD_PATH for modules - # matching the full option name and then its prefix. - local plugin-dir = options ; - local option-files = [ GLOB $(plugin-dir:D=$(BOOST_BUILD_PATH)) : - $(full-name).jam $(prefix).jam ] ; - - if $(option-files) - { - # Load the file into a module named for the option. - local f = $(option-files[1]) ; - local module-name = --$(f:D=:S=) ; - modules.load $(module-name) : $(f:D=) : $(f:D) ; - - # If there is a process rule, call it with the full option name - # and its value (if any). If there was no "=" in the option, the - # value will be empty. - if process in [ RULENAMES $(module-name) ] - { - dont-build += [ modules.call-in $(module-name) : process - --$(full-name) : $(values) ] ; - } - } - } - } - - return $(dont-build) ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/order.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/util/order.jam b/ext/kenlm/jam-files/boost-build/util/order.jam deleted file mode 100644 index a74fc8c..0000000 --- a/ext/kenlm/jam-files/boost-build/util/order.jam +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (C) 2003 Vladimir Prus -# Use, modification, and distribution is subject to the Boost Software -# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy -# at http://www.boost.org/LICENSE_1_0.txt) - -# This module defines a class which allows to order arbitrary object with -# regard to arbitrary binary relation. -# -# The primary use case is the gcc toolset, which is sensitive to library order: -# if library 'a' uses symbols from library 'b', then 'a' must be present before -# 'b' on the linker's command line. -# -# This requirement can be lifted for gcc with GNU ld, but for gcc with Solaris -# LD (and for Solaris toolset as well), the order always matters. -# -# So, we need to store order requirements and then order libraries according to -# them. It is not possible to use the dependency graph as order requirements. -# What we need is a "use symbols" relationship while dependency graph provides -# the "needs to be updated" relationship. -# -# For example:: -# lib a : a.cpp b; -# lib b ; -# -# For static linking, library 'a' need not depend on 'b'. However, it should -# still come before 'b' on the command line. - -class order -{ - rule __init__ ( ) - { - } - - # Adds the constraint that 'first' should preceede 'second'. - rule add-pair ( first second ) - { - .constraits += $(first)--$(second) ; - } - NATIVE_RULE class@order : add-pair ; - - # Given a list of objects, reorder them so that the constraints specified by - # 'add-pair' are satisfied. - # - # The algorithm was adopted from an awk script by Nikita Youshchenko - # (yoush at cs dot msu dot su) - rule order ( objects * ) - { - # The algorithm used is the same is standard transitive closure, except - # that we're not keeping in-degree for all vertices, but rather removing - # edges. - local result ; - if $(objects) - { - local constraints = [ eliminate-unused-constraits $(objects) ] ; - - # Find some library that nobody depends upon and add it to the - # 'result' array. - local obj ; - while $(objects) - { - local new_objects ; - while $(objects) - { - obj = $(objects[1]) ; - if [ has-no-dependents $(obj) : $(constraints) ] - { - # Emulate break ; - new_objects += $(objects[2-]) ; - objects = ; - } - else - { - new_objects += $(obj) ; - obj = ; - objects = $(objects[2-]) ; - } - } - - if ! $(obj) - { - errors.error "Circular order dependencies" ; - } - # No problem with placing first. - result += $(obj) ; - # Remove all contraints where 'obj' comes first, since they are - # already satisfied. - constraints = [ remove-satisfied $(constraints) : $(obj) ] ; - - # Add the remaining objects for further processing on the next - # iteration - objects = $(new_objects) ; - } - - } - return $(result) ; - } - NATIVE_RULE class@order : order ; - - # Eliminate constraints which mention objects not in 'objects'. In - # graph-theory terms, this is finding a subgraph induced by ordered - # vertices. - rule eliminate-unused-constraits ( objects * ) - { - local result ; - for local c in $(.constraints) - { - local m = [ MATCH (.*)--(.*) : $(c) ] ; - if $(m[1]) in $(objects) && $(m[2]) in $(objects) - { - result += $(c) ; - } - } - return $(result) ; - } - - # Returns true if there's no constraint in 'constaraints' where 'obj' comes - # second. - rule has-no-dependents ( obj : constraints * ) - { - local failed ; - while $(constraints) && ! $(failed) - { - local c = $(constraints[1]) ; - local m = [ MATCH (.*)--(.*) : $(c) ] ; - if $(m[2]) = $(obj) - { - failed = true ; - } - constraints = $(constraints[2-]) ; - } - if ! $(failed) - { - return true ; - } - } - - rule remove-satisfied ( constraints * : obj ) - { - local result ; - for local c in $(constraints) - { - local m = [ MATCH (.*)--(.*) : $(c) ] ; - if $(m[1]) != $(obj) - { - result += $(c) ; - } - } - return $(result) ; - } -} - - -rule __test__ ( ) -{ - import "class" : new ; - import assert ; - - c1 = [ new order ] ; - $(c1).add-pair l1 l2 ; - - assert.result l1 l2 : $(c1).order l1 l2 ; - assert.result l1 l2 : $(c1).order l2 l1 ; - - $(c1).add-pair l2 l3 ; - assert.result l1 l2 : $(c1).order l2 l1 ; - $(c1).add-pair x l2 ; - assert.result l1 l2 : $(c1).order l2 l1 ; - assert.result l1 l2 l3 : $(c1).order l2 l3 l1 ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/os.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/util/os.jam b/ext/kenlm/jam-files/boost-build/util/os.jam deleted file mode 100644 index daef27f..0000000 --- a/ext/kenlm/jam-files/boost-build/util/os.jam +++ /dev/null @@ -1,171 +0,0 @@ -# Copyright 2001, 2002, 2003, 2005 Dave Abrahams -# Copyright 2006 Rene Rivera -# Copyright 2003, 2005 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - -import modules ; -import string ; - - -# Return the value(s) of the given environment variable(s) at the time bjam was -# invoked. -rule environ ( variable-names + ) -{ - return [ modules.peek .ENVIRON : $(variable-names) ] ; -} - -.name = [ modules.peek : OS ] ; -.platform = [ modules.peek : OSPLAT ] ; -.version = [ modules.peek : OSVER ] ; - - -local rule constant ( c : os ? ) -{ - os ?= $(.name) ; - # First look for a platform-specific name, then the general value. - local variables = .$(c)-$(os) .$(c) ; - local result = $($(variables)) ; - return $(result[1]) ; -} - -rule get-constant ( os ? ) -{ - # Find the name of the constant being accessed, which is equal to the name - # used to invoke us. - local bt = [ BACKTRACE 1 ] ; - local rulename = [ MATCH ([^.]*)$ : $(bt[4]) ] ; - return [ constant $(rulename) : $(os) ] ; -} - - -# export all the common constants -.constants = name platform version shared-library-path-variable path-separator executable-path-variable executable-suffix ; -for local constant in $(.constants) -{ - IMPORT $(__name__) : get-constant : $(__name__) : $(constant) ; -} -EXPORT $(__name__) : $(.constants) ; - -.executable-path-variable-NT = PATH ; -# On Windows the case and capitalization of PATH is not always predictable, so -# let's find out what variable name was really set. -if $(.name) = NT -{ - for local n in [ VARNAMES .ENVIRON ] - { - if $(n:L) = path - { - .executable-path-variable-NT = $(n) ; - } - } -} - -# Specific constants for various platforms. There's no need to define any -# constant whose value would be the same as the default, below. -.shared-library-path-variable-NT = $(.executable-path-variable-NT) ; -.path-separator-NT = ";" ; -.expand-variable-prefix-NT = % ; -.expand-variable-suffix-NT = % ; -.executable-suffix-NT = .exe ; - -.shared-library-path-variable-CYGWIN = PATH ; - -.shared-library-path-variable-MACOSX = DYLD_LIBRARY_PATH ; - -.shared-library-path-variable-AIX = LIBPATH ; - -# Default constants -.shared-library-path-variable = LD_LIBRARY_PATH ; -.path-separator = ":" ; -.expand-variable-prefix = $ ; -.expand-variable-suffix = "" ; -.executable-path-variable = PATH ; -.executable-suffix = "" ; - - -# Return a list of the directories in the PATH. Yes, that information is (sort -# of) available in the global module, but jam code can change those values, and -# it isn't always clear what case/capitalization to use when looking. This rule -# is a more reliable way to get there. -rule executable-path ( ) -{ - return [ string.words [ environ [ constant executable-path-variable ] ] - : [ constant path-separator ] ] ; -} - - -# Initialize the list of home directories for the current user depending on the -# OS. -if $(.name) = NT -{ - local home = [ environ HOMEDRIVE HOMEPATH ] ; - .home-directories = $(home[1])$(home[2]) [ environ HOME ] [ environ USERPROFILE ] ; -} -else -{ - .home-directories = [ environ HOME ] ; -} - - -# Can't use 'constant' mechanism because it only returns 1-element values. -rule home-directories ( ) -{ - return $(.home-directories) ; -} - - -# Return the string needed to represent the expansion of the named shell -# variable. -rule expand-variable ( variable ) -{ - local prefix = [ constant expand-variable-prefix ] ; - local suffix = [ constant expand-variable-suffix ] ; - return $(prefix)$(variable)$(suffix) ; -} - - -# Returns true if running on windows, whether in cygwin or not. -rule on-windows ( ) -{ - local result ; - if [ modules.peek : NT ] - { - result = true ; - } - else if [ modules.peek : UNIX ] - { - switch [ modules.peek : JAMUNAME ] - { - case CYGWIN* : - { - result = true ; - } - } - } - return $(result) ; -} - - -if ! [ on-windows ] -{ - .on-unix = 1 ; -} - - -rule on-unix -{ - return $(.on-unix) ; -} - - -rule __test__ -{ - import assert ; - if ! ( --quiet in [ modules.peek : ARGV ] ) - { - ECHO os: name= [ name ] ; - ECHO os: version= [ version ] ; - } - assert.true name ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/path.jam ---------------------------------------------------------------------- diff --git a/ext/kenlm b/ext/kenlm new file mode 160000 index 0000000..56fdb5c --- /dev/null +++ b/ext/kenlm @@ -0,0 +1 @@ +Subproject commit 56fdb5c44fca34d5a2e07d96139c28fb163983c5 diff --git a/ext/kenlm/jam-files/boost-build/util/path.jam b/ext/kenlm/jam-files/boost-build/util/path.jam deleted file mode 100644 index 545d83c..0000000 --- a/ext/kenlm/jam-files/boost-build/util/path.jam +++ /dev/null @@ -1,910 +0,0 @@ -# Copyright 2002-2006. Vladimir Prus -# Copyright 2003-2004. Dave Abrahams -# Copyright 2003-2006. Rene Rivera -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -# Performs various path manipulations. Paths are always in a 'normalized' -# representation. In it, a path may be either: -# -# - '.', or -# -# - ['/'] [ ( '..' '/' )* (token '/')* token ] -# -# In plain english, path can be rooted, '..' elements are allowed only at the -# beginning, and it never ends in slash, except for path consisting of slash -# only. - -import modules ; -import regex ; -import sequence ; -import set ; - - -os = [ modules.peek : OS ] ; -if [ modules.peek : UNIX ] -{ - local uname = [ modules.peek : JAMUNAME ] ; - switch $(uname) - { - case CYGWIN* : os = CYGWIN ; - case * : os = UNIX ; - } -} - - -# Converts the native path into normalized form. -# -rule make ( native ) -{ - return [ make-$(os) $(native) ] ; -} - - -# Builds native representation of the path. -# -rule native ( path ) -{ - return [ native-$(os) $(path) ] ; -} - - -# Tests if a path is rooted. -# -rule is-rooted ( path ) -{ - return [ MATCH "^(/)" : $(path) ] ; -} - - -# Tests if a path has a parent. -# -rule has-parent ( path ) -{ - if $(path) != / - { - return 1 ; - } - else - { - return ; - } -} - - -# Returns the path without any directory components. -# -rule basename ( path ) -{ - return [ MATCH "([^/]+)$" : $(path) ] ; -} - - -# Returns parent directory of the path. If no parent exists, error is issued. -# -rule parent ( path ) -{ - if [ has-parent $(path) ] - { - if $(path) = . - { - return .. ; - } - else - { - # Strip everything at the end of path up to and including the last - # slash. - local result = [ regex.match "((.*)/)?([^/]+)" : $(path) : 2 3 ] ; - - # Did we strip what we shouldn't? - if $(result[2]) = ".." - { - return $(path)/.. ; - } - else - { - if ! $(result[1]) - { - if [ is-rooted $(path) ] - { - result = / ; - } - else - { - result = . ; - } - } - return $(result[1]) ; - } - } - } - else - { - import errors ; - errors.error "Path '$(path)' has no parent" ; - } -} - - -# Returns path2 such that "[ join path path2 ] = .". The path may not contain -# ".." element or be rooted. -# -rule reverse ( path ) -{ - if $(path) = . - { - return $(path) ; - } - else - { - local tokens = [ regex.split $(path) / ] ; - local tokens2 ; - for local i in $(tokens) - { - tokens2 += .. ; - } - return [ sequence.join $(tokens2) : / ] ; - } -} - - -# Concatenates the passed path elements. Generates an error if any element other -# than the first one is rooted. Skips any empty or undefined path elements. -# -rule join ( elements + ) -{ - if ! $(elements[2-]) - { - return $(elements[1]) ; - } - else - { - for local e in $(elements[2-]) - { - if [ is-rooted $(e) ] - { - import errors ; - errors.error only the first element may be rooted ; - } - } - return [ NORMALIZE_PATH "$(elements)" ] ; - } -} - - -# If 'path' is relative, it is rooted at 'root'. Otherwise, it is unchanged. -# -rule root ( path root ) -{ - if [ is-rooted $(path) ] - { - return $(path) ; - } - else - { - return [ join $(root) $(path) ] ; - } -} - - -# Returns the current working directory. -# -rule pwd ( ) -{ - if ! $(.pwd) - { - .pwd = [ make [ PWD ] ] ; - } - return $(.pwd) ; -} - - -# Returns the list of files matching the given pattern in the specified -# directory. Both directories and patterns are supplied as portable paths. Each -# pattern should be non-absolute path, and can't contain "." or ".." elements. -# Each slash separated element of pattern can contain the following special -# characters: -# - '?', which match any character -# - '*', which matches arbitrary number of characters. -# A file $(d)/e1/e2/e3 (where 'd' is in $(dirs)) matches pattern p1/p2/p3 if and -# only if e1 matches p1, e2 matches p2 and so on. -# -# For example: -# [ glob . : *.cpp ] -# [ glob . : */build/Jamfile ] -# -rule glob ( dirs * : patterns + : exclude-patterns * ) -{ - local result ; - local real-patterns ; - local real-exclude-patterns ; - for local d in $(dirs) - { - for local p in $(patterns) - { - local pattern = [ path.root $(p) $(d) ] ; - real-patterns += [ path.native $(pattern) ] ; - } - - for local p in $(exclude-patterns) - { - local pattern = [ path.root $(p) $(d) ] ; - real-exclude-patterns += [ path.native $(pattern) ] ; - } - } - - local inc = [ GLOB-RECURSIVELY $(real-patterns) ] ; - inc = [ sequence.transform NORMALIZE_PATH : $(inc) ] ; - local exc = [ GLOB-RECURSIVELY $(real-exclude-patterns) ] ; - exc = [ sequence.transform NORMALIZE_PATH : $(exc) ] ; - - return [ sequence.transform path.make : [ set.difference $(inc) : $(exc) ] ] - ; -} - - -# Recursive version of GLOB. Builds the glob of files while also searching in -# the subdirectories of the given roots. An optional set of exclusion patterns -# will filter out the matching entries from the result. The exclusions also -# apply to the subdirectory scanning, such that directories that match the -# exclusion patterns will not be searched. -# -rule glob-tree ( roots * : patterns + : exclude-patterns * ) -{ - return [ sequence.transform path.make : [ .glob-tree [ sequence.transform - path.native : $(roots) ] : $(patterns) : $(exclude-patterns) ] ] ; -} - - -local rule .glob-tree ( roots * : patterns * : exclude-patterns * ) -{ - local excluded ; - if $(exclude-patterns) - { - excluded = [ GLOB $(roots) : $(exclude-patterns) ] ; - } - local result = [ set.difference [ GLOB $(roots) : $(patterns) ] : - $(excluded) ] ; - local subdirs ; - for local d in [ set.difference [ GLOB $(roots) : * ] : $(excluded) ] - { - if ! ( $(d:D=) in . .. ) && ! [ CHECK_IF_FILE $(d) ] - { - subdirs += $(d) ; - } - } - if $(subdirs) - { - result += [ .glob-tree $(subdirs) : $(patterns) : $(exclude-patterns) ] - ; - } - return $(result) ; -} - - -# Returns true is the specified file exists. -# -rule exists ( file ) -{ - return [ path.glob $(file:D) : $(file:D=) ] ; -} -NATIVE_RULE path : exists ; - - -# Find out the absolute name of path and returns the list of all the parents, -# starting with the immediate one. Parents are returned as relative names. If -# 'upper_limit' is specified, directories above it will be pruned. -# -rule all-parents ( path : upper_limit ? : cwd ? ) -{ - cwd ?= [ pwd ] ; - local path_ele = [ regex.split [ root $(path) $(cwd) ] / ] ; - - if ! $(upper_limit) - { - upper_limit = / ; - } - local upper_ele = [ regex.split [ root $(upper_limit) $(cwd) ] / ] ; - - # Leave only elements in 'path_ele' below 'upper_ele'. - while $(path_ele) && ( $(upper_ele[1]) = $(path_ele[1]) ) - { - upper_ele = $(upper_ele[2-]) ; - path_ele = $(path_ele[2-]) ; - } - - # Have all upper elements been removed ? - if $(upper_ele) - { - import errors ; - errors.error "$(upper_limit) is not prefix of $(path)" ; - } - - # Create the relative paths to parents, number of elements in 'path_ele'. - local result ; - for local i in $(path_ele) - { - path = [ parent $(path) ] ; - result += $(path) ; - } - return $(result) ; -} - - -# Search for 'pattern' in parent directories of 'dir', up to and including -# 'upper_limit', if it is specified, or up to the filesystem root otherwise. -# -rule glob-in-parents ( dir : patterns + : upper-limit ? ) -{ - local result ; - local parent-dirs = [ all-parents $(dir) : $(upper-limit) ] ; - - while $(parent-dirs) && ! $(result) - { - result = [ glob $(parent-dirs[1]) : $(patterns) ] ; - parent-dirs = $(parent-dirs[2-]) ; - } - return $(result) ; -} - - -# Assuming 'child' is a subdirectory of 'parent', return the relative path from -# 'parent' to 'child'. -# -rule relative ( child parent : no-error ? ) -{ - local not-a-child ; - if $(parent) = "." - { - return $(child) ; - } - else - { - local split1 = [ regex.split $(parent) / ] ; - local split2 = [ regex.split $(child) / ] ; - - while $(split1) - { - if $(split1[1]) = $(split2[1]) - { - split1 = $(split1[2-]) ; - split2 = $(split2[2-]) ; - } - else - { - not-a-child = true ; - split1 = ; - } - } - if $(split2) - { - if $(not-a-child) - { - if $(no-error) - { - return not-a-child ; - } - else - { - import errors ; - errors.error $(child) is not a subdir of $(parent) ; - } - } - else - { - return [ join $(split2) ] ; - } - } - else - { - return "." ; - } - } -} - - -# Returns the minimal path to path2 that is relative to path1. -# -rule relative-to ( path1 path2 ) -{ - local root_1 = [ regex.split [ reverse $(path1) ] / ] ; - local split1 = [ regex.split $(path1) / ] ; - local split2 = [ regex.split $(path2) / ] ; - - while $(split1) && $(root_1) - { - if $(split1[1]) = $(split2[1]) - { - root_1 = $(root_1[2-]) ; - split1 = $(split1[2-]) ; - split2 = $(split2[2-]) ; - } - else - { - split1 = ; - } - } - return [ join . $(root_1) $(split2) ] ; -} - - -# Returns the list of paths used by the operating system for looking up -# programs. -# -rule programs-path ( ) -{ - local result ; - local raw = [ modules.peek : PATH Path path ] ; - for local p in $(raw) - { - if $(p) - { - result += [ path.make $(p) ] ; - } - } - return $(result) ; -} - - -rule makedirs ( path ) -{ - local result = true ; - local native = [ native $(path) ] ; - if ! [ exists $(native) ] - { - if [ makedirs [ parent $(path) ] ] - { - if ! [ MAKEDIR $(native) ] - { - import errors ; - errors.error "Could not create directory '$(path)'" ; - result = ; - } - } - } - return $(result) ; -} - - -# Converts native Windows paths into our internal canonic path representation. -# Supports 'invalid' paths containing multiple successive path separator -# characters. -# -# TODO: Check and if needed add support for Windows 'X:file' path format where -# the file is located in the current folder on drive X. -# -rule make-NT ( native ) -{ - local result = [ NORMALIZE_PATH $(native) ] ; - - # We need to add an extra '/' in front in case this is a rooted Windows path - # starting with a drive letter and not a path separator character since the - # builtin NORMALIZE_PATH rule has no knowledge of this leading drive letter - # and treats it as a regular folder name. - if [ regex.match "(^.:)" : $(native) ] - { - result = /$(result) ; - } - - return $(result) ; -} - - -rule native-NT ( path ) -{ - local remove-slash = [ MATCH "^/(.:.*)" : $(path) ] ; - if $(remove-slash) - { - path = $(remove-slash) ; - } - return [ regex.replace $(path) / \\ ] ; -} - - -rule make-UNIX ( native ) -{ - # VP: I have no idea now 'native' can be empty here! But it can! - if ! $(native) - { - import errors ; - errors.error "Empty path passed to 'make-UNIX'" ; - } - else - { - return [ NORMALIZE_PATH $(native:T) ] ; - } -} - - -rule native-UNIX ( path ) -{ - return $(path) ; -} - - -rule make-CYGWIN ( path ) -{ - return [ make-NT $(path) ] ; -} - - -rule native-CYGWIN ( path ) -{ - local result = $(path) ; - if [ regex.match "(^/.:)" : $(path) ] # Windows absolute path. - { - result = [ MATCH "^/?(.*)" : $(path) ] ; # Remove leading '/'. - } - return [ native-UNIX $(result) ] ; -} - - -# split-path-VMS: splits input native path into device dir file (each part is -# optional). -# -# example: -# -# dev:[dir]file.c => dev: [dir] file.c -# -rule split-path-VMS ( native ) -{ - local matches = [ MATCH ([a-zA-Z0-9_-]+:)?(\\[[^\]]*\\])?(.*)?$ : $(native) - ] ; - local device = $(matches[1]) ; - local dir = $(matches[2]) ; - local file = $(matches[3]) ; - - return $(device) $(dir) $(file) ; -} - - -# Converts a native VMS path into a portable path spec. -# -# Does not handle current-device absolute paths such as "[dir]File.c" as it is -# not clear how to represent them in the portable path notation. -# -# Adds a trailing dot (".") to the file part if no extension is present (helps -# when converting it back into native path). -# -rule make-VMS ( native ) -{ - if [ MATCH ^(\\[[a-zA-Z0-9]) : $(native) ] - { - import errors ; - errors.error "Can't handle default-device absolute paths: " $(native) ; - } - - local parts = [ split-path-VMS $(native) ] ; - local device = $(parts[1]) ; - local dir = $(parts[2]) ; - local file = $(parts[3]) ; - local elems ; - - if $(device) - { - # - # rooted - # - elems = /$(device) ; - } - - if $(dir) = "[]" - { - # - # Special case: current directory - # - elems = $(elems) "." ; - } - else if $(dir) - { - dir = [ regex.replace $(dir) "\\[|\\]" "" ] ; - local dir_parts = [ regex.split $(dir) \\. ] ; - - if $(dir_parts[1]) = "" - { - # - # Relative path - # - dir_parts = $(dir_parts[2--1]) ; - } - - # - # replace "parent-directory" parts (- => ..) - # - dir_parts = [ regex.replace-list $(dir_parts) : - : .. ] ; - - elems = $(elems) $(dir_parts) ; - } - - if $(file) - { - if ! [ MATCH (\\.) : $(file) ] - { - # - # Always add "." to end of non-extension file. - # - file = $(file). ; - } - elems = $(elems) $(file) ; - } - - local portable = [ path.join $(elems) ] ; - - return $(portable) ; -} - - -# Converts a portable path spec into a native VMS path. -# -# Relies on having at least one dot (".") included in the file name to be able -# to differentiate it from the directory part. -# -rule native-VMS ( path ) -{ - local device = "" ; - local dir = $(path) ; - local file = "" ; - local native ; - local split ; - - # - # Has device ? - # - if [ is-rooted $(dir) ] - { - split = [ MATCH ^/([^:]+:)/?(.*) : $(dir) ] ; - device = $(split[1]) ; - dir = $(split[2]) ; - } - - # - # Has file ? - # - # This is no exact science, just guess work: - # - # If the last part of the current path spec includes some chars, followed by - # a dot, optionally followed by more chars - then it is a file (keep your - # fingers crossed). - # - split = [ regex.split $(dir) / ] ; - local maybe_file = $(split[-1]) ; - - if [ MATCH ^([^.]+\\..*) : $(maybe_file) ] - { - file = $(maybe_file) ; - dir = [ sequence.join $(split[1--2]) : / ] ; - } - - # - # Has dir spec ? - # - if $(dir) = "." - { - dir = "[]" ; - } - else if $(dir) - { - dir = [ regex.replace $(dir) \\.\\. - ] ; - dir = [ regex.replace $(dir) / . ] ; - - if $(device) = "" - { - # - # Relative directory - # - dir = "."$(dir) ; - } - dir = "["$(dir)"]" ; - } - - native = [ sequence.join $(device) $(dir) $(file) ] ; - - return $(native) ; -} - -# Remove one level of indirection -IMPORT $(__name__) : make-$(os) native-$(os) : $(__name__) : make native ; -EXPORT $(__name__) : make native ; - -rule __test__ ( ) -{ - import assert ; - import errors : try catch ; - - assert.true is-rooted "/" ; - assert.true is-rooted "/foo" ; - assert.true is-rooted "/foo/bar" ; - assert.result : is-rooted "." ; - assert.result : is-rooted "foo" ; - assert.result : is-rooted "foo/bar" ; - - assert.true has-parent "foo" ; - assert.true has-parent "foo/bar" ; - assert.true has-parent "." ; - assert.result : has-parent "/" ; - - assert.result "." : basename "." ; - assert.result ".." : basename ".." ; - assert.result "foo" : basename "foo" ; - assert.result "foo" : basename "bar/foo" ; - assert.result "foo" : basename "gaz/bar/foo" ; - assert.result "foo" : basename "/gaz/bar/foo" ; - - assert.result "." : parent "foo" ; - assert.result "/" : parent "/foo" ; - assert.result "foo/bar" : parent "foo/bar/giz" ; - assert.result ".." : parent "." ; - assert.result ".." : parent "../foo" ; - assert.result "../../foo" : parent "../../foo/bar" ; - - assert.result "." : reverse "." ; - assert.result ".." : reverse "foo" ; - assert.result "../../.." : reverse "foo/bar/giz" ; - - assert.result "foo" : join "foo" ; - assert.result "/foo" : join "/" "foo" ; - assert.result "foo/bar" : join "foo" "bar" ; - assert.result "foo/bar" : join "foo/giz" "../bar" ; - assert.result "foo/giz" : join "foo/bar/baz" "../../giz" ; - assert.result ".." : join "." ".." ; - assert.result ".." : join "foo" "../.." ; - assert.result "../.." : join "../foo" "../.." ; - assert.result "/foo" : join "/bar" "../foo" ; - assert.result "foo/giz" : join "foo/giz" "." ; - assert.result "." : join lib2 ".." ; - assert.result "/" : join "/a" ".." ; - - assert.result /a/b : join /a/b/c .. ; - - assert.result "foo/bar/giz" : join "foo" "bar" "giz" ; - assert.result "giz" : join "foo" ".." "giz" ; - assert.result "foo/giz" : join "foo" "." "giz" ; - - try ; - { - join "a" "/b" ; - } - catch only first element may be rooted ; - - local CWD = "/home/ghost/build" ; - assert.result : all-parents . : . : $(CWD) ; - assert.result . .. ../.. ../../.. : all-parents "Jamfile" : "" : $(CWD) ; - assert.result foo . .. ../.. ../../.. : all-parents "foo/Jamfile" : "" : - $(CWD) ; - assert.result ../Work .. ../.. ../../.. : all-parents "../Work/Jamfile" : "" - : $(CWD) ; - - local CWD = "/home/ghost" ; - assert.result . .. : all-parents "Jamfile" : "/home" : $(CWD) ; - assert.result . : all-parents "Jamfile" : "/home/ghost" : $(CWD) ; - - assert.result "c/d" : relative "a/b/c/d" "a/b" ; - assert.result "foo" : relative "foo" "." ; - - local save-os = [ modules.peek path : os ] ; - modules.poke path : os : NT ; - - assert.result "foo/bar/giz" : make-NT "foo/bar/giz" ; - assert.result "foo/bar/giz" : make-NT "foo\\bar\\giz" ; - assert.result "foo" : make-NT "foo/" ; - assert.result "foo" : make-NT "foo\\" ; - assert.result "foo" : make-NT "foo/." ; - assert.result "foo" : make-NT "foo/bar/.." ; - assert.result "foo" : make-NT "foo/bar/../" ; - assert.result "foo" : make-NT "foo/bar/..\\" ; - assert.result "foo/bar" : make-NT "foo/././././bar" ; - assert.result "/foo" : make-NT "\\foo" ; - assert.result "/D:/My Documents" : make-NT "D:\\My Documents" ; - assert.result "/c:/boost/tools/build/new/project.jam" : make-NT - "c:\\boost\\tools\\build\\test\\..\\new\\project.jam" ; - - # Test processing 'invalid' paths containing multiple successive path - # separators. - assert.result "foo" : make-NT "foo//" ; - assert.result "foo" : make-NT "foo///" ; - assert.result "foo" : make-NT "foo\\\\" ; - assert.result "foo" : make-NT "foo\\\\\\" ; - assert.result "/foo" : make-NT "//foo" ; - assert.result "/foo" : make-NT "///foo" ; - assert.result "/foo" : make-NT "\\\\foo" ; - assert.result "/foo" : make-NT "\\\\\\foo" ; - assert.result "/foo" : make-NT "\\/\\/foo" ; - assert.result "foo/bar" : make-NT "foo//\\//\\\\bar//\\//\\\\\\//\\//\\\\" ; - assert.result "foo" : make-NT "foo/bar//.." ; - assert.result "foo/bar" : make-NT "foo/bar/giz//.." ; - assert.result "foo/giz" : make-NT - "foo//\\//\\\\bar///\\\\//\\\\////\\/..///giz\\//\\\\\\//\\//\\\\" ; - assert.result "../../../foo" : make-NT "..///.//..///.//..////foo///" ; - - # Test processing 'invalid' rooted paths with too many '..' path elements - # that would place them before the root. - assert.result : make-NT "/.." ; - assert.result : make-NT "/../" ; - assert.result : make-NT "/../." ; - assert.result : make-NT "/.././" ; - assert.result : make-NT "/foo/../bar/giz/.././././../../." ; - assert.result : make-NT "/foo/../bar/giz/.././././../.././" ; - assert.result : make-NT "//foo/../bar/giz/.././././../../." ; - assert.result : make-NT "//foo/../bar/giz/.././././../.././" ; - assert.result : make-NT "\\\\foo/../bar/giz/.././././../../." ; - assert.result : make-NT "\\\\foo/../bar/giz/.././././../.././" ; - assert.result : make-NT "/..///.//..///.//..////foo///" ; - - assert.result "foo\\bar\\giz" : native-NT "foo/bar/giz" ; - assert.result "foo" : native-NT "foo" ; - assert.result "\\foo" : native-NT "/foo" ; - assert.result "D:\\My Documents\\Work" : native-NT "/D:/My Documents/Work" ; - - modules.poke path : os : UNIX ; - - assert.result "foo/bar/giz" : make-UNIX "foo/bar/giz" ; - assert.result "/sub1" : make-UNIX "/sub1/." ; - assert.result "/sub1" : make-UNIX "/sub1/sub2/.." ; - assert.result "sub1" : make-UNIX "sub1/." ; - assert.result "sub1" : make-UNIX "sub1/sub2/.." ; - assert.result "/foo/bar" : native-UNIX "/foo/bar" ; - - modules.poke path : os : VMS ; - - # - # Do not really need to poke os before these - # - assert.result "disk:" "[dir]" "file" : split-path-VMS "disk:[dir]file" ; - assert.result "disk:" "[dir]" "" : split-path-VMS "disk:[dir]" ; - assert.result "disk:" "" "" : split-path-VMS "disk:" ; - assert.result "disk:" "" "file" : split-path-VMS "disk:file" ; - assert.result "" "[dir]" "file" : split-path-VMS "[dir]file" ; - assert.result "" "[dir]" "" : split-path-VMS "[dir]" ; - assert.result "" "" "file" : split-path-VMS "file" ; - assert.result "" "" "" : split-path-VMS "" ; - - # - # Special case: current directory - # - assert.result "" "[]" "" : split-path-VMS "[]" ; - assert.result "disk:" "[]" "" : split-path-VMS "disk:[]" ; - assert.result "" "[]" "file" : split-path-VMS "[]file" ; - assert.result "disk:" "[]" "file" : split-path-VMS "disk:[]file" ; - - # - # Make portable paths - # - assert.result "/disk:" : make-VMS "disk:" ; - assert.result "foo/bar/giz" : make-VMS "[.foo.bar.giz]" ; - assert.result "foo" : make-VMS "[.foo]" ; - assert.result "foo" : make-VMS "[.foo.bar.-]" ; - assert.result ".." : make-VMS "[.-]" ; - assert.result ".." : make-VMS "[-]" ; - assert.result "." : make-VMS "[]" ; - assert.result "giz.h" : make-VMS "giz.h" ; - assert.result "foo/bar/giz.h" : make-VMS "[.foo.bar]giz.h" ; - assert.result "/disk:/my_docs" : make-VMS "disk:[my_docs]" ; - assert.result "/disk:/boost/tools/build/new/project.jam" : make-VMS - "disk:[boost.tools.build.test.-.new]project.jam" ; - - # - # Special case (adds '.' to end of file w/o extension to disambiguate from - # directory in portable path spec) - # - assert.result "Jamfile." : make-VMS "Jamfile" ; - assert.result "dir/Jamfile." : make-VMS "[.dir]Jamfile" ; - assert.result "/disk:/dir/Jamfile." : make-VMS "disk:[dir]Jamfile" ; - - # - # Make native paths - # - assert.result "disk:" : native-VMS "/disk:" ; - assert.result "[.foo.bar.giz]" : native-VMS "foo/bar/giz" ; - assert.result "[.foo]" : native-VMS "foo" ; - assert.result "[.-]" : native-VMS ".." ; - assert.result "[.foo.-]" : native-VMS "foo/.." ; - assert.result "[]" : native-VMS "." ; - assert.result "disk:[my_docs.work]" : native-VMS "/disk:/my_docs/work" ; - assert.result "giz.h" : native-VMS "giz.h" ; - assert.result "disk:Jamfile." : native-VMS "/disk:Jamfile." ; - assert.result "disk:[my_docs.work]Jamfile." : native-VMS - "/disk:/my_docs/work/Jamfile." ; - - modules.poke path : os : $(save-os) ; -}
