| 2020 | }; |
| 2021 | |
| 2022 | float cbm_sem_doc_section_p(cbm_sem_doc_format_t fmt, cbm_sem_diag_family_t fam, |
| 2023 | cbm_sem_doc_kind_t kind, cbm_sem_doc_pos_t pos, float score) { |
| 2024 | bool fitted = fmt == CBM_SEM_DOC_FMT_MARKDOWN && (int)fam > 0 && fam < CBM_SEM_DIAG_COUNT && |
| 2025 | SEM_DOC_P_MD_DIAGRAM[fam].fitted; |
| 2026 | bool home = pos == CBM_SEM_DOC_POS_GLOBAL || pos == CBM_SEM_DOC_POS_LOCAL; |
| 2027 | if (!fitted || !((kind == CBM_SEM_DOC_KIND_FUNCTION && home) || |
| 2028 | (kind == CBM_SEM_DOC_KIND_LOCAL && pos == CBM_SEM_DOC_POS_LOCAL))) { |
| 2029 | return cbm_sem_doc_calibrated_p(fmt, kind, pos, score); |
| 2030 | } |
| 2031 | size_t band = 0; |
| 2032 | while (band < SEM_DOC_P_NBANDS - 1 && score >= SEM_DOC_P_CUTS[band]) { |
| 2033 | band++; |
| 2034 | } |
| 2035 | if (band == 0) { |
| 2036 | return 0.0F; /* below CBM_SEM_DOC_MIN_SCORE: never measured, nothing stored */ |
| 2037 | } |
| 2038 | return kind == CBM_SEM_DOC_KIND_LOCAL ? SEM_DOC_P_MD_DIAGRAM[fam].local |
| 2039 | : SEM_DOC_P_MD_DIAGRAM[fam].function[band]; |
| 2040 | } |
| 2041 | |
| 2042 | float cbm_sem_combined_score(const cbm_sem_func_t *a, const cbm_sem_func_t *b, |
| 2043 | const cbm_sem_config_t *cfg) { |