equals.cc 2.56 KB
Newer Older
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (C) 2003  Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING.  If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.

22
#include <iostream>
23
#include <cassert>
24
#include "ltlparse/public.hh"
25
#include "ltlvisit/lunabbrev.hh"
26
#include "ltlvisit/tunabbrev.hh"
27
#include "ltlvisit/dump.hh"
28
#include "ltlvisit/nenoform.hh"
29
30
#include "ltlvisit/destroy.hh"
#include "ltlast/allnodes.hh"
31
32

void
33
syntax(char* prog)
34
{
35
  std::cerr << prog << " formula1 formula2" << std::endl;
36
37
38
39
  exit(2);
}

int
40
main(int argc, char** argv)
41
42
43
44
{
  if (argc != 3)
    syntax(argv[0]);

45

46
  spot::ltl::parse_error_list p1;
47
  spot::ltl::formula* f1 = spot::ltl::parse(argv[1], p1);
48

49
  if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
50
51
52
    return 2;

  spot::ltl::parse_error_list p2;
53
  spot::ltl::formula* f2 = spot::ltl::parse(argv[2], p2);
54

55
  if (spot::ltl::format_parse_errors(std::cerr, argv[2], p2))
56
57
    return 2;

58
59
60
#if (defined LUNABBREV) || (defined TUNABBREV) || (defined NENOFORM)
  spot::ltl::formula* tmp;
#endif
61
#ifdef LUNABBREV
62
  tmp = f1;
63
  f1 = spot::ltl::unabbreviate_logic(f1);
64
  spot::ltl::destroy(tmp);
65
  spot::ltl::dump(std::cout, f1);
66
  std::cout << std::endl;
67
#endif
68
#ifdef TUNABBREV
69
  tmp = f1;
70
  f1 = spot::ltl::unabbreviate_ltl(f1);
71
  spot::ltl::destroy(tmp);
72
  spot::ltl::dump(std::cout, f1);
73
74
75
  std::cout << std::endl;
#endif
#ifdef NENOFORM
76
  tmp = f1;
77
  f1 = spot::ltl::negative_normal_form(f1);
78
  spot::ltl::destroy(tmp);
79
  spot::ltl::dump(std::cout, f1);
80
  std::cout << std::endl;
81
#endif
82

83
  int exit_code = f1 != f2;
84
85
86
87
88
89
90

  spot::ltl::destroy(f1);
  spot::ltl::destroy(f2);
  assert(spot::ltl::atomic_prop::instance_count() == 0);
  assert(spot::ltl::unop::instance_count() == 0);
  assert(spot::ltl::binop::instance_count() == 0);
  assert(spot::ltl::multop::instance_count() == 0);
91

92
  return exit_code;
93
}