MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_sem_doc_format

Function cbm_sem_doc_format

src/semantic/semantic.c:1890–1909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1888};
1889
1890cbm_sem_doc_format_t cbm_sem_doc_format(const char *path) {
1891 static const struct {
1892 const char *ext;
1893 cbm_sem_doc_format_t fmt;
1894 } exts[] = {{".md", CBM_SEM_DOC_FMT_MARKDOWN}, {".mdx", CBM_SEM_DOC_FMT_MARKDOWN},
1895 {".markdown", CBM_SEM_DOC_FMT_MARKDOWN}, {".rst", CBM_SEM_DOC_FMT_RST},
1896 {".rest", CBM_SEM_DOC_FMT_RST}, {".txt", CBM_SEM_DOC_FMT_RST},
1897 {".adoc", CBM_SEM_DOC_FMT_ADOC}, {".asciidoc", CBM_SEM_DOC_FMT_ADOC},
1898 {".asc", CBM_SEM_DOC_FMT_ADOC}, {".pdf", CBM_SEM_DOC_FMT_PDF}};
1899 const char *dot = path ? strrchr(path, '.') : NULL;
1900 if (!dot || strchr(dot, '/')) {
1901 return CBM_SEM_DOC_FMT_OTHER;
1902 }
1903 for (size_t i = 0; i < sizeof(exts) / sizeof(exts[0]); i++) {
1904 if (strcasecmp(dot, exts[i].ext) == 0) {
1905 return exts[i].fmt;
1906 }
1907 }
1908 return CBM_SEM_DOC_FMT_OTHER;
1909}
1910
1911double cbm_sem_p_2dp(float p) {
1912 /* 1e-4 on the x100 scale: a float holds 0.325 as 0.32499998..., 1.2e-6

Callers 2

doc_row_addFunction · 0.85
test_semantic.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected