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

Function c_line

internal/cbm/doclink_c.c:307–357  ·  view source on GitHub ↗

One line outside code blocks: commands, and the words of an @see * paragraph. */

Source from the content-addressed store, hash-verified

305/* One line outside code blocks: commands, and the words of an @see
306 * paragraph. */
307static void c_line(c_emit_t *em, const c_line_t *ln, const bool *mask) {
308 size_t i = 0;
309 bool line_start = true;
310 while (i < ln->n) {
311 if (mask[i] || isspace((unsigned char)ln->p[i]) || ln->p[i] == ',') {
312 i++;
313 continue;
314 }
315 size_t cl = c_command_at(ln->p, i, ln->n);
316 if (cl > 0) {
317 const char *w = ln->p + i + SKIP_ONE;
318 size_t j = i + SKIP_ONE + cl;
319 if (c_word_is(w, cl, "ref")) {
320 i = c_ref(em, ln, j, mask);
321 } else if (c_word_is(w, cl, "see") || c_word_is(w, cl, "sa")) {
322 em->see = true;
323 i = j;
324 } else if (c_inline_cmd(w, cl)) {
325 j = c_skip_space(ln->p, j, ln->n);
326 while (j < ln->n && !isspace((unsigned char)ln->p[j])) {
327 j++; /* the word it formats is text */
328 }
329 i = j;
330 } else {
331 int open = c_block_index(C_BLOCK_OPEN, w, cl);
332 if (open >= 0) {
333 em->verbatim = open;
334 return;
335 }
336 if (line_start) {
337 em->see = false; /* a new paragraph */
338 }
339 i = j;
340 }
341 line_start = false;
342 continue;
343 }
344 size_t k = i;
345 while (k < ln->n && !isspace((unsigned char)ln->p[k]) && ln->p[k] != ',' && !mask[k] &&
346 c_command_at(ln->p, k, ln->n) == 0) {
347 k++;
348 }
349 if (k == i) {
350 k = i + SKIP_ONE;
351 } else if (em->see) {
352 c_see_word(em, ln->p + i, k - i, ln->line);
353 }
354 line_start = false;
355 i = k;
356 }
357}
358
359/* The end command of the open code block on this line, if any. */
360static bool c_closes_block(const c_line_t *ln, int open) {

Callers 1

c_harvestFunction · 0.85

Calls 7

c_command_atFunction · 0.85
c_word_isFunction · 0.85
c_refFunction · 0.85
c_inline_cmdFunction · 0.85
c_skip_spaceFunction · 0.85
c_block_indexFunction · 0.85
c_see_wordFunction · 0.85

Tested by

no test coverage detected