commit 335795f1211192c80857c670d6d074c4cdcf6843
parent b5ccbeaad89fc7f9df9f091b82e144e2bd0c2729
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 9 Apr 2020 13:21:01 +0200
Fix -D option compatibility with other options
Diffstat:
3 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/doc/stardis.1.txt.in b/doc/stardis.1.txt.in
@@ -190,9 +190,10 @@ options that write to _standard output_ (-R, -g, -D, -h, -v).
Possible values are *error* (write paths ending in error), *success*
(write successful paths), and *all* (write all paths).
+
-This option can only be used in conjuction with an option that runs a
-computation (-p, -P, -m, -s, -R, -S, -F) and cannot be used in conjunction
-with some other options that write to _standard output_ (-R, -d, -g, -h, -v).
+This option can only be used in conjuction with options that compute a simple
+Monte-Carlo result (-p, -P, -m, -s, -S, -F) and cannot be used in conjunction
+with some other options that write additional information to _standard output_
+(-R, -d, -g, -h, -v).
**-f** _factor_::
Rescale the geometry by the given *factor* before sending it to the solver,
diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c
@@ -528,22 +528,6 @@ re_switch:
opt, optarg);
goto error;
}
- if(args->mode & USE_STDOUT_MODES) {
- res = RES_BAD_ARG;
- print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_PATHS);
- logger_print(args->logger, LOG_ERROR,
- "Option -%c cannot be used in conjunction with other dump options (%s).\n",
- (char)opt, buf);
- goto error;
- }
- if(!(args->mode & COMPUTE_MODES)) {
- res = RES_BAD_ARG;
- print_multiple_modes(buf, sizeof(buf), COMPUTE_MODES, 0);
- logger_print(args->logger, LOG_ERROR,
- "Option -%c can only be used in conjunction with a compute option (%s).\n",
- (char)opt, buf);
- goto error;
- }
args->mode |= DUMP_PATHS;
break;
@@ -832,6 +816,25 @@ re_switch:
goto error;
}
+ if(args->mode |= DUMP_PATHS) {
+ if(args->mode & USE_STDOUT_MODES) {
+ res = RES_BAD_ARG;
+ print_multiple_modes(buf, sizeof(buf), USE_STDOUT_MODES, DUMP_PATHS);
+ logger_print(args->logger, LOG_ERROR,
+ "Option -%c cannot be used in conjunction with other dump options (%s).\n",
+ (char)opt, buf);
+ goto error;
+ }
+ if(!(args->mode & SINGLE_RESULT_MODES)) {
+ res = RES_BAD_ARG;
+ print_multiple_modes(buf, sizeof(buf), SINGLE_RESULT_MODES, 0);
+ logger_print(args->logger, LOG_ERROR,
+ "Option -%c can only be used in conjunction with option producing a single result (%s).\n",
+ mode_option(DUMP_PATHS), buf);
+ goto error;
+ }
+ }
+
end:
return res;
error:
diff --git a/src/stardis-parsing.h b/src/stardis-parsing.h
@@ -63,6 +63,8 @@ enum stardis_mode {
REGION_COMPUTE_MODES = SURFACE_COMPUTE_MODES | MEDIUM_COMPUTE,
+ SINGLE_RESULT_MODES = GREEN_COMPATIBLE_MODES | SURFACE_COMPUTE_MODES,
+
COMPUTE_MODES = GREEN_COMPATIBLE_MODES | IR_COMPUTE | SURFACE_COMPUTE_MODES,
EXCLUSIVE_MODES = COMPUTE_MODES,