CBMC
crangler_parse_options.cpp
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: CRANGLER Command Line Option Processing
4
5
Author: Daniel Kroening, dkr@amazon.com
6
7
\*******************************************************************/
8
11
12
#include "
crangler_parse_options.h
"
13
14
#include <
util/cout_message.h
>
15
#include <
util/exit_codes.h
>
16
#include <
util/version.h
>
17
18
#include <
json/json_parser.h
>
19
20
#include <iostream>
21
22
#include "
c_wrangler.h
"
23
24
int
crangler_parse_optionst::doit
()
25
{
26
if
(
cmdline
.
args
.empty())
27
{
28
std::cerr <<
"please give a configuration file\n"
;
29
return
CPROVER_EXIT_INCORRECT_TASK
;
30
}
31
32
for
(
const
auto
&file_name :
cmdline
.
args
)
33
process_crangler_json
(file_name);
34
35
return
0;
36
}
37
38
void
crangler_parse_optionst::process_crangler_json
(
39
const
std::string &file_name)
40
{
41
console_message_handlert
message_handler;
42
jsont
configuration;
43
44
if
(
parse_json
(file_name, message_handler, configuration))
45
return
;
46
47
c_wrangler
(configuration);
48
}
49
50
void
crangler_parse_optionst::help
()
51
{
52
std::cout <<
'\n'
53
<<
banner_string
(
"CRANGLER"
,
CBMC_VERSION
) <<
'\n'
54
<<
"\n"
55
"Usage: Purpose:\n"
56
"\n"
57
" crangler [-?] [-h] [--help] show help\n"
58
" crangler file.json ... configuration file names\n"
59
"\n"
;
60
}
cmdlinet::args
argst args
Definition:
cmdline.h:145
crangler_parse_optionst::help
void help() override
Definition:
crangler_parse_options.cpp:50
version.h
jsont
Definition:
json.h:26
c_wrangler
void c_wrangler(const jsont &config)
Definition:
c_wrangler.cpp:561
crangler_parse_optionst::process_crangler_json
void process_crangler_json(const std::string &file_name)
Definition:
crangler_parse_options.cpp:38
json_parser.h
crangler_parse_options.h
crangler_parse_optionst::doit
int doit() override
Definition:
crangler_parse_options.cpp:24
CBMC_VERSION
const char * CBMC_VERSION
banner_string
std::string banner_string(const std::string &front_end, const std::string &version)
Definition:
parse_options.cpp:174
c_wrangler.h
cout_message.h
CPROVER_EXIT_INCORRECT_TASK
#define CPROVER_EXIT_INCORRECT_TASK
The command line is correctly structured but cannot be carried out due to missing files,...
Definition:
exit_codes.h:49
exit_codes.h
console_message_handlert
Definition:
cout_message.h:29
parse_json
bool parse_json(std::istream &in, const std::string &filename, message_handlert &message_handler, jsont &dest)
Definition:
json_parser.cpp:16
parse_options_baset::cmdline
cmdlinet cmdline
Definition:
parse_options.h:28
src
crangler
crangler_parse_options.cpp
Generated by
1.8.17