MoorDyn
MoorDynAPI.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022, Matt Hall
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
54 #ifndef __MOORDYNAPI_H__
55 #define __MOORDYNAPI_H__
56 
57 #ifdef MoorDyn_EXPORTS
58 #ifdef WIN32
59 #define DECLDIR __declspec(dllexport)
60 #else
61 #define DECLDIR
62 #endif
63 #else
64 #ifdef WIN32
65 #define DECLDIR __declspec(dllimport)
66 #else
68 #define DECLDIR
69 #endif
70 #endif
71 
72 #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
73 #define PARAM_UNUSED __attribute__((__unused__))
74 #else
76 #define PARAM_UNUSED
77 #endif
78 
79 #ifdef _MSC_VER
80 #define DEPRECATED __declspec(deprecated)
81 #elif defined(__GNUC__) | defined(__clang__)
82 #define DEPRECATED __attribute__((__deprecated__))
83 #else
85 #define DEPRECATED
86 #endif
87 
88 #ifndef __FUNC_NAME__
89 #ifdef _MSC_VER
90 #define __FUNC_NAME__ __FUNCTION__
91 #else
93 #define __FUNC_NAME__ __func__
94 #endif
95 #endif
96 
97 #ifndef __PRETTY_FUNC_NAME__
98 #ifdef _MSC_VER
99 #define __PRETTY_FUNC_NAME__ __FUNCSIG__
100 #else
102 #define __PRETTY_FUNC_NAME__ __PRETTY_FUNCTION__
103 #endif
104 #endif
105 
106 #ifndef XSTR
108 #define XSTR(s) STR(s)
109 #endif
110 #ifndef STR
112 #define STR(s) #s
113 #endif
114 
120 #define MOORDYN_ERR_LEVEL 3
122 #define MOORDYN_WRN_LEVEL 2
124 #define MOORDYN_MSG_LEVEL 1
126 #define MOORDYN_DBG_LEVEL 0
128 #define MOORDYN_NO_OUTPUT 4096
129 
143 #define MOORDYN_SUCCESS 0
145 #define MOORDYN_INVALID_INPUT_FILE -1
147 #define MOORDYN_INVALID_OUTPUT_FILE -2
149 #define MOORDYN_INVALID_INPUT -3
151 #define MOORDYN_NAN_ERROR -4
153 #define MOORDYN_MEM_ERROR -5
155 #define MOORDYN_INVALID_VALUE -6
157 #define MOORDYN_NON_IMPLEMENTED -7
159 #define MOORDYN_UNHANDLED_ERROR -255
160 
169 #endif // __MOORDYNAPI_H__