Skip to content

Commit 4b124c8

Browse files
Matthias Güdemanntautschnig
Matthias Güdemann
authored andcommitted
add centered git version to CBMC banner
1 parent 718e926 commit 4b124c8

12 files changed

+57
-63
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -721,17 +721,11 @@ bool janalyzer_parse_optionst::process_goto_program(const optionst &options)
721721
/// display command line help
722722
void janalyzer_parse_optionst::help()
723723
{
724-
std::cout << "\n"
725-
"* * JANALYZER " CBMC_VERSION " - Copyright (C) 2017-2018 ";
726-
727-
std::cout << "(" << (sizeof(void *) * 8) << "-bit version)";
728-
729-
std::cout << " * *\n";
730-
731724
// clang-format off
732-
std::cout <<
725+
std::cout << '\n' << banner_string("JANALYZER", CBMC_VERSION) << '\n'
726+
<<
733727
/* NOLINTNEXTLINE(whitespace/line_length) */
734-
"* * JANALYZER " CBMC_VERSION " - Copyright (C) 2016-2018 * *\n"
728+
"* * Copyright (C) 2016-2018 * *\n"
735729
"* * Daniel Kroening, Diffblue * *\n"
736730
"* * [email protected] * *\n"
737731
"\n"

jbmc/src/jbmc/jbmc_parse_options.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -1067,15 +1067,10 @@ bool jbmc_parse_optionst::generate_function_body(
10671067
/// display command line help
10681068
void jbmc_parse_optionst::help()
10691069
{
1070-
std::cout << "\n"
1071-
"* * JBMC " CBMC_VERSION " - Copyright (C) 2001-2018 ";
1072-
1073-
std::cout << "(" << (sizeof(void *)*8) << "-bit version)";
1074-
1075-
std::cout << " * *\n";
1076-
10771070
// clang-format off
1078-
std::cout <<
1071+
std::cout << '\n' << banner_string("JBMC", CBMC_VERSION) << '\n'
1072+
<<
1073+
"* * Copyright (C) 2001-2018 * *\n"
10791074
"* * Daniel Kroening, Edmund Clarke * *\n"
10801075
"* * Carnegie Mellon University, Computer Science Department * *\n"
10811076
"* * [email protected] * *\n"

jbmc/src/jdiff/jdiff_parse_options.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,9 @@ bool jdiff_parse_optionst::process_goto_program(
427427
void jdiff_parse_optionst::help()
428428
{
429429
// clang-format off
430-
std::cout <<
431-
"\n"
432-
// NOLINTNEXTLINE(whitespace/line_length)
433-
"* * JDIFF " CBMC_VERSION " - Copyright (C) 2016-2018 * *\n"
430+
std::cout << '\n' << banner_string("JDIFF", CBMC_VERSION) << '\n'
431+
<<
432+
"* * Copyright (C) 2016-2018 * *\n"
434433
"* * Daniel Kroening, Peter Schrammel * *\n"
435434
"* * [email protected] * *\n"
436435
"\n"

src/cbmc/cbmc_parse_options.cpp

+3-9
Original file line numberDiff line numberDiff line change
@@ -866,15 +866,9 @@ bool cbmc_parse_optionst::process_goto_program(
866866
void cbmc_parse_optionst::help()
867867
{
868868
// clang-format off
869-
std::cout <<
870-
"\n"
871-
"* * CBMC " CBMC_VERSION " - Copyright (C) 2001-2018 ";
872-
873-
std::cout << "(" << (sizeof(void *)*8) << "-bit version)";
874-
875-
std::cout << " * *\n";
876-
877-
std::cout <<
869+
std::cout << '\n' << banner_string("CBMC", CBMC_VERSION) << '\n'
870+
<<
871+
"* * Copyright (C) 2001-2018 * *\n"
878872
"* * Daniel Kroening, Edmund Clarke * *\n"
879873
"* * Carnegie Mellon University, Computer Science Department * *\n"
880874
"* * [email protected] * *\n"

src/clobber/clobber_parse_options.cpp

+5-9
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,10 @@ void clobber_parse_optionst::report_failure()
348348
/// display command line help
349349
void clobber_parse_optionst::help()
350350
{
351-
std::cout <<
352-
"\n"
353-
"* * CLOBBER " CBMC_VERSION " - Copyright (C) 2014 ";
354-
355-
std::cout << "(" << (sizeof(void *)*8) << "-bit version)";
356-
357-
std::cout << " * *\n";
358-
359-
std::cout <<
351+
// clang-format off
352+
std::cout << '\n' << banner_string("CLOBBER", CBMC_VERSION) << '\n'
353+
<<
354+
"* * Copyright (C) 2014 * *\n"
360355
"* * Daniel Kroening * *\n"
361356
"* * University of Oxford * *\n"
362357
"* * [email protected] * *\n"
@@ -414,4 +409,5 @@ void clobber_parse_optionst::help()
414409
" --version show version and exit\n"
415410
" --xml-ui use XML-formatted output\n"
416411
"\n";
412+
// clang-format on
417413
}

src/goto-analyzer/goto_analyzer_parse_options.cpp

+3-8
Original file line numberDiff line numberDiff line change
@@ -789,15 +789,10 @@ bool goto_analyzer_parse_optionst::process_goto_program(
789789
/// display command line help
790790
void goto_analyzer_parse_optionst::help()
791791
{
792-
std::cout << "\n"
793-
"* * GOTO-ANALYZER " CBMC_VERSION " - Copyright (C) 2017-2018 ";
794-
795-
std::cout << "(" << (sizeof(void *)*8) << "-bit version)";
796-
797-
std::cout << " * *\n";
798-
799792
// clang-format off
800-
std::cout <<
793+
std::cout << '\n' << banner_string("GOTO-ANALYZER", CBMC_VERSION) << '\n'
794+
<<
795+
"* * Copyright (C) 2017-2018 * *\n"
801796
"* * Daniel Kroening, DiffBlue * *\n"
802797
"* * [email protected] * *\n"
803798
"\n"

src/goto-cc/goto_cc_mode.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Author: CM Wintersteiger, 2006
2222
#include <sysexits.h>
2323
#endif
2424

25+
#include <util/parse_options.h>
2526

2627
/// constructor
2728
goto_cc_modet::goto_cc_modet(
@@ -43,10 +44,10 @@ goto_cc_modet::~goto_cc_modet()
4344
/// display command line help
4445
void goto_cc_modet::help()
4546
{
46-
std::cout <<
47-
"\n"
48-
// NOLINTNEXTLINE(whitespace/line_length)
49-
"* * goto-cc " CBMC_VERSION " - Copyright (C) 2006-2018 * *\n"
47+
// clang-format off
48+
std::cout << '\n' << banner_string("goto-cc", CBMC_VERSION) << '\n'
49+
<<
50+
"* * Copyright (C) 2006-2018 * *\n"
5051
"* * Daniel Kroening, Michael Tautschnig, * *\n"
5152
"* * Christoph Wintersteiger * *\n"
5253
"\n";
@@ -64,6 +65,7 @@ void goto_cc_modet::help()
6465
" --print-rejected-preprocessed-source file\n"
6566
" copy failing (preprocessed) source to file\n"
6667
"\n";
68+
// clang-format on
6769
}
6870

6971
/// starts the compiler

src/goto-diff/goto_diff_parse_options.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,9 @@ bool goto_diff_parse_optionst::process_goto_program(
484484
void goto_diff_parse_optionst::help()
485485
{
486486
// clang-format off
487-
std::cout <<
488-
"\n"
489-
// NOLINTNEXTLINE(whitespace/line_length)
490-
"* * GOTO_DIFF " CBMC_VERSION " - Copyright (C) 2016 * *\n"
487+
std::cout << '\n' << banner_string("GOTO_DIFF", CBMC_VERSION) << '\n'
488+
<<
489+
"* * Copyright (C) 2016 * *\n"
491490
"* * Daniel Kroening, Peter Schrammel * *\n"
492491
"* * [email protected] * *\n"
493492
"\n"

src/goto-instrument/goto_instrument_parse_options.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1439,9 +1439,9 @@ void goto_instrument_parse_optionst::instrument_goto_program()
14391439
void goto_instrument_parse_optionst::help()
14401440
{
14411441
// clang-format off
1442-
std::cout <<
1443-
"\n"
1444-
"* * Goto-Instrument " CBMC_VERSION " - Copyright (C) 2008-2013 * *\n" // NOLINT(*)
1442+
std::cout << '\n' << banner_string("Goto-Instrument", CBMC_VERSION) << '\n'
1443+
<<
1444+
"* * Copyright (C) 2008-2013 * *\n"
14451445
"* * Daniel Kroening * *\n"
14461446
"* * [email protected] * *\n"
14471447
"\n"

src/memory-models/mmcc_parse_options.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@ int mmcc_parse_optionst::convert(
9595
/// display command line help
9696
void mmcc_parse_optionst::help()
9797
{
98-
std::cout <<
99-
"\n"
100-
"* * MMCC " CBMC_VERSION " - Copyright (C) 2015-2015 * *\n";
101-
102-
std::cout <<
98+
// clang-format off
99+
std::cout << '\n' << banner_string("MMCC", CBMC_VERSION) << '\n'
100+
<<
101+
" Copyright (C) 2015-2015\n"
103102
"\n"
104103
"Usage: Purpose:\n"
105104
"\n"
106105
" mmcc [-?] [-h] [--help] show help\n"
107106
" mmcc file.cat convert given source file\n"
108107
" mmcc convert from stdin\n"
109108
"\n";
109+
// clang-format on
110110
}

src/util/parse_options.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,20 @@ int parse_options_baset::main()
6565

6666
return doit();
6767
}
68+
69+
std::string
70+
banner_string(const std::string &front_end, const std::string &version)
71+
{
72+
const std::string version_str = front_end + " " + version + " " +
73+
std::to_string(sizeof(void *) * 8) + "-bit";
74+
75+
std::string::size_type left_padding = 0, right_padding = 0;
76+
if(version_str.size() < 57)
77+
{
78+
left_padding = (57 - version_str.size() + 1) / 2;
79+
right_padding = (57 - version_str.size()) / 2;
80+
}
81+
82+
return "* *" + std::string(left_padding, ' ') + version_str +
83+
std::string(right_padding, ' ') + "* *";
84+
}

src/util/parse_options.h

+3
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,7 @@ class parse_options_baset
3535
bool parse_result;
3636
};
3737

38+
std::string
39+
banner_string(const std::string &front_end, const std::string &version);
40+
3841
#endif // CPROVER_UTIL_PARSE_OPTIONS_H

0 commit comments

Comments
 (0)