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/help_formatter.h>
17 #include <util/version.h>
18 
19 #include <json/json_parser.h>
20 
21 #include "c_wrangler.h"
22 
23 #include <iostream>
24 
26 {
27  if(cmdline.args.empty())
28  {
29  std::cerr << "please give a configuration file\n";
31  }
32 
33  for(const auto &file_name : cmdline.args)
34  process_crangler_json(file_name);
35 
36  return 0;
37 }
38 
40  const std::string &file_name)
41 {
42  console_message_handlert message_handler;
43  jsont configuration;
44 
45  if(parse_json(file_name, message_handler, configuration))
46  return;
47 
48  c_wrangler(configuration);
49 }
50 
52 {
53  std::cout << '\n' << banner_string("CRANGLER", CBMC_VERSION) << '\n';
54 
55  std::cout << help_formatter(
56  "\n"
57  "Usage: \tPurpose:\n"
58  "\n"
59  " {bcrangler} [{y-?}] [{y-h}] [{y--help}] \t show this help\n"
60  " {bcrangler} {ufile.json} ... \t configuration file names\n"
61  "\n");
62 }
void c_wrangler(const jsont &config)
Definition: c_wrangler.cpp:596
C Wrangler.
argst args
Definition: cmdline.h:154
void process_crangler_json(const std::string &file_name)
Definition: json.h:27
CRANGLER Command Line Option Processing.
Document and give macros for the exit codes of CPROVER binaries.
#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
Help Formatter.
static help_formattert help_formatter(const std::string &s)
bool parse_json(std::istream &in, const std::string &filename, message_handlert &message_handler, jsont &dest)
Definition: json_parser.cpp:27
std::string banner_string(const std::string &front_end, const std::string &version)
const char * CBMC_VERSION