ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
printf_formatter.h
Go to the documentation of this file.
1#ifndef CPROVER_PRINTF_FORMATTER
2#define CPROVER_PRINTF_FORMATTER
3
4#include <irep2/irep2_expr.h>
5
9type2tc printf_int_type(bool is_signed, const std::string &mod);
10
12{
13public:
14 void
15 operator()(const std::string &format, const std::list<expr2tc> &_operands);
16
17 void print(std::ostream &out);
18 std::string as_string();
19
22 size_t min_outlen = 0;
24 size_t max_outlen = 0;
31 bool bounded = true;
32
36 bool exact = true;
37
44 bool args_reliable = true;
45
46protected:
47 std::string format;
48 std::list<expr2tc> operands;
49 std::list<expr2tc>::const_iterator next_operand;
50 unsigned format_pos;
51 inline bool eol() const
52 {
53 return format_pos >= format.size();
54 }
55
57 {
58 };
59
60 char next()
61 {
62 if (eol())
63 throw eol_exception();
64 return format[format_pos++];
65 }
66
67 void process_char(std::ostream &out);
68 void process_format(std::ostream &out);
69
70 const expr2tc make_type(const expr2tc &src, const type2tc &dest);
71};
72
73#endif
Definition printf_formatter.h:57
Definition printf_formatter.h:12
std::string format
Definition printf_formatter.h:47
bool exact
False when a '#' flag outside o, x and X or a conversion (p, an unknown one) the formatter does not m...
Definition printf_formatter.h:36
std::list< expr2tc > operands
Definition printf_formatter.h:48
std::list< expr2tc >::const_iterator next_operand
Definition printf_formatter.h:49
const expr2tc make_type(const expr2tc &src, const type2tc &dest)
Definition printf_formatter.cpp:12
unsigned format_pos
Definition printf_formatter.h:50
bool bounded
False when print() could not compute a sound upper bound on the output length: a value-dependent conv...
Definition printf_formatter.h:31
char next()
Definition printf_formatter.h:60
size_t max_outlen
Maximum possible output length for the last print() call.
Definition printf_formatter.h:24
std::string as_string()
Definition printf_formatter.cpp:51
void operator()(const std::string &format, const std::list< expr2tc > &_operands)
Definition printf_formatter.cpp:23
bool args_reliable
True when operands are the call's actual arguments, so a non-literal s operand may be used to derive ...
Definition printf_formatter.h:44
void process_format(std::ostream &out)
Definition printf_formatter.cpp:275
bool eol() const
Definition printf_formatter.h:51
size_t min_outlen
Minimum possible output length for the last print() call.
Definition printf_formatter.h:22
void print(std::ostream &out)
Definition printf_formatter.cpp:31
void process_char(std::ostream &out)
Definition printf_formatter.cpp:553
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
type2tc printf_int_type(bool is_signed, const std::string &mod)
The type a d or i (is_signed) or u conversion converts its argument to under the length modifier mod:...
Definition printf_formatter.cpp:260