1 /* generic_math_int64.h - Native methods for 64bit math operations
2 Copyright (C) 1998 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 Description: generic target defintions of miscellaneous functions
43 #ifndef __TARGET_GENERIC_MISC__
44 #define __TARGET_GENERIC_MISC__
46 /* check if target_native_misc.h included */
47 #ifndef __TARGET_NATIVE_MISC__
48 #error Do NOT INCLUDE generic target files! Include the corresponding native target files instead!
51 /****************************** Includes *******************************/
52 /* do not move; needed here because of some macro definitions */
58 #include "target_native.h"
60 /****************** Conditional compilation switches *******************/
62 /***************************** Constants *******************************/
64 /***************************** Datatypes *******************************/
66 /***************************** Variables *******************************/
68 /****************************** Macros *********************************/
70 /***********************************************************************\
71 * Name : TARGET_NATIVE_MISC_FORMAT_STRING<n>
72 * Purpose : format a string (with a fixed number of) arguments
73 * Input : buffer - buffer for string
74 * bufferSize - size of buffer
75 * format - format string (like printf)
76 * args - optional arguments (GNU CPP only!)
79 * Side-effect: unknown
80 * Notes : - this is a "safe" macro to format string; buffer-
81 * overflows will be avoided. Direct usage of e. g.
82 * snprintf() is not permitted because it is not ANSI C
84 * - do not use this routine in a function without
85 * variable number of arguments (ellipses), because
86 * va_list/va_start/va_end is used!
87 \***********************************************************************/
89 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING0
91 #define TARGET_NATIVE_MISC_FORMAT_STRING0(buffer,bufferSize,format) \
93 snprintf(buffer,bufferSize, "%s", format); \
96 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING1
98 #define TARGET_NATIVE_MISC_FORMAT_STRING1(buffer,bufferSize,format,arg1) \
100 snprintf(buffer,bufferSize,format,arg1); \
103 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING2
105 #define TARGET_NATIVE_MISC_FORMAT_STRING2(buffer,bufferSize,format,arg1,arg2) \
107 snprintf(buffer,bufferSize,format,arg1,arg2); \
110 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING3
112 #define TARGET_NATIVE_MISC_FORMAT_STRING3(buffer,bufferSize,format,arg1,arg2,arg3) \
114 snprintf(buffer,bufferSize,format,arg1,arg2,arg3); \
117 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING4
119 #define TARGET_NATIVE_MISC_FORMAT_STRING4(buffer,bufferSize,format,arg1,arg2,arg3,arg4) \
121 snprintf(buffer,bufferSize,format,arg1,arg2,arg3,arg4); \
124 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING5
126 #define TARGET_NATIVE_MISC_FORMAT_STRING5(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5) \
128 snprintf(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5); \
131 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING6
133 #define TARGET_NATIVE_MISC_FORMAT_STRING6(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5,arg6) \
135 snprintf(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5,arg6); \
138 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING7
140 #define TARGET_NATIVE_MISC_FORMAT_STRING7(buffer,bufferSize,format,arg1,arg2,arg3,arg14,arg5,arg6,arg7) \
142 snprintf(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5,arg6,arg7); \
145 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING8
147 #define TARGET_NATIVE_MISC_FORMAT_STRING8(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \
149 snprintf(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8); \
152 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING9
154 #define TARGET_NATIVE_MISC_FORMAT_STRING9(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \
156 snprintf(buffer,bufferSize,format,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); \
160 /***********************************************************************\
161 * Name : TARGET_NATIVE_FORMAT_STRING_ELLIPSE
162 * Purpose : format a string with arguments
163 * Input : buffer - buffer for string
164 * bufferSize - size of buffer
165 * format - format string (like printf)
168 * Side-effect: unknown
169 * Notes : - this is a "safe" macro to format string; buffer-
170 * overflows will be avoided. Direct usage of e. g.
171 * snprintf() is not permitted because it is not ANSI C
173 * - do not use this routine in a function without
174 * variable number of arguments (ellipses), because
175 * va_list/va_start/va_end is used!
176 \***********************************************************************/
178 #ifndef TARGET_NATIVE_MISC_FORMAT_STRING_ELLIPSE
180 #define TARGET_NATIVE_FORMAT_STRING_ELLIPSE(buffer,bufferSize,format) \
182 va_list __arguments; \
184 va_start(__arguments,format); \
185 vsnprintf(buffer,bufferSize,format,__arguments); \
186 va_end(__arguments); \
190 /***************************** Functions *******************************/
200 #endif /* __TARGET_GENERIC_MISC__ */