os: start yeeting

This commit is contained in:
Mitchell Hashimoto
2024-08-16 10:57:19 -07:00
parent 29de3e80f1
commit d0ca949c09
3 changed files with 31 additions and 4 deletions

View File

@ -4,9 +4,9 @@ const wasm = @import("../wasm.zig");
const wasm_target = @import("target.zig"); const wasm_target = @import("target.zig");
// Use the correct implementation // Use the correct implementation
pub usingnamespace if (wasm_target.target) |target| switch (target) { pub const log = if (wasm_target.target) |target| switch (target) {
.browser => Browser, .browser => Browser.log,
} else struct {}; } else @compileError("wasm target required");
/// Browser implementation calls an extern "log" function. /// Browser implementation calls an extern "log" function.
pub const Browser = struct { pub const Browser = struct {

View File

@ -1,7 +1,33 @@
const std = @import("std"); const std = @import("std");
const windows = std.os.windows; const windows = std.os.windows;
pub usingnamespace std.os.windows; // Export any constants or functions we need from the Windows API so
// we can just import one file.
pub const kernel32 = windows.kernel32;
pub const unexpectedError = windows.unexpectedError;
pub const OpenFile = windows.OpenFile;
pub const SetHandleInformation = windows.SetHandleInformation;
pub const DWORD = windows.DWORD;
pub const FILE_ATTRIBUTE_NORMAL = windows.FILE_ATTRIBUTE_NORMAL;
pub const FILE_FLAG_OVERLAPPED = windows.FILE_FLAG_OVERLAPPED;
pub const FILE_SHARE_READ = windows.FILE_SHARE_READ;
pub const GENERIC_READ = windows.GENERIC_READ;
pub const HANDLE = windows.HANDLE;
pub const HANDLE_FLAG_INHERIT = windows.HANDLE_FLAG_INHERIT;
pub const INFINITE = windows.INFINITE;
pub const INVALID_HANDLE_VALUE = windows.INVALID_HANDLE_VALUE;
pub const OPEN_EXISTING = windows.OPEN_EXISTING;
pub const PIPE_ACCESS_OUTBOUND = windows.PIPE_ACCESS_OUTBOUND;
pub const PIPE_TYPE_BYTE = windows.PIPE_TYPE_BYTE;
pub const PROCESS_INFORMATION = windows.PROCESS_INFORMATION;
pub const S_OK = windows.S_OK;
pub const SECURITY_ATTRIBUTES = windows.SECURITY_ATTRIBUTES;
pub const STARTUPINFOW = windows.STARTUPINFOW;
pub const STARTF_USESTDHANDLES = windows.STARTF_USESTDHANDLES;
pub const SYNCHRONIZE = windows.SYNCHRONIZE;
pub const WAIT_FAILED = windows.WAIT_FAILED;
pub const FALSE = windows.FALSE;
pub const TRUE = windows.TRUE;
pub const exp = struct { pub const exp = struct {
pub const HPCON = windows.LPVOID; pub const HPCON = windows.LPVOID;

View File

@ -7,3 +7,4 @@ const c = @cImport({
// here, no need to export everything from the C lib if we don't use it. // here, no need to export everything from the C lib if we don't use it.
pub const stbi_load_from_memory = c.stbi_load_from_memory; pub const stbi_load_from_memory = c.stbi_load_from_memory;
pub const stbi_image_free = c.stbi_image_free; pub const stbi_image_free = c.stbi_image_free;
pub const stbir_resize_uint8 = c.stbir_resize_uint8;