From 252e2e13bded09fd3cd0fd3a1112605b2b97458a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 5 Feb 2021 16:32:36 +0100 Subject: Move fom_type_from_string out of API If it's needed, we'll replace it with a better piece of API (...which doesn't abort the program in the event of a typo!) --- libcrystfel/src/fom.c | 19 ------------------- libcrystfel/src/fom.h | 2 -- src/compare_hkl.c | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/libcrystfel/src/fom.c b/libcrystfel/src/fom.c index c3ac934e..2d3623ea 100644 --- a/libcrystfel/src/fom.c +++ b/libcrystfel/src/fom.c @@ -70,25 +70,6 @@ struct fom_context long int *possible; }; -enum fom_type fom_type_from_string(const char *s) -{ - if ( strcasecmp(s, "r1i") == 0 ) return FOM_R1I; - if ( strcasecmp(s, "r1f") == 0 ) return FOM_R1F; - if ( strcasecmp(s, "r2") == 0 ) return FOM_R2; - if ( strcasecmp(s, "rsplit") == 0 ) return FOM_RSPLIT; - if ( strcasecmp(s, "cc") == 0 ) return FOM_CC; - if ( strcasecmp(s, "ccstar") == 0 ) return FOM_CCSTAR; - if ( strcasecmp(s, "ccano") == 0 ) return FOM_CCANO; - if ( strcasecmp(s, "crdano") == 0 ) return FOM_CRDANO; - if ( strcasecmp(s, "rano") == 0 ) return FOM_RANO; - if ( strcasecmp(s, "rano/rsplit") == 0 ) return FOM_RANORSPLIT; - if ( strcasecmp(s, "d1sig") == 0 ) return FOM_D1SIG; - if ( strcasecmp(s, "d2sig") == 0 ) return FOM_D2SIG; - - ERROR("Unknown figure of merit '%s'.\n", s); - exit(1); -} - static struct fom_context *init_fom(enum fom_type fom, int nmax, int nshells) { diff --git a/libcrystfel/src/fom.h b/libcrystfel/src/fom.h index 565c9b80..fae8748d 100644 --- a/libcrystfel/src/fom.h +++ b/libcrystfel/src/fom.h @@ -127,6 +127,4 @@ extern int fom_shell_num_reflections(struct fom_context *fctx, int i); extern int fom_overall_num_possible(struct fom_context *fctx); extern int fom_shell_num_possible(struct fom_context *fctx, int i); -extern enum fom_type fom_type_from_string(const char *s); - #endif /* FOM */ diff --git a/src/compare_hkl.c b/src/compare_hkl.c index cb5bee38..a065713f 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -81,6 +81,25 @@ static void show_help(const char *s) } +static enum fom_type fom_type_from_string(const char *s) +{ + if ( strcasecmp(s, "r1i") == 0 ) return FOM_R1I; + if ( strcasecmp(s, "r1f") == 0 ) return FOM_R1F; + if ( strcasecmp(s, "r2") == 0 ) return FOM_R2; + if ( strcasecmp(s, "rsplit") == 0 ) return FOM_RSPLIT; + if ( strcasecmp(s, "cc") == 0 ) return FOM_CC; + if ( strcasecmp(s, "ccstar") == 0 ) return FOM_CCSTAR; + if ( strcasecmp(s, "ccano") == 0 ) return FOM_CCANO; + if ( strcasecmp(s, "crdano") == 0 ) return FOM_CRDANO; + if ( strcasecmp(s, "rano") == 0 ) return FOM_RANO; + if ( strcasecmp(s, "rano/rsplit") == 0 ) return FOM_RANORSPLIT; + if ( strcasecmp(s, "d1sig") == 0 ) return FOM_D1SIG; + if ( strcasecmp(s, "d2sig") == 0 ) return FOM_D2SIG; + + ERROR("Unknown figure of merit '%s'.\n", s); + exit(1); +} + static void do_fom(RefList *list1, RefList *list2, UnitCell *cell, double rmin, double rmax, enum fom_type fom, int config_unity, int nshells, const char *filename, -- cgit v1.2.3