Skip to content

Commit

Permalink
APREPRO: Add version number to error message output
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Sep 28, 2023
1 parent 8aba7a3 commit 27869a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/seacas/libraries/aprepro_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ TRIBITS_ADD_ADVANCED_TEST(
OUTPUT_FILE test-strings.output
NOEXEPREFIX NOEXESUFFIX
PASS_ANY
TEST_1 CMND grep ARGS -v Aprepro: test-strings.output OUTPUT_FILE grepped-strings.out
TEST_1 CMND grep ARGS -v ^Aprepro test-strings.output OUTPUT_FILE grepped-strings.out
TEST_2 CMND diff ARGS -w
${CMAKE_CURRENT_SOURCE_DIR}/test_standard.out
${CMAKE_CURRENT_BINARY_DIR}/grepped-strings.out
Expand Down
9 changes: 6 additions & 3 deletions packages/seacas/libraries/aprepro_lib/apr_aprepro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
#endif

namespace {
const std::string version_string{"6.21 (2023/09/25)"};
const std::string version_short{"6.22"};
const std::string version_date{"(2023/09/28)"};
const std::string version_string = version_short + " " + version_date;

void output_copyright();

Expand Down Expand Up @@ -131,7 +133,8 @@ namespace SEAMS {
cleanup_memory();
}

std::string Aprepro::version() { return version_string; }
const std::string &Aprepro::version() { return version_string; }
const std::string &Aprepro::short_version() { return version_short; }

std::string Aprepro::long_version() const
{
Expand Down Expand Up @@ -226,7 +229,7 @@ namespace SEAMS {
if (colorize) {
(*errorStream) << trmclr::red;
}
(*errorStream) << "Aprepro: ERROR: ";
(*errorStream) << "Aprepro-" << short_version() << ": ERROR: ";
}

ss << msg;
Expand Down
7 changes: 5 additions & 2 deletions packages/seacas/libraries/aprepro_lib/aprepro.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@ namespace SEAMS {
const std::ostringstream &parsing_results() const { return parsingResults; }
void clear_results();

/** Return string representation of current version of aprepro + commit date. */
static const std::string &version();

/** Return string representation of current version of aprepro. */
static std::string version();
static const std::string &short_version();

/** Return long version: `# Algebraic Preprocessor (Aprepro) version X.X.X` */
/** Return long version: `# Algebraic Preprocessor (Aprepro) version X.X (date)` */
std::string long_version() const;

/** Invoke the scanner and parser for a stream.
Expand Down

0 comments on commit 27869a8

Please sign in to comment.