Skip to content

Commit 3077044

Browse files
authored
Merge pull request #4588 from peterschrammel/json-interface-jbmc
Add json/xml-interface to JBMC
2 parents 87bb244 + ee7f2c9 commit 3077044

File tree

7 files changed

+40
-14
lines changed

7 files changed

+40
-14
lines changed

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jbmc_parse_optionst::jbmc_parse_optionst(int argc, const char **argv)
8181
argv,
8282
std::string("JBMC ") + CBMC_VERSION)
8383
{
84+
json_interface(cmdline, ui_message_handler);
85+
xml_interface(cmdline, ui_message_handler);
8486
}
8587

8688
::jbmc_parse_optionst::jbmc_parse_optionst(
@@ -93,6 +95,8 @@ ::jbmc_parse_optionst::jbmc_parse_optionst(
9395
argv,
9496
std::string("JBMC ") + CBMC_VERSION)
9597
{
98+
json_interface(cmdline, ui_message_handler);
99+
xml_interface(cmdline, ui_message_handler);
96100
}
97101

98102
void jbmc_parse_optionst::set_default_options(optionst &options)
@@ -1090,8 +1094,8 @@ void jbmc_parse_optionst::help()
10901094
"\n"
10911095
"Other options:\n"
10921096
" --version show version and exit\n"
1093-
" --xml-ui use XML-formatted output\n"
1094-
" --json-ui use JSON-formatted output\n"
1097+
HELP_XML_INTERFACE
1098+
HELP_JSON_INTERFACE
10951099
HELP_VALIDATE
10961100
HELP_GOTO_TRACE
10971101
HELP_FLUSH

jbmc/src/jbmc/jbmc_parse_options.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ Author: Daniel Kroening, [email protected]
3434

3535
#include <java_bytecode/java_bytecode_language.h>
3636

37+
#include <json/json_interface.h>
38+
#include <xmllang/xml_interface.h>
39+
3740
class goto_functionst;
3841
class optionst;
3942

@@ -49,7 +52,8 @@ class optionst;
4952
"(object-bits):" \
5053
"(classpath):(cp):(main-class):" \
5154
"(no-assertions)(no-assumptions)" \
52-
"(xml-ui)(json-ui)" \
55+
OPT_XML_INTERFACE \
56+
OPT_JSON_INTERFACE \
5357
"(smt1)(smt2)(fpa)(cvc3)(cvc4)(boolector)(yices)(z3)(mathsat)" \
5458
"(no-sat-preprocessor)" \
5559
"(beautify)" \

jbmc/src/jbmc/module_dependencies.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ goto-programs
66
goto-symex
77
java_bytecode
88
jbmc
9+
json
910
langapi # should go away
1011
linking
1112
pointer-analysis
@@ -15,3 +16,4 @@ solvers/prop
1516
solvers/sat
1617
solvers/strings
1718
util
19+
xmllang

src/cbmc/cbmc_parse_options.cpp

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

8080
#include <langapi/mode.h>
8181

82-
#include <json/json_interface.h>
83-
#include <xmllang/xml_interface.h>
84-
8582
#include "c_test_input_generator.h"
8683

8784
cbmc_parse_optionst::cbmc_parse_optionst(int argc, const char **argv)
@@ -1021,11 +1018,8 @@ void cbmc_parse_optionst::help()
10211018
"\n"
10221019
"Other options:\n"
10231020
" --version show version and exit\n"
1024-
" --xml-ui use XML-formatted output\n"
1025-
" --xml-interface bi-directional XML interface\n"
1026-
" --json-ui use JSON-formatted output\n"
1027-
" --json-interface bi-directional JSON interface\n"
1028-
// NOLINTNEXTLINE(whitespace/line_length)
1021+
HELP_XML_INTERFACE
1022+
HELP_JSON_INTERFACE
10291023
HELP_VALIDATE
10301024
HELP_GOTO_TRACE
10311025
HELP_FLUSH

src/cbmc/cbmc_parse_options.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Author: Daniel Kroening, [email protected]
3131

3232
#include <solvers/strings/string_refinement.h>
3333

34+
#include <json/json_interface.h>
35+
#include <xmllang/xml_interface.h>
36+
3437
class goto_functionst;
3538
class optionst;
3639

@@ -47,9 +50,8 @@ class optionst;
4750
"(object-bits):" \
4851
OPT_GOTO_CHECK \
4952
"(no-assertions)(no-assumptions)" \
50-
"(xml-ui)(xml-interface)" \
51-
"(json-interface)" \
52-
"(json-ui)" \
53+
OPT_XML_INTERFACE \
54+
OPT_JSON_INTERFACE \
5355
"(smt1)(smt2)(fpa)(cvc3)(cvc4)(boolector)(yices)(z3)(mathsat)" \
5456
"(cprover-smt2)" \
5557
"(no-sat-preprocessor)" \

src/json/json_interface.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,14 @@ class message_handlert;
3737
/// \endcode
3838
void json_interface(cmdlinet &, message_handlert &);
3939

40+
// clang-format off
41+
#define OPT_JSON_INTERFACE \
42+
"(json-ui)" \
43+
"(json-interface)"
44+
45+
#define HELP_JSON_INTERFACE \
46+
" --json-ui use JSON-formatted output\n" \
47+
" --json-interface bi-directional JSON interface\n"
48+
// clang-format on
49+
4050
#endif // CPROVER_JSON_JSON_INTERFACE_H

src/xmllang/xml_interface.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@ class message_handlert;
3131
/// \endcode
3232
void xml_interface(cmdlinet &, message_handlert &);
3333

34+
// clang-format off
35+
#define OPT_XML_INTERFACE \
36+
"(xml-ui)" \
37+
"(xml-interface)"
38+
39+
#define HELP_XML_INTERFACE \
40+
" --xml-ui use XML-formatted output\n" \
41+
" --xml-interface bi-directional XML interface\n"
42+
// clang-format on
43+
3444
#endif // CPROVER_XMLLANG_XML_INTERFACE_H

0 commit comments

Comments
 (0)