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

Function lisp_path_stem

internal/cbm/extract_defs.c:11905–11914  ·  view source on GitHub ↗

Basename stem (no directory, no extension) of a path, into an arena string. * A Chialisp `(mod ...)` has no name of its own — the file IS the puzzle — so * the module entry point is named after the file that holds it. */

Source from the content-addressed store, hash-verified

11903 * A Chialisp `(mod ...)` has no name of its own — the file IS the puzzle — so
11904 * the module entry point is named after the file that holds it. */
11905static char *lisp_path_stem(CBMArena *a, const char *path) {
11906 if (!path) {
11907 return NULL;
11908 }
11909 const char *slash = strrchr(path, '/');
11910 const char *base = slash ? slash + SKIP_CHAR : path;
11911 const char *dot = strrchr(base, '.');
11912 size_t len = (dot && dot != base) ? (size_t)(dot - base) : strlen(base);
11913 return cbm_arena_strndup(a, base, len);
11914}
11915
11916static void extract_lisp_def(CBMExtractCtx *ctx, TSNode node) {
11917 CBMArena *a = ctx->arena;

Callers 1

extract_lisp_defFunction · 0.85

Calls 1

cbm_arena_strndupFunction · 0.70

Tested by

no test coverage detected