Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix xbt_fifo_foreach
[simgrid.git] / include / simgrid / modelchecker.h
1 /* simgrid/modelchecker.h - Formal Verification made possible in SimGrid    */
2
3 /* Copyright (c) 2008-2014. 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 #include <stdbool.h>
10
11 #include <simgrid_config.h> /* HAVE_MC ? */
12 #include <xbt.h>
13 #include "xbt/automaton.h"
14
15 #ifndef SIMGRID_MODELCHECKER_H
16 #define SIMGRID_MODELCHECKER_H
17
18 SG_BEGIN_DECL()
19
20 XBT_PUBLIC(int) MC_random(int min, int max);
21
22 #ifdef HAVE_MC
23
24 extern int _sg_do_model_check; /* please don't use directly: we inline MC_is_active, but that's what you should use */
25 extern int _sg_mc_visited;
26
27 #define MC_is_active()                  _sg_do_model_check
28 #define MC_visited_reduction()          _sg_mc_visited
29
30 XBT_PUBLIC(void) MC_assert(int);
31 XBT_PUBLIC(void) MC_automaton_new_propositional_symbol(const char* id, int(*fct)(void));
32 XBT_PUBLIC(void) MC_automaton_new_propositional_symbol_pointer(const char *id, int* value);
33 XBT_PUBLIC(void) MC_automaton_new_propositional_symbol_callback(const char* id,
34   xbt_automaton_propositional_symbol_callback_type callback,
35   void* data, xbt_automaton_propositional_symbol_free_function_type free_function);
36 XBT_PUBLIC(void *) MC_snapshot(void);
37 XBT_PUBLIC(int) MC_compare_snapshots(void *s1, void *s2);
38 XBT_PUBLIC(void) MC_cut(void);
39 XBT_PUBLIC(void) MC_ignore(void *addr, size_t size);
40
41 #else
42
43 #define MC_is_active()                  0
44 #define MC_visited_reduction()          0
45
46 #define MC_assert(a)                    xbt_assert(a)
47 #define MC_automaton_new_propositional_symbol(a, b) ((void)0)
48 #define MC_automaton_new_propositional_symbol_pointer(a, b) ((void)0)
49 #define MC_automaton_new_propositional_symbol_callback(id,callback,data,free_function) \
50   if(free_function) free_function(data);
51 #define MC_snapshot()                   ((void*)0)
52 #define MC_compare_snapshots(a, b)      0
53 #define MC_cut()                        ((void)0)
54 #define MC_ignore(a, b)                 ((void)0)
55
56 #endif
57
58 SG_END_DECL()
59
60 #endif /* SIMGRID_MODELCHECKER_H */