PIPS
callback.c
Go to the documentation of this file.
1 /*
2 
3  $Id: callback.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 /*
28  */
29 
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include "genC.h"
33 #include "linear.h"
34 #include "ri.h"
35 
36 #include "database.h"
37 #include "pipsmake.h"
38 
41 static bool callback_set_p = false;
42 
44 {
45  message_assert("callback is already set", callback_set_p == false);
46 
47  callback_set_p = true;
48  callback = p;
49 }
50 
52 {
53  message_assert("callback not set", callback_set_p == true);
54 
55  callback_set_p = false;
57 }
58 
60 {
61  bool result = true;
62 
63  if (callback_set_p)
64  result = (*callback)();
65 
66  return result;
67 }
bool run_pipsmake_callback()
Definition: callback.c:59
void set_pipsmake_callback(pipsmake_callback_handler_type p)
callback.c
Definition: callback.c:43
static pipsmake_callback_handler_type callback
Definition: callback.c:39
void reset_pipsmake_callback()
Definition: callback.c:51
static bool callback_set_p
Definition: callback.c:41
#define message_assert(msg, ex)
Definition: newgen_assert.h:47
bool(* pipsmake_callback_handler_type)(void)