Move Program() and ShortProgram() into copyrite.h
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 15 Dec 2013 19:01:01 +0000 (21:01 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 20 Dec 2013 14:27:26 +0000 (15:27 +0100)
Part of effort to split up statutil.* into their component parts.
The most natural place could be utility/programinfo.h, but that would
require extra effort.  With some C++ conversion, we could also
completely get rid of at least Program(), so did not want to go through
that now.  copyrite.h already has GromacsVersion(), so this somehow
fits.

Change-Id: If82e0e924025ab782f090cb5b0542a6d01689d9e

14 files changed:
src/gromacs/commandline/wman.cpp
src/gromacs/gmxana/gmx_trjconv.c
src/gromacs/gmxlib/checkpoint.c
src/gromacs/gmxlib/copyrite.cpp
src/gromacs/gmxlib/gmx_detect_hardware.c
src/gromacs/gmxlib/gmx_omp_nthreads.c
src/gromacs/gmxlib/gmx_thread_affinity.c
src/gromacs/gmxlib/statutil.cpp
src/gromacs/gmxlib/warninp.c
src/gromacs/legacyheaders/copyrite.h
src/gromacs/legacyheaders/statutil.h
src/gromacs/utility/gmxomp.cpp
src/programs/gmx/g_x2top.c
src/programs/mdrun/runner.c

index 99ad80ea9655f28064840a3ce17d137d98a41a89..ffd0e59576cbba0daf99b91f97c4345d0cf55b90 100644 (file)
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/stringutil.h"
 
+#include "copyrite.h"
 #include "gmx_fatal.h"
 #include "string2.h"
 #include "smalloc.h"
-#include "statutil.h"
 
 // Shell types, for completion stuff
 enum {
index 67e44a309e11527a4e723d6e86987326835f6dba..4cd447cb48e7a2382561b8f43dc49d30b92c4730 100644 (file)
@@ -38,6 +38,8 @@
 
 #include <string.h>
 #include <math.h>
+
+#include "copyrite.h"
 #include "macros.h"
 #include "sysstuff.h"
 #include "smalloc.h"
index 63cde1c278e928e4abed372c401b610ed24c6e5b..0445cb65e4737e12b6668649c737d3360279d3a3 100644 (file)
 #include <sys/locking.h>
 #endif
 
+#include "copyrite.h"
 #include "names.h"
 #include "typedefs.h"
 #include "smalloc.h"
-#include "statutil.h"
 #include "txtdump.h"
 #include "vec.h"
 #include "network.h"
index 08bd655f0258542aebc4e90c338f5f23197da620..1f657fd953c42707b31535575d90bd03c6531fe0 100644 (file)
@@ -59,6 +59,7 @@
 #include "gromacs/legacyheaders/vec.h"
 
 #include "gromacs/fft/fft.h"
+#include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/programinfo.h"
 
@@ -565,6 +566,26 @@ const char *GromacsVersion()
     return _gmx_ver_string;
 }
 
+const char *ShortProgram(void)
+{
+    try
+    {
+        // TODO: Use the display name once it doesn't break anything.
+        return gmx::ProgramInfo::getInstance().programName().c_str();
+    }
+    GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+}
+
+const char *Program(void)
+{
+    try
+    {
+        return gmx::ProgramInfo::getInstance().fullBinaryPath().c_str();
+    }
+    GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+}
+
+
 extern void gmx_print_version_info_gpu(FILE *fp);
 
 static void gmx_print_version_info(FILE *fp)
index b393edc7fb0e379b9ec58a2212ec694c173f79dd..3cc1358633a0cd5cc28cca3d2a3f5161bd4a0656 100644 (file)
@@ -52,7 +52,7 @@
 #include "gmx_fatal_collective.h"
 #include "smalloc.h"
 #include "gpu_utils.h"
-#include "statutil.h"
+#include "copyrite.h"
 #include "gmx_detect_hardware.h"
 #include "main.h"
 #include "md_logging.h"
index a0cf8ecae5660b39e14222471de1eb3c8bb1a73b..ae877b1ad08f356b0f23b45130eea791021cf0b1 100644 (file)
@@ -46,7 +46,7 @@
 #include "typedefs.h"
 #include "macros.h"
 #include "network.h"
-#include "statutil.h"
+#include "copyrite.h"
 #include "gmx_omp_nthreads.h"
 #include "md_logging.h"
 
index 6ad8775e898867f8b2275fdde7c61378d5590f7e..f1f157b9aa8b5a2afdeed4bb0a03ae3571f483ab 100644 (file)
 #include <errno.h>
 #include <assert.h>
 #include <stdio.h>
+
 #include "typedefs.h"
 #include "types/commrec.h"
 #include "types/hw_info.h"
+#include "copyrite.h"
 #include "gmx_cpuid.h"
 #include "gmx_omp_nthreads.h"
 #include "md_logging.h"
-#include "statutil.h"
 #include "gmx_thread_affinity.h"
 
 #include "thread_mpi/threads.h"
index 01542b18cce99b7846e90d1070f902a4e7478376..d492eb36e6454898b272d2496f8e1102d946e30e 100644 (file)
 #endif
 
 #include <cctype>
-#include <cmath>
 #include <cstdlib>
 
-#include "sysstuff.h"
 #include "macros.h"
 #include "string2.h"
 #include "smalloc.h"
@@ -53,7 +51,6 @@
 #include "gromacs/fileio/timecontrol.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxassert.h"
-#include "gromacs/utility/programinfo.h"
 
 #include "thread_mpi/threads.h"
 
 /* The source code in this file should be thread-safe.
       Please keep it that way. */
 
-/******************************************************************
- *
- *             T R A J E C T O R Y   S T U F F
- *
- ******************************************************************/
-
-/****************************************************************
- *
- *            E X P O R T E D   F U N C T I O N S
- *
- ****************************************************************/
-
-
-/* progam names, etc. */
-
-const char *ShortProgram(void)
-{
-    try
-    {
-        // TODO: Use the display name once it doesn't break anything.
-        return gmx::ProgramInfo::getInstance().programName().c_str();
-    }
-    GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
-}
-
-const char *Program(void)
-{
-    try
-    {
-        return gmx::ProgramInfo::getInstance().fullBinaryPath().c_str();
-    }
-    GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
-}
-
-/* utility functions */
-
 static void set_default_time_unit(const char *time_list[], gmx_bool bCanTime)
 {
     int         i      = 0;
@@ -137,7 +98,6 @@ static void set_default_time_unit(const char *time_list[], gmx_bool bCanTime)
     time_list[0] = time_list[i];
 }
 
-
 static void set_default_xvg_format(const char *xvg_list[])
 {
     int         i;
@@ -167,12 +127,6 @@ static void set_default_xvg_format(const char *xvg_list[])
     }
 }
 
