Removed refs to charmm files in share/top/Makefile.am
[gromacs/qmmm-gamess-us.git] / include / futil.h
blobca36a94efbe7ceee3fec5967b62e6f6d442fa281
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _futil_h
37 #define _futil_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include <stdio.h>
44 #include "typedefs.h"
46 /* Native windows uses backslash path separators.
47 * Cygwin and everybody else in the world use slash.
48 * When reading the PATH environment variable, Unix separates entries
49 * with colon, while windows uses semicolon.
51 #if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
52 #define DIR_SEPARATOR '\\'
53 #define PATH_SEPARATOR ";"
54 #else
55 #define DIR_SEPARATOR '/'
56 #define PATH_SEPARATOR ":"
57 #endif
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
63 extern void no_buffers(void);
64 /* Turn off buffering of files (which is default) for debugging purposes */
66 extern bool gmx_fexist(const char *fname);
67 /* Return TRUE when fname exists, FALSE otherwise */
69 bool gmx_fexist_master(const char *fname, t_commrec *cr);
70 /* Return TRUE when fname exists, FALSE otherwise, bcast from master to others */
72 extern bool gmx_eof(FILE *fp);
73 /* Return TRUE on end-of-file, FALSE otherwise */
75 extern bool is_pipe(FILE *fp);
76 /* Check whether the file (opened by ffopen) is a pipe */
78 extern char *backup_fn(const char *file);
79 /* Return a backup name for file (name with # before and after) */
81 /* Make a backup of file if necessary.
82 Return false if there was a problem.
84 extern bool make_backup(const char * file);
86 extern FILE *ffopen(const char *file, const char *mode);
87 /* Return a valid file pointer when succesfull, exits otherwise
88 * If the file is in compressed format, open a pipe which uncompresses
89 * the file! Therefore, files must be closed with ffclose (see below)
92 extern void ffclose(FILE *fp);
93 /* Close files or pipes */
96 extern void frewind(FILE *fp);
97 /* Does not rewind pipes, but does so for normal files */
99 #define rewind frewind
101 bool is_pipe(FILE *fp);
103 extern char *libfn(const char *file);
104 /* allocates and returns a string with the full file name for a library file */
106 extern FILE *libopen(const char *file);
107 /* Open a library file for reading. This looks in the current directory
108 * first, and then in the library directory. If the file is not found,
109 * it terminates with a fatal_error
112 extern bool get_libdir(char *libdir);
114 extern char *low_libfn(const char *file,bool bFatal);
116 extern FILE *low_libopen(const char *file,bool bFatal);
117 /* The same as the above, but does not terminate if (!bFatal) */
119 /* Create unique name for temp file (wrapper around mkstemp).
120 * Buf should be at least 7 bytes long
122 extern void gmx_tmpnam(char *buf);
125 gmx_truncatefile(char *path, off_t length);
127 #ifdef __cplusplus
129 #endif
131 #endif /* _futil_h */