Commit 0559d06f authored by Thomas White's avatar Thomas White
Browse files

Tidy up switch statements

parent e5adbd4b
......@@ -67,34 +67,28 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "ho:a:b:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 'o' : {
case 'o' :
outfile = strdup(optarg);
break;
}
case 'a' : {
case 'a' :
afile = strdup(optarg);
break;
}
case 'b' : {
case 'b' :
bfile = strdup(optarg);
break;
}
case 0 : {
case 0 :
break;
}
default : {
default :
return 1;
}
}
}
......
......@@ -136,39 +136,32 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "ht:o:i:p:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 't' : {
case 't' :
template = strdup(optarg);
break;
}
case 'o' : {
case 'o' :
output = strdup(optarg);
break;
}
case 'i' : {
case 'i' :
input = strdup(optarg);
break;
}
case 'p' : {
case 'p' :
filename = strdup(optarg);
break;
}
case 0 : {
case 0 :
break;
}
default : {
default :
return 1;
}
}
}
......
......@@ -101,41 +101,35 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hp:b:i:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 'p' : {
case 'p' :
peaks = strdup(optarg);
break;
}
case 'i' : {
case 'i' :
boost = atoi(optarg);
if ( boost < 1 ) {
ERROR("Intensity boost must be a positive"
" integer.\n");
}
break;
}
case 'b' : {
case 'b' :
binning = atoi(optarg);
if ( boost < 1 ) {
ERROR("Binning must be a positive integer.\n");
}
break;
}
case 0 : {
case 0 :
break;
}
default : {
default :
return 1;
}
}
}
......
......@@ -457,54 +457,44 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 'i' : {
case 'i' :
filename = strdup(optarg);
break;
}
case 'z' : {
case 'z' :
indm_str = strdup(optarg);
break;
}
case 'q' : {
case 'q' :
intfile = strdup(optarg);
break;
}
case 'p' : {
case 'p' :
pdb = strdup(optarg);
break;
}
case 'x' : {
case 'x' :
prefix = strdup(optarg);
break;
}
case 'j' : {
case 'j' :
nthreads = atoi(optarg);
break;
}
case 'g' : {
case 'g' :
geometry = strdup(optarg);
break;
}
case 0 : {
case 0 :
break;
}
default : {
default :
return 1;
}
}
}
......
......@@ -222,59 +222,48 @@ int main(int argc, char *argv[])
longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 'r' : {
case 'r' :
config_randomquat = 1;
break;
}
case 'n' : {
case 'n' :
n_images = atoi(optarg);
break;
}
case 'i' : {
case 'i' :
intfile = strdup(optarg);
break;
}
case 't' : {
case 't' :
grad_str = strdup(optarg);
break;
}
case 'p' : {
case 'p' :
filename = strdup(optarg);
break;
}
case 'o' : {
case 'o' :
outfile = strdup(optarg);
break;
}
case 'w' : {
case 'w' :
powder_fn = strdup(optarg);
break;
}
case 'g' : {
case 'g' :
geometry = strdup(optarg);
break;
}
case 0 : {
case 0 :
break;
}
default : {
default :
return 1;
}
}
}
......
......@@ -62,29 +62,24 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hi:g:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 0 : {
case 0 :
break;
}
case 'i' : {
case 'i' :
filename = strdup(optarg);
break;
}
case 'g' : {
case 'g' :
geometry = strdup(optarg);
break;
}
default : {
default :
return 1;
}
}
}
......
......@@ -272,54 +272,45 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hi:e:ro:p:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 'i' : {
case 'i' :
filename = strdup(optarg);
break;
}
case 'o' : {
case 'o' :
output = strdup(optarg);
break;
}
case 'r' : {
case 'r' :
config_rvsq = 1;
break;
}
case 'e' : {
case 'e' :
config_every = atoi(optarg);
break;
}
case 's' : {
case 's' :
config_stopafter = atoi(optarg);
break;
}
case 'c' : {
case 'c' :
intfile = strdup(optarg);
break;
}
case 'p' : {
case 'p' :
pdb = strdup(optarg);
break;
}
case 0 : {
case 0 :
break;
}
default : {
default :
return 1;
}
}
}
......
......@@ -330,34 +330,27 @@ static void povray_render_animation(UnitCell *cell, double *ref,
s = 6;
}
switch ( s ) {
case 0 : { /* Black to blue */
r = 0.0; g = 0.0; b = p;
break;
}
case 1 : { /* Blue to green */
r = 0.0; g = p; b = 1.0-p;
break;
}
case 2 : { /* Green to red */
r =p; g = 1.0-p; b = 0.0;
break;
}
case 3 : { /* Red to Orange */
r = 1.0; g = 0.5*p; b = 0.0;
break;
}
case 4 : { /* Orange to Yellow */
r = 1.0; g = 0.5 + 0.5*p; b = 0.0;
break;
}
case 5 : { /* Yellow to White */
r = 1.0; g = 1.0; b = 1.0*p;
break;
}
case 6 : { /* Pixel has hit the maximum value */
r = 1.0; g = 1.0; b = 1.0;
break;
}
case 0 : /* Black to blue */
r = 0.0; g = 0.0; b = p;
break;
case 1 : /* Blue to green */
r = 0.0; g = p; b = 1.0-p;
break;
case 2 : /* Green to red */
r =p; g = 1.0-p; b = 0.0;
break;
case 3 : /* Red to Orange */
r = 1.0; g = 0.5*p; b = 0.0;
break;
case 4 : /* Orange to Yellow */
r = 1.0; g = 0.5 + 0.5*p; b = 0.0;
break;
case 5 : /* Yellow to White */
r = 1.0; g = 1.0; b = 1.0*p;
break;
case 6 : /* Pixel has hit the maximum value */
r = 1.0; g = 1.0; b = 1.0;
break;
}
val = max-val;
......@@ -448,24 +441,20 @@ int main(int argc, char *argv[])
while ((c = getopt_long(argc, argv, "hj:", longopts, NULL)) != -1) {
switch (c) {
case 'h' : {
case 'h' :
show_help(argv[0]);
return 0;
}
case 'j' : {
case 'j' :
nproc = atoi(optarg);
break;
}
case 0 : {
case 0 :
break;
}
default : {
default :
return 1;
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment