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 * GROup of MAchos and Cynical Suckers
36 static char *SRCID_copyrgt_c = "$Id$";
44 static char *head1[]= {
46 " This source code is part of",
50 " GROningen MAchine for Chemical Simulations",
54 static char *head2[]= {
55 "This program is free software; you can redistribute it and/or",
56 "modify it under the terms of the GNU General Public License",
57 "as published by the Free Software Foundation; either version 2",
58 "of the License, or (at your option) any later version.",
60 "If you want to redistribute modifications, please consider that",
61 "scientific software is very special. Version control is crucial -",
62 "bugs must be traceable. We will be happy to consider code for",
63 "inclusion in the official distribution, but derived work must not",
64 "be called official GROMACS. Details are found in the README & COPYING",
65 "files - if they are missing, get the official version at www.gromacs.org.",
67 "To help us fund GROMACS development, we humbly ask that you cite",
68 "the papers on the package - you can find them in the top README file.",
70 "Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .",
75 #define NH1 asize(head1)
76 #define NCR asize(CopyrightText)
77 #define NH2 asize(head2)
80 void head(FILE *out, char *fn_, bool bH, bool bSRCID,
81 char *cstart, char *ccont, char *cend)
85 fprintf(out,"%s\n",cstart);
86 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
87 fprintf(out,"%s $""Id""$\n",ccont);
88 for(i=0; (i<NH1); i++)
89 fprintf(out,"%s %s\n",ccont,head1[i]);
90 fprintf(out,"%s %s\n",ccont,GromacsVersion());
91 for(i=0; (i<NCR); i++)
92 fprintf(out,"%s %s\n",ccont,CopyrightText[i]);
93 for(i=0; (i<NH2); i++)
94 fprintf(out,"%s %s\n",ccont,head2[i]);
96 fprintf(out,"%s %s\n",ccont,bromacs());
97 fprintf(out,"%s\n",cend);
100 fprintf(out,"#ifndef _%s\n",fn_);
101 fprintf(out,"#define _%s\n",fn_);
105 fprintf(out,"static char *SRCID_%s = \"$""Id""$\";\n",fn_);
106 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
107 /*fprintf(out,"\n");*/
113 char ofn[1024],line[MAXS+1],cwd[1024];
117 sprintf(ofn,"%s.bak",fn);
119 fprintf(stderr,"Processing %s (backed up to %s)\n",
122 if (rename(fn,ofn) != 0) {
129 /* Skip over empty lines in the beginning only */
131 if (fgets2(line,MAXS,in))
133 } while ((strlen(line) == 0) && (!feof(in)));
135 /* Now we are at end of file, or we have a non-empty string */
136 if (strlen(line) != 0) {
137 if (strstr(line,"/*") != NULL) {
138 /* File does start with comment, so delete it and add new */
139 while ((strstr(line,"*/") == NULL) && (!feof(in)))
140 fgets2(line,MAXS,in);
148 fgets2(line,MAXS,in);
149 if ( (strstr(line,fn_) != NULL) &&
150 (strstr(line,"#define") != NULL) )
152 } while ( ( (strstr(line,fn_) != NULL) ||
153 (strstr(line,"static char *SRCID") != NULL) ||
154 (strlen(line)==0) ) && (!feof(in) ) );
157 /* Do not put source id's in include/types since some filenames are
158 * be equal to those in include */
159 if ((strlen(cwd)>strlen("types")) &&
160 (!strcmp(cwd+strlen(cwd)-strlen("types"),"types")))
162 head(out,fn_,bH,bSRCID,"/*"," *"," */");
164 fprintf(out,"%s\n",line);
165 } while (!feof(in) && fgets2(line,MAXS,in));
171 void cr_other(char *fn)
174 /* Doesnt work right now, so its commented out */
176 char ofn[1024],line[MAXS+1],line2[MAXS+1],cwd[1024];
180 sprintf(ofn,"%s.bak",fn);
182 fprintf(stderr,"Processing %s (backed up to %s)\n",
185 if (rename(fn,ofn) != 0) {
192 /* Skip over empty lines in the beginning only */
195 if (fgets2(line,MAXS,in))
197 } while ((strlen(line) == 0) && (!feof(in)));
199 /* Now we are at end of file, or we have a non-empty string */
201 if (strlen(line) != 0) {
204 while ((line2[0] == ';') && (!feof(in))) {
205 fgets2(line,MAXS,in);
217 fgets2(line,MAXS,in);
218 if ( (strstr(line,fn_) != NULL) &&
219 (strstr(line,"#define") != NULL) )
221 } while ( ( (strstr(line,fn_) != NULL) ||
222 (strstr(line,"static char *SRCID") != NULL) ||
223 (strlen(line)==0) ) && (!feof(in) ) );
227 /* Do not put source id's in include/types since some filenames are
228 * be equal to those in include */
229 /*if ((strlen(cwd)>strlen("types")) &&
230 (strcmp(cwd+strlen(cwd)-strlen("types"),"types") == NULL))
234 head(out,fn_,bH,bSRCID,";",";",";");
236 fprintf(out,"%s\n",line);
237 } while (!feof(in) && fgets2(line,MAXS,in));
244 void cr_tex(char *fn)
247 char ofn[1024],line[MAXS+1];
250 sprintf(ofn,"%s.bak",fn);
252 fprintf(stderr,"Processing (as Tex) %s (backed up to %s)\n",
255 if (rename(fn,ofn) != 0) {
262 /* Skip over empty lines in the beginning only */
264 if (fgets2(line,MAXS,in))
266 while ((strlen(line) == 0) && (!feof(in)));
268 /* Now we are at end of file, or we have a non-empty string */
269 if (strlen(line) != 0) {
270 while ((strstr(line,"%") != NULL) && (!feof(in)))
271 /* File does start with comment, so delete it and add new */
272 fgets2(line,MAXS,in);
273 head(out,"",FALSE,FALSE,"%","%","%");
274 /* Skip over empty lines */
275 while ( (strlen(line) == 0) && !feof(in) )
276 if (fgets2(line,MAXS,in))
279 fprintf(out,"%s\n",line);
280 while (!feof(in) && fgets2(line,MAXS,in));
286 int main(int argc,char *argv[])
291 for(i=1; (i<argc); i++) {
294 if ( strcmp(p,".tex")==0 )
296 else if ((strcmp(p,".c") == 0) || (strcmp(p,".h") == 0))