2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
41 #include "visibility.h"
48 void set_default_file_name(const char *name
);
49 /* Set the default file name for all file types to name */
52 const char *ftp2ext(int ftp
);
53 /* Return extension for filetype */
55 const char *ftp2ext_generic(int ftp
);
56 /* Return extension for filetype, and a generic name for generic types
60 const char *ftp2desc(int ftp
);
61 /* Return description for file type */
63 const char *ftp2defnm(int ftp
);
64 /* Return default file name for file type */
66 const char *ftp2ftype(int ftp
);
67 /* Return Binary or ASCII depending on file type */
69 void pr_def(FILE *fp
, int ftp
);
70 /* Print definitions for filename ftp */
72 void pr_defs(FILE *fp
);
73 /* Print definitions for all filename */
75 void pr_fns(FILE *fp
, int nf
, const t_filenm tfn
[]);
76 /* Print nf file names and types */
78 void pr_fopts(FILE *fp
, int nf
, const t_filenm tfn
[], int shell
);
79 /* prints file options in tcsh 'complete' format */
81 void parse_file_args(int *argc
, char *argv
[], int nf
, t_filenm fnm
[],
82 gmx_bool bKeep
, gmx_bool bReadNode
);
83 /* Parse command line for file names. When bKeep is set args are
84 * not removed from argv. */
87 const char *opt2fn(const char *opt
, int nfile
, const t_filenm fnm
[]);
88 /* Return the filename belonging to cmd-line option opt, or NULL when
92 const char *opt2fn_master(const char *opt
, int nfile
,
93 const t_filenm fnm
[], t_commrec
*cr
);
94 /* Return the filename belonging to cmd-line option opt, or NULL when
95 * no such option or not running on master */
99 int opt2fns(char **fns
[], const char *opt
, int nfile
,
100 const t_filenm fnm
[]);
101 /* Return the filenames belonging to cmd-line option opt, or NULL when
104 #define opt2FILE(opt, nfile, fnm, mode) ffopen(opt2fn(opt, nfile, fnm), mode)
105 /* Return a file pointer from the filename (see above) */
108 int fn2ftp(const char *fn
);
109 /* Return the filetype corrsponding to filename */
112 const char *ftp2fn(int ftp
, int nfile
, const t_filenm fnm
[]);
113 /* Return the first file name with type ftp, or NULL when none found. */
115 int ftp2fns(char **fns
[], int ftp
, int nfile
, const t_filenm fnm
[]);
116 /* Return the number of files for the first option with type ftp
117 and the files in **fns[] (will be allocated), or NULL when none found. */
120 /* This function is not thread-safe and used nowhere: */
121 char *ftp2filter(int ftp
);
122 /* Return a file extension filter for file type */
125 #define ftp2FILE(ftp, nfile, fnm, mode) ffopen(ftp2fn(ftp, nfile, fnm), mode)
126 /* Return a file pointer from the filename (see above) */
129 gmx_bool
ftp2bSet(int ftp
, int nfile
, const t_filenm fnm
[]);
130 /* Return TRUE when this file type has been found on the cmd-line */
133 gmx_bool
opt2bSet(const char *opt
, int nfile
, const t_filenm fnm
[]);
134 /* Return TRUE when this option has been found on the cmd-line */
137 const char *opt2fn_null(const char *opt
, int nfile
, const t_filenm fnm
[]);
138 /* Return the filenm belonging top cmd-line option opt, or NULL when
140 * Also return NULL when opt is optional and option is not set.
144 const char *ftp2fn_null(int ftp
, int nfile
, const t_filenm fnm
[]);
145 /* Return the first file name with type ftp, or NULL when none found.
146 * Also return NULL when ftp is optional and option is not set.
150 gmx_bool
is_optional(const t_filenm
*fnm
);
151 /* Return whether or not this filenm is optional */
154 gmx_bool
is_output(const t_filenm
*fnm
);
155 /* Return whether or not this filenm is output */
157 gmx_bool
is_set(const t_filenm
*fnm
);
158 /* Return whether or not this filenm is set */
160 /* When we do checkpointing, this routine is called to check for previous
161 * output files and append a '.partNNNN' suffix before the (output) file extensions.
164 int add_suffix_to_output_names(t_filenm
*fnm
, int nfile
, const char *suffix
);
166 /* duplicate the filename list (to make a private copy for each thread,
169 t_filenm
*dup_tfn(int nf
, const t_filenm tfn
[]);
171 /* Free memory allocated for file names by parse_file_args(). */
173 void done_filenms(int nf
, t_filenm fnm
[]);
179 #endif /* _filenm_h */