2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2006, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
49 static char *head1[]= {
51 " This source code is part of",
55 " GROningen MAchine for Chemical Simulations",
59 static char *head2[]= {
60 "This program is free software; you can redistribute it and/or",
61 "modify it under the terms of the GNU General Public License",
62 "as published by the Free Software Foundation; either version 2",
63 "of the License, or (at your option) any later version.",
65 "If you want to redistribute modifications, please consider that",
66 "scientific software is very special. Version control is crucial -",
67 "bugs must be traceable. We will be happy to consider code for",
68 "inclusion in the official distribution, but derived work must not",
69 "be called official GROMACS. Details are found in the README & COPYING",
70 "files - if they are missing, get the official version at www.gromacs.org.",
72 "To help us fund GROMACS development, we humbly ask that you cite",
73 "the papers on the package - you can find them in the top README file.",
75 "For more info, check our website at http://www.gromacs.org",
80 #define NH1 asize(head1)
81 #define NCR asize(CopyrightText)
82 #define NH2 asize(head2)
85 void head(FILE *out, char *fn_, gmx_bool bH,
86 char *cstart, char *ccont, char *cend)
91 fprintf(out,"%s\n",cstart);
92 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
93 fprintf(out,"%s $""Id""$\n",ccont);
94 for(i=0; (i<NH1); i++)
95 fprintf(out,"%s %s\n",ccont,head1[i]);
96 fprintf(out,"%s %s\n",ccont,GromacsVersion());
97 for(i=0; (i<NCR); i++)
98 fprintf(out,"%s %s\n",ccont,CopyrightText[i]);
99 for(i=0; (i<NH2); i++)
100 fprintf(out,"%s %s\n",ccont,head2[i]);
101 bromacs(buf,STRLEN-1);
102 fprintf(out,"%s %s\n",ccont,buf);
103 fprintf(out,"%s\n",cend);
106 fprintf(out,"#ifndef _%s\n",fn_);
107 fprintf(out,"#define _%s\n",fn_);
115 char ofn[1024],line[MAXS+1],cwd[1024];
119 sprintf(ofn,"%s.bak",fn);
121 fprintf(stderr,"Processing %s (backed up to %s)\n",
124 if (rename(fn,ofn) != 0) {
131 /* Skip over empty lines in the beginning only */
133 if (fgets2(line,MAXS,in))
135 } while ((strlen(line) == 0) && (!feof(in)));
137 /* Now we are at end of file, or we have a non-empty string */
138 if (strlen(line) != 0) {
139 if (strstr(line,"/*") != NULL) {
140 /* File does start with comment, so delete it and add new */
141 while ((strstr(line,"*/") == NULL) && (!feof(in)))
142 fgets2(line,MAXS,in);
150 fgets2(line,MAXS,in);
151 if ( (strstr(line,fn_) != NULL) &&
152 (strstr(line,"#define") != NULL) )
154 } while ( ( (strstr(line,fn_) != NULL) ||
155 (strlen(line)==0) ) && (!feof(in) ) );
157 head(out,fn_,bH,"/*"," *"," */");
159 fprintf(out,"%s\n",line);
160 } while (!feof(in) && fgets2(line,MAXS,in));
166 void cr_other(char *fn)
169 /* Doesnt work right now, so its commented out */
171 char ofn[1024],line[MAXS+1],line2[MAXS+1],cwd[1024];
175 sprintf(ofn,"%s.bak",fn);
177 fprintf(stderr,"Processing %s (backed up to %s)\n",fn,ofn);
179 if (rename(fn,ofn) != 0) {
186 /* Skip over empty lines in the beginning only */
190 void cr_tex(char *fn)
193 char ofn[1024],line[MAXS+1];
196 sprintf(ofn,"%s.bak",fn);
198 fprintf(stderr,"Processing (as Tex) %s (backed up to %s)\n",
201 if (rename(fn,ofn) != 0) {
208 /* Skip over empty lines in the beginning only */
210 if (fgets2(line,MAXS,in))
212 while ((strlen(line) == 0) && (!feof(in)));
214 /* Now we are at end of file, or we have a non-empty string */
215 if (strlen(line) != 0) {
216 while ((strstr(line,"%") != NULL) && (!feof(in)))
217 /* File does start with comment, so delete it and add new */
218 fgets2(line,MAXS,in);
219 head(out,"",FALSE,"%","%","%");
220 /* Skip over empty lines */
221 while ( (strlen(line) == 0) && !feof(in) )
222 if (fgets2(line,MAXS,in))
225 fprintf(out,"%s\n",line);
226 while (!feof(in) && fgets2(line,MAXS,in));
232 int main(int argc,char *argv[])
237 for(i=1; (i<argc); i++) {
240 if ( strcmp(p,".tex")==0 )
242 else if ((strcmp(p,".c") == 0) || (strcmp(p,".h") == 0))