Merge branch release-5-0 into release-5-1
[alexxy/gromacs.git] / src / gromacs / legacyheaders / copyrite.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team.
6  * Copyright (c) 2013,2014, by the GROMACS development team, led by
7  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8  * and including many others, as listed in the AUTHORS file in the
9  * top-level source directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37 #ifndef _copyrite_h
38 #define _copyrite_h
39
40 #include <stdio.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /* Has to be a function, so we can get version number from the build system */
47 const char *GromacsVersion(void);
48
49 const char *Program(void);
50
51 const char *ShortProgram(void);
52
53 /* For both bromacs() and cool_quote() you have to provide a pointer to
54  * a string of reasonable length (say 256) and the string length. This
55  * is necessary to make the routines threadsafe and avoid allocating
56  * a new string each time. The retstring pointer will be the return value.
57  */
58 void
59 bromacs(char *retstring, int retsize);
60
61 /* For cool_quote, the number of the quote used will be returned in cqnum
62  * if it is non-NULL.
63  */
64 void
65 cool_quote(char *retstring, int retsize, int *cqnum);
66
67 void
68 gmx_thanx(FILE *fp);
69
70 void
71 please_cite(FILE *fp, const char *key);
72 /* Print a message asking to cite something... */
73
74 #ifdef __cplusplus
75 }
76
77 namespace gmx
78 {
79
80 class ProgramContextInterface;
81
82 /*! \brief
83  * Settings for printBinaryInformation().
84  *
85  * This class is used to specify what printBinaryInformation() prints.
86  */
87 class BinaryInformationSettings
88 {
89     public:
90         BinaryInformationSettings();
91
92         //! Print information about build settings.
93         BinaryInformationSettings &extendedInfo(bool bEnabled)
94         {
95             bExtendedInfo_ = bEnabled;
96             return *this;
97         }
98         //! Print copyright and license information.
99         BinaryInformationSettings &copyright(bool bEnabled)
100         {
101             bCopyright_ = bEnabled;
102             return *this;
103         }
104         //! Print a header line with "Generated by" text (for output files).
105         BinaryInformationSettings &generatedByHeader(bool bEnabled)
106         {
107             bGeneratedByHeader_ = bEnabled;
108             return *this;
109         }
110         //! Prefix each line with this string.
111         BinaryInformationSettings &linePrefix(const char *prefix)
112         {
113             prefix_ = prefix;
114             return *this;
115         }
116         //! Suffix each line with this string.
117         BinaryInformationSettings &lineSuffix(const char *suffix)
118         {
119             suffix_ = suffix;
120             return *this;
121         }
122
123     private:
124         bool        bExtendedInfo_;
125         bool        bCopyright_;
126         bool        bGeneratedByHeader_;
127         const char *prefix_;
128         const char *suffix_;
129
130         //! Needed to read the members without otherwise unnecessary accessors.
131         friend void printBinaryInformation(
132             FILE *fp, const ProgramContextInterface &programContext,
133             const BinaryInformationSettings &settings);
134 };
135
136 /*! \brief
137  * Print basic information about the executable.
138  *
139  * \param     fp             Where to print the information to.
140  * \param[in] programContext Program information object to use.
141  */
142 void printBinaryInformation(FILE                          *fp,
143                             const ProgramContextInterface &programContext);
144 /*! \brief
145  * Print basic information about the executable with custom settings.
146  *
147  * \param     fp             Where to print the information to.
148  * \param[in] programContext Program information object to use.
149  * \param[in] settings       Specifies what to print.
150  *
151  * \see BinaryInformationSettings
152  */
153 void printBinaryInformation(FILE                            *fp,
154                             const ProgramContextInterface   &programContext,
155                             const BinaryInformationSettings &settings);
156
157 } // namespace gmx;
158
159 #endif
160
161 #endif  /* _copyright_h */