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

Function parse_region

src/pipeline/doc_links_cs.c:1007–1037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1005}
1006
1007static bool parse_region(cs_index_t *ix, cs_file_t *f, char **fld, int n, int *next_region) {
1008 /* R id parent start end name */
1009 if (n != 6 || !fld[5][0]) {
1010 return false; /* the scanner names every region: an empty name would
1011 * nest one without deepening the namespace */
1012 }
1013 int id = field_index(fld[1], f->nregions);
1014 int parent = field_index(fld[2], f->nregions);
1015 if (id != *next_region || parent < 0 || parent >= id) {
1016 return false; /* regions are numbered in order, each under an earlier one */
1017 }
1018 (*next_region)++;
1019 int ns = ns_make_path(ix, f->regions[parent].ns, fld[5]);
1020 if (ns < 0 || !undo_note_ns(ix, ns)) {
1021 return false;
1022 }
1023 ix->nss[ns].declared = true;
1024 /* product code declares it, and with it every namespace above: one that
1025 * is marked has its upper ones marked already */
1026 for (int up = ns; !f->is_test && up > 0 && !ix->nss[up].prod; up = ix->nss[up].parent) {
1027 if (!undo_note_ns(ix, up)) {
1028 return false;
1029 }
1030 ix->nss[up].prod = true;
1031 }
1032 f->regions[id] = (cs_region_t){.parent = parent,
1033 .ns = ns,
1034 .start = (uint32_t)strtoul(fld[3], NULL, 10),
1035 .end = (uint32_t)strtoul(fld[4], NULL, 10)};
1036 return true;
1037}
1038
1039static bool parse_using(cs_file_t *f, char **fld, int n, int regions_seen) {
1040 /* U region kind alias target */

Callers 1

parse_recordsFunction · 0.85

Calls 3

field_indexFunction · 0.85
ns_make_pathFunction · 0.85
undo_note_nsFunction · 0.85

Tested by

no test coverage detected