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
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
[] = {
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 "Also check out our WWW page:",
54 "http://md.chem.rug.nl/~gmx",
56 "gromacs@chem.rug.nl",
60 #define NH1 asize(head1)
61 #define NCR asize(CopyrightText)
62 #define NH2 asize(head2)
65 void head(FILE *out
, char *fn_
, bool bH
, bool bSRCID
,
66 char *cstart
, char *ccont
, char *cend
)
70 fprintf(out
,"%s\n",cstart
);
71 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
72 fprintf(out
,"%s $""Id""$\n",ccont
);
73 for(i
=0; (i
<NH1
); i
++)
74 fprintf(out
,"%s %s\n",ccont
,head1
[i
]);
75 fprintf(out
,"%s %s\n",ccont
,GromacsVersion());
76 for(i
=0; (i
<NCR
); i
++)
77 fprintf(out
,"%s %s\n",ccont
,CopyrightText
[i
]);
78 for(i
=0; (i
<NH2
); i
++)
79 fprintf(out
,"%s %s\n",ccont
,head2
[i
]);
81 fprintf(out
,"%s %s\n",ccont
,bromacs());
82 fprintf(out
,"%s\n",cend
);
85 fprintf(out
,"#ifndef _%s\n",fn_
);
86 fprintf(out
,"#define _%s\n",fn_
);
90 fprintf(out
,"static char *SRCID_%s = \"$""Id""$\";\n",fn_
);
91 /* NOTE: the "" are to mislead CVS so it will not replace by version info */
98 char ofn
[1024],line
[MAXS
+1],cwd
[1024];
102 sprintf(ofn
,"%s.bak",fn
);
104 fprintf(stderr
,"Processing %s (backed up to %s)\n",
107 if (rename(fn
,ofn
) != 0) {
114 /* Skip over empty lines in the beginning only */
116 if (fgets2(line
,MAXS
,in
))
118 } while ((strlen(line
) == 0) && (!feof(in
)));
120 /* Now we are at end of file, or we have a non-empty string */
121 if (strlen(line
) != 0) {
122 if (strstr(line
,"/*") != NULL
) {
123 /* File does start with comment, so delete it and add new */
124 while ((strstr(line
,"*/") == NULL
) && (!feof(in
)))
125 fgets2(line
,MAXS
,in
);
133 fgets2(line
,MAXS
,in
);
134 if ( (strstr(line
,fn_
) != NULL
) &&
135 (strstr(line
,"#define") != NULL
) )
137 } while ( ( (strstr(line
,fn_
) != NULL
) ||
138 (strstr(line
,"static char *SRCID") != NULL
) ||
139 (strlen(line
)==0) ) && (!feof(in
) ) );
142 /* Do not put source id's in include/types since some filenames are
143 * be equal to those in include */
144 if ((strlen(cwd
)>strlen("types")) &&
145 (strcmp(cwd
+strlen(cwd
)-strlen("types"),"types") == NULL
))
147 head(out
,fn_
,bH
,bSRCID
,"/*"," *"," */");
149 fprintf(out
,"%s\n",line
);
150 } while (!feof(in
) && fgets2(line
,MAXS
,in
));
156 void cr_tex(char *fn
)
159 char ofn
[1024],line
[MAXS
+1];
162 sprintf(ofn
,"%s.bak",fn
);
164 fprintf(stderr
,"Processing (as Tex) %s (backed up to %s)\n",
167 if (rename(fn
,ofn
) != 0) {
174 /* Skip over empty lines in the beginning only */
176 if (fgets2(line
,MAXS
,in
))
178 while ((strlen(line
) == 0) && (!feof(in
)));
180 /* Now we are at end of file, or we have a non-empty string */
181 if (strlen(line
) != 0) {
182 while ((strstr(line
,"%") != NULL
) && (!feof(in
)))
183 /* File does start with comment, so delete it and add new */
184 fgets2(line
,MAXS
,in
);
185 head(out
,"",FALSE
,FALSE
,"%","%","%");
186 /* Skip over empty lines */
187 while ( (strlen(line
) == 0) && !feof(in
) )
188 if (fgets2(line
,MAXS
,in
))
191 fprintf(out
,"%s\n",line
);
192 while (!feof(in
) && fgets2(line
,MAXS
,in
));
198 int main(int argc
,char *argv
[])
203 for(i
=1; (i
<argc
); i
++) {
206 if ( strcmp(p
,".tex")==0 )