Clean up futil.*
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 10 Apr 2014 03:39:23 +0000 (06:39 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sun, 13 Apr 2014 04:49:34 +0000 (06:49 +0200)
- Make is_pipe() static, since it is not used outside futil.cpp.
- Move gmx_fexist_master() to network.* to remove t_commrec dependency
  from futil.
- Remove unnecessary #define for a system-provided symbol rewind().
- Remove unused gmx_truncatefile().
- Move STRLEN to utility/cstringutil.h, since types/simple.h is no
  longer transitively included by futil.h.  This avoids reintroducing an
  utility/ -> types/simple.h dependency.  Include cstringutil.h in
  source files that were depending on STRLEN.
- Add some Doxygen documentation for all the functions.

Preparation for moving these to utility/ to resolve fileio-utility
cyclic dependency.

Change-Id: I26ed7e46c512ee41621e2a2c241692c1bb28530d

22 files changed:
src/gromacs/fileio/futil.cpp
src/gromacs/fileio/futil.h
src/gromacs/fileio/gmxfio.h
src/gromacs/gmxana/gmx_genpr.c
src/gromacs/gmxana/nsfactor.c
src/gromacs/gmxlib/cuda_tools/pmalloc_cuda.cu
src/gromacs/gmxlib/gmx_omp_nthreads.c
src/gromacs/gmxlib/gmx_thread_affinity.c
src/gromacs/gmxlib/gpu_utils/gpu_utils.cu
src/gromacs/gmxlib/network.c
src/gromacs/gmxpreprocess/fflibutil.cpp
src/gromacs/gmxpreprocess/insert-molecules.cpp
src/gromacs/gmxpreprocess/read-conformation.cpp
src/gromacs/legacyheaders/network.h
src/gromacs/legacyheaders/types/simple.h
src/gromacs/mdlib/domdec_top.c
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_data_mgmt.cu
src/gromacs/mdlib/wall.c
src/gromacs/utility/cstringutil.h
src/programs/mdrun/pme_loadbal.c
src/programs/view/xdlgitem.cpp

index a56dff6f91cab7e81362bda6816f436b8d6d68fa..b05502bf31e7056b92f2ed7cbcbc77bc6f9e1c6a 100644 (file)
@@ -67,9 +67,6 @@
 
 #include "thread_mpi/threads.h"
 
-#include "gromacs/legacyheaders/types/commrec.h"
-#include "gromacs/legacyheaders/network.h"
-
 #include "gromacs/fileio/futil.h"
 #include "gromacs/fileio/path.h"
 #include "gromacs/utility/cstringutil.h"
@@ -198,10 +195,6 @@ int gmx_ffclose(FILE *fp)
 }
 
 
-#ifdef rewind
-#undef rewind
-#endif
-
 void frewind(FILE *fp)
 {
     tMPI_Thread_mutex_lock(&pstack_mutex);
@@ -248,7 +241,8 @@ gmx_off_t gmx_ftell(FILE *stream)
 }
 
 
-gmx_bool is_pipe(FILE *fp)
+//! Check whether the file (opened by gmx_ffopen()) is a pipe.
+static bool is_pipe(FILE *fp)
 {
     tMPI_Thread_mutex_lock(&pstack_mutex);
 
@@ -258,12 +252,12 @@ gmx_bool is_pipe(FILE *fp)
         if (ps->fp == fp)
         {
             tMPI_Thread_mutex_unlock(&pstack_mutex);
-            return TRUE;
+            return true;
         }
         ps = ps->prev;
     }
     tMPI_Thread_mutex_unlock(&pstack_mutex);
-    return FALSE;
+    return false;
 }
 
 
@@ -325,22 +319,6 @@ gmx_bool gmx_fexist(const char *fname)
     }
 }
 
-
-gmx_bool gmx_fexist_master(const char *fname, t_commrec *cr)
-{
-    gmx_bool bExist;
-
-    if (SIMMASTER(cr))
-    {
-        bExist = gmx_fexist(fname);
-    }
-    if (PAR(cr))
-    {
-        gmx_bcast(sizeof(bExist), &bExist, cr);
-    }
-    return bExist;
-}
-
 gmx_bool gmx_eof(FILE *fp)
 {
     char     data[4];
@@ -865,28 +843,6 @@ void gmx_tmpnam(char *buf)
     /* name in Buf should now be OK */
 }
 
