http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/print.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/print.jam b/ext/kenlm/jam-files/boost-build/util/print.jam deleted file mode 100644 index c867e4e..0000000 --- a/ext/kenlm/jam-files/boost-build/util/print.jam +++ /dev/null @@ -1,488 +0,0 @@ -# Copyright 2003 Douglas Gregor -# Copyright 2002, 2003, 2005 Rene Rivera -# Copyright 2002, 2003, 2004, 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) - -# Utilities for generating format independent output. Using these -# will help in generation of documentation in at minimum plain/console -# and html. - -import modules ; -import numbers ; -import string ; -import regex ; -import "class" ; -import scanner ; -import path ; - -# The current output target. Defaults to console. -output-target = console ; - -# The current output type. Defaults to plain. Other possible values are "html". -output-type = plain ; - -# Whitespace. -.whitespace = [ string.whitespace ] ; - - -# Set the target and type of output to generate. This sets both the destination -# output and the type of docs to generate to that output. The target can be -# either a file or "console" for echoing to the console. If the type of output -# is not specified it defaults to plain text. -# -rule output ( - target # The target file or device; file or "console". - type ? # The type of output; "plain" or "html". -) -{ - type ?= plain ; - if $(output-target) != $(target) - { - output-target = $(target) ; - output-type = $(type) ; - if $(output-type) = html - { - text - "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" - "<html>" - "<head>" - "</head>" - "<body link=\"#0000ff\" vlink=\"#800080\">" - : true - : prefix ; - text - "</body>" - "</html>" - : - : suffix ; - } - } -} - - -# Generate a section with a description. The type of output can be controlled by -# the value of the 'output-type' variable. -# -rule section ( - name # The name of the section. - description * # A number of description lines. -) -{ - if $(output-type) = plain - { - lines [ split-at-words $(name): ] ; - lines ; - } - else if $(output-type) = html - { - name = [ escape-html $(name) ] ; - text <h3>$(name)</h3> <p> ; - } - local pre = ; - while $(description) - { - local paragraph = ; - while $(description) && [ string.is-whitespace $(description[1]) ] { description = $(description[2-]) ; } - if $(pre) - { - while $(description) && ( - $(pre) = " $(description[1])" || - ( $(pre) < [ string.chars [ MATCH "^([$(.whitespace)]*)" : " $(description[1])" ] ] ) - ) - { paragraph += $(description[1]) ; description = $(description[2-]) ; } - while [ string.is-whitespace $(paragraph[-1]) ] { paragraph = $(paragraph[1--2]) ; } - pre = ; - if $(output-type) = plain - { - lines $(paragraph) "" : " " " " ; - } - else if $(output-type) = html - { - text <blockquote> ; - lines $(paragraph) ; - text </blockquote> ; - } - } - else - { - while $(description) && ! [ string.is-whitespace $(description[1]) ] - { paragraph += $(description[1]) ; description = $(description[2-]) ; } - if $(paragraph[1]) = :: && ! $(paragraph[2]) - { - pre = " " ; - } - if $(paragraph[1]) = :: - { - if $(output-type) = plain - { - lines $(paragraph[2-]) "" : " " " " ; - lines ; - } - else if $(output-type) = html - { - text <blockquote> ; - lines $(paragraph[2-]) ; - text </blockquote> ; - } - } - else - { - local p = [ MATCH "(.*)(::)$" : $(paragraph[-1]) ] ; - local pws = [ MATCH "([ ]*)$" : $(p[1]) ] ; - p = [ MATCH "(.*)($(pws))($(p[2]))$" : $(paragraph[-1]) ] ; - if $(p[3]) = :: - { - pre = [ string.chars [ MATCH "^([$(.whitespace)]*)" : " $(p[1])" ] ] ; - if ! $(p[2]) || $(p[2]) = "" { paragraph = $(paragraph[1--2]) $(p[1]): ; } - else { paragraph = $(paragraph[1--2]) $(p[1]) ; } - if $(output-type) = plain - { - lines [ split-at-words " " $(paragraph) ] : " " " " ; - lines ; - } - else if $(output-type) = html - { - text </p> <p> [ escape-html $(paragraph) ] ; - } - } - else - { - if $(output-type) = plain - { - lines [ split-at-words " " $(paragraph) ] : " " " " ; - lines ; - } - else if $(output-type) = html - { - text </p> <p> [ escape-html $(paragraph) ] ; - } - } - } - } - } - if $(output-type) = html - { - text </p> ; - } -} - - -# Generate the start of a list of items. The type of output can be controlled by -# the value of the 'output-type' variable. -# -rule list-start ( ) -{ - if $(output-type) = plain - { - } - else if $(output-type) = html - { - text <ul> ; - } -} - - -# Generate an item in a list. The type of output can be controlled by the value -# of the 'output-type' variable. -# -rule list-item ( - item + # The item to list. -) -{ - if $(output-type) = plain - { - lines [ split-at-words "*" $(item) ] : " " " " ; - } - else if $(output-type) = html - { - text <li> [ escape-html $(item) ] </li> ; - } -} - - -# Generate the end of a list of items. The type of output can be controlled by -# the value of the 'output-type' variable. -# -rule list-end ( ) -{ - if $(output-type) = plain - { - lines ; - } - else if $(output-type) = html - { - text </ul> ; - } -} - - -# Split the given text into separate lines, word-wrapping to a margin. The -# default margin is 78 characters. -# -rule split-at-words ( - text + # The text to split. - : margin ? # An optional margin, default is 78. -) -{ - local lines = ; - text = [ string.words $(text:J=" ") ] ; - text = $(text:J=" ") ; - margin ?= 78 ; - local char-match-1 = ".?" ; - local char-match = "" ; - while $(margin) != 0 - { - char-match = $(char-match)$(char-match-1) ; - margin = [ numbers.decrement $(margin) ] ; - } - while $(text) - { - local s = "" ; - local t = "" ; - # divide s into the first X characters and the rest - s = [ MATCH "^($(char-match))(.*)" : $(text) ] ; - - if $(s[2]) - { - # split the first half at a space - t = [ MATCH "^(.*)[\\ ]([^\\ ]*)$" : $(s[1]) ] ; - } - else - { - t = $(s) ; - } - - if ! $(t[2]) - { - t += "" ; - } - - text = $(t[2])$(s[2]) ; - lines += $(t[1]) ; - } - return $(lines) ; -} - - -# Generate a set of fixed lines. Each single item passed in is output on a -# separate line. For console this just echos each line, but for html this will -# split them with <br>. -# -rule lines ( - text * # The lines of text. - : indent ? # Optional indentation prepended to each line after the first. - outdent ? # Optional indentation to prepend to the first line. -) -{ - text ?= "" ; - indent ?= "" ; - outdent ?= "" ; - if $(output-type) = plain - { - text $(outdent)$(text[1]) $(indent)$(text[2-]) ; - } - else if $(output-type) = html - { - local indent-chars = [ string.chars $(indent) ] ; - indent = "" ; - for local c in $(indent-chars) - { - if $(c) = " " { c = " " ; } - else if $(c) = " " { c = " " ; } - indent = $(indent)$(c) ; - } - local html-text = [ escape-html $(text) : " " ] ; - text $(html-text[1])<br> $(indent)$(html-text[2-])<br> ; - } -} - - -# Output text directly to the current target. When doing output to a file, one -# can indicate if the text should be output to "prefix" it, as the "body" -# (default), or "suffix" of the file. This is independant of the actual -# execution order of the text rule. This rule invokes a singular action, one -# action only once, which does the build of the file. Therefore actions on the -# target outside of this rule will happen entirely before and/or after all -# output using this rule. -# -rule text ( - strings * # The strings of text to output. - : overwrite ? # True to overwrite the output (if it is a file). - : prefix-body-suffix ? # Indication to output prefix, body, or suffix (for - # a file). -) -{ - prefix-body-suffix ?= body ; - if $(output-target) = console - { - if ! $(strings) - { - ECHO ; - } - else - { - for local s in $(strings) - { - ECHO $(s) ; - } - } - } - if ! $($(output-target).did-action) - { - $(output-target).did-action = yes ; - $(output-target).text-prefix = ; - $(output-target).text-body = ; - $(output-target).text-suffix = ; - - nl on $(output-target) = " -" ; - text-redirect on $(output-target) = ">>" ; - if $(overwrite) - { - text-redirect on $(output-target) = ">" ; - } - text-content on $(output-target) = ; - - text-action $(output-target) ; - - if $(overwrite) && $(output-target) != console - { - check-for-update $(output-target) ; - } - } - $(output-target).text-$(prefix-body-suffix) += $(strings) ; - text-content on $(output-target) = - $($(output-target).text-prefix) - $($(output-target).text-body) - $($(output-target).text-suffix) ; -} - - -# Outputs the text to the current targets, after word-wrapping it. -# -rule wrapped-text ( text + ) -{ - local lines = [ split-at-words $(text) ] ; - text $(lines) ; -} - - -# Escapes text into html/xml printable equivalents. Does not know about tags and -# therefore tags fed into this will also be escaped. Currently escapes space, -# "<", ">", and "&". -# -rule escape-html ( - text + # The text to escape. - : space ? # What to replace spaces with, defaults to " ". -) -{ - local html-text = ; - while $(text) - { - local html = $(text[1]) ; - text = $(text[2-]) ; - html = [ regex.replace $(html) "&" "&" ] ; - html = [ regex.replace $(html) "<" "<" ] ; - html = [ regex.replace $(html) ">" ">" ] ; - if $(space) - { - html = [ regex.replace $(html) " " "$(space)" ] ; - } - html-text += $(html) ; - } - return $(html-text) ; -} - - -# Outputs the text strings collected by the text rule to the output file. -# -actions quietly text-action -{ - @($(STDOUT):E=$(text-content:J=$(nl))) $(text-redirect) "$(<)" -} - - -rule get-scanner ( ) -{ - if ! $(.scanner) - { - .scanner = [ class.new print-scanner ] ; - } - return $(.scanner) ; -} - - -# The following code to update print targets when their contents change is a -# horrible hack. It basically creates a target which binds to this file -# (print.jam) and installs a scanner on it which reads the target and compares -# its contents to the new contents that we are writing. -# -rule check-for-update ( target ) -{ - local scanner = [ get-scanner ] ; - local file = [ path.native [ modules.binding $(__name__) ] ] ; - local g = [ MATCH <(.*)> : $(target:G) ] ; - local dependency-target = $(__file__:G=$(g:E=)-$(target:G=)-$(scanner)) ; - DEPENDS $(target) : $(dependency-target) ; - SEARCH on $(dependency-target) = $(file:D) ; - ISFILE $(dependency-target) ; - NOUPDATE $(dependency-target) ; - base on $(dependency-target) = $(target) ; - scanner.install $(scanner) : $(dependency-target) ; - return $(dependency-target) ; -} - - -class print-scanner : scanner -{ - import path ; - import os ; - - rule pattern ( ) - { - return "(One match...)" ; - } - - rule process ( target : matches * : binding ) - { - local base = [ on $(target) return $(base) ] ; - local nl = [ on $(base) return $(nl) ] ; - local text-content = [ on $(base) return $(text-content) ] ; - local dir = [ on $(base) return $(LOCATE) ] ; - if $(dir) - { - dir = [ path.make $(dir) ] ; - } - local file = [ path.native [ path.join $(dir) $(base:G=) ] ] ; - local actual-content ; - if [ os.name ] = NT - { - actual-content = [ SHELL "type \"$(file)\" 2>nul" ] ; - } - else - { - actual-content = [ SHELL "cat \"$(file)\" 2>/dev/null" ] ; - } - if $(text-content:J=$(nl)) != $(actual-content) - { - ALWAYS $(base) ; - } - } -} - - -rule __test__ ( ) -{ - import assert ; - - assert.result one two three : split-at-words one two three : 5 ; - assert.result "one two" three : split-at-words one two three : 8 ; - assert.result "one two" three : split-at-words one two three : 9 ; - assert.result "one two three" : split-at-words one two three ; - - # VP, 2004-12-03 The following test fails for some reason, so commenting it - # out. - #assert.result "one two three" "&<>" : - # escape-html "one two three" "&<>" ; -}
http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/regex.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/regex.jam b/ext/kenlm/jam-files/boost-build/util/regex.jam deleted file mode 100644 index be8b3cf..0000000 --- a/ext/kenlm/jam-files/boost-build/util/regex.jam +++ /dev/null @@ -1,203 +0,0 @@ -# Copyright 2001, 2002 Dave Abrahams -# Copyright 2003 Douglas Gregor -# Copyright 2003 Rene Rivera -# Copyright 2002, 2003, 2004, 2005 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) - -# -# Returns a list of the following substrings: -# 1) from beginning till the first occurrence of 'separator' or till the end, -# 2) between each occurrence of 'separator' and the next occurrence, -# 3) from the last occurrence of 'separator' till the end. -# If no separator is present, the result will contain only one element. -# - -rule split ( string separator ) -{ - local result ; - local s = $(string) ; - - # Break pieaces off 's' until it has no separators left. - local match = 1 ; - while $(match) - { - match = [ MATCH ^(.*)($(separator))(.*) : $(s) ] ; - if $(match) - { - match += "" ; # in case 3rd item was empty - works around MATCH bug - result = $(match[3]) $(result) ; - s = $(match[1]) ; - } - } - # Combine the remaining part at the beginning, which does not have - # separators, with the pieces broken off. Note that the rule's signature - # does not allow the initial s to be empty. - return $(s) $(result) ; -} - -if [ HAS_NATIVE_RULE regex : split : 1 ] -{ - NATIVE_RULE regex : split ; -} - -# Returns the concatenated results of Applying regex.split to every element of -# the list using the separator pattern. -# -rule split-list ( list * : separator ) -{ - local result ; - for s in $(list) - { - result += [ split $(s) $(separator) ] ; - } - return $(result) ; -} - - -# Match string against pattern, and return the elements indicated by indices. -# -rule match ( pattern : string : indices * ) -{ - indices ?= 1 2 3 4 5 6 7 8 9 ; - local x = [ MATCH $(pattern) : $(string) ] ; - return $(x[$(indices)]) ; -} - - -# Matches all elements of 'list' agains the 'pattern' and returns a list of -# elements indicated by indices of all successful matches. If 'indices' is -# omitted returns a list of first parenthesised groups of all successful -# matches. -# -rule transform ( list * : pattern : indices * ) -{ - indices ?= 1 ; - local result ; - for local e in $(list) - { - local m = [ MATCH $(pattern) : $(e) ] ; - if $(m) - { - result += $(m[$(indices)]) ; - } - } - return $(result) ; -} - -NATIVE_RULE regex : transform ; - - -# Escapes all of the characters in symbols using the escape symbol escape-symbol -# for the given string, and returns the escaped string. -# -rule escape ( string : symbols : escape-symbol ) -{ - local result = "" ; - local m = 1 ; - while $(m) - { - m = [ MATCH ^([^$(symbols)]*)([$(symbols)])(.*) : $(string) ] ; - if $(m) - { - m += "" ; # Supposedly a bug fix; borrowed from regex.split - result = "$(result)$(m[1])$(escape-symbol)$(m[2])" ; - string = $(m[3]) ; - } - } - string ?= "" ; - result = "$(result)$(string)" ; - return $(result) ; -} - - -# Replaces occurrences of a match string in a given string and returns the new -# string. The match string can be a regex expression. -# -rule replace ( - string # The string to modify. - match # The characters to replace. - replacement # The string to replace with. - ) -{ - local result = "" ; - local parts = 1 ; - while $(parts) - { - parts = [ MATCH ^(.*)($(match))(.*) : $(string) ] ; - if $(parts) - { - parts += "" ; - result = "$(replacement)$(parts[3])$(result)" ; - string = $(parts[1]) ; - } - } - string ?= "" ; - result = "$(string)$(result)" ; - return $(result) ; -} - -if [ HAS_NATIVE_RULE regex : replace : 1 ] -{ - NATIVE_RULE regex : replace ; -} - - -# Replaces occurrences of a match string in a given list of strings and returns -# a list of new strings. The match string can be a regex expression. -# -# list - the list of strings to modify. -# match - the search expression. -# replacement - the string to replace with. -# -rule replace-list ( list * : match : replacement ) -{ - local result ; - for local e in $(list) - { - result += [ replace $(e) $(match) $(replacement) ] ; - } - return $(result) ; -} - - -rule __test__ ( ) -{ - import assert ; - - assert.result a b c : split "a/b/c" / ; - assert.result "" a b c : split "/a/b/c" / ; - assert.result "" "" a b c : split "//a/b/c" / ; - assert.result "" a "" b c : split "/a//b/c" / ; - assert.result "" a "" b c "" : split "/a//b/c/" / ; - assert.result "" a "" b c "" "" : split "/a//b/c//" / ; - - assert.result a c b d - : match (.)(.)(.)(.) : abcd : 1 3 2 4 ; - - assert.result a b c d - : match (.)(.)(.)(.) : abcd ; - - assert.result ababab cddc - : match ((ab)*)([cd]+) : abababcddc : 1 3 ; - - assert.result a.h c.h - : transform <a.h> \"b.h\" <c.h> : <(.*)> ; - - assert.result a.h b.h c.h - : transform <a.h> \"b.h\" <c.h> : <([^>]*)>|\"([^\"]*)\" : 1 2 ; - - assert.result "^<?xml version=\"1.0\"^>" - : escape "<?xml version=\"1.0\">" : "&|()<>^" : "^" ; - - assert.result "<?xml version=\\\"1.0\\\">" - : escape "<?xml version=\"1.0\">" : "\\\"" : "\\" ; - - assert.result "string string " : replace "string string " " " " " ; - assert.result " string string" : replace " string string" " " " " ; - assert.result "string string" : replace "string string" " " " " ; - assert.result "-" : replace "&" "&" "-" ; - - assert.result "-" "a-b" : replace-list "&" "a&b" : "&" : "-" ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/sequence.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/sequence.jam b/ext/kenlm/jam-files/boost-build/util/sequence.jam deleted file mode 100644 index a87eb4d..0000000 --- a/ext/kenlm/jam-files/boost-build/util/sequence.jam +++ /dev/null @@ -1,339 +0,0 @@ -# Copyright 2001, 2002, 2003 Dave Abrahams -# Copyright 2006 Rene Rivera -# 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 assert ; -import numbers ; -import modules ; - - -# Note that algorithms in this module execute largely in the caller's module -# namespace, so that local rules can be used as function objects. Also note that -# most predicates can be multi-element lists. In that case, all but the first -# element are prepended to the first argument which is passed to the rule named -# by the first element. - - -# Return the elements e of $(sequence) for which [ $(predicate) e ] has a -# non-null value. -# -rule filter ( predicate + : sequence * ) -{ - local caller = [ CALLER_MODULE ] ; - local result ; - - for local e in $(sequence) - { - if [ modules.call-in $(caller) : $(predicate) $(e) ] - { - result += $(e) ; - } - } - return $(result) ; -} - - -# Return a new sequence consisting of [ $(function) $(e) ] for each element e of -# $(sequence). -# -rule transform ( function + : sequence * ) -{ - local caller = [ CALLER_MODULE ] ; - local result ; - - for local e in $(sequence) - { - result += [ modules.call-in $(caller) : $(function) $(e) ] ; - } - return $(result) ; -} - -if [ HAS_NATIVE_RULE sequence : transform : 1 ] -{ - NATIVE_RULE sequence : transform ; -} - -rule reverse ( s * ) -{ - local r ; - for local x in $(s) - { - r = $(x) $(r) ; - } - return $(r) ; -} - - -rule less ( a b ) -{ - if $(a) < $(b) - { - return true ; - } -} - - -# Insertion-sort s using the BinaryPredicate ordered. -# -rule insertion-sort ( s * : ordered * ) -{ - if ! $(ordered) - { - return [ SORT $(s) ] ; - } - else - { - local caller = [ CALLER_MODULE ] ; - ordered ?= sequence.less ; - local result = $(s[1]) ; - if $(ordered) = sequence.less - { - local head tail ; - for local x in $(s[2-]) - { - head = ; - tail = $(result) ; - while $(tail) && ( $(tail[1]) < $(x) ) - { - head += $(tail[1]) ; - tail = $(tail[2-]) ; - } - result = $(head) $(x) $(tail) ; - } - } - else - { - for local x in $(s[2-]) - { - local head tail ; - tail = $(result) ; - while $(tail) && [ modules.call-in $(caller) : $(ordered) $(tail[1]) $(x) ] - { - head += $(tail[1]) ; - tail = $(tail[2-]) ; - } - result = $(head) $(x) $(tail) ; - } - } - - return $(result) ; - } -} - - -# Merge two ordered sequences using the BinaryPredicate ordered. -# -rule merge ( s1 * : s2 * : ordered * ) -{ - ordered ?= sequence.less ; - local result__ ; - local caller = [ CALLER_MODULE ] ; - - while $(s1) && $(s2) - { - if [ modules.call-in $(caller) : $(ordered) $(s1[1]) $(s2[1]) ] - { - result__ += $(s1[1]) ; - s1 = $(s1[2-]) ; - } - else if [ modules.call-in $(caller) : $(ordered) $(s2[1]) $(s1[1]) ] - { - result__ += $(s2[1]) ; - s2 = $(s2[2-]) ; - } - else - { - s2 = $(s2[2-]) ; - } - - } - result__ += $(s1) ; - result__ += $(s2) ; - - return $(result__) ; -} - - -# Join the elements of s into one long string. If joint is supplied, it is used -# as a separator. -# -rule join ( s * : joint ? ) -{ - joint ?= "" ; - return $(s:J=$(joint)) ; -} - - -# Find the length of any sequence. -# -rule length ( s * ) -{ - local result = 0 ; - for local i in $(s) - { - result = [ CALC $(result) + 1 ] ; - } - return $(result) ; -} - - -rule unique ( list * : stable ? ) -{ - local result ; - local prev ; - if $(stable) - { - for local f in $(list) - { - if ! $(f) in $(result) - { - result += $(f) ; - } - } - } - else - { - for local i in [ SORT $(list) ] - { - if $(i) != $(prev) - { - result += $(i) ; - } - prev = $(i) ; - } - } - return $(result) ; -} - - -# Returns the maximum number in 'elements'. Uses 'ordered' for comparisons or -# 'numbers.less' if none is provided. -# -rule max-element ( elements + : ordered ? ) -{ - ordered ?= numbers.less ; - - local max = $(elements[1]) ; - for local e in $(elements[2-]) - { - if [ $(ordered) $(max) $(e) ] - { - max = $(e) ; - } - } - return $(max) ; -} - - -# Returns all of 'elements' for which corresponding element in parallel list -# 'rank' is equal to the maximum value in 'rank'. -# -rule select-highest-ranked ( elements * : ranks * ) -{ - if $(elements) - { - local max-rank = [ max-element $(ranks) ] ; - local result ; - while $(elements) - { - if $(ranks[1]) = $(max-rank) - { - result += $(elements[1]) ; - } - elements = $(elements[2-]) ; - ranks = $(ranks[2-]) ; - } - return $(result) ; - } -} -NATIVE_RULE sequence : select-highest-ranked ; - - -rule __test__ ( ) -{ - # Use a unique module so we can test the use of local rules. - module sequence.__test__ - { - import assert ; - import sequence ; - - local rule is-even ( n ) - { - if $(n) in 0 2 4 6 8 - { - return true ; - } - } - - assert.result 4 6 4 2 8 : sequence.filter is-even : 1 4 6 3 4 7 2 3 8 ; - - # Test that argument binding works. - local rule is-equal-test ( x y ) - { - if $(x) = $(y) - { - return true ; - } - } - - assert.result 3 3 3 : sequence.filter is-equal-test 3 : 1 2 3 4 3 5 3 5 7 ; - - local rule append-x ( n ) - { - return $(n)x ; - } - - assert.result 1x 2x 3x : sequence.transform append-x : 1 2 3 ; - - local rule repeat2 ( x ) - { - return $(x) $(x) ; - } - - assert.result 1 1 2 2 3 3 : sequence.transform repeat2 : 1 2 3 ; - - local rule test-greater ( a b ) - { - if $(a) > $(b) - { - return true ; - } - } - assert.result 1 2 3 4 5 6 7 8 9 : sequence.insertion-sort 9 6 5 3 8 7 1 2 4 ; - assert.result 9 8 7 6 5 4 3 2 1 : sequence.insertion-sort 9 6 5 3 8 7 1 2 4 : test-greater ; - assert.result 1 2 3 4 5 6 : sequence.merge 1 3 5 : 2 4 6 ; - assert.result 6 5 4 3 2 1 : sequence.merge 5 3 1 : 6 4 2 : test-greater ; - assert.result 1 2 3 : sequence.merge 1 2 3 : ; - assert.result 1 : sequence.merge 1 : 1 ; - - assert.result foo-bar-baz : sequence.join foo bar baz : - ; - assert.result substandard : sequence.join sub stan dard ; - assert.result 3.0.1 : sequence.join 3.0.1 : - ; - - assert.result 0 : sequence.length ; - assert.result 3 : sequence.length a b c ; - assert.result 17 : sequence.length 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 ; - - assert.result 1 : sequence.length a ; - assert.result 10 : sequence.length a b c d e f g h i j ; - assert.result 11 : sequence.length a b c d e f g h i j k ; - assert.result 12 : sequence.length a b c d e f g h i j k l ; - - local p2 = x ; - for local i in 1 2 3 4 5 6 7 8 - { - p2 = $(p2) $(p2) ; - } - assert.result 256 : sequence.length $(p2) ; - - assert.result 1 2 3 4 5 : sequence.unique 1 2 3 2 4 3 3 5 5 5 ; - - assert.result 5 : sequence.max-element 1 3 5 0 4 ; - - assert.result e-3 h-3 : sequence.select-highest-ranked e-1 e-3 h-3 m-2 : 1 3 3 2 ; - - assert.result 7 6 5 4 3 2 1 : sequence.reverse 1 2 3 4 5 6 7 ; - } -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/set.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/set.jam b/ext/kenlm/jam-files/boost-build/util/set.jam deleted file mode 100644 index fc17913..0000000 --- a/ext/kenlm/jam-files/boost-build/util/set.jam +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright 2001, 2002 Dave Abrahams -# 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) - -class set -{ - rule __init__ ( ) - { - } - - rule add ( elements * ) - { - for local e in $(elements) - { - if ! $($(e)) - { - $(e) = 1 ; - self.result += $(e) ; - } - } - } - - rule contains ( element ) - { - return $($(element)) ; - } - - rule list ( ) - { - return $(self.result) ; - } -} - - - -# Returns the elements of set1 that are not in set2. -# -rule difference ( set1 * : set2 * ) -{ - local result = ; - for local element in $(set1) - { - if ! ( $(element) in $(set2) ) - { - result += $(element) ; - } - } - return $(result) ; -} - -NATIVE_RULE set : difference ; - - -# Removes all the items appearing in both set1 & set2. -# -rule intersection ( set1 * : set2 * ) -{ - local result ; - for local v in $(set1) - { - if $(v) in $(set2) - { - result += $(v) ; - } - } - return $(result) ; -} - - -# Returns whether set1 & set2 contain the same elements. Note that this ignores -# any element ordering differences as well as any element duplication. -# -rule equal ( set1 * : set2 * ) -{ - if $(set1) in $(set2) && ( $(set2) in $(set1) ) - { - return true ; - } -} - - -rule __test__ ( ) -{ - import assert ; - - assert.result 0 1 4 6 8 9 : difference 0 1 2 3 4 5 6 7 8 9 : 2 3 5 7 ; - assert.result 2 5 7 : intersection 0 1 2 4 5 6 7 8 9 : 2 3 5 7 ; - - assert.true equal : ; - assert.true equal 1 1 2 3 : 3 2 2 1 ; - assert.false equal 2 3 : 3 2 2 1 ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/string.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/string.jam b/ext/kenlm/jam-files/boost-build/util/string.jam deleted file mode 100644 index a39ed11..0000000 --- a/ext/kenlm/jam-files/boost-build/util/string.jam +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright 2002 Dave Abrahams -# Copyright 2002, 2003 Rene Rivera -# 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 regex ; - - -# Characters considered whitespace, as a list. -.whitespace-chars = " " " " " -" ; - -# Characters considered whitespace, as a single string. -.whitespace = $(.whitespace-chars:J="") ; - - -# Returns the canonical set of whitespace characters, as a list. -# -rule whitespace-chars ( ) -{ - return $(.whitespace-chars) ; -} - - -# Returns the canonical set of whitespace characters, as a single string. -# -rule whitespace ( ) -{ - return $(.whitespace) ; -} - - -# Splits the given string into a list of strings composed of each character of -# the string in sequence. -# -rule chars ( - string # The string to split. - ) -{ - local result ; - while $(string) - { - local s = [ MATCH (.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.*) : $(string) ] ; - string = $(s[9]) ; - result += $(s[1-8]) ; - } - - # Trim off empty strings. - while $(result[1]) && ! $(result[-1]) - { - result = $(result[1--2]) ; - } - - return $(result) ; -} - - -# Apply a set of standard transformations to string to produce an abbreviation -# no more than 5 characters long. -# -rule abbreviate ( string ) -{ - local r = $(.abbreviated-$(string)) ; - if $(r) - { - return $(r) ; - } - # Anything less than 4 characters gets no abbreviation. - else if ! [ MATCH (....) : $(string) ] - { - .abbreviated-$(string) = $(string) ; - return $(string) ; - } - else - { - # Separate the initial letter in case it's a vowel. - local s1 = [ MATCH ^(.)(.*) : $(string) ] ; - - # Drop trailing "ing". - local s2 = [ MATCH ^(.*)ing$ : $(s1[2]) ] ; - s2 ?= $(s1[2]) ; - - # Reduce all doubled characters to one. - local last = "" ; - for local c in [ chars $(s2) ] - { - if $(c) != $(last) - { - r += $(c) ; - last = $(c) ; - } - } - s2 = $(r:J="") ; - - # Chop all vowels out of the remainder. - s2 = [ regex.replace $(s2) [AEIOUaeiou] "" ] ; - - # Shorten remaining consonants to 4 characters. - s2 = [ MATCH ^(.?.?.?.?) : $(s2) ] ; - - # Glue the initial character back on to the front. - s2 = $(s1[1])$(s2) ; - - .abbreviated-$(string) = $(s2) ; - return $(s2) ; - } -} - - -# Concatenates the given strings, inserting the given separator between each -# string. -# -rule join ( - strings * # The strings to join. - : separator ? # The optional separator. - ) -{ - separator ?= "" ; - return $(strings:J=$(separator)) ; -} - - -# Split a string into whitespace separated words. -# -rule words ( - string # The string to split. - : whitespace * # Optional, characters to consider as whitespace. - ) -{ - whitespace = $(whitespace:J="") ; - whitespace ?= $(.whitespace) ; - local w = ; - while $(string) - { - string = [ MATCH "^[$(whitespace)]*([^$(whitespace)]*)(.*)" : $(string) ] ; - if $(string[1]) && $(string[1]) != "" - { - w += $(string[1]) ; - } - string = $(string[2]) ; - } - return $(w) ; -} - - -# Check that the given string is composed entirely of whitespace. -# -rule is-whitespace ( - string ? # The string to test. - ) -{ - if ! $(string) { return true ; } - else if $(string) = "" { return true ; } - else if [ MATCH "^([$(.whitespace)]+)$" : $(string) ] { return true ; } - else { return ; } -} - -rule __test__ ( ) -{ - import assert ; - assert.result a b c : chars abc ; - - assert.result rntm : abbreviate runtime ; - assert.result ovrld : abbreviate overload ; - assert.result dbg : abbreviate debugging ; - assert.result async : abbreviate asynchronous ; - assert.result pop : abbreviate pop ; - assert.result aaa : abbreviate aaa ; - assert.result qck : abbreviate quack ; - assert.result sttc : abbreviate static ; - - # Check boundary cases. - assert.result a : chars a ; - assert.result : chars "" ; - assert.result a b c d e f g h : chars abcdefgh ; - assert.result a b c d e f g h i : chars abcdefghi ; - assert.result a b c d e f g h i j : chars abcdefghij ; - assert.result a b c d e f g h i j k : chars abcdefghijk ; - - assert.result a//b/c/d : join a "" b c d : / ; - assert.result abcd : join a "" b c d ; - - assert.result a b c : words "a b c" ; - - assert.true is-whitespace " " ; - assert.false is-whitespace " a b c " ; - assert.true is-whitespace "" ; - assert.true is-whitespace ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/boost-build/util/utility.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/utility.jam b/ext/kenlm/jam-files/boost-build/util/utility.jam deleted file mode 100644 index 26981c5..0000000 --- a/ext/kenlm/jam-files/boost-build/util/utility.jam +++ /dev/null @@ -1,235 +0,0 @@ -# Copyright 2001, 2002 Dave Abrahams -# Copyright 2002, 2003, 2004, 2005 Vladimir Prus -# Copyright 2008 Jurko Gospodnetic -# 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 "class" : is-instance ; - - -# For all elements of 'list' which do not already have 'suffix', add 'suffix'. -# -rule apply-default-suffix ( suffix : list * ) -{ - local result ; - for local i in $(list) - { - if $(i:S) = $(suffix) - { - result += $(i) ; - } - else - { - result += $(i)$(suffix) ; - } - } - return $(result) ; -} - - -# If 'name' contains a dot, returns the part before the last dot. If 'name' -# contains no dot, returns it unmodified. -# -rule basename ( name ) -{ - if $(name:S) - { - name = $(name:B) ; - } - return $(name) ; -} - - -# Return the file of the caller of the rule that called caller-file. -# -rule caller-file ( ) -{ - local bt = [ BACKTRACE ] ; - return $(bt[9]) ; -} - - -# Tests if 'a' is equal to 'b'. If 'a' is a class instance, calls its 'equal' -# method. Uses ordinary jam's comparison otherwise. -# -rule equal ( a b ) -{ - if [ is-instance $(a) ] - { - return [ $(a).equal $(b) ] ; - } - else - { - if $(a) = $(b) - { - return true ; - } - } -} - - -# Tests if 'a' is less than 'b'. If 'a' is a class instance, calls its 'less' -# method. Uses ordinary jam's comparison otherwise. -# -rule less ( a b ) -{ - if [ is-instance $(a) ] - { - return [ $(a).less $(b) ] ; - } - else - { - if $(a) < $(b) - { - return true ; - } - } -} - - -# Returns the textual representation of argument. If it is a class instance, -# class its 'str' method. Otherwise, returns the argument. -# -rule str ( value ) -{ - if [ is-instance $(value) ] - { - return [ $(value).str ] ; - } - else - { - return $(value) ; - } -} - - -# Accepts a list of gristed values and returns them ungristed. Reports an error -# in case any of the passed parameters is not gristed, i.e. surrounded in angle -# brackets < and >. -# -rule ungrist ( names * ) -{ - local result ; - for local name in $(names) - { - local stripped = [ MATCH ^<(.*)>$ : $(name) ] ; - if ! $(stripped)-defined - { - import errors ; - local quoted-names = \"$(names)\" ; - errors.error "in" ungrist $(quoted-names:J=" "): \"$(name)\" is not - of the form <.*> ; - } - result += $(stripped) ; - } - return $(result) ; -} - - -# If the passed value is quoted, unquotes it. Otherwise returns the value -# unchanged. -# -rule unquote ( value ? ) -{ - local match-result = [ MATCH ^(\")(.*)(\")$ : $(value) ] ; - if $(match-result) - { - return $(match-result[2]) ; - } - else - { - return $(value) ; - } -} - - -rule __test__ ( ) -{ - import assert ; - import "class" : new ; - import errors : try catch ; - - assert.result 123 : str 123 ; - - class test-class__ - { - rule __init__ ( ) { } - rule str ( ) { return "str-test-class" ; } - rule less ( a ) { return "yes, of course!" ; } - rule equal ( a ) { return "not sure" ; } - } - - assert.result "str-test-class" : str [ new test-class__ ] ; - assert.true less 1 2 ; - assert.false less 2 1 ; - assert.result "yes, of course!" : less [ new test-class__ ] 1 ; - assert.true equal 1 1 ; - assert.false equal 1 2 ; - assert.result "not sure" : equal [ new test-class__ ] 1 ; - - assert.result foo.lib foo.lib : apply-default-suffix .lib : foo.lib foo.lib - ; - - assert.result foo : basename foo ; - assert.result foo : basename foo.so ; - assert.result foo.so : basename foo.so.1 ; - - assert.result : unquote ; - assert.result "" : unquote "" ; - assert.result "" : unquote \"\" ; - assert.result \" : unquote \"\"\" ; - assert.result \"\" : unquote \"\"\"\" ; - assert.result foo : unquote foo ; - assert.result \"foo : unquote \"foo ; - assert.result foo\" : unquote foo\" ; - assert.result foo : unquote \"foo\" ; - assert.result \"foo\" : unquote \"\"foo\"\" ; - - assert.result : ungrist ; - assert.result "" : ungrist <> ; - assert.result foo : ungrist <foo> ; - assert.result <foo> : ungrist <<foo>> ; - assert.result foo bar : ungrist <foo> <bar> ; - - try ; - { - ungrist "" ; - } - catch "in" ungrist \"\": \"\" is not of the form <.*> ; - - try ; - { - ungrist foo ; - } - catch "in" ungrist \"foo\": \"foo\" is not of the form <.*> ; - - try ; - { - ungrist <foo ; - } - catch "in" ungrist \"<foo\": \"<foo\" is not of the form <.*> ; - - try ; - { - ungrist foo> ; - } - catch "in" ungrist \"foo>\": \"foo>\" is not of the form <.*> ; - - try ; - { - ungrist foo bar ; - } - catch "in" ungrist "\"foo\" \"bar\"": \"foo\" is not of the form <.*> ; - - try ; - { - ungrist foo <bar> ; - } - catch "in" ungrist "\"foo\" \"<bar>\"": \"foo\" is not of the form <.*> ; - - try ; - { - ungrist <foo> bar ; - } - catch "in" ungrist "\"<foo>\" \"bar\"": \"bar\" is not of the form <.*> ; -} http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/empty_test_main.cc ---------------------------------------------------------------------- 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/empty_test_main.cc b/ext/kenlm/jam-files/empty_test_main.cc deleted file mode 100644 index a3971f8..0000000 --- a/ext/kenlm/jam-files/empty_test_main.cc +++ /dev/null @@ -1,8 +0,0 @@ -/* Program to verify compilation against the unit test framework */ - -#define BOOST_TEST_MODULE EmptyTest -#include <boost/test/unit_test.hpp> - -namespace { -BOOST_AUTO_TEST_CASE(Empty) {} -} // namespace
