Add C and C++ library support

import "zlib.h" reads the header (cc -E + a small C declaration
parser), links via pkg-config or link "name", and builds .c/.cpp
files next to the program. C structs become Dino structs, pointers
become pointer types (nil = NULL), T* parameters take variables or
lists. Adds dino header, editor completion/hover for C names,
docs chapter 13, a raylib example, and tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Your NameandClaude Opus 5.5 committed 2026-11-08 12:55:41 +01:00
1 parent 5b42e2a3bd
commit 2f44f09b6a
26 files changed
+3418 -70

No files matched your search

+11
View File
@@ -2213,6 +2213,17 @@ fn docs_examples_run() {
}
// the output block, if one follows right away
let expected = rest.strip_prefix("\n```text\n").and_then(|r| r.find("```").map(|e| &r[..e]));
if code.contains("import \"") {
// C libraries: the header may be one written next to the program in the text,
// or a library that isn't installed here
match driver::compile_to_c(code) {
Err(d) if d.msg.contains("cannot find the C header") => continue,
Err(d) => panic!("{} failed:\n{code}\n{}", path.display(), d.msg),
// without printed output it is a program to look at (a window), not to run
Ok(_) if expected.is_none() => continue,
Ok(_) => {}
}
}
let o = run_source(code);
assert_eq!(o.code, 0, "{} failed:\n{code}\n{}", path.display(), o.stderr);
if let Some(want) = expected {