|
Graphite Version 3
An experimental 3D geometry processing program
|
Some macros and functions used internally by OpenNL. More...
Go to the source code of this file.
Macros | |
| #define | NL_DEBUG |
| #define | nl_arg_used(x) (void)x |
| Suppresses unsused argument warnings. | |
Memory management | |
| #define | NL_NEW(T) (T*)(calloc(1, sizeof(T))) |
| Allocates a new element. | |
| #define | NL_NEW_ARRAY(T, NB) (T*)(calloc((size_t)(NB),sizeof(T))) |
| Allocates a new array of elements. | |
| #define | NL_RENEW_ARRAY(T, x, NB) (T*)(realloc(x,(size_t)(NB)*sizeof(T))) |
| Changes the size of an already allocated array of elements. | |
| #define | NL_DELETE(x) free(x); x = NULL |
| Deallocates an element. | |
| #define | NL_DELETE_ARRAY(x) free(x); x = NULL |
| Deallocates an array. | |
| #define | NL_CLEAR(T, x) memset(x, 0, sizeof(T)) |
| Clears an element. | |
| #define | NL_CLEAR_ARRAY(T, x, NB) memset(x, 0, (size_t)(NB)*sizeof(T)) |
| Clears an array of elements. | |
Integer bounds | |
| #define | NL_UINT_MAX 0xffffffff |
| Maximum unsigned 32 bits integer. | |
| #define | NL_USHORT_MAX 0xffff |
| Maximum unsigned 16 bits integer. | |
Functions | |
Error reporting | |
| void | nlError (const char *function, const char *message) |
| Displays an error message. | |
| void | nlWarning (const char *function, const char *message) |
| Displays a warning message. | |
Variables | |
Logging and messages | |
| NLprintfFunc | nl_printf |
| NLfprintfFunc | nl_fprintf |
Assertion checks | |
| #define | NL_NORETURN |
| #define | NL_NORETURN_DECL |
| #define | nl_assert(x) |
| Tests an assertion and aborts the program if the test fails. | |
| #define | nl_range_assert(x, min_val, max_val) |
| Tests a range assertion and aborts the program if the test fails. | |
| #define | nl_assert_not_reached |
| Triggers an assertion failure when the execution flow reaches a specific location in the code. | |
| #define | nl_debug_assert(x) nl_assert(x) |
| #define | nl_debug_range_assert(x, min_val, max_val) nl_range_assert(x,min_val,max_val) |
| #define | nl_parano_assert(x) |
| #define | nl_parano_range_assert(x, min_val, max_val) |
| 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. | |
| 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. | |
| 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 not have reached. | |
OS | |
| #define | NL_LINK_NOW 1 |
| Flag for nlOpenDLL(), resolve all symbols when opening the DLL. | |
| #define | NL_LINK_LAZY 2 |
| Flag for nlOpenDLL(), resolve symbols only when they are called. | |
| #define | NL_LINK_GLOBAL 4 |
| Flag for nlOpenDLL(), add all loaded symbols to global namespace. | |
| #define | NL_LINK_QUIET 8 |
| Flag for nlOpenDLL(), do not display messages. | |
| #define | NL_LINK_USE_FALLBACK 16 |
| Flag for nlOpenDLL(), use fallback geogram numerical library if library is not found in the system. | |
| #define | MIN(x, y) (((x) < (y)) ? (x) : (y)) |
| #define | MAX(x, y) (((x) > (y)) ? (x) : (y)) |
| typedef void * | NLdll |
| Type for manipulating DLL/shared object/dylib handles. | |
| NLdouble | nlCurrentTime (void) |
| Gets the current time in seconds. | |
| NLuint | nlGetNumCores (void) |
| Gets the number of cores. | |
| NLuint | nlGetNumThreads (void) |
| Gets the number of threads. | |
| void | nlSetNumThreads (NLuint nb_threads) |
| Sets the number of threads. | |
| NLdll | nlOpenDLL (const char *filename, NLenum flags) |
| Dynamically links a DLL/shared object/dylib to the current process. | |
| void | nlCloseDLL (NLdll handle) |
| Closes a DLL/shared object/dylib. | |
| NLfunc | nlFindFunction (NLdll handle, const char *funcname) |
| Finds a function in a DLL/shared object/dylib. | |
Some macros and functions used internally by OpenNL.
Definition in file nl_private.h.
| #define MAX | ( | x, | |
| y | |||
| ) | (((x) > (y)) ? (x) : (y)) |
Definition at line 313 of file nl_private.h.
| #define MIN | ( | x, | |
| y | |||
| ) | (((x) < (y)) ? (x) : (y)) |
Definition at line 309 of file nl_private.h.
| #define nl_arg_used | ( | x | ) | (void)x |
Suppresses unsused argument warnings.
Some callbacks do not necessary use all their arguments.
| [in] | x | the argument to be tagged as used |
Definition at line 86 of file nl_private.h.
| #define nl_assert | ( | x | ) |
Tests an assertion and aborts the program if the test fails.
| [in] | x | the condition to be tested |
Definition at line 147 of file nl_private.h.
| #define nl_assert_not_reached |
Triggers an assertion failure when the execution flow reaches a specific location in the code.
Definition at line 171 of file nl_private.h.
| #define NL_CLEAR | ( | T, | |
| x | |||
| ) | memset(x, 0, sizeof(T)) |
Clears an element.
| [in] | T | type of the element to be cleared |
| [in,out] | x | a pointer to the element |
Definition at line 365 of file nl_private.h.
| #define NL_CLEAR_ARRAY | ( | T, | |
| x, | |||
| NB | |||
| ) | memset(x, 0, (size_t)(NB)*sizeof(T)) |
Clears an array of elements.
| [in] | T | type of the element to be cleared |
| [in,out] | x | a pointer to the element |
| [in] | NB | number of elements |
Definition at line 373 of file nl_private.h.
| #define NL_DEBUG |
Definition at line 50 of file nl_private.h.
| #define nl_debug_assert | ( | x | ) | nl_assert(x) |
Definition at line 176 of file nl_private.h.
| #define nl_debug_range_assert | ( | x, | |
| min_val, | |||
| max_val | |||
| ) | nl_range_assert(x,min_val,max_val) |
Definition at line 177 of file nl_private.h.
| #define NL_DELETE | ( | x | ) | free(x); x = NULL |
Deallocates an element.
| [in,out] | x | a pointer to the element to be deallocated |
Definition at line 351 of file nl_private.h.
| #define NL_DELETE_ARRAY | ( | x | ) | free(x); x = NULL |
Deallocates an array.
| [in,out] | x | a pointer to the first element of the array to be deallocated |
Definition at line 358 of file nl_private.h.
| #define NL_LINK_GLOBAL 4 |
Flag for nlOpenDLL(), add all loaded symbols to global namespace.
Definition at line 266 of file nl_private.h.
| #define NL_LINK_LAZY 2 |
Flag for nlOpenDLL(), resolve symbols only when they are called.
Definition at line 261 of file nl_private.h.
| #define NL_LINK_NOW 1 |
Flag for nlOpenDLL(), resolve all symbols when opening the DLL.
Definition at line 255 of file nl_private.h.
| #define NL_LINK_QUIET 8 |
Flag for nlOpenDLL(), do not display messages.
Definition at line 271 of file nl_private.h.
| #define NL_LINK_USE_FALLBACK 16 |
Flag for nlOpenDLL(), use fallback geogram numerical library if library is not found in the system.
Definition at line 277 of file nl_private.h.
| #define NL_NEW | ( | T | ) | (T*)(calloc(1, sizeof(T))) |
Allocates a new element.
Memory is zeroed after allocation
| [in] | T | type of the element to be allocated |
Definition at line 328 of file nl_private.h.
| #define NL_NEW_ARRAY | ( | T, | |
| NB | |||
| ) | (T*)(calloc((size_t)(NB),sizeof(T))) |
Allocates a new array of elements.
Memory is zeroed after allocation
| [in] | T | type of the elements |
| [in] | NB | number of elements |
Definition at line 336 of file nl_private.h.
| #define NL_NORETURN |
Definition at line 96 of file nl_private.h.
| #define NL_NORETURN_DECL |
Definition at line 102 of file nl_private.h.
| #define nl_parano_assert | ( | x | ) |
Definition at line 189 of file nl_private.h.
| #define nl_parano_range_assert | ( | x, | |
| min_val, | |||
| max_val | |||
| ) |
Definition at line 190 of file nl_private.h.
| #define nl_range_assert | ( | x, | |
| min_val, | |||
| max_val | |||
| ) |
Tests a range assertion and aborts the program if the test fails.
| [in] | x | the variable to be tested |
| [in] | min_val | the minimum admissible value for the variable |
| [in] | max_val | the maximum admissible value for the variable |
Definition at line 159 of file nl_private.h.
| #define NL_RENEW_ARRAY | ( | T, | |
| x, | |||
| NB | |||
| ) | (T*)(realloc(x,(size_t)(NB)*sizeof(T))) |
Changes the size of an already allocated array of elements.
Memory is zeroed after allocation
| [in] | T | type of the elements |
| [in,out] | x | a pointer to the array to be resized |
| [in] | NB | number of elements |
Definition at line 345 of file nl_private.h.
| #define NL_UINT_MAX 0xffffffff |
Maximum unsigned 32 bits integer.
Definition at line 384 of file nl_private.h.
| #define NL_USHORT_MAX 0xffff |
Maximum unsigned 16 bits integer.
Definition at line 389 of file nl_private.h.
| typedef void* NLdll |
Type for manipulating DLL/shared object/dylib handles.
Definition at line 248 of file nl_private.h.
| NL_NORETURN_DECL void nl_assertion_failed | ( | const char * | cond, |
| const char * | file, | ||
| int | line | ||
| ) |
Displays an error message and aborts the program when an assertion failed.
Called by nl_assert() whenever the assertion failed
| [in] | cond | the textual representation of the condition |
| [in] | file | the source filename |
| [in] | line | the line number |
| NL_NORETURN_DECL void nl_range_assertion_failed | ( | double | x, |
| double | min_val, | ||
| double | max_val, | ||
| const char * | file, | ||
| int | line | ||
| ) |
Displays an error message and aborts the program when a range assertion failed.
Called by nl_range_assert() whenever the assertion failed
| [in] | x | the variable |
| [in] | min_val | the minimum value |
| [in] | max_val | the maximum value |
| [in] | file | the source filename |
| [in] | line | the line number |
| NL_NORETURN_DECL void nl_should_not_have_reached | ( | const char * | file, |
| int | line | ||
| ) |
Displays an error message and aborts the program when the execution flow reached a point it should not have reached.
called by nl_assert_not_reached
| [in] | file | the source filename |
| [in] | line | the line number |
| void nlCloseDLL | ( | NLdll | handle | ) |
Closes a DLL/shared object/dylib.
| [in] | handle | a handle to a DLL/shared object/dylib that was previously obtained by nlOpenDLL() |
| NLdouble nlCurrentTime | ( | void | ) |
Gets the current time in seconds.
| void nlError | ( | const char * | function, |
| const char * | message | ||
| ) |
Displays an error message.
| [in] | function | name of the function that triggered the error |
| [in] | message | error message |
Finds a function in a DLL/shared object/dylib.
| [in] | handle | a handle to a DLL/shared object/dylib that was previously obtained by nlOpenDLL() |
| [in] | funcname | the name of the function |
| NLuint nlGetNumCores | ( | void | ) |
Gets the number of cores.
| NLuint nlGetNumThreads | ( | void | ) |
Gets the number of threads.
Dynamically links a DLL/shared object/dylib to the current process.
| [in] | filename | the file name fo the DLL/shared object/dylib. |
| [in] | flags | an or-combination of NL_LINK_NOW, NL_LINK_LAZY, NL_LINK_GLOBAL, NL_LINK_QUIET. |
| void nlSetNumThreads | ( | NLuint | nb_threads | ) |
Sets the number of threads.
| [in] | nb_threads | number of threads to be used by OpenMP, ignored if OpenMP is not supported. |
| void nlWarning | ( | const char * | function, |
| const char * | message | ||
| ) |
Displays a warning message.
| [in] | function | name of the function that triggered the error |
| [in] | message | warning message |