-/*************************************************************
- *
- *           P A R S I N G   S T U F F
- *
- *************************************************************/
-
 static int add_parg(int npargs, t_pargs *pa, t_pargs *pa_add)
 {
     memcpy(&(pa[npargs]), pa_add, sizeof(*pa_add));
index 7e32d8272370f6bde1d299f48ed62d36e5e45b3f..a413dca335c1ecdebdc462756552bd190a8c99c3 100644 (file)
@@ -40,7 +40,7 @@
 #include <sysstuff.h>
 #include <string.h>
 #include "smalloc.h"
-#include "statutil.h"
+#include "copyrite.h"
 #include "string2.h"
 #include "gmx_fatal.h"
 #include "warninp.h"
index 3fa237150fdcb9b17688e4bd326a76a9f844a81f..b6ecbc4fd95a51e3b0c2b2942a857bcff8e19fb5 100644 (file)
 extern "C" {
 #endif
 
-/* Has to be a function, so we can get version number from autoconf */
+/* Has to be a function, so we can get version number from the build system */
 const char *GromacsVersion(void);
 
+const char *Program(void);
+
+const char *ShortProgram(void);
+
 /* For both bromacs() and cool_quote() you have to provide a pointer to
  * a string of reasonable length (say 256) and the string length. This
  * is necessary to make the routines threadsafe and avoid allocating
index e533d7f405f0df9a3e5736e777da6b2e8e827734..b6af4be90b847d8861432a550fda045997ba5826 100644 (file)
@@ -47,22 +47,6 @@ extern "C" {
 }
 #endif
 
-/* LEGACY FUNCTIONS
-
-   The program names, command lines, etc. are now also set in the output_env
-   structure. That is now the preferred location, but the functions here
-   are still available as legacy functions. Because they all act on inherently
-   global informaion, their existence in a multi-threaded environment is not
-   a real problem. */
-
-/* set the program name to the provided string, but note
- * that it must be a real file - we determine the library
- * directory from its location!
- */
-const char *Program(void);
-/* Id. without leading directory */
-const char *ShortProgram(void);
-
 /*****************************************************
  *         Some command line parsing routines
  *****************************************************/
index 768034c9751586a44bab58ef4a0e5569dbd9f04f..261875c5e13f8d47f388ecbc471996e6a268d870 100644 (file)
@@ -48,9 +48,9 @@
 
 #include <stdio.h>
 
+#include "copyrite.h"
 #include "md_logging.h"
 #include "gmx_fatal.h"
-#include "statutil.h"
 #include "string2.h"
 
 #include "common.h"
index 7256e09ebac7e3502e5029f2e2cd6c73b20fbc4f..5aa5e4337ac02c3d0651787abb7f9f6a097a545e 100644 (file)
@@ -38,6 +38,7 @@
 #include <config.h>
 #endif
 
+#include "copyrite.h"
 #include "maths.h"
 #include "macros.h"
 #include "bondf.h"
index 2caccebf21d838fc72d50cf3294f7572174cb881..cb094bb6925be3ead340a65a082194695f690cee 100644 (file)
@@ -48,7 +48,7 @@
 #include "typedefs.h"
 #include "smalloc.h"
 #include "sysstuff.h"
-#include "statutil.h"
+#include "copyrite.h"
 #include "force.h"
 #include "mdrun.h"
 #include "md_logging.h"