-int gmx_truncatefile(char *path, gmx_off_t length)
-{
-#ifdef _MSC_VER
-    /* Microsoft visual studio does not have "truncate" */
-    HANDLE        fh;
-    LARGE_INTEGER win_length;
-
-    win_length.QuadPart = length;
-
-    fh = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL,
-                    OPEN_EXISTING, 0, NULL);
-    SetFilePointerEx(fh, win_length, NULL, FILE_BEGIN);
-    SetEndOfFile(fh);
-    CloseHandle(fh);
-
-    return 0;
-#else
-    return truncate(path, length);
-#endif
-}
-
-
 int gmx_file_rename(const char *oldname, const char *newname)
 {
 #ifndef GMX_NATIVE_WINDOWS
index ddaaef1b4ba4c3149b68a3906e5b17f70585dd04..c4586870f15ba6a672cd8041b5c29ce8f9e6befb 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
-
+/*! \file
+ * \brief
+ * Low-level wrappers for OS-specific file handling with some \Gromacs
+ * customizations.
+ *
+ * \inpublicapi
+ */
 #ifndef GMX_FILEIO_FUTIL_H
 #define GMX_FILEIO_FUTIL_H
 
+#include <limits.h>
 #include <stdio.h>
-#include "../legacyheaders/typedefs.h"
+
+#include "../utility/basedefinitions.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -48,17 +56,30 @@ extern "C" {
 }
 #endif
 
-/* Native windows uses backslash path separators.
- * Cygwin and everybody else in the world use slash.
- */
 #include "../utility/gmx_header_config.h"
+/*! \def DIR_SEPARATOR
+ * \brief
+ * Directory separator on this OS.
+ *
+ * Native Windows uses backslash path separators (but accepts also slashes).
+ * Cygwin and most other systems use slash.
+ *
+ * \todo
+ * Get rid of this (Redmine #950), or at least remove this from an installed
+ * header.  It is not necessary for constructing paths on the systems that it
+ * currently supports, and is not reliable in parsing input paths either, since
+ * Windows needs to accept both instead of only DIR_SEPARATOR.
+ */
 #ifdef GMX_NATIVE_WINDOWS
 #define DIR_SEPARATOR '\\'
 #else
 #define DIR_SEPARATOR '/'
 #endif
 
-/* Now get the maximum path size. */
+/*! \def GMX_PATH_MAX
+ * \brief
+ * Maximum path length, if the OS provides one, otherwise a fixed constant.
+ */
 #ifdef PATH_MAX
 #  define GMX_PATH_MAX PATH_MAX
 #elif defined MAX_PATH
