3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
9 * VERSION 3.3.99_development_20071104
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2006, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * Groningen Machine for Chemical Simulation
46 static char *head1
[]= {
48 " This source code is part of",
52 " GROningen MAchine for Chemical Simulations",
56 static char *head2
[]= {
57 "This program is free software; you can redistribute it and/or",
58 "modify it under the terms of the GNU General Public License",
59 "as published by the Free Software Foundation; either version 2",
60 "of the License, or (at your option) any later version.",
62 "If you want to redistribute modifications, please consider that",
63 "scientific software is very special. Version control is crucial -",
64 "bugs must be traceable. We will be happy to consider code for",
65 "inclusion in the official distribution, but derived work must not",
66 "be called official GROMACS. Details are found in the README & COPYING",
67 "files - if they are missing, get the official version at www.gromacs.org.",
69 "To help us fund GROMACS development, we humbly ask that you cite",
70 "the papers on the package - you can find them in the top README file.",
72 "For more info, check our website at http://www.gromacs.org",
77 #define NH1 asize(head1)
78 #define NCR asize(CopyrightText)
79 #define NH2 asize(head2)
82 void head(FILE *out
, char *fn_
, bool bH
,
83 char *cstart
, char *ccont
, char *cend
)
88 fprintf(out
,"%s\n",cstart
);
89 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
90 fprintf(out
,"%s $""Id""$\n",ccont
);
91 for(i
=0; (i
<NH1
); i
++)
92 fprintf(out
,"%s %s\n",ccont
,head1
[i
]);
93 fprintf(out
,"%s %s\n",ccont
,GromacsVersion());
94 for(i
=0; (i
<NCR
); i
++)
95 fprintf(out
,"%s %s\n",ccont
,CopyrightText
[i
]);
96 for(i
=0; (i
<NH2
); i
++)
97 fprintf(out
,"%s %s\n",ccont
,head2
[i
]);
98 bromacs(buf
,STRLEN
-1);
99 fprintf(out
,"%s %s\n",ccont
,buf
);
100 fprintf(out
,"%s\n",cend
);
103 fprintf(out
,"#ifndef _%s\n",fn_
);
104 fprintf(out
,"#define _%s\n",fn_
);
112 char ofn
[1024],line
[MAXS
+1],cwd
[1024];
116 sprintf(ofn
,"%s.bak",fn
);
118 fprintf(stderr
,"Processing %s (backed up to %s)\n",
121 if (rename(fn
,ofn
) != 0) {
128 /* Skip over empty lines in the beginning only */
130 if (fgets2(line
,MAXS
,in
))
132 } while ((strlen(line
) == 0) && (!feof(in
)));
134 /* Now we are at end of file, or we have a non-empty string */
135 if (strlen(line
) != 0) {
136 if (strstr(line
,"/*") != NULL
) {
137 /* File does start with comment, so delete it and add new */
138 while ((strstr(line
,"*/") == NULL
) && (!feof(in
)))
139 fgets2(line
,MAXS
,in
);
147 fgets2(line
,MAXS
,in
);
148 if ( (strstr(line
,fn_
) != NULL
) &&
149 (strstr(line
,"#define") != NULL
) )
151 } while ( ( (strstr(line
,fn_
) != NULL
) ||
152 (strlen(line
)==0) ) && (!feof(in
) ) );
154 head(out
,fn_
,bH
,"/*"," *"," */");
156 fprintf(out
,"%s\n",line
);
157 } while (!feof(in
) && fgets2(line
,MAXS
,in
));
163 void cr_other(char *fn
)
166 /* Doesnt work right now, so its commented out */
168 char ofn[1024],line[MAXS+1],line2[MAXS+1],cwd[1024];
172 sprintf(ofn,"%s.bak",fn);
174 fprintf(stderr,"Processing %s (backed up to %s)\n",fn,ofn);
176 if (rename(fn,ofn) != 0) {
183 /* Skip over empty lines in the beginning only */
187 void cr_tex(char *fn
)
190 char ofn
[1024],line
[MAXS
+1];
193 sprintf(ofn
,"%s.bak",fn
);
195 fprintf(stderr
,"Processing (as Tex) %s (backed up to %s)\n",
198 if (rename(fn
,ofn
) != 0) {
205 /* Skip over empty lines in the beginning only */
207 if (fgets2(line
,MAXS
,in
))
209 while ((strlen(line
) == 0) && (!feof(in
)));
211 /* Now we are at end of file, or we have a non-empty string */
212 if (strlen(line
) != 0) {
213 while ((strstr(line
,"%") != NULL
) && (!feof(in
)))
214 /* File does start with comment, so delete it and add new */
215 fgets2(line
,MAXS
,in
);
216 head(out
,"",FALSE
,"%","%","%");
217 /* Skip over empty lines */
218 while ( (strlen(line
) == 0) && !feof(in
) )
219 if (fgets2(line
,MAXS
,in
))
222 fprintf(out
,"%s\n",line
);
223 while (!feof(in
) && fgets2(line
,MAXS
,in
));
229 int main(int argc
,char *argv
[])
234 for(i
=1; (i
<argc
); i
++) {
237 if ( strcmp(p
,".tex")==0 )
239 else if ((strcmp(p
,".c") == 0) || (strcmp(p
,".h") == 0))