4 * This source code is part of
8 * GROningen MAchine for Chemical Simulations
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please cite this reference in all publication using GROMACS:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
27 * Great Red Oystrich Makes All Chemists Sane
29 static char *SRCID_copyrgt_c = "$Id$";
38 static char *head1[]= {
40 " This source code is part of",
44 "GROningen MAchine for Chemical Simulations",
47 static char *head2[] = {
48 "Please use these references in all publications using GROMACS:",
49 "GROMACS: A message-passing parallel molecular dynamics implementation",
50 "H.J.C. Berendsen, D. van der Spoel and R. van Drunen",
51 "Comp. Phys. Comm. 91, 43-56 (1995)",
53 "GROMACS 3.0: A package for molecular simulation and trajectory analysis",
54 "Erik Lindahl, Berk Hess and David van der Spoel",
55 "(in preparation, hey it's a beta version anyway)",
57 "Also check out our WWW page:",
58 "http://md.chem.rug.nl/~gmx",
60 "gromacs@chem.rug.nl",
64 #define NH1 asize(head1)
65 #define NCR asize(CopyrightText)
66 #define NH2 asize(head2)
69 void head(FILE *out, char *fn_, bool bH, bool bSRCID,
70 char *cstart, char *ccont, char *cend)
74 fprintf(out,"%s\n",cstart);
75 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
76 fprintf(out,"%s $""Id""$\n",ccont);
77 for(i=0; (i<NH1); i++)
78 fprintf(out,"%s %s\n",ccont,head1[i]);
79 fprintf(out,"%s %s\n",ccont,GromacsVersion());
80 for(i=0; (i<NCR); i++)
81 fprintf(out,"%s %s\n",ccont,CopyrightText[i]);
82 for(i=0; (i<NH2); i++)
83 fprintf(out,"%s %s\n",ccont,head2[i]);
85 fprintf(out,"%s %s\n",ccont,bromacs());
86 fprintf(out,"%s\n",cend);
89 fprintf(out,"#ifndef _%s\n",fn_);
90 fprintf(out,"#define _%s\n",fn_);
94 fprintf(out,"static char *SRCID_%s = \"$""Id""$\";\n",fn_);
95 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
96 /*fprintf(out,"\n");*/
102 char ofn[1024],line[MAXS+1],cwd[1024];
106 sprintf(ofn,"%s.bak",fn);
108 fprintf(stderr,"Processing %s (backed up to %s)\n",
111 if (rename(fn,ofn) != 0) {
118 /* Skip over empty lines in the beginning only */
120 if (fgets2(line,MAXS,in))
122 } while ((strlen(line) == 0) && (!feof(in)));
124 /* Now we are at end of file, or we have a non-empty string */
125 if (strlen(line) != 0) {
126 if (strstr(line,"/*") != NULL) {
127 /* File does start with comment, so delete it and add new */
128 while ((strstr(line,"*/") == NULL) && (!feof(in)))
129 fgets2(line,MAXS,in);
137 fgets2(line,MAXS,in);
138 if ( (strstr(line,fn_) != NULL) &&
139 (strstr(line,"#define") != NULL) )
141 } while ( ( (strstr(line,fn_) != NULL) ||
142 (strstr(line,"static char *SRCID") != NULL) ||
143 (strlen(line)==0) ) && (!feof(in) ) );
146 /* Do not put source id's in include/types since some filenames are
147 * be equal to those in include */
148 if ((strlen(cwd)>strlen("types")) &&
149 (strcmp(cwd+strlen(cwd)-strlen("types"),"types") == NULL))
151 head(out,fn_,bH,bSRCID,"/*"," *"," */");
153 fprintf(out,"%s\n",line);
154 } while (!feof(in) && fgets2(line,MAXS,in));
160 void cr_other(char *fn)
163 char ofn[1024],line[MAXS+1],line2[MAXS+1],cwd[1024];
167 sprintf(ofn,"%s.bak",fn);
169 fprintf(stderr,"Processing %s (backed up to %s)\n",
172 if (rename(fn,ofn) != 0) {
179 /* Skip over empty lines in the beginning only */
181 if (fgets2(line,MAXS,in))
183 } while ((strlen(line) == 0) && (!feof(in)));
185 /* Now we are at end of file, or we have a non-empty string */
186 if (strlen(line) != 0) {
189 while ((line2[0] == ';') && (!feof(in))) {
190 fgets2(line,MAXS,in);
201 fgets2(line,MAXS,in);
202 if ( (strstr(line,fn_) != NULL) &&
203 (strstr(line,"#define") != NULL) )
205 } while ( ( (strstr(line,fn_) != NULL) ||
206 (strstr(line,"static char *SRCID") != NULL) ||
207 (strlen(line)==0) ) && (!feof(in) ) );
211 /* Do not put source id's in include/types since some filenames are
212 * be equal to those in include */
213 /*if ((strlen(cwd)>strlen("types")) &&
214 (strcmp(cwd+strlen(cwd)-strlen("types"),"types") == NULL))
217 head(out,fn_,bH,bSRCID,";",";",";");
219 fprintf(out,"%s\n",line);
220 } while (!feof(in) && fgets2(line,MAXS,in));
226 void cr_tex(char *fn)
229 char ofn[1024],line[MAXS+1];
232 sprintf(ofn,"%s.bak",fn);
234 fprintf(stderr,"Processing (as Tex) %s (backed up to %s)\n",
237 if (rename(fn,ofn) != 0) {
244 /* Skip over empty lines in the beginning only */
246 if (fgets2(line,MAXS,in))
248 while ((strlen(line) == 0) && (!feof(in)));
250 /* Now we are at end of file, or we have a non-empty string */
251 if (strlen(line) != 0) {
252 while ((strstr(line,"%") != NULL) && (!feof(in)))
253 /* File does start with comment, so delete it and add new */
254 fgets2(line,MAXS,in);
255 head(out,"",FALSE,FALSE,"%","%","%");
256 /* Skip over empty lines */
257 while ( (strlen(line) == 0) && !feof(in) )
258 if (fgets2(line,MAXS,in))
261 fprintf(out,"%s\n",line);
262 while (!feof(in) && fgets2(line,MAXS,in));
268 int main(int argc,char *argv[])
273 for(i=1; (i<argc); i++) {
276 if ( strcmp(p,".tex")==0 )
278 else if ((strcmp(p,".c") == 0) || (strcmp(p,".h") == 0))