aboutsummaryrefslogtreecommitdiff
path: root/src/stream.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-16 14:18:02 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:20 +0100
commit14d12aa55a6e342d7a7c83b90e88d68e11be0e7a (patch)
tree875e78ee3c809d6f9b64c2aba5d389f5bede1597 /src/stream.c
parent193c900d095203fb74671abc1e0b52f0b1d6d62a (diff)
--record=peaksifnotindexed option
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/stream.c b/src/stream.c
index 7aaa74fd..545bed43 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -69,6 +69,10 @@ int parse_stream_flags(const char *a)
exclusive("peaks", "peaksifindexed");
return -1;
}
+ if ( ret & STREAM_PEAKS_IF_NOT_INDEXED ) {
+ exclusive("peaks", "peaksifnotindexed");
+ return -1;
+ }
ret |= STREAM_PEAKS;
} else if ( strcmp(flags[i], "peaksifindexed") == 0) {
@@ -76,8 +80,25 @@ int parse_stream_flags(const char *a)
exclusive("peaks", "peaksifindexed");
return -1;
}
+ if ( ret & STREAM_PEAKS_IF_NOT_INDEXED ) {
+ exclusive("peaksifnotindexed",
+ "peaksifindexed");
+ return -1;
+ }
ret |= STREAM_PEAKS_IF_INDEXED;
+ } else if ( strcmp(flags[i], "peaksifnotindexed") == 0) {
+ if ( ret & STREAM_PEAKS ) {
+ exclusive("peaks", "peaksifnotindexed");
+ return -1;
+ }
+ if ( ret & STREAM_PEAKS_IF_INDEXED ) {
+ exclusive("peaksifnotindexed",
+ "peaksifindexed");
+ return -1;
+ }
+ ret |= STREAM_PEAKS_IF_NOT_INDEXED;
+
} else {
ERROR("Unrecognised stream flag '%s'\n", flags[i]);
return 0;
@@ -267,7 +288,9 @@ void write_chunk(FILE *ofh, struct image *i, int f)
J_to_eV(ph_lambda_to_en(i->lambda)));
if ( (f & STREAM_PEAKS)
- || ((f & STREAM_PEAKS_IF_INDEXED) && (i->indexed_cell != NULL)) ) {
+ || ((f & STREAM_PEAKS_IF_INDEXED) && (i->indexed_cell != NULL))
+ || ((f & STREAM_PEAKS_IF_NOT_INDEXED) && (i->indexed_cell == NULL)) )
+ {
fprintf(ofh, "\n");
write_peaks(i, ofh);
}