jc/module.jai
2025-07-23 18:26:52 -06:00

59 lines
1.2 KiB
Text

#module_parameters(IMPORT_LOCATION := #caller_location);
#scope_export;
byte :: u8;
cstring :: *byte;
rawptr :: *void;
#if size_of(int) == size_of(s64) {
sint :: s64;
uint :: u64;
}
else {
sint :: s32;
uint :: u32;
}
#if size_of(rawptr) == size_of(u64) {
uptr :: u64;
sptr :: s64;
}
else {
uptr :: u32;
sptr :: s32;
}
#if OS == {
case .WINDOWS;
#if CPU != .X64 #run report_error_on_import("JC is only supported x86-64 Windows systems, not %", CPU);
ARCH :: "x86-64";
PLATFORM :: "windows";
case .MACOS;
#if CPU == {
case .X64; ARCH :: "x86-64";
case .ARM64; ARCH :: "arm64";
}
PLATFORM :: "macos";
case .LINUX;
#if CPU != .X64 #run report_error_on_import("JC is only supported x86-64 Unix systems, not %", CPU);
ARCH :: "x86-64";
PLATFORM :: "unix";
case;
#run report_error_on_import("JC is not supported on % % systems", CPU, OS);
}
#scope_file;
report_error_on_import :: (fmt: string, args: ..Any) #compile_time {
basic :: #import "Basic"; // @future
compiler :: #import "Compiler"; // @future
compiler.compiler_report(basic.tprint(fmt, ..args), loc = IMPORT_LOCATION);
}