/******************************************************************************
 * NLK - Neural Language Kit
 *
 * Copyright (c) 2015 Luis Rei <me@luisrei.com> http://luisrei.com @lmrei
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to 
 * deal in the Software without restriction, including without limitation the 
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 *****************************************************************************/


/** @file nlk.h
 * NLK common definitions
 */

#ifndef __NLK_H__
#define __NLK_H__


#include <stdbool.h>

/**
 * Workarounds for OSX
 */
#ifdef __MACH__
    #define posix_fadvise(...) 
    #define POSIX_FADV_SEQUENTIAL 0
    /* For including Accelerate */
    #ifndef __has_extension
        #define __has_extension(x) 0
    #endif
    #define vImage_Utilities_h
    #define vImage_CVUtilities_h
#endif

#ifdef __MACH__
    #include <Accelerate/Accelerate.h>
#else
    #include <cblas.h>
#endif


#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS


/** @enum NLK_FORMAT
 * File formats for saving weights
 */
enum nlk_file_format_t {
    NLK_FILE_W2V_TXT = 0,
    NLK_FILE_W2V_BIN = 1,
    NLK_FILE_BIN = 2,
    NLK_FILE_TXT = 3,
};
typedef enum nlk_file_format_t NLK_FILE_FORMAT;

NLK_FILE_FORMAT nlk_format(const char *);
void nlk_init();
int nlk_set_num_threads(int);
int nlk_get_num_threads();


__END_DECLS
#endif /* __NLK_H__ */
