1c93ed97c5e01b597835c34d281f624b6296c214
[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 2.0
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * Please refer to:
17  * GROMACS: A message-passing parallel molecular dynamics implementation
18  * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19  * Comp. Phys. Comm. 91, 43-56 (1995)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Good ROcking Metal Altar for Chronical Sinners
28  */
29
30 #ifndef _filenm_h
31 #define _filenm_h
32
33 static char *SRCID_filenm_h = "$Id$";
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38
39 #ifdef HAVE_IDENT
40 #ident  "@(#) filenm.h 1.14 2/2/97"
41 #endif /* HAVE_IDENT */
42
43 #ifdef CPLUSPLUS
44 extern "C" {
45 #endif
46
47 #include "futil.h"
48
49 void set_default_file_name(char *name);
50 /* Set the default file name for all file types to name */
51
52 extern char *ftp2ext(int ftp);
53 /* Return extension for filetype */
54
55 extern char *ftp2desc(int ftp);
56 /* Return description for file type */
57
58 extern char *ftp2defnm(int ftp);
59 /* Return default file name for file type */
60
61 extern char *ftp2ftype(int ftp);
62 /* Return Binary or ASCII depending on file type */
63
64 extern void pr_def(FILE *fp,int ftp);
65 /* Print definitions for filename ftp */
66
67 extern void pr_defs(FILE *fp);
68 /* Print definitions for all filename */
69
70 extern void pr_fns(FILE *fp,int nf,t_filenm tfn[]);
71 /* Print nf file names and types */
72
73 extern void pr_fopts(FILE *fp,int nf,t_filenm tfn[]);
74 /* prints file options in tcsh 'complete' format */
75
76 extern void parse_file_args(int *argc,char *argv[],int nf,t_filenm fnm[],
77                             bool bKeep);
78 /* Parse command line for file names. When bKeep is set args are 
79  * not removed from argv.
80  */
81
82 extern char *opt2fn(char *opt,int nfile,t_filenm fnm[]);
83 /* Return the filenm belonging top cmd-line option opt, or NULL when 
84  * no such option. 
85  */
86
87 #define opt2FILE(opt,nfile,fnm,mode) ffopen(opt2fn(opt,nfile,fnm),mode)
88 /* Return a file pointer from the filename (see above) */
89
90 extern int fn2ftp(char *fn);
91 /* Return the filetype corrsponding to filename */
92
93 extern char *ftp2fn(int ftp,int nfile,t_filenm fnm[]);
94 /* Return the first file name with type ftp, or NULL when none found. */
95
96 extern char *ftp2filter(int ftp);
97 /* Return a file extension filter for file type */
98
99 #define ftp2FILE(ftp,nfile,fnm,mode) ffopen(ftp2fn(ftp,nfile,fnm),mode)
100 /* Return a file pointer from the filename (see above) */
101
102 extern bool ftp2bSet(int ftp,int nfile,t_filenm fnm[]);
103 /* Return TRUE when this file type has been found on the cmd-line */
104
105 extern bool opt2bSet(char *opt,int nfile,t_filenm fnm[]);
106 /* Return TRUE when this option has been found on the cmd-line */
107
108 extern char *opt2fn_null(char *opt,int nfile,t_filenm fnm[]);
109 /* Return the filenm belonging top cmd-line option opt, or NULL when 
110  * no such option. 
111  * Also return NULL when opt is optional and option is not set. 
112  */
113
114 extern char *ftp2fn_null(int ftp,int nfile,t_filenm fnm[]);
115 /* Return the first file name with type ftp, or NULL when none found.
116  * Also return NULL when ftp is optional and option is not set.
117  */
118
119 extern bool is_optional(t_filenm *fnm);
120 /* Return whether or not this filenm is optional */
121
122 extern bool is_output(t_filenm *fnm);
123 /* Return whether or not this filenm is output */
124
125 extern bool is_set(t_filenm *fnm);
126 /* Return whether or not this filenm is set */
127
128 #ifdef CPLUSPLUS
129 }
130 #endif
131
132 #endif  /* _filenm_h */