You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/04/19 21:34:11 UTC

[23/51] [partial] incubator-joshua git commit: Converted KenLM into a submodule

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/function.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/function.h b/ext/kenlm/jam-files/engine/function.h
deleted file mode 100644
index 64f26b3..0000000
--- a/ext/kenlm/jam-files/engine/function.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *  Copyright 2011 Steven Watanabe
- *  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)
- */
-
-#ifndef FUNCTION_SW20111123_H
-#define FUNCTION_SW20111123_H
-
-#include "object.h"
-#include "frames.h"
-#include "lists.h"
-#include "parse.h"
-#include "strings.h"
-
-typedef struct _function FUNCTION;
-typedef struct _stack STACK;
-
-STACK * stack_global( void );
-void stack_push( STACK * s, LIST * l );
-LIST * stack_pop( STACK * s );
-
-FUNCTION * function_compile( PARSE * parse );
-FUNCTION * function_builtin( LIST * ( * func )( FRAME * frame, int flags ), int flags, const char * * args );
-void function_refer( FUNCTION * );
-void function_free( FUNCTION * );
-OBJECT * function_rulename( FUNCTION * );
-void function_set_rulename( FUNCTION *, OBJECT * );
-void function_location( FUNCTION *, OBJECT * *, int * );
-LIST * function_run( FUNCTION * function, FRAME * frame, STACK * s );
-
-FUNCTION * function_compile_actions( const char * actions, OBJECT * file, int line );
-void function_run_actions( FUNCTION * function, FRAME * frame, STACK * s, string * out );
-
-FUNCTION * function_bind_variables( FUNCTION * f, module_t * module, int * counter );
-FUNCTION * function_unbind_variables( FUNCTION * f );
-
-void function_done( void );
-
-#ifdef HAVE_PYTHON
-
-FUNCTION * function_python( PyObject * function, PyObject * bjam_signature );
-
-#endif
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/glob.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/glob.c b/ext/kenlm/jam-files/engine/glob.c
deleted file mode 100644
index bec00ee..0000000
--- a/ext/kenlm/jam-files/engine/glob.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright 1994 Christopher Seiwald.  All rights reserved.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*
- * glob.c - match a string against a simple pattern
- *
- * Understands the following patterns:
- *
- *  *   any number of characters
- *  ?   any single character
- *  [a-z]   any single character in the range a-z
- *  [^a-z]  any single character not in the range a-z
- *  \x  match x
- *
- * External functions:
- *
- *  glob() - match a string against a simple pattern
- *
- * Internal functions:
- *
- *  globchars() - build a bitlist to check for character group match
- */
-
-# include "jam.h"
-
-# define CHECK_BIT( tab, bit ) ( tab[ (bit)/8 ] & (1<<( (bit)%8 )) )
-# define BITLISTSIZE 16 /* bytes used for [chars] in compiled expr */
-
-static void globchars( const char * s, const char * e, char * b );
-
-
-/*
- * glob() - match a string against a simple pattern.
- */
-
-int glob( const char * c, const char * s )
-{
-    char   bitlist[ BITLISTSIZE ];
-    const char * here;
-
-    for ( ; ; )
-    switch ( *c++ )
-    {
-    case '\0':
-        return *s ? -1 : 0;
-
-    case '?':
-        if ( !*s++ )
-            return 1;
-        break;
-
-    case '[':
-        /* Scan for matching ]. */
-
-        here = c;
-        do if ( !*c++ ) return 1;
-        while ( ( here == c ) || ( *c != ']' ) );
-        ++c;
-
-        /* Build character class bitlist. */
-
-        globchars( here, c, bitlist );
-
-        if ( !CHECK_BIT( bitlist, *(const unsigned char *)s ) )
-            return 1;
-        ++s;
-        break;
-
-    case '*':
-        here = s;
-
-        while ( *s )
-            ++s;
-
-        /* Try to match the rest of the pattern in a recursive */
-        /* call.  If the match fails we'll back up chars, retrying. */
-
-        while ( s != here )
-        {
-            int r;
-
-            /* A fast path for the last token in a pattern. */
-            r = *c ? glob( c, s ) : *s ? -1 : 0;
-
-            if ( !r )
-                return 0;
-            if ( r < 0 )
-                return 1;
-            --s;
-        }
-        break;
-
-    case '\\':
-        /* Force literal match of next char. */
-        if ( !*c || ( *s++ != *c++ ) )
-            return 1;
-        break;
-
-    default:
-        if ( *s++ != c[ -1 ] )
-            return 1;
-        break;
-    }
-}
-
-
-/*
- * globchars() - build a bitlist to check for character group match.
- */
-
-static void globchars( const char * s,  const char * e, char * b )
-{
-    int neg = 0;
-
-    memset( b, '\0', BITLISTSIZE  );
-
-    if ( *s == '^' )
-    {
-        ++neg;
-        ++s;
-    }
-
-    while ( s < e )
-    {
-        int c;
-
-        if ( ( s + 2 < e ) && ( s[1] == '-' ) )
-        {
-            for ( c = s[0]; c <= s[2]; ++c )
-                b[ c/8 ] |= ( 1 << ( c % 8 ) );
-            s += 3;
-        }
-        else
-        {
-            c = *s++;
-            b[ c/8 ] |= ( 1 << ( c % 8 ) );
-        }
-    }
-
-    if ( neg )
-    {
-        int i;
-        for ( i = 0; i < BITLISTSIZE; ++i )
-            b[ i ] ^= 0377;
-    }
-
-    /* Do not include \0 in either $[chars] or $[^chars]. */
-    b[0] &= 0376;
-}

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/hash.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/hash.c b/ext/kenlm/jam-files/engine/hash.c
deleted file mode 100644
index 36f8366..0000000
--- a/ext/kenlm/jam-files/engine/hash.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*
- * hash.c - simple in-memory hashing routines
- *
- * External routines:
- *     hashinit() - initialize a hash table, returning a handle
- *     hashitem() - find a record in the table, and optionally enter a new one
- *     hashdone() - free a hash table, given its handle
- *
- * Internal routines:
- *     hashrehash() - resize and rebuild hp->tab, the hash table
- */
-
-#include "jam.h"
-#include "hash.h"
-
-#include "compile.h"
-
-#include <assert.h>
-
-/* */
-#define HASH_DEBUG_PROFILE 1
-/* */
-
-/* Header attached to all hash table data items. */
-
-typedef struct item ITEM;
-struct item
-{
-    ITEM * next;
-};
-
-#define MAX_LISTS 32
-
-struct hash
-{
-    /*
-     * the hash table, just an array of item pointers
-     */
-    struct
-    {
-        int nel;
-        ITEM * * base;
-    } tab;
-
-    int bloat;  /* tab.nel / items.nel */
-    int inel;   /* initial number of elements */
-
-    /*
-     * the array of records, maintained by these routines - essentially a
-     * microallocator
-     */
-    struct
-    {
-        int more;     /* how many more ITEMs fit in lists[ list ] */
-        ITEM * free;  /* free list of items */
-        char * next;  /* where to put more ITEMs in lists[ list ] */
-        int size;     /* sizeof( ITEM ) + aligned datalen */
-        int nel;      /* total ITEMs held by all lists[] */
-        int list;     /* index into lists[] */
-
-        struct
-        {
-            int nel;      /* total ITEMs held by this list */
-            char * base;  /* base of ITEMs array */
-        } lists[ MAX_LISTS ];
-    } items;
-
-    char const * name;  /* just for hashstats() */
-};
-
-static void hashrehash( struct hash * );
-static void hashstat( struct hash * );
-
-static unsigned int hash_keyval( OBJECT * key )
-{
-    return object_hash( key );
-}
-
-#define hash_bucket(hp, keyval) ((hp)->tab.base + ((keyval) % (hp)->tab.nel))
-
-#define hash_data_key(data) (*(OBJECT * *)(data))
-#define hash_item_data(item) ((HASHDATA *)((char *)item + sizeof(ITEM)))
-#define hash_item_key(item) (hash_data_key(hash_item_data(item)))
-
-
-#define ALIGNED(x) ((x + sizeof(ITEM) - 1) & ~(sizeof(ITEM) - 1))
-
-/*
- * hashinit() - initialize a hash table, returning a handle
- */
-
-struct hash * hashinit( int datalen, char const * name )
-{
-    struct hash * hp = (struct hash *)BJAM_MALLOC( sizeof( *hp ) );
-
-    hp->bloat = 3;
-    hp->tab.nel = 0;
-    hp->tab.base = 0;
-    hp->items.more = 0;
-    hp->items.free = 0;
-    hp->items.size = sizeof( ITEM ) + ALIGNED( datalen );
-    hp->items.list = -1;
-    hp->items.nel = 0;
-    hp->inel = 11;  /* 47 */
-    hp->name = name;
-
-    return hp;
-}
-
-
-/*
- * hash_search() - Find the hash item for the given data.
- *
- * Returns a pointer to a hashed item with the given key. If given a 'previous'
- * pointer, makes it point to the item prior to the found item in the same
- * bucket or to 0 if our item is the first item in its bucket.
- */
-
-static ITEM * hash_search( struct hash * hp, unsigned int keyval,
-    OBJECT * keydata, ITEM * * previous )
-{
-    ITEM * i = *hash_bucket( hp, keyval );
-    ITEM * p = 0;
-    for ( ; i; i = i->next )
-    {
-        if ( object_equal( hash_item_key( i ), keydata ) )
-        {
-            if ( previous )
-                *previous = p;
-            return i;
-        }
-        p = i;
-    }
-    return 0;
-}
-
-
-/*
- * hash_insert() - insert a record in the table or return the existing one
- */
-
-HASHDATA * hash_insert( struct hash * hp, OBJECT * key, int * found )
-{
-    ITEM * i;
-    unsigned int keyval = hash_keyval( key );
-
-    #ifdef HASH_DEBUG_PROFILE
-    profile_frame prof[ 1 ];
-    if ( DEBUG_PROFILE )
-        profile_enter( 0, prof );
-    #endif
-
-    if ( !hp->items.more )
-        hashrehash( hp );
-
-    i = hash_search( hp, keyval, key, 0 );
-    if ( i )
-        *found = 1;
-    else
-    {
-        ITEM * * base = hash_bucket( hp, keyval );
-
-        /* Try to grab one from the free list. */
-        if ( hp->items.free )
-        {
-            i = hp->items.free;
-            hp->items.free = i->next;
-            assert( !hash_item_key( i ) );
-        }
-        else
-        {
-            i = (ITEM *)hp->items.next;
-            hp->items.next += hp->items.size;
-        }
-        --hp->items.more;
-        i->next = *base;
-        *base = i;
-        *found = 0;
-    }
-
-    #ifdef HASH_DEBUG_PROFILE
-    if ( DEBUG_PROFILE )
-        profile_exit( prof );
-    #endif
-
-    return hash_item_data( i );
-}
-
-
-/*
- * hash_find() - find a record in the table or NULL if none exists
- */
-
-HASHDATA * hash_find( struct hash * hp, OBJECT * key )
-{
-    ITEM * i;
-    unsigned int keyval = hash_keyval( key );
-
-    #ifdef HASH_DEBUG_PROFILE
-    profile_frame prof[ 1 ];
-    if ( DEBUG_PROFILE )
-        profile_enter( 0, prof );
-    #endif
-
-    if ( !hp->items.nel )
-    {
-        #ifdef HASH_DEBUG_PROFILE
-        if ( DEBUG_PROFILE )
-            profile_exit( prof );
-        #endif
-        return 0;
-    }
-
-    i = hash_search( hp, keyval, key, 0 );
-
-    #ifdef HASH_DEBUG_PROFILE
-    if ( DEBUG_PROFILE )
-        profile_exit( prof );
-    #endif
-
-    return i ? hash_item_data( i ) : 0;
-}
-
-
-/*
- * hashrehash() - resize and rebuild hp->tab, the hash table
- */
-
-static void hashrehash( struct hash * hp )
-{
-    int i = ++hp->items.list;
-    hp->items.more = i ? 2 * hp->items.nel : hp->inel;
-    hp->items.next = (char *)BJAM_MALLOC( hp->items.more * hp->items.size );
-    hp->items.free = 0;
-
-    hp->items.lists[ i ].nel = hp->items.more;
-    hp->items.lists[ i ].base = hp->items.next;
-    hp->items.nel += hp->items.more;
-
-    if ( hp->tab.base )
-        BJAM_FREE( (char *)hp->tab.base );
-
-    hp->tab.nel = hp->items.nel * hp->bloat;
-    hp->tab.base = (ITEM * *)BJAM_MALLOC( hp->tab.nel * sizeof( ITEM * * ) );
-
-    memset( (char *)hp->tab.base, '\0', hp->tab.nel * sizeof( ITEM * ) );
-
-    for ( i = 0; i < hp->items.list; ++i )
-    {
-        int nel = hp->items.lists[ i ].nel;
-        char * next = hp->items.lists[ i ].base;
-
-        for ( ; nel--; next += hp->items.size )
-        {
-            ITEM * i = (ITEM *)next;
-            ITEM * * ip = hp->tab.base + object_hash( hash_item_key( i ) ) %
-                hp->tab.nel;
-            /* code currently assumes rehashing only when there are no free
-             * items
-             */
-            assert( hash_item_key( i ) );
-
-            i->next = *ip;
-            *ip = i;
-        }
-    }
-}
-
-
-void hashenumerate( struct hash * hp, void (* f)( void *, void * ), void * data
-    )
-{
-    int i;
-    for ( i = 0; i <= hp->items.list; ++i )
-    {
-        char * next = hp->items.lists[ i ].base;
-        int nel = hp->items.lists[ i ].nel;
-        if ( i == hp->items.list )
-            nel -= hp->items.more;
-
-        for ( ; nel--; next += hp->items.size )
-        {
-            ITEM * const i = (ITEM *)next;
-            if ( hash_item_key( i ) != 0 )  /* Do not enumerate freed items. */
-                f( hash_item_data( i ), data );
-        }
-    }
-}
-
-
-/*
- * hash_free() - free a hash table, given its handle
- */
-
-void hash_free( struct hash * hp )
-{
-    int i;
-    if ( !hp )
-        return;
-    if ( hp->tab.base )
-        BJAM_FREE( (char *)hp->tab.base );
-    for ( i = 0; i <= hp->items.list; ++i )
-        BJAM_FREE( hp->items.lists[ i ].base );
-    BJAM_FREE( (char *)hp );
-}
-
-
-static void hashstat( struct hash * hp )
-{
-    struct hashstats stats[ 1 ];
-    hashstats_init( stats );
-    hashstats_add( stats, hp );
-    hashstats_print( stats, hp->name );
-}
-
-
-void hashstats_init( struct hashstats * stats )
-{
-    stats->count = 0;
-    stats->num_items = 0;
-    stats->tab_size = 0;
-    stats->item_size = 0;
-    stats->sets = 0;
-    stats->num_hashes = 0;
-}
-
-
-void hashstats_add( struct hashstats * stats, struct hash * hp )
-{
-    if ( hp )
-    {
-        ITEM * * tab = hp->tab.base;
-        int nel = hp->tab.nel;
-        int count = 0;
-        int sets = 0;
-        int i;
-
-        for ( i = 0; i < nel; ++i )
-        {
-            ITEM * item;
-            int here = 0;
-            for ( item = tab[ i ]; item; item = item->next )
-                ++here;
-
-            count += here;
-            if ( here > 0 )
-                ++sets;
-        }
-
-        stats->count += count;
-        stats->sets += sets;
-        stats->num_items += hp->items.nel;
-        stats->tab_size += hp->tab.nel;
-        stats->item_size = hp->items.size;
-        ++stats->num_hashes;
-    }
-}
-
-
-void hashstats_print( struct hashstats * stats, char const * name )
-{
-    printf( "%s table: %d+%d+%d (%dK+%luK+%luK) items+table+hash, %f density\n",
-        name,
-        stats->count,
-        stats->num_items,
-        stats->tab_size,
-        stats->num_items * stats->item_size / 1024,
-        (long unsigned)stats->tab_size * sizeof( ITEM * * ) / 1024,
-        (long unsigned)stats->num_hashes * sizeof( struct hash ) / 1024,
-        (float)stats->count / (float)stats->sets );
-}
-
-
-void hashdone( struct hash * hp )
-{
-    if ( !hp )
-        return;
-    if ( DEBUG_MEM || DEBUG_PROFILE )
-        hashstat( hp );
-    hash_free( hp );
-}

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/hash.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/hash.h b/ext/kenlm/jam-files/engine/hash.h
deleted file mode 100644
index 7c40e8c..0000000
--- a/ext/kenlm/jam-files/engine/hash.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*
- * hash.h - simple in-memory hashing routines
- */
-
-#ifndef BOOST_JAM_HASH_H
-#define BOOST_JAM_HASH_H
-
-#include "object.h"
-
-/*
- * An opaque struct representing an item in the hash table. The first element of
- * every struct stored in the table must be an OBJECT * which is treated as the
- * key.
- */
-typedef struct hashdata HASHDATA;
-
-/*
- * hashinit() - initialize a hash table, returning a handle.
- *
- * Parameters:
- *   datalen - item size
- *   name    - used for debugging
- */
-struct hash * hashinit( int datalen, char const * name );
-
-/*
- * hash_free() - free a hash table, given its handle
- */
-void hash_free( struct hash * );
-void hashdone( struct hash * );
-
-/*
- * hashenumerate() - call f(i, data) on each item, i in the hash table. The
- * enumeration order is unspecified.
- */
-void hashenumerate( struct hash *, void (* f)( void *, void * ), void * data );
-
-/*
- * hash_insert() - insert a new item in a hash table, or return an existing one.
- *
- * Preconditions:
- *   - hp must be a hash table created by hashinit()
- *   - key must be an object created by object_new()
- *
- * Postconditions:
- *   - if the key does not already exist in the hash table, *found == 0 and the
- *     result will be a pointer to an uninitialized item. The key of the new
- *     item must be set to a value equal to key before any further operations on
- *     the hash table except hashdone().
- *   - if the key is present then *found == 1 and the result is a pointer to the
- *     existing record.
- */
-HASHDATA * hash_insert( struct hash *, OBJECT * key, int * found );
-
-/*
- * hash_find() - find a record in the table or NULL if none exists
- */
-HASHDATA * hash_find( struct hash *, OBJECT * key );
-
-struct hashstats {
-    int count;
-    int num_items;
-    int tab_size;
-    int item_size;
-    int sets;
-    int num_hashes;
-};
-
-void hashstats_init( struct hashstats * stats );
-void hashstats_add( struct hashstats * stats, struct hash * );
-void hashstats_print( struct hashstats * stats, char const * name );
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/hcache.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/hcache.c b/ext/kenlm/jam-files/engine/hcache.c
deleted file mode 100644
index 3cf15f7..0000000
--- a/ext/kenlm/jam-files/engine/hcache.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * This file has been donated to Jam.
- */
-
-/*
- * Craig W. McPheeters, Alias|Wavefront.
- *
- * hcache.c hcache.h - handle cacheing of #includes in source files.
- *
- * Create a cache of files scanned for headers. When starting jam, look for the
- * cache file and load it if present. When finished the binding phase, create a
- * new header cache. The cache contains files, their timestamps and the header
- * files found in their scan. During the binding phase of jam, look in the
- * header cache first for the headers contained in a file. If the cache is
- * present and valid, use its contents. This results in dramatic speedups with
- * large projects (e.g. 3min -> 1min startup for one project.)
- *
- * External routines:
- *    hcache_init() - read and parse the local .jamdeps file.
- *    hcache_done() - write a new .jamdeps file.
- *    hcache()      - return list of headers on target. Use cache or do a scan.
- *
- * The dependency file format is an ASCII file with 1 line per target. Each line
- * has the following fields:
- * @boundname@ timestamp_sec timestamp_nsec @file@ @file@ @file@ ...
- */
-
-#ifdef OPT_HEADER_CACHE_EXT
-
-#include "jam.h"
-#include "hcache.h"
-
-#include "hash.h"
-#include "headers.h"
-#include "lists.h"
-#include "modules.h"
-#include "object.h"
-#include "parse.h"
-#include "regexp.h"
-#include "rules.h"
-#include "search.h"
-#include "timestamp.h"
-#include "variable.h"
-
-typedef struct hcachedata HCACHEDATA ;
-
-struct hcachedata
-{
-    OBJECT     * boundname;
-    timestamp    time;
-    LIST       * includes;
-    LIST       * hdrscan;    /* the HDRSCAN value for this target */
-    int          age;        /* if too old, we will remove it from cache */
-    HCACHEDATA * next;
-};
-
-
-static struct hash * hcachehash = 0;
-static HCACHEDATA * hcachelist = 0;
-
-static int queries = 0;
-static int hits = 0;
-
-#define CACHE_FILE_VERSION "version 5"
-#define CACHE_RECORD_HEADER "header"
-#define CACHE_RECORD_END "end"
-
-
-/*
- * Return the name of the header cache file. May return NULL.
- *
- * The user sets this by setting the HCACHEFILE variable in a Jamfile. We cache
- * the result so the user can not change the cache file during header scanning.
- */
-
-static const char * cache_name( void )
-{
-    static OBJECT * name = 0;
-    if ( !name )
-    {
-        LIST * const hcachevar = var_get( root_module(), constant_HCACHEFILE );
-
-        if ( !list_empty( hcachevar ) )
-        {
-            TARGET * const t = bindtarget( list_front( hcachevar ) );
-
-            pushsettings( root_module(), t->settings );
-            /* Do not expect the cache file to be generated, so pass 0 as the
-             * third argument to search. Expect the location to be specified via
-             * LOCATE, so pass 0 as the fourth arugment.
-             */
-            object_free( t->boundname );
-            t->boundname = search( t->name, &t->time, 0, 0 );
-            popsettings( root_module(), t->settings );
-
-            name = object_copy( t->boundname );
-        }
-    }
-    return name ? object_str( name ) : 0;
-}
-
-
-/*
- * Return the maximum age a cache entry can have before it is purged from the
- * cache.
- */
-
-static int cache_maxage( void )
-{
-    int age = 100;
-    LIST * const var = var_get( root_module(), constant_HCACHEMAXAGE );
-    if ( !list_empty( var ) )
-    {
-        age = atoi( object_str( list_front( var ) ) );
-        if ( age < 0 )
-            age = 0;
-    }
-    return age;
-}
-
-
-/*
- * Read a netstring. The caveat is that the string can not contain ASCII 0. The
- * returned value is as returned by object_new().
- */
-
-OBJECT * read_netstring( FILE * f )
-{
-    unsigned long len;
-    static char * buf = NULL;
-    static unsigned long buf_len = 0;
-
-    if ( fscanf( f, " %9lu", &len ) != 1 )
-        return NULL;
-    if ( fgetc( f ) != (int)'\t' )
-        return NULL;
-
-    if ( len > 1024 * 64 )
-        return NULL;  /* sanity check */
-
-    if ( len > buf_len )
-    {
-        unsigned long new_len = buf_len * 2;
-        if ( new_len < len )
-            new_len = len;
-        buf = (char *)BJAM_REALLOC( buf, new_len + 1 );
-        if ( buf )
-            buf_len = new_len;
-    }
-
-    if ( !buf )
-        return NULL;
-
-    if ( fread( buf, 1, len, f ) != len )
-        return NULL;
-    if ( fgetc( f ) != (int)'\n' )
-        return NULL;
-
-    buf[ len ] = 0;
-    return object_new( buf );
-}
-
-
-/*
- * Write a netstring.
- */
-
-void write_netstring( FILE * f, char const * s )
-{
-    if ( !s )
-        s = "";
-    fprintf( f, "%lu\t%s\n", (long unsigned)strlen( s ), s );
-}
-
-
-void hcache_init()
-{
-    FILE       * f;
-    OBJECT     * version = 0;
-    int          header_count = 0;
-    const char * hcachename;
-
-    if ( hcachehash )
-        return;
-
-    hcachehash = hashinit( sizeof( HCACHEDATA ), "hcache" );
-
-    if ( !( hcachename = cache_name() ) )
-        return;
-
-    if ( !( f = fopen( hcachename, "rb" ) ) )
-        return;
-
-    version = read_netstring( f );
-
-    if ( !version || strcmp( object_str( version ), CACHE_FILE_VERSION ) )
-        goto bail;
-
-    while ( 1 )
-    {
-        HCACHEDATA   cachedata;
-        HCACHEDATA * c;
-        OBJECT * record_type = 0;
-        OBJECT * time_secs_str = 0;
-        OBJECT * time_nsecs_str = 0;
-        OBJECT * age_str = 0;
-        OBJECT * includes_count_str = 0;
-        OBJECT * hdrscan_count_str = 0;
-        int      i;
-        int      count;
-        LIST   * l;
-        int      found;
-
-        cachedata.boundname = 0;
-        cachedata.includes = 0;
-        cachedata.hdrscan = 0;
-
-        record_type = read_netstring( f );
-        if ( !record_type )
-        {
-            fprintf( stderr, "invalid %s\n", hcachename );
-            goto cleanup;
-        }
-        if ( !strcmp( object_str( record_type ), CACHE_RECORD_END ) )
-        {
-            object_free( record_type );
-            break;
-        }
-        if ( strcmp( object_str( record_type ), CACHE_RECORD_HEADER ) )
-        {
-            fprintf( stderr, "invalid %s with record separator <%s>\n",
-                hcachename, record_type ? object_str( record_type ) : "<null>" );
-            goto cleanup;
-        }
-
-        cachedata.boundname = read_netstring( f );
-        time_secs_str       = read_netstring( f );
-        time_nsecs_str      = read_netstring( f );
-        age_str             = read_netstring( f );
-        includes_count_str  = read_netstring( f );
-
-        if ( !cachedata.boundname || !time_secs_str || !time_nsecs_str ||
-            !age_str || !includes_count_str )
-        {
-            fprintf( stderr, "invalid %s\n", hcachename );
-            goto cleanup;
-        }
-
-        timestamp_init( &cachedata.time, atoi( object_str( time_secs_str ) ),
-            atoi( object_str( time_nsecs_str ) ) );
-        cachedata.age = atoi( object_str( age_str ) ) + 1;
-
-        count = atoi( object_str( includes_count_str ) );
-        for ( l = L0, i = 0; i < count; ++i )
-        {
-            OBJECT * const s = read_netstring( f );
-            if ( !s )
-            {
-                fprintf( stderr, "invalid %s\n", hcachename );
-                list_free( l );
-                goto cleanup;
-            }
-            l = list_push_back( l, s );
-        }
-        cachedata.includes = l;
-
-        hdrscan_count_str = read_netstring( f );
-        if ( !hdrscan_count_str )
-        {
-            fprintf( stderr, "invalid %s\n", hcachename );
-            goto cleanup;
-        }
-
-        count = atoi( object_str( hdrscan_count_str ) );
-        for ( l = L0, i = 0; i < count; ++i )
-        {
-            OBJECT * const s = read_netstring( f );
-            if ( !s )
-            {
-                fprintf( stderr, "invalid %s\n", hcachename );
-                list_free( l );
-                goto cleanup;
-            }
-            l = list_push_back( l, s );
-        }
-        cachedata.hdrscan = l;
-
-        c = (HCACHEDATA *)hash_insert( hcachehash, cachedata.boundname, &found )
-            ;
-        if ( !found )
-        {
-            c->boundname = cachedata.boundname;
-            c->includes  = cachedata.includes;
-            c->hdrscan   = cachedata.hdrscan;
-            c->age       = cachedata.age;
-            timestamp_copy( &c->time, &cachedata.time );
-        }
-        else
-        {
-            fprintf( stderr, "can not insert header cache item, bailing on %s"
-                "\n", hcachename );
-            goto cleanup;
-        }
-
-        c->next = hcachelist;
-        hcachelist = c;
-
-        ++header_count;
-
-        object_free( record_type );
-        object_free( time_secs_str );
-        object_free( time_nsecs_str );
-        object_free( age_str );
-        object_free( includes_count_str );
-        object_free( hdrscan_count_str );
-        continue;
-
-cleanup:
-
-        if ( record_type ) object_free( record_type );
-        if ( time_secs_str ) object_free( time_secs_str );
-        if ( time_nsecs_str ) object_free( time_nsecs_str );
-        if ( age_str ) object_free( age_str );
-        if ( includes_count_str ) object_free( includes_count_str );
-        if ( hdrscan_count_str ) object_free( hdrscan_count_str );
-
-        if ( cachedata.boundname ) object_free( cachedata.boundname );
-        if ( cachedata.includes ) list_free( cachedata.includes );
-        if ( cachedata.hdrscan ) list_free( cachedata.hdrscan );
-
-        goto bail;
-    }
-
-    if ( DEBUG_HEADER )
-        printf( "hcache read from file %s\n", hcachename );
-
-bail:
-    if ( version )
-        object_free( version );
-    fclose( f );
-}
-
-
-void hcache_done()
-{
-    FILE       * f;
-    HCACHEDATA * c;
-    int          header_count = 0;
-    const char * hcachename;
-    int          maxage;
-
-    if ( !hcachehash )
-        return;
-
-    if ( !( hcachename = cache_name() ) )
-        goto cleanup;
-
-    if ( !( f = fopen( hcachename, "wb" ) ) )
-        goto cleanup;
-
-    maxage = cache_maxage();
-
-    /* Print out the version. */
-    write_netstring( f, CACHE_FILE_VERSION );
-
-    c = hcachelist;
-    for ( c = hcachelist; c; c = c->next )
-    {
-        LISTITER iter;
-        LISTITER end;
-        char time_secs_str[ 30 ];
-        char time_nsecs_str[ 30 ];
-        char age_str[ 30 ];
-        char includes_count_str[ 30 ];
-        char hdrscan_count_str[ 30 ];
-
-        if ( maxage == 0 )
-            c->age = 0;
-        else if ( c->age > maxage )
-            continue;
-
-        sprintf( includes_count_str, "%lu", (long unsigned)list_length(
-            c->includes ) );
-        sprintf( hdrscan_count_str, "%lu", (long unsigned)list_length(
-            c->hdrscan ) );
-        sprintf( time_secs_str, "%lu", (long unsigned)c->time.secs );
-        sprintf( time_nsecs_str, "%lu", (long unsigned)c->time.nsecs );
-        sprintf( age_str, "%lu", (long unsigned)c->age );
-
-        write_netstring( f, CACHE_RECORD_HEADER );
-        write_netstring( f, object_str( c->boundname ) );
-        write_netstring( f, time_secs_str );
-        write_netstring( f, time_nsecs_str );
-        write_netstring( f, age_str );
-        write_netstring( f, includes_count_str );
-        for ( iter = list_begin( c->includes ), end = list_end( c->includes );
-            iter != end; iter = list_next( iter ) )
-            write_netstring( f, object_str( list_item( iter ) ) );
-        write_netstring( f, hdrscan_count_str );
-        for ( iter = list_begin( c->hdrscan ), end = list_end( c->hdrscan );
-            iter != end; iter = list_next( iter ) )
-            write_netstring( f, object_str( list_item( iter ) ) );
-        fputs( "\n", f );
-        ++header_count;
-    }
-    write_netstring( f, CACHE_RECORD_END );
-
-    if ( DEBUG_HEADER )
-        printf( "hcache written to %s.   %d dependencies, %.0f%% hit rate\n",
-            hcachename, header_count, queries ? 100.0 * hits / queries : 0 );
-
-    fclose ( f );
-
-cleanup:
-    for ( c = hcachelist; c; c = c->next )
-    {
-        list_free( c->includes );
-        list_free( c->hdrscan );
-        object_free( c->boundname );
-    }
-
-    hcachelist = 0;
-    if ( hcachehash )
-        hashdone( hcachehash );
-    hcachehash = 0;
-}
-
-
-LIST * hcache( TARGET * t, int rec, regexp * re[], LIST * hdrscan )
-{
-    HCACHEDATA * c;
-
-    ++queries;
-
-    if ( ( c = (HCACHEDATA *)hash_find( hcachehash, t->boundname ) ) )
-    {
-        if ( !timestamp_cmp( &c->time, &t->time ) )
-        {
-            LIST * const l1 = hdrscan;
-            LIST * const l2 = c->hdrscan;
-            LISTITER iter1 = list_begin( l1 );
-            LISTITER const end1 = list_end( l1 );
-            LISTITER iter2 = list_begin( l2 );
-            LISTITER const end2 = list_end( l2 );
-            while ( iter1 != end1 && iter2 != end2 )
-            {
-                if ( !object_equal( list_item( iter1 ), list_item( iter2 ) ) )
-                    iter1 = end1;
-                else
-                {
-                    iter1 = list_next( iter1 );
-                    iter2 = list_next( iter2 );
-                }
-            }
-            if ( iter1 != end1 || iter2 != end2 )
-            {
-                if ( DEBUG_HEADER )
-                {
-                    printf( "HDRSCAN out of date in cache for %s\n",
-                        object_str( t->boundname ) );
-                    printf(" real  : ");
-                    list_print( hdrscan );
-                    printf( "\n cached: " );
-                    list_print( c->hdrscan );
-                    printf( "\n" );
-                }
-
-                list_free( c->includes );
-                list_free( c->hdrscan );
-                c->includes = L0;
-                c->hdrscan = L0;
-            }
-            else
-            {
-                if ( DEBUG_HEADER )
-                    printf( "using header cache for %s\n", object_str(
-                        t->boundname ) );
-                c->age = 0;
-                ++hits;
-                return list_copy( c->includes );
-            }
-        }
-        else
-        {
-            if ( DEBUG_HEADER )
-                printf ("header cache out of date for %s\n", object_str(
-                    t->boundname ) );
-            list_free( c->includes );
-            list_free( c->hdrscan );
-            c->includes = L0;
-            c->hdrscan = L0;
-        }
-    }
-    else
-    {
-        int found;
-        c = (HCACHEDATA *)hash_insert( hcachehash, t->boundname, &found );
-        if ( !found )
-        {
-            c->boundname = object_copy( t->boundname );
-            c->next = hcachelist;
-            hcachelist = c;
-        }
-    }
-
-    /* 'c' points at the cache entry. Its out of date. */
-    {
-        LIST * const l = headers1( L0, t->boundname, rec, re );
-
-        timestamp_copy( &c->time, &t->time );
-        c->age = 0;
-        c->includes = list_copy( l );
-        c->hdrscan = list_copy( hdrscan );
-
-        return l;
-    }
-}
-
-#endif  /* OPT_HEADER_CACHE_EXT */

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/hcache.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/hcache.h b/ext/kenlm/jam-files/engine/hcache.h
deleted file mode 100644
index a9d929d..0000000
--- a/ext/kenlm/jam-files/engine/hcache.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * This file is not part of Jam
- */
-
-/*
- * hcache.h - handle #includes in source files
- */
-#ifndef HCACHE_H
-#define HCACHE_H
-
-#include "lists.h"
-#include "regexp.h"
-#include "rules.h"
-
-void hcache_init( void );
-void hcache_done( void );
-LIST * hcache( TARGET * t, int rec, regexp * re[], LIST * hdrscan );
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/hdrmacro.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/hdrmacro.c b/ext/kenlm/jam-files/engine/hdrmacro.c
deleted file mode 100644
index eb4fe90..0000000
--- a/ext/kenlm/jam-files/engine/hdrmacro.c
+++ /dev/null
@@ -1,139 +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)
- */
-
-/*
- * hdrmacro.c - handle header files that define macros used in #include
- *              statements.
- *
- *  we look for lines like "#define MACRO  <....>" or '#define MACRO  "    "' in
- *  the target file. When found, we then phony up a rule invocation like:
- *
- *  $(HDRRULE) <target> : <resolved included files> ;
- *
- * External routines:
- *    headers1() - scan a target for "#include MACRO" lines and try to resolve
- *                 them when needed
- *
- * Internal routines:
- *    headers1() - using regexp, scan a file and build include LIST
- */
-
-#include "jam.h"
-#include "hdrmacro.h"
-
-#include "compile.h"
-#include "hash.h"
-#include "lists.h"
-#include "object.h"
-#include "parse.h"
-#include "rules.h"
-#include "strings.h"
-#include "subst.h"
-#include "variable.h"
-
-
-/* this type is used to store a dictionary of file header macros */
-typedef struct header_macro
-{
-  OBJECT * symbol;
-  OBJECT * filename;  /* we could maybe use a LIST here ?? */
-} HEADER_MACRO;
-
-static struct hash * header_macros_hash = 0;
-
-
-/*
- * headers() - scan a target for include files and call HDRRULE
- */
-
-#define MAXINC 10
-
-void macro_headers( TARGET * t )
-{
-    static regexp * re = 0;
-    FILE * f;
-    char buf[ 1024 ];
-
-    if ( DEBUG_HEADER )
-        printf( "macro header scan for %s\n", object_str( t->name ) );
-
-    /* This regexp is used to detect lines of the form
-     * "#define  MACRO  <....>" or "#define  MACRO  "....."
-     * in the header macro files.
-     */
-    if ( !re )
-    {
-        OBJECT * const re_str = object_new(
-            "^[     ]*#[    ]*define[   ]*([A-Za-z][A-Za-z0-9_]*)[  ]*"
-            "[<\"]([^\">]*)[\">].*$" );
-        re = regex_compile( re_str );
-        object_free( re_str );
-    }
-
-    if ( !( f = fopen( object_str( t->boundname ), "r" ) ) )
-        return;
-
-    while ( fgets( buf, sizeof( buf ), f ) )
-    {
-        HEADER_MACRO var;
-        HEADER_MACRO * v = &var;
-
-        if ( regexec( re, buf ) && re->startp[ 1 ] )
-        {
-            OBJECT * symbol;
-            int found;
-            /* we detected a line that looks like "#define  MACRO  filename */
-            ( (char *)re->endp[ 1 ] )[ 0 ] = '\0';
-            ( (char *)re->endp[ 2 ] )[ 0 ] = '\0';
-
-            if ( DEBUG_HEADER )
-                printf( "macro '%s' used to define filename '%s' in '%s'\n",
-                    re->startp[ 1 ], re->startp[ 2 ], object_str( t->boundname )
-                    );
-
-            /* add macro definition to hash table */
-            if ( !header_macros_hash )
-                header_macros_hash = hashinit( sizeof( HEADER_MACRO ),
-                    "hdrmacros" );
-
-            symbol = object_new( re->startp[ 1 ] );
-            v = (HEADER_MACRO *)hash_insert( header_macros_hash, symbol, &found
-                );
-            if ( !found )
-            {
-                v->symbol = symbol;
-                v->filename = object_new( re->startp[ 2 ] );  /* never freed */
-            }
-            else
-                object_free( symbol );
-            /* XXXX: FOR NOW, WE IGNORE MULTIPLE MACRO DEFINITIONS !! */
-            /*       WE MIGHT AS WELL USE A LIST TO STORE THEM..      */
-        }
-    }
-
-    fclose( f );
-}
-
-
-OBJECT * macro_header_get( OBJECT * macro_name )
-{
-    HEADER_MACRO * v;
-    if ( header_macros_hash && ( v = (HEADER_MACRO *)hash_find(
-        header_macros_hash, macro_name ) ) )
-    {
-        if ( DEBUG_HEADER )
-            printf( "### macro '%s' evaluated to '%s'\n", object_str( macro_name
-                ), object_str( v->filename ) );
-        return v->filename;
-    }
-    return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/hdrmacro.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/hdrmacro.h b/ext/kenlm/jam-files/engine/hdrmacro.h
deleted file mode 100644
index 7595ede..0000000
--- a/ext/kenlm/jam-files/engine/hdrmacro.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*
- * hdrmacro.h - parses header files for #define MACRO  <filename> or
- *              #define MACRO  "filename" definitions
- */
-
-#ifndef HDRMACRO_SW20111118_H
-#define HDRMACRO_SW20111118_H
-
-#include "object.h"
-#include "rules.h"
-
-void macro_headers( TARGET * );
-OBJECT * macro_header_get( OBJECT * macro_name );
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/headers.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/headers.c b/ext/kenlm/jam-files/engine/headers.c
deleted file mode 100644
index 0d9558d..0000000
--- a/ext/kenlm/jam-files/engine/headers.c
+++ /dev/null
@@ -1,197 +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)
- */
-
-/*
- * headers.c - handle #includes in source files
- *
- * Using regular expressions provided as the variable $(HDRSCAN), headers()
- * searches a file for #include files and phonies up a rule invocation:
- *    $(HDRRULE) <target> : <include files> ;
- *
- * External routines:
- *    headers() - scan a target for include files and call HDRRULE
- *
- * Internal routines:
- *    headers1() - using regexp, scan a file and build include LIST
- */
-
-#include "jam.h"
-#include "headers.h"
-
-#include "compile.h"
-#include "hdrmacro.h"
-#include "lists.h"
-#include "modules.h"
-#include "object.h"
-#include "parse.h"
-#include "rules.h"
-#include "subst.h"
-#include "variable.h"
-
-#ifdef OPT_HEADER_CACHE_EXT
-# include "hcache.h"
-#endif
-
-#ifndef OPT_HEADER_CACHE_EXT
-static LIST * headers1( LIST *, OBJECT * file, int rec, regexp * re[] );
-#endif
-
-
-/*
- * headers() - scan a target for include files and call HDRRULE
- */
-
-#define MAXINC 10
-
-void headers( TARGET * t )
-{
-    LIST   * hdrscan;
-    LIST   * hdrrule;
-    #ifndef OPT_HEADER_CACHE_EXT
-    LIST   * headlist = L0;
-    #endif
-    regexp * re[ MAXINC ];
-    int rec = 0;
-    LISTITER iter;
-    LISTITER end;
-
-    hdrscan = var_get( root_module(), constant_HDRSCAN );
-    if ( list_empty( hdrscan ) )
-        return;
-
-    hdrrule = var_get( root_module(), constant_HDRRULE );
-    if ( list_empty( hdrrule ) )
-        return;
-
-    if ( DEBUG_HEADER )
-        printf( "header scan %s\n", object_str( t->name ) );
-
-    /* Compile all regular expressions in HDRSCAN */
-    iter = list_begin( hdrscan );
-    end = list_end( hdrscan );
-    for ( ; ( rec < MAXINC ) && iter != end; iter = list_next( iter ) )
-    {
-        re[ rec++ ] = regex_compile( list_item( iter ) );
-    }
-
-    /* Doctor up call to HDRRULE rule */
-    /* Call headers1() to get LIST of included files. */
-    {
-        FRAME frame[ 1 ];
-        frame_init( frame );
-        lol_add( frame->args, list_new( object_copy( t->name ) ) );
-#ifdef OPT_HEADER_CACHE_EXT
-        lol_add( frame->args, hcache( t, rec, re, hdrscan ) );
-#else
-        lol_add( frame->args, headers1( headlist, t->boundname, rec, re ) );
-#endif
-
-        if ( lol_get( frame->args, 1 ) )
-        {
-            OBJECT * rulename = list_front( hdrrule );
-            /* The third argument to HDRRULE is the bound name of $(<). */
-            lol_add( frame->args, list_new( object_copy( t->boundname ) ) );
-            list_free( evaluate_rule( bindrule( rulename, frame->module ), rulename, frame ) );
-        }
-
-        /* Clean up. */
-        frame_free( frame );
-    }
-}
-
-
-/*
- * headers1() - using regexp, scan a file and build include LIST.
- */
-
-#ifndef OPT_HEADER_CACHE_EXT
-static
-#endif
-LIST * headers1( LIST * l, OBJECT * file, int rec, regexp * re[] )
-{
-    FILE * f;
-    char buf[ 1024 ];
-    int i;
-    static regexp * re_macros = 0;
-
-#ifdef OPT_IMPROVED_PATIENCE_EXT
-    static int count = 0;
-    ++count;
-    if ( ( ( count == 100 ) || !( count % 1000 ) ) && DEBUG_MAKE )
-    {
-        printf( "...patience...\n" );
-        fflush( stdout );
-    }
-#endif
-
-    /* The following regexp is used to detect cases where a file is included
-     * through a line like "#include MACRO".
-     */
-    if ( re_macros == 0 )
-    {
-        OBJECT * const re_str = object_new(
-            "#[ \t]*include[ \t]*([A-Za-z][A-Za-z0-9_]*).*$" );
-        re_macros = regex_compile( re_str );
-        object_free( re_str );
-    }
-
-    if ( !( f = fopen( object_str( file ), "r" ) ) )
-        return l;
-
-    while ( fgets( buf, sizeof( buf ), f ) )
-    {
-        for ( i = 0; i < rec; ++i )
-            if ( regexec( re[ i ], buf ) && re[ i ]->startp[ 1 ] )
-            {
-                ( (char *)re[ i ]->endp[ 1 ] )[ 0 ] = '\0';
-                if ( DEBUG_HEADER )
-                    printf( "header found: %s\n", re[ i ]->startp[ 1 ] );
-                l = list_push_back( l, object_new( re[ i ]->startp[ 1 ] ) );
-            }
-
-        /* Special treatment for #include MACRO. */
-        if ( regexec( re_macros, buf ) && re_macros->startp[ 1 ] )
-        {
-            OBJECT * header_filename;
-            OBJECT * macro_name;
-
-            ( (char *)re_macros->endp[ 1 ] )[ 0 ] = '\0';
-
-            if ( DEBUG_HEADER )
-                printf( "macro header found: %s", re_macros->startp[ 1 ] );
-
-            macro_name = object_new( re_macros->startp[ 1 ] );
-            header_filename = macro_header_get( macro_name );
-            object_free( macro_name );
-            if ( header_filename )
-            {
-                if ( DEBUG_HEADER )
-                    printf( " resolved to '%s'\n", object_str( header_filename )
-                        );
-                l = list_push_back( l, object_copy( header_filename ) );
-            }
-            else
-            {
-                if ( DEBUG_HEADER )
-                    printf( " ignored !!\n" );
-            }
-        }
-    }
-
-    fclose( f );
-    return l;
-}
-
-
-void regerror( char const * s )
-{
-    printf( "re error %s\n", s );
-}

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/headers.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/headers.h b/ext/kenlm/jam-files/engine/headers.h
deleted file mode 100644
index 1c0a642..0000000
--- a/ext/kenlm/jam-files/engine/headers.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 1993, 1995 Christopher Seiwald.
- *
- * This file is part of Jam - see jam.c for Copyright information.
- */
-
-/*
- * headers.h - handle #includes in source files
- */
-
-#ifndef HEADERS_SW20111118_H
-#define HEADERS_SW20111118_H
-
-#include "object.h"
-#include "rules.h"
-#include "regexp.h"
-
-void headers( TARGET * t );
-
-#ifdef OPT_HEADER_CACHE_EXT
-struct regexp;
-LIST * headers1( LIST *l, OBJECT * file, int rec, struct regexp *re[] );
-#endif
-
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/jam.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/jam.c b/ext/kenlm/jam-files/engine/jam.c
deleted file mode 100644
index 1c80eec..0000000
--- a/ext/kenlm/jam-files/engine/jam.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * /+\
- * +\   Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
- * \+/
- *
- * This file is part of jam.
- *
- * License is hereby granted to use this software and distribute it freely, as
- * long as this copyright notice is retained and modifications are clearly
- * marked.
- *
- * ALL WARRANTIES ARE HEREBY DISCLAIMED.
- */
-
-/* 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 copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- */
-
-/*
- * jam.c - make redux
- *
- * See Jam.html for usage information.
- *
- * These comments document the code.
- *
- * The top half of the code is structured such:
- *
- *                       jam
- *                      / | \
- *                 +---+  |  \
- *                /       |   \
- *         jamgram     option  \
- *        /  |   \              \
- *       /   |    \              \
- *      /    |     \             |
- *  scan     |     compile      make
- *   |       |    /  | \       / |  \
- *   |       |   /   |  \     /  |   \
- *   |       |  /    |   \   /   |    \
- * jambase parse     |   rules  search make1
- *                   |           |      |   \
- *                   |           |      |    \
- *                   |           |      |     \
- *               builtins    timestamp command execute
- *                               |
- *                               |
- *                               |
- *                             filesys
- *
- *
- * The support routines are called by all of the above, but themselves are
- * layered thus:
- *
- *                     variable|expand
- *                      /      |   |
- *                     /       |   |
- *                    /        |   |
- *                 lists       |   pathsys
- *                    \        |
- *                     \      hash
- *                      \      |
- *                       \     |
- *                        \    |
- *                         \   |
- *                          \  |
- *                         object
- *
- * Roughly, the modules are:
- *
- *  builtins.c - jam's built-in rules
- *  command.c - maintain lists of commands
- *  compile.c - compile parsed jam statements
- *  exec*.c - execute a shell script on a specific OS
- *  file*.c - scan directories and archives on a specific OS
- *  hash.c - simple in-memory hashing routines
- *  hdrmacro.c - handle header file parsing for filename macro definitions
- *  headers.c - handle #includes in source files
- *  jambase.c - compilable copy of Jambase
- *  jamgram.y - jam grammar
- *  lists.c - maintain lists of strings
- *  make.c - bring a target up to date, once rules are in place
- *  make1.c - execute command to bring targets up to date
- *  object.c - string manipulation routines
- *  option.c - command line option processing
- *  parse.c - make and destroy parse trees as driven by the parser
- *  path*.c - manipulate file names on a specific OS
- *  hash.c - simple in-memory hashing routines
- *  regexp.c - Henry Spencer's regexp
- *  rules.c - access to RULEs, TARGETs, and ACTIONs
- *  scan.c - the jam yacc scanner
- *  search.c - find a target along $(SEARCH) or $(LOCATE)
- *  timestamp.c - get the timestamp of a file or archive member
- *  variable.c - handle jam multi-element variables
- */
-
-
-#include "jam.h"
-#include "patchlevel.h"
-
-#include "builtins.h"
-#include "class.h"
-#include "compile.h"
-#include "constants.h"
-#include "filesys.h"
-#include "function.h"
-#include "hcache.h"
-#include "lists.h"
-#include "make.h"
-#include "object.h"
-#include "option.h"
-#include "output.h"
-#include "parse.h"
-#include "cwd.h"
-#include "rules.h"
-#include "scan.h"
-#include "search.h"
-#include "strings.h"
-#include "timestamp.h"
-#include "variable.h"
-
-/* Macintosh is "special" */
-#ifdef OS_MAC
-# include <QuickDraw.h>
-#endif
-
-/* And UNIX for this. */
-#ifdef unix
-# include <sys/utsname.h>
-# include <signal.h>
-#endif
-
-struct globs globs =
-{
-    0,          /* noexec */
-    1,          /* jobs */
-    0,          /* quitquick */
-    0,          /* newestfirst */
-    0,          /* pipes action stdout and stderr merged to action output */
-#ifdef OS_MAC
-    { 0, 0 },   /* debug - suppress tracing output */
-#else
-    { 0, 1 },   /* debug ... */
-#endif
-    0,          /* output commands, not run them */
-    0,          /* action timeout */
-    0           /* maximum buffer size zero is all output */
-};
-
-/* Symbols to be defined as true for use in Jambase. */
-static char * othersyms[] = { OSMAJOR, OSMINOR, OSPLAT, JAMVERSYM, 0 };
-
-
-/* Known for sure:
- *  mac needs arg_enviro
- *  OS2 needs extern environ
- */
-
-#ifdef OS_MAC
-# define use_environ arg_environ
-# ifdef MPW
-    QDGlobals qd;
-# endif
-#endif
-
-/* on Win32-LCC */
-#if defined( OS_NT ) && defined( __LCC__ )
-# define use_environ _environ
-#endif
-
-#if defined( __MWERKS__)
-# define use_environ _environ
-    extern char * * _environ;
-#endif
-
-#ifndef use_environ
-# define use_environ environ
-# if !defined( __WATCOM__ ) && !defined( OS_OS2 ) && !defined( OS_NT )
-    extern char **environ;
-# endif
-#endif
-
-#if YYDEBUG != 0
-    extern int yydebug;
-#endif
-
-#ifndef NDEBUG
-static void run_unit_tests()
-{
-# if defined( USE_EXECNT )
-    extern void execnt_unit_test();
-    execnt_unit_test();
-# endif
-    string_unit_test();
-}
-#endif
-
-int anyhow = 0;
-
-#ifdef HAVE_PYTHON
-    extern PyObject * bjam_call         ( PyObject * self, PyObject * args );
-    extern PyObject * bjam_import_rule  ( PyObject * self, PyObject * args );
-    extern PyObject * bjam_define_action( PyObject * self, PyObject * args );
-    extern PyObject * bjam_variable     ( PyObject * self, PyObject * args );
-    extern PyObject * bjam_backtrace    ( PyObject * self, PyObject * args );
-    extern PyObject * bjam_caller       ( PyObject * self, PyObject * args );
-#endif
-
-void regex_done();
-
-char const * saved_argv0;
-
-int main( int argc, char * * argv, char * * arg_environ )
-{
-    int                     n;
-    char                  * s;
-    struct bjam_option      optv[ N_OPTS ];
-    char            const * all = "all";
-    int                     status;
-    int                     arg_c = argc;
-    char          *       * arg_v = argv;
-    char            const * progname = argv[ 0 ];
-    module_t              * environ_module;
-
-    saved_argv0 = argv[ 0 ];
-
-    BJAM_MEM_INIT();
-
-#ifdef OS_MAC
-    InitGraf( &qd.thePort );
-#endif
-
-    --argc;
-    ++argv;
-
-    if ( getoptions( argc, argv, "-:l:m:d:j:p:f:gs:t:ano:qv", optv ) < 0 )
-    {
-        printf( "\nusage: %s [ options ] targets...\n\n", progname );
-
-        printf( "-a      Build all targets, even if they are current.\n" );
-        printf( "-dx     Set the debug level to x (0-9).\n" );
-        printf( "-fx     Read x instead of Jambase.\n" );
-        /* printf( "-g      Build from newest sources first.\n" ); */
-        printf( "-jx     Run up to x shell commands concurrently.\n" );
-        printf( "-lx     Limit actions to x number of seconds after which they are stopped.\n" );
-        printf( "-mx     Maximum target output saved (kb), default is to save all output.\n" );
-        printf( "-n      Don't actually execute the updating actions.\n" );
-        printf( "-ox     Write the updating actions to file x.\n" );
-        printf( "-px     x=0, pipes action stdout and stderr merged into action output.\n" );
-        printf( "-q      Quit quickly as soon as a target fails.\n" );
-        printf( "-sx=y   Set variable x=y, overriding environment.\n" );
-        printf( "-tx     Rebuild x, even if it is up-to-date.\n" );
-        printf( "-v      Print the version of jam and exit.\n" );
-        printf( "--x     Option is ignored.\n\n" );
-
-        exit( EXITBAD );
-    }
-
-    /* Version info. */
-    if ( ( s = getoptval( optv, 'v', 0 ) ) )
-    {
-        printf( "Boost.Jam  Version %s. %s.\n", VERSION, OSMINOR );
-        printf( "   Copyright 1993-2002 Christopher Seiwald and Perforce "
-            "Software, Inc.\n" );
-        printf( "   Copyright 2001 David Turner.\n" );
-        printf( "   Copyright 2001-2004 David Abrahams.\n" );
-        printf( "   Copyright 2002-2008 Rene Rivera.\n" );
-        printf( "   Copyright 2003-2008 Vladimir Prus.\n" );
-        return EXITOK;
-    }
-
-    /* Pick up interesting options. */
-    if ( ( s = getoptval( optv, 'n', 0 ) ) )
-    {
-        ++globs.noexec;
-        globs.debug[ 2 ] = 1;
-    }
-
-    if ( ( s = getoptval( optv, 'p', 0 ) ) )
-    {
-        /* Undocumented -p3 (acts like both -p1 -p2) means separate pipe action
-         * stdout and stderr.
-         */
-        globs.pipe_action = atoi( s );
-        if ( globs.pipe_action < 0 || 3 < globs.pipe_action )
-        {
-            printf( "Invalid pipe descriptor '%d', valid values are -p[0..3]."
-                "\n", globs.pipe_action );
-            exit( EXITBAD );
-        }
-    }
-
-    if ( ( s = getoptval( optv, 'q', 0 ) ) )
-        globs.quitquick = 1;
-
-    if ( ( s = getoptval( optv, 'a', 0 ) ) )
-        anyhow++;
-
-    if ( ( s = getoptval( optv, 'j', 0 ) ) )
-    {
-        globs.jobs = atoi( s );
-        if ( globs.jobs < 1 || globs.jobs > MAXJOBS )
-        {
-            printf( "Invalid value for the '-j' option, valid values are 1 "
-                "through %d.\n", MAXJOBS );
-            exit( EXITBAD );
-        }
-    }
-
-    if ( ( s = getoptval( optv, 'g', 0 ) ) )
-        globs.newestfirst = 1;
-
-    if ( ( s = getoptval( optv, 'l', 0 ) ) )
-        globs.timeout = atoi( s );
-
-    if ( ( s = getoptval( optv, 'm', 0 ) ) )
-        globs.max_buf = atoi( s ) * 1024;  /* convert to kb */
-
-    /* Turn on/off debugging */
-    for ( n = 0; ( s = getoptval( optv, 'd', n ) ); ++n )
-    {
-        int i;
-
-        /* First -d, turn off defaults. */
-        if ( !n )
-            for ( i = 0; i < DEBUG_MAX; ++i )
-                globs.debug[i] = 0;
-
-        i = atoi( s );
-
-        if ( ( i < 0 ) || ( i >= DEBUG_MAX ) )
-        {
-            printf( "Invalid debug level '%s'.\n", s );
-            continue;
-        }
-
-        /* n turns on levels 1-n. */
-        /* +n turns on level n. */
-        if ( *s == '+' )
-            globs.debug[ i ] = 1;
-        else while ( i )
-            globs.debug[ i-- ] = 1;
-    }
-
-    constants_init();
-    cwd_init();
-
-    {
-        PROFILE_ENTER( MAIN );
-
-#ifdef HAVE_PYTHON
-        {
-            PROFILE_ENTER( MAIN_PYTHON );
-            Py_Initialize();
-            {
-                static PyMethodDef BjamMethods[] = {
-                    {"call", bjam_call, METH_VARARGS,
-                     "Call the specified bjam rule."},
-                    {"import_rule", bjam_import_rule, METH_VARARGS,
-                     "Imports Python callable to bjam."},
-                    {"define_action", bjam_define_action, METH_VARARGS,
-                     "Defines a command line action."},
-                    {"variable", bjam_variable, METH_VARARGS,
-                     "Obtains a variable from bjam's global module."},
-                    {"backtrace", bjam_backtrace, METH_VARARGS,
-                     "Returns bjam backtrace from the last call into Python."},
-                    {"caller", bjam_caller, METH_VARARGS,
-                     "Returns the module from which the last call into Python is made."},
-                    {NULL, NULL, 0, NULL}
-                };
-
-                Py_InitModule( "bjam", BjamMethods );
-            }
-            PROFILE_EXIT( MAIN_PYTHON );
-        }
-#endif
-
-#ifndef NDEBUG
-        run_unit_tests();
-#endif
-#if YYDEBUG != 0
-        if ( DEBUG_PARSE )
-            yydebug = 1;
-#endif
-
-        /* Set JAMDATE. */
-        {
-            timestamp current;
-            timestamp_current( &current );
-            var_set( root_module(), constant_JAMDATE, list_new( outf_time(
-                &current ) ), VAR_SET );
-        }
-
-        /* Set JAM_VERSION. */
-        var_set( root_module(), constant_JAM_VERSION,
-                 list_push_back( list_push_back( list_new(
-                   object_new( VERSION_MAJOR_SYM ) ),
-                   object_new( VERSION_MINOR_SYM ) ),
-                   object_new( VERSION_PATCH_SYM ) ),
-                   VAR_SET );
-
-        /* Set JAMUNAME. */
-#ifdef unix
-        {
-            struct utsname u;
-
-            if ( uname( &u ) >= 0 )
-            {
-                var_set( root_module(), constant_JAMUNAME,
-                         list_push_back(
-                             list_push_back(
-                                 list_push_back(
-                                     list_push_back(
-                                         list_new(
-                                            object_new( u.sysname ) ),
-                                         object_new( u.nodename ) ),
-                                     object_new( u.release ) ),
-                                 object_new( u.version ) ),
-                             object_new( u.machine ) ), VAR_SET );
-            }
-        }
-#endif  /* unix */
-
-        /* Set JAM_TIMESTAMP_RESOLUTION. */
-        {
-            timestamp fmt_resolution[ 1 ];
-            file_supported_fmt_resolution( fmt_resolution );
-            var_set( root_module(), constant_JAM_TIMESTAMP_RESOLUTION, list_new(
-                object_new( timestamp_timestr( fmt_resolution ) ) ), VAR_SET );
-        }
-
-        /* Load up environment variables. */
-
-        /* First into the global module, with splitting, for backward
-         * compatibility.
-         */
-        var_defines( root_module(), use_environ, 1 );
-
-        environ_module = bindmodule( constant_ENVIRON );
-        /* Then into .ENVIRON, without splitting. */
-        var_defines( environ_module, use_environ, 0 );
-
-        /*
-         * Jam defined variables OS & OSPLAT. We load them after environment, so
-         * that setting OS in environment does not change Jam's notion of the
-         * current platform.
-         */
-        var_defines( root_module(), othersyms, 1 );
-
-        /* Load up variables set on command line. */
-        for ( n = 0; ( s = getoptval( optv, 's', n ) ); ++n )
-        {
-            char * symv[ 2 ];
-            symv[ 0 ] = s;
-            symv[ 1 ] = 0;
-            var_defines( root_module(), symv, 1 );
-            var_defines( environ_module, symv, 0 );
-        }
-
-        /* Set the ARGV to reflect the complete list of arguments of invocation.
-         */
-        for ( n = 0; n < arg_c; ++n )
-            var_set( root_module(), constant_ARGV, list_new( object_new(
-                arg_v[ n ] ) ), VAR_APPEND );
-
-        /* Initialize built-in rules. */
-        load_builtins();
-
-        /* Add the targets in the command line to the update list. */
-        for ( n = 1; n < arg_c; ++n )
-        {
-            if ( arg_v[ n ][ 0 ] == '-' )
-            {
-                char * f = "-:l:d:j:f:gs:t:ano:qv";
-                for ( ; *f; ++f ) if ( *f == arg_v[ n ][ 1 ] ) break;
-                if ( ( f[ 1 ] == ':' ) && ( arg_v[ n ][ 2 ] == '\0' ) ) ++n;
-            }
-            else
-            {
-                OBJECT * const target = object_new( arg_v[ n ] );
-                mark_target_for_updating( target );
-                object_free( target );
-            }
-        }
-
-        if ( list_empty( targets_to_update() ) )
-            mark_target_for_updating( constant_all );
-
-        /* Parse ruleset. */
-        {
-            FRAME frame[ 1 ];
-            frame_init( frame );
-            for ( n = 0; ( s = getoptval( optv, 'f', n ) ); ++n )
-            {
-                OBJECT * const filename = object_new( s );
-                parse_file( filename, frame );
-                object_free( filename );
-            }
-
-            if ( !n )
-                parse_file( constant_plus, frame );
-        }
-
-        status = yyanyerrors();
-
-        /* Manually touch -t targets. */
-        for ( n = 0; ( s = getoptval( optv, 't', n ) ); ++n )
-        {
-            OBJECT * const target = object_new( s );
-            touch_target( target );
-            object_free( target );
-        }
-
-        /* If an output file is specified, set globs.cmdout to that. */
-        if ( ( s = getoptval( optv, 'o', 0 ) ) )
-        {
-            if ( !( globs.cmdout = fopen( s, "w" ) ) )
-            {
-                printf( "Failed to write to '%s'\n", s );
-                exit( EXITBAD );
-            }
-            ++globs.noexec;
-        }
-
-        /* The build system may set the PARALLELISM variable to override -j
-         * options.
-         */
-        {
-            LIST * const p = var_get( root_module(), constant_PARALLELISM );
-            if ( !list_empty( p ) )
-            {
-                int const j = atoi( object_str( list_front( p ) ) );
-                if ( j < 1 || j > MAXJOBS )
-                    printf( "Invalid value of PARALLELISM: %s. Valid values "
-                        "are 1 through %d.\n", object_str( list_front( p ) ),
-                        MAXJOBS );
-                else
-                    globs.jobs = j;
-            }
-        }
-
-        /* KEEP_GOING overrides -q option. */
-        {
-            LIST * const p = var_get( root_module(), constant_KEEP_GOING );
-            if ( !list_empty( p ) )
-                globs.quitquick = atoi( object_str( list_front( p ) ) ) ? 0 : 1;
-        }
-
-        /* Now make target. */
-        {
-            PROFILE_ENTER( MAIN_MAKE );
-            LIST * const targets = targets_to_update();
-            if ( !list_empty( targets ) )
-                status |= make( targets, anyhow );
-            else
-                status = last_update_now_status;
-            PROFILE_EXIT( MAIN_MAKE );
-        }
-
-        PROFILE_EXIT( MAIN );
-    }
-
-    if ( DEBUG_PROFILE )
-        profile_dump();
-
-
-#ifdef OPT_HEADER_CACHE_EXT
-    hcache_done();
-#endif
-
-    clear_targets_to_update();
-
-    /* Widely scattered cleanup. */
-    property_set_done();
-    file_done();
-    rules_done();
-    timestamp_done();
-    search_done();
-    class_done();
-    modules_done();
-    regex_done();
-    cwd_done();
-    path_done();
-    function_done();
-    list_done();
-    constants_done();
-    object_done();
-
-    /* Close cmdout. */
-    if ( globs.cmdout )
-        fclose( globs.cmdout );
-
-#ifdef HAVE_PYTHON
-    Py_Finalize();
-#endif
-
-    BJAM_MEM_CLOSE();
-
-    return status ? EXITBAD : EXITOK;
-}
-
-
-/*
- * executable_path()
- */
-
-#if defined(_WIN32)
-# define WIN32_LEAN_AND_MEAN
-# include <windows.h>
-char * executable_path( char const * argv0 )
-{
-    char buf[ 1024 ];
-    DWORD const ret = GetModuleFileName( NULL, buf, sizeof( buf ) );
-    return ( !ret || ret == sizeof( buf ) ) ? NULL : strdup( buf );
-}
-#elif defined(__APPLE__)  /* Not tested */
-# include <mach-o/dyld.h>
-char *executable_path( char const * argv0 )
-{
-    char buf[ 1024 ];
-    uint32_t size = sizeof( buf );
-    return _NSGetExecutablePath( buf, &size ) ? NULL : strdup( buf );
-}
-#elif defined(sun) || defined(__sun)  /* Not tested */
-# include <stdlib.h>
-char * executable_path( char const * argv0 )
-{
-    return strdup( getexecname() );
-}
-#elif defined(__FreeBSD__)
-# include <sys/sysctl.h>
-char * executable_path( char const * argv0 )
-{
-    int mib[ 4 ] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
-    char buf[ 1024 ];
-    size_t size = sizeof( buf );
-    sysctl( mib, 4, buf, &size, NULL, 0 );
-    return ( !size || size == sizeof( buf ) ) ? NULL : strndup( buf, size );
-}
-#elif defined(__linux__)
-# include <unistd.h>
-char * executable_path( char const * argv0 )
-{
-    char buf[ 1024 ];
-    ssize_t const ret = readlink( "/proc/self/exe", buf, sizeof( buf ) );
-    return ( !ret || ret == sizeof( buf ) ) ? NULL : strndup( buf, ret );
-}
-#else
-char * executable_path( char const * argv0 )
-{
-    /* If argv0 is an absolute path, assume it is the right absolute path. */
-    return argv0[ 0 ] == '/' ? strdup( argv0 ) : NULL;
-}
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/6da3961b/ext/kenlm/jam-files/engine/jam.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/jam.h b/ext/kenlm/jam-files/engine/jam.h
deleted file mode 100644
index 86ad0e8..0000000
--- a/ext/kenlm/jam-files/engine/jam.h
+++ /dev/null
@@ -1,475 +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 copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- */
-
-/*
- * jam.h - includes and globals for jam
- */
-
-#ifndef JAM_H_VP_2003_08_01
-#define JAM_H_VP_2003_08_01
-
-#ifdef HAVE_PYTHON
-#include <Python.h>
-#endif
-
-/* Assume popen support is available unless known otherwise. */
-#define HAVE_POPEN 1
-
-/*
- * Windows NT
- */
-
-#ifdef NT
-
-#include <ctype.h>
-#include <fcntl.h>
-#include <malloc.h>
-#ifndef __MWERKS__
-    #include <memory.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <time.h>
-
-#define OSMAJOR "NT=true"
-#define OSMINOR "OS=NT"
-#define OS_NT
-#define SPLITPATH ';'
-#define MAXLINE (undefined__see_execnt_c)  /* max chars per command line */
-#define USE_EXECNT
-#define PATH_DELIM '\\'
-
-/* AS400 cross-compile from NT. */
-
-#ifdef AS400
-    #undef OSMINOR
-    #undef OSMAJOR
-    #define OSMAJOR "AS400=true"
-    #define OSMINOR "OS=AS400"
-    #define OS_AS400
-#endif
-
-/* Metrowerks Standard Library on Windows. */
-
-#ifdef __MSL__
-    #undef HAVE_POPEN
-#endif
-
-#endif  /* #ifdef NT */
-
-
-/*
- * Windows MingW32
- */
-
-#ifdef MINGW
-
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <malloc.h>
-#include <memory.h>
-#include <signal.h>
-#include <string.h>
-#include <time.h>
-
-#define OSMAJOR "MINGW=true"
-#define OSMINOR "OS=MINGW"
-#define OS_NT
-#define SPLITPATH ';'
-#define MAXLINE 996  /* max chars per command line */
-#define USE_EXECUNIX
-#define PATH_DELIM '\\'
-
-#endif  /* #ifdef MINGW */
-
-
-/*
- * God fearing UNIX.
- */
-
-#ifndef OSMINOR
-
-#define OSMAJOR "UNIX=true"
-#define USE_EXECUNIX
-#define USE_FILEUNIX
-#define PATH_DELIM '/'
-
-#ifdef _AIX
-    #define unix
-    #define MAXLINE 23552  /* 24k - 1k, max chars per command line */
-    #define OSMINOR "OS=AIX"
-    #define OS_AIX
-    #define NO_VFORK
-#endif
-#ifdef AMIGA
-    #define OSMINOR "OS=AMIGA"
-    #define OS_AMIGA
-#endif
-#ifdef __BEOS__
-    #define unix
-    #define OSMINOR "OS=BEOS"
-    #define OS_BEOS
-    #define NO_VFORK
-#endif
-#ifdef __bsdi__
-    #define OSMINOR "OS=BSDI"
-    #define OS_BSDI
-#endif
-#if defined (COHERENT) && defined (_I386)
-    #define OSMINOR "OS=COHERENT"
-    #define OS_COHERENT
-    #define NO_VFORK
-#endif
-#if defined(__cygwin__) || defined(__CYGWIN__)
-    #define OSMINOR "OS=CYGWIN"
-    #define OS_CYGWIN
-#endif
-#if defined(__FreeBSD__) && !defined(__DragonFly__)
-    #define OSMINOR "OS=FREEBSD"
-    #define OS_FREEBSD
-#endif
-#ifdef __DragonFly__
-    #define OSMINOR "OS=DRAGONFLYBSD"
-    #define OS_DRAGONFLYBSD
-#endif
-#ifdef __DGUX__
-    #define OSMINOR "OS=DGUX"
-    #define OS_DGUX
-#endif
-#ifdef __hpux
-    #define OSMINOR "OS=HPUX"
-    #define OS_HPUX
-#endif
-#ifdef __OPENNT
-    #define unix
-    #define OSMINOR "OS=INTERIX"
-    #define OS_INTERIX
-    #define NO_VFORK
-#endif
-#ifdef __sgi
-    #define OSMINOR "OS=IRIX"
-    #define OS_IRIX
-    #define NO_VFORK
-#endif
-#ifdef __ISC
-    #define OSMINOR "OS=ISC"
-    #define OS_ISC
-    #define NO_VFORK
-#endif
-#ifdef linux
-    #define OSMINOR "OS=LINUX"
-    #define OS_LINUX
-#endif
-#ifdef __Lynx__
-    #define OSMINOR "OS=LYNX"
-    #define OS_LYNX
-    #define NO_VFORK
-    #define unix
-#endif
-#ifdef __MACHTEN__
-    #define OSMINOR "OS=MACHTEN"
-    #define OS_MACHTEN
-#endif
-#ifdef mpeix
-    #define unix
-    #define OSMINOR "OS=MPEIX"
-    #define OS_MPEIX
-    #define NO_VFORK
-#endif
-#ifdef __MVS__
-    #define unix
-    #define OSMINOR "OS=MVS"
-    #define OS_MVS
-#endif
-#ifdef _ATT4
-    #define OSMINOR "OS=NCR"
-    #define OS_NCR
-#endif
-#ifdef __NetBSD__
-    #define unix
-    #define OSMINOR "OS=NETBSD"
-    #define OS_NETBSD
-    #define NO_VFORK
-#endif
-#ifdef __QNX__
-    #define unix
-    #ifdef __QNXNTO__
-        #define OSMINOR "OS=QNXNTO"
-        #define OS_QNXNTO
-    #else
-        #define OSMINOR "OS=QNX"
-        #define OS_QNX
-        #define NO_VFORK
-        #define MAXLINE 996  /* max chars per command line */
-    #endif
-#endif
-#ifdef NeXT
-    #ifdef __APPLE__
-        #define OSMINOR "OS=RHAPSODY"
-        #define OS_RHAPSODY
-    #else
-        #define OSMINOR "OS=NEXT"
-        #define OS_NEXT
-    #endif
-#endif
-#ifdef __APPLE__
-    #define unix
-    #define OSMINOR "OS=MACOSX"
-    #define OS_MACOSX
-#endif
-#ifdef __osf__
-    #ifndef unix
-        #define unix
-    #endif
-    #define OSMINOR "OS=OSF"
-    #define OS_OSF
-#endif
-#ifdef _SEQUENT_
-    #define OSMINOR "OS=PTX"
-    #define OS_PTX
-#endif
-#ifdef M_XENIX
-    #define OSMINOR "OS=SCO"
-    #define OS_SCO
-    #define NO_VFORK
-#endif
-#ifdef sinix
-    #define unix
-    #define OSMINOR "OS=SINIX"
-    #define OS_SINIX
-#endif
-#ifdef sun
-    #if defined(__svr4__) || defined(__SVR4)
-        #define OSMINOR "OS=SOLARIS"
-        #define OS_SOLARIS
-    #else
-        #define OSMINOR "OS=SUNOS"
-        #define OS_SUNOS
-    #endif
-#endif
-#ifdef ultrix
-    #define OSMINOR "OS=ULTRIX"
-    #define OS_ULTRIX
-#endif
-#ifdef _UNICOS
-    #define OSMINOR "OS=UNICOS"
-    #define OS_UNICOS
-#endif
-#if defined(__USLC__) && !defined(M_XENIX)
-    #define OSMINOR "OS=UNIXWARE"
-    #define OS_UNIXWARE
-#endif
-#ifdef __OpenBSD__
-    #define OSMINOR "OS=OPENBSD"
-    #define OS_OPENBSD
-    #define unix
-#endif
-#if defined (__FreeBSD_kernel__) && !defined(__FreeBSD__)
-    #define OSMINOR "OS=KFREEBSD"
-    #define OS_KFREEBSD
-#endif
-#ifndef OSMINOR
-    #define OSMINOR "OS=UNKNOWN"
-#endif
-
-/* All the UNIX includes */
-
-#include <sys/types.h>
-
-#ifndef OS_MPEIX
-    #include <sys/file.h>
-#endif
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <signal.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#ifndef OS_QNX
-    #include <memory.h>
-#endif
-
-#ifndef OS_ULTRIX
-    #include <stdlib.h>
-#endif
-
-#if !defined( OS_BSDI         ) && \
-    !defined( OS_FREEBSD      ) && \
-    !defined( OS_DRAGONFLYBSD ) && \
-    !defined( OS_NEXT         ) && \
-    !defined( OS_MACHTEN      ) && \
-    !defined( OS_MACOSX       ) && \
-    !defined( OS_RHAPSODY     ) && \
-    !defined( OS_MVS          ) && \
-    !defined( OS_OPENBSD      )
-    #include <malloc.h>
-#endif
-
-#endif  /* #ifndef OSMINOR */
-
-
-/*
- * OSPLAT definitions - suppressed when it is a one-of-a-kind.
- */
-
-#if defined( _M_PPC      ) || \
-    defined( PPC         ) || \
-    defined( ppc         ) || \
-    defined( __powerpc__ ) || \
-    defined( __ppc__     )
-    #define OSPLAT "OSPLAT=PPC"
-#endif
-
-#if defined( _ALPHA_   ) || \
-    defined( __alpha__ )
-    #define OSPLAT "OSPLAT=AXP"
-#endif
-
-#if defined( _i386_   ) || \
-    defined( __i386__ ) || \
-    defined( __i386   ) || \
-    defined( _M_IX86  )
-    #define OSPLAT "OSPLAT=X86"
-#endif
-
-#if defined( __ia64__ ) || \
-    defined( __IA64__ ) || \
-    defined( __ia64   )
-    #define OSPLAT "OSPLAT=IA64"
-#endif
-
-#if defined( __x86_64__ ) || \
-    defined( __amd64__  ) || \
-    defined( _M_AMD64   )
-    #define OSPLAT "OSPLAT=X86_64"
-#endif
-
-#if defined( __sparc__ ) || \
-    defined( __sparc   )
-    #define OSPLAT "OSPLAT=SPARC"
-#endif
-
-#ifdef __mips__
-    #define OSPLAT "OSPLAT=MIPS"
-#endif
-
-#ifdef __arm__
-    #define OSPLAT "OSPLAT=ARM"
-#endif
-
-#ifdef __s390__
-    #define OSPLAT "OSPLAT=390"
-#endif
-
-#ifdef __hppa
-    #define OSPLAT "OSPLAT=PARISC"
-#endif
-
-#ifndef OSPLAT
-    #define OSPLAT ""
-#endif
-
-
-/*
- * Jam implementation misc.
- */
-
-#ifndef MAXLINE
-    #define MAXLINE 102400  /* max chars per command line */
-#endif
-
-#ifndef EXITOK
-    #define EXITOK 0
-    #define EXITBAD 1
-#endif
-
-#ifndef SPLITPATH
-    #define SPLITPATH ':'
-#endif
-
-/* You probably do not need to muck with these. */
-
-#define MAXSYM   1024  /* longest symbol in the environment */
-#define MAXJPATH 1024  /* longest filename */
-
-#define MAXJOBS  64    /* internally enforced -j limit */
-#define MAXARGC  32    /* words in $(JAMSHELL) */
-
-/* Jam private definitions below. */
-
-#define DEBUG_MAX  14
-
-
-struct globs
-{
-    int    noexec;
-    int    jobs;
-    int    quitquick;
-    int    newestfirst;         /* build newest sources first */
-    int    pipe_action;
-    char   debug[ DEBUG_MAX ];
-    FILE * cmdout;              /* print cmds, not run them */
-    long   timeout;             /* number of seconds to limit actions to,
-                                 * default 0 for no limit.
-                                 */
-    int    dart;                /* output build and test results formatted for
-                                 * Dart
-                                 */
-    int    max_buf;             /* maximum amount of output saved from target
-                                 * (kb)
-                                 */
-};
-
-extern struct globs globs;
-
-#define DEBUG_MAKE     ( globs.debug[ 1 ] )   /* show actions when executed */
-#define DEBUG_MAKEQ    ( globs.debug[ 2 ] )   /* show even quiet actions */
-#define DEBUG_EXEC     ( globs.debug[ 2 ] )   /* show text of actons */
-#define DEBUG_MAKEPROG ( globs.debug[ 3 ] )   /* show make0 progress */
-#define DEBUG_BIND     ( globs.debug[ 3 ] )   /* show when files bound */
-
-#define DEBUG_EXECCMD  ( globs.debug[ 4 ] )   /* show execcmds()'s work */
-
-#define DEBUG_COMPILE  ( globs.debug[ 5 ] )   /* show rule invocations */
-
-#define DEBUG_HEADER   ( globs.debug[ 6 ] )   /* show result of header scan */
-#define DEBUG_BINDSCAN ( globs.debug[ 6 ] )   /* show result of dir scan */
-#define DEBUG_SEARCH   ( globs.debug[ 6 ] )   /* show binding attempts */
-
-#define DEBUG_VARSET   ( globs.debug[ 7 ] )   /* show variable settings */
-#define DEBUG_VARGET   ( globs.debug[ 8 ] )   /* show variable fetches */
-#define DEBUG_VAREXP   ( globs.debug[ 8 ] )   /* show variable expansions */
-#define DEBUG_IF       ( globs.debug[ 8 ] )   /* show 'if' calculations */
-#define DEBUG_LISTS    ( globs.debug[ 9 ] )   /* show list manipulation */
-#define DEBUG_SCAN     ( globs.debug[ 9 ] )   /* show scanner tokens */
-#define DEBUG_MEM      ( globs.debug[ 9 ] )   /* show memory use */
-
-#define DEBUG_PROFILE  ( globs.debug[ 10 ] )  /* dump rule execution times */
-#define DEBUG_PARSE    ( globs.debug[ 11 ] )  /* debug parsing */
-#define DEBUG_GRAPH    ( globs.debug[ 12 ] )  /* debug dependencies */
-#define DEBUG_FATE     ( globs.debug[ 13 ] )  /* show fate changes in make0() */
-
-/* Everyone gets the memory definitions. */
-#include "mem.h"
-
-/* They also get the profile functions. */
-#include "debug.h"
-
-#endif