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

Function d2_value

internal/cbm/diagram.c:2019–2034  ·  view source on GitHub ↗

A value that is a block string read whole: the label it gives in buf, its * text added to the diagram's docstring, and whether a `{` follows it. */

Source from the content-addressed store, hash-verified

2017/* A value that is a block string read whole: the label it gives in buf, its
2018 * text added to the diagram's docstring, and whether a `{` follows it. */
2019static dg_str_t d2_value(dg_t *dg, dg_lines_t *it, dg_str_t value, char *buf, size_t cap,
2020 bool *opens) {
2021 dg_str_t text;
2022 dg_str_t after;
2023 if (!value.n || value.p[0] != '|' || !d2_block(it, value, &text, &after)) {
2024 return value;
2025 }
2026 *opens = after.n && after.p[after.n - SKIP_ONE] == '{';
2027 size_t n = d2_block_label(text, buf, cap);
2028 char all[DG_LABEL_MAX];
2029 size_t an = dg_label_text(text, all, sizeof(all));
2030 if (an > n) {
2031 dg_doc_add(dg, all, an);
2032 }
2033 return dg_s(buf, n);
2034}
2035
2036/* A connection chain `a -> b <- c: label`: true when the line is one. */
2037static bool d2_connection(dg_t *dg, dg_lines_t *it, dg_str_t ln, const char *path, uint32_t line,

Callers 2

d2_connectionFunction · 0.85
d2_keyFunction · 0.85

Calls 5

d2_blockFunction · 0.85
d2_block_labelFunction · 0.85
dg_label_textFunction · 0.85
dg_doc_addFunction · 0.85
dg_sFunction · 0.85

Tested by

no test coverage detected