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

Function spawn_expand

internal/cbm/spawn_patterns.c:421–442  ·  view source on GitHub ↗

The callee as its import makes it: `sp.run` -> subprocess.run (an alias), * `run` -> subprocess.run (a member import), `spawn` -> child_process.spawn * (a named import mapped to its module). Empty when no import applies. */

Source from the content-addressed store, hash-verified

419 * `run` -> subprocess.run (a member import), `spawn` -> child_process.spawn
420 * (a named import mapped to its module). Empty when no import applies. */
421static void spawn_expand(const char *callee, const CBMImport *imports, int count, char *out,
422 size_t n) {
423 out[0] = '\0';
424 size_t head = spawn_head_len(callee);
425 size_t key_len = head ? head : strlen(callee);
426 for (int i = 0; i < count; i++) {
427 const char *key = imports[i].local_name;
428 if (!key || !imports[i].module_path || strlen(key) != key_len ||
429 strncmp(key, callee, key_len) != 0) {
430 continue;
431 }
432 const char *val = spawn_module(imports[i].module_path);
433 if (head) {
434 snprintf(out, n, "%s%s", val, callee + head);
435 } else if (spawn_val_names(val, callee)) {
436 snprintf(out, n, "%s", val);
437 } else {
438 snprintf(out, n, "%s.%s", val, callee);
439 }
440 return;
441 }
442}
443
444static bool spawn_imports_module(const CBMImport *imports, int count, const char *module) {
445 size_t ml = strlen(module);

Callers 1

cbm_spawn_matchFunction · 0.85

Calls 3

spawn_head_lenFunction · 0.85
spawn_moduleFunction · 0.85
spawn_val_namesFunction · 0.85

Tested by

no test coverage detected