1#![allow(clippy::missing_safety_doc, clippy::too_many_arguments, non_snake_case)]
13
14pub mod array;
15pub mod closure;
16pub mod float;
17pub mod fs;
18pub mod int;
19pub mod io;
20pub mod io_error;
21pub mod marshal;
22pub mod model;
23pub mod nat;
24pub mod object;
25pub mod panic;
26pub mod process;
27pub mod string;
28pub mod thunk;
29pub mod uint;
30
31pub use array::*;
32pub use closure::*;
33pub use float::*;
34pub use fs::*;
35pub use int::*;
36pub use io::*;
37pub use io_error::*;
38pub use marshal::*;
39pub use model::*;
40pub use nat::*;
41pub use object::*;
42pub use panic::*;
43pub use process::*;
44pub use string::*;
45pub use thunk::*;
46pub use uint::*;
47
48pub unsafe fn lean_system_platform_nbits(_unit: Obj) -> Obj {
50 lean_box(usize::BITS as usize)
51}
52
53pub unsafe fn lean_system_platform_windows(_unit: Obj) -> u8 {
55 cfg!(windows) as u8
56}
57
58pub unsafe fn lean_system_platform_osx(_unit: Obj) -> u8 {
60 cfg!(target_os = "macos") as u8
61}
62
63pub unsafe fn lean_system_platform_linux(_unit: Obj) -> u8 {
65 cfg!(target_os = "linux") as u8
66}
67
68pub unsafe fn lean_system_platform_emscripten(_unit: Obj) -> u8 {
70 cfg!(target_os = "emscripten") as u8
71}
72
73pub unsafe fn lean_system_platform_target(_unit: Obj) -> Obj {
75 lean_mk_string(env!("LEANFRAN_TARGET"))
76}
77
78pub unsafe fn lean_internal_get_hardware_concurrency(_unit: Obj) -> u32 {
80 std::thread::available_parallelism().map_or(0, |n| n.get() as u32)
81}
82
83pub unsafe fn lean_ptr_addr_unsafe(a: Obj) -> usize {
85 lean_ptr_addr(a)
86}
87
88include!(concat!(env!("OUT_DIR"), "/externs.rs"));
89
90#[doc(hidden)]
92pub fn runtime_externs_lean() -> String {
93 let mut s = String::from(
94 "/-! C names of the functions the runtime `leanfran-runtime` provides. Generated by `make gen-externs`. -/\n\nnamespace LeanRust\n\ndef runtimeExterns : Array String := #[\n",
95 );
96 let items: Vec<String> = EXTERNS.iter().map(|n| format!(" \"{n}\"")).collect();
97 s.push_str(&items.join(",\n"));
98 s.push_str("\n]\n\nend LeanRust\n");
99 s
100}