Merge pull request #113 from gitter-badger/gitter-badge
[sddekit.git] / src / sddekit.h
blobfad5033de961234ffc60e233ad02c5d376d0d6bb
1 /* copyright 2016 Apache 2 sddekit authors */
3 /** SDDEKit
4 */
6 #ifndef SDDEKIT_H
7 #define SDDEKIT_H
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
13 /* standard C includes {{{ */
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <string.h>
17 #include <stdbool.h>
18 #include <stdint.h>
19 #include <math.h>
20 /* }}} */
22 /* -DSD_API_EXPORT dllexport {{{ */
23 #ifdef SD_API_EXPORT
24 #define SD_API __declspec(dllexport)
25 #else
26 #ifdef SD_API_IMPORT
27 #define SD_API __declspec(dllimport)
28 #else
29 #define SD_API
30 #endif
31 #endif
32 /* }}} */
34 /* ignore restrict if compiler doesn't support it {{{ */
35 #if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
36 # define restrict __restrict
37 #elif defined(_MSC_VER) && _MSC_VER >= 1400
38 # define restrict __restrict
39 #else
40 # define restrict
41 #endif
42 /* }}} */
44 /* cf. https://gist.github.com/maedoc/f22f691c1ee22fe1961d#prelude {{{ */
45 #define SD_AS(obj, type) (((obj)->type)(obj))
47 #define SD_CALL_AS(obj, type, meth, ...) \
48 SD_AS(obj, type)->meth(SD_AS(obj, type), __VA_ARGS__)
50 #define SD_CALL_AS_(obj, type, meth) \
51 SD_AS(obj, type)->meth(SD_AS(obj, type))
52 /* }}} */
55 /* contains actual C declarations of API */
56 #include "sddekit_api.h"
58 #ifdef __cplusplus
59 }; /* extern "C" */
60 #endif
62 #endif
64 /* vim: foldmethod=marker