Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Dont declare variables at the middle of nowhere.
[simgrid.git] / include / simgrid_config.h.in
1 /* $Id$ */
2
3 /* simgrid_config.h - Results of the configure made visible to user code    */
4
5 /* Copyright (c) 2009, Da SimGrid team. All rights reserved.                */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "xbt/misc.h"           /* XBT_PUBLIC */
11 #ifdef _WIN32
12         #define DLL_EXPORT
13 #endif
14
15 #ifndef SIMGRID_PUBLIC_CONFIG_H
16 #define SIMGRID_PUBLIC_CONFIG_H
17
18 /* Get the config */
19 #undef SIMGRID_NEED_GETLINE
20 #undef SIMGRID_NEED_ASPRINTF
21 #undef SIMGRID_NEED_VASPRINTF
22 @need_getline@
23 @need_asprintf@
24 @need_vasprintf@
25
26 /* Use that config to declare missing elements */
27 #ifdef SIMGRID_NEED_GETLINE
28 #include <stdlib.h> /* size_t */
29 #include <stdio.h>  /* FILE*  */
30 XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
31 #else
32 #ifndef _GNU_SOURCE
33         #define _GNU_SOURCE
34 #endif
35 #include <stdio.h>
36 #endif
37
38
39 /* snprintf related functions */
40 /** @addtogroup XBT_str
41   * @{ */
42 /** @brief print to allocated string (reimplemented when not provided by the system)
43  *
44  * The functions asprintf() and vasprintf() are analogues of
45  * sprintf() and vsprintf(), except that they allocate a string large
46  * enough to hold the output including the terminating null byte, and
47  * return a pointer to it via the first parameter.  This pointer
48  * should be passed to free(3) to release the allocated storage when
49  * it is no longer needed.
50  */
51 #if defined(SIMGRID_NEED_ASPRINTF)||defined(DOXYGEN)
52 XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt,   /*args */
53                          ...) _XBT_GNUC_PRINTF(2, 3);
54 #endif
55 /** @brief print to allocated string (reimplemented when not provided by the system)
56  *
57  * See asprintf()
58  */
59 #if defined(SIMGRID_NEED_VASPRINTF)||defined(DOXYGEN)
60 #include <stdarg.h>
61 XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
62 #endif
63 /** @brief print to allocated string
64  *
65  * Works just like asprintf(), but returns a pointer to the newly created string
66  */
67 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
68 /** @} */
69
70 #endif /* SIMGRID_PUBLIC_CONFIG_H */