spot  1.99.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
common_trans.hh
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2015 Laboratoire de Recherche et Développement de
3 // l'Epita (LRDE).
4 //
5 // This file is part of Spot, a model checking library.
6 //
7 // Spot is free software; you can redistribute it and/or modify it
8 // under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // Spot is distributed in the hope that it will be useful, but WITHOUT
13 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 
20 #pragma once
21 
22 #include "common_sys.hh"
23 #include <vector>
24 #include <argp.h>
25 
26 #include "misc/formater.hh"
27 #include "misc/tmpfile.hh"
28 #include "twa/twagraph.hh"
29 
30 
31 extern const struct argp trans_argp;
32 
34 {
35  // The translator command, as specified on the command-line.
36  // If this has the form of
37  // {name}cmd
38  // then it is split in two components.
39  // Otherwise, spec=cmd=name.
40  const char* spec;
41  // actual shell command (or spec)
42  const char* cmd;
43  // name of the translator (or spec)
44  const char* name;
45 
46  translator_spec(const char* spec);
47  translator_spec(const translator_spec& other);
48  ~translator_spec();
49 };
50 
51 extern std::vector<translator_spec> translators;
52 
53 struct quoted_string final: public spot::printable_value<std::string>
54 {
56  void print(std::ostream& os, const char* pos) const override;
57 };
58 
60  public spot::printable_value<spot::temporary_file*>
61 {
62  unsigned translator_num;
63  enum output_format { None, Dstar, Hoa };
64  mutable output_format format;
65 
68  void reset(unsigned n);
69  void cleanup();
70 
71  void print(std::ostream& os, const char* pos) const override;
72 };
73 
74 
76 {
77 protected:
78  spot::bdd_dict_ptr dict;
79  // Round-specific variables
80  quoted_string string_ltl_spot;
81  quoted_string string_ltl_spin;
82  quoted_string string_ltl_lbt;
83  quoted_string string_ltl_wring;
84  quoted_string filename_ltl_spot;
85  quoted_string filename_ltl_spin;
86  quoted_string filename_ltl_lbt;
87  quoted_string filename_ltl_wring;
88  // Run-specific variables
90 public:
91  using spot::formater::has;
92 
93  translator_runner(spot::bdd_dict_ptr dict,
94  // whether we accept the absence of output
95  // specifier
96  bool no_output_allowed = false);
97  void string_to_tmp(std::string& str, unsigned n, std::string& tmpname);
98  const std::string& formula() const;
99  void round_formula(const spot::ltl::formula* f, unsigned serial);
100 };
101 
102 
103 // Disable handling of timeout on systems that miss kill() or alarm().
104 // For instance MinGW.
105 #if HAVE_KILL && HAVE_ALARM
106 # define ENABLE_TIMEOUT 1
107 #else
108 # define ENABLE_TIMEOUT 0
109 #endif
110 
111 extern volatile bool timed_out;
112 extern unsigned timeout_count;
113 #if ENABLE_TIMEOUT
114 void setup_sig_handler();
115 int exec_with_timeout(const char* cmd);
116 #else // !ENABLE_TIMEOUT
117 #define exec_with_timeout(cmd) system(cmd)
118 #define setup_sig_handler() while (0);
119 #endif // !ENABLE_TIMEOUT
Definition: common_trans.hh:59
Definition: formater.hh:42
Definition: common_trans.hh:53
Definition: common_trans.hh:75
bool has(char c) const
Whether c occurred in the primed formats.
Definition: formater.hh:149
Definition: common_trans.hh:33
Definition: formater.hh:104
An LTL formula.
Definition: formula.hh:71

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Wed Aug 26 2015 08:42:37 for spot by doxygen 1.8.8