http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/jamgram.yy
----------------------------------------------------------------------
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/engine/jamgram.yy 
b/ext/kenlm/jam-files/engine/jamgram.yy
deleted file mode 100644
index 8d20e38..0000000
--- a/ext/kenlm/jam-files/engine/jamgram.yy
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright 1993, 2000 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*  This file is ALSO:
- *  Copyright 2001-2004 David Abrahams.
- *  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)
- */
-
-/*
- * jamgram.yy - jam grammar
- *
- * 04/13/94 (seiwald) - added shorthand L0 for null list pointer
- * 06/01/94 (seiwald) - new 'actions existing' does existing sources
- * 08/23/94 (seiwald) - Support for '+=' (append to variable)
- * 08/31/94 (seiwald) - Allow ?= as alias for "default =".
- * 09/15/94 (seiwald) - if conditionals take only single arguments, so
- *                     that 'if foo == bar' gives syntax error (use =).
- * 02/11/95 (seiwald) - when scanning arguments to rules, only treat
- *                     punctuation keywords as keywords.  All arg lists
- *                     are terminated with punctuation keywords.
- *
- * 09/11/00 (seiwald) - Support for function calls:
- *
- *             Rules now return lists (LIST *), rather than void.
- *
- *             New "[ rule ]" syntax evals rule into a LIST.
- *
- *             Lists are now generated by compile_list() and
- *             compile_append(), and any other rule that indirectly
- *             makes a list, rather than being built directly here,
- *             so that lists values can contain rule evaluations.
- *
- *             New 'return' rule sets the return value, though
- *             other statements also may have return values.
- *
- *             'run' production split from 'block' production so
- *             that empty blocks can be handled separately.
- */
-
-%token ARG STRING
-
-%left `||` `|`
-%left `&&` `&`
-%left `=` `!=` `in`
-%left `<` `<=` `>` `>=`
-%left `!`
-
-%{
-#include "jam.h"
-
-#include "lists.h"
-#include "parse.h"
-#include "scan.h"
-#include "compile.h"
-#include "object.h"
-#include "rules.h"
-
-# define YYMAXDEPTH 10000      /* for OSF and other less endowed yaccs */
-
-# define F0 -1
-# define P0 (PARSE *)0
-# define S0 (OBJECT *)0
-
-# define pappend( l,r )        parse_make( PARSE_APPEND,l,r,P0,S0,S0,0 )
-# define peval( c,l,r )        parse_make( PARSE_EVAL,l,r,P0,S0,S0,c )
-# define pfor( s,l,r,x )       parse_make( PARSE_FOREACH,l,r,P0,s,S0,x )
-# define pif( l,r,t )          parse_make( PARSE_IF,l,r,t,S0,S0,0 )
-# define pincl( l )            parse_make( PARSE_INCLUDE,l,P0,P0,S0,S0,0 )
-# define plist( s )            parse_make( PARSE_LIST,P0,P0,P0,s,S0,0 )
-# define plocal( l,r,t )       parse_make( PARSE_LOCAL,l,r,t,S0,S0,0 )
-# define pmodule( l,r )                parse_make( PARSE_MODULE,l,r,P0,S0,S0,0 
)
-# define pclass( l,r )         parse_make( PARSE_CLASS,l,r,P0,S0,S0,0 )
-# define pnull()               parse_make( PARSE_NULL,P0,P0,P0,S0,S0,0 )
-# define pon( l,r )            parse_make( PARSE_ON,l,r,P0,S0,S0,0 )
-# define prule( s,p )          parse_make( PARSE_RULE,p,P0,P0,s,S0,0 )
-# define prules( l,r )         parse_make( PARSE_RULES,l,r,P0,S0,S0,0 )
-# define pset( l,r,a )          parse_make( PARSE_SET,l,r,P0,S0,S0,a )
-# define pset1( l,r,t,a )      parse_make( PARSE_SETTINGS,l,r,t,S0,S0,a )
-# define psetc( s,p,a,l )      parse_make( PARSE_SETCOMP,p,a,P0,s,S0,l )
-# define psete( s,l,s1,f )     parse_make( PARSE_SETEXEC,l,P0,P0,s,s1,f )
-# define pswitch( l,r )        parse_make( PARSE_SWITCH,l,r,P0,S0,S0,0 )
-# define pwhile( l,r )         parse_make( PARSE_WHILE,l,r,P0,S0,S0,0 )
-
-# define pnode( l,r )          parse_make( F0,l,r,P0,S0,S0,0 )
-# define psnode( s,l )         parse_make( F0,l,P0,P0,s,S0,0 )
-
-%}
-
-%%
-
-run    : /* empty */
-               /* do nothing */
-       | rules
-               { parse_save( $1.parse ); }
-       ;
-
-/*
- * block - zero or more rules
- * rules - one or more rules
- * rule - any one of jam's rules
- * right-recursive so rules execute in order.
- */
-
-block  : null
-                { $$.parse = $1.parse; }
-       | rules
-               { $$.parse = $1.parse; }
-       ;
-
-rules  : rule
-               { $$.parse = $1.parse; }
-       | rule rules
-               { $$.parse = prules( $1.parse, $2.parse ); }
-       | `local` list assign_list_opt `;` block
-               { $$.parse = plocal( $2.parse, $3.parse, $5.parse ); }
-       ;
-
-null    : /* empty */
-        { $$.parse = pnull(); }
-        ;
-
-assign_list_opt : `=` list
-                { $$.parse = $2.parse; $$.number = ASSIGN_SET; }
-        | null
-               { $$.parse = $1.parse; $$.number = ASSIGN_APPEND; }
-        ;
-
-arglist_opt : `(` lol `)`
-                { $$.parse = $2.parse; }
-        |
-                { $$.parse = P0; }
-        ;
-
-local_opt : `local`
-                { $$.number = 1; }
-          | /* empty */
-                { $$.number = 0; }
-          ;
-
-rule   : `{` block `}`
-               { $$.parse = $2.parse; }
-       | `include` list `;`
-               { $$.parse = pincl( $2.parse ); }
-       | ARG lol `;`
-               { $$.parse = prule( $1.string, $2.parse ); }
-       | arg assign list `;`
-               { $$.parse = pset( $1.parse, $3.parse, $2.number ); }
-       | arg `on` list assign list `;`
-               { $$.parse = pset1( $1.parse, $3.parse, $5.parse, $4.number ); }
-       | `return` list `;`
-               { $$.parse = $2.parse; }
-       | `for` local_opt ARG `in` list `{` block `}`
-               { $$.parse = pfor( $3.string, $5.parse, $7.parse, $2.number ); }
-       | `switch` list `{` cases `}`
-               { $$.parse = pswitch( $2.parse, $4.parse ); }
-       | `if` expr `{` block `}`
-               { $$.parse = pif( $2.parse, $4.parse, pnull() ); }
-       | `module` list `{` block `}`
-               { $$.parse = pmodule( $2.parse, $4.parse ); }
-       | `class` lol `{` block `}`
-               { $$.parse = pclass( $2.parse, $4.parse ); }
-       | `while` expr `{` block `}`
-               { $$.parse = pwhile( $2.parse, $4.parse ); }
-       | `if` expr `{` block `}` `else` rule
-               { $$.parse = pif( $2.parse, $4.parse, $7.parse ); }
-     | local_opt `rule` ARG arglist_opt rule
-               { $$.parse = psetc( $3.string, $5.parse, $4.parse, $1.number ); 
}
-       | `on` arg rule
-               { $$.parse = pon( $2.parse, $3.parse ); }
-       | `actions` eflags ARG bindlist `{`
-               { yymode( SCAN_STRING ); }
-         STRING
-               { yymode( SCAN_NORMAL ); }
-         `}`
-               { $$.parse = psete( $3.string,$4.parse,$7.string,$2.number ); }
-       ;
-
-/*
- * assign - = or +=
- */
-
-assign : `=`
-               { $$.number = ASSIGN_SET; }
-       | `+=`
-               { $$.number = ASSIGN_APPEND; }
-       | `?=`
-               { $$.number = ASSIGN_DEFAULT; }
-       | `default` `=`
-               { $$.number = ASSIGN_DEFAULT; }
-       ;
-
-/*
- * expr - an expression for if
- */
-expr   : arg
-               { $$.parse = peval( EXPR_EXISTS, $1.parse, pnull() ); }
-       | expr `=` expr
-               { $$.parse = peval( EXPR_EQUALS, $1.parse, $3.parse ); }
-       | expr `!=` expr
-               { $$.parse = peval( EXPR_NOTEQ, $1.parse, $3.parse ); }
-       | expr `<` expr
-               { $$.parse = peval( EXPR_LESS, $1.parse, $3.parse ); }
-       | expr `<=` expr
-               { $$.parse = peval( EXPR_LESSEQ, $1.parse, $3.parse ); }
-       | expr `>` expr
-               { $$.parse = peval( EXPR_MORE, $1.parse, $3.parse ); }
-       | expr `>=` expr
-               { $$.parse = peval( EXPR_MOREEQ, $1.parse, $3.parse ); }
-       | expr `&` expr
-               { $$.parse = peval( EXPR_AND, $1.parse, $3.parse ); }
-       | expr `&&` expr
-               { $$.parse = peval( EXPR_AND, $1.parse, $3.parse ); }
-       | expr `|` expr
-               { $$.parse = peval( EXPR_OR, $1.parse, $3.parse ); }
-       | expr `||` expr
-               { $$.parse = peval( EXPR_OR, $1.parse, $3.parse ); }
-       | arg `in` list
-               { $$.parse = peval( EXPR_IN, $1.parse, $3.parse ); }
-       | `!` expr
-               { $$.parse = peval( EXPR_NOT, $2.parse, pnull() ); }
-       | `(` expr `)`
-               { $$.parse = $2.parse; }
-       ;
-
-
-/*
- * cases - action elements inside a 'switch'
- * case - a single action element inside a 'switch'
- * right-recursive rule so cases can be examined in order.
- */
-
-cases  : /* empty */
-               { $$.parse = P0; }
-       | case cases
-               { $$.parse = pnode( $1.parse, $2.parse ); }
-       ;
-
-case   : `case` ARG `:` block
-               { $$.parse = psnode( $2.string, $4.parse ); }
-       ;
-
-/*
- * lol - list of lists
- * right-recursive rule so that lists can be added in order.
- */
-
-lol    : list
-               { $$.parse = pnode( P0, $1.parse ); }
-       | list `:` lol
-               { $$.parse = pnode( $3.parse, $1.parse ); }
-       ;
-
-/*
- * list - zero or more args in a LIST
- * listp - list (in puncutation only mode)
- * arg - one ARG or function call
- */
-
-list   : listp
-               { $$.parse = $1.parse; yymode( SCAN_NORMAL ); }
-       ;
-
-listp  : /* empty */
-               { $$.parse = pnull(); yymode( SCAN_PUNCT ); }
-       | listp arg
-               { $$.parse = pappend( $1.parse, $2.parse ); }
-       ;
-
-arg    : ARG
-               { $$.parse = plist( $1.string ); }
-       | `[` { yymode( SCAN_NORMAL ); } func `]`
-               { $$.parse = $3.parse; }
-       ;
-
-/*
- * func - a function call (inside [])
- * This needs to be split cleanly out of 'rule'
- */
-
-func   : ARG lol
-               { $$.parse = prule( $1.string, $2.parse ); }
-       | `on` arg ARG lol
-               { $$.parse = pon( $2.parse, prule( $3.string, $4.parse ) ); }
-       | `on` arg `return` list
-               { $$.parse = pon( $2.parse, $4.parse ); }
-       ;
-
-
-/*
- * eflags - zero or more modifiers to 'executes'
- * eflag - a single modifier to 'executes'
- */
-
-eflags : /* empty */
-               { $$.number = 0; }
-       | eflags eflag
-               { $$.number = $1.number | $2.number; }
-       ;
-
-eflag  : `updated`
-               { $$.number = EXEC_UPDATED; }
-       | `together`
-               { $$.number = EXEC_TOGETHER; }
-       | `ignore`
-               { $$.number = EXEC_IGNORE; }
-       | `quietly`
-               { $$.number = EXEC_QUIETLY; }
-       | `piecemeal`
-               { $$.number = EXEC_PIECEMEAL; }
-       | `existing`
-               { $$.number = EXEC_EXISTING; }
-       ;
-
-
-/*
- * bindlist - list of variable to bind for an action
- */
-
-bindlist : /* empty */
-               { $$.parse = pnull(); }
-       | `bind` list
-               { $$.parse = $2.parse; }
-       ;
-
-

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/jamgramtab.h
----------------------------------------------------------------------
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/engine/jamgramtab.h 
b/ext/kenlm/jam-files/engine/jamgramtab.h
deleted file mode 100644
index a0fd43f..0000000
--- a/ext/kenlm/jam-files/engine/jamgramtab.h
+++ /dev/null
@@ -1,44 +0,0 @@
-    { "!", _BANG_t },
-    { "!=", _BANG_EQUALS_t },
-    { "&", _AMPER_t },
-    { "&&", _AMPERAMPER_t },
-    { "(", _LPAREN_t },
-    { ")", _RPAREN_t },
-    { "+=", _PLUS_EQUALS_t },
-    { ":", _COLON_t },
-    { ";", _SEMIC_t },
-    { "<", _LANGLE_t },
-    { "<=", _LANGLE_EQUALS_t },
-    { "=", _EQUALS_t },
-    { ">", _RANGLE_t },
-    { ">=", _RANGLE_EQUALS_t },
-    { "?=", _QUESTION_EQUALS_t },
-    { "[", _LBRACKET_t },
-    { "]", _RBRACKET_t },
-    { "actions", ACTIONS_t },
-    { "bind", BIND_t },
-    { "case", CASE_t },
-    { "class", CLASS_t },
-    { "default", DEFAULT_t },
-    { "else", ELSE_t },
-    { "existing", EXISTING_t },
-    { "for", FOR_t },
-    { "if", IF_t },
-    { "ignore", IGNORE_t },
-    { "in", IN_t },
-    { "include", INCLUDE_t },
-    { "local", LOCAL_t },
-    { "module", MODULE_t },
-    { "on", ON_t },
-    { "piecemeal", PIECEMEAL_t },
-    { "quietly", QUIETLY_t },
-    { "return", RETURN_t },
-    { "rule", RULE_t },
-    { "switch", SWITCH_t },
-    { "together", TOGETHER_t },
-    { "updated", UPDATED_t },
-    { "while", WHILE_t },
-    { "{", _LBRACE_t },
-    { "|", _BAR_t },
-    { "||", _BARBAR_t },
-    { "}", _RBRACE_t },

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/lists.c
----------------------------------------------------------------------
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/engine/lists.c 
b/ext/kenlm/jam-files/engine/lists.c
deleted file mode 100644
index 3f2309b..0000000
--- a/ext/kenlm/jam-files/engine/lists.c
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*
- * lists.c - maintain lists of objects
- */
-
-#include "jam.h"
-#include "lists.h"
-
-#include <assert.h>
-
-static LIST * freelist[ 32 ];  /* junkpile for list_dealloc() */
-
-static unsigned get_bucket( unsigned size )
-{
-    unsigned bucket = 0;
-    while ( size > ( 1u << bucket ) ) ++bucket;
-    return bucket;
-}
-
-static LIST * list_alloc( unsigned const size )
-{
-    unsigned const bucket = get_bucket( size );
-    if ( freelist[ bucket ] )
-    {
-        LIST * result = freelist[ bucket ];
-        freelist[ bucket ] = result->impl.next;
-        return result;
-    }
-    return (LIST *)BJAM_MALLOC( sizeof( LIST ) + ( 1u << bucket ) *
-        sizeof( OBJECT * ) );
-}
-
-static void list_dealloc( LIST * l )
-{
-    unsigned size = list_length( l );
-    unsigned bucket;
-    LIST * node = l;
-
-    if ( size == 0 ) return;
-
-    bucket = get_bucket( size );;
-
-#ifdef BJAM_NO_MEM_CACHE
-    BJAM_FREE( node );
-#else
-    node->impl.next = freelist[ bucket ];
-    freelist[ bucket ] = node;
-#endif
-}
-
-/*
- * list_append() - append a list onto another one, returning total
- */
-
-LIST * list_append( LIST * l, LIST * nl )
-{
-    if ( list_empty( l ) )
-        return nl;
-    if ( !list_empty( nl ) )
-    {
-        int const l_size = list_length( l );
-        int const nl_size = list_length( nl );
-        int const size = l_size + nl_size;
-        unsigned const bucket = get_bucket( size );
-
-        /* Do we need to reallocate? */
-        if ( l_size <= ( 1u << ( bucket - 1 ) ) )
-        {
-            LIST * result = list_alloc( size );
-            memcpy( list_begin( result ), list_begin( l ), l_size * sizeof(
-                OBJECT * ) );
-            list_dealloc( l );
-            l = result;
-        }
-
-        l->impl.size = size;
-        memcpy( list_begin( l ) + l_size, list_begin( nl ), nl_size * sizeof(
-            OBJECT * ) );
-        list_dealloc( nl );
-    }
-    return l;
-}
-
-LISTITER list_begin( LIST * l )
-{
-    return l ? (LISTITER)( (char *)l + sizeof( LIST ) ) : 0;
-}
-
-LISTITER list_end( LIST * l )
-{
-    return l ? list_begin( l ) + l->impl.size : 0;
-}
-
-LIST * list_new( OBJECT * value )
-{
-    LIST * const head = list_alloc( 1 ) ;
-    head->impl.size = 1;
-    list_begin( head )[ 0 ] = value;
-    return head;
-}
-
-/*
- * list_push_back() - tack a string onto the end of a list of strings
- */
-
-LIST * list_push_back( LIST * head, OBJECT * value )
-{
-    unsigned int size = list_length( head );
-    unsigned int i;
-
-    if ( DEBUG_LISTS )
-        printf( "list > %s <\n", object_str( value ) );
-
-    /* If the size is a power of 2, reallocate. */
-    if ( size == 0 )
-    {
-        head = list_alloc( 1 );
-    }
-    else if ( ( ( size - 1 ) & size ) == 0 )
-    {
-        LIST * l = list_alloc( size + 1 );
-        memcpy( l, head, sizeof( LIST ) + size * sizeof( OBJECT * ) );
-        list_dealloc( head );
-        head = l;
-    }
-
-    list_begin( head )[ size ] = value;
-    head->impl.size = size + 1;
-
-    return head;
-}
-
-
-/*
- * list_copy() - copy a whole list of strings (nl) onto end of another (l).
- */
-
-LIST * list_copy( LIST * l )
-{
-    int size = list_length( l );
-    int i;
-    LIST * result;
-
-    if ( size == 0 ) return L0;
-
-    result = list_alloc( size );
-    result->impl.size = size;
-    for ( i = 0; i < size; ++i )
-        list_begin( result )[ i ] = object_copy( list_begin( l )[ i ] );
-    return result;
-}
-
-
-LIST * list_copy_range( LIST * l, LISTITER first, LISTITER last )
-{
-    if ( first == last )
-        return L0;
-    else
-    {
-        int size = last - first;
-        LIST * result = list_alloc( size );
-        LISTITER dest = list_begin( result );
-        result->impl.size = size;
-        for ( ; first != last; ++first, ++dest )
-            *dest = object_copy( *first );
-        return result;
-    }
-}
-
-
-/*
- * list_sublist() - copy a subset of a list of strings.
- */
-
-LIST * list_sublist( LIST * l, int start, int count )
-{
-    int end = start + count;
-    int size = list_length( l );
-    if ( start >= size ) return L0;
-    if ( end > size ) end = size;
-    return list_copy_range( l, list_begin( l ) + start, list_begin( l ) + end 
);
-}
-
-
-static int str_ptr_compare( void const * va, void const * vb )
-{
-    OBJECT * a = *( (OBJECT * *)va );
-    OBJECT * b = *( (OBJECT * *)vb );
-    return strcmp( object_str( a ), object_str( b ) );
-}
-
-
-LIST * list_sort( LIST * l )
-{
-    int len;
-    int ii;
-    LIST * result;
-
-    if ( !l )
-        return L0;
-
-    len = list_length( l );
-    result = list_copy( l );
-
-    qsort( list_begin( result ), len, sizeof( OBJECT * ), str_ptr_compare );
-
-    return result;
-}
-
-
-/*
- * list_free() - free a list of strings
- */
-
-void list_free( LIST * head )
-{
-    if ( !list_empty( head ) )
-    {
-        LISTITER iter = list_begin( head );
-        LISTITER const end = list_end( head );
-        for ( ; iter != end; iter = list_next( iter ) )
-            object_free( list_item( iter ) );
-        list_dealloc( head );
-    }
-}
-
-
-/*
- * list_pop_front() - remove the front element from a list of strings
- */
-
-LIST * list_pop_front( LIST * l )
-{
-    unsigned size = list_length( l );
-    assert( size );
-    --size;
-    object_free( list_front( l ) );
-
-    if ( size == 0 )
-    {
-        list_dealloc( l );
-        return L0;
-    }
-
-    if ( ( ( size - 1 ) & size ) == 0 )
-    {
-        LIST * const nl = list_alloc( size );
-        nl->impl.size = size;
-        memcpy( list_begin( nl ), list_begin( l ) + 1, size * sizeof( OBJECT * 
)
-            );
-        list_dealloc( l );
-        return nl;
-    }
-
-    l->impl.size = size;
-    memmove( list_begin( l ), list_begin( l ) + 1, size * sizeof( OBJECT * ) );
-    return l;
-}
-
-LIST * list_reverse( LIST * l )
-{
-    int size = list_length( l );
-    if ( size == 0 ) return L0;
-    {
-        LIST * const result = list_alloc( size );
-        int i;
-        result->impl.size = size;
-        for ( i = 0; i < size; ++i )
-            list_begin( result )[ i ] = object_copy( list_begin( l )[ size - i 
-
-                1 ] );
-        return result;
-    }
-}
-
-int list_cmp( LIST * t, LIST * s )
-{
-    int status = 0;
-    LISTITER t_it = list_begin( t );
-    LISTITER const t_end = list_end( t );
-    LISTITER s_it = list_begin( s );
-    LISTITER const s_end = list_end( s );
-
-    while ( !status && ( t_it != t_end || s_it != s_end ) )
-    {
-        char const * st = t_it != t_end ? object_str( list_item( t_it ) ) : "";
-        char const * ss = s_it != s_end ? object_str( list_item( s_it ) ) : "";
-
-        status = strcmp( st, ss );
-
-        t_it = t_it != t_end ? list_next( t_it ) : t_it;
-        s_it = s_it != s_end ? list_next( s_it ) : s_it;
-    }
-
-    return status;
-}
-
-int list_is_sublist( LIST * sub, LIST * l )
-{
-    LISTITER iter = list_begin( sub );
-    LISTITER const end = list_end( sub );
-    for ( ; iter != end; iter = list_next( iter ) )
-        if ( !list_in( l, list_item( iter ) ) )
-            return 0;
-    return 1;
-}
-
-/*
- * list_print() - print a list of strings to stdout
- */
-
-void list_print( LIST * l )
-{
-    LISTITER iter = list_begin( l ), end = list_end( l );
-    if ( iter != end )
-    {
-        printf( "%s", object_str( list_item( iter ) ) );
-        iter = list_next( iter );
-        for ( ; iter != end; iter = list_next( iter ) )
-            printf( " %s", object_str( list_item( iter ) ) );
-    }
-}
-
-
-/*
- * list_length() - return the number of items in the list
- */
-
-int list_length( LIST * l )
-{
-    return l ? l->impl.size : 0;
-}
-
-
-int list_in( LIST * l, OBJECT * value )
-{
-    LISTITER iter = list_begin( l );
-    LISTITER end = list_end( l );
-    for ( ; iter != end; iter = list_next( iter ) )
-        if ( object_equal( list_item( iter ), value ) )
-            return 1;
-    return 0;
-}
-
-
-LIST * list_unique( LIST * sorted_list )
-{
-    LIST * result = L0;
-    OBJECT * last_added = 0;
-
-    LISTITER iter = list_begin( sorted_list ), end = list_end( sorted_list );
-    for ( ; iter != end; iter = list_next( iter ) )
-    {
-        if ( !last_added || !object_equal( list_item( iter ), last_added ) )
-        {
-            result = list_push_back( result, object_copy( list_item( iter ) ) 
);
-            last_added = list_item( iter );
-        }
-    }
-    return result;
-}
-
-void list_done()
-{
-    int i;
-    for ( i = 0; i < sizeof( freelist ) / sizeof( freelist[ 0 ] ); ++i )
-    {
-        LIST * l = freelist[ i ];
-        while ( l )
-        {
-            LIST * const tmp = l;
-            l = l->impl.next;
-            BJAM_FREE( tmp );
-        }
-    }
-}
-
-
-/*
- * lol_init() - initialize a LOL (list of lists).
- */
-
-void lol_init( LOL * lol )
-{
-    lol->count = 0;
-}
-
-
-/*
- * lol_add() - append a LIST onto an LOL.
- */
-
-void lol_add( LOL * lol, LIST * l )
-{
-    if ( lol->count < LOL_MAX )
-        lol->list[ lol->count++ ] = l;
-}
-
-
-/*
- * lol_free() - free the LOL and its LISTs.
- */
-
-void lol_free( LOL * lol )
-{
-    int i;
-    for ( i = 0; i < lol->count; ++i )
-        list_free( lol->list[ i ] );
-    lol->count = 0;
-}
-
-
-/*
- * lol_get() - return one of the LISTs in the LOL.
- */
-
-LIST * lol_get( LOL * lol, int i )
-{
-    return i < lol->count ? lol->list[ i ] : L0;
-}
-
-
-/*
- * lol_print() - debug print LISTS separated by ":".
- */
-
-void lol_print( LOL * lol )
-{
-    int i;
-    for ( i = 0; i < lol->count; ++i )
-    {
-        if ( i )
-            printf( " : " );
-        list_print( lol->list[ i ] );
-    }
-}
-
-#ifdef HAVE_PYTHON
-
-PyObject * list_to_python( LIST * l )
-{
-    PyObject * result = PyList_New( 0 );
-    LISTITER iter = list_begin( l );
-    LISTITER const end = list_end( l );
-    for ( ; iter != end; iter = list_next( iter ) )
-    {
-        PyObject * s = PyString_FromString( object_str( list_item( iter ) ) );
-        PyList_Append( result, s );
-        Py_DECREF( s );
-    }
-
-    return result;
-}
-
-LIST * list_from_python( PyObject * l )
-{
-    LIST * result = L0;
-
-    Py_ssize_t n = PySequence_Size( l );
-    Py_ssize_t i;
-    for ( i = 0; i < n; ++i )
-    {
-        PyObject * v = PySequence_GetItem( l, i );
-        result = list_push_back( result, object_new( PyString_AsString( v ) ) 
);
-        Py_DECREF( v );
-    }
-
-    return result;
-}
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/lists.h
----------------------------------------------------------------------
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/engine/lists.h 
b/ext/kenlm/jam-files/engine/lists.h
deleted file mode 100644
index 3dd8fe8..0000000
--- a/ext/kenlm/jam-files/engine/lists.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*  This file is ALSO:
- *  Copyright 2001-2004 David Abrahams.
- *  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)
- */
-
-/*
- * lists.h - the LIST structure and routines to manipulate them
- *
- * The whole of jam relies on lists of objects as a datatype. This module, in
- * conjunction with object.c, handles these relatively efficiently.
- *
- * Structures defined:
- *
- *  LIST - list of OBJECTs
- *  LOL - list of LISTs
- *
- * External routines:
- *
- *  list_append() - append a list onto another one, returning total
- *  list_new() - tack an object onto the end of a list of objects
- *  list_copy() - copy a whole list of objects
- *  list_sublist() - copy a subset of a list of objects
- *  list_free() - free a list of objects
- *  list_print() - print a list of objects to stdout
- *  list_length() - return the number of items in the list
- *
- *  lol_init() - initialize a LOL (list of lists)
- *  lol_add() - append a LIST onto an LOL
- *  lol_free() - free the LOL and its LISTs
- *  lol_get() - return one of the LISTs in the LOL
- *  lol_print() - debug print LISTS separated by ":"
- */
-
-#ifndef LISTS_DWA20011022_H
-#define LISTS_DWA20011022_H
-
-#include "object.h"
-
-#ifdef HAVE_PYTHON
-# include <Python.h>
-#endif
-
-/*
- * LIST - list of strings
- */
-
-typedef struct _list {
-    union {
-        int size;
-        struct _list * next;
-        OBJECT * align;
-    } impl;
-} LIST;
-
-typedef OBJECT * * LISTITER;
-
-/*
- * LOL - list of LISTs
- */
-
-#define LOL_MAX 19
-typedef struct _lol {
-    int count;
-    LIST * list[ LOL_MAX ];
-} LOL;
-
-LIST * list_new( OBJECT * value );
-LIST * list_append( LIST * destination, LIST * source );
-LIST * list_copy( LIST * );
-LIST * list_copy_range( LIST * destination, LISTITER first, LISTITER last );
-void   list_free( LIST * head );
-LIST * list_push_back( LIST * head, OBJECT * value );
-void   list_print( LIST * );
-int    list_length( LIST * );
-LIST * list_sublist( LIST *, int start, int count );
-LIST * list_pop_front( LIST * );
-LIST * list_sort( LIST * );
-LIST * list_unique( LIST * sorted_list );
-int    list_in( LIST *, OBJECT * value );
-LIST * list_reverse( LIST * );
-int    list_cmp( LIST * lhs, LIST * rhs );
-int    list_is_sublist( LIST * sub, LIST * l );
-void   list_done();
-
-LISTITER list_begin( LIST * );
-LISTITER list_end( LIST * );
-#define list_next( it ) ((it) + 1)
-#define list_item( it ) (*(it))
-#define list_empty( l ) ((l) == L0)
-#define list_front( l ) list_item( list_begin( l ) )
-
-#define L0 ((LIST *)0)
-
-void   lol_add( LOL *, LIST * );
-void   lol_init( LOL * );
-void   lol_free( LOL * );
-LIST * lol_get( LOL *, int i );
-void   lol_print( LOL * );
-void   lol_build( LOL *, char const * * elements );
-
-#ifdef HAVE_PYTHON
-PyObject * list_to_python( LIST * );
-LIST * list_from_python( PyObject * );
-#endif
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/make.c
----------------------------------------------------------------------
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/engine/make.c 
b/ext/kenlm/jam-files/engine/make.c
deleted file mode 100644
index afc8bb9..0000000
--- a/ext/kenlm/jam-files/engine/make.c
+++ /dev/null
@@ -1,908 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*  This file is ALSO:
- *  Copyright 2001-2004 David Abrahams.
- *  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)
- */
-
-/*
- * make.c - bring a target up to date, once rules are in place.
- *
- * This modules controls the execution of rules to bring a target and its
- * dependencies up to date. It is invoked after the targets, rules, et. al.
- * described in rules.h are created by the interpreting jam files.
- *
- * This file contains the main make() entry point and the first pass make0().
- * The second pass, make1(), which actually does the command execution, is in
- * make1.c.
- *
- * External routines:
- *  make() - make a target, given its name
- *
- * Internal routines:
- *  make0() - bind and scan everything to make a TARGET
- *  make0sort() - reorder TARGETS chain by their time (newest to oldest)
- */
-
-#include "jam.h"
-#include "make.h"
-
-#include "command.h"
-#ifdef OPT_HEADER_CACHE_EXT
-# include "hcache.h"
-#endif
-#include "headers.h"
-#include "lists.h"
-#include "object.h"
-#include "parse.h"
-#include "rules.h"
-#include "search.h"
-#include "timestamp.h"
-#include "variable.h"
-
-#include <assert.h>
-
-#ifndef max
-# define max(a,b) ((a)>(b)?(a):(b))
-#endif
-
-static TARGETS * make0sort( TARGETS * c );
-
-#ifdef OPT_GRAPH_DEBUG_EXT
-    static void dependGraphOutput( TARGET * t, int depth );
-#endif
-
-static char const * target_fate[] =
-{
-    "init",     /* T_FATE_INIT     */
-    "making",   /* T_FATE_MAKING   */
-    "stable",   /* T_FATE_STABLE   */
-    "newer",    /* T_FATE_NEWER    */
-    "temp",     /* T_FATE_ISTMP    */
-    "touched",  /* T_FATE_TOUCHED  */
-    "rebuild",  /* T_FATE_REBUILD  */
-    "missing",  /* T_FATE_MISSING  */
-    "needtmp",  /* T_FATE_NEEDTMP  */
-    "old",      /* T_FATE_OUTDATED */
-    "update",   /* T_FATE_UPDATE   */
-    "nofind",   /* T_FATE_CANTFIND */
-    "nomake"    /* T_FATE_CANTMAKE */
-};
-
-static char const * target_bind[] =
-{
-    "unbound",
-    "missing",
-    "parents",
-    "exists",
-};
-
-#define spaces(x) ( "                    " + ( x > 20 ? 0 : 20-x ) )
-
-
-/*
- * make() - make a target, given its name.
- */
-
-int make( LIST * targets, int anyhow )
-{
-    COUNTS counts[ 1 ];
-    int status = 0;  /* 1 if anything fails */
-
-#ifdef OPT_HEADER_CACHE_EXT
-    hcache_init();
-#endif
-
-    memset( (char *)counts, 0, sizeof( *counts ) );
-
-    /* First bind all targets with LOCATE_TARGET setting. This is needed to
-     * correctly handle dependencies to generated headers.
-     */
-    bind_explicitly_located_targets();
-
-    {
-        LISTITER iter, end;
-        PROFILE_ENTER( MAKE_MAKE0 );
-        for ( iter = list_begin( targets ), end = list_end( targets ); iter != 
end; iter = list_next( iter ) )
-        {
-            TARGET * t = bindtarget( list_item( iter ) );
-            if ( t->fate == T_FATE_INIT )
-                make0( t, 0, 0, counts, anyhow, 0 );
-        }
-        PROFILE_EXIT( MAKE_MAKE0 );
-    }
-
-#ifdef OPT_GRAPH_DEBUG_EXT
-    if ( DEBUG_GRAPH )
-    {
-        LISTITER iter, end;
-        for ( iter = list_begin( targets ), end = list_end( targets ); iter != 
end; iter = list_next( iter ) )
-           dependGraphOutput( bindtarget( list_item( iter ) ), 0 );
-    }
-#endif
-
-    if ( DEBUG_MAKE )
-    {
-        if ( counts->targets )
-            printf( "...found %d target%s...\n", counts->targets,
-                counts->targets > 1 ? "s" : "" );
-        if ( counts->temp )
-            printf( "...using %d temp target%s...\n", counts->temp,
-                counts->temp > 1 ? "s" : "" );
-        if ( counts->updating )
-            printf( "...updating %d target%s...\n", counts->updating,
-                counts->updating > 1 ? "s" : "" );
-        if ( counts->cantfind )
-            printf( "...can't find %d target%s...\n", counts->cantfind,
-                counts->cantfind > 1 ? "s" : "" );
-        if ( counts->cantmake )
-            printf( "...can't make %d target%s...\n", counts->cantmake,
-                counts->cantmake > 1 ? "s" : "" );
-    }
-
-    status = counts->cantfind || counts->cantmake;
-
-    {
-        PROFILE_ENTER( MAKE_MAKE1 );
-        status |= make1( targets );
-        PROFILE_EXIT( MAKE_MAKE1 );
-    }
-
-    return status;
-}
-
-
-/* Force any dependants of t that have already at least begun being visited by
- * make0() to be updated.
- */
-
-static void update_dependants( TARGET * t )
-{
-    TARGETS * q;
-
-    for ( q = t->dependants; q; q = q->next )
-    {
-        TARGET * p = q->target;
-        char fate0 = p->fate;
-
-        /* If we have already at least begun visiting it and we are not already
-         * rebuilding it for other reasons.
-         */
-        if ( ( fate0 != T_FATE_INIT ) && ( fate0 < T_FATE_BUILD ) )
-        {
-            p->fate = T_FATE_UPDATE;
-
-            if ( DEBUG_FATE )
-            {
-                printf( "fate change  %s from %s to %s (as dependant of %s)\n",
-                        object_str( p->name ), target_fate[ (int) fate0 ], 
target_fate[ (int) p->fate ], object_str( t->name ) );
-            }
-
-            /* If we are done visiting it, go back and make sure its dependants
-             * get rebuilt.
-             */
-            if ( fate0 > T_FATE_MAKING )
-                update_dependants( p );
-        }
-    }
-}
-
-
-/*
- * Make sure that all of t's rebuilds get rebuilt.
- */
-
-static void force_rebuilds( TARGET * t )
-{
-    TARGETS * d;
-    for ( d = t->rebuilds; d; d = d->next )
-    {
-        TARGET * r = d->target;
-
-        /* If it is not already being rebuilt for other reasons. */
-        if ( r->fate < T_FATE_BUILD )
-        {
-            if ( DEBUG_FATE )
-                printf( "fate change  %s from %s to %s (by rebuild)\n",
-                        object_str( r->name ), target_fate[ (int) r->fate ], 
target_fate[ T_FATE_REBUILD ] );
-
-            /* Force rebuild it. */
-            r->fate = T_FATE_REBUILD;
-
-            /* And make sure its dependants are updated too. */
-            update_dependants( r );
-        }
-    }
-}
-
-
-int make0rescan( TARGET * t, TARGET * rescanning )
-{
-    int result = 0;
-    TARGETS * c;
-
-    /* Check whether we have already found a cycle. */
-    if ( target_scc( t ) == rescanning )
-        return 1;
-
-    /* If we have already visited this node, ignore it. */
-    if ( t->rescanning == rescanning )
-        return 0;
-
-    /* If t is already updated, ignore it. */
-    if ( t->scc_root == NULL && t->progress > T_MAKE_ACTIVE )
-        return 0;
-
-    t->rescanning = rescanning;
-    for ( c = t->depends; c; c = c->next )
-    {
-        TARGET * dependency = c->target;
-        /* Always start at the root of each new strongly connected component. 
*/
-        if ( target_scc( dependency ) != target_scc( t ) )
-            dependency = target_scc( dependency );
-        result |= make0rescan( dependency, rescanning );
-
-        /* Make sure that we pick up the new include node. */
-        if ( c->target->includes == rescanning )
-            result = 1;
-    }
-    if ( result && t->scc_root == NULL )
-    {
-        t->scc_root = rescanning;
-        rescanning->depends = targetentry( rescanning->depends, t );
-    }
-    return result;
-}
-
-
-/*
- * make0() - bind and scan everything to make a TARGET.
- *
- * Recursively binds a target, searches for #included headers, calls itself on
- * those headers and any dependencies.
- */
-
-void make0
-(
-    TARGET * t,
-    TARGET * p,       /* parent */
-    int      depth,   /* for display purposes */
-    COUNTS * counts,  /* for reporting */
-    int      anyhow,
-    TARGET * rescanning
-)  /* forcibly touch all (real) targets */
-{
-    TARGETS    * c;
-    TARGET     * ptime = t;
-    TARGET     * located_target = 0;
-    timestamp    last;
-    timestamp    leaf;
-    timestamp    hlast;
-    int          fate;
-    char const * flag = "";
-    SETTINGS   * s;
-
-#ifdef OPT_GRAPH_DEBUG_EXT
-    int savedFate;
-    int oldTimeStamp;
-#endif
-
-    if ( DEBUG_MAKEPROG )
-        printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
-
-    /*
-     * Step 1: Initialize.
-     */
-
-    if ( DEBUG_MAKEPROG )
-        printf( "make\t--\t%s%s\n", spaces( depth ), object_str( t->name ) );
-
-    t->fate = T_FATE_MAKING;
-    t->depth = depth;
-
-    /*
-     * Step 2: Under the influence of "on target" variables, bind the target 
and
-     * search for headers.
-     */
-
-    /* Step 2a: Set "on target" variables. */
-    s = copysettings( t->settings );
-    pushsettings( root_module(), s );
-
-    /* Step 2b: Find and timestamp the target file (if it is a file). */
-    if ( ( t->binding == T_BIND_UNBOUND ) && !( t->flags & T_FLAG_NOTFILE ) )
-    {
-        OBJECT * another_target;
-        object_free( t->boundname );
-        t->boundname = search( t->name, &t->time, &another_target,
-            t->flags & T_FLAG_ISFILE );
-        /* If it was detected that this target refers to an already existing 
and
-         * bound target, we add a dependency so that every target depending on
-         * us will depend on that other target as well.
-         */
-        if ( another_target )
-            located_target = bindtarget( another_target );
-
-        t->binding = timestamp_empty( &t->time )
-            ? T_BIND_MISSING
-            : T_BIND_EXISTS;
-    }
-
-    /* INTERNAL, NOTFILE header nodes have the time of their parents. */
-    if ( p && ( t->flags & T_FLAG_INTERNAL ) )
-        ptime = p;
-
-    /* If temp file does not exist but parent does, use parent. */
-    if ( p && ( t->flags & T_FLAG_TEMP ) &&
-        ( t->binding == T_BIND_MISSING ) &&
-        ( p->binding != T_BIND_MISSING ) )
-    {
-        t->binding = T_BIND_PARENTS;
-        ptime = p;
-    }
-
-#ifdef OPT_SEMAPHORE
-    {
-        LIST * var = var_get( root_module(), constant_JAM_SEMAPHORE );
-        if ( !list_empty( var ) )
-        {
-            TARGET * const semaphore = bindtarget( list_front( var ) );
-            semaphore->progress = T_MAKE_SEMAPHORE;
-            t->semaphore = semaphore;
-        }
-    }
-#endif
-
-    /* Step 2c: If its a file, search for headers. */
-    if ( t->binding == T_BIND_EXISTS )
-        headers( t );
-
-    /* Step 2d: reset "on target" variables. */
-    popsettings( root_module(), s );
-    freesettings( s );
-
-    /*
-     * Pause for a little progress reporting.
-     */
-
-    if ( DEBUG_BIND )
-    {
-        if ( !object_equal( t->name, t->boundname ) )
-            printf( "bind\t--\t%s%s: %s\n", spaces( depth ),
-                object_str( t->name ), object_str( t->boundname ) );
-
-        switch ( t->binding )
-        {
-        case T_BIND_UNBOUND:
-        case T_BIND_MISSING:
-        case T_BIND_PARENTS:
-            printf( "time\t--\t%s%s: %s\n", spaces( depth ),
-                object_str( t->name ), target_bind[ (int)t->binding ] );
-            break;
-
-        case T_BIND_EXISTS:
-            printf( "time\t--\t%s%s: %s\n", spaces( depth ),
-                object_str( t->name ), timestamp_str( &t->time ) );
-            break;
-        }
-    }
-
-    /*
-     * Step 3: Recursively make0() dependencies & headers.
-     */
-
-    /* Step 3a: Recursively make0() dependencies. */
-    for ( c = t->depends; c; c = c->next )
-    {
-        int const internal = t->flags & T_FLAG_INTERNAL;
-
-        /* Warn about circular deps, except for includes, which include each
-         * other alot.
-         */
-        if ( c->target->fate == T_FATE_INIT )
-            make0( c->target, ptime, depth + 1, counts, anyhow, rescanning );
-        else if ( c->target->fate == T_FATE_MAKING && !internal )
-            printf( "warning: %s depends on itself\n", object_str(
-                c->target->name ) );
-        else if ( c->target->fate != T_FATE_MAKING && rescanning )
-            make0rescan( c->target, rescanning );
-        if ( rescanning && c->target->includes && c->target->includes->fate !=
-            T_FATE_MAKING )
-            make0rescan( target_scc( c->target->includes ), rescanning );
-    }
-
-    if ( located_target )
-    {
-        if ( located_target->fate == T_FATE_INIT )
-            make0( located_target, ptime, depth + 1, counts, anyhow, rescanning
-                );
-        else if ( located_target->fate != T_FATE_MAKING && rescanning )
-            make0rescan( located_target, rescanning );
-    }
-
-    /* Step 3b: Recursively make0() internal includes node. */
-    if ( t->includes )
-        make0( t->includes, p, depth + 1, counts, anyhow, rescanning );
-
-    /* Step 3c: Add dependencies' includes to our direct dependencies. */
-    {
-        TARGETS * incs = 0;
-        for ( c = t->depends; c; c = c->next )
-            if ( c->target->includes )
-                incs = targetentry( incs, c->target->includes );
-        t->depends = targetchain( t->depends, incs );
-    }
-
-    if ( located_target )
-        t->depends = targetentry( t->depends, located_target );
-
-    /* Step 3d: Detect cycles. */
-    {
-        int cycle_depth = depth;
-        for ( c = t->depends; c; c = c->next )
-        {
-            TARGET * scc_root = target_scc( c->target );
-            if ( scc_root->fate == T_FATE_MAKING &&
-                ( !scc_root->includes ||
-                  scc_root->includes->fate != T_FATE_MAKING ) )
-            {
-                if ( scc_root->depth < cycle_depth )
-                {
-                    cycle_depth = scc_root->depth;
-                    t->scc_root = scc_root;
-                }
-            }
-        }
-    }
-
-    /*
-     * Step 4: Compute time & fate.
-     */
-
-    /* Step 4a: Pick up dependencies' time and fate. */
-    timestamp_clear( &last );
-    timestamp_clear( &leaf );
-    fate = T_FATE_STABLE;
-    for ( c = t->depends; c; c = c->next )
-    {
-        /* If we are in a different strongly connected component, pull
-         * timestamps from the root.
-         */
-        if ( c->target->scc_root )
-        {
-            TARGET * const scc_root = target_scc( c->target );
-            if ( scc_root != t->scc_root )
-            {
-                timestamp_max( &c->target->leaf, &c->target->leaf,
-                    &scc_root->leaf );
-                timestamp_max( &c->target->time, &c->target->time,
-                    &scc_root->time );
-                c->target->fate = max( c->target->fate, scc_root->fate );
-            }
-        }
-
-        /* If LEAVES has been applied, we only heed the timestamps of the leaf
-         * source nodes.
-         */
-        timestamp_max( &leaf, &leaf, &c->target->leaf );
-        if ( t->flags & T_FLAG_LEAVES )
-        {
-            timestamp_copy( &last, &leaf );
-            continue;
-        }
-        timestamp_max( &last, &last, &c->target->time );
-        fate = max( fate, c->target->fate );
-
-#ifdef OPT_GRAPH_DEBUG_EXT
-        if ( DEBUG_FATE )
-            if ( fate < c->target->fate )
-                printf( "fate change %s from %s to %s by dependency %s\n",
-                    object_str( t->name ), target_fate[ (int)fate ],
-                    target_fate[ (int)c->target->fate ], object_str(
-                    c->target->name ) );
-#endif
-    }
-
-    /* Step 4b: Pick up included headers time. */
-
-    /*
-     * If a header is newer than a temp source that includes it, the temp 
source
-     * will need building.
-     */
-    if ( t->includes )
-        timestamp_copy( &hlast, &t->includes->time );
-    else
-        timestamp_clear( &hlast );
-
-    /* Step 4c: handle NOUPDATE oddity.
-     *
-     * If a NOUPDATE file exists, mark it as having eternally old dependencies.
-     * Do not inherit our fate from our dependencies. Decide fate based only on
-     * other flags and our binding (done later).
-     */
-    if ( t->flags & T_FLAG_NOUPDATE )
-    {
-#ifdef OPT_GRAPH_DEBUG_EXT
-        if ( DEBUG_FATE )
-            if ( fate != T_FATE_STABLE )
-                printf( "fate change  %s back to stable, NOUPDATE.\n",
-                    object_str( t->name ) );
-#endif
-
-        timestamp_clear( &last );
-        timestamp_clear( &t->time );
-
-        /* Do not inherit our fate from our dependencies. Decide fate based 
only
-         * upon other flags and our binding (done later).
-         */
-        fate = T_FATE_STABLE;
-    }
-
-    /* Step 4d: Determine fate: rebuild target or what? */
-
-    /*
-        In English:
-        If can not find or make child, can not make target.
-        If children changed, make target.
-        If target missing, make it.
-        If children newer, make target.
-        If temp's children newer than parent, make temp.
-        If temp's headers newer than parent, make temp.
-        If deliberately touched, make it.
-        If up-to-date temp file present, use it.
-        If target newer than non-notfile parent, mark target newer.
-        Otherwise, stable!
-
-        Note this block runs from least to most stable: as we make it further
-        down the list, the target's fate gets more stable.
-    */
-
-#ifdef OPT_GRAPH_DEBUG_EXT
-    savedFate = fate;
-    oldTimeStamp = 0;
-#endif
-
-    if ( fate >= T_FATE_BROKEN )
-    {
-        fate = T_FATE_CANTMAKE;
-    }
-    else if ( fate >= T_FATE_SPOIL )
-    {
-        fate = T_FATE_UPDATE;
-    }
-    else if ( t->binding == T_BIND_MISSING )
-    {
-        fate = T_FATE_MISSING;
-    }
-    else if ( t->binding == T_BIND_EXISTS && timestamp_cmp( &last, &t->time ) >
-        0 )
-    {
-#ifdef OPT_GRAPH_DEBUG_EXT
-        oldTimeStamp = 1;
-#endif
-        fate = T_FATE_OUTDATED;
-    }
-    else if ( t->binding == T_BIND_PARENTS && timestamp_cmp( &last, &p->time ) 
>
-        0 )
-    {
-#ifdef OPT_GRAPH_DEBUG_EXT
-        oldTimeStamp = 1;
-#endif
-        fate = T_FATE_NEEDTMP;
-    }
-    else if ( t->binding == T_BIND_PARENTS && timestamp_cmp( &hlast, &p->time )
-        > 0 )
-    {
-        fate = T_FATE_NEEDTMP;
-    }
-    else if ( t->flags & T_FLAG_TOUCHED )
-    {
-        fate = T_FATE_TOUCHED;
-    }
-    else if ( anyhow && !( t->flags & T_FLAG_NOUPDATE ) )
-    {
-        fate = T_FATE_TOUCHED;
-    }
-    else if ( t->binding == T_BIND_EXISTS && ( t->flags & T_FLAG_TEMP ) )
-    {
-        fate = T_FATE_ISTMP;
-    }
-    else if ( t->binding == T_BIND_EXISTS && p && p->binding != T_BIND_UNBOUND
-        && timestamp_cmp( &t->time, &p->time ) > 0 )
-    {
-#ifdef OPT_GRAPH_DEBUG_EXT
-        oldTimeStamp = 1;
-#endif
-        fate = T_FATE_NEWER;
-    }
-    else
-    {
-        fate = T_FATE_STABLE;
-    }
-#ifdef OPT_GRAPH_DEBUG_EXT
-    if ( DEBUG_FATE && ( fate != savedFate ) )
-       {
-        if ( savedFate == T_FATE_STABLE )
-            printf( "fate change  %s set to %s%s\n", object_str( t->name ),
-                target_fate[ fate ], oldTimeStamp ? " (by timestamp)" : "" );
-        else
-            printf( "fate change  %s from %s to %s%s\n", object_str( t->name ),
-                target_fate[ savedFate ], target_fate[ fate ], oldTimeStamp ?
-                " (by timestamp)" : "" );
-       }
-#endif
-
-    /* Step 4e: Handle missing files. */
-    /* If it is missing and there are no actions to create it, boom. */
-    /* If we can not make a target we do not care about it, okay. */
-    /* We could insist that there are updating actions for all missing */
-    /* files, but if they have dependencies we just pretend it is a NOTFILE. */
-
-    if ( ( fate == T_FATE_MISSING ) && !t->actions && !t->depends )
-    {
-        if ( t->flags & T_FLAG_NOCARE )
-        {
-#ifdef OPT_GRAPH_DEBUG_EXT
-            if ( DEBUG_FATE )
-                printf( "fate change %s to STABLE from %s, "
-                    "no actions, no dependencies and do not care\n",
-                    object_str( t->name ), target_fate[ fate ] );
-#endif
-            fate = T_FATE_STABLE;
-        }
-        else
-        {
-            printf( "don't know how to make %s\n", object_str( t->name ) );
-            fate = T_FATE_CANTFIND;
-        }
-    }
-
-    /* Step 4f: Propagate dependencies' time & fate. */
-    /* Set leaf time to be our time only if this is a leaf. */
-
-    timestamp_max( &t->time, &t->time, &last );
-    timestamp_copy( &t->leaf, timestamp_empty( &leaf ) ? &t->time : &leaf );
-    /* This target's fate may have been updated by virtue of following some
-     * target's rebuilds list, so only allow it to be increased to the fate we
-     * have calculated. Otherwise, grab its new fate.
-     */
-    if ( fate > t->fate )
-        t->fate = fate;
-    else
-        fate = t->fate;
-
-    /* Step 4g: If this target needs to be built, force rebuild everything in
-     * its rebuilds list.
-     */
-    if ( ( fate >= T_FATE_BUILD ) && ( fate < T_FATE_BROKEN ) )
-        force_rebuilds( t );
-
-    /*
-     * Step 5: Sort dependencies by their update time.
-     */
-
-    if ( globs.newestfirst )
-        t->depends = make0sort( t->depends );
-
-    /*
-     * Step 6: A little harmless tabulating for tracing purposes.
-     */
-
-    /* Do not count or report interal includes nodes. */
-    if ( t->flags & T_FLAG_INTERNAL )
-        return;
-
-    if ( counts )
-    {
-#ifdef OPT_IMPROVED_PATIENCE_EXT
-        ++counts->targets;
-#else
-        if ( !( ++counts->targets % 1000 ) && DEBUG_MAKE )
-        {
-            printf( "...patience...\n" );
-            fflush(stdout);
-        }
-#endif
-
-        if ( fate == T_FATE_ISTMP )
-            ++counts->temp;
-        else if ( fate == T_FATE_CANTFIND )
-            ++counts->cantfind;
-        else if ( ( fate == T_FATE_CANTMAKE ) && t->actions )
-            ++counts->cantmake;
-        else if ( ( fate >= T_FATE_BUILD ) && ( fate < T_FATE_BROKEN ) &&
-            t->actions )
-            ++counts->updating;
-    }
-
-    if ( !( t->flags & T_FLAG_NOTFILE ) && ( fate >= T_FATE_SPOIL ) )
-        flag = "+";
-    else if ( t->binding == T_BIND_EXISTS && p && timestamp_cmp( &t->time,
-        &p->time ) > 0 )
-        flag = "*";
-
-    if ( DEBUG_MAKEPROG )
-        printf( "made%s\t%s\t%s%s\n", flag, target_fate[ (int)t->fate ],
-            spaces( depth ), object_str( t->name ) );
-}
-
-
-#ifdef OPT_GRAPH_DEBUG_EXT
-
-static char const * target_name( TARGET * t )
-{
-    static char buf[ 1000 ];
-    if ( t->flags & T_FLAG_INTERNAL )
-    {
-        sprintf( buf, "%s (internal node)", object_str( t->name ) );
-        return buf;
-    }
-    return object_str( t->name );
-}
-
-
-/*
- * dependGraphOutput() - output the DG after make0 has run.
- */
-
-static void dependGraphOutput( TARGET * t, int depth )
-{
-    TARGETS * c;
-
-    if ( ( t->flags & T_FLAG_VISITED ) || !t->name || !t->boundname )
-        return;
-
-    t->flags |= T_FLAG_VISITED;
-
-    switch ( t->fate )
-    {
-        case T_FATE_TOUCHED:
-        case T_FATE_MISSING:
-        case T_FATE_OUTDATED:
-        case T_FATE_UPDATE:
-            printf( "->%s%2d Name: %s\n", spaces( depth ), depth, target_name( 
t
-                ) );
-            break;
-        default:
-            printf( "  %s%2d Name: %s\n", spaces( depth ), depth, target_name( 
t
-                ) );
-            break;
-    }
-
-    if ( !object_equal( t->name, t->boundname ) )
-        printf( "  %s    Loc: %s\n", spaces( depth ), object_str( t->boundname 
)
-            );
-
-    switch ( t->fate )
-    {
-    case T_FATE_STABLE:
-        printf( "  %s       : Stable\n", spaces( depth ) );
-        break;
-    case T_FATE_NEWER:
-        printf( "  %s       : Newer\n", spaces( depth ) );
-        break;
-    case T_FATE_ISTMP:
-        printf( "  %s       : Up to date temp file\n", spaces( depth ) );
-        break;
-    case T_FATE_NEEDTMP:
-        printf( "  %s       : Temporary file, to be updated\n", spaces( depth )
-            );
-        break;
-    case T_FATE_TOUCHED:
-        printf( "  %s       : Been touched, updating it\n", spaces( depth ) );
-        break;
-    case T_FATE_MISSING:
-        printf( "  %s       : Missing, creating it\n", spaces( depth ) );
-        break;
-    case T_FATE_OUTDATED:
-        printf( "  %s       : Outdated, updating it\n", spaces( depth ) );
-        break;
-    case T_FATE_REBUILD:
-        printf( "  %s       : Rebuild, updating it\n", spaces( depth ) );
-        break;
-    case T_FATE_UPDATE:
-        printf( "  %s       : Updating it\n", spaces( depth ) );
-        break;
-    case T_FATE_CANTFIND:
-        printf( "  %s       : Can not find it\n", spaces( depth ) );
-        break;
-    case T_FATE_CANTMAKE:
-        printf( "  %s       : Can make it\n", spaces( depth ) );
-        break;
-    }
-
-    if ( t->flags & ~T_FLAG_VISITED )
-    {
-        printf( "  %s       : ", spaces( depth ) );
-        if ( t->flags & T_FLAG_TEMP     ) printf( "TEMPORARY " );
-        if ( t->flags & T_FLAG_NOCARE   ) printf( "NOCARE "    );
-        if ( t->flags & T_FLAG_NOTFILE  ) printf( "NOTFILE "   );
-        if ( t->flags & T_FLAG_TOUCHED  ) printf( "TOUCHED "   );
-        if ( t->flags & T_FLAG_LEAVES   ) printf( "LEAVES "    );
-        if ( t->flags & T_FLAG_NOUPDATE ) printf( "NOUPDATE "  );
-        printf( "\n" );
-    }
-
-    for ( c = t->depends; c; c = c->next )
-    {
-        printf( "  %s       : Depends on %s (%s)", spaces( depth ),
-           target_name( c->target ), target_fate[ (int)c->target->fate ] );
-        if ( !timestamp_cmp( &c->target->time, &t->time ) )
-            printf( " (max time)");
-        printf( "\n" );
-    }
-
-    for ( c = t->depends; c; c = c->next )
-        dependGraphOutput( c->target, depth + 1 );
-}
-#endif
-
-
-/*
- * make0sort() - reorder TARGETS chain by their time (newest to oldest).
- *
- * We walk chain, taking each item and inserting it on the sorted result, with
- * newest items at the front. This involves updating each of the TARGETS'
- * c->next and c->tail. Note that we make c->tail a valid prev pointer for 
every
- * entry. Normally, it is only valid at the head, where prev == tail. Note also
- * that while tail is a loop, next ends at the end of the chain.
- */
-
-static TARGETS * make0sort( TARGETS * chain )
-{
-    PROFILE_ENTER( MAKE_MAKE0SORT );
-
-    TARGETS * result = 0;
-
-    /* Walk the current target list. */
-    while ( chain )
-    {
-        TARGETS * c = chain;
-        TARGETS * s = result;
-
-        chain = chain->next;
-
-        /* Find point s in result for c. */
-        while ( s && timestamp_cmp( &s->target->time, &c->target->time ) > 0 )
-            s = s->next;
-
-        /* Insert c in front of s (might be 0). */
-        c->next = s;                           /* good even if s = 0       */
-        if ( result == s ) result = c;         /* new head of chain?       */
-        if ( !s ) s = result;                  /* wrap to ensure a next    */
-        if ( result != c ) s->tail->next = c;  /* not head? be prev's next */
-        c->tail = s->tail;                     /* take on next's prev      */
-        s->tail = c;                           /* make next's prev us      */
-    }
-
-    PROFILE_EXIT( MAKE_MAKE0SORT );
-    return result;
-}
-
-
-static LIST * targets_to_update_ = L0;
-
-
-void mark_target_for_updating( OBJECT * target )
-{
-    targets_to_update_ = list_push_back( targets_to_update_, object_copy(
-        target ) );
-}
-
-
-LIST * targets_to_update()
-{
-    return targets_to_update_;
-}
-
-
-void clear_targets_to_update()
-{
-    list_free( targets_to_update_ );
-    targets_to_update_ = L0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/make.h
----------------------------------------------------------------------
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/engine/make.h 
b/ext/kenlm/jam-files/engine/make.h
deleted file mode 100644
index 2c3ba16..0000000
--- a/ext/kenlm/jam-files/engine/make.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*
- * make.h - bring a target up to date, once rules are in place
- */
-
-#ifndef MAKE_SW20111118_H
-#define MAKE_SW20111118_H
-
-#include "lists.h"
-#include "object.h"
-#include "rules.h"
-
-int make( LIST * targets, int anyhow );
-int make1( LIST * t );
-
-typedef struct {
-    int temp;
-    int updating;
-    int cantfind;
-    int cantmake;
-    int targets;
-    int made;
-} COUNTS ;
-
-
-void make0( TARGET * t, TARGET * p, int depth, COUNTS * counts, int anyhow,
-    TARGET * rescanning );
-
-
-/* Specifies that the target should be updated. */
-void mark_target_for_updating( OBJECT * target );
-
-/* Returns targets previously passed to mark_target_for_updating(). */
-LIST * targets_to_update();
-
-/* Clears/unmarks all targets currently marked for update. */
-void clear_targets_to_update();
-
-#endif

Reply via email to