Create fileio module
[alexxy/gromacs.git] / src / gromacs / fileio / filenm.h
similarity index 60%
rename from src/gromacs/legacyheaders/filenm.h
rename to src/gromacs/fileio/filenm.h
index dd708e4e768dbaad5af7efa1615581aa7bf4772b..49725e7e32e0a2694df54f79ceb5f2ce79bc21d2 100644 (file)
@@ -1,40 +1,42 @@
 /*
+ * This file is part of the GROMACS molecular simulation package.
  *
- *                This source code is part of
- *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * Copyright (c) 2013, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
  *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
  *
- * For more info, check our website at http://www.gromacs.org
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
  *
- * And Hey:
- * Gromacs Runs On Most of All Computer Systems
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-#ifndef _filenm_h
-#define _filenm_h
+#ifndef GMX_FILEIO_FILENM_H
+#define GMX_FILEIO_FILENM_H
 
 #include "futil.h"
 
 extern "C" {
 #endif
 
+/* this enum should correspond to the array deffile in gmxlib/filenm.c */
+enum {
+    efMDP,
+    efTRX, efTRO, efTRN, efTRR, efTRJ, efXTC, efG87,
+    efEDR,
+    efSTX, efSTO, efGRO, efG96, efPDB, efBRK, efENT, efESP, efPQR, efXYZ,
+    efCPT,
+    efLOG, efXVG, efOUT,
+    efNDX,
+    efTOP, efITP,
+    efTPX, efTPS, efTPR, efTPA, efTPB,
+    efTEX, efRTP, efATP, efHDB,
+    efDAT, efDLG,
+    efMAP, efEPS, efMAT, efM2P,
+    efMTX,
+    efEDI,
+    efCUB,
+    efXPM,
+    efRND,
+    efNR
+};
+
+typedef struct {
+    int           ftp;    /* File type (see enum above)                */
+    const char   *opt;    /* Command line option                       */
+    const char   *fn;     /* File name (as set in source code) */
+    unsigned long flag;   /* Flag for all kinds of info (see defs)*/
+    int           nfiles; /* number of files                   */
+    char        **fns;    /* File names                                */
+} t_filenm;
+
+#define ffSET   1<<0
+#define ffREAD  1<<1
+#define ffWRITE 1<<2
+#define ffOPT   1<<3
+#define ffLIB   1<<4
+#define ffMULT  1<<5
+#define ffRW    (ffREAD | ffWRITE)
+#define ffOPTRD (ffREAD | ffOPT)
+#define ffOPTWR (ffWRITE| ffOPT)
+#define ffOPTRW (ffRW   | ffOPT)
+#define ffLIBRD (ffREAD | ffLIB)
+#define ffLIBOPTRD (ffOPTRD | ffLIB)
+#define ffRDMULT   (ffREAD  | ffMULT)
+#define ffOPTRDMULT   (ffRDMULT | ffOPT)
+#define ffWRMULT   (ffWRITE  | ffMULT)
+#define ffOPTWRMULT   (ffWRMULT | ffOPT)
+
 void set_default_file_name(const char *name);
 /* Set the default file name for all file types to name */
 
@@ -109,12 +159,6 @@ int ftp2fns(char **fns[], int ftp, int nfile, const t_filenm fnm[]);
 /* Return the number of files for the first option with type ftp
    and the files in **fns[] (will be allocated), or NULL when none found. */
 
-#if 0
-/* This function is not thread-safe and used nowhere: */
-char *ftp2filter(int ftp);
-/* Return a file extension filter for file type */
-#endif
-
 #define ftp2FILE(ftp, nfile, fnm, mode) ffopen(ftp2fn(ftp, nfile, fnm), mode)
 /* Return a file pointer from the filename (see above) */
 
@@ -160,4 +204,4 @@ void done_filenms(int nf, t_filenm fnm[]);
 }
 #endif
 
-#endif  /* _filenm_h */
+#endif  /* GMX_FILEIO_FILENM_H */