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

Function dg_args

internal/cbm/diagram.c:967–986  ·  view source on GitHub ↗

The arguments of `Name(a, "b", c)`: up to DG_ARGS_MAX, quotes dropped. */

Source from the content-addressed store, hash-verified

965
966/* The arguments of `Name(a, "b", c)`: up to DG_ARGS_MAX, quotes dropped. */
967static int dg_args(dg_str_t s, dg_str_t *args) {
968 const char *open = memchr(s.p, '(', s.n);
969 if (!open) {
970 return 0;
971 }
972 int n = 0;
973 bool quoted = false;
974 const char *start = open + SKIP_ONE;
975 for (const char *p = start; p < s.p + s.n && n < DG_ARGS_MAX; p++) {
976 quoted = *p == '"' ? !quoted : quoted;
977 if (!quoted && (*p == ',' || *p == ')')) {
978 args[n++] = dg_unquote(dg_s(start, (size_t)(p - start)));
979 start = p + SKIP_ONE;
980 if (*p == ')') {
981 break;
982 }
983 }
984 }
985 return n;
986}
987
988/* A C4 macro line `Person(id, "Label", ...)` or `Rel(a, b, "label")`: false
989 * when the line is none. */

Callers 1

dg_c4_lineFunction · 0.85

Calls 2

dg_unquoteFunction · 0.85
dg_sFunction · 0.85

Tested by

no test coverage detected