merge lang/foundations into lang/native-jolt (seeds regenerated)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 03:20:44 +03:00
commit b247603b7e
62 changed files with 41302 additions and 40864 deletions

View file

@ -20,6 +20,12 @@ function is_intrinsic(name: pointer) -> bool {
function emit_bind(rest: pointer) -> pointer { let r = nreg(); emit(" "); emit(r); emit(" = "); emit(rest); emit("\n"); return r }
function arg_code(e: Node, i: int) -> pointer { let v = emit_expr(e.kids[i]); return v.code }
# a buffer handed to the platform layer: a slice's elements, never its header (as an extern's are)
function arg_buf(e: Node, i: int) -> pointer {
let v = emit_expr(e.kids[i])
if is_slice_ty(v.ty) { return emit_bind(`load ptr, ptr {slice_field(v.code, 0)}`) }
return v.code
}
function emit_intrinsic(name: pointer, e: Node) -> Val {
g_intrin_ok = true

View file

@ -70,7 +70,7 @@ function emit_intrinsic2(name: pointer, e: Node) -> Val {
return val("0", "void")
}
if (name == "win_present") {
let a = arg_code(e, 0); let b = arg_code(e, 1); let c = arg_code(e, 2)
let a = arg_buf(e, 0); let b = arg_code(e, 1); let c = arg_code(e, 2)
emit(" call void @win_present(ptr "); emit(a); emit(", i32 "); emit(b); emit(", i32 "); emit(c); emit(")\n")
return val("0", "void")
}
@ -78,19 +78,19 @@ function emit_intrinsic2(name: pointer, e: Node) -> Val {
# #50 — fill a caller buffer with the platform device state (windowed only,
# DCE'd headless). win_held: an 8-word held-key bitset; win_mouse: [x, y,
# button-mask, wheel-delta].
if (name == "win_held") { let a = arg_code(e, 0); emit(" call void @win_held(ptr "); emit(a); emit(")\n"); return val("0", "void") }
if (name == "win_mouse") { let a = arg_code(e, 0); emit(" call void @win_mouse(ptr "); emit(a); emit(")\n"); return val("0", "void") }
if (name == "win_held") { let a = arg_buf(e, 0); emit(" call void @win_held(ptr "); emit(a); emit(")\n"); return val("0", "void") }
if (name == "win_mouse") { let a = arg_buf(e, 0); emit(" call void @win_mouse(ptr "); emit(a); emit(")\n"); return val("0", "void") }
# what the active keyboard layout types on a held-set key position (windowed only,
# DCE'd headless): a code point, 0 for none.
if (name == "win_key_char") { let a = arg_code(e, 0); return val(emit_bind(`call i32 @win_key_char(i32 {a})`), "int") }
# what the player TYPED since the last call - UTF-16 code units into the caller's buffer, one per
# word, returning how many. The layout, the modifiers and any dead key are already applied, which
# is why a name field must read this rather than build text out of key codes.
if (name == "win_text") { let a = arg_code(e, 0); let b = arg_code(e, 1); return val(emit_bind(`call i32 @win_text(ptr {a}, i32 {b})`), "int") }
if (name == "win_text") { let a = arg_buf(e, 0); let b = arg_code(e, 1); return val(emit_bind(`call i32 @win_text(ptr {a}, i32 {b})`), "int") }
# #51 — win_pad: 6 words/pad [connected, mask, lx, ly, rx, ry]; win_touch: 3
# words/point [active, x, y]. Both windowed-only, DCE'd headless.
if (name == "win_pad") { let a = arg_code(e, 0); emit(" call void @win_pad(ptr "); emit(a); emit(")\n"); return val("0", "void") }
if (name == "win_touch") { let a = arg_code(e, 0); emit(" call void @win_touch(ptr "); emit(a); emit(")\n"); return val("0", "void") }
if (name == "win_pad") { let a = arg_buf(e, 0); emit(" call void @win_pad(ptr "); emit(a); emit(")\n"); return val("0", "void") }
if (name == "win_touch") { let a = arg_buf(e, 0); emit(" call void @win_touch(ptr "); emit(a); emit(")\n"); return val("0", "void") }
# #89 — set the OS cursor capture mode (windowed only; DCE'd headless).
if (name == "win_cursor_mode") { let a = arg_code(e, 0); emit(" call void @win_cursor_mode(i32 "); emit(a); emit(")\n"); return val("0", "void") }
# #22 audio backend — AVAudioPlayer via audio.ll; windowed-only, DCE'd headless.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -360,6 +360,8 @@ entry {
var vkl = join_path(home, "runtime/native/vk_mac.ll")
if g_target_win { vkl = join_path(home, "runtime/native/vk_win.ll") }
cmd = `{cmd} {vkt} {vkl}`
# the CAMetalLayer a macOS window presents through, found by name in cocoa.ll
if not g_target_win { cmd = `{cmd} -Wl,-needed_framework,QuartzCore` }
}
# A shipped Windows game is a GUI-subsystem program: started from Explorer, a
# console-subsystem one opens a console window behind the game. mainCRTStartup keeps