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

Function gc_summarize

src/pipeline/pass_operator.c:1265–1305  ·  view source on GitHub ↗

Note the file's top-level functions (not methods) that load a chart from * a parameter. */

Source from the content-addressed store, hash-verified

1263/* Note the file's top-level functions (not methods) that load a chart from
1264 * a parameter. */
1265static void gc_summarize(gc_t *g, const char *file, const char *text) {
1266 char dir[CBM_SZ_1K];
1267 op_dirname(file, dir, sizeof(dir));
1268 for (const char *p = strstr(text, "func "); p; p = strstr(p + SKIP_ONE, "func ")) {
1269 if (p > text && p[-SKIP_ONE] != '\n') {
1270 continue;
1271 }
1272 const char *name = p + OP_SLEN("func ");
1273 const char *ne = name;
1274 while (op_ident_char(*ne)) {
1275 ne++;
1276 }
1277 if (ne == name || *ne != '(') {
1278 continue; /* a method, or generic */
1279 }
1280 const char *starts[GC_ARGS_MAX];
1281 size_t lens[GC_ARGS_MAX];
1282 const char *pend = NULL;
1283 int np = gc_args(ne, starts, lens, GC_ARGS_MAX, &pend);
1284 const char *open = pend;
1285 while (*open && *open != '{' && *open != '\n') {
1286 open++;
1287 }
1288 if (*open != '{') {
1289 continue;
1290 }
1291 const char *close = gc_block_end(open);
1292 for (int i = 0; i < np; i++) {
1293 const char *ps = starts[i];
1294 size_t pl = lens[i];
1295 gc_trim(&ps, &pl);
1296 size_t idl = 0;
1297 while (idl < pl && op_ident_char(ps[idl])) {
1298 idl++;
1299 }
1300 if (idl && gc_body_loads(text, open, close, ps, idl)) {
1301 gc_note_loader(g, dir, name, (size_t)(ne - name), i);
1302 }
1303 }
1304 }
1305}
1306
1307/* ── Constants of a package ── */
1308

Callers 1

gc_noteFunction · 0.85

Calls 7

op_dirnameFunction · 0.85
op_ident_charFunction · 0.85
gc_argsFunction · 0.85
gc_block_endFunction · 0.85
gc_trimFunction · 0.85
gc_body_loadsFunction · 0.85
gc_note_loaderFunction · 0.85

Tested by

no test coverage detected