Skip to content

Commit 7508bae

Browse files
committed
new help formatter and console API
This commit adds a new help formatter, which supports a limited form of markup to visually distinguish different syntactic elements of the command line arguments. Rendering of the syntax highlighting is done via a new console API.
1 parent b08632a commit 7508bae

14 files changed

+16
-30
lines changed

Diff for: src/cprover/Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ SRC = address_taken.cpp \
22
axioms.cpp \
33
bv_pointers_wide.cpp \
44
c_safety_checks.cpp \
5-
console.cpp \
65
cprover_main.cpp \
76
cprover_parse_options.cpp \
87
counterexample_found.cpp \
@@ -13,7 +12,6 @@ SRC = address_taken.cpp \
1312
format_hooks.cpp \
1413
free_symbols.cpp \
1514
generalization.cpp \
16-
help_formatter.cpp \
1715
inductiveness.cpp \
1816
instrument_contracts.cpp \
1917
instrument_given_invariants.cpp \

Diff for: src/cprover/cprover_parse_options.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Author: Daniel Kroening, [email protected]
1414
#include <util/config.h>
1515
#include <util/cout_message.h>
1616
#include <util/exit_codes.h>
17+
#include <util/help_formatter.h>
1718
#include <util/options.h>
1819
#include <util/signal_catcher.h>
1920
#include <util/ui_message.h>
@@ -35,7 +36,6 @@ Author: Daniel Kroening, [email protected]
3536

3637
#include "c_safety_checks.h"
3738
#include "format_hooks.h"
38-
#include "help_formatter.h"
3939
#include "instrument_contracts.h"
4040
#include "instrument_given_invariants.h"
4141
#include "state_encoding.h"

Diff for: src/cprover/generalization.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "generalization.h"
1313

14+
#include <util/console.h>
1415
#include <util/format_expr.h>
1516

16-
#include "console.h"
1717
#include "solver.h"
1818

1919
#include <iostream>

Diff for: src/cprover/inductiveness.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Author: Daniel Kroening, [email protected]
1212
#include "inductiveness.h"
1313

1414
#include <util/arith_tools.h>
15+
#include <util/console.h>
1516
#include <util/cout_message.h>
1617
#include <util/format_expr.h>
1718
#include <util/simplify_expr.h>
@@ -20,7 +21,6 @@ Author: Daniel Kroening, [email protected]
2021

2122
#include "axioms.h"
2223
#include "bv_pointers_wide.h"
23-
#include "console.h"
2424
#include "counterexample_found.h"
2525
#include "propagate.h"
2626
#include "solver.h"

Diff for: src/cprover/propagate.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "propagate.h"
1313

14+
#include <util/console.h>
1415
#include <util/format_expr.h>
1516
#include <util/simplify_expr.h>
1617

17-
#include "console.h"
1818
#include "simplify_state_expr.h"
1919
#include "state.h"
2020

Diff for: src/cprover/report_properties.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "report_properties.h"
1313

14+
#include <util/console.h>
1415
#include <util/cout_message.h>
1516

16-
#include "console.h"
17-
1817
#include <iomanip>
1918

2019
void report_properties(const std::vector<propertyt> &properties)

Diff for: src/cprover/report_traces.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "report_traces.h"
1313

14+
#include <util/console.h>
1415
#include <util/format_expr.h>
1516

16-
#include "console.h"
1717
#include "state.h"
1818

1919
#include <iomanip>

Diff for: src/cprover/solver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "solver.h"
1313

14+
#include <util/console.h>
1415
#include <util/cout_message.h>
1516
#include <util/format_expr.h>
1617
#include <util/std_expr.h>
1718

1819
#include "address_taken.h"
19-
#include "console.h"
2020
#include "counterexample_found.h"
2121
#include "generalization.h"
2222
#include "inductiveness.h"

Diff for: src/cprover/solver_progress.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "solver_progress.h"
1313

14-
#include "console.h"
14+
#include <util/console.h>
1515

1616
#include <iostream>
1717

Diff for: src/util/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ SRC = arith_tools.cpp \
88
c_types.cpp \
99
cmdline.cpp \
1010
config.cpp \
11+
console.cpp \
1112
cout_message.cpp \
1213
dstring.cpp \
1314
endianness_map.cpp \
@@ -28,6 +29,7 @@ SRC = arith_tools.cpp \
2829
fresh_symbol.cpp \
2930
get_base_name.cpp \
3031
get_module.cpp \
32+
help_formatter.cpp \
3133
identifier.cpp \
3234
ieee_float.cpp \
3335
interval_union.cpp \

Diff for: src/cprover/console.cpp renamed to src/util/console.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,6 @@ std::size_t consolet::width()
227227
return _width;
228228
}
229229

230-
extern "C" int mk_wcwidth(wchar_t ucs);
231-
232-
int consolet::wcwidth(wchar_t ucs)
233-
{
234-
return mk_wcwidth(ucs);
235-
}
236-
237230
consolet::redirectt::redirectt(
238231
std::ostream &__console_out,
239232
std::ostream &__console_err)

Diff for: src/cprover/console.h renamed to src/util/console.h

+3-9
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Author: Daniel Kroening, [email protected]
99
/// \file
1010
/// Console
1111

12-
#ifndef CPROVER_CPROVER_CONSOLE_H
13-
#define CPROVER_CPROVER_CONSOLE_H
12+
#ifndef CPROVER_UTIL_CONSOLE_H
13+
#define CPROVER_UTIL_CONSOLE_H
1414

1515
#include <cstddef>
1616
#include <iosfwd>
@@ -66,12 +66,6 @@ class consolet
6666

6767
static std::size_t width();
6868

69-
// -1: not printable
70-
// 0: no width
71-
// 1: usual single width
72-
// 2: double width
73-
static int wcwidth(wchar_t);
74-
7569
// redirection
7670
class redirectt
7771
{
@@ -95,4 +89,4 @@ class consolet
9589
static std::ostream *_err;
9690
};
9791

98-
#endif // CPROVER_CPROVER_CONSOLE_H
92+
#endif // CPROVER_UTIL_CONSOLE_H
File renamed without changes.

Diff for: src/cprover/help_formatter.h renamed to src/util/help_formatter.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Author: Daniel Kroening, [email protected]
99
/// \file
1010
/// Help Formatter
1111

12-
#ifndef CPROVER_CPROVER_HELP_FORMATTER_H
13-
#define CPROVER_CPROVER_HELP_FORMATTER_H
12+
#ifndef CPROVER_UTIL_HELP_FORMATTER_H
13+
#define CPROVER_UTIL_HELP_FORMATTER_H
1414

1515
#include <iosfwd>
1616
#include <string>
@@ -49,4 +49,4 @@ operator<<(std::ostream &out, const help_formattert &h)
4949
return out;
5050
}
5151

52-
#endif // CPROVER_CPROVER_HELP_FORMATTER_H
52+
#endif // CPROVER_UTIL_HELP_FORMATTER_H

0 commit comments

Comments
 (0)