1 /*
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // This file holds compiler-dependent includes,
26 // globally used constants & types, class (forward)
27 // declarations and a few frequently used utility functions.
28
29 # include <ctype.h>
30 # include <string.h>
31 # include <stdarg.h>
32 # include <stdlib.h>
33 # include <stddef.h>// for offsetof
34 # include <io.h> // for stream.cpp
35 # include <float.h> // for _isnan
36 # include <stdio.h> // for va_list
37 # include <time.h>
38 # include <fcntl.h>
39 // Need this on windows to get the math constants (e.g., M_PI).
40 #define _USE_MATH_DEFINES
41 # include <math.h>
42
43 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
44 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
177 #endif
178
179 inline int vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr) {
180 // If number of characters written == count, Windows doesn't write a
181 // terminating NULL, so we do it ourselves.
182 int ret = _vsnprintf(buf, count, fmt, argptr);
183 if (count > 0) buf[count-1] = '\0';
184 return ret;
185 }
186
187 // Portability macros
188 #define PRAGMA_INTERFACE
189 #define PRAGMA_IMPLEMENTATION
190 #define PRAGMA_IMPLEMENTATION_(arg)
191 #define VALUE_OBJ_CLASS_SPEC : public _ValueObj
192
193 // Formatting.
194 #define FORMAT64_MODIFIER "I64"
195
196 #define offset_of(klass,field) offsetof(klass,field)
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP
26 #define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP
27
28 #include "prims/jni.h"
29
30 // This file holds compiler-dependent includes,
31 // globally used constants & types, class (forward)
32 // declarations and a few frequently used utility functions.
33
34 # include <ctype.h>
35 # include <string.h>
36 # include <stdarg.h>
37 # include <stdlib.h>
38 # include <stddef.h>// for offsetof
39 # include <io.h> // for stream.cpp
40 # include <float.h> // for _isnan
41 # include <stdio.h> // for va_list
42 # include <time.h>
43 # include <fcntl.h>
44 // Need this on windows to get the math constants (e.g., M_PI).
45 #define _USE_MATH_DEFINES
46 # include <math.h>
47
48 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
49 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
182 #endif
183
184 inline int vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr) {
185 // If number of characters written == count, Windows doesn't write a
186 // terminating NULL, so we do it ourselves.
187 int ret = _vsnprintf(buf, count, fmt, argptr);
188 if (count > 0) buf[count-1] = '\0';
189 return ret;
190 }
191
192 // Portability macros
193 #define PRAGMA_INTERFACE
194 #define PRAGMA_IMPLEMENTATION
195 #define PRAGMA_IMPLEMENTATION_(arg)
196 #define VALUE_OBJ_CLASS_SPEC : public _ValueObj
197
198 // Formatting.
199 #define FORMAT64_MODIFIER "I64"
200
201 #define offset_of(klass,field) offsetof(klass,field)
202
203 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP
|