4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-2001
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
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.
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.
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.
31 * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
34 * Giving Russians Opium May Alter Current Situation
40 static char *SRCID_filenm_h
= "$Id$";
46 #ident "@(#) filenm.h 1.14 2/2/97"
47 #endif /* HAVE_IDENT */
55 void set_default_file_name(char *name
);
56 /* Set the default file name for all file types to name */
58 extern char *ftp2ext(int ftp
);
59 /* Return extension for filetype */
61 extern char *ftp2desc(int ftp
);
62 /* Return description for file type */
64 extern char *ftp2defnm(int ftp
);
65 /* Return default file name for file type */
67 extern char *ftp2ftype(int ftp
);
68 /* Return Binary or ASCII depending on file type */
70 extern void pr_def(FILE *fp
,int ftp
);
71 /* Print definitions for filename ftp */
73 extern void pr_defs(FILE *fp
);
74 /* Print definitions for all filename */
76 extern void pr_fns(FILE *fp
,int nf
,t_filenm tfn
[]);
77 /* Print nf file names and types */
79 extern void pr_fopts(FILE *fp
,int nf
,t_filenm tfn
[], int shell
);
80 /* prints file options in tcsh 'complete' format */
82 extern void parse_file_args(int *argc
,char *argv
[],int nf
,t_filenm fnm
[],
84 /* Parse command line for file names. When bKeep is set args are
85 * not removed from argv. */
87 extern char *opt2fn(char *opt
,int nfile
,t_filenm fnm
[]);
88 /* Return the filename belonging to cmd-line option opt, or NULL when
91 extern int opt2fns(char **fns
[], char *opt
,int nfile
,t_filenm fnm
[]);
92 /* Return the filenames belonging to cmd-line option opt, or NULL when
95 #define opt2FILE(opt,nfile,fnm,mode) ffopen(opt2fn(opt,nfile,fnm),mode)
96 /* Return a file pointer from the filename (see above) */
98 extern int fn2ftp(char *fn
);
99 /* Return the filetype corrsponding to filename */
101 extern char *ftp2fn(int ftp
,int nfile
,t_filenm fnm
[]);
102 /* Return the first file name with type ftp, or NULL when none found. */
104 extern int ftp2fns(char **fns
[], int ftp
,int nfile
,t_filenm fnm
[]);
105 /* Return the number of files for the first option with type ftp
106 and the files in **fns[] (will be allocated), or NULL when none found. */
108 extern char *ftp2filter(int ftp
);
109 /* Return a file extension filter for file type */
111 #define ftp2FILE(ftp,nfile,fnm,mode) ffopen(ftp2fn(ftp,nfile,fnm),mode)
112 /* Return a file pointer from the filename (see above) */
114 extern bool ftp2bSet(int ftp
,int nfile
,t_filenm fnm
[]);
115 /* Return TRUE when this file type has been found on the cmd-line */
117 extern bool opt2bSet(char *opt
,int nfile
,t_filenm fnm
[]);
118 /* Return TRUE when this option has been found on the cmd-line */
120 extern char *opt2fn_null(char *opt
,int nfile
,t_filenm fnm
[]);
121 /* Return the filenm belonging top cmd-line option opt, or NULL when
123 * Also return NULL when opt is optional and option is not set.
126 extern char *ftp2fn_null(int ftp
,int nfile
,t_filenm fnm
[]);
127 /* Return the first file name with type ftp, or NULL when none found.
128 * Also return NULL when ftp is optional and option is not set.
131 extern bool is_optional(t_filenm
*fnm
);
132 /* Return whether or not this filenm is optional */
134 extern bool is_output(t_filenm
*fnm
);
135 /* Return whether or not this filenm is output */
137 extern bool is_set(t_filenm
*fnm
);
138 /* Return whether or not this filenm is set */
144 #endif /* _filenm_h */