PLE
Parallel Location and Exchange
ple_config_defs.h
Go to the documentation of this file.
1 #ifndef __PLE_CONFIG_DEFS_H__
2 #define __PLE_CONFIG_DEFS_H__
3 
4 /*============================================================================
5  * Base macro and typedef definitions for system portability
6  *============================================================================*/
7 
8 /*
9  This file is part of the "Parallel Location and Exchange" library,
10  intended to provide mesh or particle-based code coupling services.
11 
12  Copyright (C) 2005-2020 EDF S.A.
13 
14  This library is free software; you can redistribute it and/or
15  modify it under the terms of the GNU Lesser General Public
16  License as published by the Free Software Foundation; either
17  version 2.1 of the License, or (at your option) any later version.
18 
19  This library is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  Lesser General Public License for more details.
23 
24  You should have received a copy of the GNU Lesser General Public
25  License along with this library; if not, write to the Free Software
26  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 */
28 
29 /*----------------------------------------------------------------------------*/
30 
31 #include "ple_config.h"
32 #include "ple_config_priv.h"
33 
34 /*----------------------------------------------------------------------------*/
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #if 0
39 } /* Fake brace to force Emacs auto-indentation back to column 0 */
40 #endif
41 #endif /* __cplusplus */
42 
43 /*============================================================================
44  * Basic macros
45  *============================================================================*/
46 
47 /*============================================================================
48  * Internationalization (future)
49  *============================================================================*/
50 
51 #if defined(ENABLE_NLS) && defined(HAVE_GETTEXT)
52 # include <libintl.h>
53 # define _(String) dgettext(PACKAGE,String)
54 # ifdef gettext_noop
55 # define N_(String) gettext_noop(String)
56 # else
57 # define N_(String) String
58 # endif /* gettext_noop */
59 #else
60 # define _(String) (String)
61 # define N_(String) String
62 # define textdomain(String) (String)
63 # define gettext(String) (String)
64 # define dgettext(Domain,String) (String)
65 # define dcgettext(Domain,String,Type) (String)
66 # define bindtextdomain(Domain,Directory) (Domain)
67 #endif /* ENABLE_NLS && HAVE_GETTEXT */
68 
69 /*============================================================================
70  * C99 Qualifiers
71  *============================================================================*/
72 
73 /* inline provided by ple_config.h if necessary */
74 
75 /* restrict type qualifier (standard in C99) */
76 
77 #if defined(__GNUC__)
78 #define restrict __restrict
79 #else
80 #define restrict
81 #endif
82 
83 /*============================================================================
84  * Definitions that may not always be provided directly by the system
85  *============================================================================*/
86 
87 /*
88  * Usually stdint.h is included by inttypes.h, but only inttypes.h exists
89  * on certain systems, such as Tru64Unix.
90  */
91 
92 #if HAVE_STDINT_H
93 # include <stdint.h>
94 #elif HAVE_INTTYPES_H
95 # include <inttypes.h>
96 #endif
97 
98 /* C99 _Bool type */
99 
100 #if HAVE_STDBOOL_H
101 # include <stdbool.h>
102 #else
103 # if !HAVE__BOOL
104 # ifdef __cplusplus
105 typedef bool _Bool;
106 # else
107  define _Bool signed char;
108 # endif
109 # endif
110 # define bool _Bool
111 # define false 0
112 # define true 1
113 # define __bool_true_false_are_defined 1
114 #endif
115 
116 /* int32_t type */
117 
118 #if !defined(HAVE_INT32_T)
119 # if (PLE_SIZEOF_INT == 4)
120 typedef int int32_t;
121 # elif (PLE_SIZEOF_SHORT == 4)
122 typedef short int32_t;
123 # else
124 # error
125 # endif
126 #endif
127 
128 /* int64_t type */
129 
130 #if !defined(HAVE_INT64_T)
131 # if (PLE_SIZEOF_INT == 8)
132 typedef int int64_t;
133 # elif (PLE_SIZEOF_LONG == 8)
134 typedef long int64_t;
135 # elif (HAVE_LONG_LONG == 8) /* PLE_SIZEOF_LONG_LONG not generally available */
136 typedef long long int64_t;
137 # else
138 # error
139 # endif
140 #endif
141 
142 /* uint32_t type */
143 
144 #if !defined(HAVE_UINT32_T)
145 # if (PLE_SIZEOF_INT == 4)
146 typedef unsigned uint32_t;
147 # elif (PLE_SIZEOF_SHORT == 4)
148 typedef unsigned short uint32_t;
149 # else
150 # error
151 # endif
152 #endif
153 
154 /* uint64_t type */
155 
156 #if !defined(HAVE_UINT64_T)
157 # if (PLE_SIZEOF_INT == 8)
158 typedef unsigned uint64_t;
159 # elif (PLE_SIZEOF_LONG == 8)
160 typedef unsigned long uint64_t;
161 # elif (HAVE_LONG_LONG) /* PLE_SIZEOF_LONG_LONG not generally available */
162 typedef unsigned long long uint64_t;
163 # else
164 # error
165 # endif
166 #endif
167 
168 /*----------------------------------------------------------------------------*/
169 
170 #ifdef __cplusplus
171 }
172 #endif /* __cplusplus */
173 
174 #endif /* __PLE_CONFIG_DEFS_H__ */