Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add win32/compiler/borland.h for specific borland compiler config.
[simgrid.git] / src / win32 / compiler / borland.h
1 #ifndef __XBT_BORLAND_COMPILER_CONFIG_H__
2 #define __XBT_BORLAND_COMPILER_CONFIG_H__
3
4 /* borland.h - simgrid config for Borland C++ Builder   */
5
6 /* Copyright (c) 2003, 2004 Cherier Malek. All rights reserved.            */
7
8 /* This program is free software; you can redistribute it and/or modify it
9  * under the terms of the license (GNU LGPL) which comes with this package. */
10
11 /*
12  *  Borland C++ compiler configuration
13  */
14
15 #include <platform/select_platform_features.h>
16
17 /* 
18  * include files. 
19  */
20
21 /* No <dlfcn.h> header file. */
22 #if defined(HAVE_DLFCN_H)
23         #undef HAVE_DLFCN_H
24 #endif 
25
26 /* Defined if the compiler has the <errno.h> header file. */
27 #if !defined(HAVE_ERRNO_H)
28         #define HAVE_ERRNO_H            1
29 #endif
30
31 /* No <execinfo.h> header file. */
32 #if defined(HAVE_EXECINFO_H)
33         #undef HAVE_EXECINFO_H
34 #endif
35
36 /* No <inttypes.h> header file. */
37 #if defined(HAVE_INTTYPES_H)
38         #undef HAVE_INTTYPES_H
39 #endif
40
41 /* Defined if compiler has the <memory.h> header file. */
42 #if !defined(HAVE_MEMORY_H)
43         #define HAVE_MEMORY_H           1
44 #endif
45
46 /* No <pthread.h> header file. */
47 #if defined(HAVE_PTHREAD_H)
48         #undef HAVE_PTHREAD_H
49 #endif
50
51
52 /* No <stdint.h> header file. */
53 #if defined(HAVE_STDINT_H)
54         #undef HAVE_STDINT_H
55 #endif
56
57 /* The compiler has the <stdlib.h> header file. */
58 #if !defined(HAVE_STDLIB_H)
59         #define HAVE_STDLIB_H           1
60 #endif
61
62 /* No <strings.h> header file. */
63 #if defined(HAVE_STRINGS_H)
64         #undef HAVE_STRINGS_H
65 #endif
66
67 /* The compiler has the <string.h> header file. */
68 #if !defined(HAVE_STRING_H)
69         #define HAVE_STRING_H           1
70 #endif
71
72 /* No <sys/socket.h> header file. */
73 #if defined(HAVE_SYS_SOCKET_H)
74         #undef HAVE_SYS_SOCKET_H
75 #endif
76
77 /* The compiler has <sys/stat.h> header file. */
78 #if !defined(HAVE_SYS_STAT_H)
79         #define HAVE_SYS_STAT_H         1
80 #endif
81
82 /* No <sys/time.h> header file. */
83 #if defined(HAVE_SYS_TIME_H)
84         #undef HAVE_SYS_TIME_H          1
85 #endif
86
87 /* The compiler has the <sys/types.h> header file. */
88 #if !defined(HAVE_SYS_TYPES_H)
89         #define HAVE_SYS_TYPES_H        1
90 #endif
91
92 /* No <unistd.h> header file. */
93 #if defined(HAVE_UNISTD_H)
94         #undef HAVE_UNISTD_H    
95 #endif
96
97 /* 
98  * The compiler has the <windows.h> header file. 
99  * Process the case of afx.h
100 */
101 #if !defined(HAVE_WINDOWS_H)
102         #define HAVE_WINDOWS_H          1
103 #endif
104
105 /* The compiler has the <winsock2.h> header file. */
106 #if !defined(HAVE_WINSOCK2_H)
107         #define HAVE_WINSOCK2_H
108 #endif
109
110 /*  
111  * The compiler has the <winsock.h> header file.
112  * Trouble if winsock2.h exists ?  
113  */
114 #if !defined(HAVE_WINSOCK_H)
115         #define HAVE_WINSOCK_H  1
116 #endif
117
118 /* The compiler has the <signal.h> header file */
119 #if !defined(HAVE_SIGNAL_H)
120         #define HAVE_SIGNAL_H   1
121 #endif
122
123 /* 
124  * functions.
125  */
126
127 /* No `getcontext' function. */
128 #if defined(HAVE_GETCONTEXT)
129         #undef HAVE_GETCONTEXT
130 #endif
131
132 /* No `getdtablesize' function. */
133 #if defined(HAVE_GETDTABLESIZE)
134         #undef HAVE_GETDTABLESIZE
135 #endif
136
137 /* No `gettimeofday' function. */
138 #if defined(HAVE_GETTIMEOFDAY)
139         #undef HAVE_GETTIMEOFDAY
140 #endif
141
142 /* No `makecontext' function. */
143 #if defined(HAVE_MAKECONTEXT)
144         #undef HAVE_MAKECONTEXT
145 #endif
146
147 /* No 'popen' function. */
148 #if defined(HAVE_POPEN)
149         #undef HAVE_POPEN
150 #endif
151
152 /* No `readv' function. */
153 #if defined(HAVE_READV)
154         #undef HAVE_READV
155 #endif
156
157 /* No `setcontext' function. */
158 #if defined(HAVE_SETCONTEXT)
159         #undef HAVE_SETCONTEXT
160 #endif
161
162 /* No 'signal' function */
163 #if defined(HAVE_SIGNAL)
164         #undef HAVE_SIGNAL
165 #endif
166
167 /* The compiler has `snprintf' function. */
168 #if !defined(HAVE_SNPRINTF)
169         #define HAVE_SNPRINTF   1
170 #endif
171
172 /* No `swapcontext' function. */
173 #if defined(HAVE_SWAPCONTEXT)
174         #undef HAVE_SWAPCONTEXT
175 #endif
176
177 /* No `sysconf' function. */
178 #if defined(HAVE_SYSCONF)
179         #undef HAVE_SYSCONF
180 #endif
181
182 /* No `usleep' function. */
183 #if defined(HAVE_USLEEP)
184         #undef HAVE_USLEEP
185 #endif
186
187 /* The compiler has the `vsnprintf' function. */
188 #if !defined(HAVE_VSNPRINTF)
189         #define HAVE_VSNPRINTF  1
190 #endif
191
192 /* enable the asprintf replacement */
193 #if !defined(NEED_ASPRINTF)
194         #define NEED_ASPRINTF   1
195 #endif
196
197 /* enable the vasprintf replacement */
198 #if  !defined(NEED_VASPRINTF)
199         #define NEED_VASPRINTF  1
200 #endif
201
202 /* "disable the snprintf replacement ( this function is broken on system v only" */
203 #if defined(PREFER_PORTABLE_SNPRINTF)
204         #undef PREFER_PORTABLE_SNPRINTF 
205 #endif
206
207 /* The maximal size of any scalar on this arch */
208 #if !defined(SIZEOF_MAX)
209         #define SIZEOF_MAX 8
210 #endif
211
212 /* Define to 1 if you have the ANSI C header files. */
213 #if !defined(STDC_HEADERS)
214         #define STDC_HEADERS 1
215 #endif
216
217 #if defined(TIME_WITH_SYS_TIME)
218         #undef TIME_WITH_SYS_TIME 
219 #endif
220
221 /* 
222  * libraries
223  */
224
225 /* Define to 1 if you have the `pthread' library (-lpthread). */
226 #if defined(HAVE_LIBPTHREAD)
227         #undef HAVE_LIBPTHREAD
228 #endif
229
230 /* 
231  * package informations ?
232  */
233  
234  
235 /* Defined if arrays in struct can straddle struct alignment boundaries. This
236 is like than the structure compaction above, but this time, the argument to
237 be compacted is an array whom each element would be normally compacted.
238 Exemple: struct s { double d; int i; char c[6]; }; Arrays can straddle if c
239 is allowed to come just after i. Note that GRAS only support architecture
240 presenting this caracteristic so far. */
241
242 #if defined(GRAS_ARRAY_STRADDLE_STRUCT)
243         #undef GRAS_ARRAY_STRADDLE_STRUCT
244 #endif
245
246 /* Defined if structures are compacted when possible. Consider this structure:
247 struct s {double d; int i; char c;}; If it is allowed, the char is placed
248 just after the int. If not, it has to be on the 8 bytes boundary imposed by
249 the double. For now, GRAS requires the structures to be compacted. */
250 #if defined(GRAS_STRUCT_COMPACT)
251         #undef GRAS_STRUCT_COMPACT
252 #endif
253
254 /* Name of package */
255 #define PACKAGE "simgrid"
256
257 /* Define to the address where bug reports for this package should be sent. */
258 #define PACKAGE_BUGREPORT "simgrid-devel@lists.gforge.inria.fr"
259
260 /* Define to the full name of this package. */
261 #define PACKAGE_NAME "simgrid"
262
263 /* Define to the full name and version of this package. */
264 #define PACKAGE_STRING "simgrid 3.1.1-cvs"
265
266 /* Define to the one symbol short name of this package. */
267 #define PACKAGE_TARNAME "simgrid"
268
269 /* Define to the version of this package. */
270 #define PACKAGE_VERSION "3.1.1-cvs"
271
272 /* 
273  * macro
274  */
275  
276  /* define if big endian */
277 #if !defined(GRAS_BIGENDIAN)
278         #define GRAS_BIGENDIAN 0
279 #endif
280
281 /* Defined if structures are compacted when possible. Consider this structure:
282 struct s {double d; int i; char c;}; If it is allowed, the char is placed
283 just after the int. If not, it has to be on the 8 bytes boundary imposed by
284 the double. For now, GRAS requires the structures to be compacted. */
285 #if defined(GRAS_STRUCT_COMPACT)
286         #define GRAS_STRUCT_COMPACT 1
287 #endif
288
289 /* defines the GRAS architecture signature of this machine */
290 #if defined(GRAS_THISARCH)
291         #undef GRAS_THISARCH
292 #endif
293
294 #define GRAS_THISARCH 0
295
296  
297  /* Path to the addr2line tool */
298 #if defined(ADDR2LINE)
299         #undef ADDR2LINE
300 #endif
301
302 #if !defined(HAVE_VA_COPY)
303         #define HAVE_VA_COPY 1
304 #endif
305
306 /* This macro is not defined in borland stdarg.h include file, adds it. */
307 #define va_copy(dest,src)   ((dest)=(src))  
308
309 /* Predefined possible va_copy() implementation (id: ASP) */
310 #define __VA_COPY_USE_ASP(d, s) do { *(d) = *(s); } while (0)
311
312 /* Predefined possible va_copy() implementation (id: ASS) */
313 #define __VA_COPY_USE_ASS(d, s) do { (d) = (s); } while (0)
314
315 /* Predefined possible va_copy() implementation (id: C99) */
316 #define __VA_COPY_USE_C99(d, s) va_copy((d), (s))
317
318 /* Predefined possible va_copy() implementation (id: CPP) */
319 #define __VA_COPY_USE_CPP(d, s) memcpy((void *)(d), (void *)(s)), sizeof(*(s))
320
321 /* Predefined possible va_copy() implementation (id: CPS) */
322 #define __VA_COPY_USE_CPS(d, s) memcpy((void *)&(d), (void *)&(s)), sizeof((s))
323
324 /* Predefined possible va_copy() implementation (id: GCB) */
325 #define __VA_COPY_USE_GCB(d, s) __builtin_va_copy((d), (s))
326
327 /* Predefined possible va_copy() implementation (id: GCH) */
328 #define __VA_COPY_USE_GCH(d, s) __va_copy((d), (s))
329
330 /* Predefined possible va_copy() implementation (id: GCM) */
331 #define __VA_COPY_USE_GCM(d, s) VA_COPY((d), (s))
332
333
334 /* Optional va_copy() implementation activation */
335 #ifndef HAVE_VA_COPY
336 #define va_copy(d, s) __VA_COPY_USE(d, s)
337 #endif
338
339
340 /* Define to id of used va_copy() implementation */
341 #define __VA_COPY_USE __VA_COPY_USE_C99
342
343 #if defined(_XBT_DESIGNATED_DLL)
344         #define _XBT_CALL __cdecl __export
345 #elif defined(_RTLDLL)
346         #define  _XBT_CALL __cdecl __import
347 #else
348         #define  _XBT_CALL __cdecl
349 #endif
350
351 /* auto enable thread safety and exceptions: */
352 #ifndef _CPPUNWIND
353         #define _XBT_HAS_NO_EXCEPTIONS
354 #endif
355
356 #if defined ( __MT__ ) && !defined (_NOTHREADS) && !defined (_REENTRANT)
357         #define _REENTRANT 1
358 #endif
359
360 #if defined ( __DEBUG ) && ( __DEBUG > 1 )
361         #define _XBT_DEBUG
362 #endif
363
364 #define _XBT_LIB_BASENAME "xbt"
365
366 #define _XBT_EXPORT_DECLSPEC __declspec(dllexport)
367 #define _XBT_IMPORT_DECLSPEC __declspec(dllimport)
368         
369 #define _XBT_CLASS_EXPORT_DECLSPEC __declspec(dllexport)
370 #define _XBT_CLASS_IMPORT_DECLSPEC __declspec(dllimport)
371
372     #if(__BORLANDC__>= 0x500)
373             #define _XBT_HAS_NAMESPACES
374     #endif
375
376
377 #if(__BORLANDC__ < 0x540)
378
379         #if (defined (__DLL) || defined (_DLL) || defined (_WINDLL) || defined (_RTLDLL) || defined (_XBT_USE_DYNAMIC_LIB) ) && ! defined (_XBT_USE_STATIC_LIB)
380                 #undef  _XBT_USE_DECLSPEC
381                 #define _XBT_USE_DECLSPEC
382         #endif
383         
384 #else
385                 
386         #if ( defined (__DLL) || defined (_DLL) || defined (_WINDLL) || defined (_RTLDLL) || defined(_AFXDLL) || defined (_XBT_USE_DYNAMIC_LIB) )
387                 #undef  _XBT_USE_DECLSPEC
388                 #define _XBT_USE_DECLSPEC 1
389         #endif
390 #endif
391
392 /* For open, read etc. file operations. */
393 #include <io.h>
394 #include <fcntl.h>
395
396 /* For getpid() function. */
397 #include <process.h>
398
399 /* no unistd.h header file. */
400 #define YY_NO_UNISTD_H 
401 /*
402  * Replace winsock2.h,ws2tcpip.h and winsock.h header files */
403 #include <windows.h>
404
405 /* types */
406 typedef unsigned int uint32_t;
407 typedef int socklen_t;
408
409 #define tcp_read( s, buf, len )         recv( s, buf, len, 0 )
410 #define tcp_write( s, buf, len )        send( s, buf, len, 0 )
411 #define ioctl( s, c, a )                ioctlsocket( (s), (c), (a) )
412 #define ioctl_t                                         u_long
413 #define AC_SOCKET_INVALID               ((unsigned int) ~0)
414
415 #ifdef SD_BOTH
416         #define tcp_close(s)    (shutdown( s, SD_BOTH ), closesocket(s))
417 #else
418         #define tcp_close( s )  closesocket( s )
419 #endif
420
421 #ifndef EWOULDBLOCK
422         #define EWOULDBLOCK WSAEWOULDBLOCK
423 #endif
424
425 #ifndef EINPROGRESS
426         #define EINPROGRESS WSAEINPROGRESS
427 #endif
428
429 #ifndef ETIMEDOUT
430         #define ETIMEDOUT   WSAETIMEDOUT
431 #endif
432
433 #ifdef sock_errno
434         #undef  sock_errno
435 #endif
436
437 #define sock_errno         WSAGetLastError()
438
439 #ifdef sock_errstr
440         #undef  sock_errstr
441 #endif
442
443 #define sock_errstr(err)   gras_wsa_err2string(err)
444
445 const char *gras_wsa_err2string(int errcode);
446
447 #ifdef S_IRGRP
448         #undef S_IRGRP
449 #endif
450
451 #define S_IRGRP 0
452
453 #ifdef S_IWGRP
454         #undef S_IWGRP
455 #endif
456
457 #define S_IWGRP 0
458
459 #endif /* #ifndef __XBT_BORLAND_COMPILER_CONFIG_H__ */