Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c9da60a7e889170ca16604ee91a720adc9450bb8
[simgrid.git] / include / xbt / misc.h
1 /* xbt.h - Public interface to the xbt (simgrid's toolbox)                     */
2
3 /* Copyright (c) 2004-2015. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #ifndef XBT_MISC_H
10 #define XBT_MISC_H
11
12 #include "simgrid_config.h"
13 #include "base.h"
14 #include "dynar.h"
15
16 #include <stdarg.h>
17
18 SG_BEGIN_DECL()
19
20 /** Cache the size of a memory page for the current system. */
21 XBT_PUBLIC_DATA(int) xbt_pagesize;
22
23 /** Cache the number of bits of addresses inside a given page, log2(xbt_pagesize). */
24 XBT_PUBLIC_DATA(int) xbt_pagebits;
25
26 XBT_PUBLIC(const char *) xbt_procname(void);
27
28 /** Helps ensuring that header version (SIMGRID_VERSION_MAJOR and friends) and dynamic library version do match. */
29 XBT_PUBLIC(void) sg_version_check(int lib_version_major,int lib_version_minor,int lib_version_patch);
30
31 /** Contains all the parameters we got from the command line */
32 XBT_PUBLIC_DATA(xbt_dynar_t) sg_cmdline;
33
34 /* snprintf related functions */
35 /** @addtogroup XBT_str
36   * @{ */
37
38 /** @brief print to allocated string
39  *
40  * Similar to vasprintf(), but returns a pointer to the newly created string (or aborts on error).
41  */
42 XBT_PUBLIC(char *) bvprintf(const char *fmt, va_list ap);
43 /** @brief print to allocated string
44  *
45  * Similar to asprintf(), but returns a pointer to the newly created string (or aborts on error).
46  */
47 XBT_PUBLIC(char *) bprintf(const char *fmt, ...) XBT_ATTRIB_PRINTF(1, 2);
48 /** @} */
49
50 SG_END_DECL()
51
52 #endif                          /* XBT_MISC_H */