@@ -67,113 +88,180 @@ extern "C" {
 #  define GMX_PATH_MAX 4096
 #endif
 
+/** \Gromacs definition to use instead of `off_t`. */
 typedef gmx_int64_t    gmx_off_t;
 
+/*! \brief
+ * Turn off buffering of files (which is default) for debugging purposes.
+ *
+ * This only has effect on files opened with gmx_ffopen().
+ */
 void no_buffers(void);
-/* Turn off buffering of files (which is default) for debugging purposes */
 
+/*! \brief
+ * Check whether a path exists.
+ *
+ * \returns `TRUE` when \p fname exists.
+ *
+ * Note that this returns `TRUE` even if \p fname is a directory instead of a
+ * file.
+ */
 gmx_bool gmx_fexist(const char *fname);
-/* Return TRUE when fname exists, FALSE otherwise */
-
-gmx_bool gmx_fexist_master(const char *fname, t_commrec *cr);
-/* Return TRUE when fname exists, FALSE otherwise, bcast from master to others */
 
+/*! \brief
+ * Checks for end of file.
+ *
+ * \returns `TRUE` on end-of-file
+ *
+ * \todo
+ * There are only two callers for this function, while there are ~20 direct
+ * calls to feof().  Probably this is unnecessary.
+ */
 gmx_bool gmx_eof(FILE *fp);
-/* Return TRUE on end-of-file, FALSE otherwise */
-
-gmx_bool is_pipe(FILE *fp);
-/* Check whether the file (opened by gmx_ffopen) is a pipe */
 
-/*  Make a backup of file if necessary.
-    Return false if there was a problem.
+/*! \brief
+ * Makes a backup of file if the file exists.
+ *
+ * \returns `FALSE` if there was a problem.
  */
-gmx_bool make_backup(const char * file);
+gmx_bool make_backup(const char *file);
 
-FILE *gmx_ffopen(const char *file, const char *mode);
-/* Return a valid file pointer when successful, exits otherwise
- * If the file is in compressed format, open a pipe which uncompresses
- * the file! Therefore, files must be closed with gmx_ffclose (see below)
+/*! \brief
+ * Opens a file, with \Gromacs-specific additions.
+ *
+ * If the file is in compressed format, opens a pipe which uncompresses the
+ * file on the fly.  For this to work, gmx_ffclose() and frewind() should
+ * always be used for files opened with gmx_ffopen() instead of fclose() and
+ * rewind().  For compressed files, the \p file parameter should be passed
+ * without the compressed extension; if that file is not found, then a few
+ * compression extensions are tried.
+ * Creates a backup if a file opened for writing already exists before
+ * overwriting it.
+ * A fatal error results if the file cannot be opened, for whatever reason.
  */
+FILE *gmx_ffopen(const char *file, const char *mode);
 
+/** Closes a file opened with gmx_ffopen(). */
 int gmx_ffclose(FILE *fp);
-/* Close files or pipes */
-
 
+/*! \brief
+ * Wraps rewind() for files opened with gmx_ffopen().
+ *
+ * A fatal error results if this function is called for a pipe (a compressed
+ * input file).
+ */
 void frewind(FILE *fp);
-/* Does not rewind pipes, but does so for normal files */
-
-#define rewind frewind
-
 
+/** OS-independent 64-bit fseek(). */
 int gmx_fseek(FILE *stream, gmx_off_t offset, int whence);
-/* OS-independent fseek. 64-bit when available */
 
+/** OS-independent 64-bit ftell(). */
 gmx_off_t gmx_ftell(FILE *stream);
-/* OS-independent fseek. 64-bit when available. */
-
-
-gmx_bool is_pipe(FILE *fp);
 
+/*! \brief
+ * Finds full path for a library file.
+ *
+ * Searches first in the current directory, and then in the configured library
+ * directories.
+ * Fatal error results if the file is not found in any location.
+ * The caller is responsible of freeing the returned string.
+ */
 char *gmxlibfn(const char *file);
-/* allocates and returns a string with the full file name for a library file */
 
+/*! \brief
+ * Opens a library file for reading.
+ *
+ * Works as gmxlibfn(), except that it opens the file and returns a file
+ * handle.
+ */
 FILE *libopen(const char *file);
-/* Open a library file for reading. This looks in the current directory
- * first, and then in the library directory. If the file is not found,
- * it terminates with a fatal_error
+
+/*! \brief
+ * More flexible gmxlibfn().
+ *
+ * Works as gmxlibfn(), but provides control whether the current working
+ * directory is searched or not, and whether a missing file is a fatal error or
+ * not.
  */
+char *low_gmxlibfn(const char *file, gmx_bool bAddCWD, gmx_bool bFatal);
 
-/* Opaque data type to list directories */
-typedef struct gmx_directory *
-    gmx_directory_t;
+/*! \brief
+ * Alternative for libopen() that optionally does not exit.
+ *
+ * Works as libopen(), but provides control whether a missing file is a fatal
+ * error or not.
+ */
+FILE *low_libopen(const char *file, gmx_bool bFatal);
 
-/* Open a directory for reading. The first argument should be a pointer
- * to a declared gmx_directory_t variable. Returns 0 on success.
+/** Opaque data type to list directories. */
+typedef struct gmx_directory *gmx_directory_t;
+
+/*! \brief
+ * Opens a directory for reading.
+ *
+ * \param[out] p_gmxdir Handle to the opened directory.
+ * \param[in]  dirname  Path to directory to open.
+ * \returns  0 on success.
  */
 int
 gmx_directory_open(gmx_directory_t *p_gmxdir, const char *dirname);
 
-
-/* Given an initialized gmx_directory_t, if there are more files in
+/*! \brief
+ * Gets next file in a directory.
+ *
+ * Given an initialized gmx_directory_t, if there are more files in
  * the directory this routine returns 0 and write the next name
- * into the USER-PROVIDED buffer name. The last argument is the max
- * number of characters that will be written. Just as strncpy, the
- * string will NOT be terminated it it is longer than maxlength_name.
+ * into the USER-PROVIDED buffer \p name.  The last argument is the max
+ * number of characters that will be written.  Just as strncpy(), the
+ * string will NOT be terminated it it is longer than \p maxlength_name.
  */
 int
 gmx_directory_nextfile(gmx_directory_t gmxdir, char *name, int maxlength_name);
 
-/* Release all data for a directory structure */
+/** Releases all data for a directory structure. */
 int
 gmx_directory_close(gmx_directory_t gmxdir);
 
 
-char *low_gmxlibfn(const char *file, gmx_bool bAddCWD, gmx_bool bFatal);
-
-FILE *low_libopen(const char *file, gmx_bool bFatal);
-/* The same as the above, but does not terminate if (!bFatal) */
-
-/* Create unique name for temp file (wrapper around mkstemp).
- * Buf should be at least 7 bytes long
+/*! \brief
+ * Creates unique name for temp file (wrapper around mkstemp).
+ *
+ * \p buf should be at least 7 bytes long
  */
 void gmx_tmpnam(char *buf);
 
-/* truncte the file to the specified length */
-int gmx_truncatefile(char *path, gmx_off_t length);
-
-/* rename/move the file (atomically, if the OS makes that available) oldname
  to newname */
+/*! \brief
+ * OS-independent rename().
+ *
+ * Renames/moves a file atomically, if the OS makes that available.
+ */
 int gmx_file_rename(const char *oldname, const char *newname);
 
-/* copy the file (data only) oldname to newname. if copy_if_empty==FALSE,
-   the file won't be copied if it's empty.*/
+/*! \brief
+ * Copies a file (data only) oldname to newname.
+ *
+ * If \p copy_if_empty is `FALSE`, the file won't be copied if it's empty.
+ */
 int gmx_file_copy(const char *oldname, const char *newname, gmx_bool copy_if_empty);
 
-/* do an fsync() on an open file pointer.
-   Only use this during checkpointing! */
+/*! \brief
+ * OS-independent fsync().
+ *
+ * Only use this during checkpointing!
+ */
 int gmx_fsync(FILE *fp);
 
+/*! \brief
+ * OS-independent chdir().
+ *
+ * Exits with a fatal error if changing the directory fails.
+ */
 void gmx_chdir(const char *directory);
+/*! \brief
+ * OS-independent getcwd().
+ *
+ * Exits with a fatal error if the call fails.
+ */
 void gmx_getcwd(char *buffer, size_t size);
 
 #ifdef __cplusplus
index 021d6eec8ffe7b41de148f3c88ce0168c94c183d..7a674545f348c99ae4c2bddb6cc6b019079b4328 100644 (file)
@@ -2,8 +2,8 @@
  * This file is part of the GROMACS molecular simulation package.
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * Copyright (c) 2013, by the GROMACS development team, led by
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -39,7 +39,9 @@
 #define GMX_FILEIO_GMXFIO_H
 
 #include <stdio.h>
+
 #include "../legacyheaders/typedefs.h"
+#include "../utility/cstringutil.h"
 #include "futil.h"
 
 #ifdef __cplusplus
index 41861705f637833395bc91caa4050ada72a834ed..c903b87f073f345389766fc0435dc41b3089ce7c 100644 (file)
 #endif
 
 #include <math.h>
+#include <string.h>
+
 #include "sysstuff.h"
 #include "gromacs/commandline/pargs.h"
-#include <string.h>
 #include "gromacs/utility/smalloc.h"
 #include "typedefs.h"
 #include "gromacs/fileio/confio.h"
@@ -49,6 +50,7 @@
 #include "macros.h"
 #include "vec.h"
 #include "index.h"
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gmx_ana.h"
 
index 2997d54edb29b2afa9f6e1ac764267e268354be0..43ab27f089193292a55b7b223afb73b08696d879 100644 (file)
 
 #include <string.h>
 
-#include "gromacs/random/random.h"
-#include "gromacs/utility/smalloc.h"
 #include "sysstuff.h"
 #include "vec.h"
 #include "nsfactor.h"
 
 #include "gromacs/fileio/futil.h"
 #include "gromacs/fileio/strdb.h"
+#include "gromacs/random/random.h"
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxomp.h"
+#include "gromacs/utility/smalloc.h"
 
 void check_binwidth(real binwidth)
 {
index 8c6b2cb8d438f3d0a90d2b92a90c0342424866c1..50ffadad74ce07654ab4490bbcaf3f4f9b6a8d81 100644 (file)
@@ -38,6 +38,8 @@
 #include "cudautils.cuh"
 #include "pmalloc_cuda.h"
 
+#include "gromacs/utility/cstringutil.h"
+
 /*! Allocates nbytes of page-locked memory.
  *  This memory should always be freed using pfree (or with the page-locked
  *  free functions provied by the CUDA library).
index 1bc4944b63f3598a62a2078e2c7f57ba72d3c85f..65d1f1bcbf82e4fc607a0a0afdcebdd2ffcbc20e 100644 (file)
@@ -42,7 +42,6 @@
 #include <config.h>
 #endif
 
-#include "gromacs/utility/fatalerror.h"
 #include "typedefs.h"
 #include "types/commrec.h"
 #include "macros.h"
@@ -51,6 +50,8 @@
 #include "gmx_omp_nthreads.h"
 #include "md_logging.h"
 
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxomp.h"
 
 /** Structure with the number of threads for each OpenMP multi-threaded
index 9b01b42f743e1963eee92536306c724b01baf297..02363e230502374b1088b3dca026a22c8fe0a731 100644 (file)
@@ -57,6 +57,7 @@
 #include "gmx_thread_affinity.h"
 
 #include "gromacs/utility/basenetwork.h"
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxomp.h"
 #include "gromacs/utility/smalloc.h"
index d626214d5cfee2055eb4ed53757c4b38629b4558..16a9dd964ee120c99addb591fb34ddf711d03826 100644 (file)
 #include <stdlib.h>
 #include <assert.h>
 
-#include "gromacs/utility/smalloc.h"
 #include "types/hw_info.h"
 
 #include "gpu_utils.h"
 #include "../cuda_tools/cudautils.cuh"
 #include "memtestG80_core.h"
 
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/smalloc.h"
+
 /** Amount of memory to be used in quick memtest. */
 #define QUICK_MEM       250
 /** Bit flag with type of tests to run in quick memtest. */
index ed8b46ff8e91667aa73c5bcfe9bf5071099ed055..a47e0483cd192f90689f57f67d65a8976e5413df 100644 (file)
@@ -46,6 +46,7 @@
 #include "copyrite.h"
 #include "macros.h"
 
+#include "gromacs/fileio/futil.h"
 #include "gromacs/utility/basenetwork.h"
 #include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
@@ -695,3 +696,18 @@ void gmx_sumli_sim(int gmx_unused nr, gmx_int64_t gmx_unused r[], const gmx_mult
 #endif
 #endif
 }
+
+gmx_bool gmx_fexist_master(const char *fname, t_commrec *cr)
+{
+    gmx_bool bExist;
+
+    if (SIMMASTER(cr))
+    {
+        bExist = gmx_fexist(fname);
+    }
+    if (PAR(cr))
+    {
+        gmx_bcast(sizeof(bExist), &bExist, cr);
+    }
+    return bExist;
+}
index f41bf90e37ded031c9641a285592e8ff3e68888d..c077fcb81e636342940f4593e7155d44fc2bccc8 100644 (file)
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+
 #include "sysstuff.h"
 #include "network.h"
+
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
index b240cda303ae59860072499b21de35a1597d2a9b..5036a854e6a26e03a3e009690d078b5694656b6e 100644 (file)
@@ -60,6 +60,8 @@
 #include "pbc.h"
 #include "xvgr.h"
 
+#include "gromacs/utility/cstringutil.h"
+
 static gmx_bool in_box(t_pbc *pbc, rvec x)
 {
     rvec box_center, dx;
index 64fa909de44387d358105fd555d18b4a8936c54d..ca9e5248c80729e5d802876d1ac81b6214e6e30c 100644 (file)
  */
 #include "read-conformation.h"
 
-#include "gromacs/fileio/confio.h"
 #include "atomprop.h"
 #include "types/simple.h"
 #include "types/atoms.h"
+
+#include "gromacs/fileio/confio.h"
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/smalloc.h"
 
 real *makeExclusionDistances(const t_atoms *a, gmx_atomprop_t aps,
index 9f934478d87a5ea90c2cb25b3436e7aa29836420..90ae14c955470cdb466d9c358987b0b942062d42 100644 (file)
@@ -113,6 +113,9 @@ void gmx_sumd_sim(int nr, double r[], const gmx_multisim_t *ms);
 #define gmx_sum_sim   gmx_sumf_sim
 #endif
 
+gmx_bool gmx_fexist_master(const char *fname, t_commrec *cr);
+/* Return TRUE when fname exists, FALSE otherwise, bcast from master to others */
+
 /* This doesn't currently work if enabled (needs some header cleanup). */
 #ifdef DEBUG_GMX
 #define debug_gmx() do { FILE *fp = debug ? debug : stderr; \
index 30c0c9079b36aa442ebf60f0aea0e13f471fe0f9..2aba62292def0249c548826a1baadcd486bda6de 100644 (file)
@@ -113,9 +113,6 @@ typedef int             ivec[DIM];
 
 typedef int             imatrix[DIM][DIM];
 
-/* Standard sizes for char* string buffers */
-#define STRLEN 4096
-
 #ifdef __cplusplus
 }
 #endif
index 3b65f8997994b1e6f836fc2aa728271124021456..1e361293125f83407a64610ce6c41e14ee1f1766 100644 (file)
@@ -38,8 +38,8 @@
 #endif
 
 #include <string.h>
+
 #include "typedefs.h"
-#include "gromacs/utility/smalloc.h"
 #include "types/commrec.h"
 #include "domdec.h"
 #include "domdec_network.h"
@@ -56,7 +56,9 @@
 #include "force.h"
 #include "gmx_omp_nthreads.h"
 
+#include "gromacs/utility/cstringutil.h"
 #include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 /* for dd_init_local_state */
 #define NITEM_DD_INIT_LOCAL_STATE 5
index 440c074db3b9518cfb2da8b8769e7084f6464be8..b57ceea04d42ae0b2590acb9c87f4697f161a93d 100644 (file)
@@ -61,6 +61,8 @@
 #include "nbnxn_cuda.h"
 #include "nbnxn_cuda_data_mgmt.h"
 
+#include "gromacs/utility/cstringutil.h"
+
 #if defined TEXOBJ_SUPPORTED && __CUDA_ARCH__ >= 300
 #define USE_TEXOBJ
 #endif
index 9212e11fbd64b9436561b434601ca90b1705de1b..f2886e625fc9366001be40a29a221e7c6a806d5c 100644 (file)
@@ -43,8 +43,6 @@
 
 #include <cuda.h>
 
-#include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/smalloc.h"
 #include "tables.h"
 #include "typedefs.h"
 #include "types/enums.h"
@@ -61,6 +59,9 @@
 #include "gpu_utils.h"
 
 #include "gromacs/utility/common.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 static bool bUseCudaEventBlockingSync = false; /* makes the CPU thread block */
 
index 85a74eb4aef035394a95ba6b97b3be308294bca1..85c7684f5169e9dd6bb40edd67015c6dee43d2da 100644 (file)
 
 #include <math.h>
 #include <string.h>
-#include "gromacs/math/utilities.h"
+
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "macros.h"
-#include "gromacs/utility/smalloc.h"
 #include "force.h"
-#include "gromacs/fileio/filenm.h"
 #include "nrnb.h"
 #include "vec.h"
 
+#include "gromacs/fileio/filenm.h"
+#include "gromacs/math/utilities.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/smalloc.h"
+
 void make_wall_tables(FILE *fplog, const output_env_t oenv,
                       const t_inputrec *ir, const char *tabfn,
                       const gmx_groups_t *groups,
index 15045d569ab5be8edd8dccbcc5d0858005d4e05e..a02d2b7ec171654d27975fca4420e4b89108cbde 100644 (file)
@@ -79,6 +79,8 @@ extern "C" {
 #define CONTINUE    '\\'
 /** Comment sign to use. */
 #define COMMENTSIGN ';'
+/** Standard size for char* string buffers. */
+#define STRLEN 4096
 
 /*! \brief
  * Strip trailing spaces and if s ends with a ::CONTINUE remove that too.
index e88b4b3b457fe17cb9c598bbe287a48dff591e82..25d6fd2563583e669a3c336e11711d592cee6ffb 100644 (file)
@@ -36,7 +36,6 @@
 #include <config.h>
 #endif
 
-#include "gromacs/utility/smalloc.h"
 #include "types/commrec.h"
 #include "network.h"
 #include "calcgrid.h"
@@ -49,6 +48,9 @@
 #include "md_logging.h"
 #include "pme_loadbal.h"
 
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/smalloc.h"
+
 /* Parameters and setting for one PP-PME setup */
 typedef struct {
     real      rcut_coulomb;    /* Coulomb cut-off                              */
index 09bf122b13daf39a160475933fc25f3f8a2a16ae..b3dd9ca3ca27710e35fda756f0c8475d4738591d 100644 (file)
 
 #include <algorithm>
 
-#include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/smalloc.h"
 #include "macros.h"
 #include "Xstuff.h"
 #include "xdlgitem.h"
 
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
+
 #define BUFSIZE 16
 
 static t_dlgitem *newitem(void)