Logo AND Algorithmique Numérique Distribuée

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