OpenFAST
Wind turbine multiphysics simulator
modules
map
src
mapsys.h
1
/****************************************************************
2
* Copyright (C) 2014 mdm *
3
* map[dot]plus[dot]plus[dot]help[at]gmail *
4
* *
5
* Licensed to the Apache Software Foundation (ASF) under one *
6
* or more contributor license agreements. See the NOTICE file *
7
* distributed with this work for additional information *
8
* regarding copyright ownership. The ASF licenses this file *
9
* to you under the Apache License, Version 2.0 (the *
10
* "License"); you may not use this file except in compliance *
11
* with the License. You may obtain a copy of the License at *
12
* *
13
* http://www.apache.org/licenses/LICENSE-2.0 *
14
* *
15
* Unless required by applicable law or agreed to in writing, *
16
* software distributed under the License is distributed on an *
17
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
18
* KIND, either express or implied. See the License for the *
19
* specific language governing permissions and limitations *
20
* under the License. *
21
****************************************************************/
22
23
24
#ifndef _MAPSYS_H
25
#define _MAPSYS_H
26
27
#include <stdio.h>
28
#include <stdlib.h>
29
#include <assert.h>
30
#include <string.h>
31
#include <ctype.h>
32
#include <math.h>
33
34
35
#if defined(_WIN32) || defined(_WIN64)
36
# include <Windows.h>
37
# include <tchar.h>
38
#else
39
# include <unistd.h>
40
#endif
41
42
43
#if defined(_MSC_VER)
44
typedef
int
bool;
45
#define false 0
46
#define true 1
47
//# include "stdbool.h"
48
# define map_snprintf _snprintf
49
# define map_strcat(a,b,c) strcat_s(a,b,c)
50
# define MAP_EXTERNCALL __declspec( dllexport )
51
# define MAP_STRCPY(a,b,c) strcpy_s(a,b,c)
52
#else
53
# include <stdbool.h>
54
# define map_snprintf snprintf
55
# define map_strcat(a,b,c) strncat(a,c,b)
56
# if defined(__MINGW32__)
57
# define MAP_EXTERNCALL __declspec( dllexport )
58
# else
59
# define MAP_EXTERNCALL
60
# endif
61
# define MAP_STRCPY(a,b,c) strcpy(a,c)
62
#endif
63
64
65
#ifndef BUILD_DEFS_H
66
# define BUILD_DEFS_H
67
# define BUILD_YEAR_CH0 (__DATE__[ 7])
68
# define BUILD_YEAR_CH1 (__DATE__[ 8])
69
# define BUILD_YEAR_CH2 (__DATE__[ 9])
70
# define BUILD_YEAR_CH3 (__DATE__[10])
71
# define BUILD_MONTH_IS_JAN (__DATE__[0] == 'J' && __DATE__[1] == 'a' && __DATE__[2] == 'n')
72
# define BUILD_MONTH_IS_FEB (__DATE__[0] == 'F')
73
# define BUILD_MONTH_IS_MAR (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r')
74
# define BUILD_MONTH_IS_APR (__DATE__[0] == 'A' && __DATE__[1] == 'p')
75
# define BUILD_MONTH_IS_MAY (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y')
76
# define BUILD_MONTH_IS_JUN (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n')
77
# define BUILD_MONTH_IS_JUL (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l')
78
# define BUILD_MONTH_IS_AUG (__DATE__[0] == 'A' && __DATE__[1] == 'u')
79
# define BUILD_MONTH_IS_SEP (__DATE__[0] == 'S')
80
# define BUILD_MONTH_IS_OCT (__DATE__[0] == 'O')
81
# define BUILD_MONTH_IS_NOV (__DATE__[0] == 'N')
82
# define BUILD_MONTH_IS_DEC (__DATE__[0] == 'D')
83
# define BUILD_MONTH_CH0 (__DATE__[ 0])
84
# define BUILD_MONTH_CH1 (__DATE__[ 1])
85
# define BUILD_MONTH_CH2 (__DATE__[ 2])
86
# define BUILD_DAY_CH0 ((__DATE__[4] >= '0') ? (__DATE__[4]) : '0')
87
# define BUILD_DAY_CH1 (__DATE__[ 5])
88
#endif // BUILD_DEFS_H
89
90
91
#ifdef DEBUG
92
# define checkpoint() printf("Checkpoint: Line %d in file %s\n",__LINE__,__FILE__);
93
#else
94
# define checkpoint()
95
#endif // DEBUG
96
97
98
#define MAX_INIT_TYPE_STRING_LENGTH 255
99
#define TIME_BUFFER_SIZE 64
100
#define MAX_INIT_VERSION_STRING_LENGTH 99
101
#define MAX_INIT_COMPILING_DATA_STRING_LENGTH 25
102
#define MAP_ERROR_STRING_LENGTH 1024
103
#define MAP_HORIZONTAL_TOL 1E-2
104
105
#define PROGNAME "MAP++ (Mooring Analysis Program++)"
106
#define PROGVERSION "1.20.10"
107
#define CHECKERRQ(code) if(success!=MAP_SAFE) {set_universal_error(map_msg, ierr, code); break;}
108
#define CHECKERRK(code) if(success!=MAP_SAFE) {set_universal_error(map_msg, ierr, code);}
109
#define MAPFREE(obj) if(obj!=NULL) {free(obj); obj=NULL;}
110
#define DEG2RAD 0.01745329251
/* pi/180 */
111
#define RAD2DEG 57.2957795131
/* 180/pi */
112
#define ARCSINH(x) log(x+sqrt(1+x*x))
113
#define SPACE_LENGTH 12
114
#define MACHINE_EPSILON 1e-16
115
#define MAP_BEGIN_ERROR_LOG do{ \
116
;
117
#define MAP_END_ERROR_LOG } while(0);
118
#define MAP_RETURN_STATUS(x) \
119
if (x==MAP_SAFE) { \
120
return MAP_SAFE; \
121
} else if (x==MAP_ERROR) { \
122
return MAP_ERROR; \
123
} else { \
124
return MAP_FATAL; \
125
};
126
127
128
/* Text Coloring (OS dependant)
129
*
130
* Not used any longer, but can color text at the terminal. If we are on a non-Unix OS, then:
131
* -- set the strings to "" (empty) so that garbage is not printed
132
*/
133
#ifdef __posix
134
# define MAP_COLOR_RED "\033[1;31m"
135
# define MAP_COLOR_YELLOW "\033[1;33m"
136
# define MAP_COLOR_BLUE "\033[1;34m"
137
# define MAP_COLOR_END "\033[0m"
138
#elif __linux
139
# define MAP_COLOR_RED "\033[1;31m"
140
# define MAP_COLOR_YELLOW "\033[1;33m"
141
# define MAP_COLOR_BLUE "\033[1;34m"
142
# define MAP_COLOR_END "\033[0m"
143
#elif __unix
144
# define MAP_COLOR_RED "\033[1;31m"
145
# define MAP_COLOR_YELLOW "\033[1;33m"
146
# define MAP_COLOR_BLUE "\033[1;34m"
147
# define MAP_COLOR_END "\033[0m"
148
#elif __APPLE__
149
# define MAP_COLOR_RED "\033[1;31m"
150
# define MAP_COLOR_YELLOW "\033[1;33m"
151
# define MAP_COLOR_BLUE "\033[1;34m"
152
# define MAP_COLOR_END "\033[0m"
153
#else
154
# define MAP_COLOR_RED ""
155
# define MAP_COLOR_YELLOW ""
156
# define MAP_COLOR_BLUE ""
157
# define MAP_COLOR_END ""
158
#endif
159
160
void
__get_machine_name(
char
* machineName );
161
162
#endif
/* _MAPSYS_H */
Generated by
1.8.13