Create fileio module
[alexxy/gromacs.git] / src / gromacs / fileio / filenm.c
similarity index 91%
rename from src/gromacs/gmxlib/filenm.c
rename to src/gromacs/fileio/filenm.c
index 1f96cc160f3f3874e4fe65e0416f8f277cfebf8e..f51ea4e50cd965a45b7a6cdfeffce82f16a341f5 100644 (file)
@@ -1,37 +1,41 @@
 /*
+ * 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:
- * GROningen Mixture of Alchemy and Childrens' Stories
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
  */
+#include "filenm.h"
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -42,7 +46,6 @@
 #include "smalloc.h"
 #include "string2.h"
 #include "gmx_fatal.h"
-#include "filenm.h"
 #include "futil.h"
 #include "xdrf.h"
 #include "macros.h"
@@ -146,7 +149,7 @@ typedef struct
     const int  *tps;
 } t_deffile;
 
-/* this array should correspond to the enum in include/types/filenm.h */
+/* this array should correspond to the enum in filenm.h */
 static const t_deffile
     deffile[efNR] =
 {
@@ -227,12 +230,6 @@ void set_default_file_name(const char *name)
     tMPI_Thread_mutex_unlock(&filenm_mutex);
 #endif
 
-#if 0
-    for (i = 0; i < efNR; i++)
-    {
-        deffile[i].defnm = default_file_name;
-    }
-#endif
 }
 
 const char *ftp2ext(int ftp)
@@ -961,58 +958,6 @@ const char *ftp2fn_null(int ftp, int nfile, const t_filenm fnm[])
     return NULL;
 }
 
-#if 0
-static void add_filters(char *filter, int *n, int nf, const int ftp[])
-{
-    char buf[8];
-    int  i;
-
-    sprintf(filter, "*.{");
-    for (i = 0; (i < nf); i++)
-    {
-        sprintf(buf, "%s", ftp2ext(ftp[i]));
-        if (*n > 0)
-        {
-            strcat(filter, ",");
-        }
-        strcat(filter, buf);
-        (*n)++;
-    }
-    strcat(filter, "}");
-}
-
-char *ftp2filter(int ftp)
-{
-    int         n;
-    static char filter[128];
-
-    filter[0] = '\0';
-    n         = 0;
-    switch (ftp)
-    {
-        case efTRX:
-            add_filters(filter, &n, NTRXS, trxs);
-            break;
-        case efTRN:
-            add_filters(filter, &n, NTRNS, trns);
-            break;
-        case efSTO:
-            add_filters(filter, &n, NSTOS, stos);
-            break;
-        case efSTX:
-            add_filters(filter, &n, NSTXS, stxs);
-            break;
-        case efTPX:
-            add_filters(filter, &n, NTPXS, tpxs);
-            break;
-        default:
-            sprintf(filter, "*%s", ftp2ext(ftp));
-            break;
-    }
-    return filter;
-}
-#endif
-
 gmx_bool is_optional(const t_filenm *fnm)
 {
     return ((fnm->flag & ffOPT) == ffOPT);