void printBinaryInformation(FILE *fp, const ProgramContextInterface &programContext, const BinaryInformationSettings &settings) { const char *prefix = settings.prefix_; const char *suffix = settings.suffix_; const char *precisionString = ""; #ifdef GMX_DOUBLE precisionString = " (double precision)"; #endif const char *const name = programContext.displayName(); if (settings.bGeneratedByHeader_) { fprintf(fp, "%sCreated by:%s\n", prefix, suffix); } if (settings.bCopyright_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with copyright"); // This line is printed again after the copyright notice to make it // appear together with all the other information, so that it is not // necessary to read stuff above the copyright notice. // The line above the copyright notice puts the copyright notice is // context, though. // TODO: It would be nice to know here whether we are really running a // Gromacs binary or some other binary that is calling Gromacs; we // could then print "%s is part of GROMACS" or some alternative text. fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name, gmx_version(), precisionString, suffix); fprintf(fp, "\n"); printCopyright(fp); fprintf(fp, "\n"); } fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name, gmx_version(), precisionString, suffix); const char *const binaryPath = programContext.fullBinaryPath(); if (binaryPath != NULL && binaryPath[0] != '\0') { fprintf(fp, "%sExecutable: %s%s\n", prefix, binaryPath, suffix); } const char *const libraryPath = programContext.defaultLibraryDataPath(); if (libraryPath != NULL && libraryPath[0] != '\0') { fprintf(fp, "%sLibrary dir: %s%s\n", prefix, libraryPath, suffix); } const char *const commandLine = programContext.commandLine(); if (commandLine != NULL && commandLine[0] != '\0') { fprintf(fp, "%sCommand line:%s\n%s %s%s\n", prefix, suffix, prefix, commandLine, suffix); } if (settings.bExtendedInfo_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with extended info"); fprintf(fp, "\n"); gmx_print_version_info(fp); } }
void printBinaryInformation(FILE *fp, const ProgramContextInterface &programContext, const BinaryInformationSettings &settings) { const char *prefix = settings.prefix_; const char *suffix = settings.suffix_; const char *precisionString = ""; #ifdef GMX_DOUBLE precisionString = " (double precision)"; #endif const char *const name = programContext.displayName(); if (settings.bGeneratedByHeader_) { fprintf(fp, "%sCreated by:%s\n", prefix, suffix); } // TODO: It would be nice to know here whether we are really running a // Gromacs binary or some other binary that is calling Gromacs; we // could then print "%s is part of GROMACS" or some alternative text. std::string title = formatString(":-) GROMACS - %s, %s%s (-:", name, gmx_version(), precisionString); const int indent = centeringOffset(78 - strlen(prefix) - strlen(suffix), title.length()) + 1; fprintf(fp, "%s%*c%s%s\n", prefix, indent, ' ', title.c_str(), suffix); fprintf(fp, "%s%s\n", prefix, suffix); if (settings.bCopyright_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with copyright"); printCopyright(fp); fprintf(fp, "\n"); // This line is printed again after the copyright notice to make it // appear together with all the other information, so that it is not // necessary to read stuff above the copyright notice. // The line above the copyright notice puts the copyright notice is // context, though. fprintf(fp, "%sGROMACS: %s, %s%s%s\n", prefix, name, gmx_version(), precisionString, suffix); } const char *const binaryPath = programContext.fullBinaryPath(); if (!gmx::isNullOrEmpty(binaryPath)) { fprintf(fp, "%sExecutable: %s%s\n", prefix, binaryPath, suffix); } const gmx::InstallationPrefixInfo installPrefix = programContext.installationPrefix(); if (!gmx::isNullOrEmpty(installPrefix.path)) { fprintf(fp, "%sData prefix: %s%s%s\n", prefix, installPrefix.path, installPrefix.bSourceLayout ? " (source tree)" : "", suffix); } const char *const commandLine = programContext.commandLine(); if (!gmx::isNullOrEmpty(commandLine)) { fprintf(fp, "%sCommand line:%s\n%s %s%s\n", prefix, suffix, prefix, commandLine, suffix); } if (settings.bExtendedInfo_) { GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0', "Prefix/suffix not supported with extended info"); fprintf(fp, "\n"); gmx_print_version_info(fp); } }