Made xuni more C++-compatible by adding extern "C" to all header files.
[xuni.git] / src / utility.h
blob77271677b43c5c24882e3446e81de689d0b70b9b
1 /*! \file utility.h
3 */
5 #ifndef XUNI_GUARD_UTILITY_H
6 #define XUNI_GUARD_UTILITY_H 1
8 #include <stdlib.h>
9 #include <math.h>
11 #include "loadso.h"
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
17 #ifdef PI
18 #define CONSTANT_PI PI
19 #elif defined(M_PI)
20 #define CONSTANT_PI M_PI
21 #else
22 #define CONSTANT_PI 3.14159265358979323846264338327950288419716939937510582097
23 #endif
25 struct string_function_t {
26 const char *str;
27 func_point_t data;
30 struct string_index_t {
31 const char *str;
32 size_t index;
35 func_point_t string_to_function(const struct string_function_t *data,
36 size_t n, const char *find);
37 size_t string_to_index(const struct string_index_t *str, size_t n,
38 const char *find);
40 double degrees_to_radians(double angle);
41 double radians_to_degrees(double angle);
43 int binary_insertion_sort(void *data, size_t n, void *find, size_t *pos,
44 int (*compare)(void *data, size_t n, void *find));
46 #ifdef __cplusplus
48 #endif
50 #endif