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

Function lang_inc_text

src/discover/language.c:1480–1503  ·  view source on GitHub ↗

Disambiguate .inc files: shared by BitBake include fragments and * InterSystems ObjectScript include (macro) files. ObjectScript .inc files are * predominantly macro definitions ("#define NAME ..." / "#def1arg NAME ..."); * some also carry a "ROUTINE " header. The macro-preprocessor directives * are the strongest signal because that is the primary content of an .inc file, * whereas BitB

Source from the content-addressed store, hash-verified

1478 * followed by 'def'/';'), which BitBake never produces. Defaults to BitBake on
1479 * any doubt (preserves existing behaviour). */
1480static CBMLanguage lang_inc_text(const char *buf) {
1481 const char *line = buf;
1482 while (*line) {
1483 /* ObjectScript include header: a line beginning "ROUTINE <Uppercase>". */
1484 if (strncmp(line, "ROUTINE ", SLEN("ROUTINE ")) == 0 &&
1485 isupper((unsigned char)line[SLEN("ROUTINE ")])) {
1486 return CBM_LANG_OBJECTSCRIPT_ROUTINE;
1487 }
1488 /* ObjectScript macro directives — the primary content of .inc files.
1489 * "#define"/"#def1arg" (macro defs) and "#;" (line comment). BitBake's
1490 * only '#' use is "# comment" (hash + space), so these never collide. */
1491 if (strncmp(line, "#define", SLEN("#define")) == 0 ||
1492 strncmp(line, "#def1arg", SLEN("#def1arg")) == 0 ||
1493 strncmp(line, "#;", SLEN("#;")) == 0) {
1494 return CBM_LANG_OBJECTSCRIPT_ROUTINE;
1495 }
1496 const char *nl = strchr(line, '\n');
1497 if (!nl) {
1498 break;
1499 }
1500 line = nl + SKIP_ONE;
1501 }
1502 return CBM_LANG_BITBAKE;
1503}
1504
1505CBMLanguage cbm_disambiguate_inc(const char *path) {
1506 unsigned char head[LANG_PROBE_HEAD];

Callers 2

cbm_disambiguate_incFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected