Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
help doxygen to stop complaining about documentation for unknown define
[simgrid.git] / include / xbt / misc.h
1 /* $Id$ */
2
3 /* xbt.h - Public interface to the xbt (gras's toolbox)                     */
4
5 /* Copyright (c) 2004 Martin Quinson.                                       */
6 /* Copyright (c) 2004 Arnaud Legrand.                                       */
7 /* All rights reserved.                                                     */
8
9 /* This program is free software; you can redistribute it and/or modify it
10  * under the terms of the license (GNU LGPL) which comes with this package. */
11
12 #ifndef XBT_MISC_H
13 #define XBT_MISC_H
14
15 /* Attributes are only in recent versions of GCC */
16 #if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
17 # define _XBT_GNUC_PRINTF( format_idx, arg_idx )    \
18            __attribute__((__format__ (__printf__, format_idx, arg_idx)))
19 # define _XBT_GNUC_SCANF( format_idx, arg_idx )     \
20                __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
21 # define _XBT_GNUC_FORMAT( arg_idx )                \
22                    __attribute__((__format_arg__ (arg_idx)))
23 # define _XBT_GNUC_NORETURN __attribute__((__noreturn__))
24
25 #else   /* !__GNUC__ */
26 # define _XBT_GNUC_PRINTF( format_idx, arg_idx )
27 # define _XBT_GNUC_SCANF( format_idx, arg_idx )
28 # define _XBT_GNUC_FORMAT( arg_idx )
29 # define _XBT_GNUC_NORETURN
30
31 #endif  /* !__GNUC__ */
32
33 /* inline and __FUNCTION__ are only in GCC when -ansi is off */
34
35 #if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
36
37 # define _XBT_GNUC_FUNCTION __FUNCTION__
38 # define _XBT_INLINE inline
39 #else
40 # define _XBT_GNUC_FUNCTION "function"
41 # define _XBT_INLINE 
42 #endif
43
44
45
46 #ifndef max
47 #  define max(a, b) (((a) > (b))?(a):(b))
48 #endif
49 #ifndef min
50 #  define min(a, b) (((a) < (b))?(a):(b))
51 #endif
52
53 #define TRUE  1
54 #define FALSE 0
55
56 #define XBT_MAX_CHANNEL 10 /* FIXME: killme */
57 /*! C++ users need love */
58 #ifndef BEGIN_DECL
59 # ifdef __cplusplus
60 #  define BEGIN_DECL() extern "C" {
61 # else
62 #  define BEGIN_DECL() 
63 # endif
64 #endif
65
66 /*! C++ users need love */
67 #ifndef END_DECL
68 # ifdef __cplusplus
69 #  define END_DECL() }
70 # else
71 #  define END_DECL() 
72 # endif
73 #endif
74 /* End of cruft for C++ */
75
76 BEGIN_DECL()
77 /* Dunno where to place this: needed by config and amok */
78 typedef struct {  
79    char *name;
80    int port;
81 } xbt_host_t;
82
83 const char *xbt_procname(void);
84
85 END_DECL()
86
87 #endif /* XBT_MISC_H */