1 |
|
/* |
2 |
< |
File autogenerated by gengetopt version 2.11 |
2 |
> |
File autogenerated by gengetopt version 2.16 |
3 |
|
generated with the following command: |
4 |
< |
/home/maul/gezelter/tim/bin/gengetopt -i StaticProps.ggo -F StaticPropsCmd |
4 |
> |
gengetopt -F StaticPropsCmd |
5 |
|
|
6 |
|
The developers of gengetopt consider the fixed text that goes in all |
7 |
|
gengetopt output files to be in the public domain: |
8 |
|
we make no copyright claims on it. |
9 |
|
*/ |
10 |
|
|
11 |
– |
|
12 |
– |
#include <stdio.h> |
13 |
– |
#include <stdlib.h> |
14 |
– |
#include <string.h> |
15 |
– |
|
11 |
|
/* If we use autoconf. */ |
12 |
|
#ifdef HAVE_CONFIG_H |
13 |
|
#include "config.h" |
14 |
|
#endif |
15 |
|
|
16 |
+ |
#include <stdio.h> |
17 |
+ |
#include <stdlib.h> |
18 |
+ |
#include <string.h> |
19 |
+ |
|
20 |
|
#include "getopt.h" |
21 |
|
|
22 |
|
#include "StaticPropsCmd.h" |
23 |
|
|
24 |
+ |
static |
25 |
+ |
void clear_given (struct gengetopt_args_info *args_info); |
26 |
+ |
static |
27 |
+ |
void clear_args (struct gengetopt_args_info *args_info); |
28 |
+ |
|
29 |
+ |
static int |
30 |
+ |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error); |
31 |
+ |
|
32 |
+ |
static int |
33 |
+ |
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error); |
34 |
+ |
|
35 |
+ |
static char * |
36 |
+ |
gengetopt_strdup (const char *s); |
37 |
+ |
|
38 |
+ |
static |
39 |
+ |
void clear_given (struct gengetopt_args_info *args_info) |
40 |
+ |
{ |
41 |
+ |
args_info->help_given = 0 ; |
42 |
+ |
args_info->version_given = 0 ; |
43 |
+ |
args_info->input_given = 0 ; |
44 |
+ |
args_info->output_given = 0 ; |
45 |
+ |
args_info->step_given = 0 ; |
46 |
+ |
args_info->nrbins_given = 0 ; |
47 |
+ |
args_info->nbins_x_given = 0 ; |
48 |
+ |
args_info->nbins_y_given = 0 ; |
49 |
+ |
args_info->nanglebins_given = 0 ; |
50 |
+ |
args_info->length_given = 0 ; |
51 |
+ |
args_info->zoffset_given = 0 ; |
52 |
+ |
args_info->sele1_given = 0 ; |
53 |
+ |
args_info->sele2_given = 0 ; |
54 |
+ |
args_info->sele3_given = 0 ; |
55 |
+ |
args_info->refsele_given = 0 ; |
56 |
+ |
args_info->molname_given = 0 ; |
57 |
+ |
args_info->begin_given = 0 ; |
58 |
+ |
args_info->end_given = 0 ; |
59 |
+ |
args_info->gofr_given = 0 ; |
60 |
+ |
args_info->r_theta_given = 0 ; |
61 |
+ |
args_info->r_omega_given = 0 ; |
62 |
+ |
args_info->theta_omega_given = 0 ; |
63 |
+ |
args_info->gxyz_given = 0 ; |
64 |
+ |
args_info->p2_given = 0 ; |
65 |
+ |
args_info->scd_given = 0 ; |
66 |
+ |
args_info->density_given = 0 ; |
67 |
+ |
args_info->slab_density_given = 0 ; |
68 |
+ |
args_info->hxy_given = 0 ; |
69 |
+ |
args_info->staticProps_group_counter = 0 ; |
70 |
+ |
} |
71 |
+ |
|
72 |
+ |
static |
73 |
+ |
void clear_args (struct gengetopt_args_info *args_info) |
74 |
+ |
{ |
75 |
+ |
args_info->input_arg = NULL; |
76 |
+ |
args_info->input_orig = NULL; |
77 |
+ |
args_info->output_arg = NULL; |
78 |
+ |
args_info->output_orig = NULL; |
79 |
+ |
args_info->step_arg = 1; |
80 |
+ |
args_info->step_orig = NULL; |
81 |
+ |
args_info->nrbins_arg = 100; |
82 |
+ |
args_info->nrbins_orig = NULL; |
83 |
+ |
args_info->nbins_x_arg = 100; |
84 |
+ |
args_info->nbins_x_orig = NULL; |
85 |
+ |
args_info->nbins_y_arg = 100; |
86 |
+ |
args_info->nbins_y_orig = NULL; |
87 |
+ |
args_info->nanglebins_arg = 50; |
88 |
+ |
args_info->nanglebins_orig = NULL; |
89 |
+ |
args_info->length_orig = NULL; |
90 |
+ |
args_info->zoffset_arg = 0; |
91 |
+ |
args_info->zoffset_orig = NULL; |
92 |
+ |
args_info->sele1_arg = NULL; |
93 |
+ |
args_info->sele1_orig = NULL; |
94 |
+ |
args_info->sele2_arg = NULL; |
95 |
+ |
args_info->sele2_orig = NULL; |
96 |
+ |
args_info->sele3_arg = NULL; |
97 |
+ |
args_info->sele3_orig = NULL; |
98 |
+ |
args_info->refsele_arg = NULL; |
99 |
+ |
args_info->refsele_orig = NULL; |
100 |
+ |
args_info->molname_arg = NULL; |
101 |
+ |
args_info->molname_orig = NULL; |
102 |
+ |
args_info->begin_orig = NULL; |
103 |
+ |
args_info->end_orig = NULL; |
104 |
+ |
|
105 |
+ |
} |
106 |
+ |
|
107 |
|
void |
108 |
|
cmdline_parser_print_version (void) |
109 |
|
{ |
114 |
|
cmdline_parser_print_help (void) |
115 |
|
{ |
116 |
|
cmdline_parser_print_version (); |
117 |
< |
printf("\n" |
118 |
< |
"Usage: %s [OPTIONS]...\n", CMDLINE_PARSER_PACKAGE); |
119 |
< |
printf("\n"); |
120 |
< |
printf(" -h, --help Print help and exit\n"); |
121 |
< |
printf(" -V, --version Print version and exit\n"); |
122 |
< |
printf(" -i, --input=filename input dump file\n"); |
123 |
< |
printf(" -o, --output=filename output file name\n"); |
124 |
< |
printf(" -n, --step=INT process every n frame (default=`1')\n"); |
125 |
< |
printf(" -r, --nrbins=INT number of bins for distance (default=`100')\n"); |
126 |
< |
printf(" -a, --nanglebins=INT number of bins for cos(angle) (default=\n `50')\n"); |
127 |
< |
printf(" -l, --length=DOUBLE maximum length (Defaults to 1/2 smallest \n length of first frame)\n"); |
128 |
< |
printf(" --sele1=selection script select first stuntdouble set\n"); |
129 |
< |
printf(" --sele2=selection script select second stuntdouble set\n"); |
130 |
< |
printf(" --refsele=selection script select reference (use and only use with \n --gxyz)\n"); |
131 |
< |
printf("\n"); |
132 |
< |
printf(" Group: staticProps an option of this group is required\n"); |
133 |
< |
printf(" --gofr g(r)\n"); |
134 |
< |
printf(" --r_theta g(r, cos(theta))\n"); |
135 |
< |
printf(" --r_omega g(r, cos(omega))\n"); |
136 |
< |
printf(" --theta_omega g(cos(theta), cos(omega))\n"); |
137 |
< |
printf(" --gxyz g(x, y, z)\n"); |
138 |
< |
printf(" --p2 p2 order parameter\n"); |
117 |
> |
printf("\nUsage: StaticProps [OPTIONS]...\n\n"); |
118 |
> |
printf("%s\n"," -h, --help Print help and exit"); |
119 |
> |
printf("%s\n"," -V, --version Print version and exit"); |
120 |
> |
printf("%s\n"," -i, --input=filename input dump file"); |
121 |
> |
printf("%s\n"," -o, --output=filename output file name"); |
122 |
> |
printf("%s\n"," -n, --step=INT process every n frame (default=`1')"); |
123 |
> |
printf("%s\n"," -x, --nbins_x=INT number of bins in x axis (default=`100')"); |
124 |
> |
printf("%s\n"," -y , --nbins_y=INT number of bins in y axis (default=`100')"); |
125 |
> |
printf("%s\n"," -r, --nrbins=INT number of bins for distance (default=`100')"); |
126 |
> |
printf("%s\n"," -a, --nanglebins=INT number of bins for cos(angle) (default=`50')"); |
127 |
> |
printf("%s\n"," -l, --length=DOUBLE maximum length (Defaults to 1/2 smallest length \n of first frame)"); |
128 |
> |
printf("%s\n"," -z, --zoffset=DOUBLE Where to set the zero for the slab_density \n calculation (default=`0')"); |
129 |
> |
printf("%s\n"," --sele1=selection script select the first stuntdouble set"); |
130 |
> |
printf("%s\n"," --sele2=selection script select the second stuntdouble set"); |
131 |
> |
printf("%s\n"," --sele3=selection script select the third stuntdouble set"); |
132 |
> |
printf("%s\n"," --refsele=selection script\n select reference (use and only use with --gxyz)"); |
133 |
> |
printf("%s\n"," --molname=STRING molecule name"); |
134 |
> |
printf("%s\n"," --begin=INT begin interanl index"); |
135 |
> |
printf("%s\n"," --end=INT end internal index"); |
136 |
> |
printf("%s\n","\n Group: staticProps\n an option of this group is required"); |
137 |
> |
printf("%s\n"," --gofr g(r)"); |
138 |
> |
printf("%s\n"," --r_theta g(r, cos(theta))"); |
139 |
> |
printf("%s\n"," --r_omega g(r, cos(omega))"); |
140 |
> |
printf("%s\n"," --theta_omega g(cos(theta), cos(omega))"); |
141 |
> |
printf("%s\n"," --gxyz g(x, y, z)"); |
142 |
> |
printf("%s\n"," --p2 p2 order parameter (--sele1 and --sele2 must be \n specified)"); |
143 |
> |
printf("%s\n"," --scd scd order parameter(either --sele1, --sele2, \n --sele3 are specified or --molname, --begin, \n --end are specified)"); |
144 |
> |
printf("%s\n"," --density density plot (--sele1 must be specified)"); |
145 |
> |
printf("%s\n"," --slab_density slab density (--sele1 must be specified)"); |
146 |
> |
printf("%s\n"," --hxy hxy (--sele1 must be specified)"); |
147 |
> |
|
148 |
|
} |
149 |
|
|
150 |
+ |
void |
151 |
+ |
cmdline_parser_init (struct gengetopt_args_info *args_info) |
152 |
+ |
{ |
153 |
+ |
clear_given (args_info); |
154 |
+ |
clear_args (args_info); |
155 |
+ |
} |
156 |
|
|
157 |
< |
static char *gengetopt_strdup (const char *s); |
157 |
> |
static void |
158 |
> |
cmdline_parser_release (struct gengetopt_args_info *args_info) |
159 |
> |
{ |
160 |
> |
|
161 |
> |
if (args_info->input_arg) |
162 |
> |
{ |
163 |
> |
free (args_info->input_arg); /* free previous argument */ |
164 |
> |
args_info->input_arg = 0; |
165 |
> |
} |
166 |
> |
if (args_info->input_orig) |
167 |
> |
{ |
168 |
> |
free (args_info->input_orig); /* free previous argument */ |
169 |
> |
args_info->input_orig = 0; |
170 |
> |
} |
171 |
> |
if (args_info->output_arg) |
172 |
> |
{ |
173 |
> |
free (args_info->output_arg); /* free previous argument */ |
174 |
> |
args_info->output_arg = 0; |
175 |
> |
} |
176 |
> |
if (args_info->output_orig) |
177 |
> |
{ |
178 |
> |
free (args_info->output_orig); /* free previous argument */ |
179 |
> |
args_info->output_orig = 0; |
180 |
> |
} |
181 |
> |
if (args_info->step_orig) |
182 |
> |
{ |
183 |
> |
free (args_info->step_orig); /* free previous argument */ |
184 |
> |
args_info->step_orig = 0; |
185 |
> |
} |
186 |
> |
if (args_info->nrbins_orig) |
187 |
> |
{ |
188 |
> |
free (args_info->nrbins_orig); /* free previous argument */ |
189 |
> |
args_info->nrbins_orig = 0; |
190 |
> |
} |
191 |
> |
if (args_info->nbins_x_orig) |
192 |
> |
{ |
193 |
> |
free (args_info->nbins_x_orig); /* free previous argument */ |
194 |
> |
args_info->nbins_x_orig = 0; |
195 |
> |
} |
196 |
> |
if (args_info->nbins_y_orig) |
197 |
> |
{ |
198 |
> |
free (args_info->nbins_y_orig); /* free previous argument */ |
199 |
> |
args_info->nbins_y_orig = 0; |
200 |
> |
} |
201 |
> |
|
202 |
> |
if (args_info->nanglebins_orig) |
203 |
> |
{ |
204 |
> |
free (args_info->nanglebins_orig); /* free previous argument */ |
205 |
> |
args_info->nanglebins_orig = 0; |
206 |
> |
} |
207 |
> |
if (args_info->length_orig) |
208 |
> |
{ |
209 |
> |
free (args_info->length_orig); /* free previous argument */ |
210 |
> |
args_info->length_orig = 0; |
211 |
> |
} |
212 |
> |
if (args_info->zoffset_orig) |
213 |
> |
{ |
214 |
> |
free (args_info->zoffset_orig); /* free previous argument */ |
215 |
> |
args_info->zoffset_orig = 0; |
216 |
> |
} |
217 |
> |
if (args_info->sele1_arg) |
218 |
> |
{ |
219 |
> |
free (args_info->sele1_arg); /* free previous argument */ |
220 |
> |
args_info->sele1_arg = 0; |
221 |
> |
} |
222 |
> |
if (args_info->sele1_orig) |
223 |
> |
{ |
224 |
> |
free (args_info->sele1_orig); /* free previous argument */ |
225 |
> |
args_info->sele1_orig = 0; |
226 |
> |
} |
227 |
> |
if (args_info->sele2_arg) |
228 |
> |
{ |
229 |
> |
free (args_info->sele2_arg); /* free previous argument */ |
230 |
> |
args_info->sele2_arg = 0; |
231 |
> |
} |
232 |
> |
if (args_info->sele2_orig) |
233 |
> |
{ |
234 |
> |
free (args_info->sele2_orig); /* free previous argument */ |
235 |
> |
args_info->sele2_orig = 0; |
236 |
> |
} |
237 |
> |
if (args_info->sele3_arg) |
238 |
> |
{ |
239 |
> |
free (args_info->sele3_arg); /* free previous argument */ |
240 |
> |
args_info->sele3_arg = 0; |
241 |
> |
} |
242 |
> |
if (args_info->sele3_orig) |
243 |
> |
{ |
244 |
> |
free (args_info->sele3_orig); /* free previous argument */ |
245 |
> |
args_info->sele3_orig = 0; |
246 |
> |
} |
247 |
> |
if (args_info->refsele_arg) |
248 |
> |
{ |
249 |
> |
free (args_info->refsele_arg); /* free previous argument */ |
250 |
> |
args_info->refsele_arg = 0; |
251 |
> |
} |
252 |
> |
if (args_info->refsele_orig) |
253 |
> |
{ |
254 |
> |
free (args_info->refsele_orig); /* free previous argument */ |
255 |
> |
args_info->refsele_orig = 0; |
256 |
> |
} |
257 |
> |
if (args_info->molname_arg) |
258 |
> |
{ |
259 |
> |
free (args_info->molname_arg); /* free previous argument */ |
260 |
> |
args_info->molname_arg = 0; |
261 |
> |
} |
262 |
> |
if (args_info->molname_orig) |
263 |
> |
{ |
264 |
> |
free (args_info->molname_orig); /* free previous argument */ |
265 |
> |
args_info->molname_orig = 0; |
266 |
> |
} |
267 |
> |
if (args_info->begin_orig) |
268 |
> |
{ |
269 |
> |
free (args_info->begin_orig); /* free previous argument */ |
270 |
> |
args_info->begin_orig = 0; |
271 |
> |
} |
272 |
> |
if (args_info->end_orig) |
273 |
> |
{ |
274 |
> |
free (args_info->end_orig); /* free previous argument */ |
275 |
> |
args_info->end_orig = 0; |
276 |
> |
} |
277 |
> |
|
278 |
> |
clear_given (args_info); |
279 |
> |
} |
280 |
> |
|
281 |
> |
int |
282 |
> |
cmdline_parser_file_save(const char *filename, struct gengetopt_args_info *args_info) |
283 |
> |
{ |
284 |
> |
FILE *outfile; |
285 |
> |
int i = 0; |
286 |
> |
|
287 |
> |
outfile = fopen(filename, "w"); |
288 |
> |
|
289 |
> |
if (!outfile) |
290 |
> |
{ |
291 |
> |
fprintf (stderr, "%s: cannot open file for writing: %s\n", CMDLINE_PARSER_PACKAGE, filename); |
292 |
> |
return EXIT_FAILURE; |
293 |
> |
} |
294 |
> |
|
295 |
> |
if (args_info->help_given) { |
296 |
> |
fprintf(outfile, "%s\n", "help"); |
297 |
> |
} |
298 |
> |
if (args_info->version_given) { |
299 |
> |
fprintf(outfile, "%s\n", "version"); |
300 |
> |
} |
301 |
> |
if (args_info->input_given) { |
302 |
> |
if (args_info->input_orig) { |
303 |
> |
fprintf(outfile, "%s=\"%s\"\n", "input", args_info->input_orig); |
304 |
> |
} else { |
305 |
> |
fprintf(outfile, "%s\n", "input"); |
306 |
> |
} |
307 |
> |
} |
308 |
> |
if (args_info->output_given) { |
309 |
> |
if (args_info->output_orig) { |
310 |
> |
fprintf(outfile, "%s=\"%s\"\n", "output", args_info->output_orig); |
311 |
> |
} else { |
312 |
> |
fprintf(outfile, "%s\n", "output"); |
313 |
> |
} |
314 |
> |
} |
315 |
> |
if (args_info->step_given) { |
316 |
> |
if (args_info->step_orig) { |
317 |
> |
fprintf(outfile, "%s=\"%s\"\n", "step", args_info->step_orig); |
318 |
> |
} else { |
319 |
> |
fprintf(outfile, "%s\n", "step"); |
320 |
> |
} |
321 |
> |
} |
322 |
> |
if (args_info->nrbins_given) { |
323 |
> |
if (args_info->nrbins_orig) { |
324 |
> |
fprintf(outfile, "%s=\"%s\"\n", "nrbins", args_info->nrbins_orig); |
325 |
> |
} else { |
326 |
> |
fprintf(outfile, "%s\n", "nrbins"); |
327 |
> |
} |
328 |
> |
} |
329 |
> |
if (args_info->nbins_x_given) { |
330 |
> |
if (args_info->nbins_x_orig) { |
331 |
> |
fprintf(outfile, "%s=\"%s\"\n", "nbins_x", args_info->nbins_x_orig); |
332 |
> |
} else { |
333 |
> |
fprintf(outfile, "%s\n", "nbins_x"); |
334 |
> |
} |
335 |
> |
} |
336 |
> |
if (args_info->nbins_y_given) { |
337 |
> |
if (args_info->nbins_y_orig) { |
338 |
> |
fprintf(outfile, "%s=\"%s\"\n", "nbins_y", args_info->nbins_y_orig); |
339 |
> |
} else { |
340 |
> |
fprintf(outfile, "%s\n", "nbins_y"); |
341 |
> |
} |
342 |
> |
} |
343 |
> |
if (args_info->nanglebins_given) { |
344 |
> |
if (args_info->nanglebins_orig) { |
345 |
> |
fprintf(outfile, "%s=\"%s\"\n", "nanglebins", args_info->nanglebins_orig); |
346 |
> |
} else { |
347 |
> |
fprintf(outfile, "%s\n", "nanglebins"); |
348 |
> |
} |
349 |
> |
} |
350 |
> |
if (args_info->length_given) { |
351 |
> |
if (args_info->length_orig) { |
352 |
> |
fprintf(outfile, "%s=\"%s\"\n", "length", args_info->length_orig); |
353 |
> |
} else { |
354 |
> |
fprintf(outfile, "%s\n", "length"); |
355 |
> |
} |
356 |
> |
} |
357 |
> |
if (args_info->zoffset_given) { |
358 |
> |
if (args_info->zoffset_orig) { |
359 |
> |
fprintf(outfile, "%s=\"%s\"\n", "zoffset", args_info->zoffset_orig); |
360 |
> |
} else { |
361 |
> |
fprintf(outfile, "%s\n", "zoffset"); |
362 |
> |
} |
363 |
> |
} |
364 |
> |
if (args_info->sele1_given) { |
365 |
> |
if (args_info->sele1_orig) { |
366 |
> |
fprintf(outfile, "%s=\"%s\"\n", "sele1", args_info->sele1_orig); |
367 |
> |
} else { |
368 |
> |
fprintf(outfile, "%s\n", "sele1"); |
369 |
> |
} |
370 |
> |
} |
371 |
> |
if (args_info->sele2_given) { |
372 |
> |
if (args_info->sele2_orig) { |
373 |
> |
fprintf(outfile, "%s=\"%s\"\n", "sele2", args_info->sele2_orig); |
374 |
> |
} else { |
375 |
> |
fprintf(outfile, "%s\n", "sele2"); |
376 |
> |
} |
377 |
> |
} |
378 |
> |
if (args_info->sele3_given) { |
379 |
> |
if (args_info->sele3_orig) { |
380 |
> |
fprintf(outfile, "%s=\"%s\"\n", "sele3", args_info->sele3_orig); |
381 |
> |
} else { |
382 |
> |
fprintf(outfile, "%s\n", "sele3"); |
383 |
> |
} |
384 |
> |
} |
385 |
> |
if (args_info->refsele_given) { |
386 |
> |
if (args_info->refsele_orig) { |
387 |
> |
fprintf(outfile, "%s=\"%s\"\n", "refsele", args_info->refsele_orig); |
388 |
> |
} else { |
389 |
> |
fprintf(outfile, "%s\n", "refsele"); |
390 |
> |
} |
391 |
> |
} |
392 |
> |
if (args_info->molname_given) { |
393 |
> |
if (args_info->molname_orig) { |
394 |
> |
fprintf(outfile, "%s=\"%s\"\n", "molname", args_info->molname_orig); |
395 |
> |
} else { |
396 |
> |
fprintf(outfile, "%s\n", "molname"); |
397 |
> |
} |
398 |
> |
} |
399 |
> |
if (args_info->begin_given) { |
400 |
> |
if (args_info->begin_orig) { |
401 |
> |
fprintf(outfile, "%s=\"%s\"\n", "begin", args_info->begin_orig); |
402 |
> |
} else { |
403 |
> |
fprintf(outfile, "%s\n", "begin"); |
404 |
> |
} |
405 |
> |
} |
406 |
> |
if (args_info->end_given) { |
407 |
> |
if (args_info->end_orig) { |
408 |
> |
fprintf(outfile, "%s=\"%s\"\n", "end", args_info->end_orig); |
409 |
> |
} else { |
410 |
> |
fprintf(outfile, "%s\n", "end"); |
411 |
> |
} |
412 |
> |
} |
413 |
> |
if (args_info->gofr_given) { |
414 |
> |
fprintf(outfile, "%s\n", "gofr"); |
415 |
> |
} |
416 |
> |
if (args_info->r_theta_given) { |
417 |
> |
fprintf(outfile, "%s\n", "r_theta"); |
418 |
> |
} |
419 |
> |
if (args_info->r_omega_given) { |
420 |
> |
fprintf(outfile, "%s\n", "r_omega"); |
421 |
> |
} |
422 |
> |
if (args_info->theta_omega_given) { |
423 |
> |
fprintf(outfile, "%s\n", "theta_omega"); |
424 |
> |
} |
425 |
> |
if (args_info->gxyz_given) { |
426 |
> |
fprintf(outfile, "%s\n", "gxyz"); |
427 |
> |
} |
428 |
> |
if (args_info->p2_given) { |
429 |
> |
fprintf(outfile, "%s\n", "p2"); |
430 |
> |
} |
431 |
> |
if (args_info->scd_given) { |
432 |
> |
fprintf(outfile, "%s\n", "scd"); |
433 |
> |
} |
434 |
> |
if (args_info->density_given) { |
435 |
> |
fprintf(outfile, "%s\n", "density"); |
436 |
> |
} |
437 |
> |
if (args_info->slab_density_given) { |
438 |
> |
fprintf(outfile, "%s\n", "slab_density"); |
439 |
> |
} |
440 |
> |
if (args_info->hxy_given) { |
441 |
> |
fprintf(outfile, "%s\n", "hxy"); |
442 |
> |
} |
443 |
> |
fclose (outfile); |
444 |
|
|
445 |
+ |
i = EXIT_SUCCESS; |
446 |
+ |
return i; |
447 |
+ |
} |
448 |
+ |
|
449 |
+ |
void |
450 |
+ |
cmdline_parser_free (struct gengetopt_args_info *args_info) |
451 |
+ |
{ |
452 |
+ |
cmdline_parser_release (args_info); |
453 |
+ |
} |
454 |
+ |
|
455 |
+ |
|
456 |
|
/* gengetopt_strdup() */ |
457 |
|
/* strdup.c replacement of strdup, which is not standard */ |
458 |
|
char * |
459 |
|
gengetopt_strdup (const char *s) |
460 |
|
{ |
461 |
< |
char *result = (char*)malloc(strlen(s) + 1); |
461 |
> |
char *result = NULL; |
462 |
> |
if (!s) |
463 |
> |
return result; |
464 |
> |
|
465 |
> |
result = (char*)malloc(strlen(s) + 1); |
466 |
|
if (result == (char*)0) |
467 |
|
return (char*)0; |
468 |
|
strcpy(result, s); |
469 |
|
return result; |
470 |
|
} |
471 |
|
|
472 |
< |
int |
473 |
< |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
472 |
> |
static void |
473 |
> |
reset_group_staticProps(struct gengetopt_args_info *args_info); |
474 |
> |
|
475 |
> |
static void |
476 |
> |
reset_group_staticProps(struct gengetopt_args_info *args_info) |
477 |
|
{ |
478 |
< |
int c; /* Character of the parsed option. */ |
479 |
< |
int missing_required_options = 0; |
79 |
< |
int staticProps_group_counter = 0; |
478 |
> |
if (! args_info->staticProps_group_counter) |
479 |
> |
return; |
480 |
|
|
81 |
– |
|
82 |
– |
args_info->help_given = 0 ; |
83 |
– |
args_info->version_given = 0 ; |
84 |
– |
args_info->input_given = 0 ; |
85 |
– |
args_info->output_given = 0 ; |
86 |
– |
args_info->step_given = 0 ; |
87 |
– |
args_info->nrbins_given = 0 ; |
88 |
– |
args_info->nanglebins_given = 0 ; |
89 |
– |
args_info->length_given = 0 ; |
90 |
– |
args_info->sele1_given = 0 ; |
91 |
– |
args_info->sele2_given = 0 ; |
92 |
– |
args_info->refsele_given = 0 ; |
481 |
|
args_info->gofr_given = 0 ; |
482 |
|
args_info->r_theta_given = 0 ; |
483 |
|
args_info->r_omega_given = 0 ; |
484 |
|
args_info->theta_omega_given = 0 ; |
485 |
|
args_info->gxyz_given = 0 ; |
486 |
|
args_info->p2_given = 0 ; |
487 |
< |
#define clear_args() { \ |
488 |
< |
args_info->input_arg = NULL; \ |
489 |
< |
args_info->output_arg = NULL; \ |
490 |
< |
args_info->step_arg = 1 ;\ |
491 |
< |
args_info->nrbins_arg = 100 ;\ |
492 |
< |
args_info->nanglebins_arg = 50 ;\ |
105 |
< |
args_info->sele1_arg = NULL; \ |
106 |
< |
args_info->sele2_arg = NULL; \ |
107 |
< |
args_info->refsele_arg = NULL; \ |
487 |
> |
args_info->scd_given = 0 ; |
488 |
> |
args_info->density_given = 0 ; |
489 |
> |
args_info->slab_density_given = 0 ; |
490 |
> |
args_info->hxy_given= 0 ; |
491 |
> |
|
492 |
> |
args_info->staticProps_group_counter = 0; |
493 |
|
} |
494 |
|
|
495 |
< |
clear_args(); |
495 |
> |
int |
496 |
> |
cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info) |
497 |
> |
{ |
498 |
> |
return cmdline_parser2 (argc, argv, args_info, 0, 1, 1); |
499 |
> |
} |
500 |
|
|
501 |
+ |
int |
502 |
+ |
cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required) |
503 |
+ |
{ |
504 |
+ |
int result; |
505 |
+ |
|
506 |
+ |
result = cmdline_parser_internal (argc, argv, args_info, override, initialize, check_required, NULL); |
507 |
+ |
|
508 |
+ |
if (result == EXIT_FAILURE) |
509 |
+ |
{ |
510 |
+ |
cmdline_parser_free (args_info); |
511 |
+ |
exit (EXIT_FAILURE); |
512 |
+ |
} |
513 |
+ |
|
514 |
+ |
return result; |
515 |
+ |
} |
516 |
+ |
|
517 |
+ |
int |
518 |
+ |
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) |
519 |
+ |
{ |
520 |
+ |
int result = EXIT_SUCCESS; |
521 |
+ |
|
522 |
+ |
if (cmdline_parser_required2(args_info, prog_name, NULL) > 0) |
523 |
+ |
result = EXIT_FAILURE; |
524 |
+ |
|
525 |
+ |
if (result == EXIT_FAILURE) |
526 |
+ |
{ |
527 |
+ |
cmdline_parser_free (args_info); |
528 |
+ |
exit (EXIT_FAILURE); |
529 |
+ |
} |
530 |
+ |
|
531 |
+ |
return result; |
532 |
+ |
} |
533 |
+ |
|
534 |
+ |
int |
535 |
+ |
cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error) |
536 |
+ |
{ |
537 |
+ |
int error = 0; |
538 |
+ |
|
539 |
+ |
if (! args_info->input_given) |
540 |
+ |
{ |
541 |
+ |
fprintf (stderr, "%s: '--input' ('-i') option required%s\n", prog_name, (additional_error ? additional_error : "")); |
542 |
+ |
error = 1; |
543 |
+ |
} |
544 |
+ |
if (args_info->staticProps_group_counter == 0) |
545 |
+ |
{ |
546 |
+ |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", prog_name, args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
547 |
+ |
error = 1; |
548 |
+ |
} |
549 |
+ |
|
550 |
+ |
|
551 |
+ |
return error; |
552 |
+ |
} |
553 |
+ |
|
554 |
+ |
int |
555 |
+ |
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required, const char *additional_error) |
556 |
+ |
{ |
557 |
+ |
int c; /* Character of the parsed option. */ |
558 |
+ |
|
559 |
+ |
int error = 0; |
560 |
+ |
struct gengetopt_args_info local_args_info; |
561 |
+ |
|
562 |
+ |
if (initialize) |
563 |
+ |
cmdline_parser_init (args_info); |
564 |
+ |
|
565 |
+ |
cmdline_parser_init (&local_args_info); |
566 |
+ |
|
567 |
|
optarg = 0; |
568 |
< |
optind = 1; |
568 |
> |
optind = 0; |
569 |
|
opterr = 1; |
570 |
|
optopt = '?'; |
571 |
|
|
583 |
|
{ "nrbins", 1, NULL, 'r' }, |
584 |
|
{ "nanglebins", 1, NULL, 'a' }, |
585 |
|
{ "length", 1, NULL, 'l' }, |
586 |
+ |
{ "zoffset", 1, NULL, 'z' }, |
587 |
|
{ "sele1", 1, NULL, 0 }, |
588 |
|
{ "sele2", 1, NULL, 0 }, |
589 |
+ |
{ "sele3", 1, NULL, 0 }, |
590 |
|
{ "refsele", 1, NULL, 0 }, |
591 |
+ |
{ "molname", 1, NULL, 0 }, |
592 |
+ |
{ "begin", 1, NULL, 0 }, |
593 |
+ |
{ "end", 1, NULL, 0 }, |
594 |
|
{ "gofr", 0, NULL, 0 }, |
595 |
|
{ "r_theta", 0, NULL, 0 }, |
596 |
|
{ "r_omega", 0, NULL, 0 }, |
597 |
|
{ "theta_omega", 0, NULL, 0 }, |
598 |
|
{ "gxyz", 0, NULL, 0 }, |
599 |
|
{ "p2", 0, NULL, 0 }, |
600 |
+ |
{ "scd", 0, NULL, 0 }, |
601 |
+ |
{ "density", 0, NULL, 0 }, |
602 |
+ |
{ "slab_density", 0, NULL, 0 }, |
603 |
+ |
{ "hxy", 0, NULL, 0 }, |
604 |
|
{ NULL, 0, NULL, 0 } |
605 |
|
}; |
606 |
|
|
607 |
|
stop_char = 0; |
608 |
< |
c = getopt_long (argc, argv, "hVi:o:n:r:a:l:", long_options, &option_index); |
608 |
> |
c = getopt_long (argc, argv, "hVi:o:n:r:a:l:z:", long_options, &option_index); |
609 |
|
|
610 |
|
if (c == -1) break; /* Exit from `while (1)' loop. */ |
611 |
|
|
612 |
|
switch (c) |
613 |
|
{ |
614 |
|
case 'h': /* Print help and exit. */ |
151 |
– |
clear_args (); |
615 |
|
cmdline_parser_print_help (); |
616 |
+ |
cmdline_parser_free (&local_args_info); |
617 |
|
exit (EXIT_SUCCESS); |
618 |
|
|
619 |
|
case 'V': /* Print version and exit. */ |
156 |
– |
clear_args (); |
620 |
|
cmdline_parser_print_version (); |
621 |
+ |
cmdline_parser_free (&local_args_info); |
622 |
|
exit (EXIT_SUCCESS); |
623 |
|
|
624 |
|
case 'i': /* input dump file. */ |
625 |
< |
if (args_info->input_given) |
625 |
> |
if (local_args_info.input_given) |
626 |
|
{ |
627 |
< |
fprintf (stderr, "%s: `--input' (`-i') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
628 |
< |
clear_args (); |
165 |
< |
exit (EXIT_FAILURE); |
627 |
> |
fprintf (stderr, "%s: `--input' (`-i') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
628 |
> |
goto failure; |
629 |
|
} |
630 |
+ |
if (args_info->input_given && ! override) |
631 |
+ |
continue; |
632 |
+ |
local_args_info.input_given = 1; |
633 |
|
args_info->input_given = 1; |
634 |
+ |
if (args_info->input_arg) |
635 |
+ |
free (args_info->input_arg); /* free previous string */ |
636 |
|
args_info->input_arg = gengetopt_strdup (optarg); |
637 |
+ |
if (args_info->input_orig) |
638 |
+ |
free (args_info->input_orig); /* free previous string */ |
639 |
+ |
args_info->input_orig = gengetopt_strdup (optarg); |
640 |
|
break; |
641 |
|
|
642 |
|
case 'o': /* output file name. */ |
643 |
< |
if (args_info->output_given) |
643 |
> |
if (local_args_info.output_given) |
644 |
|
{ |
645 |
< |
fprintf (stderr, "%s: `--output' (`-o') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
646 |
< |
clear_args (); |
176 |
< |
exit (EXIT_FAILURE); |
645 |
> |
fprintf (stderr, "%s: `--output' (`-o') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
646 |
> |
goto failure; |
647 |
|
} |
648 |
+ |
if (args_info->output_given && ! override) |
649 |
+ |
continue; |
650 |
+ |
local_args_info.output_given = 1; |
651 |
|
args_info->output_given = 1; |
652 |
+ |
if (args_info->output_arg) |
653 |
+ |
free (args_info->output_arg); /* free previous string */ |
654 |
|
args_info->output_arg = gengetopt_strdup (optarg); |
655 |
+ |
if (args_info->output_orig) |
656 |
+ |
free (args_info->output_orig); /* free previous string */ |
657 |
+ |
args_info->output_orig = gengetopt_strdup (optarg); |
658 |
|
break; |
659 |
|
|
660 |
|
case 'n': /* process every n frame. */ |
661 |
< |
if (args_info->step_given) |
661 |
> |
if (local_args_info.step_given) |
662 |
|
{ |
663 |
< |
fprintf (stderr, "%s: `--step' (`-n') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
664 |
< |
clear_args (); |
187 |
< |
exit (EXIT_FAILURE); |
663 |
> |
fprintf (stderr, "%s: `--step' (`-n') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
664 |
> |
goto failure; |
665 |
|
} |
666 |
+ |
if (args_info->step_given && ! override) |
667 |
+ |
continue; |
668 |
+ |
local_args_info.step_given = 1; |
669 |
|
args_info->step_given = 1; |
670 |
< |
args_info->step_arg = strtol (optarg,&stop_char,0); |
670 |
> |
args_info->step_arg = strtol (optarg, &stop_char, 0); |
671 |
> |
if (!(stop_char && *stop_char == '\0')) { |
672 |
> |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
673 |
> |
goto failure; |
674 |
> |
} |
675 |
> |
if (args_info->step_orig) |
676 |
> |
free (args_info->step_orig); /* free previous string */ |
677 |
> |
args_info->step_orig = gengetopt_strdup (optarg); |
678 |
|
break; |
679 |
|
|
680 |
|
case 'r': /* number of bins for distance. */ |
681 |
< |
if (args_info->nrbins_given) |
681 |
> |
if (local_args_info.nrbins_given) |
682 |
|
{ |
683 |
< |
fprintf (stderr, "%s: `--nrbins' (`-r') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
684 |
< |
clear_args (); |
198 |
< |
exit (EXIT_FAILURE); |
683 |
> |
fprintf (stderr, "%s: `--nrbins' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
684 |
> |
goto failure; |
685 |
|
} |
686 |
+ |
if (args_info->nrbins_given && ! override) |
687 |
+ |
continue; |
688 |
+ |
local_args_info.nrbins_given = 1; |
689 |
|
args_info->nrbins_given = 1; |
690 |
< |
args_info->nrbins_arg = strtol (optarg,&stop_char,0); |
690 |
> |
args_info->nrbins_arg = strtol (optarg, &stop_char, 0); |
691 |
> |
if (!(stop_char && *stop_char == '\0')) { |
692 |
> |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
693 |
> |
goto failure; |
694 |
> |
} |
695 |
> |
if (args_info->nrbins_orig) |
696 |
> |
free (args_info->nrbins_orig); /* free previous string */ |
697 |
> |
args_info->nrbins_orig = gengetopt_strdup (optarg); |
698 |
|
break; |
699 |
|
|
700 |
+ |
case 'x': /* number of bins in x axis. */ |
701 |
+ |
if (local_args_info.nbins_x_given) |
702 |
+ |
{ |
703 |
+ |
fprintf (stderr, "%s: `--nbins_x' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
704 |
+ |
goto failure; |
705 |
+ |
} |
706 |
+ |
if (args_info->nbins_x_given && ! override) |
707 |
+ |
continue; |
708 |
+ |
local_args_info.nbins_x_given = 1; |
709 |
+ |
args_info->nbins_x_given = 1; |
710 |
+ |
args_info->nbins_x_arg = strtol (optarg, &stop_char, 0); |
711 |
+ |
if (!(stop_char && *stop_char == '\0')) { |
712 |
+ |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
713 |
+ |
goto failure; |
714 |
+ |
} |
715 |
+ |
if (args_info->nbins_x_orig) |
716 |
+ |
free (args_info->nbins_x_orig); /* free previous string */ |
717 |
+ |
args_info->nbins_x_orig = gengetopt_strdup (optarg); |
718 |
+ |
break; |
719 |
+ |
|
720 |
+ |
case 'y': /* number of bins in y axis. */ |
721 |
+ |
if (local_args_info.nbins_y_given) |
722 |
+ |
{ |
723 |
+ |
fprintf (stderr, "%s: `--nbins_y' (`-r') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
724 |
+ |
goto failure; |
725 |
+ |
} |
726 |
+ |
if (args_info->nbins_y_given && ! override) |
727 |
+ |
continue; |
728 |
+ |
local_args_info.nbins_y_given = 1; |
729 |
+ |
args_info->nbins_y_given = 1; |
730 |
+ |
args_info->nbins_y_arg = strtol (optarg, &stop_char, 0); |
731 |
+ |
if (!(stop_char && *stop_char == '\0')) { |
732 |
+ |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
733 |
+ |
goto failure; |
734 |
+ |
} |
735 |
+ |
if (args_info->nbins_y_orig) |
736 |
+ |
free (args_info->nbins_y_orig); /* free previous string */ |
737 |
+ |
args_info->nbins_y_orig = gengetopt_strdup (optarg); |
738 |
+ |
break; |
739 |
+ |
|
740 |
|
case 'a': /* number of bins for cos(angle). */ |
741 |
< |
if (args_info->nanglebins_given) |
741 |
> |
if (local_args_info.nanglebins_given) |
742 |
|
{ |
743 |
< |
fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
744 |
< |
clear_args (); |
209 |
< |
exit (EXIT_FAILURE); |
743 |
> |
fprintf (stderr, "%s: `--nanglebins' (`-a') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
744 |
> |
goto failure; |
745 |
|
} |
746 |
+ |
if (args_info->nanglebins_given && ! override) |
747 |
+ |
continue; |
748 |
+ |
local_args_info.nanglebins_given = 1; |
749 |
|
args_info->nanglebins_given = 1; |
750 |
< |
args_info->nanglebins_arg = strtol (optarg,&stop_char,0); |
750 |
> |
args_info->nanglebins_arg = strtol (optarg, &stop_char, 0); |
751 |
> |
if (!(stop_char && *stop_char == '\0')) { |
752 |
> |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
753 |
> |
goto failure; |
754 |
> |
} |
755 |
> |
if (args_info->nanglebins_orig) |
756 |
> |
free (args_info->nanglebins_orig); /* free previous string */ |
757 |
> |
args_info->nanglebins_orig = gengetopt_strdup (optarg); |
758 |
|
break; |
759 |
|
|
760 |
|
case 'l': /* maximum length (Defaults to 1/2 smallest length of first frame). */ |
761 |
< |
if (args_info->length_given) |
761 |
> |
if (local_args_info.length_given) |
762 |
|
{ |
763 |
< |
fprintf (stderr, "%s: `--length' (`-l') option given more than once\n", CMDLINE_PARSER_PACKAGE); |
764 |
< |
clear_args (); |
220 |
< |
exit (EXIT_FAILURE); |
763 |
> |
fprintf (stderr, "%s: `--length' (`-l') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
764 |
> |
goto failure; |
765 |
|
} |
766 |
+ |
if (args_info->length_given && ! override) |
767 |
+ |
continue; |
768 |
+ |
local_args_info.length_given = 1; |
769 |
|
args_info->length_given = 1; |
770 |
< |
args_info->length_arg = strtod (optarg, NULL); |
770 |
> |
args_info->length_arg = strtod (optarg, &stop_char); |
771 |
> |
if (!(stop_char && *stop_char == '\0')) { |
772 |
> |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
773 |
> |
goto failure; |
774 |
> |
} |
775 |
> |
if (args_info->length_orig) |
776 |
> |
free (args_info->length_orig); /* free previous string */ |
777 |
> |
args_info->length_orig = gengetopt_strdup (optarg); |
778 |
|
break; |
779 |
|
|
780 |
+ |
case 'z': /* Where to set the zero for the slab_density calculation. */ |
781 |
+ |
if (local_args_info.zoffset_given) |
782 |
+ |
{ |
783 |
+ |
fprintf (stderr, "%s: `--zoffset' (`-z') option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
784 |
+ |
goto failure; |
785 |
+ |
} |
786 |
+ |
if (args_info->zoffset_given && ! override) |
787 |
+ |
continue; |
788 |
+ |
local_args_info.zoffset_given = 1; |
789 |
+ |
args_info->zoffset_given = 1; |
790 |
+ |
args_info->zoffset_arg = strtod (optarg, &stop_char); |
791 |
+ |
if (!(stop_char && *stop_char == '\0')) { |
792 |
+ |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
793 |
+ |
goto failure; |
794 |
+ |
} |
795 |
+ |
if (args_info->zoffset_orig) |
796 |
+ |
free (args_info->zoffset_orig); /* free previous string */ |
797 |
+ |
args_info->zoffset_orig = gengetopt_strdup (optarg); |
798 |
+ |
break; |
799 |
|
|
800 |
+ |
|
801 |
|
case 0: /* Long option with no short option */ |
802 |
< |
/* select first stuntdouble set. */ |
802 |
> |
/* select the first stuntdouble set. */ |
803 |
|
if (strcmp (long_options[option_index].name, "sele1") == 0) |
804 |
|
{ |
805 |
< |
if (args_info->sele1_given) |
805 |
> |
if (local_args_info.sele1_given) |
806 |
|
{ |
807 |
< |
fprintf (stderr, "%s: `--sele1' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
808 |
< |
clear_args (); |
235 |
< |
exit (EXIT_FAILURE); |
807 |
> |
fprintf (stderr, "%s: `--sele1' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
808 |
> |
goto failure; |
809 |
|
} |
810 |
+ |
if (args_info->sele1_given && ! override) |
811 |
+ |
continue; |
812 |
+ |
local_args_info.sele1_given = 1; |
813 |
|
args_info->sele1_given = 1; |
814 |
+ |
if (args_info->sele1_arg) |
815 |
+ |
free (args_info->sele1_arg); /* free previous string */ |
816 |
|
args_info->sele1_arg = gengetopt_strdup (optarg); |
817 |
< |
break; |
817 |
> |
if (args_info->sele1_orig) |
818 |
> |
free (args_info->sele1_orig); /* free previous string */ |
819 |
> |
args_info->sele1_orig = gengetopt_strdup (optarg); |
820 |
|
} |
821 |
< |
|
242 |
< |
/* select second stuntdouble set. */ |
821 |
> |
/* select the second stuntdouble set. */ |
822 |
|
else if (strcmp (long_options[option_index].name, "sele2") == 0) |
823 |
|
{ |
824 |
< |
if (args_info->sele2_given) |
824 |
> |
if (local_args_info.sele2_given) |
825 |
|
{ |
826 |
< |
fprintf (stderr, "%s: `--sele2' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
827 |
< |
clear_args (); |
249 |
< |
exit (EXIT_FAILURE); |
826 |
> |
fprintf (stderr, "%s: `--sele2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
827 |
> |
goto failure; |
828 |
|
} |
829 |
+ |
if (args_info->sele2_given && ! override) |
830 |
+ |
continue; |
831 |
+ |
local_args_info.sele2_given = 1; |
832 |
|
args_info->sele2_given = 1; |
833 |
+ |
if (args_info->sele2_arg) |
834 |
+ |
free (args_info->sele2_arg); /* free previous string */ |
835 |
|
args_info->sele2_arg = gengetopt_strdup (optarg); |
836 |
< |
break; |
836 |
> |
if (args_info->sele2_orig) |
837 |
> |
free (args_info->sele2_orig); /* free previous string */ |
838 |
> |
args_info->sele2_orig = gengetopt_strdup (optarg); |
839 |
|
} |
840 |
< |
|
840 |
> |
/* select the third stuntdouble set. */ |
841 |
> |
else if (strcmp (long_options[option_index].name, "sele3") == 0) |
842 |
> |
{ |
843 |
> |
if (local_args_info.sele3_given) |
844 |
> |
{ |
845 |
> |
fprintf (stderr, "%s: `--sele3' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
846 |
> |
goto failure; |
847 |
> |
} |
848 |
> |
if (args_info->sele3_given && ! override) |
849 |
> |
continue; |
850 |
> |
local_args_info.sele3_given = 1; |
851 |
> |
args_info->sele3_given = 1; |
852 |
> |
if (args_info->sele3_arg) |
853 |
> |
free (args_info->sele3_arg); /* free previous string */ |
854 |
> |
args_info->sele3_arg = gengetopt_strdup (optarg); |
855 |
> |
if (args_info->sele3_orig) |
856 |
> |
free (args_info->sele3_orig); /* free previous string */ |
857 |
> |
args_info->sele3_orig = gengetopt_strdup (optarg); |
858 |
> |
} |
859 |
|
/* select reference (use and only use with --gxyz). */ |
860 |
|
else if (strcmp (long_options[option_index].name, "refsele") == 0) |
861 |
|
{ |
862 |
< |
if (args_info->refsele_given) |
862 |
> |
if (local_args_info.refsele_given) |
863 |
|
{ |
864 |
< |
fprintf (stderr, "%s: `--refsele' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
865 |
< |
clear_args (); |
263 |
< |
exit (EXIT_FAILURE); |
864 |
> |
fprintf (stderr, "%s: `--refsele' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
865 |
> |
goto failure; |
866 |
|
} |
867 |
+ |
if (args_info->refsele_given && ! override) |
868 |
+ |
continue; |
869 |
+ |
local_args_info.refsele_given = 1; |
870 |
|
args_info->refsele_given = 1; |
871 |
+ |
if (args_info->refsele_arg) |
872 |
+ |
free (args_info->refsele_arg); /* free previous string */ |
873 |
|
args_info->refsele_arg = gengetopt_strdup (optarg); |
874 |
< |
break; |
874 |
> |
if (args_info->refsele_orig) |
875 |
> |
free (args_info->refsele_orig); /* free previous string */ |
876 |
> |
args_info->refsele_orig = gengetopt_strdup (optarg); |
877 |
|
} |
878 |
< |
|
879 |
< |
/* g(r). */ |
271 |
< |
else if (strcmp (long_options[option_index].name, "gofr") == 0) |
878 |
> |
/* molecule name. */ |
879 |
> |
else if (strcmp (long_options[option_index].name, "molname") == 0) |
880 |
|
{ |
881 |
< |
if (args_info->gofr_given) |
881 |
> |
if (local_args_info.molname_given) |
882 |
|
{ |
883 |
< |
fprintf (stderr, "%s: `--gofr' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
884 |
< |
clear_args (); |
277 |
< |
exit (EXIT_FAILURE); |
883 |
> |
fprintf (stderr, "%s: `--molname' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
884 |
> |
goto failure; |
885 |
|
} |
886 |
< |
args_info->gofr_given = 1; staticProps_group_counter += 1; |
887 |
< |
|
886 |
> |
if (args_info->molname_given && ! override) |
887 |
> |
continue; |
888 |
> |
local_args_info.molname_given = 1; |
889 |
> |
args_info->molname_given = 1; |
890 |
> |
if (args_info->molname_arg) |
891 |
> |
free (args_info->molname_arg); /* free previous string */ |
892 |
> |
args_info->molname_arg = gengetopt_strdup (optarg); |
893 |
> |
if (args_info->molname_orig) |
894 |
> |
free (args_info->molname_orig); /* free previous string */ |
895 |
> |
args_info->molname_orig = gengetopt_strdup (optarg); |
896 |
> |
} |
897 |
> |
/* begin interanl index. */ |
898 |
> |
else if (strcmp (long_options[option_index].name, "begin") == 0) |
899 |
> |
{ |
900 |
> |
if (local_args_info.begin_given) |
901 |
> |
{ |
902 |
> |
fprintf (stderr, "%s: `--begin' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
903 |
> |
goto failure; |
904 |
> |
} |
905 |
> |
if (args_info->begin_given && ! override) |
906 |
> |
continue; |
907 |
> |
local_args_info.begin_given = 1; |
908 |
> |
args_info->begin_given = 1; |
909 |
> |
args_info->begin_arg = strtol (optarg, &stop_char, 0); |
910 |
> |
if (!(stop_char && *stop_char == '\0')) { |
911 |
> |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
912 |
> |
goto failure; |
913 |
> |
} |
914 |
> |
if (args_info->begin_orig) |
915 |
> |
free (args_info->begin_orig); /* free previous string */ |
916 |
> |
args_info->begin_orig = gengetopt_strdup (optarg); |
917 |
> |
} |
918 |
> |
/* end internal index. */ |
919 |
> |
else if (strcmp (long_options[option_index].name, "end") == 0) |
920 |
> |
{ |
921 |
> |
if (local_args_info.end_given) |
922 |
> |
{ |
923 |
> |
fprintf (stderr, "%s: `--end' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
924 |
> |
goto failure; |
925 |
> |
} |
926 |
> |
if (args_info->end_given && ! override) |
927 |
> |
continue; |
928 |
> |
local_args_info.end_given = 1; |
929 |
> |
args_info->end_given = 1; |
930 |
> |
args_info->end_arg = strtol (optarg, &stop_char, 0); |
931 |
> |
if (!(stop_char && *stop_char == '\0')) { |
932 |
> |
fprintf(stderr, "%s: invalid numeric value: %s\n", argv[0], optarg); |
933 |
> |
goto failure; |
934 |
> |
} |
935 |
> |
if (args_info->end_orig) |
936 |
> |
free (args_info->end_orig); /* free previous string */ |
937 |
> |
args_info->end_orig = gengetopt_strdup (optarg); |
938 |
> |
} |
939 |
> |
/* g(r). */ |
940 |
> |
else if (strcmp (long_options[option_index].name, "gofr") == 0) |
941 |
> |
{ |
942 |
> |
if (local_args_info.gofr_given) |
943 |
> |
{ |
944 |
> |
fprintf (stderr, "%s: `--gofr' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
945 |
> |
goto failure; |
946 |
> |
} |
947 |
> |
if (args_info->gofr_given && ! override) |
948 |
> |
continue; |
949 |
> |
local_args_info.gofr_given = 1; |
950 |
> |
args_info->gofr_given = 1; |
951 |
> |
if (args_info->staticProps_group_counter && override) |
952 |
> |
reset_group_staticProps (args_info); |
953 |
> |
args_info->staticProps_group_counter += 1; |
954 |
|
break; |
955 |
|
} |
283 |
– |
|
956 |
|
/* g(r, cos(theta)). */ |
957 |
|
else if (strcmp (long_options[option_index].name, "r_theta") == 0) |
958 |
|
{ |
959 |
< |
if (args_info->r_theta_given) |
959 |
> |
if (local_args_info.r_theta_given) |
960 |
|
{ |
961 |
< |
fprintf (stderr, "%s: `--r_theta' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
962 |
< |
clear_args (); |
291 |
< |
exit (EXIT_FAILURE); |
961 |
> |
fprintf (stderr, "%s: `--r_theta' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
962 |
> |
goto failure; |
963 |
|
} |
964 |
< |
args_info->r_theta_given = 1; staticProps_group_counter += 1; |
965 |
< |
|
964 |
> |
if (args_info->r_theta_given && ! override) |
965 |
> |
continue; |
966 |
> |
local_args_info.r_theta_given = 1; |
967 |
> |
args_info->r_theta_given = 1; |
968 |
> |
if (args_info->staticProps_group_counter && override) |
969 |
> |
reset_group_staticProps (args_info); |
970 |
> |
args_info->staticProps_group_counter += 1; |
971 |
|
break; |
972 |
|
} |
297 |
– |
|
973 |
|
/* g(r, cos(omega)). */ |
974 |
|
else if (strcmp (long_options[option_index].name, "r_omega") == 0) |
975 |
|
{ |
976 |
< |
if (args_info->r_omega_given) |
976 |
> |
if (local_args_info.r_omega_given) |
977 |
|
{ |
978 |
< |
fprintf (stderr, "%s: `--r_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
979 |
< |
clear_args (); |
305 |
< |
exit (EXIT_FAILURE); |
978 |
> |
fprintf (stderr, "%s: `--r_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
979 |
> |
goto failure; |
980 |
|
} |
981 |
< |
args_info->r_omega_given = 1; staticProps_group_counter += 1; |
982 |
< |
|
981 |
> |
if (args_info->r_omega_given && ! override) |
982 |
> |
continue; |
983 |
> |
local_args_info.r_omega_given = 1; |
984 |
> |
args_info->r_omega_given = 1; |
985 |
> |
if (args_info->staticProps_group_counter && override) |
986 |
> |
reset_group_staticProps (args_info); |
987 |
> |
args_info->staticProps_group_counter += 1; |
988 |
|
break; |
989 |
|
} |
311 |
– |
|
990 |
|
/* g(cos(theta), cos(omega)). */ |
991 |
|
else if (strcmp (long_options[option_index].name, "theta_omega") == 0) |
992 |
|
{ |
993 |
< |
if (args_info->theta_omega_given) |
993 |
> |
if (local_args_info.theta_omega_given) |
994 |
|
{ |
995 |
< |
fprintf (stderr, "%s: `--theta_omega' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
996 |
< |
clear_args (); |
319 |
< |
exit (EXIT_FAILURE); |
995 |
> |
fprintf (stderr, "%s: `--theta_omega' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
996 |
> |
goto failure; |
997 |
|
} |
998 |
< |
args_info->theta_omega_given = 1; staticProps_group_counter += 1; |
999 |
< |
|
998 |
> |
if (args_info->theta_omega_given && ! override) |
999 |
> |
continue; |
1000 |
> |
local_args_info.theta_omega_given = 1; |
1001 |
> |
args_info->theta_omega_given = 1; |
1002 |
> |
if (args_info->staticProps_group_counter && override) |
1003 |
> |
reset_group_staticProps (args_info); |
1004 |
> |
args_info->staticProps_group_counter += 1; |
1005 |
|
break; |
1006 |
|
} |
325 |
– |
|
1007 |
|
/* g(x, y, z). */ |
1008 |
|
else if (strcmp (long_options[option_index].name, "gxyz") == 0) |
1009 |
|
{ |
1010 |
< |
if (args_info->gxyz_given) |
1010 |
> |
if (local_args_info.gxyz_given) |
1011 |
|
{ |
1012 |
< |
fprintf (stderr, "%s: `--gxyz' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
1013 |
< |
clear_args (); |
333 |
< |
exit (EXIT_FAILURE); |
1012 |
> |
fprintf (stderr, "%s: `--gxyz' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1013 |
> |
goto failure; |
1014 |
|
} |
1015 |
< |
args_info->gxyz_given = 1; staticProps_group_counter += 1; |
1016 |
< |
|
1015 |
> |
if (args_info->gxyz_given && ! override) |
1016 |
> |
continue; |
1017 |
> |
local_args_info.gxyz_given = 1; |
1018 |
> |
args_info->gxyz_given = 1; |
1019 |
> |
if (args_info->staticProps_group_counter && override) |
1020 |
> |
reset_group_staticProps (args_info); |
1021 |
> |
args_info->staticProps_group_counter += 1; |
1022 |
|
break; |
1023 |
|
} |
1024 |
< |
|
340 |
< |
/* p2 order parameter. */ |
1024 |
> |
/* p2 order parameter (--sele1 and --sele2 must be specified). */ |
1025 |
|
else if (strcmp (long_options[option_index].name, "p2") == 0) |
1026 |
|
{ |
1027 |
< |
if (args_info->p2_given) |
1027 |
> |
if (local_args_info.p2_given) |
1028 |
|
{ |
1029 |
< |
fprintf (stderr, "%s: `--p2' option given more than once\n", CMDLINE_PARSER_PACKAGE); |
1030 |
< |
clear_args (); |
347 |
< |
exit (EXIT_FAILURE); |
1029 |
> |
fprintf (stderr, "%s: `--p2' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1030 |
> |
goto failure; |
1031 |
|
} |
1032 |
< |
args_info->p2_given = 1; staticProps_group_counter += 1; |
1033 |
< |
|
1032 |
> |
if (args_info->p2_given && ! override) |
1033 |
> |
continue; |
1034 |
> |
local_args_info.p2_given = 1; |
1035 |
> |
args_info->p2_given = 1; |
1036 |
> |
if (args_info->staticProps_group_counter && override) |
1037 |
> |
reset_group_staticProps (args_info); |
1038 |
> |
args_info->staticProps_group_counter += 1; |
1039 |
|
break; |
1040 |
|
} |
1041 |
+ |
/* scd order parameter(either --sele1, --sele2, --sele3 are specified or --molname, --begin, --end are specified). */ |
1042 |
+ |
else if (strcmp (long_options[option_index].name, "scd") == 0) |
1043 |
+ |
{ |
1044 |
+ |
if (local_args_info.scd_given) |
1045 |
+ |
{ |
1046 |
+ |
fprintf (stderr, "%s: `--scd' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1047 |
+ |
goto failure; |
1048 |
+ |
} |
1049 |
+ |
if (args_info->scd_given && ! override) |
1050 |
+ |
continue; |
1051 |
+ |
local_args_info.scd_given = 1; |
1052 |
+ |
args_info->scd_given = 1; |
1053 |
+ |
if (args_info->staticProps_group_counter && override) |
1054 |
+ |
reset_group_staticProps (args_info); |
1055 |
+ |
args_info->staticProps_group_counter += 1; |
1056 |
+ |
break; |
1057 |
+ |
} |
1058 |
+ |
/* density plot (--sele1 must be specified). */ |
1059 |
+ |
else if (strcmp (long_options[option_index].name, "density") == 0) |
1060 |
+ |
{ |
1061 |
+ |
if (local_args_info.density_given) |
1062 |
+ |
{ |
1063 |
+ |
fprintf (stderr, "%s: `--density' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1064 |
+ |
goto failure; |
1065 |
+ |
} |
1066 |
+ |
if (args_info->density_given && ! override) |
1067 |
+ |
continue; |
1068 |
+ |
local_args_info.density_given = 1; |
1069 |
+ |
args_info->density_given = 1; |
1070 |
+ |
if (args_info->staticProps_group_counter && override) |
1071 |
+ |
reset_group_staticProps (args_info); |
1072 |
+ |
args_info->staticProps_group_counter += 1; |
1073 |
+ |
break; |
1074 |
+ |
} |
1075 |
+ |
/* slab density (--sele1 must be specified). */ |
1076 |
+ |
else if (strcmp (long_options[option_index].name, "slab_density") == 0) |
1077 |
+ |
{ |
1078 |
+ |
if (local_args_info.slab_density_given) |
1079 |
+ |
{ |
1080 |
+ |
fprintf (stderr, "%s: `--slab_density' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1081 |
+ |
goto failure; |
1082 |
+ |
} |
1083 |
+ |
if (args_info->slab_density_given && ! override) |
1084 |
+ |
continue; |
1085 |
+ |
local_args_info.slab_density_given = 1; |
1086 |
+ |
args_info->slab_density_given = 1; |
1087 |
+ |
if (args_info->staticProps_group_counter && override) |
1088 |
+ |
reset_group_staticProps (args_info); |
1089 |
+ |
args_info->staticProps_group_counter += 1; |
1090 |
+ |
break; |
1091 |
+ |
} |
1092 |
+ |
/* hxy (--sele1 must be specified). */ |
1093 |
+ |
else if (strcmp (long_options[option_index].name, "hxy") == 0) |
1094 |
+ |
{ |
1095 |
+ |
if (local_args_info.hxy_given) |
1096 |
+ |
{ |
1097 |
+ |
fprintf (stderr, "%s: `--hxy' option given more than once%s\n", argv[0], (additional_error ? additional_error : "")); |
1098 |
+ |
goto failure; |
1099 |
+ |
} |
1100 |
+ |
if (args_info->hxy_given && ! override) |
1101 |
+ |
continue; |
1102 |
+ |
local_args_info.hxy_given = 1; |
1103 |
+ |
args_info->hxy_given = 1; |
1104 |
+ |
if (args_info->staticProps_group_counter && override) |
1105 |
+ |
reset_group_staticProps (args_info); |
1106 |
+ |
args_info->staticProps_group_counter += 1; |
1107 |
+ |
break; |
1108 |
+ |
} |
1109 |
|
|
1110 |
< |
|
1110 |
> |
break; |
1111 |
|
case '?': /* Invalid option. */ |
1112 |
|
/* `getopt_long' already printed an error message. */ |
1113 |
< |
exit (EXIT_FAILURE); |
1113 |
> |
goto failure; |
1114 |
|
|
1115 |
|
default: /* bug: option not considered. */ |
1116 |
< |
fprintf (stderr, "%s: option unknown: %c\n", CMDLINE_PARSER_PACKAGE, c); |
1116 |
> |
fprintf (stderr, "%s: option unknown: %c%s\n", CMDLINE_PARSER_PACKAGE, c, (additional_error ? additional_error : "")); |
1117 |
|
abort (); |
1118 |
|
} /* switch */ |
1119 |
|
} /* while */ |
1120 |
|
|
1121 |
< |
if ( staticProps_group_counter != 1) |
1121 |
> |
if (args_info->staticProps_group_counter > 1) |
1122 |
|
{ |
1123 |
< |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required\n", CMDLINE_PARSER_PACKAGE, staticProps_group_counter); |
1124 |
< |
missing_required_options = 1; |
1123 |
> |
fprintf (stderr, "%s: %d options of group staticProps were given. One is required.%s\n", argv[0], args_info->staticProps_group_counter, (additional_error ? additional_error : "")); |
1124 |
> |
error = 1; |
1125 |
|
} |
1126 |
|
|
1127 |
|
|
1128 |
< |
if (! args_info->input_given) |
1128 |
> |
|
1129 |
> |
if (check_required) |
1130 |
|
{ |
1131 |
< |
fprintf (stderr, "%s: '--input' ('-i') option required\n", CMDLINE_PARSER_PACKAGE); |
375 |
< |
missing_required_options = 1; |
1131 |
> |
error += cmdline_parser_required2 (args_info, argv[0], additional_error); |
1132 |
|
} |
377 |
– |
if ( missing_required_options ) |
378 |
– |
exit (EXIT_FAILURE); |
1133 |
|
|
1134 |
+ |
cmdline_parser_release (&local_args_info); |
1135 |
+ |
|
1136 |
+ |
if ( error ) |
1137 |
+ |
return (EXIT_FAILURE); |
1138 |
+ |
|
1139 |
|
return 0; |
1140 |
+ |
|
1141 |
+ |
failure: |
1142 |
+ |
|
1143 |
+ |
cmdline_parser_release (&local_args_info); |
1144 |
+ |
return (EXIT_FAILURE); |
1145 |
|
} |