40 #ifndef OPENNL_PRIVATE_H
41 #define OPENNL_PRIVATE_H
58 #if defined(__APPLE__) && defined(__MACH__)
65 #if defined(__linux__) || defined(__ANDROID__) || defined(NL_OS_APPLE)
73 #if defined(WIN32) || defined(_WIN64)
86 #define nl_arg_used(x) (void)x
93 #if defined(__clang__) || defined(__GNUC__)
94 #define NL_NORETURN __attribute__((noreturn))
100 #define NL_NORETURN_DECL __declspec(noreturn)
102 #define NL_NORETURN_DECL
114 const char* cond,
const char* file,
int line
128 double x,
double min_val,
double max_val,
const char* file,
int line
140 const char* file,
int line
147 #define nl_assert(x) { \
149 nl_assertion_failed(#x,__FILE__, __LINE__) ; \
159 #define nl_range_assert(x,min_val,max_val) { \
160 if(((int)(x) < (int)(min_val)) || ((int)(x) > (int)(max_val))) { \
161 nl_range_assertion_failed(x, min_val, max_val, \
171 #define nl_assert_not_reached { \
172 nl_should_not_have_reached(__FILE__, __LINE__) ; \
176 #define nl_debug_assert(x) nl_assert(x)
177 #define nl_debug_range_assert(x,min_val,max_val) \
178 nl_range_assert(x,min_val,max_val)
180 #define nl_debug_assert(x)
181 #define nl_debug_range_assert(x,min_val,max_val)
185 #define nl_parano_assert(x) nl_assert(x)
186 #define nl_parano_range_assert(x,min_val,max_val) \
187 nl_range_assert(x,min_val,max_val)
189 #define nl_parano_assert(x)
190 #define nl_parano_range_assert(x,min_val,max_val)
204 void nlError(
const char*
function,
const char* message) ;
211 void nlWarning(
const char*
function,
const char* message) ;
255 #define NL_LINK_NOW 1
261 #define NL_LINK_LAZY 2
266 #define NL_LINK_GLOBAL 4
271 #define NL_LINK_QUIET 8
277 #define NL_LINK_USE_FALLBACK 16
309 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
313 #define MAX(x,y) (((x) > (y)) ? (x) : (y))
328 #define NL_NEW(T) (T*)(calloc(1, sizeof(T)))
336 #define NL_NEW_ARRAY(T,NB) (T*)(calloc((size_t)(NB),sizeof(T)))
345 #define NL_RENEW_ARRAY(T,x,NB) (T*)(realloc(x,(size_t)(NB)*sizeof(T)))
351 #define NL_DELETE(x) free(x); x = NULL
358 #define NL_DELETE_ARRAY(x) free(x); x = NULL
365 #define NL_CLEAR(T, x) memset(x, 0, sizeof(T))
373 #define NL_CLEAR_ARRAY(T,x,NB) memset(x, 0, (size_t)(NB)*sizeof(T))
384 #define NL_UINT_MAX 0xffffffff
389 #define NL_USHORT_MAX 0xffff
The public API of the OpenNL linear solver library. Click the "More..." link below for simple example...
uint32_t NLuint
A 4-bytes unsigned integer.
int(* NLprintfFunc)(const char *format,...)
Function pointer type for user printf function.
double NLdouble
A double-precision floating-point number.
void(* NLfunc)(void)
A function pointer.
unsigned int NLenum
A symbolic constant.
int(* NLfprintfFunc)(FILE *out, const char *format,...)
Function pointer type for user fprintf function.
void nlCloseDLL(NLdll handle)
Closes a DLL/shared object/dylib.
NLdouble nlCurrentTime(void)
Gets the current time in seconds.
void nlWarning(const char *function, const char *message)
Displays a warning message.
NLuint nlGetNumThreads(void)
Gets the number of threads.
NL_NORETURN_DECL void nl_assertion_failed(const char *cond, const char *file, int line) NL_NORETURN
Displays an error message and aborts the program when an assertion failed.
NLuint nlGetNumCores(void)
Gets the number of cores.
NL_NORETURN_DECL void nl_range_assertion_failed(double x, double min_val, double max_val, const char *file, int line) NL_NORETURN
Displays an error message and aborts the program when a range assertion failed.
void nlError(const char *function, const char *message)
Displays an error message.
NLfunc nlFindFunction(NLdll handle, const char *funcname)
Finds a function in a DLL/shared object/dylib.
NLdll nlOpenDLL(const char *filename, NLenum flags)
Dynamically links a DLL/shared object/dylib to the current process.
NL_NORETURN_DECL void nl_should_not_have_reached(const char *file, int line) NL_NORETURN
Displays an error message and aborts the program when the execution flow reached a point it should no...
void nlSetNumThreads(NLuint nb_threads)
Sets the number of threads.
void * NLdll
Type for manipulating DLL/shared object/dylib handles.
Functions for string manipulation.