Tagged files with gromacs 3.0 header and added some license info
[alexxy/gromacs.git] / include / filenm.h
1 /*
2  * $Id$
3  * 
4  *                This source code is part of
5  * 
6  *                 G   R   O   M   A   C   S
7  * 
8  *          GROningen MAchine for Chemical Simulations
9  * 
10  *                        VERSION 3.0
11  * 
12  * Copyright (c) 1991-2001
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  * 
21  * If you want to redistribute modifications, please consider that
22  * scientific software is very special. Version control is crucial -
23  * bugs must be traceable. We will be happy to consider code for
24  * inclusion in the official distribution, but derived work must not
25  * be called official GROMACS. Details are found in the README & COPYING
26  * files - if they are missing, get the official version at www.gromacs.org.
27  * 
28  * To help us fund GROMACS development, we humbly ask that you cite
29  * the papers on the package - you can find them in the top README file.
30  * 
31  * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
32  * 
33  * And Hey:
34  * Giving Russians Opium May Alter Current Situation
35  */
36
37 #ifndef _filenm_h
38 #define _filenm_h
39
40 static char *SRCID_filenm_h = "$Id$";
41 #ifdef HAVE_CONFIG_H
42 #include <config.h>
43 #endif
44
45 #ifdef HAVE_IDENT
46 #ident  "@(#) filenm.h 1.14 2/2/97"
47 #endif /* HAVE_IDENT */
48
49 #ifdef CPLUSPLUS
50 extern "C" {
51 #endif
52
53 #include "futil.h"
54
55 void set_default_file_name(char *name);
56 /* Set the default file name for all file types to name */
57
58 extern char *ftp2ext(int ftp);
59 /* Return extension for filetype */
60
61 extern char *ftp2desc(int ftp);
62 /* Return description for file type */
63
64 extern char *ftp2defnm(int ftp);
65 /* Return default file name for file type */
66
67 extern char *ftp2ftype(int ftp);
68 /* Return Binary or ASCII depending on file type */
69
70 extern void pr_def(FILE *fp,int ftp);
71 /* Print definitions for filename ftp */
72
73 extern void pr_defs(FILE *fp);
74 /* Print definitions for all filename */
75
76 extern void pr_fns(FILE *fp,int nf,t_filenm tfn[]);
77 /* Print nf file names and types */
78
79 extern void pr_fopts(FILE *fp,int nf,t_filenm tfn[]);
80 /* prints file options in tcsh 'complete' format */
81
82 extern void parse_file_args(int *argc,char *argv[],int nf,t_filenm fnm[],
83                             bool bKeep);
84 /* Parse command line for file names. When bKeep is set args are 
85  * not removed from argv.
86  */
87
88 extern char *opt2fn(char *opt,int nfile,t_filenm fnm[]);
89 /* Return the filenm belonging top cmd-line option opt, or NULL when 
90  * no such option. 
91  */
92
93 #define opt2FILE(opt,nfile,fnm,mode) ffopen(opt2fn(opt,nfile,fnm),mode)
94 /* Return a file pointer from the filename (see above) */
95
96 extern int fn2ftp(char *fn);
97 /* Return the filetype corrsponding to filename */
98
99 extern char *ftp2fn(int ftp,int nfile,t_filenm fnm[]);
100 /* Return the first file name with type ftp, or NULL when none found. */
101
102 extern char *ftp2filter(int ftp);
103 /* Return a file extension filter for file type */
104
105 #define ftp2FILE(ftp,nfile,fnm,mode) ffopen(ftp2fn(ftp,nfile,fnm),mode)
106 /* Return a file pointer from the filename (see above) */
107
108 extern bool ftp2bSet(int ftp,int nfile,t_filenm fnm[]);
109 /* Return TRUE when this file type has been found on the cmd-line */
110
111 extern bool opt2bSet(char *opt,int nfile,t_filenm fnm[]);
112 /* Return TRUE when this option has been found on the cmd-line */
113
114 extern char *opt2fn_null(char *opt,int nfile,t_filenm fnm[]);
115 /* Return the filenm belonging top cmd-line option opt, or NULL when 
116  * no such option. 
117  * Also return NULL when opt is optional and option is not set. 
118  */
119
120 extern char *ftp2fn_null(int ftp,int nfile,t_filenm fnm[]);
121 /* Return the first file name with type ftp, or NULL when none found.
122  * Also return NULL when ftp is optional and option is not set.
123  */
124
125 extern bool is_optional(t_filenm *fnm);
126 /* Return whether or not this filenm is optional */
127
128 extern bool is_output(t_filenm *fnm);
129 /* Return whether or not this filenm is output */
130
131 extern bool is_set(t_filenm *fnm);
132 /* Return whether or not this filenm is set */
133
134 #ifdef CPLUSPLUS
135 }
136 #endif
137
138 #endif  /* _filenm_h */