Skip to content

Commit 449a3f9

Browse files
author
Daniel Kroening
committed
move smt2_format into separate file
1 parent f5f870b commit 449a3f9

File tree

5 files changed

+55
-27
lines changed

5 files changed

+55
-27
lines changed

src/solvers/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ SRC = $(BOOLEFORCE_SRC) \
185185
sat/resolution_proof.cpp \
186186
smt2/smt2_conv.cpp \
187187
smt2/smt2_dec.cpp \
188+
smt2/smt2_format.cpp \
188189
smt2/smt2_parser.cpp \
189190
smt2/smt2_tokenizer.cpp \
190191
smt2/smt2irep.cpp \

src/solvers/smt2/smt2_format.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*******************************************************************\
2+
3+
Module:
4+
5+
Author: Daniel Kroening, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#include "smt2_format.h"
10+
11+
#include <util/std_types.h>
12+
13+
std::ostream &operator<<(std::ostream &out, const smt2_format &f)
14+
{
15+
if(f.type.id() == ID_unsignedbv)
16+
out << "(_ BitVec " << to_unsignedbv_type(f.type).get_width() << ')';
17+
else if(f.type.id() == ID_bool)
18+
out << "Bool";
19+
else if(f.type.id() == ID_integer)
20+
out << "Int";
21+
else if(f.type.id() == ID_real)
22+
out << "Real";
23+
else
24+
out << "? " << f.type.id();
25+
26+
return out;
27+
}

src/solvers/smt2/smt2_format.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************\
2+
3+
Module:
4+
5+
Author: Daniel Kroening, [email protected]
6+
7+
\*******************************************************************/
8+
9+
#ifndef CPROVER_SOLVERS_SMT2_SMT2_FORMAT_H
10+
#define CPROVER_SOLVERS_SMT2_SMT2_FORMAT_H
11+
12+
#include <util/type.h>
13+
14+
struct smt2_format
15+
{
16+
explicit smt2_format(const typet &_type) : type(_type)
17+
{
18+
}
19+
20+
const typet &type;
21+
};
22+
23+
std::ostream &operator<<(std::ostream &, const smt2_format &);
24+
25+
#endif // CPROVER_SOLVERS_SMT2_SMT2_FORMAT_H

src/solvers/smt2/smt2_parser.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,9 @@ Author: Daniel Kroening, [email protected]
88

99
#include "smt2_parser.h"
1010

11-
#include <util/arith_tools.h>
12-
13-
std::ostream &operator<<(std::ostream &out, const smt2_parsert::smt2_format &f)
14-
{
15-
if(f.type.id() == ID_unsignedbv)
16-
out << "(_ BitVec " << to_unsignedbv_type(f.type).get_width() << ')';
17-
else if(f.type.id() == ID_bool)
18-
out << "Bool";
19-
else if(f.type.id() == ID_integer)
20-
out << "Int";
21-
else if(f.type.id() == ID_real)
22-
out << "Real";
23-
else
24-
out << "? " << f.type.id();
11+
#include "smt2_format.h"
2512

26-
return out;
27-
}
13+
#include <util/arith_tools.h>
2814

2915
void smt2_parsert::command_sequence()
3016
{

src/solvers/smt2/smt2_parser.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ class smt2_parsert:public smt2_tokenizert
4343
using id_mapt=std::map<irep_idt, idt>;
4444
id_mapt id_map;
4545

46-
struct smt2_format
47-
{
48-
explicit smt2_format(const typet &_type) : type(_type)
49-
{
50-
}
51-
52-
const typet type;
53-
};
54-
5546
protected:
5647
bool exit;
5748
void command_sequence();
@@ -91,6 +82,4 @@ class smt2_parsert:public smt2_tokenizert
9182
exprt cast_bv_to_unsigned(const exprt &);
9283
};
9384

94-
std::ostream &operator<<(std::ostream &, const smt2_parsert::smt2_format &);
95-
9685
#endif // CPROVER_SOLVERS_SMT2_SMT2_PARSER_H

0 commit comments

Comments
 (0)