Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
b4267e11e489c3c59c249359e953cf2b1e42f35e
[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
12 #ifndef SIMGRID_PUBLIC_CONFIG_H
13 #define SIMGRID_PUBLIC_CONFIG_H
14
15 /* Get the config */
16 #undef SIMGRID_NEED_GETLINE
17 #undef SIMGRID_NEED_ASPRINTF
18 #undef SIMGRID_NEED_VASPRINTF
19 @need_getline@
20 @need_asprintf@
21 @need_vasprintf@
22
23 /* Use that config to declare missing elements */
24 #ifdef SIMGRID_NEED_GETLINE
25 #include <stdlib.h> /* size_t */
26 XBT_PUBLIC(long) getline(char **lineptr, size_t * n, FILE * stream);
27 #else
28 #define _GNU_SOURCE
29 #include <stdio.h>
30 #endif
31
32
33 /* snprintf related functions */
34 /** @addtogroup XBT_str
35   * @{ */
36 /** @brief print to allocated string (reimplemented when not provided by the system)
37  *
38  * The functions asprintf() and vasprintf() are analogues of
39  * sprintf() and vsprintf(), except that they allocate a string large
40  * enough to hold the output including the terminating null byte, and
41  * return a pointer to it via the first parameter.  This pointer
42  * should be passed to free(3) to release the allocated storage when
43  * it is no longer needed.
44  */
45 #if defined(SIMGRID_NEED_ASPRINTF)||defined(DOXYGEN)
46 XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt,   /*args */
47                          ...) _XBT_GNUC_PRINTF(2, 3);
48 #endif
49 /** @brief print to allocated string (reimplemented when not provided by the system)
50  *
51  * See asprintf()
52  */
53 #if defined(SIMGRID_NEED_VASPRINTF)||defined(DOXYGEN)
54 XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
55 #endif
56 /** @brief print to allocated string
57  *
58  * Works just like asprintf(), but returns a pointer to the newly created string
59  */
60 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
61 /** @} */
62
63 #endif /* SIMGRID_PUBLIC_CONFIG_H */