Skip to content

Commit

Permalink
APREPRO: Dump output should use full precision if available
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Jun 19, 2023
1 parent 3a258ce commit cfa539b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/seacas/libraries/aprepro_lib/apr_aprepro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#include "aprepro.h" // for Aprepro, symrec, file_rec, etc
#include "aprepro_parser.h" // for Parser, Parser::token, etc
#include "terminal_color.h"
#if defined(FMT_SUPPORT)
#include <fmt/ostream.h>
#endif
#include <cstdlib> // for exit, EXIT_SUCCESS, etc
#include <cstring> // for strcmp
#include <fstream> // for operator<<, basic_ostream, etc
Expand Down Expand Up @@ -750,8 +753,13 @@ namespace SEAMS {
for (const auto &ptr : get_sorted_sym_table()) {
if (!ptr->isInternal) {
if (ptr->type == Parser::token::VAR || ptr->type == Parser::token::IMMVAR) {
#if defined(FMT_SUPPORT)
fmt::print((*infoStream), "{}{}\": {}", (first ? "\"" : ",\n\""), ptr->name,
ptr->value.var);
#else
(*infoStream) << (first ? "\"" : ",\n\"") << ptr->name << "\": " << std::setprecision(10)
<< ptr->value.var;
#endif
first = false;
}
else if (ptr->type == Parser::token::UNDVAR) {
Expand Down Expand Up @@ -785,13 +793,23 @@ namespace SEAMS {
if (spre.empty() || ptr->name.find(spre) != std::string::npos) {
if (doInternal == ptr->isInternal) {
if (ptr->type == Parser::token::VAR) {
#if defined(FMT_SUPPORT)
fmt::print((*infoStream), "{} {{{:<{}}\t= {}}}\n", comment, ptr->name, width,
ptr->value.var);
#else
(*infoStream) << comment << " {" << std::left << std::setw(width) << ptr->name
<< "\t= " << std::setprecision(10) << ptr->value.var << "}" << '\n';
#endif
}
else if (ptr->type == Parser::token::IMMVAR) {
#if defined(FMT_SUPPORT)
fmt::print((*infoStream), "{} {{{:<{}}\t= {}}} (immutable)\n", comment, ptr->name,
width, ptr->value.var);
#else
(*infoStream) << comment << " {" << std::left << std::setw(width) << ptr->name
<< "\t= " << std::setprecision(10) << ptr->value.var << "} (immutable)"
<< '\n';
#endif
}
else if (ptr->type == Parser::token::SVAR) {
if (strchr(ptr->value.svar.c_str(), '\n') != nullptr ||
Expand Down

0 comments on commit cfa539b

Please sign in to comment.