code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const yeti = @import("yeti"); const initCodebase = yeti.initCodebase; const MockFileSystem = yeti.FileSystem; const analyzeSemantics = yeti.analyzeSemantics; const printErrors = yeti.printErrors; const colors = yeti.colors; test "error printer calling function with to few parameters" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", \\add(x: i64, y: i64) i64 { \\ x + y \\} \\ \\start() i64 { \\ add(5) \\} ); try expectEqual(analyzeSemantics(codebase, fs, "foo.yeti"), error.CompileError); const error_message = try printErrors(codebase); try expectEqualStrings(error_message, try std.fmt.allocPrint(arena.allocator(), \\{s}---- FUNCTION CALL ERROR ----------------------------------- foo.yeti{s} \\ \\No matching function overload found for argument types (IntLiteral) \\ \\4| \\5| start() i64 {{ \\6| {s}add(5){s} \\7| }} \\Here are the possible candidates: \\ \\add(x: i64, {s}y: i64{s}) ----- foo.yeti:1 \\ , .{ colors.RED, colors.RESET, colors.RED, colors.RESET, colors.RED, colors.RESET })); } test "error printer function overloads are aligned" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", \\add(x: i64, y: i64) i64 { \\ x + y \\} \\ \\add(x: i64) i64 { \\ x + y \\} \\ \\start() i64 { \\ a: i32 = 5 \\ add(a, 7) \\} ); try expectEqual(analyzeSemantics(codebase, fs, "foo.yeti"), error.CompileError); const error_message = try printErrors(codebase); try expectEqualStrings(error_message, try std.fmt.allocPrint(arena.allocator(), \\{s}---- FUNCTION CALL ERROR ----------------------------------- foo.yeti{s} \\ \\No matching function overload found for argument types (i32, IntLiteral) \\ \\ 9| start() i64 {{ \\10| a: i32 = 5 \\11| {s}add(a, 7){s} \\12| }} \\Here are the possible candidates: \\ \\add({s}x: i64{s}, y: i64) ----- foo.yeti:1 \\add({s}x: i64{s}) ----- foo.yeti:5 \\ , .{ colors.RED, colors.RESET, colors.RED, colors.RESET, colors.RED, colors.RESET, colors.RED, colors.RESET })); }
src/tests/test_error_printer.zig
const std = @import("std"); const print = std.debug.print; const napi = @import("./src/napi.zig"); const allocator = std.heap.c_allocator; comptime { napi.register(init); } comptime { const n = @import("./src/napi/c-napi/types.zig"); std.testing.refAllDecls(n); } fn init(env: napi.env, exports: napi.object) !void { _ = env; _ = exports; const n = @import("./src/napi/c-napi/types.zig"); const heap_string = try allocator.alloc(u8, 64); std.mem.set(u8, heap_string, 'a'); const nenv = n.Env.init(env.raw); const np = try n.Promise.init(nenv); const nv = try n.Function.init(nenv, "hello", (opaque { pub fn hello(envv: n.Env, info: n.CallbackInfo) !n.Value { _ = info; _ = envv; return error.aaaa; // return n.Value.from(try n.String.init(envv, .utf8, "hello")); } }).hello); try exports.set(env, "zig", napi.value.init(np.inner)); try np.resolve(nenv, nv); // std.log.info("{}", .{std.mem.eql(u16, ss, sss)}); // std.log.info("{}", .{try nv.len(nenv)}); // const b: ?u1 = null; // const o = try napi.object.new(env); // const a = try napi.array.new(env, 5); // const heap_string_utf16 = try allocator.alloc(u16, 100); // defer allocator.free(heap_string); // defer allocator.free(heap_string_utf16); { // try exports.set(env, "zig", try env.create(a)); // try exports.set(env, "zig", try env.create(o)); // try exports.set(env, "zig", try env.create(b)); // try exports.set(env, "zig", try env.create(true)); // try exports.set(env, "zig", try env.create(null)); // try exports.set(env, "zig", try env.create(void)); // try exports.set(env, "zig", try env.create(error.abcdef)); // try exports.set(env, "zig", try env.create(@as(i128, -1))); // try exports.set(env, "zig", try env.create(enum { a, b, c })); // try exports.set(env, "zig", try env.create(enum { a, b, c }.a)); // try exports.set(env, "zig", try env.create(.{ .a = 1, .b = 2, .c = .{3} })); // try exports.set(env, "zig", try env.create(@bitCast(u53, @as(i53, -1)))); // int // try exports.set(env, "zig", try env.create(@bitCast(u54, @as(i54, -1)))); // bigint // try exports.set(env, "zig", try env.create(try napi.string.new(env, .utf8, "hello"))); // try exports.set(env, "zig", try env.create(try napi.string.new(env, .latin1, "hello".*))); // try exports.set(env, "zig", try env.create(union(enum) { a: u2, b: u2, c: u2 }{ .a = 1 })); // try exports.set(env, "zig", try env.create(try napi.string.new(env, .latin1, heap_string))); // try exports.set(env, "zig", try env.create(try napi.string.new(env, .utf16, heap_string_utf16))); } // try exports.set(env, "zig", try napi.bind.function(env, sleep, "sleep", allocator)); // try exports.set(env, "zig", try napi.bind.function(env, random, "random", allocator)); } // fn sleep(time: usize) !void { // std.time.sleep(time * std.time.ns_per_ms); // return error.aaa; // } // fn random(slice: []u8, slice2: []u8) u32 { // _ = slice2; // std.time.sleep(1 * std.time.ns_per_s); // return @intCast(u32, slice.len); // }
lib.zig
const std = @import("std"); pub fn build(b: *std.build.Builder) void { const target = fixedStandardTargetOptions(b); const mode = b.standardReleaseOptions(); { const tigerbeetle = b.addExecutable("tigerbeetle", "src/main.zig"); tigerbeetle.setTarget(target); tigerbeetle.setBuildMode(mode); tigerbeetle.install(); const run_cmd = tigerbeetle.run(); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| run_cmd.addArgs(args); const run_step = b.step("run", "Run TigerBeetle"); run_step.dependOn(&run_cmd.step); } { const lint = b.addExecutable("lint", "scripts/lint.zig"); lint.setTarget(target); lint.setBuildMode(mode); const run_cmd = lint.run(); run_cmd.step.dependOn(&lint.step); if (b.args) |args| { run_cmd.addArgs(args); } else { run_cmd.addArg("src"); } const lint_step = b.step("lint", "Run the linter on src/"); lint_step.dependOn(&run_cmd.step); } { const unit_tests = b.addTest("src/unit_tests.zig"); unit_tests.setTarget(target); unit_tests.setBuildMode(mode); const test_step = b.step("test", "Run the unit tests"); test_step.dependOn(&unit_tests.step); } } // A patched version of std.build.Builder.standardTargetOptions() to backport the fix // from https://github.com/ziglang/zig/pull/9817. fn fixedStandardTargetOptions(self: *std.build.Builder) std.zig.CrossTarget { const maybe_triple = self.option( []const u8, "target", "The CPU architecture, OS, and ABI to build for", ); const mcpu = self.option([]const u8, "cpu", "Target CPU"); if (maybe_triple == null and mcpu == null) { return .{}; } const triple = maybe_triple orelse "native"; var diags: std.zig.CrossTarget.ParseOptions.Diagnostics = .{}; var selected_target = std.zig.CrossTarget.parse(.{ .arch_os_abi = triple, .cpu_features = mcpu, .diagnostics = &diags, }) catch |err| switch (err) { error.UnknownCpuModel => { std.debug.print("Unknown CPU: '{s}'\nAvailable CPUs for architecture '{s}':\n", .{ diags.cpu_name.?, @tagName(diags.arch.?), }); for (diags.arch.?.allCpuModels()) |cpu| { std.debug.print(" {s}\n", .{cpu.name}); } std.debug.print("\n", .{}); self.invalid_user_input = true; return .{}; }, error.UnknownCpuFeature => { std.debug.print( \\Unknown CPU feature: '{s}' \\Available CPU features for architecture '{s}': \\ , .{ diags.unknown_feature_name, @tagName(diags.arch.?), }); for (diags.arch.?.allFeaturesList()) |feature| { std.debug.print(" {s}: {s}\n", .{ feature.name, feature.description }); } std.debug.print("\n", .{}); self.invalid_user_input = true; return .{}; }, error.UnknownOperatingSystem => { std.debug.print( \\Unknown OS: '{s}' \\Available operating systems: \\ , .{diags.os_name}); inline for (std.meta.fields(std.Target.Os.Tag)) |field| { std.debug.print(" {s}\n", .{field.name}); } std.debug.print("\n", .{}); self.invalid_user_input = true; return .{}; }, else => |e| { std.debug.print("Unable to parse target '{s}': {s}\n\n", .{ triple, @errorName(e) }); self.invalid_user_input = true; return .{}; }, }; // Work around LibExeObjStep.make() explicitly omitting -mcpu=baseline // even when the target arch is native. The proper fix is in https://github.com/ziglang/zig/pull/9817 // but we can work around this by providing an explicit arch if the baseline cpu and native arch // were requested. const cpu = selected_target.getCpu(); if (selected_target.cpu_arch == null and cpu.model == std.Target.Cpu.baseline(cpu.arch).model) { const native_target_info = std.zig.system.NativeTargetInfo.detect(self.allocator, .{}) catch { @panic("failed to detect native target info"); }; selected_target.cpu_arch = native_target_info.target.cpu.arch; } return selected_target; }
build.zig
const std = @import("../std.zig"); const build = @import("../build.zig"); const Step = build.Step; const Builder = build.Builder; const fs = std.fs; const warn = std.debug.warn; const ArrayList = std.ArrayList; pub const WriteFileStep = struct { step: Step, builder: *Builder, output_dir: []const u8, files: ArrayList(File), pub const File = struct { basename: []const u8, bytes: []const u8, }; pub fn init(builder: *Builder) WriteFileStep { return WriteFileStep{ .builder = builder, .step = Step.init(.WriteFile, "writefile", builder.allocator, make), .files = ArrayList(File).init(builder.allocator), .output_dir = undefined, }; } pub fn add(self: *WriteFileStep, basename: []const u8, bytes: []const u8) void { self.files.append(.{ .basename = basename, .bytes = bytes }) catch unreachable; } /// Unless setOutputDir was called, this function must be called only in /// the make step, from a step that has declared a dependency on this one. /// To run an executable built with zig build, use `run`, or create an install step and invoke it. pub fn getOutputPath(self: *WriteFileStep, basename: []const u8) []const u8 { return fs.path.join( self.builder.allocator, &[_][]const u8{ self.output_dir, basename }, ) catch unreachable; } fn make(step: *Step) !void { const self = @fieldParentPtr(WriteFileStep, "step", step); // The cache is used here not really as a way to speed things up - because writing // the data to a file would probably be very fast - but as a way to find a canonical // location to put build artifacts. // If, for example, a hard-coded path was used as the location to put WriteFileStep // files, then two WriteFileSteps executing in parallel might clobber each other. // TODO port the cache system from stage1 to zig std lib. Until then we use blake2b // directly and construct the path, and no "cache hit" detection happens; the files // are always written. var hash = std.crypto.hash.blake2.Blake2b384.init(.{}); // Random bytes to make WriteFileStep unique. Refresh this with // new random bytes when WriteFileStep implementation is modified // in a non-backwards-compatible way. hash.update("eagVR1dYXoE7ARDP"); for (self.files.items) |file| { hash.update(file.basename); hash.update(file.bytes); hash.update("|"); } var digest: [48]u8 = undefined; hash.final(&digest); var hash_basename: [64]u8 = undefined; fs.base64_encoder.encode(&hash_basename, &digest); self.output_dir = try fs.path.join(self.builder.allocator, &[_][]const u8{ self.builder.cache_root, "o", &hash_basename, }); // TODO replace with something like fs.makePathAndOpenDir fs.cwd().makePath(self.output_dir) catch |err| { warn("unable to make path {}: {}\n", .{ self.output_dir, @errorName(err) }); return err; }; var dir = try fs.cwd().openDir(self.output_dir, .{}); defer dir.close(); for (self.files.items) |file| { dir.writeFile(file.basename, file.bytes) catch |err| { warn("unable to write {} into {}: {}\n", .{ file.basename, self.output_dir, @errorName(err), }); return err; }; } } };
lib/std/build/write_file.zig
const std = @import("std"); const crypto = std.crypto; const IdentityElementError = crypto.errors.IdentityElementError; const NonCanonicalError = crypto.errors.NonCanonicalError; const WeakPublicKeyError = crypto.errors.WeakPublicKeyError; /// Group operations over Curve25519. pub const Curve25519 = struct { /// The underlying prime field. pub const Fe = @import("field.zig").Fe; /// Field arithmetic mod the order of the main subgroup. pub const scalar = @import("scalar.zig"); x: Fe, /// Decode a Curve25519 point from its compressed (X) coordinates. pub fn fromBytes(s: [32]u8) callconv(.Inline) Curve25519 { return .{ .x = Fe.fromBytes(s) }; } /// Encode a Curve25519 point. pub fn toBytes(p: Curve25519) callconv(.Inline) [32]u8 { return p.x.toBytes(); } /// The Curve25519 base point. pub const basePoint = Curve25519{ .x = Fe.curve25519BasePoint }; /// Check that the encoding of a Curve25519 point is canonical. pub fn rejectNonCanonical(s: [32]u8) NonCanonicalError!void { return Fe.rejectNonCanonical(s, false); } /// Reject the neutral element. pub fn rejectIdentity(p: Curve25519) IdentityElementError!void { if (p.x.isZero()) { return error.IdentityElement; } } /// Multiply a point by the cofactor pub fn clearCofactor(p: Edwards25519) Edwards25519 { return p.dbl().dbl().dbl(); } fn ladder(p: Curve25519, s: [32]u8, comptime bits: usize) IdentityElementError!Curve25519 { var x1 = p.x; var x2 = Fe.one; var z2 = Fe.zero; var x3 = x1; var z3 = Fe.one; var swap: u8 = 0; var pos: usize = bits - 1; while (true) : (pos -= 1) { const bit = (s[pos >> 3] >> @truncate(u3, pos)) & 1; swap ^= bit; Fe.cSwap2(&x2, &x3, &z2, &z3, swap); swap = bit; const a = x2.add(z2); const b = x2.sub(z2); const aa = a.sq(); const bb = b.sq(); x2 = aa.mul(bb); const e = aa.sub(bb); const da = x3.sub(z3).mul(a); const cb = x3.add(z3).mul(b); x3 = da.add(cb).sq(); z3 = x1.mul(da.sub(cb).sq()); z2 = e.mul(bb.add(e.mul32(121666))); if (pos == 0) break; } Fe.cSwap2(&x2, &x3, &z2, &z3, swap); z2 = z2.invert(); x2 = x2.mul(z2); if (x2.isZero()) { return error.IdentityElement; } return Curve25519{ .x = x2 }; } /// Multiply a Curve25519 point by a scalar after "clamping" it. /// Clamping forces the scalar to be a multiple of the cofactor in /// order to prevent small subgroups attacks. This is the standard /// way to use Curve25519 for a DH operation. /// Return error.IdentityElement if the resulting point is /// the identity element. pub fn clampedMul(p: Curve25519, s: [32]u8) IdentityElementError!Curve25519 { var t: [32]u8 = s; scalar.clamp(&t); return try ladder(p, t, 255); } /// Multiply a Curve25519 point by a scalar without clamping it. /// Return error.IdentityElement if the resulting point is /// the identity element or error.WeakPublicKey if the public /// key is a low-order point. pub fn mul(p: Curve25519, s: [32]u8) (IdentityElementError || WeakPublicKeyError)!Curve25519 { const cofactor = [_]u8{8} ++ [_]u8{0} ** 31; _ = ladder(p, cofactor, 4) catch return error.WeakPublicKey; return try ladder(p, s, 256); } /// Compute the Curve25519 equivalent to an Edwards25519 point. pub fn fromEdwards25519(p: crypto.ecc.Edwards25519) IdentityElementError!Curve25519 { try p.clearCofactor().rejectIdentity(); const one = crypto.ecc.Edwards25519.Fe.one; const x = one.add(p.y).mul(one.sub(p.y).invert()); // xMont=(1+yEd)/(1-yEd) return Curve25519{ .x = x }; } }; test "curve25519" { var s = [32]u8{ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 }; const p = try Curve25519.basePoint.clampedMul(s); try p.rejectIdentity(); var buf: [128]u8 = undefined; try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&p.toBytes())}), "E6F2A4D1C28EE5C7AD0329268255A468AD407D2672824C0C0EB30EA6EF450145"); const q = try p.clampedMul(s); try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{s}", .{std.fmt.fmtSliceHexUpper(&q.toBytes())}), "3614E119FFE55EC55B87D6B19971A9F4CBC78EFE80BEC55B96392BABCC712537"); try Curve25519.rejectNonCanonical(s); s[31] |= 0x80; try std.testing.expectError(error.NonCanonical, Curve25519.rejectNonCanonical(s)); } test "curve25519 small order check" { var s: [32]u8 = [_]u8{1} ++ [_]u8{0} ** 31; const small_order_ss: [7][32]u8 = .{ .{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0 (order 4) }, .{ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 1 (order 1) }, .{ 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3, 0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32, 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00, // 325606250916557431795983626356110631294008115727848805560023387167927233504 (order 8) */ }, .{ 0x5f, 0x9c, 0x95, 0xbc, 0xa3, 0x50, 0x8c, 0x24, 0xb1, 0xd0, 0xb1, 0x55, 0x9c, 0x83, 0xef, 0x5b, 0x04, 0x44, 0x5c, 0xc4, 0x58, 0x1c, 0x8e, 0x86, 0xd8, 0x22, 0x4e, 0xdd, 0xd0, 0x9f, 0x11, 0x57, // 39382357235489614581723060781553021112529911719440698176882885853963445705823 (order 8) }, .{ 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, // p-1 (order 2) }, .{ 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, // p (=0, order 4) }, .{ 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, // p+1 (=1, order 1) }, }; for (small_order_ss) |small_order_s| { try std.testing.expectError(error.WeakPublicKey, Curve25519.fromBytes(small_order_s).mul(s)); var extra = small_order_s; extra[31] ^= 0x80; try std.testing.expectError(error.WeakPublicKey, Curve25519.fromBytes(extra).mul(s)); var valid = small_order_s; valid[31] = 0x40; s[0] = 0; try std.testing.expectError(error.IdentityElement, Curve25519.fromBytes(valid).mul(s)); } }
lib/std/crypto/25519/curve25519.zig
const std = @import("std"); const lola = @import("../main.zig"); /// This map is required by the VM serialization to identify environment pointers /// and allow serialization/deserialization of the correct references. pub const EnvironmentMap = struct { const Self = @This(); const Entry = struct { env: *lola.runtime.Environment, id: u32, }; items: std.ArrayList(Entry), pub fn init(allocator: *std.mem.Allocator) Self { return Self{ .items = std.ArrayList(Entry).init(allocator), }; } pub fn deinit(self: *Self) void { self.items.deinit(); self.* = undefined; } /// Adds a new environment-id-pair to the map. /// Will return `error.IdAlreadyMapped` if a environment with this ID already exists, /// will return `error.EnvironmentAlreadyMapped` if the given environment is already in the map. /// Will return `error.OutOfMemory` when the internal storage cannot be resized. pub fn add(self: *Self, id: u32, env: *lola.runtime.Environment) !void { for (self.items.items) |item| { if (item.id == id) return error.IdAlreadyMapped; if (item.env == env) return error.EnvironmentAlreadyMapped; } try self.items.append(Entry{ .id = id, .env = env, }); } /// Returns the ID for the given environment or `null` if the environment was not registered. pub fn queryByPtr(self: Self, env: *lola.runtime.Environment) ?u32 { return for (self.items.items) |item| { if (item.env == env) break item.id; } else null; } /// Returns the Environment for the given id or `null` if the environment was not registered. pub fn queryById(self: Self, id: u32) ?*lola.runtime.Environment { return for (self.items.items) |item| { if (item.id == id) break item.env; } else null; } }; test "EnvironmentMap" { // three storage locations var env_1: lola.runtime.Environment = undefined; var env_2: lola.runtime.Environment = undefined; var env_3: lola.runtime.Environment = undefined; var map = EnvironmentMap.init(std.testing.allocator); defer map.deinit(); try map.add(1, &env_1); try map.add(2, &env_2); std.testing.expectEqual(@as(?*lola.runtime.Environment, &env_1), map.queryById(1)); std.testing.expectEqual(@as(?*lola.runtime.Environment, &env_2), map.queryById(2)); std.testing.expectEqual(@as(?*lola.runtime.Environment, null), map.queryById(3)); std.testing.expectEqual(@as(?u32, 1), map.queryByPtr(&env_1)); std.testing.expectEqual(@as(?u32, 2), map.queryByPtr(&env_2)); std.testing.expectEqual(@as(?u32, null), map.queryByPtr(&env_3)); }
src/library/runtime/environmentmap.zig
const std = @import("std"); const zang = @import("../zang.zig"); const ModuleParam = @import("parse.zig").ModuleParam; const ParamType = @import("parse.zig").ParamType; pub const BuiltinModule = struct { name: []const u8, params: []const ModuleParam, num_temps: usize, num_outputs: usize, }; pub const BuiltinEnum = struct { name: []const u8, zig_name: []const u8, values: []const BuiltinEnumValue, }; pub const BuiltinEnumValue = struct { label: []const u8, payload_type: enum { none, f32 }, }; fn getBuiltinEnumFromEnumInfo(comptime typeName: []const u8, comptime enum_info: std.builtin.TypeInfo.Enum) BuiltinEnum { comptime var values: [enum_info.fields.len]BuiltinEnumValue = undefined; inline for (enum_info.fields) |field, i| { values[i].label = field.name; values[i].payload_type = .none; } return .{ // assume it's one of the public enums (e.g. zang.FilterType) .name = typeName, .zig_name = "zang." ++ typeName, .values = &values, }; } fn getBuiltinEnumFromUnionInfo(comptime typeName: []const u8, comptime union_info: std.builtin.TypeInfo.Union) BuiltinEnum { comptime var values: [union_info.fields.len]BuiltinEnumValue = undefined; inline for (union_info.fields) |field, i| { values[i].label = field.name; values[i].payload_type = switch (field.field_type) { void => .none, f32 => .f32, else => @compileError("getBuiltinEnumFromUnionInfo: unsupported field_type: " ++ @typeName(field.field_type)), }; } return .{ // assume it's one of the public enums (e.g. zang.FilterType) .name = typeName, .zig_name = "zang." ++ typeName, .values = &values, }; } fn getBuiltinEnum(comptime T: type) BuiltinEnum { switch (@typeInfo(T)) { .Enum => |enum_info| return getBuiltinEnumFromEnumInfo(@typeName(T), enum_info), .Union => |union_info| return getBuiltinEnumFromUnionInfo(@typeName(T), union_info), else => @compileError("getBuiltinEnum: not an enum: " ++ @typeName(T)), } } // this also reads enums, separately from the global list of enums that we get for the builtin package. // but it's ok because zangscript compares enums "structurally". // (although i don't think zig does. so this might create zig errors if i try to codegen something // that uses enums with overlapping value names. not important now though because user-defined enums // are currently not supported, and so far no builtins have overlapping enums) fn getBuiltinParamType(comptime T: type) ParamType { return switch (T) { bool => .boolean, f32 => .constant, []const f32 => .buffer, zang.ConstantOrBuffer => .constant_or_buffer, []const zang.CurveNode => .curve, else => switch (@typeInfo(T)) { .Enum => |enum_info| return .{ .one_of = getBuiltinEnumFromEnumInfo(@typeName(T), enum_info) }, .Union => |union_info| return .{ .one_of = getBuiltinEnumFromUnionInfo(@typeName(T), union_info) }, else => @compileError("unsupported builtin field type: " ++ @typeName(T)), }, }; } pub fn getBuiltinModule(comptime T: type) BuiltinModule { const struct_fields = @typeInfo(T.Params).Struct.fields; comptime var params: [struct_fields.len]ModuleParam = undefined; inline for (struct_fields) |field, i| { params[i] = .{ .name = field.name, .param_type = getBuiltinParamType(field.field_type), }; } return .{ .name = @typeName(T), .params = &params, .num_temps = T.num_temps, .num_outputs = T.num_outputs, }; } pub const BuiltinPackage = struct { zig_package_name: []const u8, zig_import_path: []const u8, // relative to zang root dir builtins: []const BuiltinModule, enums: []const BuiltinEnum, }; pub const zang_builtin_package = BuiltinPackage{ .zig_package_name = "zang", .zig_import_path = "zang", .builtins = &[_]BuiltinModule{ getBuiltinModule(zang.Curve), getBuiltinModule(zang.Cycle), getBuiltinModule(zang.Decimator), getBuiltinModule(zang.Distortion), getBuiltinModule(zang.Envelope), getBuiltinModule(zang.Filter), getBuiltinModule(zang.Gate), getBuiltinModule(zang.Noise), getBuiltinModule(zang.Portamento), getBuiltinModule(zang.PulseOsc), // zang.Sampler getBuiltinModule(zang.SineOsc), getBuiltinModule(zang.TriSawOsc), }, .enums = &[_]BuiltinEnum{ getBuiltinEnum(zang.DistortionType), getBuiltinEnum(zang.FilterType), getBuiltinEnum(zang.NoiseColor), getBuiltinEnum(zang.PaintCurve), }, };
src/zangscript/builtins.zig
const std = @import("std"); const upaya = @import("upaya"); const Color = upaya.math.Color; usingnamespace upaya.imgui; const ToDoState = struct { todos: []ToDo = undefined, pub const ToDo = struct { label: [25]u8 = [_]u8{0} ** 25, done: bool = false, }; pub fn init() ToDoState { return .{ .todos = &[_]ToDo{} }; } pub fn deinit(self: ToDoState) void {} pub fn addToDo(self: *ToDoState) void { self.todos = upaya.mem.allocator.realloc(self.todos, self.todos.len + 1) catch unreachable; self.todos[self.todos.len - 1] = ToDoState.ToDo{}; } }; var state: ToDoState = undefined; pub fn main() !void { upaya.run(.{ .init = init, .update = update, .shutdown = shutdown, .docking = true, .setupDockLayout = setupDockLayout, .window_title = "Upaya ToDos", .width = 300, .height = 500, .swap_interval = 4, }); } fn init() void { upaya.colors.setTintColor(Color.aya.asImVec4()); // TODO: figure out why on windows [25]u8 is saved as an array and not a string if (std.Target.current.os.tag == .windows) { state = ToDoState.init(); } else { state = upaya.fs.readPrefsJson(ToDoState, "upaya-todo", "todos.json") catch |err| ToDoState.init(); } } fn update() void { upaya.menu.draw(&[_]upaya.MenuItem{.{ .label = "File", .children = &[_]upaya.MenuItem{ .{ .label = "New", .action = onNew }, .{ .label = "Quit", .action = onQuit }, }, }}); _ = igBegin("ToDos", null, ImGuiWindowFlags_None); defer igEnd(); for (state.todos) |*todo| { igPushIDPtr(todo); defer igPopID(); _ = igCheckbox("##cb", &todo.done); igSameLine(0, -1); if (todo.done) { var pos = ogGetCursorScreenPos(); pos.y += igGetFrameHeight() / 2; igText(&todo.label); var line_end = pos; line_end.x += 250; ImDrawList_AddLine(igGetWindowDrawList(), pos, line_end, Color.white.value, 1); } else { igSetNextItemWidth(-1); if (ogInputText("##input", &todo.label, todo.label.len)) { // TODO: why does windows not properly handle 0-terminated strings? todo.label[24] = 0; } } } } fn shutdown() void { upaya.fs.savePrefsJson("upaya-todo", "todos.json", state) catch unreachable; } fn setupDockLayout(id: ImGuiID) void { igDockBuilderDockWindow("ToDos", id); igDockBuilderFinish(id); } // Menu callbacks fn onQuit() void { upaya.quit(); } fn onNew() void { state.addToDo(); }
examples/todo.zig
const std = @import("std"); const geometry = @import("geometry.zig"); const Vec2 = geometry.Vec2; const Slope = geometry.Slope; // The algorithm works by dividing up the world around the origin into eight triangular // regions. Each region is bounded by one orthogonal line and one diagonal line, and // coordinates are transformed such that vision computation in each octave can treat the // orthogonal bounding line as 'y = 0' and and the diagonal bounding line is 'y = x'. const Octant = u3; fn adjustForOctant(origin: Vec2, o: Octant, p: Vec2) Vec2 { return origin.add(switch (o) { 0 => Vec2.new(p.x, -p.y), 1 => Vec2.new(p.y, -p.x), 2 => Vec2.new(-p.y, -p.x), 3 => Vec2.new(-p.x, -p.y), 4 => Vec2.new(-p.x, p.y), 5 => Vec2.new(-p.y, p.x), 6 => Vec2.new(p.y, p.x), 7 => Vec2.new(p.x, p.y), }); } // World should provide the following API: // fn isOpaque(self, Vec2) bool whether a given point is solid // fn magnitude(Vec2) u32 distance metric to origin // fn markVisible(self, Vec2) !void mark a given point as visible pub fn Visibility(comptime World: type, comptime Error: type) type { return struct { world: World, origin: Vec2, max_distance: u32, const Self = @This(); fn isOpaque(self: *Self, o: Octant, p: Vec2) bool { return self.world.isOpaque(adjustForOctant(self.origin, o, p)); } fn markVisible(self: *Self, o: Octant, p: Vec2) Error!void { return self.world.markVisible(adjustForOctant(self.origin, o, p)); } fn vec(x: i32, y: i32) Vec2 { return Vec2.new(@intCast(i16, x), @intCast(i16, y)); } fn slope(x: i32, y: i32) Slope { return Slope.new(@intCast(u16, x), @intCast(u16, y)); } /// Recursively add visible points in the sector bounded by the lines given by /// `top` and `bottom` and whose relative x coordinate is at least `min_x`. fn computeSector( self: *Self, oct: Octant, param_top: Slope, param_bottom: Slope, min_x: i32, max_x: i32, ) Error!void { var top = param_top; var bottom = param_bottom; var x = min_x; while (x < max_x) : (x += 1) { const column_top_y = if (top.numer == top.denom) x else blk: { const n = top.numer; const d = top.denom; var top_y = @intCast(i32, ((2 * @intCast(u32, x) - 1) * n + d) / (2 * d)); if (self.isOpaque(oct, vec(x, top_y))) { if (top.ge(slope(2 * top_y + 1, 2 * x)) and !self.isOpaque(oct, vec(x, top_y + 1))) top_y += 1; } else { var ax = 2 * x; if (self.isOpaque(oct, vec(x + 1, top_y + 1))) ax += 1; if (top.gt(slope(top_y + 1, ax))) top_y += 1; } break :blk top_y; }; const column_bottom_y = if (bottom.numer == 0) 0 else blk: { const n = bottom.numer; const d = bottom.denom; var bottom_y = @intCast(i32, ((2 * @intCast(u32, x) - 1) * n + d) / (2 * d)); if (bottom.ge(slope(2 * bottom_y + 1, 2 * x)) and self.isOpaque(oct, vec(x, bottom_y)) and !self.isOpaque(oct, vec(x, bottom_y + 1))) bottom_y += 1; break :blk bottom_y; }; var last_cell_was_opaque: ?bool = null; var y = column_top_y; while (y >= column_bottom_y) : (y -= 1) { const cell_loc = vec(x, y); if (World.magnitude(cell_loc) > self.max_distance) continue; { const cell_slope = slope(y, x); // check if this cell should be visible if ((y != column_top_y or top.ge(cell_slope)) and (y != column_bottom_y or cell_slope.ge(bottom))) try self.markVisible(oct, cell_loc); } const cell_is_opaque = self.isOpaque(oct, cell_loc); defer last_cell_was_opaque = cell_is_opaque; if (last_cell_was_opaque != !cell_is_opaque) continue; const mid_slope = slope(2 * y + 1, 2 * x); if (cell_is_opaque) if (top.gt(mid_slope)) if (y == column_bottom_y) { bottom = mid_slope; break; } else try self.computeSector(oct, top, mid_slope, x + 1, max_x) else if (y == column_bottom_y) return else {} else if (bottom.ge(mid_slope)) return else top = mid_slope; } if (last_cell_was_opaque != false) break; } } pub fn compute(self: *Self) Error!void { try self.world.markVisible(self.origin); const max_x = @intCast(i32, self.max_distance); var oct: Octant = 0; while (true) { try self.computeSector(oct, Slope.new(1, 1), Slope.new(0, 1), 1, max_x); if (oct == 7) break else oct += 1; } } }; } test "compilation" { std.testing.refAllDecls(@This()); std.testing.refAllDecls(Visibility(struct { const Self = @This(); fn isOpaque(self: Self, at: Vec2) bool { _ = self; _ = at; @panic("unimplemented"); } fn magnitude(at: Vec2) u32 { _ = at; @panic("unimplemented"); } fn markVisible(self: Self, at: Vec2) void { _ = self; _ = at; @panic("unimplemented"); } })); }
src/vision.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArgIterator = std.process.ArgIterator; const ArrayList = std.ArrayList; const CompTimeStringMap = std.CompTimeStringMap; const Writer = std.io.Writer; const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const fmt = std.fmt; const io = std.io; const mem = std.mem; const print = std.debug.print; const process = std.process; const talloc = std.testing.allocator; const ArgsList = ArrayList(Arg); pub const ArgumentError = error{ MissingExe, MissingFiles, InvalidFile, InvalidFiles, }; pub const ArgType = enum { File, Flag, Integer, Float, String, }; pub const Arg = struct { name: []const u8, arg_type: ArgType, short: []const u8 = "", desc: []const u8, is_req: bool, }; pub const ArgParser = struct { allocator: *Allocator, args: ArgsList, exe_name: []const u8 = "", exe_desc: []const u8 = "", pub fn init(a: *Allocator) !*ArgParser { var parser = try a.create(ArgParser); var args = ArgsList.init(a); parser.* = ArgParser{ .allocator = a, .args = args, }; return parser; } pub fn append(self: *ArgParser, arg: Arg) !void { try self.args.append(arg); } pub fn appendArgs(self: *ArgParser, args: []Arg) !void { for (args) |arg| { try self.append(arg); } } pub fn deinit(self: *ArgParser) void { self.args.deinit(); self.allocator.destroy(self); } pub fn usage(self: *ArgParser, buffer: anytype) !void { try fmt.format(buffer, \\{s} {s} \\Usage: {s} \\ Options: , .{ self.exe_name, self.exe_desc, self.exe_name }); } // NOTE(lbayes): std.os.args are: [][*:0]u8, we need to provide // an easy way to convert this to a slice of []const u8. pub fn parse(self: *ArgParser, input: [][]const u8) !void { // for (input) |arg| { // } // var segment = input.next(self.allocator); // while (segment != null) : (segment = input.next()) { // print("Seg: {s}\n", .{segment}); // } } }; const Tag = enum { BSlash, Char, Dash, Equal, FSlash, Quote, Space, End, }; const Token = struct { tag: Tag = undefined, start: usize, end: usize, value: u8 = '0', }; fn tokenize(a: *Allocator, arg: []const u8, tokens: []Token) ![]Token { if (arg.len == 0) { return tokens[0..0]; } var token_index: u32 = 0; var char_index: usize = 0; while (char_index < arg.len) { var char = arg[char_index]; var token = Token{ .start = char_index, .end = char_index + 1, .value = arg[char_index], }; switch (char) { '-' => { token.tag = Tag.Dash; }, ' ' => { token.tag = Tag.Space; }, '=' => { token.tag = Tag.Equal; }, '"' => { token.tag = Tag.Quote; }, else => { token.tag = Tag.Char; }, } tokens[token_index] = token; token_index += 1; char_index += 1; } // End EOF token to the end of result. var eof_token = Token{ .tag = Tag.End, .start = char_index, .end = char_index, .value = '\n', }; tokens[token_index] = eof_token; token_index += 1; return tokens[0..token_index]; } const LexState = enum { Ready, TakingDash, TakingName, TakingValue, TakingFlag, TakingString, }; const LexArg = struct { name: []u8 = "", value: []u8 = "", }; const LexError = error{ MissingName, MissingValue, UnexpectedValue, UnexpectedSymbol, }; const Lexer = struct { allocator: *Allocator, state: LexState = LexState.Ready, buffer: ArrayList(u8), result: []LexArg = undefined, pub fn init(a: *Allocator) !*Lexer { const instance = try a.create(Lexer); const buffer = ArrayList(u8).init(a); instance.* = Lexer{ .allocator = a, .buffer = buffer, }; return instance; } pub fn setState(self: *Lexer, state: LexState) ?LexState { self.state = state; switch (state) { LexState.Ready => {}, LexState.TakingDash => {}, LexState.TakingName => {}, LexState.TakingValue => {}, LexState.TakingFlag => {}, LexState.TakingString => {}, } return self.state; } fn handleToken(self: *Lexer, token: Token, arg: *LexArg) ?LexArg { return null; } pub fn deinit(self: *Lexer) void { for (self.result) |arg| { self.allocator.free(arg.name); if (arg.value.len > 0) { self.allocator.free(arg.value); } } self.allocator.destroy(self); } fn applyName(self: *Lexer, arg: *LexArg, buf: []u8) !void { arg.name = try self.allocator.alloc(u8, buf.len); mem.copy(u8, arg.name, buf); } fn applyValue(self: *Lexer, arg: *LexArg, buf: []u8) !void { arg.value = try self.allocator.alloc(u8, buf.len); mem.copy(u8, arg.value, buf); } pub fn lex(self: *Lexer, tokens: []Token, args: []LexArg) ![]LexArg { var buf: [256]u8 = undefined; var buf_index: usize = 0; var arg_index: usize = 0; var token_index: usize = 0; var arg: LexArg = undefined; while (token_index < tokens.len) { const token = tokens[token_index]; switch (token.tag) { Tag.Dash => { // Starting a new arg self.state = LexState.TakingName; }, Tag.Char => { // digest chars until space or equal buf[buf_index] = token.value; buf_index += 1; }, Tag.BSlash => { // digest chars until space or equal buf[buf_index] = token.value; buf_index += 1; }, Tag.FSlash => { // digest chars until space or equal buf[buf_index] = token.value; buf_index += 1; }, Tag.Space => { // TODO(lbayes): Handle escape sequences and inside quotations // TODO(lbayes): Handle boolean flags (i.e., no value segment) if (self.state == LexState.TakingName) { // arg = LexArg{}; // try self.applyName(&arg, buf[0..buf_index]); // buf_index = 0; // args[arg_index] = arg; // arg_index += 1; arg = LexArg{}; try self.applyName(&arg, buf[0..buf_index]); buf_index = 0; self.state = LexState.TakingValue; } else if (self.state == LexState.TakingValue) { try self.applyValue(&arg, buf[0..buf_index]); buf_index = 0; args[arg_index] = arg; arg_index += 1; self.state = LexState.Ready; } else { return LexError.UnexpectedSymbol; } }, Tag.Equal => { if (self.state == LexState.TakingName) { arg = LexArg{}; try self.applyName(&arg, buf[0..buf_index]); buf_index = 0; self.state = LexState.TakingValue; } else { return LexError.UnexpectedSymbol; } }, Tag.Quote => {}, Tag.End => { if (self.state == LexState.TakingName) { arg = LexArg{}; try self.applyName(&arg, buf[0..buf_index]); buf_index = 0; args[arg_index] = arg; arg_index += 1; } else if (self.state == LexState.TakingValue) { try self.applyValue(&arg, buf[0..buf_index]); buf_index = 0; args[arg_index] = arg; arg_index += 1; } }, } token_index += 1; } self.result = args[0..arg_index]; return self.result; } }; test "Lexer.lex name value othername othervalue" { var t_buf: [256]Token = undefined; var a_buf: [256]LexArg = undefined; const lexer = try Lexer.init(talloc); defer lexer.deinit(); var tokens = try tokenize(talloc, "--abcd efgh --ijkl mnop", &t_buf); const results = try lexer.lex(tokens[0..], &a_buf); try expectEqual(results.len, 2); var result = results[0]; try expectEqualStrings(result.name, "abcd"); try expectEqualStrings(result.value, "efgh"); } test "Lexer.lex name=value othername=othervalue" { var t_buf: [256]Token = undefined; var a_buf: [256]LexArg = undefined; const lexer = try Lexer.init(talloc); defer lexer.deinit(); var tokens = try tokenize(talloc, "--abcd=efgh --ijkl=mnop", &t_buf); const results = try lexer.lex(tokens[0..], &a_buf); try expectEqual(results.len, 2); var result = results[0]; try expectEqualStrings(result.name, "abcd"); try expectEqualStrings(result.value, "efgh"); } test "Lexer.lex name value" { var t_buf: [20]Token = undefined; var a_buf: [20]LexArg = undefined; const lexer = try Lexer.init(talloc); defer lexer.deinit(); var tokens = try tokenize(talloc, "--abcd efgh", &t_buf); const results = try lexer.lex(tokens[0..], &a_buf); try expectEqual(results.len, 1); var result = results[0]; try expectEqualStrings(result.name, "abcd"); try expectEqualStrings(result.value, "efgh"); } test "Lexer.lex name=value" { var t_buf: [20]Token = undefined; var a_buf: [20]LexArg = undefined; const lexer = try Lexer.init(talloc); defer lexer.deinit(); var tokens = try tokenize(talloc, "--abcd=efgh", &t_buf); const results = try lexer.lex(tokens[0..], &a_buf); try expectEqual(results.len, 1); var result = results[0]; try expectEqualStrings(result.name, "abcd"); try expectEqualStrings(result.value, "efgh"); } test "Lexer.lex bool arg" { var t_buf: [20]Token = undefined; var a_buf: [20]LexArg = undefined; const lexer = try Lexer.init(talloc); defer lexer.deinit(); var tokens = try tokenize(talloc, "--abcd", &t_buf); const results = try lexer.lex(tokens[0..], &a_buf); try expectEqual(results.len, 1); var result = results[0]; try expectEqualStrings(result.name, "abcd"); try expectEqualStrings(result.value, ""); } test "Lexer.lex empty tokens" { var t_buf: [20]Token = undefined; var a_buf: [20]LexArg = undefined; const lexer = try Lexer.init(talloc); defer lexer.deinit(); const args = try lexer.lex(t_buf[0..0], &a_buf); try expectEqual(args.len, 0); } test "tokenize works" { var buffer: [20]Token = undefined; const tokens = try tokenize(talloc, "--abcd", &buffer); // for (tokens) |token, index| { // print(">>>>>> FOUND: {any} {c} {d}\n", .{ token.tag, token.value, token.start }); // } try expectEqual(tokens.len, 7); try expectEqual(tokens[0].tag, Tag.Dash); try expectEqual(tokens[0].value, '-'); try expectEqual(tokens[1].tag, Tag.Dash); try expectEqual(tokens[1].value, '-'); try expectEqual(tokens[2].tag, Tag.Char); try expectEqual(tokens[2].value, 'a'); try expectEqual(tokens[3].tag, Tag.Char); try expectEqual(tokens[3].value, 'b'); try expectEqual(tokens[4].tag, Tag.Char); try expectEqual(tokens[4].value, 'c'); try expectEqual(tokens[5].tag, Tag.Char); try expectEqual(tokens[5].value, 'd'); try expectEqual(tokens[6].tag, Tag.End); try expectEqual(tokens[6].value, '\n'); } test "ArgParser is instantiable" { var p = try ArgParser.init(talloc); defer p.deinit(); p.exe_name = "abcd"; p.exe_desc = "Runs the abc's"; try expectEqualStrings(p.exe_name, "abcd"); try expectEqualStrings(p.exe_desc, "Runs the abc's"); } test "ArgParser append" { var p = try ArgParser.init(talloc); p.exe_name = "abcd"; p.exe_desc = "makes everything just a little more difficult"; defer p.deinit(); try p.append(.{ .arg_type = ArgType.String, .name = "foo", .short = "f", .desc = "Foo the foo", .is_req = true, }); try p.append(.{ .arg_type = ArgType.String, .name = "bar", .short = "b", .desc = "Bar the bar", .is_req = false, }); var buf: [512]u8 = undefined; var buf_stream = io.fixedBufferStream(&buf); var writer = buf_stream.writer(); try p.usage(writer); var lines = mem.split(buf_stream.getWritten(), "\n"); var line = try lines.next() orelse error.Fail; try expectEqualStrings(line, "abcd makes everything just a little more difficult"); line = try lines.next() orelse error.Fail; try expectEqualStrings(line, "Usage: abcd"); line = try lines.next() orelse error.Fail; try expectEqualStrings(line, " Options:"); var empty = lines.next(); try expect(empty == null); } test "ArgParser.parse" { var p = try ArgParser.init(talloc); p.exe_name = "abcd"; p.exe_desc = "makes everything just a little more difficult"; defer p.deinit(); try p.append(.{ .name = "name", .short = "n", .desc = "Name for the parameter", .is_req = true, .arg_type = ArgType.String, }); try p.append(.{ .name = "flag", .short = "f", .desc = "Do it if present", .is_req = false, .arg_type = ArgType.Flag, }); try p.append(.{ .name = "color", .short = "c", .desc = "Set the color", .is_req = false, .arg_type = ArgType.String, }); try p.append(.{ .name = "unused", .short = "u", .desc = "Unused param", .is_req = false, .arg_type = ArgType.String, }); var argv = [_][]const u8{ "cmd", "--name=efgh", "--bigflag", "--color", "green", }; var itr = try p.parse(argv[0..]); }
src/arg_parser.zig
const w4 = @import("../wasm4.zig"); const sprites = @import("../assets/sprites.zig"); const std = @import("std"); pub const Facing = enum { UP, DOWN, LEFT, RIGHT }; const SCREEN_SIZE: u8 = 160; pub const Projectile = struct { sprite: sprites.Image, x: u32, y: u32, xOff: u32 = 0, colors: u16 = 0x0432, velocity: u32 = 2, facing: Facing = .UP, player_targetable: bool = false, other_targetable: bool = false, pub fn init(sprite: sprites.Image, x: u32, y: u32, dir: Facing) Projectile { return Projectile{ .sprite = sprite, .x = x, .y = y, .facing = dir }; } pub fn update(self: *@This()) void { //self.draw(); self.move(); } pub fn draw(self: *const @This()) void { var flags: u32 = switch (self.facing) { .UP => 0x4, .DOWN => 0x0, .LEFT => 0b1100, .RIGHT => 0x8, }; w4.blitSub(self.sprite.data, @intCast(i32, self.x) - @divTrunc(self.sprite.width, 2), @intCast(i32, self.y), // x, y self.sprite.height, self.sprite.height, // w, h; Assumes square self.xOff, 0, // src_x, src_y self.sprite.width, // Assumes stride and width are equal self.sprite.flags | flags); } pub fn move(self: *@This()) void { w4.DRAW_COLORS.* = self.colors; switch (self.facing) { .UP => { self.y -= self.velocity; }, .DOWN => { self.y += self.velocity; }, .LEFT => { self.x -= self.velocity; }, .RIGHT => { self.x += self.velocity; }, } } pub fn inBounds(_: *const @This()) void { return true; } pub fn onScreen(self: *const @This()) bool { const y_good = self.y > 0 and self.y < SCREEN_SIZE; const x_good = self.x > 0 and self.x < SCREEN_SIZE; return y_good and x_good; } pub fn inArea(self: *const @This(), x: u8, y: u8, radius: u32) bool { const sqx: u32 = @intCast(u32, std.math.pow(i16, (@intCast(i16, x) - @intCast(i16, self.x)), 2)); const sqy: u32 = @intCast(u32, std.math.pow(i16, (@intCast(i16, y) - @intCast(i16, self.y)), 2)); return std.math.sqrt(sqx ^ 2 + sqy ^ 2) < radius; } };
src/components/projectile.zig
const kernel = @import("root").kernel; const Console = kernel.Console; const HexColor = Console.HexColor; const platform = @import("platform.zig"); const vbe = platform.vbe; const font = vbe.font; pub fn color_value_from_hex_color(hex_color: HexColor) u32 { return switch (hex_color) { HexColor.White => 0x00e8e6e3, HexColor.LightGray => 0x00D0CFCC, HexColor.DarkGray => 0x005E5C64, HexColor.Black => 0x00171421, HexColor.Red => 0x00C01C28, HexColor.Green => 0x0026A269, HexColor.Yellow => 0x00A2734C, HexColor.Blue => 0x0012488B, HexColor.Magenta => 0x00A347BA, HexColor.Cyan => 0x002AA1B3, HexColor.LightRed => 0x00F66151, HexColor.LightGreen => 0x0033DA7A, HexColor.LightYellow => 0x00E9AD0C, HexColor.LightBlue => 0x002A7BDE, HexColor.LightMagenta => 0x00C061CB, HexColor.LightCyan => 0x0033C7DE, }; } const default_fg_color = HexColor.Black; const default_fg_color_value = color_value_from_hex_color(default_fg_color); const default_bg_color = HexColor.White; const default_bg_color_value = color_value_from_hex_color(default_bg_color); var fg_color: HexColor = undefined; var bg_color: HexColor = undefined; var fg_color_value: u32 = undefined; var bg_color_value: u32 = undefined; pub var console = Console{ .place_impl = place_impl, .scroll_impl = scroll_impl, .set_hex_color_impl = set_hex_color_impl, .get_hex_color_impl = get_hex_color_impl, .reset_attributes_impl = reset_attributes_impl, .move_cursor_impl = move_cursor_impl, .show_cursor_impl = show_cursor_impl, .clear_screen_impl = clear_screen_impl, }; var text_buffer: [][]u8 = undefined; pub fn init(screen_width: u32, screen_height: u32) void { console.init(screen_width / font.width , screen_height / font.height); text_buffer = kernel.alloc.alloc_array([]u8, console.height) catch @panic("vbe_console text_buffer"); for (text_buffer) |*row| { row.* = kernel.alloc.alloc_array(u8, console.width) catch @panic("vbe_console text_buffer"); } clear_screen_impl(&console); } fn place_impl_no_flush(c: *Console, utf32_value: u32, row: u32, col: u32) void { _ = c; _ = utf32_value; const char = if (utf32_value >= ' ' and utf32_value <= 0x7e) @truncate(u8, utf32_value) else '?'; text_buffer[row][col] = char; const x = col * font.width; const y = row * font.height; _ = vbe.draw_glyph(x, y, char, fg_color_value, bg_color_value); } fn place_impl(c: *Console, utf32_value: u32, row: u32, col: u32) void { place_impl_no_flush(c, utf32_value, row, col); vbe.flush_buffer(); } pub fn set_hex_color_impl(c: *Console, color: HexColor, layer: Console.Layer) void { _ = c; if (layer == .Foreground) { fg_color = color; fg_color_value = color_value_from_hex_color(color); } else { bg_color = color; bg_color_value = color_value_from_hex_color(color); } } pub fn get_hex_color_impl(c: *Console, layer: Console.Layer) HexColor { _ = c; return if (layer == .Foreground) fg_color else bg_color; } pub fn reset_attributes_impl(c: *Console) void { c.set_hex_colors(default_fg_color, default_bg_color); } pub fn clear_screen_impl(c: *Console) void { _ = c; // vbe.fill_buffer(0xe8e6e3); vbe.fill_buffer(default_bg_color_value); for (text_buffer) |*row| { for (row.*) |*char| { char.* = 0; } } vbe.flush_buffer(); } pub fn move_cursor_impl(c: *Console, row: u32, col: u32) void { _ = c; _ = row; _ = col; } pub fn show_cursor_impl(c: *Console, show: bool) void { _ = c; _ = show; } fn get_text_buffer(row: u32, col: u32) u8 { return text_buffer[row][col]; } pub fn scroll_impl(c: *Console) void { _ = c; // vbe.fill_buffer(0xe8e6e3); vbe.fill_buffer(default_bg_color_value); // TODO: Like all the VBE operations, this is really really slow for (text_buffer[0..text_buffer.len - 1]) |*row, row_i| { for (row.*) |*char, col_i| { char.* = get_text_buffer(row_i + 1, col_i); if (char.* > 0) place_impl_no_flush(c, char.*, row_i, col_i); } } for (text_buffer[text_buffer.len - 1]) |*char| { char.* = 0; } vbe.flush_buffer(); }
kernel/platform/vbe_console.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const Allocator = mem.Allocator; const assert = debug.assert; const ArrayList = std.ArrayList; /// A buffer that allocates memory and maintains a null byte at the end. pub fn Buffer(comptime T: type) type { return struct { const Self = @This(); list: ArrayList(T), /// Must deinitialize with deinit. pub fn init(allocator: *Allocator, m: []const T) !Self { var self = try initSize(allocator, m.len); mem.copy(T, self.list.items, m); return self; } /// Must deinitialize with deinit. pub fn initSize(allocator: *Allocator, size: usize) !Self { var self = initNull(allocator); try self.resize(size); return self; } /// Must deinitialize with deinit. /// None of the other operations are valid until you do one of these: /// * ::replaceContents /// * ::resize pub fn initNull(allocator: *Allocator) Self { return Self{ .list = ArrayList(T).init(allocator) }; } /// Must deinitialize with deinit. pub fn initFromSelf(buffer: *const Self) !Self { return Self.init(buffer.list.allocator, buffer.toSliceConst()); } /// Self takes ownership of the passed in slice. The slice must have been /// allocated with `allocator`. /// Must deinitialize with deinit. pub fn fromOwnedSlice(allocator: *Allocator, slice: []T) !Self { var self = Self{ .list = ArrayList(T).fromOwnedSlice(allocator, slice) }; try self.list.append(0); return self; } /// The caller owns the returned memory. The Self becomes null and /// is safe to `deinit`. pub fn toOwnedSlice(self: *Self) []T { const allocator = self.list.allocator; const result = allocator.shrink(T, self.list.items, self.len()); self.* = initNull(allocator); return result; } pub fn allocPrint(allocator: *Allocator, comptime format: []const T, args: ...) !Self { const countSize = struct { fn countSize(size: *usize, bytes: []const T) (error{}!void) { size.* += bytes.len; } }.countSize; var size: usize = 0; std.fmt.format(&size, error{}, countSize, format, args) catch |err| switch (err) {}; var self = try Self.initSize(allocator, size); assert((std.fmt.bufPrint(self.list.items, format, args) catch unreachable).len == size); return self; } pub fn deinit(self: *Self) void { self.list.deinit(); } pub fn toSlice(self: *const Self) []T { return self.list.toSlice()[0..self.len()]; } pub fn toSliceConst(self: *const Self) []const T { return self.list.toSliceConst()[0..self.len()]; } pub fn shrink(self: *Self, new_len: usize) void { assert(new_len <= self.len()); self.list.shrink(new_len + 1); self.list.items[self.len()] = 0; } pub fn resize(self: *Self, new_len: usize) !void { try self.list.resize(new_len + 1); self.list.items[self.len()] = 0; } pub fn isNull(self: *const Self) bool { return self.list.len == 0; } pub fn len(self: *const Self) usize { return self.list.len - 1; } pub fn append(self: *Self, m: []const T) !void { const old_len = self.len(); try self.resize(old_len + m.len); mem.copy(T, self.list.toSlice()[old_len..], m); } pub fn appendByte(self: *Self, byte: T) !void { const old_len = self.len(); try self.resize(old_len + 1); self.list.toSlice()[old_len] = byte; } pub fn eql(self: *const Self, m: []const T) bool { return mem.eql(T, self.toSliceConst(), m); } pub fn startsWith(self: *const Self, m: []const T) bool { if (self.len() < m.len) return false; return mem.eql(T, self.list.items[0..m.len], m); } pub fn endsWith(self: *const Self, m: []const T) bool { const l = self.len(); if (l < m.len) return false; const start = l - m.len; return mem.eql(T, self.list.items[start..l], m); } pub fn replaceContents(self: *Self, m: []const T) !void { try self.resize(m.len); mem.copy(T, self.list.toSlice(), m); } /// For passing to C functions. pub fn ptr(self: *const Self) [*]T { return self.list.items.ptr; } }; }
src/buffer.zig
const std = @import("../std.zig"); const CpuFeature = std.Target.Cpu.Feature; const CpuModel = std.Target.Cpu.Model; pub const Feature = enum { a76, aes, aggressive_fma, alternate_sextload_cvt_f32_pattern, altnzcv, am, arith_bcc_fusion, arith_cbz_fusion, balance_fp_ops, bti, call_saved_x10, call_saved_x11, call_saved_x12, call_saved_x13, call_saved_x14, call_saved_x15, call_saved_x18, call_saved_x8, call_saved_x9, ccdp, ccidx, ccpp, complxnum, crc, crypto, custom_cheap_as_move, cyclone, disable_latency_sched_heuristic, dit, dotprod, exynos_cheap_as_move, exynosm4, fmi, force_32bit_jump_tables, fp_armv8, fp16fml, fptoint, fullfp16, fuse_address, fuse_aes, fuse_arith_logic, fuse_crypto_eor, fuse_csel, fuse_literals, jsconv, lor, lse, lsl_fast, mpam, mte, neon, no_neg_immediates, nv, pa, pan, pan_rwv, perfmon, predictable_select_expensive, predres, rand, ras, rasv8_4, rcpc, rcpc_immo, rdm, reserve_x1, reserve_x10, reserve_x11, reserve_x12, reserve_x13, reserve_x14, reserve_x15, reserve_x18, reserve_x2, reserve_x20, reserve_x21, reserve_x22, reserve_x23, reserve_x24, reserve_x25, reserve_x26, reserve_x27, reserve_x28, reserve_x3, reserve_x4, reserve_x5, reserve_x6, reserve_x7, reserve_x9, sb, sel2, sha2, sha3, slow_misaligned_128store, slow_paired_128, slow_strqro_store, sm4, spe, specrestrict, ssbs, strict_align, sve, sve2, sve2_aes, sve2_bitperm, sve2_sha3, sve2_sm4, tlb_rmi, tpidr_el1, tpidr_el2, tpidr_el3, tracev8_4, uaops, use_aa, use_postra_scheduler, use_reciprocal_square_root, v8a, v8_1a, v8_2a, v8_3a, v8_4a, v8_5a, vh, zcm, zcz, zcz_fp, zcz_fp_workaround, zcz_gp, }; pub usingnamespace CpuFeature.feature_set_fns(Feature); pub const all_features = blk: { @setEvalBranchQuota(2000); const len = @typeInfo(Feature).Enum.fields.len; std.debug.assert(len <= CpuFeature.Set.needed_bit_count); var result: [len]CpuFeature = undefined; result[@enumToInt(Feature.a76)] = .{ .llvm_name = "a76", .description = "Cortex-A76 ARM processors", .dependencies = featureSet(&[_]Feature{ .crypto, .dotprod, .fullfp16, .rcpc, .ssbs, .v8_2a, }), }; result[@enumToInt(Feature.aes)] = .{ .llvm_name = "aes", .description = "Enable AES support", .dependencies = featureSet(&[_]Feature{ .neon, }), }; result[@enumToInt(Feature.aggressive_fma)] = .{ .llvm_name = "aggressive-fma", .description = "Enable Aggressive FMA for floating-point.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.alternate_sextload_cvt_f32_pattern)] = .{ .llvm_name = "alternate-sextload-cvt-f32-pattern", .description = "Use alternative pattern for sextload convert to f32", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.altnzcv)] = .{ .llvm_name = "altnzcv", .description = "Enable alternative NZCV format for floating point comparisons", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.am)] = .{ .llvm_name = "am", .description = "Enable v8.4-A Activity Monitors extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.arith_bcc_fusion)] = .{ .llvm_name = "arith-bcc-fusion", .description = "CPU fuses arithmetic+bcc operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.arith_cbz_fusion)] = .{ .llvm_name = "arith-cbz-fusion", .description = "CPU fuses arithmetic + cbz/cbnz operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.balance_fp_ops)] = .{ .llvm_name = "balance-fp-ops", .description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.bti)] = .{ .llvm_name = "bti", .description = "Enable Branch Target Identification", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x10)] = .{ .llvm_name = "call-saved-x10", .description = "Make X10 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x11)] = .{ .llvm_name = "call-saved-x11", .description = "Make X11 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x12)] = .{ .llvm_name = "call-saved-x12", .description = "Make X12 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x13)] = .{ .llvm_name = "call-saved-x13", .description = "Make X13 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x14)] = .{ .llvm_name = "call-saved-x14", .description = "Make X14 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x15)] = .{ .llvm_name = "call-saved-x15", .description = "Make X15 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x18)] = .{ .llvm_name = "call-saved-x18", .description = "Make X18 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x8)] = .{ .llvm_name = "call-saved-x8", .description = "Make X8 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.call_saved_x9)] = .{ .llvm_name = "call-saved-x9", .description = "Make X9 callee saved.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ccdp)] = .{ .llvm_name = "ccdp", .description = "Enable v8.5 Cache Clean to Point of Deep Persistence", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ccidx)] = .{ .llvm_name = "ccidx", .description = "Enable v8.3-A Extend of the CCSIDR number of sets", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ccpp)] = .{ .llvm_name = "ccpp", .description = "Enable v8.2 data Cache Clean to Point of Persistence", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.complxnum)] = .{ .llvm_name = "complxnum", .description = "Enable v8.3-A Floating-point complex number support", .dependencies = featureSet(&[_]Feature{ .neon, }), }; result[@enumToInt(Feature.crc)] = .{ .llvm_name = "crc", .description = "Enable ARMv8 CRC-32 checksum instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.crypto)] = .{ .llvm_name = "crypto", .description = "Enable cryptographic instructions", .dependencies = featureSet(&[_]Feature{ .aes, .neon, .sha2, }), }; result[@enumToInt(Feature.custom_cheap_as_move)] = .{ .llvm_name = "custom-cheap-as-move", .description = "Use custom handling of cheap instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.cyclone)] = .{ .llvm_name = "cyclone", .description = "Cyclone", .dependencies = featureSet(&[_]Feature{ .alternate_sextload_cvt_f32_pattern, .arith_bcc_fusion, .arith_cbz_fusion, .crypto, .disable_latency_sched_heuristic, .fuse_aes, .fuse_crypto_eor, .perfmon, .v8a, .zcm, .zcz, .zcz_fp_workaround, }), }; result[@enumToInt(Feature.disable_latency_sched_heuristic)] = .{ .llvm_name = "disable-latency-sched-heuristic", .description = "Disable latency scheduling heuristic", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.dit)] = .{ .llvm_name = "dit", .description = "Enable v8.4-A Data Independent Timing instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.dotprod)] = .{ .llvm_name = "dotprod", .description = "Enable dot product support", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.exynos_cheap_as_move)] = .{ .llvm_name = "exynos-cheap-as-move", .description = "Use Exynos specific handling of cheap instructions", .dependencies = featureSet(&[_]Feature{ .custom_cheap_as_move, }), }; result[@enumToInt(Feature.exynosm4)] = .{ .llvm_name = "exynosm4", .description = "Samsung Exynos-M4 processors", .dependencies = featureSet(&[_]Feature{ .arith_bcc_fusion, .arith_cbz_fusion, .crypto, .dotprod, .exynos_cheap_as_move, .force_32bit_jump_tables, .fullfp16, .fuse_address, .fuse_aes, .fuse_arith_logic, .fuse_csel, .fuse_literals, .lsl_fast, .perfmon, .use_postra_scheduler, .v8_2a, .zcz, }), }; result[@enumToInt(Feature.fmi)] = .{ .llvm_name = "fmi", .description = "Enable v8.4-A Flag Manipulation Instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.force_32bit_jump_tables)] = .{ .llvm_name = "force-32bit-jump-tables", .description = "Force jump table entries to be 32-bits wide except at MinSize", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fp_armv8)] = .{ .llvm_name = "fp-armv8", .description = "Enable ARMv8 FP", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fp16fml)] = .{ .llvm_name = "fp16fml", .description = "Enable FP16 FML instructions", .dependencies = featureSet(&[_]Feature{ .fullfp16, }), }; result[@enumToInt(Feature.fptoint)] = .{ .llvm_name = "fptoint", .description = "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fullfp16)] = .{ .llvm_name = "fullfp16", .description = "Full FP16", .dependencies = featureSet(&[_]Feature{ .fp_armv8, }), }; result[@enumToInt(Feature.fuse_address)] = .{ .llvm_name = "fuse-address", .description = "CPU fuses address generation and memory operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fuse_aes)] = .{ .llvm_name = "fuse-aes", .description = "CPU fuses AES crypto operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fuse_arith_logic)] = .{ .llvm_name = "fuse-arith-logic", .description = "CPU fuses arithmetic and logic operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fuse_crypto_eor)] = .{ .llvm_name = "fuse-crypto-eor", .description = "CPU fuses AES/PMULL and EOR operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fuse_csel)] = .{ .llvm_name = "fuse-csel", .description = "CPU fuses conditional select operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.fuse_literals)] = .{ .llvm_name = "fuse-literals", .description = "CPU fuses literal generation operations", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.jsconv)] = .{ .llvm_name = "jsconv", .description = "Enable v8.3-A JavaScript FP conversion enchancement", .dependencies = featureSet(&[_]Feature{ .fp_armv8, }), }; result[@enumToInt(Feature.lor)] = .{ .llvm_name = "lor", .description = "Enables ARM v8.1 Limited Ordering Regions extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.lse)] = .{ .llvm_name = "lse", .description = "Enable ARMv8.1 Large System Extension (LSE) atomic instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.lsl_fast)] = .{ .llvm_name = "lsl-fast", .description = "CPU has a fastpath logical shift of up to 3 places", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.mpam)] = .{ .llvm_name = "mpam", .description = "Enable v8.4-A Memory system Partitioning and Monitoring extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.mte)] = .{ .llvm_name = "mte", .description = "Enable Memory Tagging Extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.neon)] = .{ .llvm_name = "neon", .description = "Enable Advanced SIMD instructions", .dependencies = featureSet(&[_]Feature{ .fp_armv8, }), }; result[@enumToInt(Feature.no_neg_immediates)] = .{ .llvm_name = "no-neg-immediates", .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.nv)] = .{ .llvm_name = "nv", .description = "Enable v8.4-A Nested Virtualization Enchancement", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.pa)] = .{ .llvm_name = "pa", .description = "Enable v8.3-A Pointer Authentication enchancement", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.pan)] = .{ .llvm_name = "pan", .description = "Enables ARM v8.1 Privileged Access-Never extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.pan_rwv)] = .{ .llvm_name = "pan-rwv", .description = "Enable v8.2 PAN s1e1R and s1e1W Variants", .dependencies = featureSet(&[_]Feature{ .pan, }), }; result[@enumToInt(Feature.perfmon)] = .{ .llvm_name = "perfmon", .description = "Enable ARMv8 PMUv3 Performance Monitors extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.predictable_select_expensive)] = .{ .llvm_name = "predictable-select-expensive", .description = "Prefer likely predicted branches over selects", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.predres)] = .{ .llvm_name = "predres", .description = "Enable v8.5a execution and data prediction invalidation instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.rand)] = .{ .llvm_name = "rand", .description = "Enable Random Number generation instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ras)] = .{ .llvm_name = "ras", .description = "Enable ARMv8 Reliability, Availability and Serviceability Extensions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.rasv8_4)] = .{ .llvm_name = "rasv8_4", .description = "Enable v8.4-A Reliability, Availability and Serviceability extension", .dependencies = featureSet(&[_]Feature{ .ras, }), }; result[@enumToInt(Feature.rcpc)] = .{ .llvm_name = "rcpc", .description = "Enable support for RCPC extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.rcpc_immo)] = .{ .llvm_name = "rcpc-immo", .description = "Enable v8.4-A RCPC instructions with Immediate Offsets", .dependencies = featureSet(&[_]Feature{ .rcpc, }), }; result[@enumToInt(Feature.rdm)] = .{ .llvm_name = "rdm", .description = "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x1)] = .{ .llvm_name = "reserve-x1", .description = "Reserve X1, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x10)] = .{ .llvm_name = "reserve-x10", .description = "Reserve X10, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x11)] = .{ .llvm_name = "reserve-x11", .description = "Reserve X11, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x12)] = .{ .llvm_name = "reserve-x12", .description = "Reserve X12, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x13)] = .{ .llvm_name = "reserve-x13", .description = "Reserve X13, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x14)] = .{ .llvm_name = "reserve-x14", .description = "Reserve X14, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x15)] = .{ .llvm_name = "reserve-x15", .description = "Reserve X15, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x18)] = .{ .llvm_name = "reserve-x18", .description = "Reserve X18, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x2)] = .{ .llvm_name = "reserve-x2", .description = "Reserve X2, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x20)] = .{ .llvm_name = "reserve-x20", .description = "Reserve X20, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x21)] = .{ .llvm_name = "reserve-x21", .description = "Reserve X21, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x22)] = .{ .llvm_name = "reserve-x22", .description = "Reserve X22, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x23)] = .{ .llvm_name = "reserve-x23", .description = "Reserve X23, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x24)] = .{ .llvm_name = "reserve-x24", .description = "Reserve X24, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x25)] = .{ .llvm_name = "reserve-x25", .description = "Reserve X25, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x26)] = .{ .llvm_name = "reserve-x26", .description = "Reserve X26, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x27)] = .{ .llvm_name = "reserve-x27", .description = "Reserve X27, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x28)] = .{ .llvm_name = "reserve-x28", .description = "Reserve X28, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x3)] = .{ .llvm_name = "reserve-x3", .description = "Reserve X3, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x4)] = .{ .llvm_name = "reserve-x4", .description = "Reserve X4, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x5)] = .{ .llvm_name = "reserve-x5", .description = "Reserve X5, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x6)] = .{ .llvm_name = "reserve-x6", .description = "Reserve X6, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x7)] = .{ .llvm_name = "reserve-x7", .description = "Reserve X7, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.reserve_x9)] = .{ .llvm_name = "reserve-x9", .description = "Reserve X9, making it unavailable as a GPR", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sb)] = .{ .llvm_name = "sb", .description = "Enable v8.5 Speculation Barrier", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sel2)] = .{ .llvm_name = "sel2", .description = "Enable v8.4-A Secure Exception Level 2 extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sha2)] = .{ .llvm_name = "sha2", .description = "Enable SHA1 and SHA256 support", .dependencies = featureSet(&[_]Feature{ .neon, }), }; result[@enumToInt(Feature.sha3)] = .{ .llvm_name = "sha3", .description = "Enable SHA512 and SHA3 support", .dependencies = featureSet(&[_]Feature{ .neon, .sha2, }), }; result[@enumToInt(Feature.slow_misaligned_128store)] = .{ .llvm_name = "slow-misaligned-128store", .description = "Misaligned 128 bit stores are slow", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.slow_paired_128)] = .{ .llvm_name = "slow-paired-128", .description = "Paired 128 bit loads and stores are slow", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.slow_strqro_store)] = .{ .llvm_name = "slow-strqro-store", .description = "STR of Q register with register offset is slow", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm4)] = .{ .llvm_name = "sm4", .description = "Enable SM3 and SM4 support", .dependencies = featureSet(&[_]Feature{ .neon, }), }; result[@enumToInt(Feature.spe)] = .{ .llvm_name = "spe", .description = "Enable Statistical Profiling extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.specrestrict)] = .{ .llvm_name = "specrestrict", .description = "Enable architectural speculation restriction", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ssbs)] = .{ .llvm_name = "ssbs", .description = "Enable Speculative Store Bypass Safe bit", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.strict_align)] = .{ .llvm_name = "strict-align", .description = "Disallow all unaligned memory access", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sve)] = .{ .llvm_name = "sve", .description = "Enable Scalable Vector Extension (SVE) instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sve2)] = .{ .llvm_name = "sve2", .description = "Enable Scalable Vector Extension 2 (SVE2) instructions", .dependencies = featureSet(&[_]Feature{ .sve, }), }; result[@enumToInt(Feature.sve2_aes)] = .{ .llvm_name = "sve2-aes", .description = "Enable AES SVE2 instructions", .dependencies = featureSet(&[_]Feature{ .aes, .sve2, }), }; result[@enumToInt(Feature.sve2_bitperm)] = .{ .llvm_name = "sve2-bitperm", .description = "Enable bit permutation SVE2 instructions", .dependencies = featureSet(&[_]Feature{ .sve2, }), }; result[@enumToInt(Feature.sve2_sha3)] = .{ .llvm_name = "sve2-sha3", .description = "Enable SHA3 SVE2 instructions", .dependencies = featureSet(&[_]Feature{ .sha3, .sve2, }), }; result[@enumToInt(Feature.sve2_sm4)] = .{ .llvm_name = "sve2-sm4", .description = "Enable SM4 SVE2 instructions", .dependencies = featureSet(&[_]Feature{ .sm4, .sve2, }), }; result[@enumToInt(Feature.tlb_rmi)] = .{ .llvm_name = "tlb-rmi", .description = "Enable v8.4-A TLB Range and Maintenance Instructions", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.tpidr_el1)] = .{ .llvm_name = "tpidr-el1", .description = "Permit use of TPIDR_EL1 for the TLS base", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.tpidr_el2)] = .{ .llvm_name = "tpidr-el2", .description = "Permit use of TPIDR_EL2 for the TLS base", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.tpidr_el3)] = .{ .llvm_name = "tpidr-el3", .description = "Permit use of TPIDR_EL3 for the TLS base", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.tracev8_4)] = .{ .llvm_name = "tracev8.4", .description = "Enable v8.4-A Trace extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.uaops)] = .{ .llvm_name = "uaops", .description = "Enable v8.2 UAO PState", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.use_aa)] = .{ .llvm_name = "use-aa", .description = "Use alias analysis during codegen", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.use_postra_scheduler)] = .{ .llvm_name = "use-postra-scheduler", .description = "Schedule again after register allocation", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.use_reciprocal_square_root)] = .{ .llvm_name = "use-reciprocal-square-root", .description = "Use the reciprocal square root approximation", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.v8a)] = .{ .llvm_name = null, .description = "Support ARM v8a instructions", .dependencies = featureSet(&[_]Feature{ .fp_armv8, .neon, }), }; result[@enumToInt(Feature.v8_1a)] = .{ .llvm_name = "v8.1a", .description = "Support ARM v8.1a instructions", .dependencies = featureSet(&[_]Feature{ .crc, .lor, .lse, .pan, .rdm, .vh, .v8a, }), }; result[@enumToInt(Feature.v8_2a)] = .{ .llvm_name = "v8.2a", .description = "Support ARM v8.2a instructions", .dependencies = featureSet(&[_]Feature{ .ccpp, .pan_rwv, .ras, .uaops, .v8_1a, }), }; result[@enumToInt(Feature.v8_3a)] = .{ .llvm_name = "v8.3a", .description = "Support ARM v8.3a instructions", .dependencies = featureSet(&[_]Feature{ .ccidx, .complxnum, .jsconv, .pa, .rcpc, .v8_2a, }), }; result[@enumToInt(Feature.v8_4a)] = .{ .llvm_name = "v8.4a", .description = "Support ARM v8.4a instructions", .dependencies = featureSet(&[_]Feature{ .am, .dit, .dotprod, .fmi, .mpam, .nv, .rasv8_4, .rcpc_immo, .sel2, .tlb_rmi, .tracev8_4, .v8_3a, }), }; result[@enumToInt(Feature.v8_5a)] = .{ .llvm_name = "v8.5a", .description = "Support ARM v8.5a instructions", .dependencies = featureSet(&[_]Feature{ .altnzcv, .bti, .ccdp, .fptoint, .predres, .sb, .specrestrict, .ssbs, .v8_4a, }), }; result[@enumToInt(Feature.vh)] = .{ .llvm_name = "vh", .description = "Enables ARM v8.1 Virtual Host extension", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.zcm)] = .{ .llvm_name = "zcm", .description = "Has zero-cycle register moves", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.zcz)] = .{ .llvm_name = "zcz", .description = "Has zero-cycle zeroing instructions", .dependencies = featureSet(&[_]Feature{ .zcz_fp, .zcz_gp, }), }; result[@enumToInt(Feature.zcz_fp)] = .{ .llvm_name = "zcz-fp", .description = "Has zero-cycle zeroing instructions for FP registers", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.zcz_fp_workaround)] = .{ .llvm_name = "zcz-fp-workaround", .description = "The zero-cycle floating-point zeroing instruction has a bug", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.zcz_gp)] = .{ .llvm_name = "zcz-gp", .description = "Has zero-cycle zeroing instructions for generic registers", .dependencies = featureSet(&[_]Feature{}), }; const ti = @typeInfo(Feature); for (result) |*elem, i| { elem.index = i; elem.name = ti.Enum.fields[i].name; } break :blk result; }; pub const cpu = struct { pub const apple_latest = CpuModel{ .name = "apple_latest", .llvm_name = "apple-latest", .features = featureSet(&[_]Feature{ .cyclone, }), }; pub const cortex_a35 = CpuModel{ .name = "cortex_a35", .llvm_name = "cortex-a35", .features = featureSet(&[_]Feature{ .crc, .crypto, .perfmon, .v8a, }), }; pub const cortex_a53 = CpuModel{ .name = "cortex_a53", .llvm_name = "cortex-a53", .features = featureSet(&[_]Feature{ .balance_fp_ops, .crc, .crypto, .custom_cheap_as_move, .fuse_aes, .perfmon, .use_aa, .use_postra_scheduler, .v8a, }), }; pub const cortex_a55 = CpuModel{ .name = "cortex_a55", .llvm_name = "cortex-a55", .features = featureSet(&[_]Feature{ .crypto, .dotprod, .fullfp16, .fuse_aes, .perfmon, .rcpc, .v8_2a, }), }; pub const cortex_a57 = CpuModel{ .name = "cortex_a57", .llvm_name = "cortex-a57", .features = featureSet(&[_]Feature{ .balance_fp_ops, .crc, .crypto, .custom_cheap_as_move, .fuse_aes, .fuse_literals, .perfmon, .predictable_select_expensive, .use_postra_scheduler, .v8a, }), }; pub const cortex_a72 = CpuModel{ .name = "cortex_a72", .llvm_name = "cortex-a72", .features = featureSet(&[_]Feature{ .crc, .crypto, .fuse_aes, .perfmon, .v8a, }), }; pub const cortex_a73 = CpuModel{ .name = "cortex_a73", .llvm_name = "cortex-a73", .features = featureSet(&[_]Feature{ .crc, .crypto, .fuse_aes, .perfmon, .v8a, }), }; pub const cortex_a75 = CpuModel{ .name = "cortex_a75", .llvm_name = "cortex-a75", .features = featureSet(&[_]Feature{ .crypto, .dotprod, .fullfp16, .fuse_aes, .perfmon, .rcpc, .v8_2a, }), }; pub const cortex_a76 = CpuModel{ .name = "cortex_a76", .llvm_name = "cortex-a76", .features = featureSet(&[_]Feature{ .a76, }), }; pub const cortex_a76ae = CpuModel{ .name = "cortex_a76ae", .llvm_name = "cortex-a76ae", .features = featureSet(&[_]Feature{ .a76, }), }; pub const cyclone = CpuModel{ .name = "cyclone", .llvm_name = "cyclone", .features = featureSet(&[_]Feature{ .cyclone, }), }; pub const exynos_m1 = CpuModel{ .name = "exynos_m1", .llvm_name = "exynos-m1", .features = featureSet(&[_]Feature{ .crc, .crypto, .exynos_cheap_as_move, .force_32bit_jump_tables, .fuse_aes, .perfmon, .slow_misaligned_128store, .slow_paired_128, .use_postra_scheduler, .use_reciprocal_square_root, .v8a, .zcz_fp, }), }; pub const exynos_m2 = CpuModel{ .name = "exynos_m2", .llvm_name = "exynos-m2", .features = featureSet(&[_]Feature{ .crc, .crypto, .exynos_cheap_as_move, .force_32bit_jump_tables, .fuse_aes, .perfmon, .slow_misaligned_128store, .slow_paired_128, .use_postra_scheduler, .v8a, .zcz_fp, }), }; pub const exynos_m3 = CpuModel{ .name = "exynos_m3", .llvm_name = "exynos-m3", .features = featureSet(&[_]Feature{ .crc, .crypto, .exynos_cheap_as_move, .force_32bit_jump_tables, .fuse_address, .fuse_aes, .fuse_csel, .fuse_literals, .lsl_fast, .perfmon, .predictable_select_expensive, .use_postra_scheduler, .v8a, .zcz_fp, }), }; pub const exynos_m4 = CpuModel{ .name = "exynos_m4", .llvm_name = "exynos-m4", .features = featureSet(&[_]Feature{ .exynosm4, }), }; pub const exynos_m5 = CpuModel{ .name = "exynos_m5", .llvm_name = "exynos-m5", .features = featureSet(&[_]Feature{ .exynosm4, }), }; pub const falkor = CpuModel{ .name = "falkor", .llvm_name = "falkor", .features = featureSet(&[_]Feature{ .crc, .crypto, .custom_cheap_as_move, .lsl_fast, .perfmon, .predictable_select_expensive, .rdm, .slow_strqro_store, .use_postra_scheduler, .v8a, .zcz, }), }; pub const generic = CpuModel{ .name = "generic", .llvm_name = "generic", .features = featureSet(&[_]Feature{ .fuse_aes, .perfmon, .use_postra_scheduler, .v8a, }), }; pub const kryo = CpuModel{ .name = "kryo", .llvm_name = "kryo", .features = featureSet(&[_]Feature{ .crc, .crypto, .custom_cheap_as_move, .lsl_fast, .perfmon, .predictable_select_expensive, .use_postra_scheduler, .zcz, .v8a, }), }; pub const saphira = CpuModel{ .name = "saphira", .llvm_name = "saphira", .features = featureSet(&[_]Feature{ .crypto, .custom_cheap_as_move, .lsl_fast, .perfmon, .predictable_select_expensive, .spe, .use_postra_scheduler, .v8_4a, .zcz, }), }; pub const thunderx = CpuModel{ .name = "thunderx", .llvm_name = "thunderx", .features = featureSet(&[_]Feature{ .crc, .crypto, .perfmon, .predictable_select_expensive, .use_postra_scheduler, .v8a, }), }; pub const thunderx2t99 = CpuModel{ .name = "thunderx2t99", .llvm_name = "thunderx2t99", .features = featureSet(&[_]Feature{ .aggressive_fma, .arith_bcc_fusion, .crc, .crypto, .lse, .predictable_select_expensive, .use_postra_scheduler, .v8_1a, }), }; pub const thunderxt81 = CpuModel{ .name = "thunderxt81", .llvm_name = "thunderxt81", .features = featureSet(&[_]Feature{ .crc, .crypto, .perfmon, .predictable_select_expensive, .use_postra_scheduler, .v8a, }), }; pub const thunderxt83 = CpuModel{ .name = "thunderxt83", .llvm_name = "thunderxt83", .features = featureSet(&[_]Feature{ .crc, .crypto, .perfmon, .predictable_select_expensive, .use_postra_scheduler, .v8a, }), }; pub const thunderxt88 = CpuModel{ .name = "thunderxt88", .llvm_name = "thunderxt88", .features = featureSet(&[_]Feature{ .crc, .crypto, .perfmon, .predictable_select_expensive, .use_postra_scheduler, .v8a, }), }; pub const tsv110 = CpuModel{ .name = "tsv110", .llvm_name = "tsv110", .features = featureSet(&[_]Feature{ .crypto, .custom_cheap_as_move, .dotprod, .fp16fml, .fullfp16, .fuse_aes, .perfmon, .spe, .use_postra_scheduler, .v8_2a, }), }; }; /// All aarch64 CPUs, sorted alphabetically by name. /// TODO: Replace this with usage of `std.meta.declList`. It does work, but stage1 /// compiler has inefficient memory and CPU usage, affecting build times. pub const all_cpus = &[_]*const CpuModel{ &cpu.apple_latest, &cpu.cortex_a35, &cpu.cortex_a53, &cpu.cortex_a55, &cpu.cortex_a57, &cpu.cortex_a72, &cpu.cortex_a73, &cpu.cortex_a75, &cpu.cortex_a76, &cpu.cortex_a76ae, &cpu.cyclone, &cpu.exynos_m1, &cpu.exynos_m2, &cpu.exynos_m3, &cpu.exynos_m4, &cpu.exynos_m5, &cpu.falkor, &cpu.generic, &cpu.kryo, &cpu.saphira, &cpu.thunderx, &cpu.thunderx2t99, &cpu.thunderxt81, &cpu.thunderxt83, &cpu.thunderxt88, &cpu.tsv110, };
lib/std/target/aarch64.zig
extern fn sceRtcGetTickResolution() u32; extern fn sceRtcGetCurrentTick(tick: *u64) c_int; extern fn scePowerSetClockFrequency(pllfreq: c_int, cpufreq: c_int, busfreq: c_int) c_int; /// Required variables var currentTime: u64 = 0; // What is the current time var tickRate: u32 = 0; // RTC tick rate var lastTick: u64 = 0; // Last tick var lastUsage: f64 = 0; // Last CPU Usage % var cpuFreq: c_int = 333; // Current CPU Frequency var cpuTargetUtil: f64 = 0.70; //Targeted utilization (0.7 = 70%) /// Returns the CPU frequency pub fn getCpuFreq() c_int{ return cpuFreq; } /// Returns the CPU Usage pub fn getUsage() f64 { return lastUsage; } /// Sets the CPU frequency (internal) fn setCpuFreq(newFreq: c_int) void { if(newFreq <= 333){ cpuFreq = newFreq; var stat = scePowerSetClockFrequency(newFreq, newFreq, @divFloor(newFreq, 2)); }else{ cpuFreq = 333; _ = scePowerSetClockFrequency(333, 333, 166); } } /// Sets the targeted utilization pub fn setUsageTarget(target: f64) void { cpuTargetUtil = target; } // Initializes the powerscale module pub fn init() void { tickRate = sceRtcGetTickResolution(); _ = sceRtcGetCurrentTick(&currentTime); setCpuFreq(333); } /// Terminates the module and sets frequency to 333 mhz pub fn deinit() void { setCpuFreq(333); //Set this up just in case. } /// Starts a recording pub fn startRecord() void { _ = sceRtcGetCurrentTick(&lastTick); } /// Ends Recording pub fn endRecord() void { // Get our tick _ = sceRtcGetCurrentTick(&currentTime); // Calculate delta ticks var delta = @intToFloat(f64, @intCast(i64, currentTime) - @intCast(i64, lastTick)); // Calculate total time taken in seconds var timeTaken: f64 = delta / @intToFloat(f64, tickRate); // Utilization = timeTaken / fpsTarget var timeUtil = timeTaken / (1 / 60.0); // Difference from desired CPU utilization var utilDiff = timeUtil - cpuTargetUtil; lastUsage = timeUtil; // Frequency = current frequency + (current frequency / 0.5) * difference in utilization. var newFreqCalc = @floatToInt(c_int, @intToFloat(f64, cpuFreq) + @intToFloat(f64, cpuFreq)/2.0 * utilDiff); // Limit the end result if(newFreqCalc < 20){ newFreqCalc = 20; } if(newFreqCalc > 333){ newFreqCalc = 333; } // Set the new frequency setCpuFreq(newFreqCalc); }
src/powerscale.zig
const std = @import("../std.zig"); const CpuFeature = std.Target.Cpu.Feature; const CpuModel = std.Target.Cpu.Model; pub const Feature = enum { ptx32, ptx40, ptx41, ptx42, ptx43, ptx50, ptx60, ptx61, ptx63, ptx64, sm_20, sm_21, sm_30, sm_32, sm_35, sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, }; pub usingnamespace CpuFeature.feature_set_fns(Feature); pub const all_features = blk: { const len = @typeInfo(Feature).Enum.fields.len; std.debug.assert(len <= CpuFeature.Set.needed_bit_count); var result: [len]CpuFeature = undefined; result[@enumToInt(Feature.ptx32)] = .{ .llvm_name = "ptx32", .description = "Use PTX version 3.2", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx40)] = .{ .llvm_name = "ptx40", .description = "Use PTX version 4.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx41)] = .{ .llvm_name = "ptx41", .description = "Use PTX version 4.1", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx42)] = .{ .llvm_name = "ptx42", .description = "Use PTX version 4.2", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx43)] = .{ .llvm_name = "ptx43", .description = "Use PTX version 4.3", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx50)] = .{ .llvm_name = "ptx50", .description = "Use PTX version 5.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx60)] = .{ .llvm_name = "ptx60", .description = "Use PTX version 6.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx61)] = .{ .llvm_name = "ptx61", .description = "Use PTX version 6.1", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx63)] = .{ .llvm_name = "ptx63", .description = "Use PTX version 6.3", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx64)] = .{ .llvm_name = "ptx64", .description = "Use PTX version 6.4", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_20)] = .{ .llvm_name = "sm_20", .description = "Target SM 2.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_21)] = .{ .llvm_name = "sm_21", .description = "Target SM 2.1", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_30)] = .{ .llvm_name = "sm_30", .description = "Target SM 3.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_32)] = .{ .llvm_name = "sm_32", .description = "Target SM 3.2", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_35)] = .{ .llvm_name = "sm_35", .description = "Target SM 3.5", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_37)] = .{ .llvm_name = "sm_37", .description = "Target SM 3.7", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_50)] = .{ .llvm_name = "sm_50", .description = "Target SM 5.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_52)] = .{ .llvm_name = "sm_52", .description = "Target SM 5.2", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_53)] = .{ .llvm_name = "sm_53", .description = "Target SM 5.3", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_60)] = .{ .llvm_name = "sm_60", .description = "Target SM 6.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_61)] = .{ .llvm_name = "sm_61", .description = "Target SM 6.1", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_62)] = .{ .llvm_name = "sm_62", .description = "Target SM 6.2", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_70)] = .{ .llvm_name = "sm_70", .description = "Target SM 7.0", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_72)] = .{ .llvm_name = "sm_72", .description = "Target SM 7.2", .dependencies = featureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_75)] = .{ .llvm_name = "sm_75", .description = "Target SM 7.5", .dependencies = featureSet(&[_]Feature{}), }; const ti = @typeInfo(Feature); for (result) |*elem, i| { elem.index = i; elem.name = ti.Enum.fields[i].name; } break :blk result; }; pub const cpu = struct { pub const sm_20 = CpuModel{ .name = "sm_20", .llvm_name = "sm_20", .features = featureSet(&[_]Feature{ .sm_20, }), }; pub const sm_21 = CpuModel{ .name = "sm_21", .llvm_name = "sm_21", .features = featureSet(&[_]Feature{ .sm_21, }), }; pub const sm_30 = CpuModel{ .name = "sm_30", .llvm_name = "sm_30", .features = featureSet(&[_]Feature{ .sm_30, }), }; pub const sm_32 = CpuModel{ .name = "sm_32", .llvm_name = "sm_32", .features = featureSet(&[_]Feature{ .ptx40, .sm_32, }), }; pub const sm_35 = CpuModel{ .name = "sm_35", .llvm_name = "sm_35", .features = featureSet(&[_]Feature{ .sm_35, }), }; pub const sm_37 = CpuModel{ .name = "sm_37", .llvm_name = "sm_37", .features = featureSet(&[_]Feature{ .ptx41, .sm_37, }), }; pub const sm_50 = CpuModel{ .name = "sm_50", .llvm_name = "sm_50", .features = featureSet(&[_]Feature{ .ptx40, .sm_50, }), }; pub const sm_52 = CpuModel{ .name = "sm_52", .llvm_name = "sm_52", .features = featureSet(&[_]Feature{ .ptx41, .sm_52, }), }; pub const sm_53 = CpuModel{ .name = "sm_53", .llvm_name = "sm_53", .features = featureSet(&[_]Feature{ .ptx42, .sm_53, }), }; pub const sm_60 = CpuModel{ .name = "sm_60", .llvm_name = "sm_60", .features = featureSet(&[_]Feature{ .ptx50, .sm_60, }), }; pub const sm_61 = CpuModel{ .name = "sm_61", .llvm_name = "sm_61", .features = featureSet(&[_]Feature{ .ptx50, .sm_61, }), }; pub const sm_62 = CpuModel{ .name = "sm_62", .llvm_name = "sm_62", .features = featureSet(&[_]Feature{ .ptx50, .sm_62, }), }; pub const sm_70 = CpuModel{ .name = "sm_70", .llvm_name = "sm_70", .features = featureSet(&[_]Feature{ .ptx60, .sm_70, }), }; pub const sm_72 = CpuModel{ .name = "sm_72", .llvm_name = "sm_72", .features = featureSet(&[_]Feature{ .ptx61, .sm_72, }), }; pub const sm_75 = CpuModel{ .name = "sm_75", .llvm_name = "sm_75", .features = featureSet(&[_]Feature{ .ptx63, .sm_75, }), }; };
lib/std/target/nvptx.zig
const std = @import("std"); const parser = @import("parser.zig"); const mem = std.mem; const Writer = std.fs.File.Writer; const Reader = std.fs.File.Reader; pub const Color = struct { r: u8, g: u8, b: u8, pub fn fromSlice(slice: []const u8) Color { return .{ .r = slice[0], .g = slice[1], .b = slice[2], }; } pub fn format( self: Color, comptime fmt: []const u8, options: std.fmt.FormatOptions, out_stream: anytype, ) !void { _ = options; if (comptime std.mem.eql(u8, fmt, "x")) { try std.fmt.format(out_stream, "#{x:0>2}{x:0>2}{x:0>2}", .{ self.r, self.g, self.b }); } else { try std.fmt.format(out_stream, "{d};{d};{d}", .{ self.r, self.g, self.b }); } } }; pub const Palette = struct { name: []const u8, foreground: Color, background: Color, cursor: Color, colors: [16]Color, /// prefer manually loading and parsing the palette file to this function. pub fn showCurrent(out_stream: anytype) !void { var i: usize = 0; while (i < 8) : (i += 1) { try std.fmt.format(out_stream, "\x1b[48;5;{d}m \x1b[0m", .{i}); } try std.fmt.format(out_stream, "\n", .{}); while (i < 16) : (i += 1) { try std.fmt.format(out_stream, "\x1b[48;5;{d}m \x1b[0m", .{i}); } } /// this probably isn't what you want as it resets all theming. pub fn reset(out_stream: anytype) !void { var i: usize = 0; while (i < 16) : (i += 1) { try std.fmt.format(out_stream, "\x1b]104;{d}\x1b\\", .{i}); } try std.fmt.format(out_stream, "\x1b]110\x1b\\", .{}); try std.fmt.format(out_stream, "\x1b]111\x1b\\", .{}); try std.fmt.format(out_stream, "\x1b]112\x1b\\", .{}); } pub fn preview(self: Palette, out_stream: anytype) !void { try std.fmt.format(out_stream, "{s}\n", .{self.name}); for (self.colors[0..8]) |c| { try std.fmt.format(out_stream, "\x1b[48;2;{}m \x1b[0m", .{c}); } try std.fmt.format(out_stream, "\n", .{}); for (self.colors[8..16]) |c| { try std.fmt.format(out_stream, "\x1b[48;2;{}m \x1b[0m", .{c}); } } pub fn apply(self: Palette, out_stream: anytype) !void { for (self.colors[0..16]) |c, i| { try std.fmt.format(out_stream, "\x1b]4;{d};{x}\x1b\\", .{ i, c }); } try std.fmt.format(out_stream, "\x1b]10;{x}\x1b\\", .{self.foreground}); try std.fmt.format(out_stream, "\x1b]11;{x}\x1b\\", .{self.background}); try std.fmt.format(out_stream, "\x1b]12;{x}\x1b\\", .{self.cursor}); } pub fn format( self: Palette, comptime fmt: []const u8, options: std.fmt.FormatOptions, out_stream: anytype, ) !void { _ = options; if (comptime std.mem.eql(u8, fmt, "x")) { try self.apply(out_stream); } else if (comptime std.mem.eql(u8, fmt, "s")) { try std.fmt.format(out_stream, "[{s}]\n", .{self.name}); try std.fmt.format(out_stream, "foreground = \"{x}\"\n", .{self.foreground}); try std.fmt.format(out_stream, "background = \"{x}\"\n", .{self.background}); try std.fmt.format(out_stream, "cursor = \"{x}\"\n", .{self.cursor}); try std.fmt.format(out_stream, "colors = [\n", .{}); for (self.colors[0..16]) |c| { try std.fmt.format(out_stream, " \"{x}\",\n", .{c}); } try std.fmt.format(out_stream, "]", .{}); } else { try self.preview(out_stream); } } // deprecated: use a PaletteSet pub fn parseOldFormat(name: []const u8, reader: Reader) !Palette { var buf: [32]u8 = undefined; var result: Palette = undefined; var bytes: [3]u8 = undefined; result.name = name; while (try reader.readUntilDelimiterOrEof(&buf, '\n')) |line| { var toks = mem.split(line, "="); const color = toks.next() orelse return error.InvalidPalette; try std.fmt.hexToBytes(&bytes, toks.next() orelse return error.InvalidPalette); if (mem.eql(u8, color, "background")) { result.background = Color.fromSlice(&bytes); } else if (mem.eql(u8, color, "foreground")) { result.foreground = Color.fromSlice(&bytes); } else if (mem.eql(u8, color, "cursor")) { result.cursor = Color.fromSlice(&bytes); } else if (mem.startsWith(u8, color, "color")) { const idx = try std.fmt.parseUnsigned(usize, mem.trimLeft(u8, color, "color"), 10); if (idx < result.colors.len) { result.colors[idx] = Color.fromSlice(&bytes); } } } return result; } }; pub const PaletteSet = struct { const Map = std.StringHashMap(Palette); const List = std.ArrayList([]const u8); // the Map does not free keys or values so we use the List to track values allocator: *mem.Allocator, profiles: List, palettes: Map, pub fn init(allocator: *mem.Allocator) PaletteSet { return PaletteSet{ .allocator = allocator, .palettes = Map.init(allocator), .profiles = List.init(allocator), }; } pub fn add(self: *PaletteSet, name: []const u8, reader: Reader) !void { var buf = try reader.readAllAlloc(self.allocator, std.math.maxInt(usize)); defer self.allocator.free(buf); var rem = @as([]const u8, buf); while (parser.parsePalette(undefined, rem)) |*r| : (rem = r.rest) { var new_name = try self.profiles.addOne(); new_name.* = try std.fmt.allocPrint(self.allocator, "{s}:{s}", .{ name, r.value.name }); if (std.mem.eql(u8, r.value.name, "default")) { r.value.name = new_name.*[0..name.len]; } else { r.value.name = new_name.*; } try self.palettes.put(new_name.*, r.value); } else |_| { if (rem.len != 0) { return error.InvalidPalette; } } } pub fn get(self: *PaletteSet, name: []const u8) ?Palette { if (self.palettes.get(name)) |p| { return p; } else { const full_name = std.fmt.allocPrint(self.allocator, "{s}:default", .{name}) catch return null; defer self.allocator.free(full_name); return self.palettes.get(full_name); } } pub fn deinit(self: *PaletteSet) void { self.palettes.deinit(); for (self.profiles.items) |n| { self.allocator.free(n); } self.profiles.deinit(); } };
pal/pal/palette.zig
const std = @import("std"); const imgui = @import("imgui"); pub const Color = extern union { value: u32, comps: packed struct { r: u8, g: u8, b: u8, a: u8, }, pub fn fromBytes(r: u8, g: u8, b: u8, a: u8) Color { return .{ .value = (r) | (@as(u32, g) << 8) | (@as(u32, b) << 16) | (@as(u32, a) << 24) }; } pub fn fromRgb(r: f32, g: f32, b: f32) Color { return fromBytes(@floatToInt(u8, @round(r * 255)), @floatToInt(u8, @round(g * 255)), @floatToInt(u8, @round(b * 255)), @as(u8, 255)); } pub fn fromRgba(r: f32, g: f32, b: f32, a: f32) Color { return fromBytes(@floatToInt(u8, @round(r * 255)), @floatToInt(u8, @round(g * 255)), @floatToInt(u8, @round(b * 255)), @floatToInt(u8, @round(a * 255))); } pub fn fromI32(r: i32, g: i32, b: i32, a: i32) Color { return fromBytes(@truncate(u8, @intCast(u32, r)), @truncate(u8, @intCast(u32, g)), @truncate(u8, @intCast(u32, b)), @truncate(u8, @intCast(u32, a))); } pub fn r_val(self: Color) u8 { return @truncate(u8, self.value); } pub fn g_val(self: Color) u8 { return @truncate(u8, self.value >> 8); } pub fn b_val(self: Color) u8 { return @truncate(u8, self.value >> 16); } pub fn a_val(self: Color) u8 { return @truncate(u8, self.value >> 24); } pub fn set_r(self: *Color, r: u8) void { self.value = (self.value & 0xffffff00) | r; } pub fn set_g(self: *Color, g: u8) void { self.value = (self.value & 0xffff00ff) | g; } pub fn set_b(self: *Color, b: u8) void { self.value = (self.value & 0xff00ffff) | b; } pub fn set_a(self: *Color, a: u8) void { self.value = (self.value & 0x00ffffff) | a; } pub fn asImVec4(self: Color) imgui.ImVec4 { return .{ .x = @intToFloat(f32, self.comps.r) / 255, .y = @intToFloat(f32, self.comps.g) / 255, .z = @intToFloat(f32, self.comps.b) / 255, .w = @intToFloat(f32, self.comps.a) / 255, }; } pub fn scale(self: Color, s: f32) Color { const r = @floatToInt(i32, @intToFloat(f32, self.r_val()) * s); const g = @floatToInt(i32, @intToFloat(f32, self.g_val()) * s); const b = @floatToInt(i32, @intToFloat(f32, self.b_val()) * s); const a = @floatToInt(i32, @intToFloat(f32, self.a_val()) * s); return fromI32(r, g, b, a); } pub const white = Color{ .value = 0xFFFFFFFF }; pub const black = Color{ .value = 0xFF000000 }; pub const transparent = Color{ .comps = .{ .r = 0, .g = 0, .b = 0, .a = 0 } }; pub const aya = Color{ .comps = .{ .r = 204, .g = 51, .b = 77, .a = 255 } }; pub const light_gray = Color{ .comps = .{ .r = 200, .g = 200, .b = 200, .a = 255 } }; pub const gray = Color{ .comps = .{ .r = 130, .g = 130, .b = 130, .a = 255 } }; pub const dark_gray = Color{ .comps = .{ .r = 80, .g = 80, .b = 80, .a = 255 } }; pub const yellow = Color{ .comps = .{ .r = 253, .g = 249, .b = 0, .a = 255 } }; pub const gold = Color{ .comps = .{ .r = 255, .g = 203, .b = 0, .a = 255 } }; pub const orange = Color{ .comps = .{ .r = 255, .g = 161, .b = 0, .a = 255 } }; pub const pink = Color{ .comps = .{ .r = 255, .g = 109, .b = 194, .a = 255 } }; pub const red = Color{ .comps = .{ .r = 230, .g = 41, .b = 55, .a = 255 } }; pub const maroon = Color{ .comps = .{ .r = 190, .g = 33, .b = 55, .a = 255 } }; pub const green = Color{ .comps = .{ .r = 0, .g = 228, .b = 48, .a = 255 } }; pub const lime = Color{ .comps = .{ .r = 0, .g = 158, .b = 47, .a = 255 } }; pub const dark_green = Color{ .comps = .{ .r = 0, .g = 117, .b = 44, .a = 255 } }; pub const sky_blue = Color{ .comps = .{ .r = 102, .g = 191, .b = 255, .a = 255 } }; pub const blue = Color{ .comps = .{ .r = 0, .g = 121, .b = 241, .a = 255 } }; pub const dark_blue = Color{ .comps = .{ .r = 0, .g = 82, .b = 172, .a = 255 } }; pub const purple = Color{ .comps = .{ .r = 200, .g = 122, .b = 255, .a = 255 } }; pub const voilet = Color{ .comps = .{ .r = 135, .g = 60, .b = 190, .a = 255 } }; pub const dark_purple = Color{ .comps = .{ .r = 112, .g = 31, .b = 126, .a = 255 } }; pub const beige = Color{ .comps = .{ .r = 211, .g = 176, .b = 131, .a = 255 } }; pub const brown = Color{ .comps = .{ .r = 127, .g = 106, .b = 79, .a = 255 } }; pub const dark_brown = Color{ .comps = .{ .r = 76, .g = 63, .b = 47, .a = 255 } }; pub const magenta = Color{ .comps = .{ .r = 255, .g = 0, .b = 255, .a = 255 } }; }; test "test color" { const ColorConverter = extern struct { r: u8, g: u8, b: u8, a: u8 }; _ = Color{ .value = @as(u32, 0xFF9900FF) }; const cc = Color{ .value = @bitCast(u32, [4]u8{ 10, 45, 34, 255 }) }; const ccc = Color{ .value = @bitCast(u32, ColorConverter{ .r = 10, .g = 45, .b = 34, .a = 255 }) }; // const c = @bitCast(Color, @as(u32, 0xFF9900FF)); // const cc = @bitCast(Color, [4]u8{ 10, 45, 34, 255 }); // const ccc = @bitCast(Color, ColorConverter{ .r = 10, .g = 45, .b = 34, .a = 255 }); std.testing.expectEqual(cc.value, ccc.value); _ = Color.fromBytes(10, 45, 34, 255); const c3 = Color.fromRgb(0.2, 0.4, 0.3); const c4 = Color.fromRgba(0.2, 0.4, 0.3, 1.0); std.testing.expectEqual(c3.value, c4.value); var c5 = Color.fromI32(10, 45, 34, 255); std.testing.expectEqual(c5.r_val(), 10); std.testing.expectEqual(c5.g_val(), 45); std.testing.expectEqual(c5.b_val(), 34); std.testing.expectEqual(c5.a_val(), 255); c5.set_r(100); std.testing.expectEqual(c5.r_val(), 100); const scaled = c5.scale(2); std.testing.expectEqual(scaled.r_val(), 200); }
src/math/color.zig
const std = @import("std"); const FailOnAllocationSize = @import("fail_on_allocation_size.zig").FailingAllocator; const FailOnStochastically = @import("fail_stochastically.zig").FailingAllocator; const functionThatUsesAnAllocator = @import("util.zig").functionThatUsesAnAllocator; const rand = std.rand; test "fail after N allocations" { // baseline that should not fail const success = try functionThatUsesAnAllocator(std.testing.allocator, 32, 10); std.testing.expect(success == 32); // Create an allocator that fails after the 5th allocation var failing_allocator = std.testing.FailingAllocator.init(std.testing.allocator, 5); // Perform 5 allocations, success const success_2 = try functionThatUsesAnAllocator(&failing_allocator.allocator, 5, 5); std.testing.expect(success_2 == 5); // Try to allocate one more time and fail const result = functionThatUsesAnAllocator(&failing_allocator.allocator, 32, 1); std.testing.expectError(error.OutOfMemory, result); } test "fail allocation stochastically" { // In a real example you would choose a random seed and record it to replay failures var prng = rand.DefaultPrng.init(0); // Pull NUMALLOCS from environment, or use 10 as default const numallocs_env = std.os.getenv("NUMALLOCS") orelse "10"; const numallocs = try std.fmt.parseInt(usize, numallocs_env, 10); // Pull FAILCHANCE from environment, or use 0.1 as default const fail_chance_env = std.os.getenv("FAILCHANCE") orelse "0.1"; const fail_chance = try std.fmt.parseFloat(f64, fail_chance_env); // Create an allocator that fails with probability FAILCHANCE on any given allocation var failing_allocator = FailOnStochastically.init(std.testing.allocator, fail_chance, &prng.random); var result = functionThatUsesAnAllocator(&failing_allocator.allocator, 10, numallocs); if (result) |value| { std.debug.print("No memory errors\n", .{}); std.testing.expect(value == numallocs); } else |err| { std.debug.print("Memory error caught\n", .{}); std.testing.expect(err == error.OutOfMemory); } } test "fail on size N allocation" { // Create an allocator that fails when trying to allocate a block of size 5 var failing_allocator = FailOnAllocationSize.init(std.testing.allocator, 5); // Allocate 10 bytes 5 times, no problem var result = functionThatUsesAnAllocator(&failing_allocator.allocator, 10, 5); std.testing.expect((try result) == 10); // Try to allocate 5 bytes 1 time, fails with OutOfMemory result = functionThatUsesAnAllocator(&failing_allocator.allocator, 5, 1); std.testing.expectError(error.OutOfMemory, result); }
src/main.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const c = @cImport(@cInclude("lz4.h")); const testing = @import("testing.zig"); const length_size = 4; pub fn compress(allocator: *mem.Allocator, data: []const u8) ![]const u8 { const max_dst_size = c.LZ4_compressBound(@intCast(c_int, data.len)); var buf = try allocator.alloc(u8, @intCast(usize, max_dst_size) + length_size); errdefer allocator.free(buf); // Encode the uncompressed length before the compressed byted. mem.writeIntBig(u32, buf[0..length_size], @intCast(u32, data.len)); var compressed_bytes = buf[length_size..buf.len]; const compressed_data_size = c.LZ4_compress_default( @ptrCast([*c]const u8, data), @ptrCast([*c]u8, compressed_bytes), @intCast(c_int, data.len), max_dst_size, ); if (compressed_data_size <= 0) { return error.CompressionFailed; } buf = try allocator.realloc(buf, @intCast(usize, compressed_data_size) + length_size); return buf; } pub fn decompress(allocator: *mem.Allocator, data: []const u8) ![]const u8 { // The uncompressed length is encoded as 4 bytes before the compressed byted. var max_decompressed_size = mem.readIntBig(u32, data[0..length_size]); // The rest are the compressed bytes. const compressed_data = data[length_size..]; const buf = try allocator.alloc(u8, max_decompressed_size); errdefer allocator.free(buf); const decompressed_size = c.LZ4_decompress_safe( @ptrCast([*c]const u8, compressed_data), @ptrCast([*c]u8, buf), @intCast(c_int, compressed_data.len), @intCast(c_int, buf.len), ); if (decompressed_size < 0) { return error.DecompressionFailed; } assert(max_decompressed_size == decompressed_size); return buf[0..@intCast(usize, decompressed_size)]; } test "lz4: compress and decompress" { const exp = "Dolorem in eos repellat facilis voluptatum sed. Autem ipsum quaerat voluptas ut cum impedit. Ut sapiente dolor eos sit. Dolorum nihil nobis voluptas est et sunt voluptatem. Veniam labore quae explicabo." ** 100; const compressed = try compress(testing.allocator, exp); defer testing.allocator.free(compressed); const decompressed = try decompress(testing.allocator, compressed); defer testing.allocator.free(decompressed); testing.expectEqualStrings(exp, decompressed); }
src/lz4.zig
const std = @import("std"); const NumberKind = @import("ast.zig").NumberKind; type: Type = .EOF, value: union(enum) { char: u8, string: []const u8, symbol: []const u8, nil: void, } = .nil, number_kind: NumberKind = .I32, line_number: i32 = 0, column_number: i32 = 0, filename: ?[]const u8 = null, delimiter_state: DelimiterState = .{}, macro_state: MacroState = .{}, passed_backslash_newline: bool = false, doc_buffer: ?void = null, // ?IO::Memory raw: []const u8 = "", start: i32 = 0, invalid_escape: bool = false, location: ?void = null, // ?Location pub const MacroState = struct { whitespace: bool = true, nest: i32 = 0, control_nest: i32 = 0, delimiter_state: ?DelimiterState = null, beginning_of_line: bool = true, yields: bool = false, comment: bool = false, heredocs: ?[]DelimiterState = null, }; pub const DelimiterKind = enum { STRING, REGEX, STRING_ARRAY, SYMBOL_ARRAY, COMMAND, HEREDOC, }; pub const DelimiterState = struct { kind: DelimiterKind = .STRING, nest: union(enum) { char: u8, string: []const u8 } = .{ .char = 0 }, end: union(enum) { char: u8, string: []const u8 } = .{ .char = 0 }, open_count: i32 = 0, heredoc_indent: i32 = 0, allow_escapes: bool = true, pub fn withOpenCountDelta(self: @This(), delta: i32) @This() { return .{ .kind = self.kind, .nest = self.nest, .end = self.end, .open_count = self.open_count + delta, .heredoc_indent = self.heredoc_indent, .allow_escapes = self.allow_escapes, }; } pub fn withHeredocIndent(self: @This(), indent: i32) @This() { return .{ .kind = self.kind, .nest = self.nest, .end = self.end, .open_count = self.open_count, .heredoc_indent = indent, .allow_escapes = self.allow_escapes, }; } }; pub const Type = enum { // cd crystal-lang/crystal // rg --pcre2 -o '(?<=type = :|next_char :).*' src/compiler/crystal/syntax/lexer.cr | sort | uniq ExclamationMark, // "!" ExclamationMarkEqual, // "!=" ExclamationMarkTilde, // "!~" DollarQuestionMark, // "$?" DollarTilde, // "$~" Percent, // "%" PercentEqual, // "%=" PercentRBrace, // "%}" Ampersand, // "&" Ampersand2, // "&&" Ampersand2Equal, // "&&=" AmpersandAsterisk, // "&*" AmpersandAsterisk2, // "&**" AmpersandAsteriskEqual, // "&*=" AmpersandPlus, // "&+" AmpersandPlusEqual, // "&+=" AmpersandMinus, // "&-" AmpersandMinusEqual, // "&-=" AmpersandEqual, // "&=" LParen, // "(" RParen, // ")" Asterisk, // "*" Asterisk2, // "**" Asterisk2Equal, // "**=" AsteriskEqual, // "*=" Plus, // "+" PlusEqual, // "+=" Comma, // "," Minus, // "-" MinusEqual, // "-=" MinusArrow, // "->" Dot, // "." Dot2, // ".." Dot3, // "..." Slash, // "/" Slash2, // "//" Slash2Equal, // "//=" SlashEqual, // "/=" Colon, // ":" Colon2, // "::" Semicolon, // ";" LArrow, // "<" LArrow2, // "<<" LArrow2Equal, // "<<=" LArrowEqual, // "<=" LArrowEqualRArrow, // "<=>" Equal, // "=" Equal2, // "==" Equal3, // "===" EqualArrow, // "=>" EqualTilde, // "=~" RArrow, // ">" RArrowEqual, // ">=" RArrow2, // ">>" RArrow2Equal, // ">>=" QuestionMark, // "?" AtLBracket, // "@[" LBracket, // "[" LBracketRBracket, // "[]" LBracketRBracketEqual, // "[]=" LBracketRBracketQuestionMark, // "[]?" RBracket, // "]" Caret, // "^" CaretEqual, // "^=" Backtick, // "`" LBrace, // "{" LBracePercent, // "{%" LBrace2, // "{{" Pipe, // "|" PipeEqual, // "|=" Pipe2, // "||" Pipe2Equal, // "||=" RBrace, // "}" Tilde, // "~" CHAR, COMMENT, CONST, DELIMITER_END, DELIMITER_START, EOF, GLOBAL, GLOBAL_MATCH_DATA_INDEX, IDENT, INTERPOLATION_START, MACRO_CONTROL_START, MACRO_END, MACRO_EXPRESSION_START, MACRO_LITERAL, MACRO_VAR, NEWLINE, NUMBER, SPACE, STRING, STRING_ARRAY_END, STRING_ARRAY_START, SYMBOL, SYMBOL_ARRAY_START, UNDERSCORE, __DIR__, __END_LINE__, __FILE__, __LINE__, pub fn format(self: @This(), comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { try writer.print("{s}", .{self.toString()}); } pub fn toString(self: @This()) []const u8 { return switch (self) { .ExclamationMark, => "!", .ExclamationMarkEqual, => "!=", .ExclamationMarkTilde, => "!~", .DollarQuestionMark, => "$?", .DollarTilde, => "$~", .Percent, => "%", .PercentEqual, => "%=", .PercentRBrace, => "%}", .Ampersand, => "&", .Ampersand2, => "&&", .Ampersand2Equal, => "&&=", .AmpersandAsterisk, => "&*", .AmpersandAsterisk2, => "&**", .AmpersandAsteriskEqual, => "&*=", .AmpersandPlus, => "&+", .AmpersandPlusEqual, => "&+=", .AmpersandMinus, => "&-", .AmpersandMinusEqual, => "&-=", .AmpersandEqual, => "&=", .LParen, => "(", .RParen, => ")", .Asterisk, => "*", .Asterisk2, => "**", .Asterisk2Equal, => "**=", .AsteriskEqual, => "*=", .Plus, => "+", .PlusEqual, => "+=", .Comma, => ",", .Minus, => "-", .MinusEqual, => "-=", .MinusArrow, => "->", .Dot, => ".", .Dot2, => "..", .Dot3, => "...", .Slash, => "/", .Slash2, => "//", .Slash2Equal, => "//=", .SlashEqual, => "/=", .Colon, => ":", .Colon2, => "::", .Semicolon, => ";", .LArrow, => "<", .LArrow2, => "<<", .LArrow2Equal, => "<<=", .LArrowEqual, => "<=", .LArrowEqualRArrow, => "<=>", .Equal, => "=", .Equal2, => "==", .Equal3, => "===", .EqualArrow, => "=>", .EqualTilde, => "=~", .RArrow, => ">", .RArrowEqual, => ">=", .RArrow2, => ">>", .RArrow2Equal, => ">>=", .QuestionMark, => "?", .AtLBracket, => "@[", .LBracket, => "[", .LBracketRBracket, => "[]", .LBracketRBracketEqual, => "[]=", .LBracketRBracketQuestionMark, => "[]?", .RBracket, => "]", .Caret, => "^", .CaretEqual, => "^=", .Backtick, => "`", .LBrace, => "{", .LBracePercent, => "{%", .LBrace2, => "{{", .Pipe, => "|", .PipeEqual, => "|=", .Pipe2, => "||", .Pipe2Equal, => "||=", .RBrace, => "}", .Tilde, => "~", .CHAR => "CHAR", .COMMENT => "COMMENT", .CONST => "CONST", .DELIMITER_END => "DELIMITER_END", .DELIMITER_START => "DELIMITER_START", .EOF => "EOF", .GLOBAL => "GLOBAL", .GLOBAL_MATCH_DATA_INDEX => "GLOBAL_MATCH_DATA_INDEX", .IDENT => "IDENT", .INTERPOLATION_START => "INTERPOLATION_START", .MACRO_CONTROL_START => "MACRO_CONTROL_START", .MACRO_END => "MACRO_END", .MACRO_EXPRESSION_START => "MACRO_EXPRESSION_START", .MACRO_LITERAL => "MACRO_LITERAL", .MACRO_VAR => "MACRO_VAR", .NEWLINE => "NEWLINE", .NUMBER => "NUMBER", .SPACE => "SPACE", .STRING => "STRING", .STRING_ARRAY_END => "STRING_ARRAY_END", .STRING_ARRAY_START => "STRING_ARRAY_START", .SYMBOL => "SYMBOL", .SYMBOL_ARRAY_START => "SYMBOL_ARRAY_START", .UNDERSCORE => "UNDERSCORE", .__DIR__ => "__DIR__", .__END_LINE__ => "__END_LINE__", .__FILE__ => "__FILE__", .__LINE__ => "__LINE__", }; } }; const print = std.debug.print; const c_allocator = std.heap.c_allocator; const utils = @import("utils.zig"); const inspect = utils.inspect; const pp = utils.pp; const p = utils.p; const xprint = utils.xprint; pub fn main() void { p(Type.__LINE__); p(Type.__LINE__.toString()); p(Type.__LINE__.toString() ++ "bar"); p(@This() {}); }
token.zig
const c = @cImport({ @cInclude("cfl_text.h"); }); const widget = @import("widget.zig"); const enums = @import("enums.zig"); pub const TextBuffer = struct { inner: ?*c.Fl_Text_Buffer, pub fn new() TextBuffer { return TextBuffer{ .inner = c.Fl_Text_Buffer_new(), }; } pub fn fromVoidPtr(ptr: ?*c_void) TextBuffer { return TextBuffer{ .inner = @ptrCast(?*c.Fl_Text_Buffer, ptr), }; } pub fn toVoidPtr(self: *TextBuffer) ?*c_void { return @ptrCast(?*c_void, self.inner); } pub fn delete(self: *TextBuffer) void { c.Fl_Text_Buffer_delete(self.inner); self.inner = null; } /// Sets the text of the buffer pub fn setText(self: *TextBuffer, txt: [*c]const u8) void { return c.Fl_Text_Buffer_set_text(self.inner, txt); } /// Returns the text of the buffer pub fn text(self: *const TextBuffer) [*c]const u8 { return c.Fl_Text_Buffer_txt(self.inner); } /// Appends to the buffer pub fn append(self: *TextBuffer, str: [*c]const u8) void { return c.Fl_Text_Buffer_append(self.inner, str); } /// Get the length of the buffer pub fn length(self: *const TextBuffer) u32 { return c.Fl_Text_Buffer_length(self.inner); } /// Removes from the buffer pub fn remove(self: *TextBuffer, start: u32, end: u32) void { return c.Fl_Text_Buffer_remove(self.inner, start, end); } /// Returns the text within the range pub fn textRange(self: *const TextBuffer, start: u32, end: u32) [*c]const u8 { return c.Fl_Text_Buffer_text_range(self.inner, start, end); } /// Inserts text into a position pub fn insert(self: *TextBuffer, pos: u32, str: [*c]const u8) void { c.Fl_Text_Buffer_insert(self.inner, pos, str.as_ptr()); } /// Replaces text from position ```start``` to ```end``` pub fn replace(self: *TextBuffer, start: u32, end: u32, txt: [*c]const u8) void { c.Fl_Text_Buffer_replace(self.inner, start, end, txt); } /// Copies text from a source buffer into the current buffer pub fn copyFrom(self: *TextBuffer, source_buf: *TextBuffer, start: u32, end: u32, to: u32) void { c.Fl_Text_Buffer_copy( self.inner, source_buf.inner, start, end, to, ); } /// Copies whole text from a source buffer into a new buffer pub fn copy(self: *const TextBuffer) TextBuffer { var temp = TextBuffer.new(); temp.copy_from(self, 0, 0, self.length()); } /// Performs an undo operation on the buffer pub fn undo(self: *TextBuffer) void { _ = c.Fl_Text_Buffer_undo(self.inner, null); } /// Sets whether the buffer can undo pub fn canUndo(self: *TextBuffer, flag: bool) void { c.Fl_Text_Buffer_canUndo(self.inner, @boolToInt(flag)); } pub fn lineStart(self: *TextBuffer, pos: u32) u32 { return c.Fl_Text_Buffer_line_start(self.inner, pos); } /// Loads a file into the buffer pub fn loadFile(self: *TextBuffer, path: [*c]const u8) !void { const ret = c.Fl_Text_Buffer_load_file(self.inner, path); if (ret != 0) return error.InvalidParameter; } /// Saves a buffer into a file pub fn saveFile(self: *TextBuffer, path: [*c]const u8) !void { const ret = c.Fl_Text_Buffer_save_file(self.inner, path); if (ret != 0) return error.InvalidParameter; } /// Returns the tab distance for the buffer pub fn tabDistance(self: *const TextBuffer) u32 { c.Fl_Text_Buffer_tab_distance(self.inner); } /// Sets the tab distance pub fn setTabDistance(self: *TextBuffer, tab_dist: u32) void { c.Fl_Text_Buffer_set_tab_distance(self.inner, tab_dist); } /// Selects the text from start to end pub fn select(self: *TextBuffer, start: u32, end: u32) void { c.Fl_Text_Buffer_select(self.inner, start, end); } /// Returns whether text is selected pub fn selected(self: *const TextBuffer) bool { return c.Fl_Text_Buffer_selected(self.inner) != 0; } /// Unselects text pub fn unselect(self: *TextBuffer) void { return c.Fl_Text_Buffer_unselect(self.inner); } }; pub const TextDisplay = struct { inner: ?*c.Fl_Text_Display, pub fn new(x: i32, y: i32, w: i32, h: i32, title: [*c]const u8) TextDisplay { const ptr = c.Fl_Text_Display_new(x, y, w, h, title); if (ptr == null) unreachable; return TextDisplay{ .inner = ptr, }; } pub fn raw(self: *TextDisplay) ?*c.Fl_Text_Display { return self.inner; } pub fn fromRaw(ptr: ?*c.Fl_Text_Display) TextDisplay { return TextDisplay{ .inner = ptr, }; } pub fn fromWidgetPtr(w: widget.WidgetPtr) TextDisplay { return TextDisplay{ .inner = @ptrCast(?*c.Fl_Text_Display, w), }; } pub fn fromVoidPtr(ptr: ?*c_void) TextDisplay { return TextDisplay{ .inner = @ptrCast(?*c.Fl_Text_Display, ptr), }; } pub fn toVoidPtr(self: *TextDisplay) ?*c_void { return @ptrCast(?*c_void, self.inner); } pub fn asWidget(self: *const TextDisplay) widget.Widget { return widget.Widget{ .inner = @ptrCast(widget.WidgetPtr, self.inner), }; } pub fn handle(self: *TextDisplay, cb: fn (w: widget.WidgetPtr, ev: i32, data: ?*c_void) callconv(.C) i32, data: ?*c_void) void { c.Fl_Text_Display_handle(self.inner, @ptrCast(c.custom_handler_callback, cb), data); } pub fn draw(self: *TextDisplay, cb: fn (w: widget.WidgetPtr, data: ?*c_void) callconv(.C) void, data: ?*c_void) void { c.Fl_Text_Display_handle(self.inner, @ptrCast(c.custom_draw_callback, cb), data); } pub fn buffer(self: *const TextDisplay) TextBuffer { const buf = c.Fl_Text_Display_get_buffer(self.inner); return TextBuffer{ .inner = buf }; } pub fn setBuffer(self: *TextDisplay, buf: *TextBuffer) void { c.Fl_Text_Display_set_buffer(self.inner, buf.*.inner); } pub fn setTextFont(self: *TextDisplay, font: enums.Font) void { c.Fl_Text_Display_set_text_font(self.inner, @enumToInt(font)); } pub fn setTextColor(self: *TextDisplay, col: u32) void { c.Fl_Text_Display_set_text_color(self.inner, col); } pub fn setTextSize(self: *TextDisplay, sz: u32) void { c.Fl_Text_Display_set_text_size(self.inner, sz); } pub fn scroll(self: *TextDisplay, topLineNum: u32, horizOffset: u32) void { c.Fl_Text_Display_scroll(self.inner, topLineNum, horizOffset); } pub fn insert(self: *const TextDisplay, text: [*c]const u8) void { c.Fl_Text_Display_insert(self.inner, text); } pub fn setInsertPosition(self: *TextDisplay, newPos: u32) void { c.Fl_Text_Display_set_insert_position(self.inner, newPos); } pub fn insertPosition(self: *const TextDisplay) u32 { return c.Fl_Text_Display_insert_position(self.inner); } pub fn countLines(self: *const TextDisplay, start: u32, end: u32, is_line_start: bool) u32 { return c.Fl_Text_Display_count_lines(self.inner, start, end, @boolToInt(is_line_start)); } pub fn moveRight(self: *TextDisplay) void { _ = c.Fl_Text_Display_move_right(self.inner); } pub fn moveLeft(self: *TextDisplay) void { _ = c.Fl_Text_Display_move_left(self.inner); } pub fn moveUp(self: *TextDisplay) void { _ = c.Fl_Text_Display_move_up(self.inner); } pub fn moveDown(self: *TextDisplay) void { _ = c.Fl_Text_Display_move_down(self.inner); } pub fn showCursor(self: *TextDisplay, val: bool) void { c.Fl_Text_Display_show_cursor(self.inner, @boolToInt(val)); } pub fn setCursorStyle(self: *TextDisplay, style: enums.TextCursor) void { c.Fl_Text_Display_set_cursor_style(self.inner, @enumToInt(style)); } pub fn setCursorColor(self: *TextDisplay, col: enums.Color) void { c.Fl_Text_Display_set_cursor_color(self.inner, @enumToInt(col)); } pub fn setScrollbarSize(self: *TextDisplay, size: u32) void { c.Fl_Text_Display_set_scrollbar_size(self.inner, size); } pub fn setScrollbarAlign(self: *TextDisplay, a: i32) void { c.Fl_Text_Display_set_scrollbar_align(self.inner, a); } pub fn setLinenumberWidth(self: *TextDisplay, w: i32) void { c.Fl_Text_Display_set_linenumber_width(self.inner, w); } }; pub const TextEditor = struct { inner: ?*c.Fl_Text_Editor, pub fn new(x: i32, y: i32, w: i32, h: i32, title: [*c]const u8) TextEditor { const ptr = c.Fl_Text_Editor_new(x, y, w, h, title); if (ptr == null) unreachable; return TextEditor{ .inner = ptr, }; } pub fn raw(self: *TextEditor) ?*c.Fl_Text_Editor { return self.inner; } pub fn fromRaw(ptr: ?*c.Fl_Text_Editor) TextEditor { return TextEditor{ .inner = ptr, }; } pub fn fromWidgetPtr(w: widget.WidgetPtr) TextEditor { return TextEditor{ .inner = @ptrCast(?*c.Fl_Text_Editor, w), }; } pub fn fromVoidPtr(ptr: ?*c_void) TextEditor { return TextEditor{ .inner = @ptrCast(?*c.Fl_Text_Editor, ptr), }; } pub fn toVoidPtr(self: *TextEditor) ?*c_void { return @ptrCast(?*c_void, self.inner); } pub fn asWidget(self: *const TextEditor) widget.Widget { return widget.Widget{ .inner = @ptrCast(widget.WidgetPtr, self.inner), }; } pub fn asTextDisplay(self: *const TextEditor) TextDisplay { return TextDisplay{ .inner = @ptrCast(?*c.Fl_Text_Display, self.inner), }; } pub fn handle(self: *TextEditor, cb: fn (w: widget.WidgetPtr, ev: i32, data: ?*c_void) callconv(.C) i32, data: ?*c_void) void { c.Fl_Text_Editor_handle(self.inner, @ptrCast(c.custom_handler_callback, cb), data); } pub fn draw(self: *TextEditor, cb: fn (w: widget.WidgetPtr, data: ?*c_void) callconv(.C) void, data: ?*c_void) void { c.Fl_Text_Editor_handle(self.inner, @ptrCast(c.custom_draw_callback, cb), data); } /// Copies the text within the TextEditor widget pub fn copy(self: *const TextEditor) void { _ = c.Fl_Text_Editor_kf_copy(self.inner); } /// Cuts the text within the TextEditor widget pub fn cut(self: *const TextEditor) void { _ = c.Fl_Text_Editor_kf_cut(self.inner); } /// Pastes text from the clipboard into the TextEditor widget pub fn paste(self: *const TextEditor) void { _ = c.Fl_Text_Editor_kf_paste(self.inner); } }; test "" { @import("std").testing.refAllDecls(@This()); }
src/text.zig
const std = @import("std"); const assert = std.debug.assert; /// Whether development or production: pub const deployment_environment = .development; /// The maximum log level in increasing order of verbosity (emergency=0, debug=3): pub const log_level = 2; /// The maximum number of replicas allowed in a cluster. pub const replicas_max = 6; /// The maximum number of clients allowed per cluster, where each client has a unique 128-bit ID. /// This impacts the amount of memory allocated at initialization by the server. /// This determines the size of the VR client table used to cache replies to clients by client ID. /// Each client has one entry in the VR client table to store the latest `message_size_max` reply. pub const clients_max = 32; /// The minimum number of nodes required to form a quorum for replication: /// Majority quorums are only required across view change and replication phases (not within). /// As per Flexible Paxos, provided `quorum_replication + quorum_view_change > replicas`: /// 1. you may increase `quorum_view_change` above a majority, so that /// 2. you can decrease `quorum_replication` below a majority, to optimize the common case. /// This improves latency by reducing the number of nodes required for synchronous replication. /// This reduces redundancy only in the short term, asynchronous replication will still continue. /// The size of the replication quorum is limited to the minimum of this value and actual majority. /// The size of the view change quorum will then be automatically inferred from quorum_replication. pub const quorum_replication_max = 3; /// The default server port to listen on if not specified in `--addresses`: pub const port = 3001; /// The default network interface address to listen on if not specified in `--addresses`: /// WARNING: Binding to all interfaces with "0.0.0.0" is dangerous and opens the server to anyone. /// Bind to the "127.0.0.1" loopback address to accept local connections as a safe default only. pub const address = "127.0.0.1"; /// Where data files should be persisted by default: pub const directory = "/var/lib/tigerbeetle"; /// The maximum number of accounts to store in memory: /// This impacts the amount of memory allocated at initialization by the server. pub const accounts_max = switch (deployment_environment) { .production => 1_000_000, else => 100_000, }; /// The maximum number of transfers to store in memory: /// This impacts the amount of memory allocated at initialization by the server. /// We allocate more capacity than the number of transfers for a safe hash table load factor. pub const transfers_max = switch (deployment_environment) { .production => 100_000_000, else => 1_000_000, }; /// The maximum number of two-phase commits to store in memory: /// This impacts the amount of memory allocated at initialization by the server. pub const commits_max = transfers_max; /// The maximum size of the journal file: /// This is pre-allocated and zeroed for performance when initialized. /// Writes within this file never extend the filesystem inode size reducing the cost of fdatasync(). /// This enables static allocation of disk space so that appends cannot fail with ENOSPC. /// This also enables us to detect filesystem inode corruption that would change the journal size. pub const journal_size_max = switch (deployment_environment) { .production => 128 * 1024 * 1024 * 1024, else => 128 * 1024 * 1024, }; /// The maximum number of batch entries in the journal file: /// A batch entry may contain many transfers, so this is not a limit on the number of transfers. /// We need this limit to allocate space for copies of batch headers at the start of the journal. /// These header copies enable us to disentangle corruption from crashes and recover accordingly. pub const journal_headers_max = switch (deployment_environment) { .production => 1024 * 1024, else => 16384, }; /// The maximum number of connections that can be held open by the server at any time: pub const connections_max = replicas_max + clients_max; /// The maximum size of a message in bytes: /// This is also the limit of all inflight data across multiple pipelined requests per connection. /// We may have one request of up to 2 MiB inflight or 2 pipelined requests of up to 1 MiB inflight. /// This impacts sequential disk write throughput, the larger the buffer the better. /// 2 MiB is 16,384 transfers, and a reasonable choice for sequential disk write throughput. /// However, this impacts bufferbloat and head-of-line blocking latency for pipelined requests. /// For a 1 Gbps NIC = 125 MiB/s throughput: 2 MiB / 125 * 1000ms = 16ms for the next request. /// This impacts the amount of memory allocated at initialization by the server. pub const message_size_max = 1 * 1024 * 1024; /// The maximum number of Viewstamped Replication prepare messages that can be inflight at a time. /// This is immutable once assigned per cluster, as replicas need to know how many operations might /// possibly be uncommitted during a view change, and this must be constant for all replicas. pub const pipelining_max = clients_max; /// The minimum and maximum amount of time in milliseconds to wait before initiating a connection. /// Exponential backoff and jitter are applied within this range. pub const connection_delay_min_ms = 50; pub const connection_delay_max_ms = 1000; /// The maximum number of outgoing messages that may be queued on a replica connection. pub const connection_send_queue_max_replica = std.math.max(std.math.min(clients_max, 4), 2); /// The maximum number of outgoing messages that may be queued on a client connection. /// The client has one in-flight request, and occasionally a ping. pub const connection_send_queue_max_client = 2; /// The maximum number of outgoing requests that may be queued on a client (including the in-flight request). pub const client_request_queue_max = 32; /// The maximum number of connections in the kernel's complete connection queue pending an accept(): /// If the backlog argument is greater than the value in `/proc/sys/net/core/somaxconn`, then it is /// silently truncated to that value. Since Linux 5.4, the default in this file is 4096. pub const tcp_backlog = 64; /// The maximum size of a kernel socket receive buffer in bytes (or 0 to use the system default): /// This sets SO_RCVBUF as an alternative to the auto-tuning range in /proc/sys/net/ipv4/tcp_rmem. /// The value is limited by /proc/sys/net/core/rmem_max, unless the CAP_NET_ADMIN privilege exists. /// The kernel doubles this value to allow space for packet bookkeeping overhead. /// The receive buffer should ideally exceed the Bandwidth-Delay Product for maximum throughput. /// At the same time, be careful going beyond 4 MiB as the kernel may merge many small TCP packets, /// causing considerable latency spikes for large buffer sizes: /// https://blog.cloudflare.com/the-story-of-one-latency-spike/ pub const tcp_rcvbuf = 4 * 1024 * 1024; /// The maximum size of a kernel socket send buffer in bytes (or 0 to use the system default): /// This sets SO_SNDBUF as an alternative to the auto-tuning range in /proc/sys/net/ipv4/tcp_wmem. /// The value is limited by /proc/sys/net/core/wmem_max, unless the CAP_NET_ADMIN privilege exists. /// The kernel doubles this value to allow space for packet bookkeeping overhead. pub const tcp_sndbuf_replica = connection_send_queue_max_replica * message_size_max; pub const tcp_sndbuf_client = connection_send_queue_max_client * message_size_max; /// Whether to enable TCP keepalive: pub const tcp_keepalive = true; /// The time (in seconds) the connection needs to be idle before sending TCP keepalive probes: /// Probes are not sent when the send buffer has data or the congestion window size is zero, /// for these cases we also need tcp_user_timeout below. pub const tcp_keepidle = 5; /// The time (in seconds) between individual keepalive probes: pub const tcp_keepintvl = 4; /// The maximum number of keepalive probes to send before dropping the connection: pub const tcp_keepcnt = 3; /// The time (in milliseconds) to timeout an idle connection or unacknowledged send: /// This timer rides on the granularity of the keepalive or retransmission timers. /// For example, if keepalive will only send a probe after 10s then this becomes the lower bound /// for tcp_user_timeout to fire, even if tcp_user_timeout is 2s. Nevertheless, this would timeout /// the connection at 10s rather than wait for tcp_keepcnt probes to be sent. At the same time, if /// tcp_user_timeout is larger than the max keepalive time then tcp_keepcnt will be ignored and /// more keepalive probes will be sent until tcp_user_timeout fires. /// For a thorough overview of how these settings interact: /// https://blog.cloudflare.com/when-tcp-sockets-refuse-to-die/ pub const tcp_user_timeout = (tcp_keepidle + tcp_keepintvl * tcp_keepcnt) * 1000; /// Whether to disable Nagle's algorithm to eliminate send buffering delays: pub const tcp_nodelay = true; /// The minimum size of an aligned kernel page and an Advanced Format disk sector: /// This is necessary for direct I/O without the kernel having to fix unaligned pages with a copy. /// The new Advanced Format sector size is backwards compatible with the old 512 byte sector size. /// This should therefore never be less than 4 KiB to be future-proof when server disks are swapped. pub const sector_size = 4096; /// Whether to perform direct I/O to the underlying disk device: /// This enables several performance optimizations: /// * A memory copy to the kernel's page cache can be eliminated for reduced CPU utilization. /// * I/O can be issued immediately to the disk device without buffering delay for improved latency. /// This also enables several safety features: /// * Disk data can be scrubbed to repair latent sector errors and checksum errors proactively. /// * Fsync failures can be recovered from correctly. /// WARNING: Disabling direct I/O is unsafe; the page cache cannot be trusted after an fsync error, /// even after an application panic, since the kernel will mark dirty pages as clean, even /// when they were never written to disk. pub const direct_io = true; /// The maximum number of concurrent read I/O operations to allow at once. pub const io_depth_read = 8; /// The maximum number of concurrent write I/O operations to allow at once. pub const io_depth_write = 8; /// The number of milliseconds between each replica tick, the basic unit of time in TigerBeetle. /// Used to regulate heartbeats, retries and timeouts, all specified as multiples of a tick. pub const tick_ms = 10; /// The conservative round-trip time at startup when there is no network knowledge. /// Adjusted dynamically thereafter for RTT-sensitive timeouts according to network congestion. /// This should be set higher rather than lower to avoid flooding the network at startup. pub const rtt_ticks = 300 / tick_ms; /// The multiple of round-trip time for RTT-sensitive timeouts. pub const rtt_multiple = 2; /// The min/max bounds of exponential backoff (and jitter) to add to RTT-sensitive timeouts. pub const backoff_min_ticks = 100 / tick_ms; pub const backoff_max_ticks = 10000 / tick_ms; /// The maximum skew between two clocks to allow when considering them to be in agreement. /// The principle is that no two clocks tick exactly alike but some clocks more or less agree. /// The maximum skew across the cluster as a whole is this value times the total number of clocks. /// The cluster will be unavailable if the majority of clocks are all further than this value apart. /// Decreasing this reduces the probability of reaching agreement on synchronized time. /// Increasing this reduces the accuracy of synchronized time. pub const clock_offset_tolerance_max_ms = 10000; /// The amount of time before the clock's synchronized epoch is expired. /// If the epoch is expired before it can be replaced with a new synchronized epoch, then this most /// likely indicates either a network partition or else too many clock faults across the cluster. /// A new synchronized epoch will be installed as soon as these conditions resolve. pub const clock_epoch_max_ms = 60000; /// The amount of time to wait for enough accurate samples before synchronizing the clock. /// The more samples we can take per remote clock source, the more accurate our estimation becomes. /// This impacts cluster startup time as the leader must first wait for synchronization to complete. pub const clock_synchronization_window_min_ms = 2000; /// The amount of time without agreement before the clock window is expired and a new window opened. /// This happens where some samples have been collected but not enough to reach agreement. /// The quality of samples degrades as they age so at some point we throw them away and start over. /// This eliminates the impact of gradual clock drift on our clock offset (clock skew) measurements. /// If a window expires because of this then it is likely that the clock epoch will also be expired. pub const clock_synchronization_window_max_ms = 20000; comptime { // vsr.parse_address assumes that config.address/config.port are valid. _ = std.net.Address.parseIp4(address, 0) catch unreachable; _ = @as(u16, port); // Avoid latency issues from a too-large sndbuf. assert(tcp_sndbuf_replica <= 4 * 1024 * 1024); assert(tcp_sndbuf_client <= 4 * 1024 * 1024); }
src/config.zig
const std = @import("std"); const api = @import("./buzz_api.zig"); const utils = @import("../src/utils.zig"); export fn mkDir(vm: *api.VM) c_int { const filename: []const u8 = std.mem.sliceTo(api.Value.bz_valueToString(vm.bz_peek(0)) orelse { vm.bz_throwString("Could not get filename"); return -1; }, 0); if (std.fs.path.isAbsolute(filename)) { std.fs.makeDirAbsolute(filename) catch { vm.bz_throwString("Could not create directory"); return -1; }; } else { std.fs.cwd().makeDir(filename) catch { vm.bz_throwString("Could not create directory"); return -1; }; } return 0; } export fn rm(vm: *api.VM) c_int { const filename: []const u8 = std.mem.sliceTo(api.Value.bz_valueToString(vm.bz_peek(0)) orelse { vm.bz_throwString("Could not get filename"); return -1; }, 0); if (std.fs.path.isAbsolute(filename)) { std.fs.deleteTreeAbsolute(filename) catch { vm.bz_throwString("Could not delete file or directory"); return -1; }; } else { std.fs.cwd().deleteTree(filename) catch { vm.bz_throwString("Could not delete file or directory"); return -1; }; } return 0; } export fn move(_: *api.VM) c_int { unreachable; } export fn ls(vm: *api.VM) c_int { const filename: []const u8 = std.mem.sliceTo(api.Value.bz_valueToString(vm.bz_peek(0)) orelse { vm.bz_throwString("Could not get filename"); return -1; }, 0); const dir: std.fs.Dir = if (std.fs.path.isAbsolute(filename)) std.fs.openDirAbsolute(filename, .{}) catch { vm.bz_throwString("Could not list directory"); return -1; } else std.fs.cwd().openDir(filename, .{}) catch { vm.bz_throwString("Could not list directory"); return -1; }; var list = api.ObjList.bz_newList(vm, api.ObjTypeDef.bz_stringType() orelse { vm.bz_throwString("Could not list directory"); return -1; }) orelse { vm.bz_throwString("Could not list directory"); return -1; }; var it = dir.iterate(); while (it.next() catch { vm.bz_throwString("Could not list directory"); return -1; }) |element| { vm.bz_pushString(api.ObjString.bz_string(vm, utils.toCString(api.VM.allocator, element.name) orelse { vm.bz_throwString("Could not list directory"); return -1; }) orelse { vm.bz_throwString("Could not list directory"); return -1; }); if (!list.bz_listAppend(vm.bz_pop())) { vm.bz_throwString("Could not list directory"); return -1; } } vm.bz_pushList(list); return 1; }
lib/buzz_fs.zig
const olin = @import("./olin/olin.zig"); const env = olin.env; const log = olin.log; const random = olin.random; const resource = olin.resource; const time = olin.time; const runtime = olin.runtime; const startup = olin.startup; pub const os = olin; pub const panic = os.panic; const std = @import("std"); const assert = std.debug.assert; var alloc = std.heap.page_allocator; pub fn main() anyerror!void { std.os.exit(do()); } fn do() u8 { log.info("hi"); log.warning("hi"); log.err("hi"); const ai32 = random.int32(); const bi32 = random.int32(); assert(ai32 != bi32); const ai64 = random.int64(); const bi64 = random.int64(); assert(ai64 != bi64); const now = time.unix(); assert(now != 0); test_runtime_sleep(); test_time(); test_resource_log() catch return 1; test_resource_random() catch return 2; test_env_get() catch return 3; test_runtime_metadata() catch return 4; test_startup_args() catch return 5; return 0; } fn test_resource_log() !void { const msg = "hi there"; const fout = try resource.open("log://?prefix=test"); const n = try fout.write(msg); fout.close(); } fn test_resource_random() !void { const fin = try resource.open("random://"); var buf: []u8 = try alloc.alloc(u8, 32); defer alloc.free(buf); _ = try fin.read(buf); } fn test_env_get() !void { const key = "MAGIC_CONCH"; log.info("getting env"); const val = try env.get(alloc, key); log.info(val); alloc.free(val); } fn test_runtime_sleep() void { runtime.sleep(1); } fn test_runtime_metadata() !void { const metadata = try runtime.metadata(alloc); log.info(metadata.name); alloc.destroy(metadata); } fn test_time() void { const now = time.unix(); @import("std").debug.assert(now != 0); } fn test_startup_args() !void { var args = try startup.args(alloc); for (args) |v| { log.info(v); } startup.free_args(alloc, args); }
zig/src/coi.zig
const std = @import("std"); const builtin = @import("builtin"); const objc = @import("zig-objcrt"); const common = @import("common.zig"); const InitFn = common.InitFn; const DeinitFn = common.DeinitFn; const FrameFn = common.FrameFn; const AudioPlaybackFn = common.AudioPlaybackFn; const FrameInput = common.FrameInput; const AudioPlaybackStream = common.AudioPlaybackStream; const KeyEvent = common.KeyEvent; const MouseButton = common.MouseButton; const MouseButtonEvent = common.MouseButtonEvent; const Key = common.Key; // TODO(hazeycode): CoreAudio const AudioPlaybackInterface = struct { num_channels: u32 = 0, sample_rate: u32 = 0, pub fn init(_: u64) !AudioPlaybackInterface { return .{}; } }; const GraphicsAPI = enum { metal, }; pub var target_framerate: u16 = undefined; var window_width: u16 = undefined; var window_height: u16 = undefined; pub var audio_playback = struct { user_cb: ?fn (AudioPlaybackStream) anyerror!u32 = null, interface: AudioPlaybackInterface = undefined, thread: std.Thread = undefined, }{}; var timer: std.time.Timer = undefined; var allocator: *std.mem.Allocator = undefined; var frame_fn: fn (FrameInput) anyerror!bool = undefined; var window_closed = false; var frame_timer: std.time.Timer = undefined; var prev_cpu_frame_elapsed: u64 = 0; pub fn timestamp() u64 { return timer.read(); } pub fn run(args: struct { graphics_api: GraphicsAPI = .metal, requested_framerate: u16 = 0, title: []const u8 = "", window_size: struct { width: u16, height: u16, } = .{ .width = 854, .height = 480, }, init_fn: InitFn, deinit_fn: DeinitFn, frame_fn: FrameFn, audio_playback: ?struct { request_sample_rate: u32 = 48000, callback: AudioPlaybackFn = null, }, }) !void { timer = try std.time.Timer.start(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); allocator = gpa.allocator(); // TODO(hazeycode): get monitor refresh and shoot for that, downgrade if we miss alot target_framerate = if (args.requested_framerate == 0) 60 else args.requested_framerate; frame_fn = args.frame_fn; try args.init_fn(allocator); defer args.deinit_fn(); const CGFloat = switch (builtin.target.cpu.arch.ptrBitWidth()) { 32 => f32, 64 => f64, else => @compileError("Mad CPU!"), }; const NSApplication = try objc.getClass("NSApplication"); const NSString = try objc.getClass("NSString"); const AppDelegate = try objc.getClass("AppDelegate"); const application = try objc.msgSendByName(objc.id, NSApplication, "sharedApplication", .{}); const title_string = try objc.msgSendByName(objc.id, NSString, "stringWithUTF8String:", .{args.title.ptr}); const app_delegate = try objc.msgSendByName( objc.id, AppDelegate, "appDelegateWithWindowWidth:height:andTitle:", .{ @intToFloat(CGFloat, args.window_size.width), @intToFloat(CGFloat, args.window_size.height), title_string, }, ); try objc.msgSendByName(void, application, "setDelegate:", .{app_delegate}); frame_timer = try std.time.Timer.start(); try objc.msgSendByName(void, application, "run", .{}); } export fn frame(view_width: c_int, view_height: c_int) callconv(.C) void { const prev_frame_elapsed = frame_timer.lap(); const start_cpu_time = timestamp(); var frame_mem_arena = std.heap.ArenaAllocator.init(allocator); defer frame_mem_arena.deinit(); const arena_allocator = frame_mem_arena.allocator(); var key_events = std.ArrayList(FrameInput.KeyEvent).init(arena_allocator); var mouse_button_events = std.ArrayList(FrameInput.MouseButtonEvent).init(arena_allocator); const target_frame_dt = @floatToInt(u64, (1 / @intToFloat(f64, target_framerate) * 1e9)); _ = !(frame_fn(.{ .frame_arena_allocator = arena_allocator, .quit_requested = window_closed, .target_frame_dt = target_frame_dt, .prev_frame_elapsed = prev_frame_elapsed, .user_input = .{ .key_events = key_events.items, .mouse_button_events = mouse_button_events.items, .mouse_position = .{}, }, .window_size = .{ .width = @intCast(u16, view_width), .height = @intCast(u16, view_height), }, .debug_stats = .{ .prev_cpu_frame_elapsed = prev_cpu_frame_elapsed, }, }) catch unreachable); prev_cpu_frame_elapsed = timestamp() - start_cpu_time; const remaining_frame_time = @intCast(i128, target_frame_dt - 100000) - frame_timer.read(); if (remaining_frame_time > 0) { std.time.sleep(@intCast(u64, remaining_frame_time)); } }
modules/platform/src/macos.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const List = std.ArrayList; const Map = std.AutoHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day17.txt"); const int = i64; const Target = struct { min_x: int, max_x: int, min_y: int, max_y: int, }; // We can do a brute search of all velocities and check each one for a hit on target // To get the bounds of our search, we need to consider the following. // v_x must be >0 to hit target so lower bound is zero // v_x must be less than max_x otherwise it would miss the target so max_x is the upper bound inclusive // v_y must be greater than min_y otherwise it would miss the target so min_y is the lower bound inclusive // When shooting up, the projectile must come down. It comes exactly to zero with velocity -v0-1 // So on the next iteration, y will land at y=-v0-1. So min_y=-v0-1 -> -min_y-1=v0 is the upper bound pub fn main() !void { const target = Target {.min_x = 135, .max_x = 155, .min_y=-102 , .max_y =-78 }; //const target = Target {.min_x = 20, .max_x=30, .min_y=-10, .max_y=-5}; var max_y_hit: int = 0; var count :int = 0; var vx_init:int = 0; while (vx_init <= target.max_x) : (vx_init += 1) { var vy_init:int = target.min_y; while (vy_init <= -target.min_y-1) : (vy_init += 1) { var max_y: int = 0; var vx = vx_init; var vy = vy_init; var x:int = 0; var y:int = 0; while (x <= target.max_x and y >= target.min_y) { max_y = max(max_y, y); //print("pos:{},{} vel:{},{}\n", .{x,y,vx,vy}); if (x <= target.max_x and x >= target.min_x and y >= target.min_y and y <= target.max_y) { max_y_hit = max(max_y_hit, max_y); count += 1; break; } x += vx; y += vy; vx = if (vx==0) 0 else if (vx>0) vx-1 else vx+1; vy -= 1; } } } assert(max_y_hit==5151); assert(count == 968); print("{}\n", .{max_y_hit}); print("{}\n", .{count}); } // Useful stdlib functions const tokenize = std.mem.tokenize; const split = std.mem.split; const indexOf = std.mem.indexOfScalar; const indexOfAny = std.mem.indexOfAny; const indexOfStr = std.mem.indexOfPosLinear; const lastIndexOf = std.mem.lastIndexOfScalar; const lastIndexOfAny = std.mem.lastIndexOfAny; const lastIndexOfStr = std.mem.lastIndexOfLinear; const trim = std.mem.trim; const sliceMin = std.mem.min; const sliceMax = std.mem.max; const parseInt = std.fmt.parseInt; const parseFloat = std.fmt.parseFloat; const min = std.math.min; const min3 = std.math.min3; const max = std.math.max; const max3 = std.math.max3; const print = std.debug.print; const assert = std.debug.assert; const sort = std.sort.sort; const asc = std.sort.asc; const desc = std.sort.desc;
src/day17.zig
//-------------------------------------------------------------------------------- // Section: Types (20) //-------------------------------------------------------------------------------- pub const AMSI_RESULT = enum(i32) { CLEAN = 0, NOT_DETECTED = 1, BLOCKED_BY_ADMIN_START = 16384, BLOCKED_BY_ADMIN_END = 20479, DETECTED = 32768, }; pub const AMSI_RESULT_CLEAN = AMSI_RESULT.CLEAN; pub const AMSI_RESULT_NOT_DETECTED = AMSI_RESULT.NOT_DETECTED; pub const AMSI_RESULT_BLOCKED_BY_ADMIN_START = AMSI_RESULT.BLOCKED_BY_ADMIN_START; pub const AMSI_RESULT_BLOCKED_BY_ADMIN_END = AMSI_RESULT.BLOCKED_BY_ADMIN_END; pub const AMSI_RESULT_DETECTED = AMSI_RESULT.DETECTED; pub const AMSI_ATTRIBUTE = enum(i32) { APP_NAME = 0, CONTENT_NAME = 1, CONTENT_SIZE = 2, CONTENT_ADDRESS = 3, SESSION = 4, REDIRECT_CHAIN_SIZE = 5, REDIRECT_CHAIN_ADDRESS = 6, ALL_SIZE = 7, ALL_ADDRESS = 8, QUIET = 9, }; pub const AMSI_ATTRIBUTE_APP_NAME = AMSI_ATTRIBUTE.APP_NAME; pub const AMSI_ATTRIBUTE_CONTENT_NAME = AMSI_ATTRIBUTE.CONTENT_NAME; pub const AMSI_ATTRIBUTE_CONTENT_SIZE = AMSI_ATTRIBUTE.CONTENT_SIZE; pub const AMSI_ATTRIBUTE_CONTENT_ADDRESS = AMSI_ATTRIBUTE.CONTENT_ADDRESS; pub const AMSI_ATTRIBUTE_SESSION = AMSI_ATTRIBUTE.SESSION; pub const AMSI_ATTRIBUTE_REDIRECT_CHAIN_SIZE = AMSI_ATTRIBUTE.REDIRECT_CHAIN_SIZE; pub const AMSI_ATTRIBUTE_REDIRECT_CHAIN_ADDRESS = AMSI_ATTRIBUTE.REDIRECT_CHAIN_ADDRESS; pub const AMSI_ATTRIBUTE_ALL_SIZE = AMSI_ATTRIBUTE.ALL_SIZE; pub const AMSI_ATTRIBUTE_ALL_ADDRESS = AMSI_ATTRIBUTE.ALL_ADDRESS; pub const AMSI_ATTRIBUTE_QUIET = AMSI_ATTRIBUTE.QUIET; pub const AMSI_UAC_REQUEST_TYPE = enum(i32) { EXE = 0, COM = 1, MSI = 2, AX = 3, PACKAGED_APP = 4, MAX = 5, }; pub const AMSI_UAC_REQUEST_TYPE_EXE = AMSI_UAC_REQUEST_TYPE.EXE; pub const AMSI_UAC_REQUEST_TYPE_COM = AMSI_UAC_REQUEST_TYPE.COM; pub const AMSI_UAC_REQUEST_TYPE_MSI = AMSI_UAC_REQUEST_TYPE.MSI; pub const AMSI_UAC_REQUEST_TYPE_AX = AMSI_UAC_REQUEST_TYPE.AX; pub const AMSI_UAC_REQUEST_TYPE_PACKAGED_APP = AMSI_UAC_REQUEST_TYPE.PACKAGED_APP; pub const AMSI_UAC_REQUEST_TYPE_MAX = AMSI_UAC_REQUEST_TYPE.MAX; pub const AMSI_UAC_TRUST_STATE = enum(i32) { TRUSTED = 0, UNTRUSTED = 1, BLOCKED = 2, MAX = 3, }; pub const AMSI_UAC_TRUST_STATE_TRUSTED = AMSI_UAC_TRUST_STATE.TRUSTED; pub const AMSI_UAC_TRUST_STATE_UNTRUSTED = AMSI_UAC_TRUST_STATE.UNTRUSTED; pub const AMSI_UAC_TRUST_STATE_BLOCKED = AMSI_UAC_TRUST_STATE.BLOCKED; pub const AMSI_UAC_TRUST_STATE_MAX = AMSI_UAC_TRUST_STATE.MAX; pub const AMSI_UAC_MSI_ACTION = enum(i32) { INSTALL = 0, UNINSTALL = 1, UPDATE = 2, MAINTENANCE = 3, MAX = 4, }; pub const AMSI_UAC_MSI_ACTION_INSTALL = AMSI_UAC_MSI_ACTION.INSTALL; pub const AMSI_UAC_MSI_ACTION_UNINSTALL = AMSI_UAC_MSI_ACTION.UNINSTALL; pub const AMSI_UAC_MSI_ACTION_UPDATE = AMSI_UAC_MSI_ACTION.UPDATE; pub const AMSI_UAC_MSI_ACTION_MAINTENANCE = AMSI_UAC_MSI_ACTION.MAINTENANCE; pub const AMSI_UAC_MSI_ACTION_MAX = AMSI_UAC_MSI_ACTION.MAX; pub const AMSI_UAC_REQUEST_EXE_INFO = extern struct { ulLength: u32, lpwszApplicationName: ?PWSTR, lpwszCommandLine: ?PWSTR, lpwszDLLParameter: ?PWSTR, }; pub const AMSI_UAC_REQUEST_COM_INFO = extern struct { ulLength: u32, lpwszServerBinary: ?PWSTR, lpwszRequestor: ?PWSTR, Clsid: Guid, }; pub const AMSI_UAC_REQUEST_MSI_INFO = extern struct { ulLength: u32, MsiAction: AMSI_UAC_MSI_ACTION, lpwszProductName: ?PWSTR, lpwszVersion: ?PWSTR, lpwszLanguage: ?PWSTR, lpwszManufacturer: ?PWSTR, lpwszPackagePath: ?PWSTR, lpwszPackageSource: ?PWSTR, ulUpdates: u32, ppwszUpdates: ?*?PWSTR, ppwszUpdateSources: ?*?PWSTR, }; pub const AMSI_UAC_REQUEST_AX_INFO = extern struct { ulLength: u32, lpwszLocalInstallPath: ?PWSTR, lpwszSourceURL: ?PWSTR, }; pub const AMSI_UAC_REQUEST_PACKAGED_APP_INFO = extern struct { ulLength: u32, lpwszApplicationName: ?PWSTR, lpwszCommandLine: ?PWSTR, lpPackageFamilyName: ?PWSTR, lpApplicationId: ?PWSTR, }; pub const AMSI_UAC_REQUEST_CONTEXT = extern struct { ulLength: u32, ulRequestorProcessId: u32, UACTrustState: AMSI_UAC_TRUST_STATE, Type: AMSI_UAC_REQUEST_TYPE, RequestType: extern union { ExeInfo: AMSI_UAC_REQUEST_EXE_INFO, ComInfo: AMSI_UAC_REQUEST_COM_INFO, MsiInfo: AMSI_UAC_REQUEST_MSI_INFO, ActiveXInfo: AMSI_UAC_REQUEST_AX_INFO, PackagedAppInfo: AMSI_UAC_REQUEST_PACKAGED_APP_INFO, }, bAutoElevateRequest: BOOL, }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IAmsiStream_Value = Guid.initString("3e47f2e5-81d4-4d3b-897f-545096770373"); pub const IID_IAmsiStream = &IID_IAmsiStream_Value; pub const IAmsiStream = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAttribute: fn( self: *const IAmsiStream, attribute: AMSI_ATTRIBUTE, dataSize: u32, data: [*:0]u8, retData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Read: fn( self: *const IAmsiStream, position: u64, size: u32, buffer: [*:0]u8, readSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAmsiStream_GetAttribute(self: *const T, attribute: AMSI_ATTRIBUTE, dataSize: u32, data: [*:0]u8, retData: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAmsiStream.VTable, self.vtable).GetAttribute(@ptrCast(*const IAmsiStream, self), attribute, dataSize, data, retData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAmsiStream_Read(self: *const T, position: u64, size: u32, buffer: [*:0]u8, readSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAmsiStream.VTable, self.vtable).Read(@ptrCast(*const IAmsiStream, self), position, size, buffer, readSize); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IAntimalwareProvider_Value = Guid.initString("b2cabfe3-fe04-42b1-a5df-08d483d4d125"); pub const IID_IAntimalwareProvider = &IID_IAntimalwareProvider_Value; pub const IAntimalwareProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Scan: fn( self: *const IAntimalwareProvider, stream: ?*IAmsiStream, result: ?*AMSI_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseSession: fn( self: *const IAntimalwareProvider, session: u64, ) callconv(@import("std").os.windows.WINAPI) void, DisplayName: fn( self: *const IAntimalwareProvider, displayName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalwareProvider_Scan(self: *const T, stream: ?*IAmsiStream, result: ?*AMSI_RESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IAntimalwareProvider.VTable, self.vtable).Scan(@ptrCast(*const IAntimalwareProvider, self), stream, result); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalwareProvider_CloseSession(self: *const T, session: u64) callconv(.Inline) void { return @ptrCast(*const IAntimalwareProvider.VTable, self.vtable).CloseSession(@ptrCast(*const IAntimalwareProvider, self), session); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalwareProvider_DisplayName(self: *const T, displayName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAntimalwareProvider.VTable, self.vtable).DisplayName(@ptrCast(*const IAntimalwareProvider, self), displayName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAntimalwareUacProvider_Value = Guid.initString("b2cabfe4-fe04-42b1-a5df-08d483d4d125"); pub const IID_IAntimalwareUacProvider = &IID_IAntimalwareUacProvider_Value; pub const IAntimalwareUacProvider = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, UacScan: fn( self: *const IAntimalwareUacProvider, context: ?*AMSI_UAC_REQUEST_CONTEXT, result: ?*AMSI_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisplayName: fn( self: *const IAntimalwareUacProvider, displayName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalwareUacProvider_UacScan(self: *const T, context: ?*AMSI_UAC_REQUEST_CONTEXT, result: ?*AMSI_RESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IAntimalwareUacProvider.VTable, self.vtable).UacScan(@ptrCast(*const IAntimalwareUacProvider, self), context, result); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalwareUacProvider_DisplayName(self: *const T, displayName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAntimalwareUacProvider.VTable, self.vtable).DisplayName(@ptrCast(*const IAntimalwareUacProvider, self), displayName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAntimalwareProvider2_Value = Guid.initString("7c1e6570-3f73-4e0f-8ad4-98b94cd3290f"); pub const IID_IAntimalwareProvider2 = &IID_IAntimalwareProvider2_Value; pub const IAntimalwareProvider2 = extern struct { pub const VTable = extern struct { base: IAntimalwareProvider.VTable, Notify: fn( self: *const IAntimalwareProvider2, buffer: ?*anyopaque, length: u32, contentName: ?[*:0]const u16, appName: ?[*:0]const u16, pResult: ?*AMSI_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAntimalwareProvider.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalwareProvider2_Notify(self: *const T, buffer: ?*anyopaque, length: u32, contentName: ?[*:0]const u16, appName: ?[*:0]const u16, pResult: ?*AMSI_RESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IAntimalwareProvider2.VTable, self.vtable).Notify(@ptrCast(*const IAntimalwareProvider2, self), buffer, length, contentName, appName, pResult); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IAntimalware_Value = Guid.initString("82d29c2e-f062-44e6-b5c9-3d9a2f24a2df"); pub const IID_IAntimalware = &IID_IAntimalware_Value; pub const IAntimalware = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Scan: fn( self: *const IAntimalware, stream: ?*IAmsiStream, result: ?*AMSI_RESULT, provider: ?*?*IAntimalwareProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseSession: fn( self: *const IAntimalware, session: u64, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalware_Scan(self: *const T, stream: ?*IAmsiStream, result: ?*AMSI_RESULT, provider: ?*?*IAntimalwareProvider) callconv(.Inline) HRESULT { return @ptrCast(*const IAntimalware.VTable, self.vtable).Scan(@ptrCast(*const IAntimalware, self), stream, result, provider); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalware_CloseSession(self: *const T, session: u64) callconv(.Inline) void { return @ptrCast(*const IAntimalware.VTable, self.vtable).CloseSession(@ptrCast(*const IAntimalware, self), session); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAntimalware2_Value = Guid.initString("301035b5-2d42-4f56-8c65-2dcaa7fb3cdc"); pub const IID_IAntimalware2 = &IID_IAntimalware2_Value; pub const IAntimalware2 = extern struct { pub const VTable = extern struct { base: IAntimalware.VTable, Notify: fn( self: *const IAntimalware2, buffer: ?*anyopaque, length: u32, contentName: ?[*:0]const u16, appName: ?[*:0]const u16, pResult: ?*AMSI_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAntimalware.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAntimalware2_Notify(self: *const T, buffer: ?*anyopaque, length: u32, contentName: ?[*:0]const u16, appName: ?[*:0]const u16, pResult: ?*AMSI_RESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IAntimalware2.VTable, self.vtable).Notify(@ptrCast(*const IAntimalware2, self), buffer, length, contentName, appName, pResult); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_CAntimalware_Value = Guid.initString("fdb00e52-a214-4aa1-8fba-4357bb0072ec"); pub const CLSID_CAntimalware = &CLSID_CAntimalware_Value; pub const HAMSICONTEXT = *opaque{}; pub const HAMSISESSION = *opaque{}; //-------------------------------------------------------------------------------- // Section: Functions (8) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows10.0.10240' pub extern "Amsi" fn AmsiInitialize( appName: ?[*:0]const u16, amsiContext: ?*?HAMSICONTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "Amsi" fn AmsiUninitialize( amsiContext: ?HAMSICONTEXT, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "Amsi" fn AmsiOpenSession( amsiContext: ?HAMSICONTEXT, amsiSession: ?*?HAMSISESSION, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "Amsi" fn AmsiCloseSession( amsiContext: ?HAMSICONTEXT, amsiSession: ?HAMSISESSION, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "Amsi" fn AmsiScanBuffer( amsiContext: ?HAMSICONTEXT, // TODO: what to do with BytesParamIndex 2? buffer: ?*anyopaque, length: u32, contentName: ?[*:0]const u16, amsiSession: ?HAMSISESSION, result: ?*AMSI_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "Amsi" fn AmsiNotifyOperation( amsiContext: ?HAMSICONTEXT, // TODO: what to do with BytesParamIndex 2? buffer: ?*anyopaque, length: u32, contentName: ?[*:0]const u16, result: ?*AMSI_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "Amsi" fn AmsiScanString( amsiContext: ?HAMSICONTEXT, string: ?[*:0]const u16, contentName: ?[*:0]const u16, amsiSession: ?HAMSISESSION, result: ?*AMSI_RESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows8.1' pub extern "KERNEL32" fn InstallELAMCertificateInfo( ELAMFile: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (6) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const HANDLE = @import("../foundation.zig").HANDLE; const HRESULT = @import("../foundation.zig").HRESULT; const IUnknown = @import("../system/com.zig").IUnknown; const PWSTR = @import("../foundation.zig").PWSTR; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/antimalware.zig
// todo: use package-merge algorithm to ensure length-limited codes. const std = @import("std"); const expect = std.testing.expect; const NodeTag = enum { internal, leaf }; const Node = union(NodeTag) { internal: struct { left: *Node, right: *Node, count: u64 }, leaf: struct { byte: u8, count: u64 }, fn get_count(self: Node) u64 { return switch (self) { .leaf => self.leaf.count, .internal => self.internal.count }; } fn print(self: Node) void { if (self == .leaf) { std.debug.print("Leaf node:\n Count: {}\n Byte: {} « {c} »\n\n", .{ self.leaf.count, self.leaf.byte, self.leaf.byte}); } else if (self == .internal) { std.debug.print("Internal node:\n Count: {}\n Left: {}\n Right: {}\n\n", .{self.internal.count, self.internal.left, self.internal.right}); } } fn print_recursive(self: *Node) void { self.print(); if (self.* == .internal) { self.internal.left.print_recursive(); self.internal.right.print_recursive(); } } }; fn compare_nodes_desc(ctx: void, a: *Node, b: *Node) bool { _ = ctx; return a.get_count() > b.get_count(); } /// Build Huffman (binary) tree. /// Caller must free the tree. // todo: read files through 4K / page-sized chunks. fn tree_build(allocator: *std.mem.Allocator, text: []const u8) !*Node { // Build ArrayList of pointers to alloc'd leaf nodes. var nodes = std.ArrayList(*Node).init(allocator); defer nodes.deinit(); outer: for (text) |byte| { for (nodes.items) |node| { if (byte == node.leaf.byte) { node.leaf.count += 1; continue :outer; } } // Reached only if byte not in `nodes`. var node: *Node = try allocator.create(Node); node.* = Node { .leaf = .{ .byte = byte, .count = 1 } }; try nodes.append(node); } for (nodes.items) |n| { if (n.* == .leaf) { std.debug.print("{X} {c} = {}\n", .{n.leaf.byte, n.leaf.byte, n.get_count()}); } } // Build tree. while (nodes.items.len > 1) { std.sort.sort(*Node, nodes.items, {}, compare_nodes_desc); var child_left: *Node = nodes.pop(); var child_right: *Node = nodes.pop(); var node: *Node = try allocator.create(Node); node.* = Node { .internal = .{ .left = child_left, .right = child_right, .count = child_left.get_count() + child_right.get_count() } }; try nodes.append(node); } return nodes.pop(); // Tree root. } pub fn main() !void { const allocator = std.heap.page_allocator; const tree = tree_build(allocator, "Hello, world!"); //std.debug.print("{}", tree); _ = try tree; }
src/huffman.zig
const std = @import("std"); const fs = std.fs; const mem = std.mem; const print = std.debug.print; const c = @cImport({ @cInclude("unistd.h"); @cInclude("sys/types.h"); @cInclude("sys/param.h"); }); const proce_stat_core_times = packed struct { user: u64 = 0, nice: u64 = 0, system: u64 = 0, idle: u64 = 0, iowait: u64 = 0, irq: u64 = 0, softirq: u64 = 0, // steal: u64 = 0, // guest: u64 = 0, // guestnice: u64 = 0, }; // TODO : don't hard code this const num_cores = 4; // TODO : don't hard code this const jiffies = 100; const proc_stat = struct { tick_per_sec: u8 = jiffies, uptime: u64 = 0, idletime: u64 = 0, cpu: proce_stat_core_times, cores: [num_cores]proce_stat_core_times, }; fn parse_cpu_line(line: []const u8) proce_stat_core_times { var it = std.mem.split(line, " "); const ident = it.next() orelse @panic("stat: no core name"); // 'cpu' has two spaces after it instead of one, so advance over the null between them if (ident.len == 3) { _ = it.next(); } return proce_stat_core_times{ .user = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core user time"), 10) catch unreachable, .nice = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core nice time"), 10) catch unreachable, .system = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core system time"), 10) catch unreachable, .idle = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core idle time"), 10) catch unreachable, .iowait = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core iowait time"), 10) catch unreachable, .irq = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core irq time"), 10) catch unreachable, .softirq = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core softirq time"), 10) catch unreachable, // .steal = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core steal time"), 10) catch unreachable, // .guest = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core guest time"), 10) catch unreachable, // .guestnice = std.fmt.parseInt(u64, it.next() orelse @panic("stat: no core guestnice time"), 10) catch unreachable, }; } pub fn stat() !?proc_stat { const path = "/proc/stat"; var buf: [1024]u8 = undefined; var fd = fs.openFileAbsolute(path, fs.File.OpenFlags{ .read = true, .write = false }) catch unreachable; defer fd.close(); const reader = std.io.bufferedReader(fd.reader()).reader(); // Fill struct with default (e.g. 0) core_time structs var data: proc_stat = undefined; data.cpu = proce_stat_core_times{}; var core_idx: usize = 0; while (core_idx < num_cores) { data.cores[core_idx] = proce_stat_core_times{}; core_idx += 1; } core_idx = 0; while (try reader.readUntilDelimiterOrEof(&buf, '\n')) |line| { var it = std.mem.split(line, " "); const ident = it.next() orelse @panic("malformed /proc/stat"); // print("{s}\n", .{line}); if (ident.len >= 3 and mem.eql(u8, ident[0..3], "cpu")) { const times = parse_cpu_line(line); if (ident.len == 3) { data.cpu = times; } else { data.cores[core_idx] = times; core_idx += 1; } } } if (uptime()) |value| { data.uptime = @floatToInt(u64, value[0] * jiffies); data.idletime = @floatToInt(u64, value[1] * jiffies / num_cores); } data.tick_per_sec = jiffies; return data; } pub fn uptime() ?[2]f32 { const path = "/proc/uptime"; var buf: [32]u8 = undefined; if (fs.cwd().readFile(path, &buf)) |bytes| { var it = std.mem.split(bytes, " "); const uptime_s = it.next() orelse @panic("malformed /proc/uptime"); const idletime_s = it.next() orelse @panic("malformed /proc/uptime"); // print("uptime {s} {s}\n", .{ uptime_s, idletime_s[0 .. idletime_s.len - 1] }); const uptime_f = std.fmt.parseFloat(f32, uptime_s) catch unreachable; const idletime_f = std.fmt.parseFloat(f32, idletime_s[0 .. idletime_s.len - 1]) catch unreachable; // print("uptime {d} {d}\n", .{ uptime_f, idletime_f }); return [_]f32{ uptime_f, idletime_f }; } else |_| { return null; } return null; }
src/info.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "XFIXES", .global_id = 0 }; /// @brief QueryVersioncookie pub const QueryVersioncookie = struct { sequence: c_uint, }; /// @brief QueryVersionRequest pub const QueryVersionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 0, @"length": u16, @"client_major_version": u32, @"client_minor_version": u32, }; /// @brief QueryVersionReply pub const QueryVersionReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"major_version": u32, @"minor_version": u32, @"pad1": [16]u8, }; pub const SaveSetMode = extern enum(c_uint) { @"Insert" = 0, @"Delete" = 1, }; pub const SaveSetTarget = extern enum(c_uint) { @"Nearest" = 0, @"Root" = 1, }; pub const SaveSetMapping = extern enum(c_uint) { @"Map" = 0, @"Unmap" = 1, }; /// @brief ChangeSaveSetRequest pub const ChangeSaveSetRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 1, @"length": u16, @"mode": u8, @"target": u8, @"map": u8, @"pad0": u8, @"window": xcb.WINDOW, }; pub const SelectionEvent = extern enum(c_uint) { @"SetSelectionOwner" = 0, @"SelectionWindowDestroy" = 1, @"SelectionClientClose" = 2, }; pub const SelectionEventMask = extern enum(c_uint) { @"SetSelectionOwner" = 1, @"SelectionWindowDestroy" = 2, @"SelectionClientClose" = 4, }; /// Opcode for SelectionNotify. pub const SelectionNotifyOpcode = 0; /// @brief SelectionNotifyEvent pub const SelectionNotifyEvent = struct { @"response_type": u8, @"subtype": u8, @"sequence": u16, @"window": xcb.WINDOW, @"owner": xcb.WINDOW, @"selection": xcb.ATOM, @"timestamp": xcb.TIMESTAMP, @"selection_timestamp": xcb.TIMESTAMP, @"pad0": [8]u8, }; /// @brief SelectSelectionInputRequest pub const SelectSelectionInputRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 2, @"length": u16, @"window": xcb.WINDOW, @"selection": xcb.ATOM, @"event_mask": u32, }; pub const CursorNotify = extern enum(c_uint) { @"DisplayCursor" = 0, }; pub const CursorNotifyMask = extern enum(c_uint) { @"DisplayCursor" = 1, }; /// Opcode for CursorNotify. pub const CursorNotifyOpcode = 1; /// @brief CursorNotifyEvent pub const CursorNotifyEvent = struct { @"response_type": u8, @"subtype": u8, @"sequence": u16, @"window": xcb.WINDOW, @"cursor_serial": u32, @"timestamp": xcb.TIMESTAMP, @"name": xcb.ATOM, @"pad0": [12]u8, }; /// @brief SelectCursorInputRequest pub const SelectCursorInputRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 3, @"length": u16, @"window": xcb.WINDOW, @"event_mask": u32, }; /// @brief GetCursorImagecookie pub const GetCursorImagecookie = struct { sequence: c_uint, }; /// @brief GetCursorImageRequest pub const GetCursorImageRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 4, @"length": u16, }; /// @brief GetCursorImageReply pub const GetCursorImageReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"x": i16, @"y": i16, @"width": u16, @"height": u16, @"xhot": u16, @"yhot": u16, @"cursor_serial": u32, @"pad1": [8]u8, @"cursor_image": []u32, }; pub const REGION = u32; /// Opcode for BadRegion. pub const BadRegionOpcode = 0; /// @brief BadRegionError pub const BadRegionError = struct { @"response_type": u8, @"error_code": u8, @"sequence": u16, }; pub const Region = extern enum(c_uint) { @"None" = 0, }; /// @brief CreateRegionRequest pub const CreateRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 5, @"length": u16, @"region": xcb.xfixes.REGION, @"rectangles": []const xcb.RECTANGLE, }; /// @brief CreateRegionFromBitmapRequest pub const CreateRegionFromBitmapRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 6, @"length": u16, @"region": xcb.xfixes.REGION, @"bitmap": xcb.PIXMAP, }; /// @brief CreateRegionFromWindowRequest pub const CreateRegionFromWindowRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 7, @"length": u16, @"region": xcb.xfixes.REGION, @"window": xcb.WINDOW, @"kind": xcb.shape.KIND, @"pad0": [3]u8, }; /// @brief CreateRegionFromGCRequest pub const CreateRegionFromGCRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 8, @"length": u16, @"region": xcb.xfixes.REGION, @"gc": xcb.GCONTEXT, }; /// @brief CreateRegionFromPictureRequest pub const CreateRegionFromPictureRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 9, @"length": u16, @"region": xcb.xfixes.REGION, @"picture": xcb.render.PICTURE, }; /// @brief DestroyRegionRequest pub const DestroyRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 10, @"length": u16, @"region": xcb.xfixes.REGION, }; /// @brief SetRegionRequest pub const SetRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 11, @"length": u16, @"region": xcb.xfixes.REGION, @"rectangles": []const xcb.RECTANGLE, }; /// @brief CopyRegionRequest pub const CopyRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 12, @"length": u16, @"source": xcb.xfixes.REGION, @"destination": xcb.xfixes.REGION, }; /// @brief UnionRegionRequest pub const UnionRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 13, @"length": u16, @"source1": xcb.xfixes.REGION, @"source2": xcb.xfixes.REGION, @"destination": xcb.xfixes.REGION, }; /// @brief IntersectRegionRequest pub const IntersectRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 14, @"length": u16, @"source1": xcb.xfixes.REGION, @"source2": xcb.xfixes.REGION, @"destination": xcb.xfixes.REGION, }; /// @brief SubtractRegionRequest pub const SubtractRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 15, @"length": u16, @"source1": xcb.xfixes.REGION, @"source2": xcb.xfixes.REGION, @"destination": xcb.xfixes.REGION, }; /// @brief InvertRegionRequest pub const InvertRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 16, @"length": u16, @"source": xcb.xfixes.REGION, @"bounds": xcb.RECTANGLE, @"destination": xcb.xfixes.REGION, }; /// @brief TranslateRegionRequest pub const TranslateRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 17, @"length": u16, @"region": xcb.xfixes.REGION, @"dx": i16, @"dy": i16, }; /// @brief RegionExtentsRequest pub const RegionExtentsRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 18, @"length": u16, @"source": xcb.xfixes.REGION, @"destination": xcb.xfixes.REGION, }; /// @brief FetchRegioncookie pub const FetchRegioncookie = struct { sequence: c_uint, }; /// @brief FetchRegionRequest pub const FetchRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 19, @"length": u16, @"region": xcb.xfixes.REGION, }; /// @brief FetchRegionReply pub const FetchRegionReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"extents": xcb.RECTANGLE, @"pad1": [16]u8, @"rectangles": []xcb.RECTANGLE, }; /// @brief SetGCClipRegionRequest pub const SetGCClipRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 20, @"length": u16, @"gc": xcb.GCONTEXT, @"region": xcb.xfixes.REGION, @"x_origin": i16, @"y_origin": i16, }; /// @brief SetWindowShapeRegionRequest pub const SetWindowShapeRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 21, @"length": u16, @"dest": xcb.WINDOW, @"dest_kind": xcb.shape.KIND, @"pad0": [3]u8, @"x_offset": i16, @"y_offset": i16, @"region": xcb.xfixes.REGION, }; /// @brief SetPictureClipRegionRequest pub const SetPictureClipRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 22, @"length": u16, @"picture": xcb.render.PICTURE, @"region": xcb.xfixes.REGION, @"x_origin": i16, @"y_origin": i16, }; /// @brief SetCursorNameRequest pub const SetCursorNameRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 23, @"length": u16, @"cursor": xcb.CURSOR, @"nbytes": u16, @"pad0": [2]u8, @"name": []const u8, }; /// @brief GetCursorNamecookie pub const GetCursorNamecookie = struct { sequence: c_uint, }; /// @brief GetCursorNameRequest pub const GetCursorNameRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 24, @"length": u16, @"cursor": xcb.CURSOR, }; /// @brief GetCursorNameReply pub const GetCursorNameReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"atom": xcb.ATOM, @"nbytes": u16, @"pad1": [18]u8, @"name": []u8, }; /// @brief GetCursorImageAndNamecookie pub const GetCursorImageAndNamecookie = struct { sequence: c_uint, }; /// @brief GetCursorImageAndNameRequest pub const GetCursorImageAndNameRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 25, @"length": u16, }; /// @brief GetCursorImageAndNameReply pub const GetCursorImageAndNameReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"x": i16, @"y": i16, @"width": u16, @"height": u16, @"xhot": u16, @"yhot": u16, @"cursor_serial": u32, @"cursor_atom": xcb.ATOM, @"nbytes": u16, @"pad1": [2]u8, @"cursor_image": []u32, @"name": []u8, }; /// @brief ChangeCursorRequest pub const ChangeCursorRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 26, @"length": u16, @"source": xcb.CURSOR, @"destination": xcb.CURSOR, }; /// @brief ChangeCursorByNameRequest pub const ChangeCursorByNameRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 27, @"length": u16, @"src": xcb.CURSOR, @"nbytes": u16, @"pad0": [2]u8, @"name": []const u8, }; /// @brief ExpandRegionRequest pub const ExpandRegionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 28, @"length": u16, @"source": xcb.xfixes.REGION, @"destination": xcb.xfixes.REGION, @"left": u16, @"right": u16, @"top": u16, @"bottom": u16, }; /// @brief HideCursorRequest pub const HideCursorRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 29, @"length": u16, @"window": xcb.WINDOW, }; /// @brief ShowCursorRequest pub const ShowCursorRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 30, @"length": u16, @"window": xcb.WINDOW, }; pub const BARRIER = u32; pub const BarrierDirections = extern enum(c_uint) { @"PositiveX" = 1, @"PositiveY" = 2, @"NegativeX" = 4, @"NegativeY" = 8, }; /// @brief CreatePointerBarrierRequest pub const CreatePointerBarrierRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 31, @"length": u16, @"barrier": xcb.xfixes.BARRIER, @"window": xcb.WINDOW, @"x1": u16, @"y1": u16, @"x2": u16, @"y2": u16, @"directions": u32, @"pad0": [2]u8, @"num_devices": u16, @"devices": []const u16, }; /// @brief DeletePointerBarrierRequest pub const DeletePointerBarrierRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 32, @"length": u16, @"barrier": xcb.xfixes.BARRIER, }; test "" { @import("std").testing.refAllDecls(@This()); }
src/auto/xfixes.zig
const std = @import("std"); const print = std.debug.print; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day22.txt"); pub fn main() !void { var timer = try std.time.Timer.start(); print("🎁 On Cubes: {}\n", .{part1(data)}); print("Day 22 - part 01 took {:15}ns\n", .{timer.lap()}); timer.reset(); print("🎁 On Cubes: {}\n", .{part2(data)}); print("Day 22 - part 02 took {:15}ns\n", .{timer.lap()}); print("❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️\n", .{}); } fn part1(input : []const u8) !usize { const offset = 50; const width = 101; var board = std.StaticBitSet(width * width * width).initEmpty(); var lines = std.mem.tokenize(input, "\r\n"); while (lines.next()) |line| { var iterator = std.mem.tokenize(line, " xyz=.,"); const isOn = std.mem.eql(u8, iterator.next().?, "on"); const xLo = std.math.max(-50, try std.fmt.parseInt(i32, iterator.next().?, 10)); const xHi = std.math.min(50, try std.fmt.parseInt(i32, iterator.next().?, 10)); const yLo = std.math.max(-50, try std.fmt.parseInt(i32, iterator.next().?, 10)); const yHi = std.math.min(50, try std.fmt.parseInt(i32, iterator.next().?, 10)); const zLo = std.math.max(-50, try std.fmt.parseInt(i32, iterator.next().?, 10)); const zHi = std.math.min(50, try std.fmt.parseInt(i32, iterator.next().?, 10)); var z = zLo; while (z <= zHi) : (z += 1) { const zOffset = @intCast(usize, z + offset); var y = yLo; while (y <= yHi) : (y += 1) { const yOffset = @intCast(usize, y + offset); var x = xLo; while (x <= xHi) : (x += 1) { const xOffset = @intCast(usize, x + offset); const index = (zOffset * width * width) + (yOffset * width) + xOffset; if (isOn) { board.set(@intCast(usize, index)); } else { board.unset(@intCast(usize, index)); } } } } } return board.count(); } const Region = struct { xLo : i32, xHi : i32, yLo : i32, yHi : i32, zLo : i32, zHi : i32, pub fn init(xLo : i32, xHi : i32, yLo : i32, yHi : i32, zLo : i32, zHi : i32) @This() { return @This() { .xLo = xLo, .xHi = xHi, .yLo = yLo, .yHi = yHi, .zLo = zLo, .zHi = zHi, }; } pub fn dump(me : *const @This(), header : ?[]const u8) void { if (header != null) { print("{s}\n", .{header.?}); } print(" Region ({}..{}, {}..{}, {}..{})\n", .{ me.xLo, me.xHi, me.yLo, me.yHi, me.zLo, me.zHi }); print(" Size {}\n", .{me.size()}); } pub fn intersection(me : *const @This(), other : @This()) ?@This() { const r = Region.init( std.math.max(me.xLo, other.xLo), std.math.min(me.xHi, other.xHi), std.math.max(me.yLo, other.yLo), std.math.min(me.yHi, other.yHi), std.math.max(me.zLo, other.zLo), std.math.min(me.zHi, other.zHi)); if (r.xLo > r.xHi or r.yLo > r.yHi or r.zLo > r.zHi) { return null; } else { return r; } } pub fn size(me : *const @This()) usize { const xSize = @intCast(usize, (me.xHi - me.xLo + 1)); const ySize = @intCast(usize, (me.yHi - me.yLo + 1)); const zSize = @intCast(usize, (me.zHi - me.zLo + 1)); return xSize * ySize * zSize; } }; const OnOrOffRegion = struct { region : Region, isOn : bool, pub fn init(region : Region, isOn : bool) @This() { return @This() { .region = region, .isOn = isOn, }; } pub fn dump(me : *const @This()) void { const header = if (me.isOn) "Region is on" else "Region is off"; me.region.dump(header); } }; fn part2(input : []const u8) !usize { var regions = std.ArrayList(OnOrOffRegion).init(gpa); var lines = std.mem.tokenize(input, "\r\n"); while (lines.next()) |line| { var iterator = std.mem.tokenize(line, " xyz=.,"); const isOn = std.mem.eql(u8, iterator.next().?, "on"); const xLo = try std.fmt.parseInt(i32, iterator.next().?, 10); const xHi = try std.fmt.parseInt(i32, iterator.next().?, 10); const yLo = try std.fmt.parseInt(i32, iterator.next().?, 10); const yHi = try std.fmt.parseInt(i32, iterator.next().?, 10); const zLo = try std.fmt.parseInt(i32, iterator.next().?, 10); const zHi = try std.fmt.parseInt(i32, iterator.next().?, 10); var region = Region.init(xLo, xHi, yLo, yHi, zLo, zHi); const len = regions.items.len; if (isOn) { try regions.append(OnOrOffRegion.init(region, isOn)); } var index : u32 = 0; while (index < len) : (index += 1) { const other = regions.items[index]; const intersection = region.intersection(other.region); if (intersection != null) { try regions.append(OnOrOffRegion.init(intersection.?, !other.isOn)); } } } var total : usize = 0; for (regions.items) |region| { const size = region.region.size(); if (region.isOn) { total += size; } else { total -= size; } } print("Total {}\n", .{total}); return total; } test "part1_example1" { const input = \\on x=10..12,y=10..12,z=10..12 \\on x=11..13,y=11..13,z=11..13 \\off x=9..11,y=9..11,z=9..11 \\on x=10..10,y=10..10,z=10..10 ; const result = try part1(input); try std.testing.expect(result == 39); } test "part1_example2" { const input = \\on x=-20..26,y=-36..17,z=-47..7 \\on x=-20..33,y=-21..23,z=-26..28 \\on x=-22..28,y=-29..23,z=-38..16 \\on x=-46..7,y=-6..46,z=-50..-1 \\on x=-49..1,y=-3..46,z=-24..28 \\on x=2..47,y=-22..22,z=-23..27 \\on x=-27..23,y=-28..26,z=-21..29 \\on x=-39..5,y=-6..47,z=-3..44 \\on x=-30..21,y=-8..43,z=-13..34 \\on x=-22..26,y=-27..20,z=-29..19 \\off x=-48..-32,y=26..41,z=-47..-37 \\on x=-12..35,y=6..50,z=-50..-2 \\off x=-48..-32,y=-32..-16,z=-15..-5 \\on x=-18..26,y=-33..15,z=-7..46 \\off x=-40..-22,y=-38..-28,z=23..41 \\on x=-16..35,y=-41..10,z=-47..6 \\off x=-32..-23,y=11..30,z=-14..3 \\on x=-49..-5,y=-3..45,z=-29..18 \\off x=18..30,y=-20..-8,z=-3..13 \\on x=-41..9,y=-7..43,z=-33..15 \\on x=-54112..-39298,y=-85059..-49293,z=-27449..7877 \\on x=967..23432,y=45373..81175,z=27513..53682 ; const result = try part1(input); try std.testing.expect(result == 590784); } test "handwritten" { const input = \\on x=0..2,y=0..2,z=0..2 \\on x=1..1,y=1..1,z=1..1 \\off x=2..2,y=2..2,z=2..2 \\on x=-1..-1,y=1..1,z=1..1 ; const result = try part2(input); try std.testing.expect(result == 27); } test "part2_example" { const input = \\on x=-5..47,y=-31..22,z=-19..33 \\on x=-44..5,y=-27..21,z=-14..35 \\on x=-49..-1,y=-11..42,z=-10..38 \\on x=-20..34,y=-40..6,z=-44..1 \\off x=26..39,y=40..50,z=-2..11 \\on x=-41..5,y=-41..6,z=-36..8 \\off x=-43..-33,y=-45..-28,z=7..25 \\on x=-33..15,y=-32..19,z=-34..11 \\off x=35..47,y=-46..-34,z=-11..5 \\on x=-14..36,y=-6..44,z=-16..29 \\on x=-57795..-6158,y=29564..72030,z=20435..90618 \\on x=36731..105352,y=-21140..28532,z=16094..90401 \\on x=30999..107136,y=-53464..15513,z=8553..71215 \\on x=13528..83982,y=-99403..-27377,z=-24141..23996 \\on x=-72682..-12347,y=18159..111354,z=7391..80950 \\on x=-1060..80757,y=-65301..-20884,z=-103788..-16709 \\on x=-83015..-9461,y=-72160..-8347,z=-81239..-26856 \\on x=-52752..22273,y=-49450..9096,z=54442..119054 \\on x=-29982..40483,y=-108474..-28371,z=-24328..38471 \\on x=-4958..62750,y=40422..118853,z=-7672..65583 \\on x=55694..108686,y=-43367..46958,z=-26781..48729 \\on x=-98497..-18186,y=-63569..3412,z=1232..88485 \\on x=-726..56291,y=-62629..13224,z=18033..85226 \\on x=-110886..-34664,y=-81338..-8658,z=8914..63723 \\on x=-55829..24974,y=-16897..54165,z=-121762..-28058 \\on x=-65152..-11147,y=22489..91432,z=-58782..1780 \\on x=-120100..-32970,y=-46592..27473,z=-11695..61039 \\on x=-18631..37533,y=-124565..-50804,z=-35667..28308 \\on x=-57817..18248,y=49321..117703,z=5745..55881 \\on x=14781..98692,y=-1341..70827,z=15753..70151 \\on x=-34419..55919,y=-19626..40991,z=39015..114138 \\on x=-60785..11593,y=-56135..2999,z=-95368..-26915 \\on x=-32178..58085,y=17647..101866,z=-91405..-8878 \\on x=-53655..12091,y=50097..105568,z=-75335..-4862 \\on x=-111166..-40997,y=-71714..2688,z=5609..50954 \\on x=-16602..70118,y=-98693..-44401,z=5197..76897 \\on x=16383..101554,y=4615..83635,z=-44907..18747 \\off x=-95822..-15171,y=-19987..48940,z=10804..104439 \\on x=-89813..-14614,y=16069..88491,z=-3297..45228 \\on x=41075..99376,y=-20427..49978,z=-52012..13762 \\on x=-21330..50085,y=-17944..62733,z=-112280..-30197 \\on x=-16478..35915,y=36008..118594,z=-7885..47086 \\off x=-98156..-27851,y=-49952..43171,z=-99005..-8456 \\off x=2032..69770,y=-71013..4824,z=7471..94418 \\on x=43670..120875,y=-42068..12382,z=-24787..38892 \\off x=37514..111226,y=-45862..25743,z=-16714..54663 \\off x=25699..97951,y=-30668..59918,z=-15349..69697 \\off x=-44271..17935,y=-9516..60759,z=49131..112598 \\on x=-61695..-5813,y=40978..94975,z=8655..80240 \\off x=-101086..-9439,y=-7088..67543,z=33935..83858 \\off x=18020..114017,y=-48931..32606,z=21474..89843 \\off x=-77139..10506,y=-89994..-18797,z=-80..59318 \\off x=8476..79288,y=-75520..11602,z=-96624..-24783 \\on x=-47488..-1262,y=24338..100707,z=16292..72967 \\off x=-84341..13987,y=2429..92914,z=-90671..-1318 \\off x=-37810..49457,y=-71013..-7894,z=-105357..-13188 \\off x=-27365..46395,y=31009..98017,z=15428..76570 \\off x=-70369..-16548,y=22648..78696,z=-1892..86821 \\on x=-53470..21291,y=-120233..-33476,z=-44150..38147 \\off x=-93533..-4276,y=-16170..68771,z=-104985..-24507 ; const result = try part2(input); try std.testing.expect(result == 2758514936282235); }
src/day22.zig
const std = @import("std"); const interop = @import("../interop.zig"); const iup = @import("../iup.zig"); const Impl = @import("../impl.zig").Impl; const CallbackHandler = @import("../callback_handler.zig").CallbackHandler; const debug = std.debug; const trait = std.meta.trait; const Element = iup.Element; const Handle = iup.Handle; const Error = iup.Error; const ChildrenIterator = iup.ChildrenIterator; const Size = iup.Size; const Margin = iup.Margin; /// /// Creates the toggle interface element. /// It is a two-state (on/off) button that, when selected, generates an action /// that activates a function in the associated application. /// Its visual representation can contain a text or an image. pub const Toggle = opaque { pub const CLASS_NAME = "toggle"; pub const NATIVE_TYPE = iup.NativeType.Control; const Self = @This(); /// /// K_ANY K_ANY Action generated when a keyboard event occurs. /// Callback int function(Ihandle *ih, int c); [in C] ih:k_any(c: number) -> /// (ret: number) [in Lua] ih: identifier of the element that activated the event. /// c: identifier of typed key. /// Please refer to the Keyboard Codes table for a list of possible values. /// Returns: If IUP_IGNORE is returned the key is ignored and not processed by /// the control and not propagated. /// If returns IUP_CONTINUE, the key will be processed and the event will be /// propagated to the parent of the element receiving it, this is the default behavior. /// If returns IUP_DEFAULT the key is processed but it is not propagated. /// IUP_CLOSE will be processed. /// Notes Keyboard callbacks depend on the keyboard usage of the control with /// the focus. /// So if you return IUP_IGNORE the control will usually not process the key. /// But be aware that sometimes the control process the key in another event so /// even returning IUP_IGNORE the key can get processed. /// Although it will not be propagated. /// IMPORTANT: The callbacks "K_*" of the dialog or native containers depend on /// the IUP_CONTINUE return value to work while the control is in focus. /// If the callback does not exists it is automatically propagated to the /// parent of the element. /// K_* callbacks All defined keys are also callbacks of any element, called /// when the respective key is activated. /// For example: "K_cC" is also a callback activated when the user press /// Ctrl+C, when the focus is at the element or at a children with focus. /// This is the way an application can create shortcut keys, also called hot keys. /// These callbacks are not available in IupLua. /// Affects All elements with keyboard interaction. pub const OnKAnyFn = fn (self: *Self, arg0: i32) anyerror!void; /// /// HELP_CB HELP_CB Action generated when the user press F1 at a control. /// In Motif is also activated by the Help button in some workstations keyboard. /// Callback void function(Ihandle *ih); [in C] ih:help_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Returns: IUP_CLOSE will be processed. /// Affects All elements with user interaction. pub const OnHelpFn = fn (self: *Self) anyerror!void; /// /// ACTION ACTION Action generated when the element is activated. /// Affects each element differently. /// Callback int function(Ihandle *ih); [in C] ih:action() -> (ret: number) [in /// Lua] ih: identifier of the element that activated the event. /// In some elements, this callback may receive more parameters, apart from ih. /// Please refer to each element's documentation. /// Affects IupButton, IupItem, IupList, IupText, IupCanvas, IupMultiline, /// IupToggle pub const OnActionFn = fn (self: *Self, arg0: i32) anyerror!void; /// /// MAP_CB MAP_CB Called right after an element is mapped and its attributes /// updated in IupMap. /// When the element is a dialog, it is called after the layout is updated. /// For all other elements is called before the layout is updated, so the /// element current size will still be 0x0 during MAP_CB (since 3.14). /// Callback int function(Ihandle *ih); [in C] ih:map_cb() -> (ret: number) [in /// Lua] ih: identifier of the element that activated the event. /// Affects All that have a native representation. pub const OnMapFn = fn (self: *Self) anyerror!void; /// /// ENTERWINDOW_CB ENTERWINDOW_CB Action generated when the mouse enters the /// native element. /// Callback int function(Ihandle *ih); [in C] ih:enterwindow_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Notes When the cursor is moved from one element to another, the call order /// in all platforms will be first the LEAVEWINDOW_CB callback of the old /// control followed by the ENTERWINDOW_CB callback of the new control. /// (since 3.14) If the mouse button is hold pressed and the cursor moves /// outside the element the behavior is system dependent. /// In Windows the LEAVEWINDOW_CB/ENTERWINDOW_CB callbacks are NOT called, in /// GTK the callbacks are called. /// Affects All controls with user interaction. /// See Also LEAVEWINDOW_CB pub const OnEnterWindowFn = fn (self: *Self) anyerror!void; /// /// DESTROY_CB DESTROY_CB Called right before an element is destroyed. /// Callback int function(Ihandle *ih); [in C] ih:destroy_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Notes If the dialog is visible then it is hidden before it is destroyed. /// The callback will be called right after it is hidden. /// The callback will be called before all other destroy procedures. /// For instance, if the element has children then it is called before the /// children are destroyed. /// For language binding implementations use the callback name "LDESTROY_CB" to /// release memory allocated by the binding for the element. /// Also the callback will be called before the language callback. /// Affects All. pub const OnDestroyFn = fn (self: *Self) anyerror!void; /// /// KILLFOCUS_CB KILLFOCUS_CB Action generated when an element loses keyboard focus. /// This callback is called before the GETFOCUS_CB of the element that gets the focus. /// Callback int function(Ihandle *ih); [in C] ih:killfocus_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Affects All elements with user interaction, except menus. /// In Windows, there are restrictions when using this callback. /// From MSDN on WM_KILLFOCUS: "While processing this message, do not make any /// function calls that display or activate a window. /// This causes the thread to yield control and can cause the application to /// stop responding to messages. /// See Also GETFOCUS_CB, IupGetFocus, IupSetFocus pub const OnKillFocusFn = fn (self: *Self) anyerror!void; /// /// UNMAP_CB UNMAP_CB Called right before an element is unmapped. /// Callback int function(Ihandle *ih); [in C] ih:unmap_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Affects All that have a native representation. pub const OnUnmapFn = fn (self: *Self) anyerror!void; /// /// GETFOCUS_CB GETFOCUS_CB Action generated when an element is given keyboard focus. /// This callback is called after the KILLFOCUS_CB of the element that loosed /// the focus. /// The IupGetFocus function during the callback returns the element that /// loosed the focus. /// Callback int function(Ihandle *ih); [in C] ih:getfocus_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that received keyboard focus. /// Affects All elements with user interaction, except menus. /// See Also KILLFOCUS_CB, IupGetFocus, IupSetFocus pub const OnGetFocusFn = fn (self: *Self) anyerror!void; /// /// VALUECHANGED_CB: Called after the value was interactively changed by the user. /// Called after the ACTION callback, but under the same context. /// (since 3.0) int function(Ihandle *ih); [in C]ih:valuechanged_cb() -> (ret: /// number) [in Lua] pub const OnValueChangedFn = fn (self: *Self) anyerror!void; pub const OnLDestroyFn = fn (self: *Self) anyerror!void; /// /// LEAVEWINDOW_CB LEAVEWINDOW_CB Action generated when the mouse leaves the /// native element. /// Callback int function(Ihandle *ih); [in C] ih:leavewindow_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Notes When the cursor is moved from one element to another, the call order /// in all platforms will be first the LEAVEWINDOW_CB callback of the old /// control followed by the ENTERWINDOW_CB callback of the new control. /// (since 3.14) If the mouse button is hold pressed and the cursor moves /// outside the element the behavior is system dependent. /// In Windows the LEAVEWINDOW_CB/ENTERWINDOW_CB callbacks are NOT called, in /// GTK the callbacks are called. /// Affects All controls with user interaction. /// See Also ENTERWINDOW_CB pub const OnLeaveWindowFn = fn (self: *Self) anyerror!void; pub const OnPostMessageFn = fn (self: *Self, arg0: [:0]const u8, arg1: i32, arg2: f64, arg3: *iup.Unknow) anyerror!void; pub const ZOrder = enum { Top, Bottom, }; pub const Expand = enum { Yes, Horizontal, Vertical, HorizontalFree, VerticalFree, No, }; pub const Floating = enum { Yes, Ignore, No, }; /// /// VALUE (non inheritable): Toggle's state. /// Values can be "ON", "OFF" or "TOGGLE". /// If 3STATE=YES then can also be "NOTDEF". /// Default: "OFF". /// The TOGGLE option will invert the current state (since 3.7). /// In GTK if you change the state of a radio, the unchecked toggle will /// receive an ACTION callback notification. /// Can only be set to ON if the toggle is inside a radio, it will /// automatically set to OFF the previous toggle that was ON in the radio. pub const Value = enum { On, Off, NotDef, }; pub const Initializer = struct { last_error: ?anyerror = null, ref: *Self, /// /// Returns a pointer to IUP element or an error. /// Only top-level or detached elements needs to be unwraped, pub fn unwrap(self: Initializer) !*Self { if (self.last_error) |e| { return e; } else { return self.ref; } } /// /// Captures a reference into a external variable /// Allows to capture some references even using full declarative API pub fn capture(self: *Initializer, ref: **Self) Initializer { ref.* = self.ref; return self.*; } pub fn setStrAttribute(self: *Initializer, attributeName: [:0]const u8, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; Self.setStrAttribute(self.ref, attributeName, arg); return self.*; } pub fn setIntAttribute(self: *Initializer, attributeName: [:0]const u8, arg: i32) Initializer { if (self.last_error) |_| return self.*; Self.setIntAttribute(self.ref, attributeName, arg); return self.*; } pub fn setBoolAttribute(self: *Initializer, attributeName: [:0]const u8, arg: bool) Initializer { if (self.last_error) |_| return self.*; Self.setBoolAttribute(self.ref, attributeName, arg); return self.*; } pub fn setPtrAttribute(self: *Initializer, comptime T: type, attributeName: [:0]const u8, value: ?*T) Initializer { if (self.last_error) |_| return self.*; Self.setPtrAttribute(self.ref, T, attributeName, value); return self.*; } pub fn setHandle(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setHandle(self.ref, arg); return self.*; } /// /// FGCOLOR: Color of the text shown on the toggle. /// In Windows, when using Visual Styles FGCOLOR is ignored. /// Default: the global attribute DLGFGCOLOR. pub fn setFgColor(self: *Initializer, rgb: iup.Rgb) Initializer { if (self.last_error) |_| return self.*; interop.setRgb(self.ref, "FGCOLOR", .{}, rgb); return self.*; } pub fn setHandleName(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "HANDLENAME", .{}, arg); return self.*; } pub fn setTipBgColor(self: *Initializer, rgb: iup.Rgb) Initializer { if (self.last_error) |_| return self.*; interop.setRgb(self.ref, "TIPBGCOLOR", .{}, rgb); return self.*; } pub fn setTipIcon(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "TIPICON", .{}, arg); return self.*; } /// /// RIGHTBUTTON (Windows Only) (creation only): place the check button at the /// right of the text. /// Can be "YES" or "NO". /// Default: "NO". pub fn setRightButton(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "RIGHTBUTTON", .{}, arg); return self.*; } pub fn setMaxSize(self: *Initializer, width: ?i32, height: ?i32) Initializer { if (self.last_error) |_| return self.*; var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self.ref, "MAXSIZE", .{}, value); return self.*; } pub fn setPosition(self: *Initializer, x: i32, y: i32) Initializer { if (self.last_error) |_| return self.*; var buffer: [128]u8 = undefined; var value = iup.XYPos.intIntToString(&buffer, x, y, ','); interop.setStrAttribute(self.ref, "POSITION", .{}, value); return self.*; } /// /// IMPRESS (non inheritable): Image name of the pressed toggle. /// Unlike buttons, toggles always display the button border when IMAGE and /// IMPRESS are both defined. /// (GTK 2.6) pub fn setImPress(self: *Initializer, arg: anytype) Initializer { if (self.last_error) |_| return self.*; if (interop.validateHandle(.Image, arg)) { interop.setHandleAttribute(self.ref, "IMPRESS", .{}, arg); } else |err| { self.last_error = err; } return self.*; } pub fn setImPressHandleName(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "IMPRESS", .{}, arg); return self.*; } /// /// IMINACTIVE (non inheritable): Image name of the inactive toggle. /// If it is not defined but IMAGE is defined then for inactive toggles the /// colors will be replaced by a modified version of the background color /// creating the disabled effect. /// (GTK 2.6) pub fn setIMinActive(self: *Initializer, arg: anytype) Initializer { if (self.last_error) |_| return self.*; if (interop.validateHandle(.Image, arg)) { interop.setHandleAttribute(self.ref, "IMINACTIVE", .{}, arg); } else |err| { self.last_error = err; } return self.*; } pub fn setIMinActiveHandleName(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "IMINACTIVE", .{}, arg); return self.*; } pub fn setTip(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "TIP", .{}, arg); return self.*; } /// /// CANFOCUS (creation only) (non inheritable): enables the focus traversal of /// the control. /// In Windows the control will still get the focus when clicked. /// Default: YES. /// (since 3.0) pub fn setCanFocus(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "CANFOCUS", .{}, arg); return self.*; } pub fn setVisible(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "VISIBLE", .{}, arg); return self.*; } /// /// IMAGE (non inheritable): Image name. /// When the IMAGE attribute is defined, the TITLE is not shown. /// This makes the toggle looks just like a button with an image, but its /// behavior remains the same. /// Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. /// See also IupImage. /// (GTK 2.6) pub fn setImage(self: *Initializer, arg: anytype) Initializer { if (self.last_error) |_| return self.*; if (interop.validateHandle(.Image, arg)) { interop.setHandleAttribute(self.ref, "IMAGE", .{}, arg); } else |err| { self.last_error = err; } return self.*; } pub fn setImageHandleName(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "IMAGE", .{}, arg); return self.*; } pub fn zOrder(self: *Initializer, arg: ?ZOrder) Initializer { if (self.last_error) |_| return self.*; if (arg) |value| switch (value) { .Top => interop.setStrAttribute(self.ref, "ZORDER", .{}, "TOP"), .Bottom => interop.setStrAttribute(self.ref, "ZORDER", .{}, "BOTTOM"), } else { interop.clearAttribute(self.ref, "ZORDER", .{}); } return self.*; } pub fn setTheme(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "THEME", .{}, arg); return self.*; } pub fn setExpand(self: *Initializer, arg: ?Expand) Initializer { if (self.last_error) |_| return self.*; if (arg) |value| switch (value) { .Yes => interop.setStrAttribute(self.ref, "EXPAND", .{}, "YES"), .Horizontal => interop.setStrAttribute(self.ref, "EXPAND", .{}, "HORIZONTAL"), .Vertical => interop.setStrAttribute(self.ref, "EXPAND", .{}, "VERTICAL"), .HorizontalFree => interop.setStrAttribute(self.ref, "EXPAND", .{}, "HORIZONTALFREE"), .VerticalFree => interop.setStrAttribute(self.ref, "EXPAND", .{}, "VERTICALFREE"), .No => interop.setStrAttribute(self.ref, "EXPAND", .{}, "NO"), } else { interop.clearAttribute(self.ref, "EXPAND", .{}); } return self.*; } pub fn setSize(self: *Initializer, width: ?i32, height: ?i32) Initializer { if (self.last_error) |_| return self.*; var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self.ref, "SIZE", .{}, value); return self.*; } /// /// PADDING: internal margin when IMAGE is defined. /// Works just like the MARGIN attribute of the IupHbox and IupVbox containers, /// but uses a different name to avoid inheritance problems. /// Default value: "0x0". /// Value can be DEFAULTBUTTONPADDING, so the global attribute of this name /// will be used instead (since 3.29). /// (since 3.0) pub fn setPadding(self: *Initializer, width: ?i32, height: ?i32) Initializer { if (self.last_error) |_| return self.*; var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self.ref, "PADDING", .{}, value); return self.*; } pub fn setTipMarkup(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "TIPMARKUP", .{}, arg); return self.*; } pub fn setFontSize(self: *Initializer, arg: i32) Initializer { if (self.last_error) |_| return self.*; interop.setIntAttribute(self.ref, "FONTSIZE", .{}, arg); return self.*; } pub fn setUserSize(self: *Initializer, width: ?i32, height: ?i32) Initializer { if (self.last_error) |_| return self.*; var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self.ref, "USERSIZE", .{}, value); return self.*; } pub fn setTipDelay(self: *Initializer, arg: i32) Initializer { if (self.last_error) |_| return self.*; interop.setIntAttribute(self.ref, "TIPDELAY", .{}, arg); return self.*; } /// /// TITLE (non inheritable): Toggle's text. /// If IMAGE is not defined before map, then the default behavior is to contain /// a text. /// The button behavior can not be changed after map. /// The natural size will be larger enough to include all the text in the /// selected font, even using multiple lines, plus the button borders or check /// box if any. /// The '\n' character is accepted for line change. /// The "&" character can be used to define a mnemonic, the next character will /// be used as key. /// Use "&&" to show the "&" character instead on defining a mnemonic. /// The toggle can be activated from any control in the dialog using the /// "Alt+key" combination. /// (mnemonic support since 3.0) pub fn setTitle(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "TITLE", .{}, arg); return self.*; } /// /// PROPAGATEFOCUS(non inheritable): enables the focus callback forwarding to /// the next native parent with FOCUS_CB defined. /// Default: NO. /// (since 3.23) pub fn setPropagateFocus(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "PROPAGATEFOCUS", .{}, arg); return self.*; } /// /// BGCOLOR: Background color of toggle mark when displaying a text. /// The text background is transparent, it will use the background color of the /// native parent. /// When displaying an image in Windows the background is ignored and the /// system color is used. /// Default: the global attribute DLGBGCOLOR. pub fn setBgColor(self: *Initializer, rgb: iup.Rgb) Initializer { if (self.last_error) |_| return self.*; interop.setRgb(self.ref, "BGCOLOR", .{}, rgb); return self.*; } /// /// MARKUP [GTK only]: allows the title string to contains pango markup commands. /// Works only if a mnemonic is NOT defined in the title. /// Can be "YES" or "NO". /// Default: "NO". pub fn setMarkup(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "MARKUP", .{}, arg); return self.*; } pub fn setFloating(self: *Initializer, arg: ?Floating) Initializer { if (self.last_error) |_| return self.*; if (arg) |value| switch (value) { .Yes => interop.setStrAttribute(self.ref, "FLOATING", .{}, "YES"), .Ignore => interop.setStrAttribute(self.ref, "FLOATING", .{}, "IGNORE"), .No => interop.setStrAttribute(self.ref, "FLOATING", .{}, "NO"), } else { interop.clearAttribute(self.ref, "FLOATING", .{}); } return self.*; } pub fn setNormalizerGroup(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "NORMALIZERGROUP", .{}, arg); return self.*; } pub fn setRasterSize(self: *Initializer, width: ?i32, height: ?i32) Initializer { if (self.last_error) |_| return self.*; var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self.ref, "RASTERSIZE", .{}, value); return self.*; } pub fn setTipFgColor(self: *Initializer, rgb: iup.Rgb) Initializer { if (self.last_error) |_| return self.*; interop.setRgb(self.ref, "TIPFGCOLOR", .{}, rgb); return self.*; } pub fn setFontFace(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "FONTFACE", .{}, arg); return self.*; } /// /// 3STATE (creation only): Enable a three state toggle. /// Valid for toggles with text only and that do not belong to a radio. /// Can be "YES" or NO". /// Default: "NO". pub fn set3State(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "3STATE", .{}, arg); return self.*; } pub fn setName(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "NAME", .{}, arg); return self.*; } /// /// VALUE (non inheritable): Toggle's state. /// Values can be "ON", "OFF" or "TOGGLE". /// If 3STATE=YES then can also be "NOTDEF". /// Default: "OFF". /// The TOGGLE option will invert the current state (since 3.7). /// In GTK if you change the state of a radio, the unchecked toggle will /// receive an ACTION callback notification. /// Can only be set to ON if the toggle is inside a radio, it will /// automatically set to OFF the previous toggle that was ON in the radio. pub fn setValue(self: *Initializer, arg: ?Value) Initializer { if (self.last_error) |_| return self.*; if (arg) |value| switch (value) { .On => interop.setStrAttribute(self.ref, "VALUE", .{}, "ON"), .Off => interop.setStrAttribute(self.ref, "VALUE", .{}, "OFF"), .NotDef => interop.setStrAttribute(self.ref, "VALUE", .{}, "NOTDEF"), } else { interop.clearAttribute(self.ref, "VALUE", .{}); } return self.*; } /// /// ACTIVE, FONT, EXPAND, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP, /// SIZE, RASTERSIZE, ZORDER, VISIBLE, THEME: also accepted. pub fn setActive(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "ACTIVE", .{}, arg); return self.*; } pub fn setTipVisible(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "TIPVISIBLE", .{}, arg); return self.*; } pub fn setExpandWeight(self: *Initializer, arg: f64) Initializer { if (self.last_error) |_| return self.*; interop.setDoubleAttribute(self.ref, "EXPANDWEIGHT", .{}, arg); return self.*; } pub fn setMinSize(self: *Initializer, width: ?i32, height: ?i32) Initializer { if (self.last_error) |_| return self.*; var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self.ref, "MINSIZE", .{}, value); return self.*; } /// /// FLAT (creation only): Hides the toggle borders until the mouse enter the /// toggle area when the toggle is not checked. /// If the toggle is checked, then the borders will be shown even if flat is enabled. /// Used only when IMAGE is defined. /// Can be YES or NO. /// Default: NO. /// (since 3.3) pub fn setFlat(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "FLAT", .{}, arg); return self.*; } pub fn setNTheme(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "NTHEME", .{}, arg); return self.*; } /// /// IGNORERADIO (non inheritable): when set the toggle will not behave as a /// radio when inside an IupRadio hierarchy. /// (since 3.21) pub fn setIgnoreRadio(self: *Initializer, arg: bool) Initializer { if (self.last_error) |_| return self.*; interop.setBoolAttribute(self.ref, "IGNORERADIO", .{}, arg); return self.*; } pub fn setFontStyle(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "FONTSTYLE", .{}, arg); return self.*; } pub fn setFont(self: *Initializer, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "FONT", .{}, arg); return self.*; } /// /// TABIMAGEn (non inheritable): image name to be used in the respective tab. /// Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. /// n starts at 0. /// See also IupImage. /// In Motif, the image is shown only if TABTITLEn is NULL. /// In Windows and Motif set the BGCOLOR attribute before setting the image. /// When set after map will update the TABIMAGE attribute on the respective /// child (since 3.10). /// (since 3.0). /// TABIMAGE (non inheritable) (at children only): Same as TABIMAGEn but set in /// each child. /// Works only if set before the child is added to the tabs. pub fn setTabImage(self: *Initializer, index: i32, arg: anytype) Initializer { if (self.last_error) |_| return self.*; if (interop.validateHandle(.Image, arg)) { interop.setHandleAttribute(self.ref, "TABIMAGE", .{index}, arg); } else |err| { self.last_error = err; } return self.*; } pub fn setTabImageHandleName(self: *Initializer, index: i32, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "TABIMAGE", .{index}, arg); return self.*; } /// /// TABTITLEn (non inheritable): Contains the text to be shown in the /// respective tab title. /// n starts at 0. /// If this value is NULL, it will remain empty. /// The "&" character can be used to define a mnemonic, the next character will /// be used as key. /// Use "&&" to show the "&" character instead on defining a mnemonic. /// The button can be activated from any control in the dialog using the /// "Alt+key" combination. /// (mnemonic support since 3.3). /// When set after map will update the TABTITLE attribute on the respective /// child (since 3.10). /// (since 3.0). /// TABTITLE (non inheritable) (at children only): Same as TABTITLEn but set in /// each child. /// Works only if set before the child is added to the tabs. pub fn setTabTitle(self: *Initializer, index: i32, arg: [:0]const u8) Initializer { if (self.last_error) |_| return self.*; interop.setStrAttribute(self.ref, "TABTITLE", .{index}, arg); return self.*; } /// /// K_ANY K_ANY Action generated when a keyboard event occurs. /// Callback int function(Ihandle *ih, int c); [in C] ih:k_any(c: number) -> /// (ret: number) [in Lua] ih: identifier of the element that activated the event. /// c: identifier of typed key. /// Please refer to the Keyboard Codes table for a list of possible values. /// Returns: If IUP_IGNORE is returned the key is ignored and not processed by /// the control and not propagated. /// If returns IUP_CONTINUE, the key will be processed and the event will be /// propagated to the parent of the element receiving it, this is the default behavior. /// If returns IUP_DEFAULT the key is processed but it is not propagated. /// IUP_CLOSE will be processed. /// Notes Keyboard callbacks depend on the keyboard usage of the control with /// the focus. /// So if you return IUP_IGNORE the control will usually not process the key. /// But be aware that sometimes the control process the key in another event so /// even returning IUP_IGNORE the key can get processed. /// Although it will not be propagated. /// IMPORTANT: The callbacks "K_*" of the dialog or native containers depend on /// the IUP_CONTINUE return value to work while the control is in focus. /// If the callback does not exists it is automatically propagated to the /// parent of the element. /// K_* callbacks All defined keys are also callbacks of any element, called /// when the respective key is activated. /// For example: "K_cC" is also a callback activated when the user press /// Ctrl+C, when the focus is at the element or at a children with focus. /// This is the way an application can create shortcut keys, also called hot keys. /// These callbacks are not available in IupLua. /// Affects All elements with keyboard interaction. pub fn setKAnyCallback(self: *Initializer, callback: ?OnKAnyFn) Initializer { const Handler = CallbackHandler(Self, OnKAnyFn, "K_ANY"); Handler.setCallback(self.ref, callback); return self.*; } /// /// HELP_CB HELP_CB Action generated when the user press F1 at a control. /// In Motif is also activated by the Help button in some workstations keyboard. /// Callback void function(Ihandle *ih); [in C] ih:help_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Returns: IUP_CLOSE will be processed. /// Affects All elements with user interaction. pub fn setHelpCallback(self: *Initializer, callback: ?OnHelpFn) Initializer { const Handler = CallbackHandler(Self, OnHelpFn, "HELP_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// ACTION ACTION Action generated when the element is activated. /// Affects each element differently. /// Callback int function(Ihandle *ih); [in C] ih:action() -> (ret: number) [in /// Lua] ih: identifier of the element that activated the event. /// In some elements, this callback may receive more parameters, apart from ih. /// Please refer to each element's documentation. /// Affects IupButton, IupItem, IupList, IupText, IupCanvas, IupMultiline, /// IupToggle pub fn setActionCallback(self: *Initializer, callback: ?OnActionFn) Initializer { const Handler = CallbackHandler(Self, OnActionFn, "ACTION"); Handler.setCallback(self.ref, callback); return self.*; } /// /// MAP_CB MAP_CB Called right after an element is mapped and its attributes /// updated in IupMap. /// When the element is a dialog, it is called after the layout is updated. /// For all other elements is called before the layout is updated, so the /// element current size will still be 0x0 during MAP_CB (since 3.14). /// Callback int function(Ihandle *ih); [in C] ih:map_cb() -> (ret: number) [in /// Lua] ih: identifier of the element that activated the event. /// Affects All that have a native representation. pub fn setMapCallback(self: *Initializer, callback: ?OnMapFn) Initializer { const Handler = CallbackHandler(Self, OnMapFn, "MAP_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// ENTERWINDOW_CB ENTERWINDOW_CB Action generated when the mouse enters the /// native element. /// Callback int function(Ihandle *ih); [in C] ih:enterwindow_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Notes When the cursor is moved from one element to another, the call order /// in all platforms will be first the LEAVEWINDOW_CB callback of the old /// control followed by the ENTERWINDOW_CB callback of the new control. /// (since 3.14) If the mouse button is hold pressed and the cursor moves /// outside the element the behavior is system dependent. /// In Windows the LEAVEWINDOW_CB/ENTERWINDOW_CB callbacks are NOT called, in /// GTK the callbacks are called. /// Affects All controls with user interaction. /// See Also LEAVEWINDOW_CB pub fn setEnterWindowCallback(self: *Initializer, callback: ?OnEnterWindowFn) Initializer { const Handler = CallbackHandler(Self, OnEnterWindowFn, "ENTERWINDOW_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// DESTROY_CB DESTROY_CB Called right before an element is destroyed. /// Callback int function(Ihandle *ih); [in C] ih:destroy_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Notes If the dialog is visible then it is hidden before it is destroyed. /// The callback will be called right after it is hidden. /// The callback will be called before all other destroy procedures. /// For instance, if the element has children then it is called before the /// children are destroyed. /// For language binding implementations use the callback name "LDESTROY_CB" to /// release memory allocated by the binding for the element. /// Also the callback will be called before the language callback. /// Affects All. pub fn setDestroyCallback(self: *Initializer, callback: ?OnDestroyFn) Initializer { const Handler = CallbackHandler(Self, OnDestroyFn, "DESTROY_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// KILLFOCUS_CB KILLFOCUS_CB Action generated when an element loses keyboard focus. /// This callback is called before the GETFOCUS_CB of the element that gets the focus. /// Callback int function(Ihandle *ih); [in C] ih:killfocus_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Affects All elements with user interaction, except menus. /// In Windows, there are restrictions when using this callback. /// From MSDN on WM_KILLFOCUS: "While processing this message, do not make any /// function calls that display or activate a window. /// This causes the thread to yield control and can cause the application to /// stop responding to messages. /// See Also GETFOCUS_CB, IupGetFocus, IupSetFocus pub fn setKillFocusCallback(self: *Initializer, callback: ?OnKillFocusFn) Initializer { const Handler = CallbackHandler(Self, OnKillFocusFn, "KILLFOCUS_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// UNMAP_CB UNMAP_CB Called right before an element is unmapped. /// Callback int function(Ihandle *ih); [in C] ih:unmap_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Affects All that have a native representation. pub fn setUnmapCallback(self: *Initializer, callback: ?OnUnmapFn) Initializer { const Handler = CallbackHandler(Self, OnUnmapFn, "UNMAP_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// GETFOCUS_CB GETFOCUS_CB Action generated when an element is given keyboard focus. /// This callback is called after the KILLFOCUS_CB of the element that loosed /// the focus. /// The IupGetFocus function during the callback returns the element that /// loosed the focus. /// Callback int function(Ihandle *ih); [in C] ih:getfocus_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that received keyboard focus. /// Affects All elements with user interaction, except menus. /// See Also KILLFOCUS_CB, IupGetFocus, IupSetFocus pub fn setGetFocusCallback(self: *Initializer, callback: ?OnGetFocusFn) Initializer { const Handler = CallbackHandler(Self, OnGetFocusFn, "GETFOCUS_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// VALUECHANGED_CB: Called after the value was interactively changed by the user. /// Called after the ACTION callback, but under the same context. /// (since 3.0) int function(Ihandle *ih); [in C]ih:valuechanged_cb() -> (ret: /// number) [in Lua] pub fn setValueChangedCallback(self: *Initializer, callback: ?OnValueChangedFn) Initializer { const Handler = CallbackHandler(Self, OnValueChangedFn, "VALUECHANGED_CB"); Handler.setCallback(self.ref, callback); return self.*; } pub fn setLDestroyCallback(self: *Initializer, callback: ?OnLDestroyFn) Initializer { const Handler = CallbackHandler(Self, OnLDestroyFn, "LDESTROY_CB"); Handler.setCallback(self.ref, callback); return self.*; } /// /// LEAVEWINDOW_CB LEAVEWINDOW_CB Action generated when the mouse leaves the /// native element. /// Callback int function(Ihandle *ih); [in C] ih:leavewindow_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Notes When the cursor is moved from one element to another, the call order /// in all platforms will be first the LEAVEWINDOW_CB callback of the old /// control followed by the ENTERWINDOW_CB callback of the new control. /// (since 3.14) If the mouse button is hold pressed and the cursor moves /// outside the element the behavior is system dependent. /// In Windows the LEAVEWINDOW_CB/ENTERWINDOW_CB callbacks are NOT called, in /// GTK the callbacks are called. /// Affects All controls with user interaction. /// See Also ENTERWINDOW_CB pub fn setLeaveWindowCallback(self: *Initializer, callback: ?OnLeaveWindowFn) Initializer { const Handler = CallbackHandler(Self, OnLeaveWindowFn, "LEAVEWINDOW_CB"); Handler.setCallback(self.ref, callback); return self.*; } pub fn setPostMessageCallback(self: *Initializer, callback: ?OnPostMessageFn) Initializer { const Handler = CallbackHandler(Self, OnPostMessageFn, "POSTMESSAGE_CB"); Handler.setCallback(self.ref, callback); return self.*; } }; pub fn setStrAttribute(self: *Self, attribute: [:0]const u8, arg: [:0]const u8) void { interop.setStrAttribute(self, attribute, .{}, arg); } pub fn getStrAttribute(self: *Self, attribute: [:0]const u8) [:0]const u8 { return interop.getStrAttribute(self, attribute, .{}); } pub fn setIntAttribute(self: *Self, attribute: [:0]const u8, arg: i32) void { interop.setIntAttribute(self, attribute, .{}, arg); } pub fn getIntAttribute(self: *Self, attribute: [:0]const u8) i32 { return interop.getIntAttribute(self, attribute, .{}); } pub fn setBoolAttribute(self: *Self, attribute: [:0]const u8, arg: bool) void { interop.setBoolAttribute(self, attribute, .{}, arg); } pub fn getBoolAttribute(self: *Self, attribute: [:0]const u8) bool { return interop.getBoolAttribute(self, attribute, .{}); } pub fn getPtrAttribute(self: *Self, comptime T: type, attribute: [:0]const u8) ?*T { return interop.getPtrAttribute(T, self, attribute, .{}); } pub fn setPtrAttribute(self: *Self, comptime T: type, attribute: [:0]const u8, value: ?*T) void { interop.setPtrAttribute(T, self, attribute, .{}, value); } pub fn setHandle(self: *Self, arg: [:0]const u8) void { interop.setHandle(self, arg); } pub fn fromHandleName(handle_name: [:0]const u8) ?*Self { return interop.fromHandleName(Self, handle_name); } /// /// Creates an interface element given its class name and parameters. /// After creation the element still needs to be attached to a container and mapped to the native system so it can be visible. pub fn init() Initializer { var handle = interop.create(Self); if (handle) |valid| { return .{ .ref = @ptrCast(*Self, valid), }; } else { return .{ .ref = undefined, .last_error = Error.NotInitialized }; } } /// /// Displays a dialog in the current position, or changes a control VISIBLE attribute. /// For dialogs it is equivalent to call IupShowXY using IUP_CURRENT. See IupShowXY for more details. /// For other controls, to call IupShow is the same as setting VISIBLE=YES. pub fn show(self: *Self) !void { try interop.show(self); } /// /// Hides an interface element. This function has the same effect as attributing value "NO" to the interface element’s VISIBLE attribute. /// Once a dialog is hidden, either by means of IupHide or by changing the VISIBLE attribute or by means of a click in the window close button, the elements inside this dialog are not destroyed, so that you can show the dialog again. To destroy dialogs, the IupDestroy function must be called. pub fn hide(self: *Self) void { interop.hide(self); } /// /// Destroys an interface element and all its children. /// Only dialogs, timers, popup menus and images should be normally destroyed, but detached elements can also be destroyed. pub fn deinit(self: *Self) void { interop.destroy(self); } /// /// Creates (maps) the native interface objects corresponding to the given IUP interface elements. /// It will also called recursively to create the native element of all the children in the element's tree. /// The element must be already attached to a mapped container, except the dialog. A child can only be mapped if its parent is already mapped. /// This function is automatically called before the dialog is shown in IupShow, IupShowXY or IupPopup. /// If the element is a dialog then the abstract layout will be updated even if the dialog is already mapped. If the dialog is visible the elements will be immediately repositioned. Calling IupMap for an already mapped dialog is the same as only calling IupRefresh for the dialog. /// Calling IupMap for an already mapped element that is not a dialog does nothing. /// If you add new elements to an already mapped dialog you must call IupMap for that elements. And then call IupRefresh to update the dialog layout. /// If the WID attribute of an element is NULL, it means the element was not already mapped. Some containers do not have a native element associated, like VBOX and HBOX. In this case their WID is a fake value (void*)(-1). /// It is useful for the application to call IupMap when the value of the WID attribute must be known, i.e. the native element must exist, before a dialog is made visible. /// The MAP_CB callback is called at the end of the IupMap function, after all processing, so it can also be used to create other things that depend on the WID attribute. But notice that for non dialog elements it will be called before the dialog layout has been updated, so the element current size will still be 0x0 (since 3.14). pub fn map(self: *Self) !void { try interop.map(self); } /// /// pub fn getDialog(self: *Self) ?*iup.Dialog { return interop.getDialog(self); } /// /// Returns the the child element that has the NAME attribute equals to the given value on the same dialog hierarchy. /// Works also for children of a menu that is associated with a dialog. pub fn getDialogChild(self: *Self, byName: [:0]const u8) ?Element { return interop.getDialogChild(self, byName); } /// /// Updates the size and layout of all controls in the same dialog. /// To be used after changing size attributes, or attributes that affect the size of the control. Can be used for any element inside a dialog, but the layout of the dialog and all controls will be updated. It can change the layout of all the controls inside the dialog because of the dynamic layout positioning. pub fn refresh(self: *Self) void { Impl(Self).refresh(self); } /// /// FGCOLOR: Color of the text shown on the toggle. /// In Windows, when using Visual Styles FGCOLOR is ignored. /// Default: the global attribute DLGFGCOLOR. pub fn getFgColor(self: *Self) ?iup.Rgb { return interop.getRgb(self, "FGCOLOR", .{}); } /// /// FGCOLOR: Color of the text shown on the toggle. /// In Windows, when using Visual Styles FGCOLOR is ignored. /// Default: the global attribute DLGFGCOLOR. pub fn setFgColor(self: *Self, rgb: iup.Rgb) void { interop.setRgb(self, "FGCOLOR", .{}, rgb); } pub fn getHandleName(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "HANDLENAME", .{}); } pub fn setHandleName(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "HANDLENAME", .{}, arg); } pub fn getTipBgColor(self: *Self) ?iup.Rgb { return interop.getRgb(self, "TIPBGCOLOR", .{}); } pub fn setTipBgColor(self: *Self, rgb: iup.Rgb) void { interop.setRgb(self, "TIPBGCOLOR", .{}, rgb); } pub fn getTipIcon(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "TIPICON", .{}); } pub fn setTipIcon(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "TIPICON", .{}, arg); } pub fn getMaxSize(self: *Self) Size { var str = interop.getStrAttribute(self, "MAXSIZE", .{}); return Size.parse(str); } pub fn setMaxSize(self: *Self, width: ?i32, height: ?i32) void { var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self, "MAXSIZE", .{}, value); } pub fn getScreenPosition(self: *Self) iup.XYPos { var str = interop.getStrAttribute(self, "SCREENPOSITION", .{}); return iup.XYPos.parse(str, ','); } pub fn getPosition(self: *Self) iup.XYPos { var str = interop.getStrAttribute(self, "POSITION", .{}); return iup.XYPos.parse(str, ','); } pub fn setPosition(self: *Self, x: i32, y: i32) void { var buffer: [128]u8 = undefined; var value = iup.XYPos.intIntToString(&buffer, x, y, ','); interop.setStrAttribute(self, "POSITION", .{}, value); } /// /// IMPRESS (non inheritable): Image name of the pressed toggle. /// Unlike buttons, toggles always display the button border when IMAGE and /// IMPRESS are both defined. /// (GTK 2.6) pub fn getImPress(self: *Self) ?iup.Element { if (interop.getHandleAttribute(self, "IMPRESS", .{})) |handle| { return iup.Element.fromHandle(handle); } else { return null; } } /// /// IMPRESS (non inheritable): Image name of the pressed toggle. /// Unlike buttons, toggles always display the button border when IMAGE and /// IMPRESS are both defined. /// (GTK 2.6) pub fn setImPress(self: *Self, arg: anytype) !void { try interop.validateHandle(.Image, arg); interop.setHandleAttribute(self, "IMPRESS", .{}, arg); } pub fn setImPressHandleName(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "IMPRESS", .{}, arg); } /// /// IMINACTIVE (non inheritable): Image name of the inactive toggle. /// If it is not defined but IMAGE is defined then for inactive toggles the /// colors will be replaced by a modified version of the background color /// creating the disabled effect. /// (GTK 2.6) pub fn getIMinActive(self: *Self) ?iup.Element { if (interop.getHandleAttribute(self, "IMINACTIVE", .{})) |handle| { return iup.Element.fromHandle(handle); } else { return null; } } /// /// IMINACTIVE (non inheritable): Image name of the inactive toggle. /// If it is not defined but IMAGE is defined then for inactive toggles the /// colors will be replaced by a modified version of the background color /// creating the disabled effect. /// (GTK 2.6) pub fn setIMinActive(self: *Self, arg: anytype) !void { try interop.validateHandle(.Image, arg); interop.setHandleAttribute(self, "IMINACTIVE", .{}, arg); } pub fn setIMinActiveHandleName(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "IMINACTIVE", .{}, arg); } pub fn getTip(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "TIP", .{}); } pub fn setTip(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "TIP", .{}, arg); } pub fn getVisible(self: *Self) bool { return interop.getBoolAttribute(self, "VISIBLE", .{}); } pub fn setVisible(self: *Self, arg: bool) void { interop.setBoolAttribute(self, "VISIBLE", .{}, arg); } /// /// IMAGE (non inheritable): Image name. /// When the IMAGE attribute is defined, the TITLE is not shown. /// This makes the toggle looks just like a button with an image, but its /// behavior remains the same. /// Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. /// See also IupImage. /// (GTK 2.6) pub fn getImage(self: *Self) ?iup.Element { if (interop.getHandleAttribute(self, "IMAGE", .{})) |handle| { return iup.Element.fromHandle(handle); } else { return null; } } /// /// IMAGE (non inheritable): Image name. /// When the IMAGE attribute is defined, the TITLE is not shown. /// This makes the toggle looks just like a button with an image, but its /// behavior remains the same. /// Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. /// See also IupImage. /// (GTK 2.6) pub fn setImage(self: *Self, arg: anytype) !void { try interop.validateHandle(.Image, arg); interop.setHandleAttribute(self, "IMAGE", .{}, arg); } pub fn setImageHandleName(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "IMAGE", .{}, arg); } pub fn zOrder(self: *Self, arg: ?ZOrder) void { if (arg) |value| switch (value) { .Top => interop.setStrAttribute(self, "ZORDER", .{}, "TOP"), .Bottom => interop.setStrAttribute(self, "ZORDER", .{}, "BOTTOM"), } else { interop.clearAttribute(self, "ZORDER", .{}); } } pub fn getX(self: *Self) i32 { return interop.getIntAttribute(self, "X", .{}); } pub fn getY(self: *Self) i32 { return interop.getIntAttribute(self, "Y", .{}); } pub fn getTheme(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "THEME", .{}); } pub fn setTheme(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "THEME", .{}, arg); } pub fn getExpand(self: *Self) ?Expand { var ret = interop.getStrAttribute(self, "EXPAND", .{}); if (std.ascii.eqlIgnoreCase("YES", ret)) return .Yes; if (std.ascii.eqlIgnoreCase("HORIZONTAL", ret)) return .Horizontal; if (std.ascii.eqlIgnoreCase("VERTICAL", ret)) return .Vertical; if (std.ascii.eqlIgnoreCase("HORIZONTALFREE", ret)) return .HorizontalFree; if (std.ascii.eqlIgnoreCase("VERTICALFREE", ret)) return .VerticalFree; if (std.ascii.eqlIgnoreCase("NO", ret)) return .No; return null; } pub fn setExpand(self: *Self, arg: ?Expand) void { if (arg) |value| switch (value) { .Yes => interop.setStrAttribute(self, "EXPAND", .{}, "YES"), .Horizontal => interop.setStrAttribute(self, "EXPAND", .{}, "HORIZONTAL"), .Vertical => interop.setStrAttribute(self, "EXPAND", .{}, "VERTICAL"), .HorizontalFree => interop.setStrAttribute(self, "EXPAND", .{}, "HORIZONTALFREE"), .VerticalFree => interop.setStrAttribute(self, "EXPAND", .{}, "VERTICALFREE"), .No => interop.setStrAttribute(self, "EXPAND", .{}, "NO"), } else { interop.clearAttribute(self, "EXPAND", .{}); } } pub fn getSize(self: *Self) Size { var str = interop.getStrAttribute(self, "SIZE", .{}); return Size.parse(str); } pub fn setSize(self: *Self, width: ?i32, height: ?i32) void { var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self, "SIZE", .{}, value); } /// /// PADDING: internal margin when IMAGE is defined. /// Works just like the MARGIN attribute of the IupHbox and IupVbox containers, /// but uses a different name to avoid inheritance problems. /// Default value: "0x0". /// Value can be DEFAULTBUTTONPADDING, so the global attribute of this name /// will be used instead (since 3.29). /// (since 3.0) pub fn getPadding(self: *Self) Size { var str = interop.getStrAttribute(self, "PADDING", .{}); return Size.parse(str); } /// /// PADDING: internal margin when IMAGE is defined. /// Works just like the MARGIN attribute of the IupHbox and IupVbox containers, /// but uses a different name to avoid inheritance problems. /// Default value: "0x0". /// Value can be DEFAULTBUTTONPADDING, so the global attribute of this name /// will be used instead (since 3.29). /// (since 3.0) pub fn setPadding(self: *Self, width: ?i32, height: ?i32) void { var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self, "PADDING", .{}, value); } pub fn getWId(self: *Self) i32 { return interop.getIntAttribute(self, "WID", .{}); } pub fn getTipMarkup(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "TIPMARKUP", .{}); } pub fn setTipMarkup(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "TIPMARKUP", .{}, arg); } pub fn getFontSize(self: *Self) i32 { return interop.getIntAttribute(self, "FONTSIZE", .{}); } pub fn setFontSize(self: *Self, arg: i32) void { interop.setIntAttribute(self, "FONTSIZE", .{}, arg); } pub fn getNaturalSize(self: *Self) Size { var str = interop.getStrAttribute(self, "NATURALSIZE", .{}); return Size.parse(str); } pub fn getUserSize(self: *Self) Size { var str = interop.getStrAttribute(self, "USERSIZE", .{}); return Size.parse(str); } pub fn setUserSize(self: *Self, width: ?i32, height: ?i32) void { var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self, "USERSIZE", .{}, value); } pub fn getTipDelay(self: *Self) i32 { return interop.getIntAttribute(self, "TIPDELAY", .{}); } pub fn setTipDelay(self: *Self, arg: i32) void { interop.setIntAttribute(self, "TIPDELAY", .{}, arg); } /// /// TITLE (non inheritable): Toggle's text. /// If IMAGE is not defined before map, then the default behavior is to contain /// a text. /// The button behavior can not be changed after map. /// The natural size will be larger enough to include all the text in the /// selected font, even using multiple lines, plus the button borders or check /// box if any. /// The '\n' character is accepted for line change. /// The "&" character can be used to define a mnemonic, the next character will /// be used as key. /// Use "&&" to show the "&" character instead on defining a mnemonic. /// The toggle can be activated from any control in the dialog using the /// "Alt+key" combination. /// (mnemonic support since 3.0) pub fn getTitle(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "TITLE", .{}); } /// /// TITLE (non inheritable): Toggle's text. /// If IMAGE is not defined before map, then the default behavior is to contain /// a text. /// The button behavior can not be changed after map. /// The natural size will be larger enough to include all the text in the /// selected font, even using multiple lines, plus the button borders or check /// box if any. /// The '\n' character is accepted for line change. /// The "&" character can be used to define a mnemonic, the next character will /// be used as key. /// Use "&&" to show the "&" character instead on defining a mnemonic. /// The toggle can be activated from any control in the dialog using the /// "Alt+key" combination. /// (mnemonic support since 3.0) pub fn setTitle(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "TITLE", .{}, arg); } /// /// RADIO (read-only): returns if the toggle is inside a radio. /// Can be "YES" or "NO". /// Valid only after the element is mapped, before returns NULL. /// (since 3.0) pub fn getRadio(self: *Self) bool { return interop.getBoolAttribute(self, "RADIO", .{}); } /// /// PROPAGATEFOCUS(non inheritable): enables the focus callback forwarding to /// the next native parent with FOCUS_CB defined. /// Default: NO. /// (since 3.23) pub fn getPropagateFocus(self: *Self) bool { return interop.getBoolAttribute(self, "PROPAGATEFOCUS", .{}); } /// /// PROPAGATEFOCUS(non inheritable): enables the focus callback forwarding to /// the next native parent with FOCUS_CB defined. /// Default: NO. /// (since 3.23) pub fn setPropagateFocus(self: *Self, arg: bool) void { interop.setBoolAttribute(self, "PROPAGATEFOCUS", .{}, arg); } /// /// BGCOLOR: Background color of toggle mark when displaying a text. /// The text background is transparent, it will use the background color of the /// native parent. /// When displaying an image in Windows the background is ignored and the /// system color is used. /// Default: the global attribute DLGBGCOLOR. pub fn getBgColor(self: *Self) ?iup.Rgb { return interop.getRgb(self, "BGCOLOR", .{}); } /// /// BGCOLOR: Background color of toggle mark when displaying a text. /// The text background is transparent, it will use the background color of the /// native parent. /// When displaying an image in Windows the background is ignored and the /// system color is used. /// Default: the global attribute DLGBGCOLOR. pub fn setBgColor(self: *Self, rgb: iup.Rgb) void { interop.setRgb(self, "BGCOLOR", .{}, rgb); } /// /// MARKUP [GTK only]: allows the title string to contains pango markup commands. /// Works only if a mnemonic is NOT defined in the title. /// Can be "YES" or "NO". /// Default: "NO". pub fn getMarkup(self: *Self) bool { return interop.getBoolAttribute(self, "MARKUP", .{}); } /// /// MARKUP [GTK only]: allows the title string to contains pango markup commands. /// Works only if a mnemonic is NOT defined in the title. /// Can be "YES" or "NO". /// Default: "NO". pub fn setMarkup(self: *Self, arg: bool) void { interop.setBoolAttribute(self, "MARKUP", .{}, arg); } pub fn getFloating(self: *Self) ?Floating { var ret = interop.getStrAttribute(self, "FLOATING", .{}); if (std.ascii.eqlIgnoreCase("YES", ret)) return .Yes; if (std.ascii.eqlIgnoreCase("IGNORE", ret)) return .Ignore; if (std.ascii.eqlIgnoreCase("NO", ret)) return .No; return null; } pub fn setFloating(self: *Self, arg: ?Floating) void { if (arg) |value| switch (value) { .Yes => interop.setStrAttribute(self, "FLOATING", .{}, "YES"), .Ignore => interop.setStrAttribute(self, "FLOATING", .{}, "IGNORE"), .No => interop.setStrAttribute(self, "FLOATING", .{}, "NO"), } else { interop.clearAttribute(self, "FLOATING", .{}); } } pub fn getNormalizerGroup(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "NORMALIZERGROUP", .{}); } pub fn setNormalizerGroup(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "NORMALIZERGROUP", .{}, arg); } pub fn getRasterSize(self: *Self) Size { var str = interop.getStrAttribute(self, "RASTERSIZE", .{}); return Size.parse(str); } pub fn setRasterSize(self: *Self, width: ?i32, height: ?i32) void { var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self, "RASTERSIZE", .{}, value); } pub fn getTipFgColor(self: *Self) ?iup.Rgb { return interop.getRgb(self, "TIPFGCOLOR", .{}); } pub fn setTipFgColor(self: *Self, rgb: iup.Rgb) void { interop.setRgb(self, "TIPFGCOLOR", .{}, rgb); } pub fn getFontFace(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "FONTFACE", .{}); } pub fn setFontFace(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "FONTFACE", .{}, arg); } pub fn getName(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "NAME", .{}); } pub fn setName(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "NAME", .{}, arg); } /// /// VALUE (non inheritable): Toggle's state. /// Values can be "ON", "OFF" or "TOGGLE". /// If 3STATE=YES then can also be "NOTDEF". /// Default: "OFF". /// The TOGGLE option will invert the current state (since 3.7). /// In GTK if you change the state of a radio, the unchecked toggle will /// receive an ACTION callback notification. /// Can only be set to ON if the toggle is inside a radio, it will /// automatically set to OFF the previous toggle that was ON in the radio. pub fn getValue(self: *Self) ?Value { var ret = interop.getStrAttribute(self, "VALUE", .{}); if (std.ascii.eqlIgnoreCase("ON", ret)) return .On; if (std.ascii.eqlIgnoreCase("OFF", ret)) return .Off; if (std.ascii.eqlIgnoreCase("NOTDEF", ret)) return .NotDef; return null; } /// /// VALUE (non inheritable): Toggle's state. /// Values can be "ON", "OFF" or "TOGGLE". /// If 3STATE=YES then can also be "NOTDEF". /// Default: "OFF". /// The TOGGLE option will invert the current state (since 3.7). /// In GTK if you change the state of a radio, the unchecked toggle will /// receive an ACTION callback notification. /// Can only be set to ON if the toggle is inside a radio, it will /// automatically set to OFF the previous toggle that was ON in the radio. pub fn setValue(self: *Self, arg: ?Value) void { if (arg) |value| switch (value) { .On => interop.setStrAttribute(self, "VALUE", .{}, "ON"), .Off => interop.setStrAttribute(self, "VALUE", .{}, "OFF"), .NotDef => interop.setStrAttribute(self, "VALUE", .{}, "NOTDEF"), } else { interop.clearAttribute(self, "VALUE", .{}); } } /// /// ACTIVE, FONT, EXPAND, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP, /// SIZE, RASTERSIZE, ZORDER, VISIBLE, THEME: also accepted. pub fn getActive(self: *Self) bool { return interop.getBoolAttribute(self, "ACTIVE", .{}); } /// /// ACTIVE, FONT, EXPAND, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP, /// SIZE, RASTERSIZE, ZORDER, VISIBLE, THEME: also accepted. pub fn setActive(self: *Self, arg: bool) void { interop.setBoolAttribute(self, "ACTIVE", .{}, arg); } pub fn getTipVisible(self: *Self) bool { return interop.getBoolAttribute(self, "TIPVISIBLE", .{}); } pub fn setTipVisible(self: *Self, arg: bool) void { interop.setBoolAttribute(self, "TIPVISIBLE", .{}, arg); } pub fn getExpandWeight(self: *Self) f64 { return interop.getDoubleAttribute(self, "EXPANDWEIGHT", .{}); } pub fn setExpandWeight(self: *Self, arg: f64) void { interop.setDoubleAttribute(self, "EXPANDWEIGHT", .{}, arg); } pub fn getMinSize(self: *Self) Size { var str = interop.getStrAttribute(self, "MINSIZE", .{}); return Size.parse(str); } pub fn setMinSize(self: *Self, width: ?i32, height: ?i32) void { var buffer: [128]u8 = undefined; var value = Size.intIntToString(&buffer, width, height); interop.setStrAttribute(self, "MINSIZE", .{}, value); } pub fn getNTheme(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "NTHEME", .{}); } pub fn setNTheme(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "NTHEME", .{}, arg); } pub fn getCharSize(self: *Self) Size { var str = interop.getStrAttribute(self, "CHARSIZE", .{}); return Size.parse(str); } /// /// IGNORERADIO (non inheritable): when set the toggle will not behave as a /// radio when inside an IupRadio hierarchy. /// (since 3.21) pub fn getIgnoreRadio(self: *Self) bool { return interop.getBoolAttribute(self, "IGNORERADIO", .{}); } /// /// IGNORERADIO (non inheritable): when set the toggle will not behave as a /// radio when inside an IupRadio hierarchy. /// (since 3.21) pub fn setIgnoreRadio(self: *Self, arg: bool) void { interop.setBoolAttribute(self, "IGNORERADIO", .{}, arg); } pub fn getFontStyle(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "FONTSTYLE", .{}); } pub fn setFontStyle(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "FONTSTYLE", .{}, arg); } pub fn getFont(self: *Self) [:0]const u8 { return interop.getStrAttribute(self, "FONT", .{}); } pub fn setFont(self: *Self, arg: [:0]const u8) void { interop.setStrAttribute(self, "FONT", .{}, arg); } /// /// TABIMAGEn (non inheritable): image name to be used in the respective tab. /// Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. /// n starts at 0. /// See also IupImage. /// In Motif, the image is shown only if TABTITLEn is NULL. /// In Windows and Motif set the BGCOLOR attribute before setting the image. /// When set after map will update the TABIMAGE attribute on the respective /// child (since 3.10). /// (since 3.0). /// TABIMAGE (non inheritable) (at children only): Same as TABIMAGEn but set in /// each child. /// Works only if set before the child is added to the tabs. pub fn getTabImage(self: *Self, index: i32) ?iup.Element { if (interop.getHandleAttribute(self, "TABIMAGE", .{index})) |handle| { return iup.Element.fromHandle(handle); } else { return null; } } /// /// TABIMAGEn (non inheritable): image name to be used in the respective tab. /// Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. /// n starts at 0. /// See also IupImage. /// In Motif, the image is shown only if TABTITLEn is NULL. /// In Windows and Motif set the BGCOLOR attribute before setting the image. /// When set after map will update the TABIMAGE attribute on the respective /// child (since 3.10). /// (since 3.0). /// TABIMAGE (non inheritable) (at children only): Same as TABIMAGEn but set in /// each child. /// Works only if set before the child is added to the tabs. pub fn setTabImage(self: *Self, index: i32, arg: anytype) !void { try interop.validateHandle(.Image, arg); interop.setHandleAttribute(self, "TABIMAGE", .{index}, arg); } pub fn setTabImageHandleName(self: *Self, index: i32, arg: [:0]const u8) void { interop.setStrAttribute(self, "TABIMAGE", .{index}, arg); } /// /// TABTITLEn (non inheritable): Contains the text to be shown in the /// respective tab title. /// n starts at 0. /// If this value is NULL, it will remain empty. /// The "&" character can be used to define a mnemonic, the next character will /// be used as key. /// Use "&&" to show the "&" character instead on defining a mnemonic. /// The button can be activated from any control in the dialog using the /// "Alt+key" combination. /// (mnemonic support since 3.3). /// When set after map will update the TABTITLE attribute on the respective /// child (since 3.10). /// (since 3.0). /// TABTITLE (non inheritable) (at children only): Same as TABTITLEn but set in /// each child. /// Works only if set before the child is added to the tabs. pub fn getTabTitle(self: *Self, index: i32) [:0]const u8 { return interop.getStrAttribute(self, "TABTITLE", .{index}); } /// /// TABTITLEn (non inheritable): Contains the text to be shown in the /// respective tab title. /// n starts at 0. /// If this value is NULL, it will remain empty. /// The "&" character can be used to define a mnemonic, the next character will /// be used as key. /// Use "&&" to show the "&" character instead on defining a mnemonic. /// The button can be activated from any control in the dialog using the /// "Alt+key" combination. /// (mnemonic support since 3.3). /// When set after map will update the TABTITLE attribute on the respective /// child (since 3.10). /// (since 3.0). /// TABTITLE (non inheritable) (at children only): Same as TABTITLEn but set in /// each child. /// Works only if set before the child is added to the tabs. pub fn setTabTitle(self: *Self, index: i32, arg: [:0]const u8) void { interop.setStrAttribute(self, "TABTITLE", .{index}, arg); } /// /// K_ANY K_ANY Action generated when a keyboard event occurs. /// Callback int function(Ihandle *ih, int c); [in C] ih:k_any(c: number) -> /// (ret: number) [in Lua] ih: identifier of the element that activated the event. /// c: identifier of typed key. /// Please refer to the Keyboard Codes table for a list of possible values. /// Returns: If IUP_IGNORE is returned the key is ignored and not processed by /// the control and not propagated. /// If returns IUP_CONTINUE, the key will be processed and the event will be /// propagated to the parent of the element receiving it, this is the default behavior. /// If returns IUP_DEFAULT the key is processed but it is not propagated. /// IUP_CLOSE will be processed. /// Notes Keyboard callbacks depend on the keyboard usage of the control with /// the focus. /// So if you return IUP_IGNORE the control will usually not process the key. /// But be aware that sometimes the control process the key in another event so /// even returning IUP_IGNORE the key can get processed. /// Although it will not be propagated. /// IMPORTANT: The callbacks "K_*" of the dialog or native containers depend on /// the IUP_CONTINUE return value to work while the control is in focus. /// If the callback does not exists it is automatically propagated to the /// parent of the element. /// K_* callbacks All defined keys are also callbacks of any element, called /// when the respective key is activated. /// For example: "K_cC" is also a callback activated when the user press /// Ctrl+C, when the focus is at the element or at a children with focus. /// This is the way an application can create shortcut keys, also called hot keys. /// These callbacks are not available in IupLua. /// Affects All elements with keyboard interaction. pub fn setKAnyCallback(self: *Self, callback: ?OnKAnyFn) void { const Handler = CallbackHandler(Self, OnKAnyFn, "K_ANY"); Handler.setCallback(self, callback); } /// /// HELP_CB HELP_CB Action generated when the user press F1 at a control. /// In Motif is also activated by the Help button in some workstations keyboard. /// Callback void function(Ihandle *ih); [in C] ih:help_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Returns: IUP_CLOSE will be processed. /// Affects All elements with user interaction. pub fn setHelpCallback(self: *Self, callback: ?OnHelpFn) void { const Handler = CallbackHandler(Self, OnHelpFn, "HELP_CB"); Handler.setCallback(self, callback); } /// /// ACTION ACTION Action generated when the element is activated. /// Affects each element differently. /// Callback int function(Ihandle *ih); [in C] ih:action() -> (ret: number) [in /// Lua] ih: identifier of the element that activated the event. /// In some elements, this callback may receive more parameters, apart from ih. /// Please refer to each element's documentation. /// Affects IupButton, IupItem, IupList, IupText, IupCanvas, IupMultiline, /// IupToggle pub fn setActionCallback(self: *Self, callback: ?OnActionFn) void { const Handler = CallbackHandler(Self, OnActionFn, "ACTION"); Handler.setCallback(self, callback); } /// /// MAP_CB MAP_CB Called right after an element is mapped and its attributes /// updated in IupMap. /// When the element is a dialog, it is called after the layout is updated. /// For all other elements is called before the layout is updated, so the /// element current size will still be 0x0 during MAP_CB (since 3.14). /// Callback int function(Ihandle *ih); [in C] ih:map_cb() -> (ret: number) [in /// Lua] ih: identifier of the element that activated the event. /// Affects All that have a native representation. pub fn setMapCallback(self: *Self, callback: ?OnMapFn) void { const Handler = CallbackHandler(Self, OnMapFn, "MAP_CB"); Handler.setCallback(self, callback); } /// /// ENTERWINDOW_CB ENTERWINDOW_CB Action generated when the mouse enters the /// native element. /// Callback int function(Ihandle *ih); [in C] ih:enterwindow_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Notes When the cursor is moved from one element to another, the call order /// in all platforms will be first the LEAVEWINDOW_CB callback of the old /// control followed by the ENTERWINDOW_CB callback of the new control. /// (since 3.14) If the mouse button is hold pressed and the cursor moves /// outside the element the behavior is system dependent. /// In Windows the LEAVEWINDOW_CB/ENTERWINDOW_CB callbacks are NOT called, in /// GTK the callbacks are called. /// Affects All controls with user interaction. /// See Also LEAVEWINDOW_CB pub fn setEnterWindowCallback(self: *Self, callback: ?OnEnterWindowFn) void { const Handler = CallbackHandler(Self, OnEnterWindowFn, "ENTERWINDOW_CB"); Handler.setCallback(self, callback); } /// /// DESTROY_CB DESTROY_CB Called right before an element is destroyed. /// Callback int function(Ihandle *ih); [in C] ih:destroy_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Notes If the dialog is visible then it is hidden before it is destroyed. /// The callback will be called right after it is hidden. /// The callback will be called before all other destroy procedures. /// For instance, if the element has children then it is called before the /// children are destroyed. /// For language binding implementations use the callback name "LDESTROY_CB" to /// release memory allocated by the binding for the element. /// Also the callback will be called before the language callback. /// Affects All. pub fn setDestroyCallback(self: *Self, callback: ?OnDestroyFn) void { const Handler = CallbackHandler(Self, OnDestroyFn, "DESTROY_CB"); Handler.setCallback(self, callback); } /// /// KILLFOCUS_CB KILLFOCUS_CB Action generated when an element loses keyboard focus. /// This callback is called before the GETFOCUS_CB of the element that gets the focus. /// Callback int function(Ihandle *ih); [in C] ih:killfocus_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Affects All elements with user interaction, except menus. /// In Windows, there are restrictions when using this callback. /// From MSDN on WM_KILLFOCUS: "While processing this message, do not make any /// function calls that display or activate a window. /// This causes the thread to yield control and can cause the application to /// stop responding to messages. /// See Also GETFOCUS_CB, IupGetFocus, IupSetFocus pub fn setKillFocusCallback(self: *Self, callback: ?OnKillFocusFn) void { const Handler = CallbackHandler(Self, OnKillFocusFn, "KILLFOCUS_CB"); Handler.setCallback(self, callback); } /// /// UNMAP_CB UNMAP_CB Called right before an element is unmapped. /// Callback int function(Ihandle *ih); [in C] ih:unmap_cb() -> (ret: number) /// [in Lua] ih: identifier of the element that activated the event. /// Affects All that have a native representation. pub fn setUnmapCallback(self: *Self, callback: ?OnUnmapFn) void { const Handler = CallbackHandler(Self, OnUnmapFn, "UNMAP_CB"); Handler.setCallback(self, callback); } /// /// GETFOCUS_CB GETFOCUS_CB Action generated when an element is given keyboard focus. /// This callback is called after the KILLFOCUS_CB of the element that loosed /// the focus. /// The IupGetFocus function during the callback returns the element that /// loosed the focus. /// Callback int function(Ihandle *ih); [in C] ih:getfocus_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that received keyboard focus. /// Affects All elements with user interaction, except menus. /// See Also KILLFOCUS_CB, IupGetFocus, IupSetFocus pub fn setGetFocusCallback(self: *Self, callback: ?OnGetFocusFn) void { const Handler = CallbackHandler(Self, OnGetFocusFn, "GETFOCUS_CB"); Handler.setCallback(self, callback); } /// /// VALUECHANGED_CB: Called after the value was interactively changed by the user. /// Called after the ACTION callback, but under the same context. /// (since 3.0) int function(Ihandle *ih); [in C]ih:valuechanged_cb() -> (ret: /// number) [in Lua] pub fn setValueChangedCallback(self: *Self, callback: ?OnValueChangedFn) void { const Handler = CallbackHandler(Self, OnValueChangedFn, "VALUECHANGED_CB"); Handler.setCallback(self, callback); } pub fn setLDestroyCallback(self: *Self, callback: ?OnLDestroyFn) void { const Handler = CallbackHandler(Self, OnLDestroyFn, "LDESTROY_CB"); Handler.setCallback(self, callback); } /// /// LEAVEWINDOW_CB LEAVEWINDOW_CB Action generated when the mouse leaves the /// native element. /// Callback int function(Ihandle *ih); [in C] ih:leavewindow_cb() -> (ret: /// number) [in Lua] ih: identifier of the element that activated the event. /// Notes When the cursor is moved from one element to another, the call order /// in all platforms will be first the LEAVEWINDOW_CB callback of the old /// control followed by the ENTERWINDOW_CB callback of the new control. /// (since 3.14) If the mouse button is hold pressed and the cursor moves /// outside the element the behavior is system dependent. /// In Windows the LEAVEWINDOW_CB/ENTERWINDOW_CB callbacks are NOT called, in /// GTK the callbacks are called. /// Affects All controls with user interaction. /// See Also ENTERWINDOW_CB pub fn setLeaveWindowCallback(self: *Self, callback: ?OnLeaveWindowFn) void { const Handler = CallbackHandler(Self, OnLeaveWindowFn, "LEAVEWINDOW_CB"); Handler.setCallback(self, callback); } pub fn setPostMessageCallback(self: *Self, callback: ?OnPostMessageFn) void { const Handler = CallbackHandler(Self, OnPostMessageFn, "POSTMESSAGE_CB"); Handler.setCallback(self, callback); } }; test "Toggle FgColor" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setFgColor(.{ .r = 9, .g = 10, .b = 11 }).unwrap()); defer item.deinit(); var ret = item.getFgColor(); try std.testing.expect(ret != null and ret.?.r == 9 and ret.?.g == 10 and ret.?.b == 11); } test "Toggle HandleName" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setHandleName("Hello").unwrap()); defer item.deinit(); var ret = item.getHandleName(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle TipBgColor" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTipBgColor(.{ .r = 9, .g = 10, .b = 11 }).unwrap()); defer item.deinit(); var ret = item.getTipBgColor(); try std.testing.expect(ret != null and ret.?.r == 9 and ret.?.g == 10 and ret.?.b == 11); } test "Toggle TipIcon" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTipIcon("Hello").unwrap()); defer item.deinit(); var ret = item.getTipIcon(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle MaxSize" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setMaxSize(9, 10).unwrap()); defer item.deinit(); var ret = item.getMaxSize(); try std.testing.expect(ret.width != null and ret.width.? == 9 and ret.height != null and ret.height.? == 10); } test "Toggle Position" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setPosition(9, 10).unwrap()); defer item.deinit(); var ret = item.getPosition(); try std.testing.expect(ret.x == 9 and ret.y == 10); } test "Toggle Tip" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTip("Hello").unwrap()); defer item.deinit(); var ret = item.getTip(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle Visible" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setVisible(true).unwrap()); defer item.deinit(); var ret = item.getVisible(); try std.testing.expect(ret == true); } test "Toggle Theme" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTheme("Hello").unwrap()); defer item.deinit(); var ret = item.getTheme(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle Expand" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setExpand(.Yes).unwrap()); defer item.deinit(); var ret = item.getExpand(); try std.testing.expect(ret != null and ret.? == .Yes); } test "Toggle Size" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setSize(9, 10).unwrap()); defer item.deinit(); var ret = item.getSize(); try std.testing.expect(ret.width != null and ret.width.? == 9 and ret.height != null and ret.height.? == 10); } test "Toggle Padding" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setPadding(9, 10).unwrap()); defer item.deinit(); var ret = item.getPadding(); try std.testing.expect(ret.width != null and ret.width.? == 9 and ret.height != null and ret.height.? == 10); } test "Toggle TipMarkup" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTipMarkup("Hello").unwrap()); defer item.deinit(); var ret = item.getTipMarkup(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle FontSize" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setFontSize(42).unwrap()); defer item.deinit(); var ret = item.getFontSize(); try std.testing.expect(ret == 42); } test "Toggle UserSize" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setUserSize(9, 10).unwrap()); defer item.deinit(); var ret = item.getUserSize(); try std.testing.expect(ret.width != null and ret.width.? == 9 and ret.height != null and ret.height.? == 10); } test "Toggle TipDelay" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTipDelay(42).unwrap()); defer item.deinit(); var ret = item.getTipDelay(); try std.testing.expect(ret == 42); } test "Toggle Title" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTitle("Hello").unwrap()); defer item.deinit(); var ret = item.getTitle(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle PropagateFocus" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setPropagateFocus(true).unwrap()); defer item.deinit(); var ret = item.getPropagateFocus(); try std.testing.expect(ret == true); } test "Toggle BgColor" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setBgColor(.{ .r = 9, .g = 10, .b = 11 }).unwrap()); defer item.deinit(); var ret = item.getBgColor(); try std.testing.expect(ret != null and ret.?.r == 9 and ret.?.g == 10 and ret.?.b == 11); } test "Toggle Markup" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setMarkup(true).unwrap()); defer item.deinit(); var ret = item.getMarkup(); try std.testing.expect(ret == true); } test "Toggle Floating" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setFloating(.Yes).unwrap()); defer item.deinit(); var ret = item.getFloating(); try std.testing.expect(ret != null and ret.? == .Yes); } test "Toggle NormalizerGroup" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setNormalizerGroup("Hello").unwrap()); defer item.deinit(); var ret = item.getNormalizerGroup(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle RasterSize" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setRasterSize(9, 10).unwrap()); defer item.deinit(); var ret = item.getRasterSize(); try std.testing.expect(ret.width != null and ret.width.? == 9 and ret.height != null and ret.height.? == 10); } test "Toggle TipFgColor" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTipFgColor(.{ .r = 9, .g = 10, .b = 11 }).unwrap()); defer item.deinit(); var ret = item.getTipFgColor(); try std.testing.expect(ret != null and ret.?.r == 9 and ret.?.g == 10 and ret.?.b == 11); } test "Toggle FontFace" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setFontFace("Hello").unwrap()); defer item.deinit(); var ret = item.getFontFace(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle Name" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setName("Hello").unwrap()); defer item.deinit(); var ret = item.getName(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle Value" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setValue(.On).unwrap()); defer item.deinit(); var ret = item.getValue(); try std.testing.expect(ret != null and ret.? == .On); } test "Toggle Active" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setActive(true).unwrap()); defer item.deinit(); var ret = item.getActive(); try std.testing.expect(ret == true); } test "Toggle TipVisible" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setTipVisible(true).unwrap()); defer item.deinit(); var ret = item.getTipVisible(); try std.testing.expect(ret == true); } test "Toggle ExpandWeight" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setExpandWeight(3.14).unwrap()); defer item.deinit(); var ret = item.getExpandWeight(); try std.testing.expect(ret == @as(f64, 3.14)); } test "Toggle MinSize" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setMinSize(9, 10).unwrap()); defer item.deinit(); var ret = item.getMinSize(); try std.testing.expect(ret.width != null and ret.width.? == 9 and ret.height != null and ret.height.? == 10); } test "Toggle NTheme" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setNTheme("Hello").unwrap()); defer item.deinit(); var ret = item.getNTheme(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle IgnoreRadio" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setIgnoreRadio(true).unwrap()); defer item.deinit(); var ret = item.getIgnoreRadio(); try std.testing.expect(ret == true); } test "Toggle FontStyle" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setFontStyle("Hello").unwrap()); defer item.deinit(); var ret = item.getFontStyle(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); } test "Toggle Font" { try iup.MainLoop.open(); defer iup.MainLoop.close(); var item = try (iup.Toggle.init().setFont("Hello").unwrap()); defer item.deinit(); var ret = item.getFont(); try std.testing.expect(std.mem.eql(u8, ret, "Hello")); }
src/elements/toggle.zig
const macro = @import("pspmacros.zig"); comptime { asm (macro.import_module_start("sceRtc", "0x40010000", "40")); asm (macro.import_function("sceRtc", "0xC41C2853", "sceRtcGetTickResolution")); asm (macro.import_function("sceRtc", "0x3F7AD767", "sceRtcGetCurrentTick")); asm (macro.import_function("sceRtc", "0x029CA3B3", "sceRtc_029CA3B3")); asm (macro.import_function("sceRtc", "0x4CFA57B0", "sceRtcGetCurrentClock")); asm (macro.import_function("sceRtc", "0xE7C27D1B", "sceRtcGetCurrentClockLocalTime")); asm (macro.import_function("sceRtc", "0x34885E0D", "sceRtcConvertUtcToLocalTime")); asm (macro.import_function("sceRtc", "0x779242A2", "sceRtcConvertLocalTimeToUTC")); asm (macro.import_function("sceRtc", "0x42307A17", "sceRtcIsLeapYear")); asm (macro.import_function("sceRtc", "0x05EF322C", "sceRtcGetDaysInMonth")); asm (macro.import_function("sceRtc", "0x57726BC1", "sceRtcGetDayOfWeek")); asm (macro.import_function("sceRtc", "0x4B1B5E82", "sceRtcCheckValid")); asm (macro.import_function("sceRtc", "0x3A807CC8", "sceRtcSetTime_t")); asm (macro.import_function("sceRtc", "0x27C4594C", "sceRtcGetTime_t")); asm (macro.import_function("sceRtc", "0xF006F264", "sceRtcSetDosTime")); asm (macro.import_function("sceRtc", "0x36075567", "sceRtcGetDosTime")); asm (macro.import_function("sceRtc", "0x7ACE4C04", "sceRtcSetWin32FileTime")); asm (macro.import_function("sceRtc", "0xCF561893", "sceRtcGetWin32FileTime")); asm (macro.import_function("sceRtc", "0x7ED29E40", "sceRtcSetTick")); asm (macro.import_function("sceRtc", "0x6FF40ACC", "sceRtcGetTick")); asm (macro.import_function("sceRtc", "0x9ED0AE87", "sceRtcCompareTick")); asm (macro.import_function("sceRtc", "0x44F45E05", "sceRtcTickAddTicks")); asm (macro.import_function("sceRtc", "0x26D25A5D", "sceRtcTickAddMicroseconds")); asm (macro.import_function("sceRtc", "0xF2A4AFE5", "sceRtcTickAddSeconds")); asm (macro.import_function("sceRtc", "0xE6605BCA", "sceRtcTickAddMinutes")); asm (macro.import_function("sceRtc", "0x26D7A24A", "sceRtcTickAddHours")); asm (macro.import_function("sceRtc", "0xE51B4B7A", "sceRtcTickAddDays")); asm (macro.import_function("sceRtc", "0xCF3A2CA8", "sceRtcTickAddWeeks")); asm (macro.import_function("sceRtc", "0xDBF74F1B", "sceRtcTickAddMonths")); asm (macro.import_function("sceRtc", "0x42842C77", "sceRtcTickAddYears")); asm (macro.import_function("sceRtc", "0xC663B3B9", "sceRtcFormatRFC2822")); asm (macro.import_function("sceRtc", "0x7DE6711B", "sceRtcFormatRFC2822LocalTime")); asm (macro.import_function("sceRtc", "0x0498FB3C", "sceRtcFormatRFC3339")); asm (macro.import_function("sceRtc", "0x27F98543", "sceRtcFormatRFC3339LocalTime")); asm (macro.import_function("sceRtc", "0xDFBC5F16", "sceRtcParseDateTime")); asm (macro.import_function("sceRtc", "0x28E1E988", "sceRtcParseRFC3339")); asm (macro.import_function("sceRtc", "0x011F03C1", "sceRtcGetAccumulativeTime")); asm (macro.import_function("sceRtc", "0x1909C99B", "sceRtcSetTime64_t")); asm (macro.import_function("sceRtc", "0x203CEB0D", "sceRtcGetLastReincarnatedTime")); asm (macro.import_function("sceRtc", "0x62685E98", "sceRtcGetLastAdjustedTime")); asm (macro.import_function("sceRtc", "0xE1C93E47", "sceRtcGetTime64_t")); }
src/psp/nids/psprtc.zig
const std = @import("std"); const utils = @import("utils.zig"); const CountConverter = utils.Converter{ .units = &[_][]const u8{ "", "k", "M", "G" }, .dividers = &[_]usize{ 1, 1_000, 1_000_000, 1_000_000_000 }, }; const ByteConverter = utils.Converter{ .units = &[_][]const u8{ "B", "kB", "MB", "GB" }, .dividers = &[_]usize{ 1, 1024, 1024 * 1024, 1024 * 1024 * 1024 }, }; pub fn Progress(comptime Stages: type) type { return struct { const Unit = enum { counts, bytes, }; const Stage = struct { label: []const u8, unit: Unit, value: usize = 0, max: usize = 0, }; const Self = @This(); const Indexer = std.enums.EnumIndexer(Stages); stages: [Indexer.count]Stage = undefined, active_index: usize = 0, out: std.fs.File = std.io.getStdOut(), timer: std.time.Timer = undefined, prev_stage: ?*Stage = undefined, prev_print_timestamp: u64 = undefined, pub fn start(self: *Self) !void { self.timer = try std.time.Timer.start(); self.prev_stage = null; self.prev_print_timestamp = 0; } pub fn finish(self: *Self) void { self.write("\n", .{}); } pub fn add(self: *Self, stage: Stages, label: []const u8, unit: Unit) void { self.stages[Indexer.indexOf(stage)] = .{ .label = label, .unit = unit, }; } pub fn activate(self: *Self, stage: Stages) void { const new_index = Indexer.indexOf(stage); if (new_index != self.active_index) self.write("\n", .{}); self.active_index = new_index; } pub fn set(self: *Self, stage: Stages, value: usize, max: usize) void { const index = Indexer.indexOf(stage); const st = &self.stages[index]; st.value = value; st.max = max; if (self.active_index == index) { self.print(st); } } fn print(self: *Self, stage: *Stage) void { const now = self.timer.read(); var refresh: bool = false; refresh = refresh or (self.prev_print_timestamp + 50 * std.time.ns_per_ms < now); refresh = refresh or (self.prev_stage == null or self.prev_stage.? != stage); refresh = refresh or (stage.value >= stage.max); if (!refresh) { return; } self.prev_print_timestamp = now; self.prev_stage = stage; const ratio = if (stage.max == 0) 1.0 else (@intToFloat(f32, stage.value) / @intToFloat(f32, stage.max)); const percent = ratio * 100.0; const result = switch (stage.unit) { .counts => CountConverter.convert(stage.value), .bytes => ByteConverter.convert(stage.value), }; self.write("{s: <20}: {d:3.0}% ({d}{s})" ++ (" " ** 40) ++ "\r", .{ stage.label, percent, result.value, result.unit }); } fn write(self: *Self, comptime fmt: anytype, args: anytype) void { self.out.writer().print(fmt, args) catch std.process.exit(1); } }; }
src/progress.zig
const std = @import("std"); const Span = @import("basics.zig").Span; const PaintCurve = @import("painter.zig").PaintCurve; const PaintState = @import("painter.zig").PaintState; const Painter = @import("painter.zig").Painter; pub const Envelope = struct { pub const num_outputs = 1; pub const num_temps = 0; pub const Params = struct { sample_rate: f32, attack: PaintCurve, decay: PaintCurve, release: PaintCurve, sustain_volume: f32, note_on: bool, }; const State = enum { idle, attack, decay, sustain, release }; state: State, painter: Painter, pub fn init() Envelope { return .{ .state = .idle, .painter = Painter.init(), }; } fn changeState(self: *Envelope, new_state: State) void { self.state = new_state; self.painter.newCurve(); } fn paintOn(self: *Envelope, buf: []f32, p: Params, new_note: bool) void { var ps = PaintState.init(buf, p.sample_rate); if (new_note) { self.changeState(.attack); } std.debug.assert(self.state != .idle); std.debug.assert(self.state != .release); if (self.state == .attack) { if (self.painter.paintToward(&ps, p.attack, 1.0)) { if (p.sustain_volume < 1.0) { self.changeState(.decay); } else { self.changeState(.sustain); } } } if (self.state == .decay) { if (self.painter.paintToward(&ps, p.decay, p.sustain_volume)) { self.changeState(.sustain); } } if (self.state == .sustain) { self.painter.paintFlat(&ps, p.sustain_volume); } std.debug.assert(ps.i == buf.len); } fn paintOff(self: *Envelope, buf: []f32, p: Params) void { if (self.state == .idle) { return; } var ps = PaintState.init(buf, p.sample_rate); if (self.state != .release) { self.changeState(.release); } if (self.painter.paintToward(&ps, p.release, 0.0)) { self.changeState(.idle); } } pub fn paint( self: *Envelope, span: Span, outputs: [num_outputs][]f32, temps: [num_temps][]f32, note_id_changed: bool, params: Params, ) void { const output = outputs[0][span.start..span.end]; if (params.note_on) { self.paintOn(output, params, note_id_changed); } else { self.paintOff(output, params); } } };
src/zang/mod_envelope.zig
pub const SIZEOF_IP4_ADDRESS = @as(u32, 4); pub const IP4_ADDRESS_STRING_LENGTH = @as(u32, 16); pub const IP4_ADDRESS_STRING_BUFFER_LENGTH = @as(u32, 16); pub const DNS_ADDR_MAX_SOCKADDR_LENGTH = @as(u32, 32); pub const IP6_ADDRESS_STRING_LENGTH = @as(u32, 65); pub const IP6_ADDRESS_STRING_BUFFER_LENGTH = @as(u32, 65); pub const DNS_ADDRESS_STRING_LENGTH = @as(u32, 65); pub const DNS_PORT_HOST_ORDER = @as(u32, 53); pub const DNS_PORT_NET_ORDER = @as(u32, 13568); pub const DNS_RFC_MAX_UDP_PACKET_LENGTH = @as(u32, 512); pub const DNS_MAX_NAME_LENGTH = @as(u32, 255); pub const DNS_MAX_LABEL_LENGTH = @as(u32, 63); pub const DNS_MAX_NAME_BUFFER_LENGTH = @as(u32, 256); pub const DNS_MAX_LABEL_BUFFER_LENGTH = @as(u32, 64); pub const DNS_MAX_IP4_REVERSE_NAME_LENGTH = @as(u32, 31); pub const DNS_MAX_IP6_REVERSE_NAME_LENGTH = @as(u32, 75); pub const DNS_MAX_REVERSE_NAME_LENGTH = @as(u32, 75); pub const DNS_MAX_IP4_REVERSE_NAME_BUFFER_LENGTH = @as(u32, 31); pub const DNS_MAX_IP6_REVERSE_NAME_BUFFER_LENGTH = @as(u32, 75); pub const DNS_MAX_REVERSE_NAME_BUFFER_LENGTH = @as(u32, 75); pub const DNS_MAX_TEXT_STRING_LENGTH = @as(u32, 255); pub const DNS_COMPRESSED_QUESTION_NAME = @as(u32, 49164); pub const DNS_OPCODE_QUERY = @as(u32, 0); pub const DNS_OPCODE_IQUERY = @as(u32, 1); pub const DNS_OPCODE_SERVER_STATUS = @as(u32, 2); pub const DNS_OPCODE_UNKNOWN = @as(u32, 3); pub const DNS_OPCODE_NOTIFY = @as(u32, 4); pub const DNS_OPCODE_UPDATE = @as(u32, 5); pub const DNS_RCODE_NOERROR = @as(u32, 0); pub const DNS_RCODE_FORMERR = @as(u32, 1); pub const DNS_RCODE_SERVFAIL = @as(u32, 2); pub const DNS_RCODE_NXDOMAIN = @as(u32, 3); pub const DNS_RCODE_NOTIMPL = @as(u32, 4); pub const DNS_RCODE_REFUSED = @as(u32, 5); pub const DNS_RCODE_YXDOMAIN = @as(u32, 6); pub const DNS_RCODE_YXRRSET = @as(u32, 7); pub const DNS_RCODE_NXRRSET = @as(u32, 8); pub const DNS_RCODE_NOTAUTH = @as(u32, 9); pub const DNS_RCODE_NOTZONE = @as(u32, 10); pub const DNS_RCODE_MAX = @as(u32, 15); pub const DNS_RCODE_BADVERS = @as(u32, 16); pub const DNS_RCODE_BADSIG = @as(u32, 16); pub const DNS_RCODE_BADKEY = @as(u32, 17); pub const DNS_RCODE_BADTIME = @as(u32, 18); pub const DNS_RCODE_NO_ERROR = @as(u32, 0); pub const DNS_RCODE_FORMAT_ERROR = @as(u32, 1); pub const DNS_RCODE_SERVER_FAILURE = @as(u32, 2); pub const DNS_RCODE_NAME_ERROR = @as(u32, 3); pub const DNS_RCODE_NOT_IMPLEMENTED = @as(u32, 4); pub const DNS_CLASS_INTERNET = @as(u32, 1); pub const DNS_CLASS_CSNET = @as(u32, 2); pub const DNS_CLASS_CHAOS = @as(u32, 3); pub const DNS_CLASS_HESIOD = @as(u32, 4); pub const DNS_CLASS_NONE = @as(u32, 254); pub const DNS_CLASS_ALL = @as(u32, 255); pub const DNS_CLASS_ANY = @as(u32, 255); pub const DNS_CLASS_UNICAST_RESPONSE = @as(u32, 32768); pub const DNS_RCLASS_INTERNET = @as(u32, 256); pub const DNS_RCLASS_CSNET = @as(u32, 512); pub const DNS_RCLASS_CHAOS = @as(u32, 768); pub const DNS_RCLASS_HESIOD = @as(u32, 1024); pub const DNS_RCLASS_NONE = @as(u32, 65024); pub const DNS_RCLASS_ALL = @as(u32, 65280); pub const DNS_RCLASS_ANY = @as(u32, 65280); pub const DNS_RCLASS_UNICAST_RESPONSE = @as(u32, 128); pub const DNS_TYPE_ZERO = @as(u32, 0); pub const DNS_TYPE_A = @as(u32, 1); pub const DNS_TYPE_NS = @as(u32, 2); pub const DNS_TYPE_MD = @as(u32, 3); pub const DNS_TYPE_MF = @as(u32, 4); pub const DNS_TYPE_CNAME = @as(u32, 5); pub const DNS_TYPE_SOA = @as(u32, 6); pub const DNS_TYPE_MB = @as(u32, 7); pub const DNS_TYPE_MG = @as(u32, 8); pub const DNS_TYPE_MR = @as(u32, 9); pub const DNS_TYPE_NULL = @as(u32, 10); pub const DNS_TYPE_WKS = @as(u32, 11); pub const DNS_TYPE_PTR = @as(u32, 12); pub const DNS_TYPE_HINFO = @as(u32, 13); pub const DNS_TYPE_MINFO = @as(u32, 14); pub const DNS_TYPE_MX = @as(u32, 15); pub const DNS_TYPE_TEXT = @as(u32, 16); pub const DNS_TYPE_RP = @as(u32, 17); pub const DNS_TYPE_AFSDB = @as(u32, 18); pub const DNS_TYPE_X25 = @as(u32, 19); pub const DNS_TYPE_ISDN = @as(u32, 20); pub const DNS_TYPE_RT = @as(u32, 21); pub const DNS_TYPE_NSAP = @as(u32, 22); pub const DNS_TYPE_NSAPPTR = @as(u32, 23); pub const DNS_TYPE_SIG = @as(u32, 24); pub const DNS_TYPE_KEY = @as(u32, 25); pub const DNS_TYPE_PX = @as(u32, 26); pub const DNS_TYPE_GPOS = @as(u32, 27); pub const DNS_TYPE_AAAA = @as(u32, 28); pub const DNS_TYPE_LOC = @as(u32, 29); pub const DNS_TYPE_NXT = @as(u32, 30); pub const DNS_TYPE_EID = @as(u32, 31); pub const DNS_TYPE_NIMLOC = @as(u32, 32); pub const DNS_TYPE_SRV = @as(u32, 33); pub const DNS_TYPE_ATMA = @as(u32, 34); pub const DNS_TYPE_NAPTR = @as(u32, 35); pub const DNS_TYPE_KX = @as(u32, 36); pub const DNS_TYPE_CERT = @as(u32, 37); pub const DNS_TYPE_A6 = @as(u32, 38); pub const DNS_TYPE_DNAME = @as(u32, 39); pub const DNS_TYPE_SINK = @as(u32, 40); pub const DNS_TYPE_OPT = @as(u32, 41); pub const DNS_TYPE_DS = @as(u32, 43); pub const DNS_TYPE_RRSIG = @as(u32, 46); pub const DNS_TYPE_NSEC = @as(u32, 47); pub const DNS_TYPE_DNSKEY = @as(u32, 48); pub const DNS_TYPE_DHCID = @as(u32, 49); pub const DNS_TYPE_NSEC3 = @as(u32, 50); pub const DNS_TYPE_NSEC3PARAM = @as(u32, 51); pub const DNS_TYPE_TLSA = @as(u32, 52); pub const DNS_TYPE_UINFO = @as(u32, 100); pub const DNS_TYPE_UID = @as(u32, 101); pub const DNS_TYPE_GID = @as(u32, 102); pub const DNS_TYPE_UNSPEC = @as(u32, 103); pub const DNS_TYPE_ADDRS = @as(u32, 248); pub const DNS_TYPE_TKEY = @as(u32, 249); pub const DNS_TYPE_TSIG = @as(u32, 250); pub const DNS_TYPE_IXFR = @as(u32, 251); pub const DNS_TYPE_AXFR = @as(u32, 252); pub const DNS_TYPE_MAILB = @as(u32, 253); pub const DNS_TYPE_MAILA = @as(u32, 254); pub const DNS_TYPE_ALL = @as(u32, 255); pub const DNS_TYPE_ANY = @as(u32, 255); pub const DNS_TYPE_WINS = @as(u32, 65281); pub const DNS_TYPE_WINSR = @as(u32, 65282); pub const DNS_TYPE_NBSTAT = @as(u32, 65282); pub const DNS_RTYPE_A = @as(u32, 256); pub const DNS_RTYPE_NS = @as(u32, 512); pub const DNS_RTYPE_MD = @as(u32, 768); pub const DNS_RTYPE_MF = @as(u32, 1024); pub const DNS_RTYPE_CNAME = @as(u32, 1280); pub const DNS_RTYPE_SOA = @as(u32, 1536); pub const DNS_RTYPE_MB = @as(u32, 1792); pub const DNS_RTYPE_MG = @as(u32, 2048); pub const DNS_RTYPE_MR = @as(u32, 2304); pub const DNS_RTYPE_NULL = @as(u32, 2560); pub const DNS_RTYPE_WKS = @as(u32, 2816); pub const DNS_RTYPE_PTR = @as(u32, 3072); pub const DNS_RTYPE_HINFO = @as(u32, 3328); pub const DNS_RTYPE_MINFO = @as(u32, 3584); pub const DNS_RTYPE_MX = @as(u32, 3840); pub const DNS_RTYPE_TEXT = @as(u32, 4096); pub const DNS_RTYPE_RP = @as(u32, 4352); pub const DNS_RTYPE_AFSDB = @as(u32, 4608); pub const DNS_RTYPE_X25 = @as(u32, 4864); pub const DNS_RTYPE_ISDN = @as(u32, 5120); pub const DNS_RTYPE_RT = @as(u32, 5376); pub const DNS_RTYPE_NSAP = @as(u32, 5632); pub const DNS_RTYPE_NSAPPTR = @as(u32, 5888); pub const DNS_RTYPE_SIG = @as(u32, 6144); pub const DNS_RTYPE_KEY = @as(u32, 6400); pub const DNS_RTYPE_PX = @as(u32, 6656); pub const DNS_RTYPE_GPOS = @as(u32, 6912); pub const DNS_RTYPE_AAAA = @as(u32, 7168); pub const DNS_RTYPE_LOC = @as(u32, 7424); pub const DNS_RTYPE_NXT = @as(u32, 7680); pub const DNS_RTYPE_EID = @as(u32, 7936); pub const DNS_RTYPE_NIMLOC = @as(u32, 8192); pub const DNS_RTYPE_SRV = @as(u32, 8448); pub const DNS_RTYPE_ATMA = @as(u32, 8704); pub const DNS_RTYPE_NAPTR = @as(u32, 8960); pub const DNS_RTYPE_KX = @as(u32, 9216); pub const DNS_RTYPE_CERT = @as(u32, 9472); pub const DNS_RTYPE_A6 = @as(u32, 9728); pub const DNS_RTYPE_DNAME = @as(u32, 9984); pub const DNS_RTYPE_SINK = @as(u32, 10240); pub const DNS_RTYPE_OPT = @as(u32, 10496); pub const DNS_RTYPE_DS = @as(u32, 11008); pub const DNS_RTYPE_RRSIG = @as(u32, 11776); pub const DNS_RTYPE_NSEC = @as(u32, 12032); pub const DNS_RTYPE_DNSKEY = @as(u32, 12288); pub const DNS_RTYPE_DHCID = @as(u32, 12544); pub const DNS_RTYPE_NSEC3 = @as(u32, 12800); pub const DNS_RTYPE_NSEC3PARAM = @as(u32, 13056); pub const DNS_RTYPE_TLSA = @as(u32, 13312); pub const DNS_RTYPE_UINFO = @as(u32, 25600); pub const DNS_RTYPE_UID = @as(u32, 25856); pub const DNS_RTYPE_GID = @as(u32, 26112); pub const DNS_RTYPE_UNSPEC = @as(u32, 26368); pub const DNS_RTYPE_TKEY = @as(u32, 63744); pub const DNS_RTYPE_TSIG = @as(u32, 64000); pub const DNS_RTYPE_IXFR = @as(u32, 64256); pub const DNS_RTYPE_AXFR = @as(u32, 64512); pub const DNS_RTYPE_MAILB = @as(u32, 64768); pub const DNS_RTYPE_MAILA = @as(u32, 65024); pub const DNS_RTYPE_ALL = @as(u32, 65280); pub const DNS_RTYPE_ANY = @as(u32, 65280); pub const DNS_RTYPE_WINS = @as(u32, 511); pub const DNS_RTYPE_WINSR = @as(u32, 767); pub const DNS_ATMA_FORMAT_E164 = @as(u32, 1); pub const DNS_ATMA_FORMAT_AESA = @as(u32, 2); pub const DNS_ATMA_MAX_ADDR_LENGTH = @as(u32, 20); pub const DNS_ATMA_AESA_ADDR_LENGTH = @as(u32, 20); pub const DNS_ATMA_MAX_RECORD_LENGTH = @as(u32, 21); pub const DNSSEC_ALGORITHM_RSAMD5 = @as(u32, 1); pub const DNSSEC_ALGORITHM_RSASHA1 = @as(u32, 5); pub const DNSSEC_ALGORITHM_RSASHA1_NSEC3 = @as(u32, 7); pub const DNSSEC_ALGORITHM_RSASHA256 = @as(u32, 8); pub const DNSSEC_ALGORITHM_RSASHA512 = @as(u32, 10); pub const DNSSEC_ALGORITHM_ECDSAP256_SHA256 = @as(u32, 13); pub const DNSSEC_ALGORITHM_ECDSAP384_SHA384 = @as(u32, 14); pub const DNSSEC_ALGORITHM_NULL = @as(u32, 253); pub const DNSSEC_ALGORITHM_PRIVATE = @as(u32, 254); pub const DNSSEC_DIGEST_ALGORITHM_SHA1 = @as(u32, 1); pub const DNSSEC_DIGEST_ALGORITHM_SHA256 = @as(u32, 2); pub const DNSSEC_DIGEST_ALGORITHM_SHA384 = @as(u32, 4); pub const DNSSEC_PROTOCOL_NONE = @as(u32, 0); pub const DNSSEC_PROTOCOL_TLS = @as(u32, 1); pub const DNSSEC_PROTOCOL_EMAIL = @as(u32, 2); pub const DNSSEC_PROTOCOL_DNSSEC = @as(u32, 3); pub const DNSSEC_PROTOCOL_IPSEC = @as(u32, 4); pub const DNSSEC_KEY_FLAG_NOAUTH = @as(u32, 1); pub const DNSSEC_KEY_FLAG_NOCONF = @as(u32, 2); pub const DNSSEC_KEY_FLAG_FLAG2 = @as(u32, 4); pub const DNSSEC_KEY_FLAG_EXTEND = @as(u32, 8); pub const DNSSEC_KEY_FLAG_FLAG4 = @as(u32, 16); pub const DNSSEC_KEY_FLAG_FLAG5 = @as(u32, 32); pub const DNSSEC_KEY_FLAG_USER = @as(u32, 0); pub const DNSSEC_KEY_FLAG_ZONE = @as(u32, 64); pub const DNSSEC_KEY_FLAG_HOST = @as(u32, 128); pub const DNSSEC_KEY_FLAG_NTPE3 = @as(u32, 192); pub const DNSSEC_KEY_FLAG_FLAG8 = @as(u32, 256); pub const DNSSEC_KEY_FLAG_FLAG9 = @as(u32, 512); pub const DNSSEC_KEY_FLAG_FLAG10 = @as(u32, 1024); pub const DNSSEC_KEY_FLAG_FLAG11 = @as(u32, 2048); pub const DNSSEC_KEY_FLAG_SIG0 = @as(u32, 0); pub const DNSSEC_KEY_FLAG_SIG1 = @as(u32, 4096); pub const DNSSEC_KEY_FLAG_SIG2 = @as(u32, 8192); pub const DNSSEC_KEY_FLAG_SIG3 = @as(u32, 12288); pub const DNSSEC_KEY_FLAG_SIG4 = @as(u32, 16384); pub const DNSSEC_KEY_FLAG_SIG5 = @as(u32, 20480); pub const DNSSEC_KEY_FLAG_SIG6 = @as(u32, 24576); pub const DNSSEC_KEY_FLAG_SIG7 = @as(u32, 28672); pub const DNSSEC_KEY_FLAG_SIG8 = @as(u32, 32768); pub const DNSSEC_KEY_FLAG_SIG9 = @as(u32, 36864); pub const DNSSEC_KEY_FLAG_SIG10 = @as(u32, 40960); pub const DNSSEC_KEY_FLAG_SIG11 = @as(u32, 45056); pub const DNSSEC_KEY_FLAG_SIG12 = @as(u32, 49152); pub const DNSSEC_KEY_FLAG_SIG13 = @as(u32, 53248); pub const DNSSEC_KEY_FLAG_SIG14 = @as(u32, 57344); pub const DNSSEC_KEY_FLAG_SIG15 = @as(u32, 61440); pub const DNS_TKEY_MODE_SERVER_ASSIGN = @as(u32, 1); pub const DNS_TKEY_MODE_DIFFIE_HELLMAN = @as(u32, 2); pub const DNS_TKEY_MODE_GSS = @as(u32, 3); pub const DNS_TKEY_MODE_RESOLVER_ASSIGN = @as(u32, 4); pub const DNS_WINS_FLAG_SCOPE = @as(u32, 2147483648); pub const DNS_WINS_FLAG_LOCAL = @as(u32, 65536); pub const DNS_CONFIG_FLAG_ALLOC = @as(u32, 1); pub const DNSREC_SECTION = @as(u32, 3); pub const DNSREC_QUESTION = @as(u32, 0); pub const DNSREC_ANSWER = @as(u32, 1); pub const DNSREC_AUTHORITY = @as(u32, 2); pub const DNSREC_ADDITIONAL = @as(u32, 3); pub const DNSREC_ZONE = @as(u32, 0); pub const DNSREC_PREREQ = @as(u32, 1); pub const DNSREC_UPDATE = @as(u32, 2); pub const DNSREC_DELETE = @as(u32, 4); pub const DNSREC_NOEXIST = @as(u32, 4); pub const DNS_QUERY_STANDARD = @as(u32, 0); pub const DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE = @as(u32, 1); pub const DNS_QUERY_USE_TCP_ONLY = @as(u32, 2); pub const DNS_QUERY_NO_RECURSION = @as(u32, 4); pub const DNS_QUERY_BYPASS_CACHE = @as(u32, 8); pub const DNS_QUERY_NO_WIRE_QUERY = @as(u32, 16); pub const DNS_QUERY_NO_LOCAL_NAME = @as(u32, 32); pub const DNS_QUERY_NO_HOSTS_FILE = @as(u32, 64); pub const DNS_QUERY_NO_NETBT = @as(u32, 128); pub const DNS_QUERY_WIRE_ONLY = @as(u32, 256); pub const DNS_QUERY_RETURN_MESSAGE = @as(u32, 512); pub const DNS_QUERY_MULTICAST_ONLY = @as(u32, 1024); pub const DNS_QUERY_NO_MULTICAST = @as(u32, 2048); pub const DNS_QUERY_TREAT_AS_FQDN = @as(u32, 4096); pub const DNS_QUERY_ADDRCONFIG = @as(u32, 8192); pub const DNS_QUERY_DUAL_ADDR = @as(u32, 16384); pub const DNS_QUERY_DONT_RESET_TTL_VALUES = @as(u32, 1048576); pub const DNS_QUERY_DISABLE_IDN_ENCODING = @as(u32, 2097152); pub const DNS_QUERY_APPEND_MULTILABEL = @as(u32, 8388608); pub const DNS_QUERY_DNSSEC_OK = @as(u32, 16777216); pub const DNS_QUERY_DNSSEC_CHECKING_DISABLED = @as(u32, 33554432); pub const DNS_QUERY_RESERVED = @as(u32, 4026531840); pub const DNS_QUERY_CACHE_ONLY = @as(u32, 16); pub const DNS_QUERY_REQUEST_VERSION1 = @as(u32, 1); pub const DNS_QUERY_REQUEST_VERSION2 = @as(u32, 2); pub const DNS_QUERY_RESULTS_VERSION1 = @as(u32, 1); pub const DNS_QUERY_REQUEST_VERSION3 = @as(u32, 3); pub const DNS_CUSTOM_SERVER_TYPE_UDP = @as(u32, 1); pub const DNS_CUSTOM_SERVER_TYPE_DOH = @as(u32, 2); pub const DNS_CUSTOM_SERVER_UDP_FALLBACK = @as(u32, 1); pub const DNS_APP_SETTINGS_VERSION1 = @as(u32, 1); pub const DNS_APP_SETTINGS_EXCLUSIVE_SERVERS = @as(u32, 1); pub const DNS_UPDATE_SECURITY_USE_DEFAULT = @as(u32, 0); pub const DNS_UPDATE_SECURITY_OFF = @as(u32, 16); pub const DNS_UPDATE_SECURITY_ON = @as(u32, 32); pub const DNS_UPDATE_SECURITY_ONLY = @as(u32, 256); pub const DNS_UPDATE_CACHE_SECURITY_CONTEXT = @as(u32, 512); pub const DNS_UPDATE_TEST_USE_LOCAL_SYS_ACCT = @as(u32, 1024); pub const DNS_UPDATE_FORCE_SECURITY_NEGO = @as(u32, 2048); pub const DNS_UPDATE_TRY_ALL_MASTER_SERVERS = @as(u32, 4096); pub const DNS_UPDATE_SKIP_NO_UPDATE_ADAPTERS = @as(u32, 8192); pub const DNS_UPDATE_REMOTE_SERVER = @as(u32, 16384); pub const DNS_UPDATE_RESERVED = @as(u32, 4294901760); pub const DNS_VALSVR_ERROR_INVALID_ADDR = @as(u32, 1); pub const DNS_VALSVR_ERROR_INVALID_NAME = @as(u32, 2); pub const DNS_VALSVR_ERROR_UNREACHABLE = @as(u32, 3); pub const DNS_VALSVR_ERROR_NO_RESPONSE = @as(u32, 4); pub const DNS_VALSVR_ERROR_NO_AUTH = @as(u32, 5); pub const DNS_VALSVR_ERROR_REFUSED = @as(u32, 6); pub const DNS_VALSVR_ERROR_NO_TCP = @as(u32, 16); pub const DNS_VALSVR_ERROR_UNKNOWN = @as(u32, 255); pub const DNS_CONNECTION_NAME_MAX_LENGTH = @as(u32, 64); pub const DNS_CONNECTION_PROXY_INFO_CURRENT_VERSION = @as(u32, 1); pub const DNS_CONNECTION_PROXY_INFO_SERVER_MAX_LENGTH = @as(u32, 256); pub const DNS_CONNECTION_PROXY_INFO_FRIENDLY_NAME_MAX_LENGTH = @as(u32, 64); pub const DNS_CONNECTION_PROXY_INFO_USERNAME_MAX_LENGTH = @as(u32, 128); pub const DNS_CONNECTION_PROXY_INFO_PASSWORD_MAX_LENGTH = @as(u32, 128); pub const DNS_CONNECTION_PROXY_INFO_EXCEPTION_MAX_LENGTH = @as(u32, 1024); pub const DNS_CONNECTION_PROXY_INFO_EXTRA_INFO_MAX_LENGTH = @as(u32, 1024); pub const DNS_CONNECTION_PROXY_INFO_FLAG_DISABLED = @as(u32, 1); pub const DNS_CONNECTION_PROXY_INFO_FLAG_BYPASSLOCAL = @as(u32, 2); pub const DNS_CONNECTION_POLICY_ENTRY_ONDEMAND = @as(u32, 1); //-------------------------------------------------------------------------------- // Section: Types (97) //-------------------------------------------------------------------------------- // TODO: this type has a FreeFunc 'DnsReleaseContextHandle', what can Zig do with this information? pub const DnsContextHandle = isize; pub const IP4_ARRAY = extern struct { AddrCount: u32, AddrArray: [1]u32, }; pub const DNS_ADDR = extern struct { MaxSa: [32]CHAR, Data: packed union { DnsAddrUserDword: [8]u32, }, }; pub const DNS_ADDR_ARRAY = packed struct { MaxCount: u32, AddrCount: u32, Tag: u32, Family: u16, WordReserved: u16, Flags: u32, MatchFlag: u32, Reserved1: u32, Reserved2: u32, AddrArray: [1]DNS_ADDR, }; pub const DNS_HEADER = packed struct { Xid: u16, _bitfield1: u8, _bitfield2: u8, QuestionCount: u16, AnswerCount: u16, NameServerCount: u16, AdditionalCount: u16, }; pub const DNS_HEADER_EXT = packed struct { _bitfield: u16, chRcode: u8, chVersion: u8, }; pub const DNS_WIRE_QUESTION = packed struct { QuestionType: u16, QuestionClass: u16, }; pub const DNS_WIRE_RECORD = packed struct { RecordType: u16, RecordClass: u16, TimeToLive: u32, DataLength: u16, }; pub const DNS_CONFIG_TYPE = enum(i32) { PrimaryDomainName_W = 0, PrimaryDomainName_A = 1, PrimaryDomainName_UTF8 = 2, AdapterDomainName_W = 3, AdapterDomainName_A = 4, AdapterDomainName_UTF8 = 5, DnsServerList = 6, SearchList = 7, AdapterInfo = 8, PrimaryHostNameRegistrationEnabled = 9, AdapterHostNameRegistrationEnabled = 10, AddressRegistrationMaxCount = 11, HostName_W = 12, HostName_A = 13, HostName_UTF8 = 14, FullHostName_W = 15, FullHostName_A = 16, FullHostName_UTF8 = 17, NameServer = 18, }; pub const DnsConfigPrimaryDomainName_W = DNS_CONFIG_TYPE.PrimaryDomainName_W; pub const DnsConfigPrimaryDomainName_A = DNS_CONFIG_TYPE.PrimaryDomainName_A; pub const DnsConfigPrimaryDomainName_UTF8 = DNS_CONFIG_TYPE.PrimaryDomainName_UTF8; pub const DnsConfigAdapterDomainName_W = DNS_CONFIG_TYPE.AdapterDomainName_W; pub const DnsConfigAdapterDomainName_A = DNS_CONFIG_TYPE.AdapterDomainName_A; pub const DnsConfigAdapterDomainName_UTF8 = DNS_CONFIG_TYPE.AdapterDomainName_UTF8; pub const DnsConfigDnsServerList = DNS_CONFIG_TYPE.DnsServerList; pub const DnsConfigSearchList = DNS_CONFIG_TYPE.SearchList; pub const DnsConfigAdapterInfo = DNS_CONFIG_TYPE.AdapterInfo; pub const DnsConfigPrimaryHostNameRegistrationEnabled = DNS_CONFIG_TYPE.PrimaryHostNameRegistrationEnabled; pub const DnsConfigAdapterHostNameRegistrationEnabled = DNS_CONFIG_TYPE.AdapterHostNameRegistrationEnabled; pub const DnsConfigAddressRegistrationMaxCount = DNS_CONFIG_TYPE.AddressRegistrationMaxCount; pub const DnsConfigHostName_W = DNS_CONFIG_TYPE.HostName_W; pub const DnsConfigHostName_A = DNS_CONFIG_TYPE.HostName_A; pub const DnsConfigHostName_UTF8 = DNS_CONFIG_TYPE.HostName_UTF8; pub const DnsConfigFullHostName_W = DNS_CONFIG_TYPE.FullHostName_W; pub const DnsConfigFullHostName_A = DNS_CONFIG_TYPE.FullHostName_A; pub const DnsConfigFullHostName_UTF8 = DNS_CONFIG_TYPE.FullHostName_UTF8; pub const DnsConfigNameServer = DNS_CONFIG_TYPE.NameServer; pub const DNS_A_DATA = extern struct { IpAddress: u32, }; pub const DNS_PTR_DATAW = extern struct { pNameHost: ?PWSTR, }; pub const DNS_PTR_DATAA = extern struct { pNameHost: ?PSTR, }; pub const DNS_SOA_DATAW = extern struct { pNamePrimaryServer: ?PWSTR, pNameAdministrator: ?PWSTR, dwSerialNo: u32, dwRefresh: u32, dwRetry: u32, dwExpire: u32, dwDefaultTtl: u32, }; pub const DNS_SOA_DATAA = extern struct { pNamePrimaryServer: ?PSTR, pNameAdministrator: ?PSTR, dwSerialNo: u32, dwRefresh: u32, dwRetry: u32, dwExpire: u32, dwDefaultTtl: u32, }; pub const DNS_MINFO_DATAW = extern struct { pNameMailbox: ?PWSTR, pNameErrorsMailbox: ?PWSTR, }; pub const DNS_MINFO_DATAA = extern struct { pNameMailbox: ?PSTR, pNameErrorsMailbox: ?PSTR, }; pub const DNS_MX_DATAW = extern struct { pNameExchange: ?PWSTR, wPreference: u16, Pad: u16, }; pub const DNS_MX_DATAA = extern struct { pNameExchange: ?PSTR, wPreference: u16, Pad: u16, }; pub const DNS_TXT_DATAW = extern struct { dwStringCount: u32, pStringArray: [1]?PWSTR, }; pub const DNS_TXT_DATAA = extern struct { dwStringCount: u32, pStringArray: [1]?PSTR, }; pub const DNS_NULL_DATA = extern struct { dwByteCount: u32, Data: [1]u8, }; pub const DNS_WKS_DATA = extern struct { IpAddress: u32, chProtocol: u8, BitMask: [1]u8, }; pub const DNS_AAAA_DATA = extern struct { Ip6Address: IP6_ADDRESS, }; pub const DNS_SIG_DATAW = extern struct { wTypeCovered: u16, chAlgorithm: u8, chLabelCount: u8, dwOriginalTtl: u32, dwExpiration: u32, dwTimeSigned: u32, wKeyTag: u16, wSignatureLength: u16, pNameSigner: ?PWSTR, Signature: [1]u8, }; pub const DNS_SIG_DATAA = extern struct { wTypeCovered: u16, chAlgorithm: u8, chLabelCount: u8, dwOriginalTtl: u32, dwExpiration: u32, dwTimeSigned: u32, wKeyTag: u16, wSignatureLength: u16, pNameSigner: ?PSTR, Signature: [1]u8, }; pub const DNS_KEY_DATA = extern struct { wFlags: u16, chProtocol: u8, chAlgorithm: u8, wKeyLength: u16, wPad: u16, Key: [1]u8, }; pub const DNS_DHCID_DATA = extern struct { dwByteCount: u32, DHCID: [1]u8, }; pub const DNS_NSEC_DATAW = extern struct { pNextDomainName: ?PWSTR, wTypeBitMapsLength: u16, wPad: u16, TypeBitMaps: [1]u8, }; pub const DNS_NSEC_DATAA = extern struct { pNextDomainName: ?PSTR, wTypeBitMapsLength: u16, wPad: u16, TypeBitMaps: [1]u8, }; pub const DNS_NSEC3_DATA = extern struct { chAlgorithm: u8, bFlags: u8, wIterations: u16, bSaltLength: u8, bHashLength: u8, wTypeBitMapsLength: u16, chData: [1]u8, }; pub const DNS_NSEC3PARAM_DATA = extern struct { chAlgorithm: u8, bFlags: u8, wIterations: u16, bSaltLength: u8, bPad: [3]u8, pbSalt: [1]u8, }; pub const DNS_TLSA_DATA = extern struct { bCertUsage: u8, bSelector: u8, bMatchingType: u8, bCertificateAssociationDataLength: u16, bPad: [3]u8, bCertificateAssociationData: [1]u8, }; pub const DNS_DS_DATA = extern struct { wKeyTag: u16, chAlgorithm: u8, chDigestType: u8, wDigestLength: u16, wPad: u16, Digest: [1]u8, }; pub const DNS_OPT_DATA = extern struct { wDataLength: u16, wPad: u16, Data: [1]u8, }; pub const DNS_LOC_DATA = extern struct { wVersion: u16, wSize: u16, wHorPrec: u16, wVerPrec: u16, dwLatitude: u32, dwLongitude: u32, dwAltitude: u32, }; pub const DNS_NXT_DATAW = extern struct { pNameNext: ?PWSTR, wNumTypes: u16, wTypes: [1]u16, }; pub const DNS_NXT_DATAA = extern struct { pNameNext: ?PSTR, wNumTypes: u16, wTypes: [1]u16, }; pub const DNS_SRV_DATAW = extern struct { pNameTarget: ?PWSTR, wPriority: u16, wWeight: u16, wPort: u16, Pad: u16, }; pub const DNS_SRV_DATAA = extern struct { pNameTarget: ?PSTR, wPriority: u16, wWeight: u16, wPort: u16, Pad: u16, }; pub const DNS_NAPTR_DATAW = extern struct { wOrder: u16, wPreference: u16, pFlags: ?PWSTR, pService: ?PWSTR, pRegularExpression: ?PWSTR, pReplacement: ?PWSTR, }; pub const DNS_NAPTR_DATAA = extern struct { wOrder: u16, wPreference: u16, pFlags: ?PSTR, pService: ?PSTR, pRegularExpression: ?PSTR, pReplacement: ?PSTR, }; pub const DNS_ATMA_DATA = extern struct { AddressType: u8, Address: [20]u8, }; pub const DNS_TKEY_DATAW = extern struct { pNameAlgorithm: ?PWSTR, pAlgorithmPacket: ?*u8, pKey: ?*u8, pOtherData: ?*u8, dwCreateTime: u32, dwExpireTime: u32, wMode: u16, wError: u16, wKeyLength: u16, wOtherLength: u16, cAlgNameLength: u8, bPacketPointers: BOOL, }; pub const DNS_TKEY_DATAA = extern struct { pNameAlgorithm: ?PSTR, pAlgorithmPacket: ?*u8, pKey: ?*u8, pOtherData: ?*u8, dwCreateTime: u32, dwExpireTime: u32, wMode: u16, wError: u16, wKeyLength: u16, wOtherLength: u16, cAlgNameLength: u8, bPacketPointers: BOOL, }; pub const DNS_TSIG_DATAW = extern struct { pNameAlgorithm: ?PWSTR, pAlgorithmPacket: ?*u8, pSignature: ?*u8, pOtherData: ?*u8, i64CreateTime: i64, wFudgeTime: u16, wOriginalXid: u16, wError: u16, wSigLength: u16, wOtherLength: u16, cAlgNameLength: u8, bPacketPointers: BOOL, }; pub const DNS_TSIG_DATAA = extern struct { pNameAlgorithm: ?PSTR, pAlgorithmPacket: ?*u8, pSignature: ?*u8, pOtherData: ?*u8, i64CreateTime: i64, wFudgeTime: u16, wOriginalXid: u16, wError: u16, wSigLength: u16, wOtherLength: u16, cAlgNameLength: u8, bPacketPointers: BOOL, }; pub const DNS_UNKNOWN_DATA = extern struct { dwByteCount: u32, bData: [1]u8, }; pub const DNS_WINS_DATA = extern struct { dwMappingFlag: u32, dwLookupTimeout: u32, dwCacheTimeout: u32, cWinsServerCount: u32, WinsServers: [1]u32, }; pub const DNS_WINSR_DATAW = extern struct { dwMappingFlag: u32, dwLookupTimeout: u32, dwCacheTimeout: u32, pNameResultDomain: ?PWSTR, }; pub const DNS_WINSR_DATAA = extern struct { dwMappingFlag: u32, dwLookupTimeout: u32, dwCacheTimeout: u32, pNameResultDomain: ?PSTR, }; pub const DNS_RECORD_FLAGS = extern struct { _bitfield: u32, }; pub const DNS_SECTION = enum(i32) { Question = 0, Answer = 1, Authority = 2, Addtional = 3, }; pub const DnsSectionQuestion = DNS_SECTION.Question; pub const DnsSectionAnswer = DNS_SECTION.Answer; pub const DnsSectionAuthority = DNS_SECTION.Authority; pub const DnsSectionAddtional = DNS_SECTION.Addtional; pub const DNS_RECORDW = extern struct { pNext: ?*DNS_RECORDW, pName: ?PWSTR, wType: u16, wDataLength: u16, Flags: extern union { DW: u32, S: DNS_RECORD_FLAGS, }, dwTtl: u32, dwReserved: u32, Data: extern union { A: DNS_A_DATA, SOA: DNS_SOA_DATAW, Soa: DNS_SOA_DATAW, PTR: DNS_PTR_DATAW, Ptr: DNS_PTR_DATAW, NS: DNS_PTR_DATAW, Ns: DNS_PTR_DATAW, CNAME: DNS_PTR_DATAW, Cname: DNS_PTR_DATAW, DNAME: DNS_PTR_DATAW, Dname: DNS_PTR_DATAW, MB: DNS_PTR_DATAW, Mb: DNS_PTR_DATAW, MD: DNS_PTR_DATAW, Md: DNS_PTR_DATAW, MF: DNS_PTR_DATAW, Mf: DNS_PTR_DATAW, MG: DNS_PTR_DATAW, Mg: DNS_PTR_DATAW, MR: DNS_PTR_DATAW, Mr: DNS_PTR_DATAW, MINFO: DNS_MINFO_DATAW, Minfo: DNS_MINFO_DATAW, RP: DNS_MINFO_DATAW, Rp: DNS_MINFO_DATAW, MX: DNS_MX_DATAW, Mx: DNS_MX_DATAW, AFSDB: DNS_MX_DATAW, Afsdb: DNS_MX_DATAW, RT: DNS_MX_DATAW, Rt: DNS_MX_DATAW, HINFO: DNS_TXT_DATAW, Hinfo: DNS_TXT_DATAW, ISDN: DNS_TXT_DATAW, Isdn: DNS_TXT_DATAW, TXT: DNS_TXT_DATAW, Txt: DNS_TXT_DATAW, X25: DNS_TXT_DATAW, Null: DNS_NULL_DATA, WKS: DNS_WKS_DATA, Wks: DNS_WKS_DATA, AAAA: DNS_AAAA_DATA, KEY: DNS_KEY_DATA, Key: DNS_KEY_DATA, SIG: DNS_SIG_DATAW, Sig: DNS_SIG_DATAW, ATMA: DNS_ATMA_DATA, Atma: DNS_ATMA_DATA, NXT: DNS_NXT_DATAW, Nxt: DNS_NXT_DATAW, SRV: DNS_SRV_DATAW, Srv: DNS_SRV_DATAW, NAPTR: DNS_NAPTR_DATAW, Naptr: DNS_NAPTR_DATAW, OPT: DNS_OPT_DATA, Opt: DNS_OPT_DATA, DS: DNS_DS_DATA, Ds: DNS_DS_DATA, RRSIG: DNS_SIG_DATAW, Rrsig: DNS_SIG_DATAW, NSEC: DNS_NSEC_DATAW, Nsec: DNS_NSEC_DATAW, DNSKEY: DNS_KEY_DATA, Dnskey: DNS_KEY_DATA, TKEY: DNS_TKEY_DATAW, Tkey: DNS_TKEY_DATAW, TSIG: DNS_TSIG_DATAW, Tsig: DNS_TSIG_DATAW, WINS: DNS_WINS_DATA, Wins: DNS_WINS_DATA, WINSR: DNS_WINSR_DATAW, WinsR: DNS_WINSR_DATAW, NBSTAT: DNS_WINSR_DATAW, Nbstat: DNS_WINSR_DATAW, DHCID: DNS_DHCID_DATA, NSEC3: DNS_NSEC3_DATA, Nsec3: DNS_NSEC3_DATA, NSEC3PARAM: DNS_NSEC3PARAM_DATA, Nsec3Param: DNS_NSEC3PARAM_DATA, TLSA: DNS_TLSA_DATA, Tlsa: DNS_TLSA_DATA, UNKNOWN: DNS_UNKNOWN_DATA, Unknown: DNS_UNKNOWN_DATA, pDataPtr: ?*u8, }, }; pub const _DnsRecordOptW = extern struct { pNext: ?*DNS_RECORDW, pName: ?PWSTR, wType: u16, wDataLength: u16, Flags: extern union { DW: u32, S: DNS_RECORD_FLAGS, }, ExtHeader: DNS_HEADER_EXT, wPayloadSize: u16, wReserved: u16, Data: extern union { OPT: DNS_OPT_DATA, Opt: DNS_OPT_DATA, }, }; pub const DNS_RECORDA = extern struct { pNext: ?*DNS_RECORDA, pName: ?PSTR, wType: u16, wDataLength: u16, Flags: extern union { DW: u32, S: DNS_RECORD_FLAGS, }, dwTtl: u32, dwReserved: u32, Data: extern union { A: DNS_A_DATA, SOA: DNS_SOA_DATAA, Soa: DNS_SOA_DATAA, PTR: DNS_PTR_DATAA, Ptr: DNS_PTR_DATAA, NS: DNS_PTR_DATAA, Ns: DNS_PTR_DATAA, CNAME: DNS_PTR_DATAA, Cname: DNS_PTR_DATAA, DNAME: DNS_PTR_DATAA, Dname: DNS_PTR_DATAA, MB: DNS_PTR_DATAA, Mb: DNS_PTR_DATAA, MD: DNS_PTR_DATAA, Md: DNS_PTR_DATAA, MF: DNS_PTR_DATAA, Mf: DNS_PTR_DATAA, MG: DNS_PTR_DATAA, Mg: DNS_PTR_DATAA, MR: DNS_PTR_DATAA, Mr: DNS_PTR_DATAA, MINFO: DNS_MINFO_DATAA, Minfo: DNS_MINFO_DATAA, RP: DNS_MINFO_DATAA, Rp: DNS_MINFO_DATAA, MX: DNS_MX_DATAA, Mx: DNS_MX_DATAA, AFSDB: DNS_MX_DATAA, Afsdb: DNS_MX_DATAA, RT: DNS_MX_DATAA, Rt: DNS_MX_DATAA, HINFO: DNS_TXT_DATAA, Hinfo: DNS_TXT_DATAA, ISDN: DNS_TXT_DATAA, Isdn: DNS_TXT_DATAA, TXT: DNS_TXT_DATAA, Txt: DNS_TXT_DATAA, X25: DNS_TXT_DATAA, Null: DNS_NULL_DATA, WKS: DNS_WKS_DATA, Wks: DNS_WKS_DATA, AAAA: DNS_AAAA_DATA, KEY: DNS_KEY_DATA, Key: DNS_KEY_DATA, SIG: DNS_SIG_DATAA, Sig: DNS_SIG_DATAA, ATMA: DNS_ATMA_DATA, Atma: DNS_ATMA_DATA, NXT: DNS_NXT_DATAA, Nxt: DNS_NXT_DATAA, SRV: DNS_SRV_DATAA, Srv: DNS_SRV_DATAA, NAPTR: DNS_NAPTR_DATAA, Naptr: DNS_NAPTR_DATAA, OPT: DNS_OPT_DATA, Opt: DNS_OPT_DATA, DS: DNS_DS_DATA, Ds: DNS_DS_DATA, RRSIG: DNS_SIG_DATAA, Rrsig: DNS_SIG_DATAA, NSEC: DNS_NSEC_DATAA, Nsec: DNS_NSEC_DATAA, DNSKEY: DNS_KEY_DATA, Dnskey: DNS_KEY_DATA, TKEY: DNS_TKEY_DATAA, Tkey: DNS_TKEY_DATAA, TSIG: DNS_TSIG_DATAA, Tsig: DNS_TSIG_DATAA, WINS: DNS_WINS_DATA, Wins: DNS_WINS_DATA, WINSR: DNS_WINSR_DATAA, WinsR: DNS_WINSR_DATAA, NBSTAT: DNS_WINSR_DATAA, Nbstat: DNS_WINSR_DATAA, DHCID: DNS_DHCID_DATA, NSEC3: DNS_NSEC3_DATA, Nsec3: DNS_NSEC3_DATA, NSEC3PARAM: DNS_NSEC3PARAM_DATA, Nsec3Param: DNS_NSEC3PARAM_DATA, TLSA: DNS_TLSA_DATA, Tlsa: DNS_TLSA_DATA, UNKNOWN: DNS_UNKNOWN_DATA, Unknown: DNS_UNKNOWN_DATA, pDataPtr: ?*u8, }, }; pub const _DnsRecordOptA = extern struct { pNext: ?*DNS_RECORDA, pName: ?PSTR, wType: u16, wDataLength: u16, Flags: extern union { DW: u32, S: DNS_RECORD_FLAGS, }, ExtHeader: DNS_HEADER_EXT, wPayloadSize: u16, wReserved: u16, Data: extern union { OPT: DNS_OPT_DATA, Opt: DNS_OPT_DATA, }, }; pub const DNS_RRSET = extern struct { pFirstRR: ?*DNS_RECORDA, pLastRR: ?*DNS_RECORDA, }; pub const DNS_PROXY_COMPLETION_ROUTINE = fn( completionContext: ?*anyopaque, status: i32, ) callconv(@import("std").os.windows.WINAPI) void; pub const DNS_PROXY_INFORMATION_TYPE = enum(i32) { DIRECT = 0, DEFAULT_SETTINGS = 1, PROXY_NAME = 2, DOES_NOT_EXIST = 3, }; pub const DNS_PROXY_INFORMATION_DIRECT = DNS_PROXY_INFORMATION_TYPE.DIRECT; pub const DNS_PROXY_INFORMATION_DEFAULT_SETTINGS = DNS_PROXY_INFORMATION_TYPE.DEFAULT_SETTINGS; pub const DNS_PROXY_INFORMATION_PROXY_NAME = DNS_PROXY_INFORMATION_TYPE.PROXY_NAME; pub const DNS_PROXY_INFORMATION_DOES_NOT_EXIST = DNS_PROXY_INFORMATION_TYPE.DOES_NOT_EXIST; pub const DNS_PROXY_INFORMATION = extern struct { version: u32, proxyInformationType: DNS_PROXY_INFORMATION_TYPE, proxyName: ?PWSTR, }; pub const DNS_CHARSET = enum(i32) { Unknown = 0, Unicode = 1, Utf8 = 2, Ansi = 3, }; pub const DnsCharSetUnknown = DNS_CHARSET.Unknown; pub const DnsCharSetUnicode = DNS_CHARSET.Unicode; pub const DnsCharSetUtf8 = DNS_CHARSET.Utf8; pub const DnsCharSetAnsi = DNS_CHARSET.Ansi; pub const DNS_FREE_TYPE = enum(i32) { Flat = 0, RecordList = 1, ParsedMessageFields = 2, }; pub const DnsFreeFlat = DNS_FREE_TYPE.Flat; pub const DnsFreeRecordList = DNS_FREE_TYPE.RecordList; pub const DnsFreeParsedMessageFields = DNS_FREE_TYPE.ParsedMessageFields; pub const DNS_QUERY_RESULT = extern struct { Version: u32, QueryStatus: i32, QueryOptions: u64, pQueryRecords: ?*DNS_RECORDA, Reserved: ?*anyopaque, }; pub const PDNS_QUERY_COMPLETION_ROUTINE = fn( pQueryContext: ?*anyopaque, pQueryResults: ?*DNS_QUERY_RESULT, ) callconv(@import("std").os.windows.WINAPI) void; pub const DNS_QUERY_REQUEST = extern struct { Version: u32, QueryName: ?[*:0]const u16, QueryType: u16, QueryOptions: u64, pDnsServerList: ?*DNS_ADDR_ARRAY, InterfaceIndex: u32, pQueryCompletionCallback: ?PDNS_QUERY_COMPLETION_ROUTINE, pQueryContext: ?*anyopaque, }; pub const DNS_QUERY_CANCEL = extern struct { Reserved: [32]CHAR, }; pub const DNS_CUSTOM_SERVER = extern struct { dwServerType: u32, ullFlags: u64, Anonymous1: extern union { pwszTemplate: ?PWSTR, }, Anonymous2: extern union { MaxSa: [32]CHAR, }, }; pub const DNS_QUERY_REQUEST3 = extern struct { Version: u32, QueryName: ?[*:0]const u16, QueryType: u16, QueryOptions: u64, pDnsServerList: ?*DNS_ADDR_ARRAY, InterfaceIndex: u32, pQueryCompletionCallback: ?PDNS_QUERY_COMPLETION_ROUTINE, pQueryContext: ?*anyopaque, IsNetworkQueryRequired: BOOL, RequiredNetworkIndex: u32, cCustomServers: u32, pCustomServers: ?*DNS_CUSTOM_SERVER, }; pub const DNS_APPLICATION_SETTINGS = extern struct { Version: u32, Flags: u64, }; pub const DNS_NAME_FORMAT = enum(i32) { Domain = 0, DomainLabel = 1, HostnameFull = 2, HostnameLabel = 3, Wildcard = 4, SrvRecord = 5, ValidateTld = 6, }; pub const DnsNameDomain = DNS_NAME_FORMAT.Domain; pub const DnsNameDomainLabel = DNS_NAME_FORMAT.DomainLabel; pub const DnsNameHostnameFull = DNS_NAME_FORMAT.HostnameFull; pub const DnsNameHostnameLabel = DNS_NAME_FORMAT.HostnameLabel; pub const DnsNameWildcard = DNS_NAME_FORMAT.Wildcard; pub const DnsNameSrvRecord = DNS_NAME_FORMAT.SrvRecord; pub const DnsNameValidateTld = DNS_NAME_FORMAT.ValidateTld; pub const DNS_MESSAGE_BUFFER = extern struct { MessageHead: DNS_HEADER, MessageBody: [1]CHAR, }; pub const DNS_CONNECTION_PROXY_TYPE = enum(i32) { NULL = 0, HTTP = 1, WAP = 2, SOCKS4 = 4, SOCKS5 = 5, }; pub const DNS_CONNECTION_PROXY_TYPE_NULL = DNS_CONNECTION_PROXY_TYPE.NULL; pub const DNS_CONNECTION_PROXY_TYPE_HTTP = DNS_CONNECTION_PROXY_TYPE.HTTP; pub const DNS_CONNECTION_PROXY_TYPE_WAP = DNS_CONNECTION_PROXY_TYPE.WAP; pub const DNS_CONNECTION_PROXY_TYPE_SOCKS4 = DNS_CONNECTION_PROXY_TYPE.SOCKS4; pub const DNS_CONNECTION_PROXY_TYPE_SOCKS5 = DNS_CONNECTION_PROXY_TYPE.SOCKS5; pub const DNS_CONNECTION_PROXY_INFO_SWITCH = enum(i32) { CONFIG = 0, SCRIPT = 1, WPAD = 2, }; pub const DNS_CONNECTION_PROXY_INFO_SWITCH_CONFIG = DNS_CONNECTION_PROXY_INFO_SWITCH.CONFIG; pub const DNS_CONNECTION_PROXY_INFO_SWITCH_SCRIPT = DNS_CONNECTION_PROXY_INFO_SWITCH.SCRIPT; pub const DNS_CONNECTION_PROXY_INFO_SWITCH_WPAD = DNS_CONNECTION_PROXY_INFO_SWITCH.WPAD; pub const DNS_CONNECTION_PROXY_INFO = extern struct { Version: u32, pwszFriendlyName: ?PWSTR, Flags: u32, Switch: DNS_CONNECTION_PROXY_INFO_SWITCH, Anonymous: extern union { pub const _DNS_CONNECTION_PROXY_INFO_SCRIPT = extern struct { pwszScript: ?PWSTR, pwszUsername: ?PWSTR, pwszPassword: ?PWSTR, }; pub const _DNS_CONNECTION_PROXY_INFO_CONFIG = extern struct { pwszServer: ?PWSTR, pwszUsername: ?PWSTR, pwszPassword: ?PWSTR, pwszException: ?PWSTR, pwszExtraInfo: ?PWSTR, Port: u16, }; Config: _DNS_CONNECTION_PROXY_INFO_CONFIG, Script: _DNS_CONNECTION_PROXY_INFO_SCRIPT, }, }; pub const DNS_CONNECTION_PROXY_INFO_EX = extern struct { ProxyInfo: DNS_CONNECTION_PROXY_INFO, dwInterfaceIndex: u32, pwszConnectionName: ?PWSTR, fDirectConfiguration: BOOL, hConnection: ?HANDLE, }; pub const DNS_CONNECTION_PROXY_ELEMENT = extern struct { Type: DNS_CONNECTION_PROXY_TYPE, Info: DNS_CONNECTION_PROXY_INFO, }; pub const DNS_CONNECTION_PROXY_LIST = extern struct { cProxies: u32, pProxies: ?*DNS_CONNECTION_PROXY_ELEMENT, }; pub const DNS_CONNECTION_NAME = extern struct { wszName: [65]u16, }; pub const DNS_CONNECTION_NAME_LIST = extern struct { cNames: u32, pNames: ?*DNS_CONNECTION_NAME, }; pub const DNS_CONNECTION_IFINDEX_ENTRY = extern struct { pwszConnectionName: ?[*:0]const u16, dwIfIndex: u32, }; pub const DNS_CONNECTION_IFINDEX_LIST = extern struct { pConnectionIfIndexEntries: ?*DNS_CONNECTION_IFINDEX_ENTRY, nEntries: u32, }; pub const DNS_CONNECTION_POLICY_ENTRY = extern struct { pwszHost: ?[*:0]const u16, pwszAppId: ?[*:0]const u16, cbAppSid: u32, pbAppSid: ?*u8, nConnections: u32, ppwszConnections: ?*?PWSTR, dwPolicyEntryFlags: u32, }; pub const DNS_CONNECTION_POLICY_ENTRY_LIST = extern struct { pPolicyEntries: ?*DNS_CONNECTION_POLICY_ENTRY, nEntries: u32, }; pub const DNS_CONNECTION_POLICY_TAG = enum(i32) { DEFAULT = 0, CONNECTION_MANAGER = 1, WWWPT = 2, }; pub const TAG_DNS_CONNECTION_POLICY_TAG_DEFAULT = DNS_CONNECTION_POLICY_TAG.DEFAULT; pub const TAG_DNS_CONNECTION_POLICY_TAG_CONNECTION_MANAGER = DNS_CONNECTION_POLICY_TAG.CONNECTION_MANAGER; pub const TAG_DNS_CONNECTION_POLICY_TAG_WWWPT = DNS_CONNECTION_POLICY_TAG.WWWPT; pub const DNS_SERVICE_INSTANCE = extern struct { pszInstanceName: ?PWSTR, pszHostName: ?PWSTR, ip4Address: ?*u32, ip6Address: ?*IP6_ADDRESS, wPort: u16, wPriority: u16, wWeight: u16, dwPropertyCount: u32, keys: ?*?PWSTR, values: ?*?PWSTR, dwInterfaceIndex: u32, }; pub const DNS_SERVICE_CANCEL = extern struct { reserved: ?*anyopaque, }; pub const PDNS_SERVICE_BROWSE_CALLBACK = fn( Status: u32, pQueryContext: ?*anyopaque, pDnsRecord: ?*DNS_RECORDA, ) callconv(@import("std").os.windows.WINAPI) void; pub const DNS_SERVICE_BROWSE_REQUEST = extern struct { Version: u32, InterfaceIndex: u32, QueryName: ?[*:0]const u16, Anonymous: extern union { pBrowseCallback: ?PDNS_SERVICE_BROWSE_CALLBACK, pBrowseCallbackV2: ?PDNS_QUERY_COMPLETION_ROUTINE, }, pQueryContext: ?*anyopaque, }; pub const PDNS_SERVICE_RESOLVE_COMPLETE = fn( Status: u32, pQueryContext: ?*anyopaque, pInstance: ?*DNS_SERVICE_INSTANCE, ) callconv(@import("std").os.windows.WINAPI) void; pub const DNS_SERVICE_RESOLVE_REQUEST = extern struct { Version: u32, InterfaceIndex: u32, QueryName: ?PWSTR, pResolveCompletionCallback: ?PDNS_SERVICE_RESOLVE_COMPLETE, pQueryContext: ?*anyopaque, }; pub const PDNS_SERVICE_REGISTER_COMPLETE = fn( Status: u32, pQueryContext: ?*anyopaque, pInstance: ?*DNS_SERVICE_INSTANCE, ) callconv(@import("std").os.windows.WINAPI) void; pub const DNS_SERVICE_REGISTER_REQUEST = extern struct { Version: u32, InterfaceIndex: u32, pServiceInstance: ?*DNS_SERVICE_INSTANCE, pRegisterCompletionCallback: ?PDNS_SERVICE_REGISTER_COMPLETE, pQueryContext: ?*anyopaque, hCredentials: ?HANDLE, unicastEnabled: BOOL, }; pub const MDNS_QUERY_HANDLE = extern struct { nameBuf: [256]u16, wType: u16, pSubscription: ?*anyopaque, pWnfCallbackParams: ?*anyopaque, stateNameData: [2]u32, }; pub const PMDNS_QUERY_CALLBACK = fn( pQueryContext: ?*anyopaque, pQueryHandle: ?*MDNS_QUERY_HANDLE, pQueryResults: ?*DNS_QUERY_RESULT, ) callconv(@import("std").os.windows.WINAPI) void; pub const MDNS_QUERY_REQUEST = extern struct { Version: u32, ulRefCount: u32, Query: ?[*:0]const u16, QueryType: u16, QueryOptions: u64, InterfaceIndex: u32, pQueryCallback: ?PMDNS_QUERY_CALLBACK, pQueryContext: ?*anyopaque, fAnswerReceived: BOOL, ulResendCount: u32, }; pub const IP6_ADDRESS = switch(@import("../zig.zig").arch) { .X64, .Arm64 => extern union { IP6Qword: [2]u64, IP6Dword: [4]u32, IP6Word: [8]u16, IP6Byte: [16]u8, }, .X86 => extern union { IP6Dword: [4]u32, IP6Word: [8]u16, IP6Byte: [16]u8, }, }; //-------------------------------------------------------------------------------- // Section: Functions (60) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsQueryConfig( Config: DNS_CONFIG_TYPE, Flag: u32, pwsAdapterName: ?[*:0]const u16, pReserved: ?*anyopaque, // TODO: what to do with BytesParamIndex 5? pBuffer: ?*anyopaque, pBufLen: ?*u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsRecordCopyEx( pRecord: ?*DNS_RECORDA, CharSetIn: DNS_CHARSET, CharSetOut: DNS_CHARSET, ) callconv(@import("std").os.windows.WINAPI) ?*DNS_RECORDA; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsRecordSetCopyEx( pRecordSet: ?*DNS_RECORDA, CharSetIn: DNS_CHARSET, CharSetOut: DNS_CHARSET, ) callconv(@import("std").os.windows.WINAPI) ?*DNS_RECORDA; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsRecordCompare( pRecord1: ?*DNS_RECORDA, pRecord2: ?*DNS_RECORDA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsRecordSetCompare( pRR1: ?*DNS_RECORDA, pRR2: ?*DNS_RECORDA, ppDiff1: ?*?*DNS_RECORDA, ppDiff2: ?*?*DNS_RECORDA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsRecordSetDetach( pRecordList: ?*DNS_RECORDA, ) callconv(@import("std").os.windows.WINAPI) ?*DNS_RECORDA; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "DNSAPI" fn DnsFree( pData: ?*anyopaque, FreeType: DNS_FREE_TYPE, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsQuery_A( pszName: ?[*:0]const u8, wType: u16, Options: u32, pExtra: ?*anyopaque, ppQueryResults: ?*?*DNS_RECORDA, pReserved: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsQuery_UTF8( pszName: ?[*:0]const u8, wType: u16, Options: u32, pExtra: ?*anyopaque, ppQueryResults: ?*?*DNS_RECORDA, pReserved: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsQuery_W( pszName: ?[*:0]const u16, wType: u16, Options: u32, pExtra: ?*anyopaque, ppQueryResults: ?*?*DNS_RECORDA, pReserved: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.0' pub extern "DNSAPI" fn DnsQueryEx( pQueryRequest: ?*DNS_QUERY_REQUEST, pQueryResults: ?*DNS_QUERY_RESULT, pCancelHandle: ?*DNS_QUERY_CANCEL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows8.0' pub extern "DNSAPI" fn DnsCancelQuery( pCancelHandle: ?*DNS_QUERY_CANCEL, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "DNSAPI" fn DnsFreeCustomServers( pcServers: ?*u32, ppServers: ?*?*DNS_CUSTOM_SERVER, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "DNSAPI" fn DnsGetApplicationSettings( pcServers: ?*u32, ppDefaultServers: ?*?*DNS_CUSTOM_SERVER, pSettings: ?*DNS_APPLICATION_SETTINGS, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsSetApplicationSettings( cServers: u32, pServers: [*]const DNS_CUSTOM_SERVER, pSettings: ?*const DNS_APPLICATION_SETTINGS, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsAcquireContextHandle_W( CredentialFlags: u32, Credentials: ?*anyopaque, pContext: ?*DnsContextHandle, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsAcquireContextHandle_A( CredentialFlags: u32, Credentials: ?*anyopaque, pContext: ?*DnsContextHandle, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsReleaseContextHandle( hContext: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsModifyRecordsInSet_W( pAddRecords: ?*DNS_RECORDA, pDeleteRecords: ?*DNS_RECORDA, Options: u32, hCredentials: ?HANDLE, pExtraList: ?*anyopaque, pReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsModifyRecordsInSet_A( pAddRecords: ?*DNS_RECORDA, pDeleteRecords: ?*DNS_RECORDA, Options: u32, hCredentials: ?HANDLE, pExtraList: ?*anyopaque, pReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsModifyRecordsInSet_UTF8( pAddRecords: ?*DNS_RECORDA, pDeleteRecords: ?*DNS_RECORDA, Options: u32, hCredentials: ?HANDLE, pExtraList: ?*anyopaque, pReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsReplaceRecordSetW( pReplaceSet: ?*DNS_RECORDA, Options: u32, hContext: ?HANDLE, pExtraInfo: ?*anyopaque, pReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsReplaceRecordSetA( pReplaceSet: ?*DNS_RECORDA, Options: u32, hContext: ?HANDLE, pExtraInfo: ?*anyopaque, pReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsReplaceRecordSetUTF8( pReplaceSet: ?*DNS_RECORDA, Options: u32, hContext: ?HANDLE, pExtraInfo: ?*anyopaque, pReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsValidateName_W( pszName: ?[*:0]const u16, Format: DNS_NAME_FORMAT, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsValidateName_A( pszName: ?[*:0]const u8, Format: DNS_NAME_FORMAT, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsValidateName_UTF8( pszName: ?[*:0]const u8, Format: DNS_NAME_FORMAT, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsNameCompare_A( pName1: ?[*:0]const u8, pName2: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsNameCompare_W( pName1: ?[*:0]const u16, pName2: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsWriteQuestionToBuffer_W( pDnsBuffer: ?*DNS_MESSAGE_BUFFER, pdwBufferSize: ?*u32, pszName: ?[*:0]const u16, wType: u16, Xid: u16, fRecursionDesired: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsWriteQuestionToBuffer_UTF8( pDnsBuffer: ?*DNS_MESSAGE_BUFFER, pdwBufferSize: ?*u32, pszName: ?[*:0]const u8, wType: u16, Xid: u16, fRecursionDesired: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsExtractRecordsFromMessage_W( pDnsBuffer: ?*DNS_MESSAGE_BUFFER, wMessageLength: u16, ppRecord: ?*?*DNS_RECORDA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "DNSAPI" fn DnsExtractRecordsFromMessage_UTF8( pDnsBuffer: ?*DNS_MESSAGE_BUFFER, wMessageLength: u16, ppRecord: ?*?*DNS_RECORDA, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows6.1' pub extern "DNSAPI" fn DnsGetProxyInformation( hostName: ?[*:0]const u16, proxyInformation: ?*DNS_PROXY_INFORMATION, defaultProxyInformation: ?*DNS_PROXY_INFORMATION, completionRoutine: ?DNS_PROXY_COMPLETION_ROUTINE, completionContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows6.1' pub extern "DNSAPI" fn DnsFreeProxyName( proxyName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "DNSAPI" fn DnsConnectionGetProxyInfoForHostUrl( pwszHostUrl: ?[*:0]const u16, pSelectionContext: ?[*:0]u8, dwSelectionContextLength: u32, dwExplicitInterfaceIndex: u32, pProxyInfoEx: ?*DNS_CONNECTION_PROXY_INFO_EX, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionFreeProxyInfoEx( pProxyInfoEx: ?*DNS_CONNECTION_PROXY_INFO_EX, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "DNSAPI" fn DnsConnectionGetProxyInfo( pwszConnectionName: ?[*:0]const u16, Type: DNS_CONNECTION_PROXY_TYPE, pProxyInfo: ?*DNS_CONNECTION_PROXY_INFO, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionFreeProxyInfo( pProxyInfo: ?*DNS_CONNECTION_PROXY_INFO, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "DNSAPI" fn DnsConnectionSetProxyInfo( pwszConnectionName: ?[*:0]const u16, Type: DNS_CONNECTION_PROXY_TYPE, pProxyInfo: ?*const DNS_CONNECTION_PROXY_INFO, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionDeleteProxyInfo( pwszConnectionName: ?[*:0]const u16, Type: DNS_CONNECTION_PROXY_TYPE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionGetProxyList( pwszConnectionName: ?[*:0]const u16, pProxyList: ?*DNS_CONNECTION_PROXY_LIST, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionFreeProxyList( pProxyList: ?*DNS_CONNECTION_PROXY_LIST, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "DNSAPI" fn DnsConnectionGetNameList( pNameList: ?*DNS_CONNECTION_NAME_LIST, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionFreeNameList( pNameList: ?*DNS_CONNECTION_NAME_LIST, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "DNSAPI" fn DnsConnectionUpdateIfIndexTable( pConnectionIfIndexEntries: ?*DNS_CONNECTION_IFINDEX_LIST, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionSetPolicyEntries( PolicyEntryTag: DNS_CONNECTION_POLICY_TAG, pPolicyEntryList: ?*DNS_CONNECTION_POLICY_ENTRY_LIST, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "DNSAPI" fn DnsConnectionDeletePolicyEntries( PolicyEntryTag: DNS_CONNECTION_POLICY_TAG, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceConstructInstance( pServiceName: ?[*:0]const u16, pHostName: ?[*:0]const u16, pIp4: ?*u32, pIp6: ?*IP6_ADDRESS, wPort: u16, wPriority: u16, wWeight: u16, dwPropertiesCount: u32, keys: [*]?PWSTR, values: [*]?PWSTR, ) callconv(@import("std").os.windows.WINAPI) ?*DNS_SERVICE_INSTANCE; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceCopyInstance( pOrig: ?*DNS_SERVICE_INSTANCE, ) callconv(@import("std").os.windows.WINAPI) ?*DNS_SERVICE_INSTANCE; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceFreeInstance( pInstance: ?*DNS_SERVICE_INSTANCE, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceBrowse( pRequest: ?*DNS_SERVICE_BROWSE_REQUEST, pCancel: ?*DNS_SERVICE_CANCEL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceBrowseCancel( pCancelHandle: ?*DNS_SERVICE_CANCEL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceResolve( pRequest: ?*DNS_SERVICE_RESOLVE_REQUEST, pCancel: ?*DNS_SERVICE_CANCEL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceResolveCancel( pCancelHandle: ?*DNS_SERVICE_CANCEL, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceRegister( pRequest: ?*DNS_SERVICE_REGISTER_REQUEST, pCancel: ?*DNS_SERVICE_CANCEL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceDeRegister( pRequest: ?*DNS_SERVICE_REGISTER_REQUEST, pCancel: ?*DNS_SERVICE_CANCEL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsServiceRegisterCancel( pCancelHandle: ?*DNS_SERVICE_CANCEL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsStartMulticastQuery( pQueryRequest: ?*MDNS_QUERY_REQUEST, pHandle: ?*MDNS_QUERY_HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DNSAPI" fn DnsStopMulticastQuery( pHandle: ?*MDNS_QUERY_HANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (21) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const DNS_PTR_DATA = thismodule.DNS_PTR_DATAA; pub const DNS_SOA_DATA = thismodule.DNS_SOA_DATAA; pub const DNS_MINFO_DATA = thismodule.DNS_MINFO_DATAA; pub const DNS_MX_DATA = thismodule.DNS_MX_DATAA; pub const DNS_TXT_DATA = thismodule.DNS_TXT_DATAA; pub const DNS_SIG_DATA = thismodule.DNS_SIG_DATAA; pub const DNS_NSEC_DATA = thismodule.DNS_NSEC_DATAA; pub const DNS_NXT_DATA = thismodule.DNS_NXT_DATAA; pub const DNS_SRV_DATA = thismodule.DNS_SRV_DATAA; pub const DNS_NAPTR_DATA = thismodule.DNS_NAPTR_DATAA; pub const DNS_TKEY_DATA = thismodule.DNS_TKEY_DATAA; pub const DNS_TSIG_DATA = thismodule.DNS_TSIG_DATAA; pub const DNS_WINSR_DATA = thismodule.DNS_WINSR_DATAA; pub const DNS_RECORD = thismodule.DNS_RECORDA; pub const _DnsRecordOpt = thismodule._DnsRecordOptA; pub const DnsQuery_ = thismodule.DnsQuery_A; pub const DnsAcquireContextHandle_ = thismodule.DnsAcquireContextHandle_A; pub const DnsModifyRecordsInSet_ = thismodule.DnsModifyRecordsInSet_A; pub const DnsReplaceRecordSet = thismodule.DnsReplaceRecordSetA; pub const DnsValidateName_ = thismodule.DnsValidateName_A; pub const DnsNameCompare_ = thismodule.DnsNameCompare_A; }, .wide => struct { pub const DNS_PTR_DATA = thismodule.DNS_PTR_DATAW; pub const DNS_SOA_DATA = thismodule.DNS_SOA_DATAW; pub const DNS_MINFO_DATA = thismodule.DNS_MINFO_DATAW; pub const DNS_MX_DATA = thismodule.DNS_MX_DATAW; pub const DNS_TXT_DATA = thismodule.DNS_TXT_DATAW; pub const DNS_SIG_DATA = thismodule.DNS_SIG_DATAW; pub const DNS_NSEC_DATA = thismodule.DNS_NSEC_DATAW; pub const DNS_NXT_DATA = thismodule.DNS_NXT_DATAW; pub const DNS_SRV_DATA = thismodule.DNS_SRV_DATAW; pub const DNS_NAPTR_DATA = thismodule.DNS_NAPTR_DATAW; pub const DNS_TKEY_DATA = thismodule.DNS_TKEY_DATAW; pub const DNS_TSIG_DATA = thismodule.DNS_TSIG_DATAW; pub const DNS_WINSR_DATA = thismodule.DNS_WINSR_DATAW; pub const DNS_RECORD = thismodule.DNS_RECORDW; pub const _DnsRecordOpt = thismodule._DnsRecordOptW; pub const DnsQuery_ = thismodule.DnsQuery_W; pub const DnsAcquireContextHandle_ = thismodule.DnsAcquireContextHandle_W; pub const DnsModifyRecordsInSet_ = thismodule.DnsModifyRecordsInSet_W; pub const DnsReplaceRecordSet = thismodule.DnsReplaceRecordSetW; pub const DnsValidateName_ = thismodule.DnsValidateName_W; pub const DnsNameCompare_ = thismodule.DnsNameCompare_W; }, .unspecified => if (@import("builtin").is_test) struct { pub const DNS_PTR_DATA = *opaque{}; pub const DNS_SOA_DATA = *opaque{}; pub const DNS_MINFO_DATA = *opaque{}; pub const DNS_MX_DATA = *opaque{}; pub const DNS_TXT_DATA = *opaque{}; pub const DNS_SIG_DATA = *opaque{}; pub const DNS_NSEC_DATA = *opaque{}; pub const DNS_NXT_DATA = *opaque{}; pub const DNS_SRV_DATA = *opaque{}; pub const DNS_NAPTR_DATA = *opaque{}; pub const DNS_TKEY_DATA = *opaque{}; pub const DNS_TSIG_DATA = *opaque{}; pub const DNS_WINSR_DATA = *opaque{}; pub const DNS_RECORD = *opaque{}; pub const _DnsRecordOpt = *opaque{}; pub const DnsQuery_ = *opaque{}; pub const DnsAcquireContextHandle_ = *opaque{}; pub const DnsModifyRecordsInSet_ = *opaque{}; pub const DnsReplaceRecordSet = *opaque{}; pub const DnsValidateName_ = *opaque{}; pub const DnsNameCompare_ = *opaque{}; } else struct { pub const DNS_PTR_DATA = @compileError("'DNS_PTR_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_SOA_DATA = @compileError("'DNS_SOA_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_MINFO_DATA = @compileError("'DNS_MINFO_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_MX_DATA = @compileError("'DNS_MX_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_TXT_DATA = @compileError("'DNS_TXT_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_SIG_DATA = @compileError("'DNS_SIG_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_NSEC_DATA = @compileError("'DNS_NSEC_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_NXT_DATA = @compileError("'DNS_NXT_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_SRV_DATA = @compileError("'DNS_SRV_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_NAPTR_DATA = @compileError("'DNS_NAPTR_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_TKEY_DATA = @compileError("'DNS_TKEY_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_TSIG_DATA = @compileError("'DNS_TSIG_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_WINSR_DATA = @compileError("'DNS_WINSR_DATA' requires that UNICODE be set to true or false in the root module"); pub const DNS_RECORD = @compileError("'DNS_RECORD' requires that UNICODE be set to true or false in the root module"); pub const _DnsRecordOpt = @compileError("'_DnsRecordOpt' requires that UNICODE be set to true or false in the root module"); pub const DnsQuery_ = @compileError("'DnsQuery_' requires that UNICODE be set to true or false in the root module"); pub const DnsAcquireContextHandle_ = @compileError("'DnsAcquireContextHandle_' requires that UNICODE be set to true or false in the root module"); pub const DnsModifyRecordsInSet_ = @compileError("'DnsModifyRecordsInSet_' requires that UNICODE be set to true or false in the root module"); pub const DnsReplaceRecordSet = @compileError("'DnsReplaceRecordSet' requires that UNICODE be set to true or false in the root module"); pub const DnsValidateName_ = @compileError("'DnsValidateName_' requires that UNICODE be set to true or false in the root module"); pub const DnsNameCompare_ = @compileError("'DnsNameCompare_' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (5) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const CHAR = @import("../foundation.zig").CHAR; const HANDLE = @import("../foundation.zig").HANDLE; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "DNS_PROXY_COMPLETION_ROUTINE")) { _ = DNS_PROXY_COMPLETION_ROUTINE; } if (@hasDecl(@This(), "PDNS_QUERY_COMPLETION_ROUTINE")) { _ = PDNS_QUERY_COMPLETION_ROUTINE; } if (@hasDecl(@This(), "PDNS_SERVICE_BROWSE_CALLBACK")) { _ = PDNS_SERVICE_BROWSE_CALLBACK; } if (@hasDecl(@This(), "PDNS_SERVICE_RESOLVE_COMPLETE")) { _ = PDNS_SERVICE_RESOLVE_COMPLETE; } if (@hasDecl(@This(), "PDNS_SERVICE_REGISTER_COMPLETE")) { _ = PDNS_SERVICE_REGISTER_COMPLETE; } if (@hasDecl(@This(), "PMDNS_QUERY_CALLBACK")) { _ = PMDNS_QUERY_CALLBACK; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/network_management/dns.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = false; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } const assert = std.debug.assert; pub const main = tools.defaultMain("2021/day18.txt", run); const Digit = u8; const PAIR_MARK = @as(Digit, 0xFF); const SnailfishNumber = [63]Digit; // maximum five levels -> 32 nums + 31 '[' const SnailfishBuilder = struct { n: SnailfishNumber = undefined, len: u32 = 0, fn append(self: *@This(), d: Digit) void { self.n[self.len] = d; self.len += 1; } }; fn parse(str: []const u8) SnailfishNumber { var snail = SnailfishBuilder{}; for (str) |c| { switch (c) { '0'...'9' => snail.append(c - '0'), 'A'...'Z' => snail.append(10 + c - 'A'), '[' => snail.append(PAIR_MARK), else => continue, } } return snail.n; } fn print_recurse(buf: *[]u8, ptr: *[]const Digit) void { const d = ptr.*[0]; ptr.* = ptr.*[1..]; switch (d) { PAIR_MARK => { buf.*[0] = '['; buf.* = buf.*[1..]; print_recurse(buf, ptr); buf.*[0] = ','; buf.* = buf.*[1..]; print_recurse(buf, ptr); buf.*[0] = ']'; buf.* = buf.*[1..]; }, else => |v| { buf.*[0] = (if (v < 10) '0' + v else 'A' + (v - 10)); buf.* = buf.*[1..]; }, } } fn print(buf: []u8, snail: SnailfishNumber) []u8 { var b = buf; var s: []const Digit = snail[0..]; print_recurse(&b, &s); return buf[0 .. @ptrToInt(b.ptr) - @ptrToInt(buf.ptr)]; } fn magnitude_recurse(snail: SnailfishNumber, cur_digit: *u32) u32 { const d = snail[cur_digit.*]; cur_digit.* += 1; switch (d) { PAIR_MARK => { const left = magnitude_recurse(snail, cur_digit); const right = magnitude_recurse(snail, cur_digit); return left * 3 + right * 2; }, else => |v| return v, } } fn magnitude(snail: SnailfishNumber) u32 { var cur_digit: u32 = 0; return magnitude_recurse(snail, &cur_digit); } fn add(a: SnailfishNumber, b: SnailfishNumber) SnailfishNumber { var r = SnailfishBuilder{}; r.append(PAIR_MARK); var len: u32 = 1; for (a) |d, i| { if (i >= len) break; if (d == PAIR_MARK) len += 2; r.append(d); } len = 1; for (b) |d, i| { if (i >= len) break; if (d == PAIR_MARK) len += 2; r.append(d); } return r.n; } fn equal(a: SnailfishNumber, b: SnailfishNumber) bool { var len: u32 = 1; for (a) |d, i| { if (i >= len) return true; if (a[i] != b[i]) return false; if (d == PAIR_MARK) len += 2; } unreachable; } fn explode(a: SnailfishNumber) SnailfishNumber { var r = SnailfishBuilder{}; var has_exploded = false; var depth: u32 = 0; var stack: [5]u1 = undefined; var carry: u8 = 0; for (a) |d| { switch (d) { PAIR_MARK => { r.append(d); stack[depth] = 0; depth += 1; }, else => { if (!has_exploded and depth == 5) { if (stack[depth - 1] == 0) { //left // change '[' -> 0 r.n[r.len - 1] = 0; // find the first left number and add var left = r.len - 1; while (left > 0 and r.n[left - 1] == PAIR_MARK) : (left -= 1) {} if (left > 0) r.n[left - 1] += d; } else { //right carry = d; has_exploded = true; } } else { r.append(d + carry); carry = 0; } while (depth > 0 and stack[depth - 1] == 1) depth -= 1; if (depth == 0) break; stack[depth - 1] += 1; }, } } return r.n; } fn split(a: SnailfishNumber) SnailfishNumber { var r = SnailfishBuilder{}; var has_split = false; var len: u32 = 1; for (a) |d, i| { if (i >= len) break; switch (d) { PAIR_MARK => { len += 2; r.append(d); }, else => { if (!has_split and d > 9) { has_split = true; r.append(PAIR_MARK); r.append(d / 2); r.append(d - d / 2); } else { r.append(d); } }, } } return r.n; } fn reduce(a: SnailfishNumber) SnailfishNumber { var next = a; var cur: SnailfishNumber = undefined; while (true) { cur = next; next = explode(cur); if (equal(next, cur)) next = split(cur); if (equal(next, cur)) break; } return cur; } test "operations" { try std.testing.expect(equal( // add(parse("[1,2]"), parse("[[3,4],5]")), // parse("[[1,2],[[3,4],5]]") // )); for ([_][2][]const u8{ .{ "[[1,2],[[3,4],5]]", "[[1,2],[[3,4],5]]" }, .{ "[[[[[9,8],1],2],3],4]", "[[[[0,9],2],3],4]" }, .{ "[7,[6,[5,[4,[3,2]]]]]", "[7,[6,[5,[7,0]]]]" }, .{ "[[6,[5,[4,[3,2]]]],1]", "[[6,[5,[7,0]]],3]" }, .{ "[[3,[2,[1,[7,3]]]],[6,[5,[4,[3,2]]]]]", "[[3,[2,[8,0]]],[9,[5,[4,[3,2]]]]]" }, .{ "[[3,[2,[8,0]]],[9,[5,[4,[3,2]]]]]", "[[3,[2,[8,0]]],[9,[5,[7,0]]]]" }, }) |example| { var buf: [100]u8 = undefined; trace("explode({s}) -> {s}\n", .{ example[0], print(&buf, explode(parse(example[0]))) }); try std.testing.expect(equal(explode(parse(example[0])), parse(example[1]))); } for ([_][2][]const u8{ .{ "[[[[0,7],4],[F,[0,D]]],[1,1]]", "[[[[0,7],4],[[7,8],[0,D]]],[1,1]]" }, .{ "[[[[0,7],4],[[7,8],[0,D]]],[1,1]]", "[[[[0,7],4],[[7,8],[0,[6,7]]]],[1,1]]" }, }) |example| { var buf: [100]u8 = undefined; trace("split({s}) -> {s}\n", .{ example[0], print(&buf, split(parse(example[0]))) }); try std.testing.expect(equal(split(parse(example[0])), parse(example[1]))); } try std.testing.expect(equal( // reduce(parse("[[[[[4,3],4],4],[7,[[8,4],9]]],[1,1]]")), // parse("[[[[0,7],4],[[7,8],[6,0]]],[8,1]]") // )); try std.testing.expect(equal( // reduce(add(parse("[[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]]"), // parse("[[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]]"))), // parse("[[[[7,8],[6,6]],[[6,0],[7,7]]],[[[7,8],[8,8]],[[7,9],[0,6]]]]"))); try std.testing.expectEqual(@as(u32, 143), magnitude(parse("[[1,2],[[3,4],5]]"))); try std.testing.expectEqual(@as(u32, 1384), magnitude(parse("[[[[0,7],4],[[7,8],[6,0]]],[8,1]]"))); try std.testing.expectEqual(@as(u32, 445), magnitude(parse("[[[[1,1],[2,2]],[3,3]],[4,4]]"))); try std.testing.expectEqual(@as(u32, 791), magnitude(parse("[[[[3,0],[5,3]],[4,4]],[5,5]]"))); try std.testing.expectEqual(@as(u32, 1137), magnitude(parse("[[[[5,0],[7,4]],[5,5]],[6,6]]"))); try std.testing.expectEqual(@as(u32, 3488), magnitude(parse("[[[[8,7],[7,7]],[[8,6],[7,7]]],[[[0,7],[6,6]],[8,7]]]"))); } pub fn run(input: []const u8, gpa: std.mem.Allocator) tools.RunError![2][]const u8 { //var arena_alloc = std.heap.ArenaAllocator.init(gpa); //defer arena_alloc.deinit(); //const arena = arena_alloc.allocator(); var input_list = std.ArrayList(SnailfishNumber).init(gpa); defer input_list.deinit(); var it = std.mem.tokenize(u8, input, "\n"); while (it.next()) |line| { const snail = parse(line); try input_list.append(snail); } const ans1 = ans: { var snail_sum = input_list.items[0]; for (input_list.items[1..]) |snail| { snail_sum = reduce(add(snail_sum, snail)); } break :ans magnitude(snail_sum); }; const ans2 = ans: { var max: u32 = 0; for (input_list.items) |a, i| { for (input_list.items) |b, j| { if (i == j) continue; max = @maximum(max, magnitude(reduce(add(a, b)))); } } break :ans max; }; return [_][]const u8{ try std.fmt.allocPrint(gpa, "{}", .{ans1}), try std.fmt.allocPrint(gpa, "{}", .{ans2}), }; } test { { const res = try run( \\[[[0,[4,5]],[0,0]],[[[4,5],[2,6]],[9,5]]] \\[7,[[[3,7],[4,3]],[[6,3],[8,8]]]] \\[[2,[[0,8],[3,4]]],[[[6,7],1],[7,[1,6]]]] \\[[[[2,4],7],[6,[0,5]]],[[[6,8],[2,8]],[[2,1],[4,5]]]] \\[7,[5,[[3,8],[1,4]]]] \\[[2,[2,2]],[8,[8,1]]] \\[2,9] \\[1,[[[9,3],9],[[9,0],[0,7]]]] \\[[[5,[7,4]],7],1] \\[[[[4,2],2],6],[8,7]] , std.testing.allocator); defer std.testing.allocator.free(res[0]); defer std.testing.allocator.free(res[1]); try std.testing.expectEqualStrings("3488", res[0]); try std.testing.expectEqualStrings("3805", res[1]); } { const res = try run( \\[[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]] \\[[[5,[2,8]],4],[5,[[9,9],0]]] \\[6,[[[6,2],[5,6]],[[7,6],[4,7]]]] \\[[[6,[0,7]],[0,9]],[4,[9,[9,0]]]] \\[[[7,[6,4]],[3,[1,3]]],[[[5,5],1],9]] \\[[6,[[7,3],[3,2]]],[[[3,8],[5,7]],4]] \\[[[[5,4],[7,7]],8],[[8,3],8]] \\[[9,3],[[9,9],[6,[4,9]]]] \\[[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]] \\[[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]] , std.testing.allocator); defer std.testing.allocator.free(res[0]); defer std.testing.allocator.free(res[1]); try std.testing.expectEqualStrings("4140", res[0]); try std.testing.expectEqualStrings("3993", res[1]); } }
2021/day18.zig
const std = @import("std"); const c = @import("c.zig"); const zigimg = @import("zigimg"); const utils = @import("utils.zig"); /// read all images in the assets folder and render them /// on a square raster. The images will be stretched/squeezed to fit the raster. pub fn main() anyerror!void { _= c.SDL_Init(c.SDL_INIT_VIDEO); defer c.SDL_Quit(); // edge length of the square window const WINDOW_SIZE :c_int = 640; var window = c.SDL_CreateWindow("Examples: zigimg with SDL2", c.SDL_WINDOWPOS_CENTERED, c.SDL_WINDOWPOS_CENTERED, WINDOW_SIZE, WINDOW_SIZE, 0); defer c.SDL_DestroyWindow(window); var renderer = c.SDL_CreateRenderer(window, 0, c.SDL_RENDERER_PRESENTVSYNC) orelse return error.CreateRenderer; defer c.SDL_DestroyRenderer(renderer); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _=gpa.deinit(); var allocator : *std.mem.Allocator = &gpa.allocator; const images = try utils.openImagesFromDirectoryRelPath(allocator, "assets"); defer { for (images) |image| { image.deinit(); } allocator.free(images); } var textures = try utils.sdlTexturesFromImagesAlloc(allocator,renderer,images); defer { for (textures) |texture| { c.SDL_DestroyTexture(texture); } allocator.free(textures); } _ = c.SDL_SetRenderDrawColor(renderer, 0x80, 0x80, 0x80, 0x00); _ = c.SDL_RenderClear(renderer); const TILES_PER_ROW = @floatToInt(c_int,@ceil(@sqrt(@intToFloat(f32,textures.len)))); const TILE_SIZE = @intCast(c_int,@divFloor(WINDOW_SIZE,TILES_PER_ROW)); var destination_rect = c.SDL_Rect{.x = 0, .y = 0, .w = TILE_SIZE, .h = TILE_SIZE}; for (textures) |texture,idx| { _ = c.SDL_RenderCopy(renderer, texture,null,&destination_rect); destination_rect.x += TILE_SIZE; std.log.info("Render index {}", .{idx}); if (@mod(@intCast(c_int,idx+1),TILES_PER_ROW)==0) { destination_rect.y += TILE_SIZE; destination_rect.x = 0; std.log.info("linebreak",.{}); } } c.SDL_RenderPresent(renderer); mainloop: while (true) { var sdl_event: c.SDL_Event = undefined; while (c.SDL_PollEvent(&sdl_event) != 0) { switch (sdl_event.type) { c.SDL_QUIT => break :mainloop, else => {}, } } } }
src/main.zig
const std = @import("std"); const builtin = @import("builtin"); const testing = std.testing; const math = std.math; const floatXiYf = @import("floatXiYf.zig").floatXiYf; // Conversion to f32 const __floatsisf = @import("floatXiYf.zig").__floatsisf; const __floatunsisf = @import("floatXiYf.zig").__floatunsisf; const __floatdisf = @import("floatXiYf.zig").__floatdisf; const __floatundisf = @import("floatXiYf.zig").__floatundisf; const __floattisf = @import("floatXiYf.zig").__floattisf; const __floatuntisf = @import("floatXiYf.zig").__floatuntisf; // Conversion to f64 const __floatsidf = @import("floatXiYf.zig").__floatsidf; const __floatunsidf = @import("floatXiYf.zig").__floatunsidf; const __floatdidf = @import("floatXiYf.zig").__floatdidf; const __floatundidf = @import("floatXiYf.zig").__floatundidf; const __floattidf = @import("floatXiYf.zig").__floattidf; const __floatuntidf = @import("floatXiYf.zig").__floatuntidf; // Conversion to f128 const __floatsitf = @import("floatXiYf.zig").__floatsitf; const __floatunsitf = @import("floatXiYf.zig").__floatunsitf; const __floatditf = @import("floatXiYf.zig").__floatditf; const __floatunditf = @import("floatXiYf.zig").__floatunditf; const __floattitf = @import("floatXiYf.zig").__floattitf; const __floatuntitf = @import("floatXiYf.zig").__floatuntitf; fn test__floatsisf(a: i32, expected: u32) !void { const r = __floatsisf(a); try std.testing.expect(@bitCast(u32, r) == expected); } fn test_one_floatunsisf(a: u32, expected: u32) !void { const r = __floatunsisf(a); try std.testing.expect(@bitCast(u32, r) == expected); } test "floatsisf" { try test__floatsisf(0, 0x00000000); try test__floatsisf(1, 0x3f800000); try test__floatsisf(-1, 0xbf800000); try test__floatsisf(0x7FFFFFFF, 0x4f000000); try test__floatsisf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xcf000000); } test "floatunsisf" { // Test the produced bit pattern try test_one_floatunsisf(0, 0); try test_one_floatunsisf(1, 0x3f800000); try test_one_floatunsisf(0x7FFFFFFF, 0x4f000000); try test_one_floatunsisf(0x80000000, 0x4f000000); try test_one_floatunsisf(0xFFFFFFFF, 0x4f800000); } fn test__floatdisf(a: i64, expected: f32) !void { const x = __floatdisf(a); try testing.expect(x == expected); } fn test__floatundisf(a: u64, expected: f32) !void { try std.testing.expectEqual(expected, __floatundisf(a)); } test "floatdisf" { try test__floatdisf(0, 0.0); try test__floatdisf(1, 1.0); try test__floatdisf(2, 2.0); try test__floatdisf(-1, -1.0); try test__floatdisf(-2, -2.0); try test__floatdisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floatdisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floatdisf(@bitCast(i64, @as(u64, 0x8000008000000000)), -0x1.FFFFFEp+62); try test__floatdisf(@bitCast(i64, @as(u64, 0x8000010000000000)), -0x1.FFFFFCp+62); try test__floatdisf(@bitCast(i64, @as(u64, 0x8000000000000000)), -0x1.000000p+63); try test__floatdisf(@bitCast(i64, @as(u64, 0x8000000000000001)), -0x1.000000p+63); try test__floatdisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); try test__floatdisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); try test__floatdisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); } test "floatundisf" { try test__floatundisf(0, 0.0); try test__floatundisf(1, 1.0); try test__floatundisf(2, 2.0); try test__floatundisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floatundisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floatundisf(0x8000008000000000, 0x1p+63); try test__floatundisf(0x8000010000000000, 0x1.000002p+63); try test__floatundisf(0x8000000000000000, 0x1p+63); try test__floatundisf(0x8000000000000001, 0x1p+63); try test__floatundisf(0xFFFFFFFFFFFFFFFE, 0x1p+64); try test__floatundisf(0xFFFFFFFFFFFFFFFF, 0x1p+64); try test__floatundisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); try test__floatundisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); try test__floatundisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); } fn test__floattisf(a: i128, expected: f32) !void { const x = __floattisf(a); try testing.expect(x == expected); } fn test__floatuntisf(a: u128, expected: f32) !void { const x = __floatuntisf(a); try testing.expect(x == expected); } test "floattisf" { try test__floattisf(0, 0.0); try test__floattisf(1, 1.0); try test__floattisf(2, 2.0); try test__floattisf(-1, -1.0); try test__floattisf(-2, -2.0); try test__floattisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floattisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000008000000000), -0x1.FFFFFEp+62); try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000010000000000), -0x1.FFFFFCp+62); try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000000), -0x1.000000p+63); try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000001), -0x1.000000p+63); try test__floattisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); try test__floattisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); try test__floattisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); try test__floattisf(make_ti(0x0007FB72E8000000, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72EA000000, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72EB000000, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72EBFFFFFF, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72EC000000, 0), 0x1.FEDCBCp+114); try test__floattisf(make_ti(0x0007FB72E8000001, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72E6000000, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72E7000000, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72E7FFFFFF, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72E4000001, 0), 0x1.FEDCBAp+114); try test__floattisf(make_ti(0x0007FB72E4000000, 0), 0x1.FEDCB8p+114); } test "floatuntisf" { try test__floatuntisf(0, 0.0); try test__floatuntisf(1, 1.0); try test__floatuntisf(2, 2.0); try test__floatuntisf(20, 20.0); try test__floatuntisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floatuntisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floatuntisf(make_uti(0x8000008000000000, 0), 0x1.000001p+127); try test__floatuntisf(make_uti(0x8000000000000800, 0), 0x1.0p+127); try test__floatuntisf(make_uti(0x8000010000000000, 0), 0x1.000002p+127); try test__floatuntisf(make_uti(0x8000000000000000, 0), 0x1.000000p+127); try test__floatuntisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); try test__floatuntisf(0x0007FB72EB000000, 0x1.FEDCBACp+50); try test__floatuntisf(0x0007FB72EC000000, 0x1.FEDCBBp+50); try test__floatuntisf(0x0007FB72E6000000, 0x1.FEDCB98p+50); try test__floatuntisf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); try test__floatuntisf(0x0007FB72E4000000, 0x1.FEDCB9p+50); try test__floatuntisf(0xFFFFFFFFFFFFFFFE, 0x1p+64); try test__floatuntisf(0xFFFFFFFFFFFFFFFF, 0x1p+64); try test__floatuntisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); try test__floatuntisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); try test__floatuntisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCB90000000000001), 0x1.FEDCBAp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBA0000000000000), 0x1.FEDCBAp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBAFFFFFFFFFFFFF), 0x1.FEDCBAp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBB0000000000000), 0x1.FEDCBCp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBB0000000000001), 0x1.FEDCBCp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBBFFFFFFFFFFFFF), 0x1.FEDCBCp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBC0000000000000), 0x1.FEDCBCp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBC0000000000001), 0x1.FEDCBCp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBD0000000000000), 0x1.FEDCBCp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBD0000000000001), 0x1.FEDCBEp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBDFFFFFFFFFFFFF), 0x1.FEDCBEp+76); try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBE0000000000000), 0x1.FEDCBEp+76); // Test overflow to infinity try test__floatuntisf(@as(u128, math.maxInt(u128)), @bitCast(f32, math.inf(f32))); } fn test_one_floatsidf(a: i32, expected: u64) !void { const r = __floatsidf(a); try std.testing.expect(@bitCast(u64, r) == expected); } fn test_one_floatunsidf(a: u32, expected: u64) !void { const r = __floatunsidf(a); try std.testing.expect(@bitCast(u64, r) == expected); } test "floatsidf" { try test_one_floatsidf(0, 0x0000000000000000); try test_one_floatsidf(1, 0x3ff0000000000000); try test_one_floatsidf(-1, 0xbff0000000000000); try test_one_floatsidf(0x7FFFFFFF, 0x41dfffffffc00000); try test_one_floatsidf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xc1e0000000000000); } test "floatunsidf" { try test_one_floatunsidf(0, 0x0000000000000000); try test_one_floatunsidf(1, 0x3ff0000000000000); try test_one_floatunsidf(0x7FFFFFFF, 0x41dfffffffc00000); try test_one_floatunsidf(@intCast(u32, 0x80000000), 0x41e0000000000000); try test_one_floatunsidf(@intCast(u32, 0xFFFFFFFF), 0x41efffffffe00000); } fn test__floatdidf(a: i64, expected: f64) !void { const r = __floatdidf(a); try testing.expect(r == expected); } fn test__floatundidf(a: u64, expected: f64) !void { const r = __floatundidf(a); try testing.expect(r == expected); } test "floatdidf" { try test__floatdidf(0, 0.0); try test__floatdidf(1, 1.0); try test__floatdidf(2, 2.0); try test__floatdidf(20, 20.0); try test__floatdidf(-1, -1.0); try test__floatdidf(-2, -2.0); try test__floatdidf(-20, -20.0); try test__floatdidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floatdidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); try test__floatdidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floatdidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000008000000000)), -0x1.FFFFFEp+62); try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000800)), -0x1.FFFFFFFFFFFFEp+62); try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000010000000000)), -0x1.FFFFFCp+62); try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000001000)), -0x1.FFFFFFFFFFFFCp+62); try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000000)), -0x1.000000p+63); try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000001)), -0x1.000000p+63); // 0x8000000000000001 try test__floatdidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatdidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); try test__floatdidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); try test__floatdidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); try test__floatdidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); try test__floatdidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); try test__floatdidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); try test__floatdidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); try test__floatdidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); try test__floatdidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); try test__floatdidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); try test__floatdidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); try test__floatdidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); try test__floatdidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); try test__floatdidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); try test__floatdidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); try test__floatdidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); } test "floatundidf" { try test__floatundidf(0, 0.0); try test__floatundidf(1, 1.0); try test__floatundidf(2, 2.0); try test__floatundidf(20, 20.0); try test__floatundidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floatundidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); try test__floatundidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floatundidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); try test__floatundidf(0x8000008000000000, 0x1.000001p+63); try test__floatundidf(0x8000000000000800, 0x1.0000000000001p+63); try test__floatundidf(0x8000010000000000, 0x1.000002p+63); try test__floatundidf(0x8000000000001000, 0x1.0000000000002p+63); try test__floatundidf(0x8000000000000000, 0x1p+63); try test__floatundidf(0x8000000000000001, 0x1p+63); try test__floatundidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatundidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); try test__floatundidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); try test__floatundidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); try test__floatundidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); try test__floatundidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); try test__floatundidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); try test__floatundidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); try test__floatundidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); try test__floatundidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); try test__floatundidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); try test__floatundidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); try test__floatundidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); try test__floatundidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); try test__floatundidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); try test__floatundidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); try test__floatundidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); } fn test__floattidf(a: i128, expected: f64) !void { const x = __floattidf(a); try testing.expect(x == expected); } fn test__floatuntidf(a: u128, expected: f64) !void { const x = __floatuntidf(a); try testing.expect(x == expected); } test "floattidf" { try test__floattidf(0, 0.0); try test__floattidf(1, 1.0); try test__floattidf(2, 2.0); try test__floattidf(20, 20.0); try test__floattidf(-1, -1.0); try test__floattidf(-2, -2.0); try test__floattidf(-20, -20.0); try test__floattidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floattidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); try test__floattidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floattidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); try test__floattidf(make_ti(0x8000008000000000, 0), -0x1.FFFFFEp+126); try test__floattidf(make_ti(0x8000000000000800, 0), -0x1.FFFFFFFFFFFFEp+126); try test__floattidf(make_ti(0x8000010000000000, 0), -0x1.FFFFFCp+126); try test__floattidf(make_ti(0x8000000000001000, 0), -0x1.FFFFFFFFFFFFCp+126); try test__floattidf(make_ti(0x8000000000000000, 0), -0x1.000000p+127); try test__floattidf(make_ti(0x8000000000000001, 0), -0x1.000000p+127); try test__floattidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floattidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); try test__floattidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); try test__floattidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); try test__floattidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); try test__floattidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); try test__floattidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); try test__floattidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); try test__floattidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); try test__floattidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); try test__floattidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); try test__floattidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); try test__floattidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); try test__floattidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); try test__floattidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); try test__floattidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); try test__floattidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); try test__floattidf(make_ti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496Dp+121); try test__floattidf(make_ti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496Ep+121); try test__floattidf(make_ti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496Fp+121); try test__floattidf(make_ti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496Fp+121); try test__floattidf(make_ti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496Fp+121); try test__floattidf(make_ti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); } test "floatuntidf" { try test__floatuntidf(0, 0.0); try test__floatuntidf(1, 1.0); try test__floatuntidf(2, 2.0); try test__floatuntidf(20, 20.0); try test__floatuntidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floatuntidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); try test__floatuntidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floatuntidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); try test__floatuntidf(make_uti(0x8000008000000000, 0), 0x1.000001p+127); try test__floatuntidf(make_uti(0x8000000000000800, 0), 0x1.0000000000001p+127); try test__floatuntidf(make_uti(0x8000010000000000, 0), 0x1.000002p+127); try test__floatuntidf(make_uti(0x8000000000001000, 0), 0x1.0000000000002p+127); try test__floatuntidf(make_uti(0x8000000000000000, 0), 0x1.000000p+127); try test__floatuntidf(make_uti(0x8000000000000001, 0), 0x1.0000000000000002p+127); try test__floatuntidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatuntidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); try test__floatuntidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); try test__floatuntidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); try test__floatuntidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); try test__floatuntidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); try test__floatuntidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); try test__floatuntidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); try test__floatuntidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); try test__floatuntidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); try test__floatuntidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); try test__floatuntidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); try test__floatuntidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); try test__floatuntidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); try test__floatuntidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); try test__floatuntidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); try test__floatuntidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); try test__floatuntidf(make_uti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496Dp+121); try test__floatuntidf(make_uti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496Ep+121); try test__floatuntidf(make_uti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496Fp+121); try test__floatuntidf(make_uti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496Fp+121); try test__floatuntidf(make_uti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496Fp+121); try test__floatuntidf(make_uti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); } fn test__floatsitf(a: i32, expected: u128) !void { const r = __floatsitf(a); try std.testing.expect(@bitCast(u128, r) == expected); } test "floatsitf" { try test__floatsitf(0, 0); try test__floatsitf(0x7FFFFFFF, 0x401dfffffffc00000000000000000000); try test__floatsitf(0x12345678, 0x401b2345678000000000000000000000); try test__floatsitf(-0x12345678, 0xc01b2345678000000000000000000000); try test__floatsitf(@bitCast(i32, @intCast(u32, 0xffffffff)), 0xbfff0000000000000000000000000000); try test__floatsitf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xc01e0000000000000000000000000000); } fn test__floatunsitf(a: u32, expected_hi: u64, expected_lo: u64) !void { const x = __floatunsitf(a); const x_repr = @bitCast(u128, x); const x_hi = @intCast(u64, x_repr >> 64); const x_lo = @truncate(u64, x_repr); if (x_hi == expected_hi and x_lo == expected_lo) { return; } // nan repr else if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { if ((x_hi & 0x7fff000000000000) == 0x7fff000000000000 and ((x_hi & 0xffffffffffff) > 0 or x_lo > 0)) { return; } } @panic("__floatunsitf test failure"); } test "floatunsitf" { try test__floatunsitf(0x7fffffff, 0x401dfffffffc0000, 0x0); try test__floatunsitf(0, 0x0, 0x0); try test__floatunsitf(0xffffffff, 0x401efffffffe0000, 0x0); try test__floatunsitf(0x12345678, 0x401b234567800000, 0x0); } fn test__floatditf(a: i64, expected: f128) !void { const x = __floatditf(a); try testing.expect(x == expected); } fn test__floatunditf(a: u64, expected_hi: u64, expected_lo: u64) !void { const x = __floatunditf(a); const x_repr = @bitCast(u128, x); const x_hi = @intCast(u64, x_repr >> 64); const x_lo = @truncate(u64, x_repr); if (x_hi == expected_hi and x_lo == expected_lo) { return; } // nan repr else if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { if ((x_hi & 0x7fff000000000000) == 0x7fff000000000000 and ((x_hi & 0xffffffffffff) > 0 or x_lo > 0)) { return; } } @panic("__floatunditf test failure"); } test "floatditf" { try test__floatditf(0x7fffffffffffffff, make_tf(0x403dffffffffffff, 0xfffc000000000000)); try test__floatditf(0x123456789abcdef1, make_tf(0x403b23456789abcd, 0xef10000000000000)); try test__floatditf(0x2, make_tf(0x4000000000000000, 0x0)); try test__floatditf(0x1, make_tf(0x3fff000000000000, 0x0)); try test__floatditf(0x0, make_tf(0x0, 0x0)); try test__floatditf(@bitCast(i64, @as(u64, 0xffffffffffffffff)), make_tf(0xbfff000000000000, 0x0)); try test__floatditf(@bitCast(i64, @as(u64, 0xfffffffffffffffe)), make_tf(0xc000000000000000, 0x0)); try test__floatditf(-0x123456789abcdef1, make_tf(0xc03b23456789abcd, 0xef10000000000000)); try test__floatditf(@bitCast(i64, @as(u64, 0x8000000000000000)), make_tf(0xc03e000000000000, 0x0)); } test "floatunditf" { try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000); try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000); try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0); try test__floatunditf(0x7fffffffffffffff, 0x403dffffffffffff, 0xfffc000000000000); try test__floatunditf(0x123456789abcdef1, 0x403b23456789abcd, 0xef10000000000000); try test__floatunditf(0x2, 0x4000000000000000, 0x0); try test__floatunditf(0x1, 0x3fff000000000000, 0x0); try test__floatunditf(0x0, 0x0, 0x0); } fn test__floattitf(a: i128, expected: f128) !void { const x = __floattitf(a); try testing.expect(x == expected); } fn test__floatuntitf(a: u128, expected: f128) !void { const x = __floatuntitf(a); try testing.expect(x == expected); } test "floattitf" { try test__floattitf(0, 0.0); try test__floattitf(1, 1.0); try test__floattitf(2, 2.0); try test__floattitf(20, 20.0); try test__floattitf(-1, -1.0); try test__floattitf(-2, -2.0); try test__floattitf(-20, -20.0); try test__floattitf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floattitf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); try test__floattitf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floattitf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); try test__floattitf(make_ti(0x8000008000000000, 0), -0x1.FFFFFEp+126); try test__floattitf(make_ti(0x8000000000000800, 0), -0x1.FFFFFFFFFFFFEp+126); try test__floattitf(make_ti(0x8000010000000000, 0), -0x1.FFFFFCp+126); try test__floattitf(make_ti(0x8000000000001000, 0), -0x1.FFFFFFFFFFFFCp+126); try test__floattitf(make_ti(0x8000000000000000, 0), -0x1.000000p+127); try test__floattitf(make_ti(0x8000000000000001, 0), -0x1.FFFFFFFFFFFFFFFCp+126); try test__floattitf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floattitf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); try test__floattitf(0x0007FB72EB000000, 0x1.FEDCBACp+50); try test__floattitf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); try test__floattitf(0x0007FB72EC000000, 0x1.FEDCBBp+50); try test__floattitf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); try test__floattitf(0x0007FB72E6000000, 0x1.FEDCB98p+50); try test__floattitf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); try test__floattitf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); try test__floattitf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); try test__floattitf(0x0007FB72E4000000, 0x1.FEDCB9p+50); try test__floattitf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); try test__floattitf(0x023479FD0E092DA1, 0x1.1A3CFE870496D08p+57); try test__floattitf(0x023479FD0E092DB0, 0x1.1A3CFE870496D8p+57); try test__floattitf(0x023479FD0E092DB8, 0x1.1A3CFE870496DCp+57); try test__floattitf(0x023479FD0E092DB6, 0x1.1A3CFE870496DBp+57); try test__floattitf(0x023479FD0E092DBF, 0x1.1A3CFE870496DF8p+57); try test__floattitf(0x023479FD0E092DC1, 0x1.1A3CFE870496E08p+57); try test__floattitf(0x023479FD0E092DC7, 0x1.1A3CFE870496E38p+57); try test__floattitf(0x023479FD0E092DC8, 0x1.1A3CFE870496E4p+57); try test__floattitf(0x023479FD0E092DCF, 0x1.1A3CFE870496E78p+57); try test__floattitf(0x023479FD0E092DD0, 0x1.1A3CFE870496E8p+57); try test__floattitf(0x023479FD0E092DD1, 0x1.1A3CFE870496E88p+57); try test__floattitf(0x023479FD0E092DD8, 0x1.1A3CFE870496ECp+57); try test__floattitf(0x023479FD0E092DDF, 0x1.1A3CFE870496EF8p+57); try test__floattitf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); try test__floattitf(make_ti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); try test__floattitf(make_ti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496D08p+121); try test__floattitf(make_ti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496D8p+121); try test__floattitf(make_ti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496DCp+121); try test__floattitf(make_ti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496DBp+121); try test__floattitf(make_ti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496DF8p+121); try test__floattitf(make_ti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496E08p+121); try test__floattitf(make_ti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496E38p+121); try test__floattitf(make_ti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496E4p+121); try test__floattitf(make_ti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496E78p+121); try test__floattitf(make_ti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496E8p+121); try test__floattitf(make_ti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496E88p+121); try test__floattitf(make_ti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496ECp+121); try test__floattitf(make_ti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496EF8p+121); try test__floattitf(make_ti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); try test__floattitf(make_ti(0, 0xFFFFFFFFFFFFFFFF), 0x1.FFFFFFFFFFFFFFFEp+63); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC2801), 0x1.23456789ABCDEF0123456789ABC3p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC3000), 0x1.23456789ABCDEF0123456789ABC3p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC37FF), 0x1.23456789ABCDEF0123456789ABC3p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC3800), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4000), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC47FF), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4800), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4801), 0x1.23456789ABCDEF0123456789ABC5p+124); try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC57FF), 0x1.23456789ABCDEF0123456789ABC5p+124); } test "floatuntitf" { try test__floatuntitf(0, 0.0); try test__floatuntitf(1, 1.0); try test__floatuntitf(2, 2.0); try test__floatuntitf(20, 20.0); try test__floatuntitf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); try test__floatuntitf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); try test__floatuntitf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); try test__floatuntitf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); try test__floatuntitf(0x7FFFFFFFFFFFFFFF, 0xF.FFFFFFFFFFFFFFEp+59); try test__floatuntitf(0xFFFFFFFFFFFFFFFE, 0xF.FFFFFFFFFFFFFFEp+60); try test__floatuntitf(0xFFFFFFFFFFFFFFFF, 0xF.FFFFFFFFFFFFFFFp+60); try test__floatuntitf(0x8000008000000000, 0x8.000008p+60); try test__floatuntitf(0x8000000000000800, 0x8.0000000000008p+60); try test__floatuntitf(0x8000010000000000, 0x8.00001p+60); try test__floatuntitf(0x8000000000001000, 0x8.000000000001p+60); try test__floatuntitf(0x8000000000000000, 0x8p+60); try test__floatuntitf(0x8000000000000001, 0x8.000000000000001p+60); try test__floatuntitf(0x0007FB72E8000000, 0x1.FEDCBAp+50); try test__floatuntitf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); try test__floatuntitf(0x0007FB72EB000000, 0x1.FEDCBACp+50); try test__floatuntitf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); try test__floatuntitf(0x0007FB72EC000000, 0x1.FEDCBBp+50); try test__floatuntitf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); try test__floatuntitf(0x0007FB72E6000000, 0x1.FEDCB98p+50); try test__floatuntitf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); try test__floatuntitf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); try test__floatuntitf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); try test__floatuntitf(0x0007FB72E4000000, 0x1.FEDCB9p+50); try test__floatuntitf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); try test__floatuntitf(0x023479FD0E092DA1, 0x1.1A3CFE870496D08p+57); try test__floatuntitf(0x023479FD0E092DB0, 0x1.1A3CFE870496D8p+57); try test__floatuntitf(0x023479FD0E092DB8, 0x1.1A3CFE870496DCp+57); try test__floatuntitf(0x023479FD0E092DB6, 0x1.1A3CFE870496DBp+57); try test__floatuntitf(0x023479FD0E092DBF, 0x1.1A3CFE870496DF8p+57); try test__floatuntitf(0x023479FD0E092DC1, 0x1.1A3CFE870496E08p+57); try test__floatuntitf(0x023479FD0E092DC7, 0x1.1A3CFE870496E38p+57); try test__floatuntitf(0x023479FD0E092DC8, 0x1.1A3CFE870496E4p+57); try test__floatuntitf(0x023479FD0E092DCF, 0x1.1A3CFE870496E78p+57); try test__floatuntitf(0x023479FD0E092DD0, 0x1.1A3CFE870496E8p+57); try test__floatuntitf(0x023479FD0E092DD1, 0x1.1A3CFE870496E88p+57); try test__floatuntitf(0x023479FD0E092DD8, 0x1.1A3CFE870496ECp+57); try test__floatuntitf(0x023479FD0E092DDF, 0x1.1A3CFE870496EF8p+57); try test__floatuntitf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); try test__floatuntitf(make_uti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); try test__floatuntitf(make_uti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496D08p+121); try test__floatuntitf(make_uti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496D8p+121); try test__floatuntitf(make_uti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496DCp+121); try test__floatuntitf(make_uti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496DBp+121); try test__floatuntitf(make_uti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496DF8p+121); try test__floatuntitf(make_uti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496E08p+121); try test__floatuntitf(make_uti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496E38p+121); try test__floatuntitf(make_uti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496E4p+121); try test__floatuntitf(make_uti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496E78p+121); try test__floatuntitf(make_uti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496E8p+121); try test__floatuntitf(make_uti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496E88p+121); try test__floatuntitf(make_uti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496ECp+121); try test__floatuntitf(make_uti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496EF8p+121); try test__floatuntitf(make_uti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); try test__floatuntitf(make_uti(0, 0xFFFFFFFFFFFFFFFF), 0x1.FFFFFFFFFFFFFFFEp+63); try test__floatuntitf(make_uti(0xFFFFFFFFFFFFFFFF, 0x0000000000000000), 0x1.FFFFFFFFFFFFFFFEp+127); try test__floatuntitf(make_uti(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF), 0x1.0000000000000000p+128); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC2801), 0x1.23456789ABCDEF0123456789ABC3p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC3000), 0x1.23456789ABCDEF0123456789ABC3p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC37FF), 0x1.23456789ABCDEF0123456789ABC3p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC3800), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4000), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC47FF), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4800), 0x1.23456789ABCDEF0123456789ABC4p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4801), 0x1.23456789ABCDEF0123456789ABC5p+124); try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC57FF), 0x1.23456789ABCDEF0123456789ABC5p+124); } fn make_ti(high: u64, low: u64) i128 { var result: u128 = high; result <<= 64; result |= low; return @bitCast(i128, result); } fn make_uti(high: u64, low: u64) u128 { var result: u128 = high; result <<= 64; result |= low; return result; } fn make_tf(high: u64, low: u64) f128 { var result: u128 = high; result <<= 64; result |= low; return @bitCast(f128, result); } test "conversion to f16" { try testing.expect(floatXiYf(f16, @as(u32, 0)) == 0.0); try testing.expect(floatXiYf(f16, @as(u32, 1)) == 1.0); try testing.expect(floatXiYf(f16, @as(u32, 65504)) == 65504); try testing.expect(floatXiYf(f16, @as(u32, 65504 + (1 << 4))) == math.inf(f16)); } test "conversion to f32" { try testing.expect(floatXiYf(f32, @as(u32, 0)) == 0.0); try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u32))) != 1.0); try testing.expect(floatXiYf(f32, @as(i32, math.minInt(i32))) != 1.0); try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24))) == math.maxInt(u24)); try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 1) == math.maxInt(u24) + 1); // 0x100_0000 - Exact try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 2) == math.maxInt(u24) + 1); // 0x100_0001 - Tie: Rounds down to even try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 3) == math.maxInt(u24) + 3); // 0x100_0002 - Exact try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 4) == math.maxInt(u24) + 5); // 0x100_0003 - Tie: Rounds up to even try testing.expect(floatXiYf(f32, @as(u32, math.maxInt(u24)) + 5) == math.maxInt(u24) + 5); // 0x100_0004 - Exact } test "conversion to f80" { if (builtin.zig_backend == .stage1 and builtin.cpu.arch != .x86_64) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/11408 try testing.expect(floatXiYf(f80, @as(i80, -12)) == -12); try testing.expect(@floatToInt(u80, floatXiYf(f80, @as(u64, math.maxInt(u64)) + 0)) == math.maxInt(u64) + 0); try testing.expect(@floatToInt(u80, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); try testing.expect(floatXiYf(f80, @as(u32, 0)) == 0.0); try testing.expect(floatXiYf(f80, @as(u32, 1)) == 1.0); try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u32, math.maxInt(u24)) + 0)) == math.maxInt(u24)); try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 0)) == math.maxInt(u64)); try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); // Exact try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 2)) == math.maxInt(u64) + 1); // Rounds down try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 3)) == math.maxInt(u64) + 3); // Tie - Exact try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u64)) + 4)) == math.maxInt(u64) + 5); // Rounds up try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 0)) == math.maxInt(u65) + 1); // Rounds up try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 1)) == math.maxInt(u65) + 1); // Exact try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 2)) == math.maxInt(u65) + 1); // Rounds down try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 3)) == math.maxInt(u65) + 1); // Tie - Rounds down try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 4)) == math.maxInt(u65) + 5); // Rounds up try testing.expect(@floatToInt(u128, floatXiYf(f80, @as(u80, math.maxInt(u65)) + 5)) == math.maxInt(u65) + 5); // Exact }
lib/std/special/compiler_rt/floatXiYf_test.zig
const std = @import("std"); const process = std.process; const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Version = std.builtin.Version; const max_line_len = 1024 * 40; const Table = struct { version: void, date: void, values: void, }; fn getUnicodeVersions(allocator: *Allocator) ![]const Version { var result = ArrayList(Version).init(allocator); var file = try std.fs.cwd().openFile("DerivedAge.txt", .{}); defer file.close(); var reader = file.reader(); while (reader.readUntilDelimiterAlloc(allocator, '\n', max_line_len)) |line| { defer allocator.free(line); const needle = "# Newly assigned in Unicode "; if (std.mem.startsWith(u8, line, needle)) { const version_start = line[needle.len..]; const version_end = std.mem.indexOfScalar(u8, version_start, ' ') orelse continue; const version = version_start[0..version_end]; try result.append(try Version.parse(version)); } } else |e| switch (e) { error.EndOfStream => {}, else => return e, } return result.toOwnedSlice(); } fn writeUnicodeVersions(allocator: *Allocator, versions: []const Version) !void { const file_name = "unicode_versions.zig"; var file = try std.fs.cwd().createFile(file_name, .{}); defer file.close(); const writer = file.writer(); try writer.writeAll( \\/// Generated by tools/generate.zig \\const std = @import("std"); \\const Version = std.builtin.Version; \\ ); try writer.writeAll("pub const unicode_versions = [_]Version{\n"); const indent = " "; for (versions) |v| { try writer.print(indent ++ "comptime Version.parse(\"{}\"),\n", .{v}); } try writer.writeAll("}\n"); } fn makeTable(allocator: *Allocator, values: []const u21) ![]const [2]u21 { var result = ArrayList([2]u21).init(allocator); var start = values[0]; var end = values[0]; for (values) |x, i| { if (i == 0) { try result.append([2]u21{ x, x }); } else { const last = result.pop(); start = last[0]; end = last[1]; if (end == x - 1) { try result.append([2]u21{ start, x }); } else { try result.append([2]u21{ start, end }); try result.append([2]u21{ x, x }); } } } return result.toOwnedSlice(); } fn writeTable(file: File, table_name: []const u8, table: Table) !void { const buf_writer = std.io.bufferedWriter(file.writer()); const writer = buf_writer.writer(); try writer.writeAll("/// Automatically generated table\n"); try writer.print("pub const {} = [_][2]u21{\n", .{table_name}); try writer.writeAll("};\n"); try buf_writer.flush(); } fn writeEastAsian(allocator: *Allocator, versions: []const Version) !void { var in_file = try std.fs.cwd().openFile("", .{}); defer in_file.close(); var out_file = try std.fs.cwd().createFile("", .{}); defer out_file.close(); var reader = in_file.reader(); } fn parseEastAsian(allocator: *Allocator, reader: anytype) !Table { const properties = [_]u8{ 'W', 'F' }; const version_line = try reader.readUntilDelimiterAlloc(allocator, '\n', max_line_len); const date_line = try reader.readUntilDelimiterAlloc(allocator, '\n', max_line_len); while (reader.readUntilDelimiterAlloc(allocator, '\n', max_line_len)) |line| { if (line.len > 0 and line[0] == '#') continue; var iter = std.mem.tokenize(line, ";"); const addrs = iter.next() orelse continue; const details = iter.next() orelse continue; } else |e| switch (e) { error.EndOfStream => {}, else => return e, } } pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = &gpa.allocator; const versions = try getUnicodeVersions(allocator); defer allocator.free(versions); // try writeEastAsian(allocator, versions); try writeUnicodeVersions(allocator, versions); }
tools/generate.zig
const std = @import("std"); const Rom = @import("rom.zig").Rom; const Mbc = @import("mbc.zig").Mbc; pub const Mmu = struct { mem: []u8, mbc: Mbc, bank0: []u8, bank1: []u8, vram: []u8, ram: []u8, wram0: []u8, wram1: []u8, echo: []u8, oam: []u8, io: []u8, hram: []u8, // The JOYP circuitry can be physically switched via a register write to switch between // diretional or other buttons. We need an extra u8 to handle this in software. joyp_bit: [2]u8, joyp_active: u1, pub fn init(mem: []u8, rom: *Rom) Mmu { var mmu: Mmu = undefined; mmu.mem = mem; mmu.mbc = Mbc.init(rom); mmu.bank0 = mmu.mem[0x0000..0x3FFF]; mmu.bank1 = mmu.mem[0x4000..0x7FFF]; mmu.vram = mmu.mem[0x8000..0x9FFF]; mmu.ram = mmu.mem[0xA000..0xBFFF]; mmu.wram0 = mmu.mem[0xC000..0xCFFF]; mmu.wram1 = mmu.mem[0xD000..0xDFFF]; mmu.echo = mmu.mem[0xE000..0xFDFF]; mmu.oam = mmu.mem[0xFE00..0xFE9F]; mmu.io = mmu.mem[0xFF00..0xFF7F]; mmu.hram = mmu.mem[0xFF80..0xFFFE]; mmu.joyp_active = 0; // bit 4 std.mem.copy(u8, mmu.mem[0..0x8000], rom.content); return mmu; } pub fn read(self: *Mmu, address: u16) u8 { switch (address) { // ROM/RAM banks 0x0000...0x7FFF, 0xA000...0xBFFF => { return self.mbc.read(address); }, 0x8000...0x9FFF => { // VRAM is accessible during Mode 0-2 const mode = @truncate(u2, self.mem[addresses.STAT]); switch (mode) { 0, 1, 2 => { return self.mem[address]; }, 3 => { return 0xFF; // undefined }, } }, 0xFE00...0xFE9F => { // OAM is accessible during Mode 0-1 const mode = @truncate(u2, self.mem[addresses.STAT]); switch (mode) { 0, 1 => { return self.mem[address]; }, 2, 3 => { return 0xFF; // undefined }, } }, else => { return self.mem[address]; }, } } pub fn write(self: *Mmu, address: u16, value: u8) void { switch (address) { // ROM/RAM banks 0x0000...0x7FFF, 0xA000...0xBFFF => { return self.mbc.write(address, value); }, // First 1K of WRAM echos to ECHO RAM and vice-versa 0xC000...0xDDFF => { self.mem[address] = value; self.mem[address + 0x2000] = value; }, 0x8000...0x9FFF => { // VRAM is accessible during Mode 0-2 const mode = @truncate(u2, self.mem[addresses.STAT]); switch (mode) { 0, 1, 2 => { self.mem[address] = value; }, 3 => {}, } }, 0xE000...0xFDFF => { self.mem[address] = value; self.mem[address - 0x2000] = value; }, 0xFE00...0xFE9F => { // OAM is accessible during Mode 0-1 const mode = @truncate(u2, self.mem[addresses.STAT]); switch (mode) { 0, 1 => { self.mem[address] = value; }, 2, 3 => {}, } }, addresses.JOYP => { switch (value) { 0x10 => { self.joyp_active = 0; self.mem[addresses.JOYP] = self.joyp_bit[0]; }, 0x20 => { self.joyp_active = 1; self.mem[addresses.JOYP] = self.joyp_bit[1]; }, else => {}, } }, 0xFF01 => { self.mem[address] = value & 0xF0; }, 0xFF04 => { self.mem[address] = 0; }, else => { self.mem[address] = value; }, } } }; pub const addresses = struct { // Video Display pub const LCDC = 0xff40; // LCD Control Register (R/W) pub const STAT = 0xff41; // LCD Status Register (R/W) pub const SCY_ = 0xff42; // LCD Scroll Y (R) pub const SCX_ = 0xff43; // LCD Scroll X (R/W) pub const LY__ = 0xff44; // LCDC Y-Coordinate (R/W) pub const LYC_ = 0xff45; // LY Compare (R/W) pub const WY__ = 0xff4a; // Window Y Position (R/W) pub const WX__ = 0xff4b; // Window X Position (R/W) pub const BGP_ = 0xff47; // BG Palette Data (R/W) pub const OBP0 = 0xff48; // Object Palette 0 Data pub const OBP1 = 0xff48; // Object Palette 1 Data pub const DMA_ = 0xff46; // DMA Transfer and Start Address (R/W) // Sound Controller pub const NR10 = 0xff10; // CH1 Sweep Register (R/W) pub const NR11 = 0xff10; // CH1 Sound length/Wave pattern duty (R/w) pub const NR12 = 0xff10; // CH1 Volume Envelope (R/W) pub const NR13 = 0xff10; //CH1 Frequency lo (W) pub const NR14 = 0xff10; // CH1 Frequency hi (R/W) pub const NR21 = 0xff10; // CH2 Sound Length/Wave Pattern Duty (R/W) pub const NR22 = 0xff10; // CH2 Volume Envelope (R/W) pub const NR23 = 0xff10; // CH2 Frequency lo (W) pub const NR24 = 0xff10; // CH2 Frequency hi (R/W) pub const NR30 = 0xff10; // CH3 Sound on/off (R/W) pub const NR31 = 0xff10; // CH3 Sound Length pub const NR32 = 0xff10; // CH3 Select output level (R/W) pub const NR33 = 0xff10; // CH3 Frequency lo (W) pub const NR34 = 0xff10; // CH3 Frequency hi (R/W) pub const NR41 = 0xff10; // CH4 Sound Length (R/W) pub const NR42 = 0xff10; // CH4 Volume Envelope (R/W) pub const NR43 = 0xff10; // CH4 Polynomial Counter (R/W) pub const NR44 = 0xff10; // CH4 Counter/consecutive; Initial (R/W) pub const NR50 = 0xff10; // Channel control/ON-OFF/Volume (R/W) pub const NR51 = 0xff10; // Selection of Sound output terminal (R/W) pub const NR52 = 0xff10; // Sound on/off // Joypad Input pub const P1__ = 0xff00; // Joypad (R/W) pub const JOYP = P1__; // Serial Data Transfer (Link Cable) pub const SB__ = 0xff01; // Serial Transfer Data (R/W) pub const SC__ = 0xff02; // Serial Transfer Control (R/W) // Timer and Divider Registers pub const DIV_ = 0xff04; // Divider Register (R/W) pub const TIMA = 0xff05; // Timer Counter (R/W) pub const TMA_ = 0xff06; // Timer Modulo (R/W) pub const TAC_ = 0xff07; // Timer Control (R/W) // Interrupts pub const IE__ = 0xffff; // Interrupt Enable (R/W) pub const IF__ = 0xff0f; // Interrupt Flag (R/W) };
src/mmu.zig
const std = @import("std"); const mem = std.mem; pub const NodeType = enum { text, action, range, if_, else_, end //, comment, template, block, with }; pub const Node = union(NodeType) { text: []const u8, /// something bounded by delimiters /// action represents simple field evaluations and parenthesized pipelines. action: Pipeline, range: Branch, if_: Branch, else_, end, pub const Branch = struct { pipeline: ?Pipeline = null, list: ?List = null, else_list: ?List = null, }; pub const List = struct { len: usize, root: []const Node, pub fn format(value: List, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { try writer.print("{}", .{value.root}); } }; pub const Pipeline = struct { is_assign: bool, // The variables are being assigned, not declared. decls: []const []const u8, // Variables in lexical order. cmds: []const Command, // The commands in lexical order. }; pub const CommandType = enum { variable, func, field, constant, interval }; pub const Command = union(CommandType) { variable: []const u8, // TODO: support chained variables ($id.field1.field2...) func: []const []const u8, // TODO: support chained funcs (func1.field1.field2...) field: []const u8, // TODO: support chained fields (.field1.field2...) constant: []const u8, // TODO: add different constant types interval: struct { start: usize, end: usize }, // Arguments in lexical order: Identifier, field, or constant. }; // const FormatError = error{ DiskQuota, FileTooBig, InputOutput, NoSpaceLeft, AccessDenied, BrokenPipe, SystemResources, OperationAborted, NotOpenForWriting, WouldBlock, Unexpected }; pub fn format(value: Node, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { switch (value) { .text => try writer.print("'{s}'", .{value.text}), .action => { try writer.print("'{{{{{}}}}}'", .{value.action}); }, .range => { try writer.print("range {}", .{value.range.pipeline}); // for (value.range.body) |child| try writer.print(" {}", .{child}); try writer.print("\n {}", .{value.range.list}); }, .if_ => { try writer.print("if {}", .{value.if_.pipeline}); try writer.print("\n {}", .{value.if_.list}); }, .end, .else_ => unreachable, } } }; pub const Parser = struct { buf: []const u8, pos: usize = 0, marked_pos: usize = 0, /// Returns a substring of the input starting from the current position /// and ending where `ch` is found or until the end if not found pub fn until(self: *@This(), comptime ch: u8) []const u8 { const start = self.pos; if (start >= self.buf.len) return &[_]u8{}; while (self.pos < self.buf.len) : (self.pos += 1) { if (self.buf[self.pos] == ch) break; } return self.buf[start..self.pos]; } /// Returns a substring of the input starting from the current position /// and ending where one of `cs` is found or until the end if not found pub fn untilOneOf(self: *@This(), comptime cs: []const u8) []const u8 { const start = self.pos; if (start >= self.buf.len) return &[_]u8{}; while (self.pos < self.buf.len) : (self.pos += 1) { if (mem.indexOfScalar(u8, cs, self.buf[self.pos])) |_| break; } return self.buf[start..self.pos]; } /// Returns a substring of the input starting from the current position /// and ending where `str` is found or until the end if not found pub fn untilStr(self: *@This(), comptime str: []const u8) []const u8 { const start = self.pos; if (start + str.len >= self.buf.len) return &[_]u8{}; while (self.pos < self.buf.len) : (self.pos += 1) { if (self.pos + str.len <= self.buf.len and memeql(self.buf[self.pos .. self.pos + str.len], str)) break; } return self.buf[start..self.pos]; } /// Returns the n-th next character or null if that's past the end pub fn peek(self: *@This(), comptime n: comptime_int) ?u8 { const signed_pos = @as(isize, self.pos); return if (signed_pos + n < self.buf.len) self.buf[signed_pos + n] else null; } /// end of stream pub fn eos(self: @This()) bool { return self.pos >= self.buf.len; } /// sets `marked_pos` to `current pos + n` pub fn mark(self: *@This(), comptime n: usize) void { self.marked_pos = self.pos + n; } /// Returns a substring of the input starting from /// `marked_pos` until `pos` pub fn fromMark(self: @This()) []const u8 { return self.buf[self.marked_pos..self.pos]; } }; inline fn escape(comptime input: []const u8) []u8 { var output = [1]u8{0} ** input.len; const n1 = mem.replace(u8, input, "\\{", "{", &output); const n2 = mem.replace(u8, &output, "\\}", "}", &output); return output[0 .. input.len - (n1 + n2)]; } /// trim trailing and leading whitespace fn trimSpaces(comptime input: []const u8) []const u8 { return @call(.{ .modifier = .always_inline }, trim, .{ input, &std.ascii.spaces }); } /// trim leading whitespace fn trimSpacesLeft(comptime input: []const u8) []const u8 { return @call(.{ .modifier = .always_inline }, trimLeft, .{ input, &std.ascii.spaces }); } /// trim trailing whitespace fn trimSpacesRight(comptime input: []const u8) []const u8 { return @call(.{ .modifier = .always_inline }, trimRight, .{ input, &std.ascii.spaces }); } fn trim(comptime input: []const u8, comptime trim_chars: []const u8) []const u8 { if (input.len == 0) return input; var start: usize = 0; while (mem.indexOfScalar(u8, trim_chars, input[start])) |_| start += 1; var end: usize = input.len; while (mem.indexOfScalar(u8, trim_chars, input[end - 1])) |_| end -= 1; return input[start..end]; } fn trimLeft(comptime input: []const u8, comptime trim_chars: []const u8) []const u8 { if (input.len == 0) return input; var start: usize = 0; while (mem.indexOfScalar(u8, trim_chars, input[start])) |_| start += 1; return input[start..]; } fn trimRight(comptime input: []const u8, comptime trim_chars: []const u8) []const u8 { if (input.len == 0) return input; var end: usize = input.len; while (mem.indexOfScalar(u8, trim_chars, input[end - 1])) |_| end -= 1; return input[0..end]; } fn showError(comptime msg: []const u8, args: anytype) noreturn { @compileError(std.fmt.comptimePrint(msg, args)); } fn todo(comptime msg: []const u8, args: anytype) noreturn { comptime showError("TODO: " ++ msg, args); } fn parseIdentifier(comptime input: []const u8) []const []const u8 { var result: []const []const u8 = &[0][]const u8{}; var it = std.mem.split(input, "."); while (it.next()) |part| result = result ++ [1][]const u8{trimSpaces(part)}; return result; } // func | variable | field | constant | interval fn parseCommand(comptime input: []const u8) Node.Command { if (std.mem.indexOf(u8, input, "..")) |dots_idx| { const start = std.fmt.parseUnsigned(usize, input[0..dots_idx], 10) catch |e| showError("invalid range start '{}'. {s}", .{ input[0..dots_idx], @errorName(e) }); const end = std.fmt.parseUnsigned(usize, input[dots_idx + 2 ..], 10) catch |e| showError("invalid range end '{}'. {s}", .{ input[0..dots_idx], @errorName(e) }); return .{ .interval = .{ .start = start, .end = end } }; } return switch (input[0]) { '.' => .{ .field = input[1..] }, 'a'...'z', 'A'...'Z' => .{ .func = parseIdentifier(input) }, '$' => .{ .variable = input }, '0'...'9', '-' => .{ .constant = input }, // TODO: add different constant types else => todo("parseCommand: unsupported command type '{s}'", .{input}), }; } // Pipeline: // declarations? command ('|' command)* fn parsePipeline(comptime input: []const u8) Node.Pipeline { var result: Node.Pipeline = .{ .is_assign = false, .cmds = &[_]Node.Command{}, .decls = &[_][]const u8{} }; var parser = Parser{ .buf = trimSpaces(input) }; if (std.mem.indexOfScalar(u8, input, '=')) |eqpos_| { // @compileLog("eqpos_", eqpos_); result.is_assign = true; const is_decl_assign = input[eqpos_ - 1] == ':'; // check for := const eqpos = if (is_decl_assign) eqpos_ - 1 else eqpos_; while (parser.pos < eqpos_) { // declarations // @compileLog(parser.pos, eqpos_, parser.buf.len); var next = trimSpaces(parser.untilOneOf(",=:")); // @compileLog(next); if (next.len == 0) break; if (next[0] == '$') { result.decls = result.decls ++ &[1][]const u8{next}; } else { todo("declarations: '{s}'", .{input}); } parser.pos += 1; } parser.pos += 1; } // commands // @compileLog(parser.pos); while (true) { // @compileLog(parser.pos); var cmd_text = trimSpaces(parser.until('|')); // @compileLog(parser.pos); // @compileError(cmd_text); if (cmd_text.len == 0) break; result.cmds = result.cmds ++ [1]Node.Command{parseCommand(cmd_text)}; parser.pos += 1; // skip '|' } return result; } // {{range pipeline}} T1 {{end}} // {{range pipeline}} T1 {{else}} T0 {{end}} fn parseRange(comptime input: []const u8) Node { std.debug.assert(mem.startsWith(u8, input, "range")); return .{ .range = .{ .pipeline = parsePipeline(input[5..]) } }; } fn parseIf(comptime input: []const u8) Node { std.debug.assert(mem.startsWith(u8, input, "if")); return .{ .if_ = .{ .pipeline = parsePipeline(input[2..]) } }; } inline fn parseNodes(comptime fmt: []const u8) []const Node { var nodes: []const Node = &[0]Node{}; var parser = Parser{ .buf = fmt }; var trim_right = false; var trim_left = false; while (!parser.eos()) : (parser.pos += 1) { const c = parser.peek(0) orelse break; switch (c) { '{' => { const next = parser.peek(1) orelse break; if (next != '{') continue; var lit = parser.fromMark(); if (nodes.len > 0) { if (parser.peek(2)) |c2| { if (parser.peek(3)) |c3| { if (c2 == '-' and c3 == ' ') { // make sure '-' is followed by space too lit = trimSpacesRight(lit); trim_left = true; } } } } if (trim_right) { lit = trimSpacesLeft(lit); trim_right = false; } if (lit.len != 0) nodes = nodes ++ [1]Node{.{ .text = escape(lit) }}; parser.mark(2); parser.pos += 1; }, '}' => { const next = parser.peek(1) orelse break; if (next != c) continue; trim_right = if (parser.peek(-1)) |c2| if (parser.peek(-2)) |c3| c2 == '-' and c3 == ' '; var action = parser.fromMark(); if (action.len != 0) { if (trim_right) action = action[0 .. action.len - 1]; // remove the '-' if (trim_left) { action = action[1..]; // remove the '-' trim_left = false; } action = trimSpaces(action); if (mem.startsWith(u8, action, "range")) { nodes = nodes ++ [1]Node{parseRange(escape(action))}; } else if (mem.startsWith(u8, action, "if")) { nodes = nodes ++ [1]Node{parseIf(escape(action))}; } else if (mem.startsWith(u8, action, "else if")) { // Treat // {{if a}}_{{else if b}}_{{end}} // as // {{if a}}_{{else}}{{if b}}_{{end}}{{end}}. nodes = nodes ++ [2]Node{ .else_, parseIf(escape(action[5..])) }; } else if (memeql(action, "else")) { nodes = nodes ++ [1]Node{.else_}; } else if (memeql(action, "end")) nodes = nodes ++ [1]Node{.end} else nodes = nodes ++ [1]Node{.{ .action = parsePipeline(escape(action)) }}; } parser.mark(2); parser.pos += 1; }, else => {}, } } if (parser.marked_pos < parser.buf.len) { const lit = parser.buf[parser.marked_pos..]; nodes = nodes ++ [1]Node{.{ .text = escape(lit) }}; } return nodes; } /// recursively appends children of range/ifs to their lists /// until end action reached fn parseTree(comptime flat_nodes: []const Node, comptime stop_types: []const NodeType) Node.List { var result: []const Node = &[0]Node{}; var i: usize = 0; while (i < flat_nodes.len) : (i += 1) { var node = flat_nodes[i]; // append children until end switch (node) { .range => { i += 1; const list = parseTree(flat_nodes[i..], &[_]NodeType{.end}); node.range.list = list; if (list.len > 0) i += list.len; // TODO: support range else list }, .if_ => { { i += 1; const list = parseTree(flat_nodes[i..], &[_]NodeType{ .end, .else_ }); node.if_.list = list; if (list.len > 0) i += list.len; } if (i < flat_nodes.len and flat_nodes[i] == .else_) { i += 1; const list = parseTree(flat_nodes[i..], &[_]NodeType{.end}); node.if_.else_list = list; if (list.len > 0) i += list.len; } }, else => { if (std.mem.indexOfScalar(NodeType, stop_types, node)) |_| break; }, } result = result ++ &[1]Node{node}; } return .{ .len = i, .root = result }; } // fn visitNodes(nodes: []const Node, ctx: anytype, cb: fn (Node, @TypeOf(ctx)) void) void { // for (nodes) |node| { // switch (node) { // .range => { // cb(node, ctx); // visitTree(@field(node, @tagName(node)).body, ctx, cb); // }, // else => cb(node, ctx), // } // } // } const Options = struct { eval_branch_quota: usize = 2000, name: ?[]const u8 = null, }; pub fn Template(comptime fmt: []const u8, comptime options_: Options) type { @setEvalBranchQuota(options_.eval_branch_quota); var flat_nodes = parseNodes(fmt); // flat_nodes is a flat list of nodes here. // need to nest range nodes in range / if. var tree_ = parseTree(flat_nodes, &[_]NodeType{}); var root = tree_.root; // append remaining non-nested nodes if (tree_.len < flat_nodes.len) { for (flat_nodes[tree_.len..]) |node| root = root ++ [1]Node{node}; tree_.len = flat_nodes.len; } tree_.root = root; return struct { pub const options = options_; pub const tree = tree_; pub fn bufPrint(buf: []u8, args: anytype) ![]u8 { var fbs = std.io.fixedBufferStream(buf); comptime var scopes: []const []const ScopeEntry = &[_][]const ScopeEntry{}; try bufPrintImpl(scopes, tree.root, fbs.writer(), args); return fbs.getWritten(); } fn writeNestedCmdFields(comptime cmds: []const Node.Command, writer: anytype, args: anytype) !void { std.debug.assert(cmds.len > 0); // make a tuple of all the nested types in args // example - cmds: ".field1.field2" // types[0] = @TypeOf(args) // types[1] = @TypeOf(@field(args, "field1")) // types[2] = @TypeOf(@field(@field(args, "field1"), "field2")) comptime var types: []const type = &[_]type{@TypeOf(args)}; inline for (cmds) |cmd, i| { comptime var dummy: types[i] = undefined; switch (cmd) { .field => if (@hasField(types[i], cmd.field) or @hasDecl(types[i], cmd.field)) { types = types ++ [_]type{@TypeOf(@field(dummy, cmd.field))}; } else comptime showError("type {} has no field or public decl '{s}'", .{ types[i], cmd.field }), .func => if (@hasField(types[i], cmd.func[0]) or @hasDecl(types[i], cmd.func[0])) { const T = @TypeOf(@field(dummy, cmd.func[0])); types = types ++ [_]type{T}; } else comptime showError("type {} has no public decl '{s}'", .{ types[i], cmd.func[0] }), else => todo("support {s} command type", .{std.meta.tagName(cmd)}), } } const Tuple = std.meta.Tuple(types); comptime var tuple: Tuple = undefined; // assign nested values until we find one to write tuple[0] = args; inline for (std.meta.fields(Tuple)[1..]) |_, fi| { const field = switch (cmds[fi]) { .field => @field(tuple[fi], cmds[fi].field), // TODO: function arguments // TODO: support func.fields .func => @call(.{}, @field(tuple[fi], cmds[fi].func[0]), .{}), else => todo("unsupported command type {}", .{cmds[fi]}), }; const ti = @typeInfo(@TypeOf(field)); switch (ti) { .Struct, .Union, .Enum => tuple[fi + 1] = field, else => { // TODO: verify field is a string or use another method like print or std.fmt.formatType _ = try writer.write(field); break; }, } } // std.debug.print("{}\n", .{tuple}); } pub const BufPrintError = error{ DuplicateKey, InvalidConditionType } || std.io.FixedBufferStream([]u8).WriteError; fn bufPrintImpl(comptime scopes: []const []const ScopeEntry, comptime nodes: []const Node, writer: anytype, args: anytype) BufPrintError!void { comptime var i: comptime_int = 0; inline while (i < nodes.len) : (i += 1) { const node = nodes[i]; // std.debug.print( // "bufPrintImpl node {}:{} i {} scopes.len {}\n", // .{ std.meta.activeTag(node), node, i, scopes.len }, // ); switch (node) { .text => _ = try writer.write(node.text), .action => { if (node.action.cmds.len == 0 and node.action.decls.len == 0) @compileError("no commands or declarations present"); if (node.action.decls.len != 0) todo("support action.decls", .{}); if (node.action.cmds.len == 0) @compileError("action with no commands"); const first_cmd = node.action.cmds[0]; switch (first_cmd) { .field, .func => try writeNestedCmdFields(node.action.cmds, writer, args), .constant => _ = try writer.write(first_cmd.constant), .variable => { // search scopes inline for (scopes) |scope| { inline for (scope) |entry| { // std.debug.print("searching scopes for '{s}' action '{s}'\n", .{ entry.key, node.action }); if (memeql(entry.key, first_cmd.variable)) { // std.debug.print("found scope entry {s} {}\n", .{ entry.key, entry.value }); _ = try writer.print("{}", .{entry.value}); } } } }, .interval => unreachable, } }, .range => { if (node.range.pipeline) |pipeline| { if (pipeline.is_assign and pipeline.decls.len == 2) { std.debug.assert(pipeline.cmds.len == 1); if (pipeline.cmds[0] == .interval) { const idx_name = pipeline.decls[0]; const item_name = pipeline.decls[1]; comptime var item = pipeline.cmds[0].interval.start; comptime var index: usize = 0; inline while (item <= pipeline.cmds[0].interval.end) : ({ item += 1; index += 1; }) { // std.debug.print("item {} index {}\n", .{ item, index }); const new_scope_entries = [_]ScopeEntry{ .{ .key = item_name, .value = item }, .{ .key = idx_name, .value = index }, }; try bufPrintImpl( try appendScope(scopes, &new_scope_entries), node.range.list.?.root, writer, args, ); } } else if (pipeline.cmds[0] == .field) { const idx_name = pipeline.decls[0]; const item_name = pipeline.decls[1]; const items = @field(args, pipeline.cmds[0].field); inline for (items) |item, index| { const new_scope_entries = [_]ScopeEntry{ .{ .key = item_name, .value = item }, .{ .key = idx_name, .value = index }, }; try bufPrintImpl( try appendScope(scopes, &new_scope_entries), node.range.list.?.root, writer, args, ); } } else showError("unsupported range command", .{}); } else { std.debug.assert(pipeline.cmds.len == 1); if (pipeline.cmds[0] == .interval) { const item_name = pipeline.decls[0]; comptime var item = pipeline.cmds[0].interval.start; inline while (item <= pipeline.cmds[0].interval.end) : ({ item += 1; }) { // std.debug.print("item {} index {}\n", .{ item, index }); const new_scope_entries = [_]ScopeEntry{.{ .key = item_name, .value = item }}; try bufPrintImpl( try appendScope(scopes, &new_scope_entries), node.range.list.?.root, writer, args, ); } } else if (pipeline.cmds[0] == .field) { const items = @field(args, pipeline.cmds[0].field); inline for (items) |item| { // std.debug.print("item {} index {}\n", .{ item, index }); const item_name = pipeline.decls[0]; const new_scope_entries = [_]ScopeEntry{.{ .key = item_name, .value = item }}; try bufPrintImpl( try appendScope(scopes, &new_scope_entries), node.range.list.?.root, writer, args, ); } } else comptime showError("unsupported range command {}", .{pipeline.cmds[0]}); } } }, .if_ => { const field = node.if_.pipeline.?.cmds[0].field; const condition = if (@hasField(@TypeOf(args), field)) @field(args, field) else null; if (!try empty(condition)) try bufPrintImpl(scopes, node.if_.list.?.root, writer, args) else if (node.if_.else_list) |else_list| try bufPrintImpl(scopes, else_list.root, writer, args); }, .else_, .end => unreachable, } } } // TODO: review rules for truthiness // TODO: support maps fn empty(value: anytype) !bool { const V = @TypeOf(value); const vti = @typeInfo(V); return switch (vti) { .Int, .Float, .ComptimeInt, .ComptimeFloat => value == 0, .Pointer => switch (vti.Pointer.size) { .One => empty(value.*), .Slice => value.len == 0, else => error.InvalidConditionType, // other types to consider: .Many, .C }, .Optional => value == null or empty(value.?), .Bool => !value, .Array, .Vector => value.len == 0, .Null => true, else => if (@hasField(V, "len") or @hasDecl(V, "len")) value.len == 0 else error.InvalidConditionType, // other types to consider: .Void, .Struct, .Union, .Enum, .EnumLiteral }; } const ScopeEntry = struct { key: []const u8, value: anytype }; pub fn allocPrint(allocator: *mem.Allocator, args: anytype) ![]u8 { var writer = std.io.countingWriter(std.io.null_writer); comptime var scopes: []const []const ScopeEntry = &[_][]const ScopeEntry{}; try bufPrintImpl(scopes, tree.root, writer.writer(), args); const buf = try allocator.alloc(u8, writer.bytes_written); return try bufPrint(buf, args); } fn appendScope(comptime scopes: []const []const ScopeEntry, comptime entries: []const ScopeEntry) ![]const []const ScopeEntry { for (scopes) |scope| for (scope) |entry| for (entries) |newentry| if (memeql(entry.key, newentry.key)) return error.DuplicateKey; return scopes ++ [_][]const ScopeEntry{entries}; } }; } fn StrHasher(comptime min_bytes: usize) type { return struct { const byte_len = std.math.ceilPowerOfTwo(usize, min_bytes) catch |e| @compileError("invalid min_bytes: " ++ @errorName(e)); const I = std.meta.Int(.unsigned, byte_len * 8); fn case(comptime src: []const u8) I { if (src.len > byte_len) @compileError("String too long"); return comptime match(src) catch |e| @compileError("Error: " ++ @errorName(e)); } fn match(src: []const u8) !I { if (src.len > byte_len) return error.StringTooLong; var dest = [1]u8{0} ** byte_len; std.mem.copy(u8, &dest, src); return std.mem.readIntNative(I, &dest); } }; } inline fn memeql(a: []const u8, comptime b: []const u8) bool { // const Sh = StrHasher(b.len); // return (comptime Sh.case(b)) == Sh.match(a) catch return false; return mem.eql(u8, a, b); } test "main tests" { _ = @import("tests.zig"); } test "string match" { const E = enum { a = 1, ab = 2, abc = 3, inv = 0, const Self = @This(); pub fn fromStr(s: []const u8) !?Self { const strhasher = StrHasher(4); inline for (std.meta.fields(Self)) |f| if (strhasher.case(f.name) == try strhasher.match(s)) return @field(Self, f.name); return null; } }; const Sh = StrHasher(4); for ([_][]const u8{ "a", "ab", "abc", "inv" }) |name| { const hash = try Sh.match(name); const e: E = switch (hash) { Sh.case("a") => .a, Sh.case("ab") => .ab, Sh.case("abc") => .abc, Sh.case("inv") => .inv, else => unreachable, }; std.testing.expectEqual(try E.fromStr(name), e); } } test "end" { const text = "{{ end }}"; const tree = comptime parseNodes(text); std.testing.expectEqual(tree.len, 1); std.testing.expect(tree[0] == .end); }
src/template.zig
const std = @import("std"); pub const ASTInterpreterError = error{OutOfMemory}; pub const ASTInterpreter = struct { output: std.ArrayList(u8), globals: std.StringHashMap(NodeValue), const Self = @This(); pub fn init(allocator: std.mem.Allocator) Self { return ASTInterpreter{ .output = std.ArrayList(u8).init(allocator), .globals = std.StringHashMap(NodeValue).init(allocator), }; } // Returning `NodeValue` from this function looks suboptimal and this should // probably be a separate type. pub fn interp(self: *Self, tree: ?*Tree) ASTInterpreterError!?NodeValue { if (tree) |t| { switch (t.typ) { .sequence => { _ = try self.interp(t.left); _ = try self.interp(t.right); }, .assign => try self.globals.put( t.left.?.value.?.string, (try self.interp(t.right)).?, ), .identifier => return self.globals.get(t.value.?.string).?, .kw_while => { while ((try self.interp(t.left)).?.integer != 0) { _ = try self.interp(t.right); } }, .kw_if => { const condition = (try self.interp(t.left)).?.integer; if (condition == 1) { _ = try self.interp(t.right.?.left); } else { _ = try self.interp(t.right.?.right); } }, .less => return NodeValue{ .integer = try self.binOp(less, t.left, t.right) }, .less_equal => return NodeValue{ .integer = try self.binOp(less_equal, t.left, t.right) }, .greater => return NodeValue{ .integer = try self.binOp(greater, t.left, t.right) }, .greater_equal => return NodeValue{ .integer = try self.binOp(greater_equal, t.left, t.right) }, .add => return NodeValue{ .integer = try self.binOp(add, t.left, t.right) }, .subtract => return NodeValue{ .integer = try self.binOp(sub, t.left, t.right) }, .multiply => return NodeValue{ .integer = try self.binOp(mul, t.left, t.right) }, .divide => return NodeValue{ .integer = try self.binOp(div, t.left, t.right) }, .mod => return NodeValue{ .integer = try self.binOp(mod, t.left, t.right) }, .equal => return NodeValue{ .integer = try self.binOp(equal, t.left, t.right) }, .not_equal => return NodeValue{ .integer = try self.binOp(not_equal, t.left, t.right) }, .bool_and => return NodeValue{ .integer = try self.binOp(@"and", t.left, t.right) }, .bool_or => return NodeValue{ .integer = try self.binOp(@"or", t.left, t.right) }, .negate => return NodeValue{ .integer = -(try self.interp(t.left)).?.integer }, .not => { const arg = (try self.interp(t.left)).?.integer; const result: i32 = if (arg == 0) 1 else 0; return NodeValue{ .integer = result }; }, .prts => _ = try self.out("{s}", .{(try self.interp(t.left)).?.string}), .prti => _ = try self.out("{d}", .{(try self.interp(t.left)).?.integer}), .prtc => _ = try self.out("{c}", .{@intCast(u8, (try self.interp(t.left)).?.integer)}), .string => return t.value, .integer => return t.value, .unknown => { std.debug.print("\nINTERP: UNKNOWN {}\n", .{t}); std.os.exit(1); }, } } return null; } pub fn out(self: *Self, comptime format: []const u8, args: anytype) ASTInterpreterError!void { try self.output.writer().print(format, args); } fn binOp( self: *Self, func: fn (a: i32, b: i32) i32, a: ?*Tree, b: ?*Tree, ) ASTInterpreterError!i32 { return func( (try self.interp(a)).?.integer, (try self.interp(b)).?.integer, ); } fn less(a: i32, b: i32) i32 { return @boolToInt(a < b); } fn less_equal(a: i32, b: i32) i32 { return @boolToInt(a <= b); } fn greater(a: i32, b: i32) i32 { return @boolToInt(a > b); } fn greater_equal(a: i32, b: i32) i32 { return @boolToInt(a >= b); } fn equal(a: i32, b: i32) i32 { return @boolToInt(a == b); } fn not_equal(a: i32, b: i32) i32 { return @boolToInt(a != b); } fn add(a: i32, b: i32) i32 { return a + b; } fn sub(a: i32, b: i32) i32 { return a - b; } fn mul(a: i32, b: i32) i32 { return a * b; } fn div(a: i32, b: i32) i32 { return @divTrunc(a, b); } fn mod(a: i32, b: i32) i32 { return @mod(a, b); } fn @"or"(a: i32, b: i32) i32 { return @boolToInt((a != 0) or (b != 0)); } fn @"and"(a: i32, b: i32) i32 { return @boolToInt((a != 0) and (b != 0)); } }; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); var arg_it = std.process.args(); _ = try arg_it.next(allocator) orelse unreachable; // program name const file_name = arg_it.next(allocator); // We accept both files and standard input. var file_handle = blk: { if (file_name) |file_name_delimited| { const fname: []const u8 = try file_name_delimited; break :blk try std.fs.cwd().openFile(fname, .{}); } else { break :blk std.io.getStdIn(); } }; defer file_handle.close(); const input_content = try file_handle.readToEndAlloc(allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, input_content, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const result: []const u8 = ast_interpreter.output.items; _ = try std.io.getStdOut().write(result); } pub const NodeType = enum { unknown, identifier, string, integer, sequence, kw_if, prtc, prts, prti, kw_while, assign, negate, not, multiply, divide, mod, add, subtract, less, less_equal, greater, greater_equal, equal, not_equal, bool_and, bool_or, const from_string_map = std.ComptimeStringMap(NodeType, .{ .{ "UNKNOWN", .unknown }, .{ "Identifier", .identifier }, .{ "String", .string }, .{ "Integer", .integer }, .{ "Sequence", .sequence }, .{ "If", .kw_if }, .{ "Prtc", .prtc }, .{ "Prts", .prts }, .{ "Prti", .prti }, .{ "While", .kw_while }, .{ "Assign", .assign }, .{ "Negate", .negate }, .{ "Not", .not }, .{ "Multiply", .multiply }, .{ "Divide", .divide }, .{ "Mod", .mod }, .{ "Add", .add }, .{ "Subtract", .subtract }, .{ "Less", .less }, .{ "LessEqual", .less_equal }, .{ "Greater", .greater }, .{ "GreaterEqual", .greater_equal }, .{ "Equal", .equal }, .{ "NotEqual", .not_equal }, .{ "And", .bool_and }, .{ "Or", .bool_or }, }); pub fn fromString(str: []const u8) NodeType { return from_string_map.get(str).?; } }; pub const NodeValue = union(enum) { integer: i32, string: []const u8, }; pub const Tree = struct { left: ?*Tree, right: ?*Tree, typ: NodeType = .unknown, value: ?NodeValue = null, fn makeNode(allocator: std.mem.Allocator, typ: NodeType, left: ?*Tree, right: ?*Tree) !*Tree { const result = try allocator.create(Tree); result.* = Tree{ .left = left, .right = right, .typ = typ }; return result; } fn makeLeaf(allocator: std.mem.Allocator, typ: NodeType, value: ?NodeValue) !*Tree { const result = try allocator.create(Tree); result.* = Tree{ .left = null, .right = null, .typ = typ, .value = value }; return result; } }; const LoadASTError = error{OutOfMemory} || std.fmt.ParseIntError; fn loadAST( allocator: std.mem.Allocator, str: []const u8, string_pool: *std.ArrayList([]const u8), ) LoadASTError!?*Tree { var line_it = std.mem.split(u8, str, "\n"); return try loadASTHelper(allocator, &line_it, string_pool); } fn loadASTHelper( allocator: std.mem.Allocator, line_it: *std.mem.SplitIterator(u8), string_pool: *std.ArrayList([]const u8), ) LoadASTError!?*Tree { if (line_it.next()) |line| { var tok_it = std.mem.tokenize(u8, line, " "); const tok_str = tok_it.next().?; if (tok_str[0] == ';') return null; const node_type = NodeType.fromString(tok_str); const pre_iteration_index = tok_it.index; if (tok_it.next()) |leaf_value| { const node_value = blk: { switch (node_type) { .integer => break :blk NodeValue{ .integer = try std.fmt.parseInt(i32, leaf_value, 10) }, .identifier => break :blk NodeValue{ .string = leaf_value }, .string => { tok_it.index = pre_iteration_index; const str = tok_it.rest(); var string_literal = try std.ArrayList(u8).initCapacity(allocator, str.len); var escaped = false; // Truncate double quotes for (str[1 .. str.len - 1]) |ch| { if (escaped) { escaped = false; switch (ch) { 'n' => try string_literal.append('\n'), '\\' => try string_literal.append('\\'), else => unreachable, } } else { switch (ch) { '\\' => escaped = true, else => try string_literal.append(ch), } } } try string_pool.append(string_literal.items); break :blk NodeValue{ .string = string_literal.items }; }, else => unreachable, } }; return try Tree.makeLeaf(allocator, node_type, node_value); } const left = try loadASTHelper(allocator, line_it, string_pool); const right = try loadASTHelper(allocator, line_it, string_pool); return try Tree.makeNode(allocator, node_type, left, right); } else { return null; } } const testing = std.testing; test "examples" { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); { const example_input_path = "examples/parsed0.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output0.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed1.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output1.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed3.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output3.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed4.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output4.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed5.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output5.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed6.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output6.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed7.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output7.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed8.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output8.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed9.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output9.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed10.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output10.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed11.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output11.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed12.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output12.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed13.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output13.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } { const example_input_path = "examples/parsed14.txt"; var file_input = try std.fs.cwd().openFile(example_input_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_input); const content_input = try std.fs.File.readToEndAlloc(file_input, allocator, std.math.maxInt(usize)); const example_output_path = "examples/output14.txt"; var file_output = try std.fs.cwd().openFile(example_output_path, std.fs.File.OpenFlags{}); defer std.fs.File.close(file_output); const content_output = try std.fs.File.readToEndAlloc(file_output, allocator, std.math.maxInt(usize)); var string_pool = std.ArrayList([]const u8).init(allocator); const ast = try loadAST(allocator, content_input, &string_pool); var ast_interpreter = ASTInterpreter.init(allocator); _ = try ast_interpreter.interp(ast); const pretty_output: []const u8 = ast_interpreter.output.items; try testing.expectFmt(content_output, "{s}", .{pretty_output}); } }
ast_interpreter.zig
const types = @import("types.zig"); usingnamespace @import("method.zig"); const mailbox = struct { pub const Record = struct { id: types.Id, name: []const u8, parent_id: ?types.Id, role: ?[]const u8, sort_order: types.UnsignedInt = 0, total_emails: types.UnsignedInt, unread_emails: types.UnsignedInt, total_threads: types.UnsignedInt, unread_threads: types.UnsignedInt, my_rights: MailboxRights, is_subscribed: bool, }; pub const Get = Method(standard.GetRequest, standard.GetResponse); pub const Changes = Method(standard.ChangesRequest, ChangesResponse); pub const Query = Method(QueryRequest, standard.QueryResponse); pub const QueryChanges = Method(standard.QueryChangesRequest, standard.QueryChangesResponse); pub const Set = Method(SetRequest, standard.SetResponse); const MailboxRights = struct { may_read_items: bool, may_add_items: bool, may_remove_items: bool, may_set_seen: bool, may_set_keywords: bool, may_create_child: bool, may_rename: bool, may_delete: bool, may_submit: bool, }; pub const ChangesResponse = struct { account_id: types.Id, old_state: []const u8, new_state: []const u8, has_more_changes: bool, created: []const types.Id, updated: []const types.Id, destroyed: []const types.Id, // extra fields updated_properties: ?[]const []const u8, }; pub const FilterCondition = struct { parent_id: ?types.Id, name: []const u8, role: ?[]const u8, has_any_role: bool, is_subscribed: bool, }; pub const QueryRequest = struct { account_id: types.Id, filter: ?custom_filter(FilterCondition).Filter, sort: ?[]const Comparator, // extra fields sort_as_tree: bool = false, filter_as_tree: bool = false, }; pub const SetRequest = struct { account_id: types.Id, if_in_state: ?[]const u8, create: ?JsonStringMap(T), update: ?json.ObjectMap, destroy: ?[]const types.Id, // extra fields on_destroy_remove_emails: bool = false, pub fn toJson(self: Self, allocator: *Allocator) !Value { var map = ObjectMap.init(allocator); try map.ensureCapacity(6); _ = map.putAssumeCapacity("accountId", js.toJson(self.account_id, allocator)); _ = map.putAssumeCapacity("ifInState", js.toJson(self.if_in_state, allocator)); _ = map.putAssumeCapacity("create", js.toJson(self.create, allocator)); _ = map.putAssumeCapacity("destroy", js.toJson(self.destroy, allocator)); _ = map.putAssumeCapacity("onDestroyRemoveEmails", js.toJson(self.on_destroy_remove_emails, allocator)); const update = if (self.update) |unwrapped| Value{ .Object = unwrapped } else Value{ .Null = {} }; _ = map.putAssumeCapacity("update", update); return Value{ .Object = map }; } }; };
mail/mailbox.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day19_sample.txt"); pub const Scanner = struct { pub const Self = @This(); id: u32, beacons: []const util.Point3d(i32), allocator: *util.Allocator, pub fn deserialize(allocator: *util.Allocator, scanner_data: []const u8) !Self { var beacons = util.List(util.Point3d(i32)).init(allocator); defer beacons.deinit(); var it = std.mem.tokenize(u8, scanner_data, "\n"); // Parse ID var id_data = it.next() orelse return error.InvalidInput; var id_it = std.mem.tokenize(u8, id_data, "scanner -"); var id = util.parseInt(u32, id_it.next() orelse return error.InvalidInput, 10) catch { return error.InvalidInput; }; // Parse points while (it.next()) |line| { var val_it = util.tokenize(u8, line, ","); const x = util.parseInt(i32, val_it.next() orelse return error.InvalidInput, 10) catch { return error.InvalidInput; }; const y = util.parseInt(i32, val_it.next() orelse return error.InvalidInput, 10) catch { return error.InvalidInput; }; const z = util.parseInt(i32, val_it.next() orelse return error.InvalidInput, 10) catch { return error.InvalidInput; }; try beacons.append(util.Point3d(i32){ .x = x, .y = y, .z = z }); } return Self{ .id = id, .beacons = beacons.toOwnedSlice(), .allocator = allocator, }; } pub fn deinit(self: *Self) void { self.allocator.free(self.beacons); } }; pub fn main() !void { defer { const leaks = util.gpa_impl.deinit(); std.debug.assert(!leaks); } var scanners = util.List(Scanner).init(util.gpa); defer { for (scanners.items) |*scanner| { scanner.deinit(); } scanners.deinit(); } // Parse scanners from input var it = util.split(u8, data, "\n\n"); while (it.next()) |scanner_data| { const scanner = try Scanner.deserialize(util.gpa, scanner_data); try scanners.append(scanner); } // Check each scanner for potential overlap for (scanners.items) |*scanner1, idx| { for (scanners.items[idx + 1 ..]) |*scanner2| { // For each pair of scanners, iterate through all orientations } } }
src/day19.zig
const std = @import("std"); const builtin = @import("builtin"); const Pkg = std.build.Pkg; const string = []const u8; pub const cache = ".zigmod/deps"; pub fn addAllTo(exe: *std.build.LibExeObjStep) void { @setEvalBranchQuota(1_000_000); for (packages) |pkg| { exe.addPackage(pkg.pkg.?); } var llc = false; var vcpkg = false; inline for (std.meta.declarations(package_data)) |decl| { const pkg = @as(Package, @field(package_data, decl.name)); inline for (pkg.system_libs) |item| { exe.linkSystemLibrary(item); llc = true; } inline for (pkg.c_include_dirs) |item| { exe.addIncludeDir(@field(dirs, decl.name) ++ "/" ++ item); llc = true; } inline for (pkg.c_source_files) |item| { exe.addCSourceFile(@field(dirs, decl.name) ++ "/" ++ item, pkg.c_source_flags); llc = true; } } if (llc) exe.linkLibC(); if (builtin.os.tag == .windows and vcpkg) exe.addVcpkgPaths(.static) catch |err| @panic(@errorName(err)); } pub const Package = struct { directory: string, pkg: ?Pkg = null, c_include_dirs: []const string = &.{}, c_source_files: []const string = &.{}, c_source_flags: []const string = &.{}, system_libs: []const string = &.{}, vcpkg: bool = false, }; const dirs = struct { pub const _root = ""; pub const _89ujp8gq842x = cache ++ "/../.."; pub const _8mdbh0zuneb0 = cache ++ "/v/git/github.com/yaml/libyaml/tag-0.2.5"; pub const _csbnipaad8n7 = cache ++ "/git/github.com/nektro/iguanaTLS"; pub const _s84v9o48ucb0 = cache ++ "/git/github.com/nektro/zig-ansi"; pub const _2ta738wrqbaq = cache ++ "/git/github.com/ziglibs/known-folders"; pub const _0npcrzfdlrvk = cache ++ "/git/github.com/nektro/zig-licenses"; pub const _ejw82j2ipa0e = cache ++ "/git/github.com/truemedian/zfetch"; pub const _9k24gimke1an = cache ++ "/git/github.com/truemedian/hzzp"; pub const _yyhw90zkzgmu = cache ++ "/git/github.com/MasterQ32/zig-network"; pub const _u9w9dpp6p804 = cache ++ "/git/github.com/MasterQ32/zig-uri"; pub const _ocmr9rtohgcc = cache ++ "/git/github.com/nektro/zig-json"; pub const _f7dubzb7cyqe = cache ++ "/git/github.com/nektro/zig-extras"; pub const _tnj3qf44tpeq = cache ++ "/git/github.com/nektro/zig-range"; pub const _2ovav391ivak = cache ++ "/git/github.com/nektro/zig-detect-license"; pub const _pt88y5d80m25 = cache ++ "/git/github.com/nektro/zig-licenses-text"; pub const _96h80ezrvj7i = cache ++ "/git/github.com/nektro/zig-leven"; pub const _qyrnfg0iwpzl = cache ++ "/git/github.com/nektro/zig-fs-check"; pub const _c1xirp1ota5p = cache ++ "/git/github.com/nektro/zig-inquirer"; pub const _u7sysdckdymi = cache ++ "/git/github.com/arqv/ini"; pub const _o6ogpor87xc2 = cache ++ "/git/github.com/marlersoft/zigwin32"; }; pub const package_data = struct { pub const _8mdbh0zuneb0 = Package{ .directory = dirs._8mdbh0zuneb0, .c_include_dirs = &.{ "include" }, .c_source_files = &.{ "src/api.c", "src/dumper.c", "src/emitter.c", "src/loader.c", "src/parser.c", "src/reader.c", "src/scanner.c", "src/writer.c" }, .c_source_flags = &.{ "-DYAML_VERSION_MAJOR=0", "-DYAML_VERSION_MINOR=2", "-DYAML_VERSION_PATCH=5", "-DYAML_VERSION_STRING=\"0.2.5\"", "-DYAML_DECLARE_STATIC=1" }, }; pub const _csbnipaad8n7 = Package{ .directory = dirs._csbnipaad8n7, .pkg = Pkg{ .name = "iguanaTLS", .path = .{ .path = dirs._csbnipaad8n7 ++ "/src/main.zig" }, .dependencies = null }, }; pub const _s84v9o48ucb0 = Package{ .directory = dirs._s84v9o48ucb0, .pkg = Pkg{ .name = "ansi", .path = .{ .path = dirs._s84v9o48ucb0 ++ "/src/lib.zig" }, .dependencies = null }, }; pub const _2ta738wrqbaq = Package{ .directory = dirs._2ta738wrqbaq, .pkg = Pkg{ .name = "known-folders", .path = .{ .path = dirs._2ta738wrqbaq ++ "/known-folders.zig" }, .dependencies = null }, }; pub const _0npcrzfdlrvk = Package{ .directory = dirs._0npcrzfdlrvk, .pkg = Pkg{ .name = "licenses", .path = .{ .path = dirs._0npcrzfdlrvk ++ "/src/lib.zig" }, .dependencies = null }, }; pub const _9k24gimke1an = Package{ .directory = dirs._9k24gimke1an, .pkg = Pkg{ .name = "hzzp", .path = .{ .path = dirs._9k24gimke1an ++ "/src/main.zig" }, .dependencies = null }, }; pub const _yyhw90zkzgmu = Package{ .directory = dirs._yyhw90zkzgmu, .pkg = Pkg{ .name = "network", .path = .{ .path = dirs._yyhw90zkzgmu ++ "/network.zig" }, .dependencies = null }, }; pub const _u9w9dpp6p804 = Package{ .directory = dirs._u9w9dpp6p804, .pkg = Pkg{ .name = "uri", .path = .{ .path = dirs._u9w9dpp6p804 ++ "/uri.zig" }, .dependencies = null }, }; pub const _ejw82j2ipa0e = Package{ .directory = dirs._ejw82j2ipa0e, .pkg = Pkg{ .name = "zfetch", .path = .{ .path = dirs._ejw82j2ipa0e ++ "/src/main.zig" }, .dependencies = &.{ _9k24gimke1an.pkg.?, _csbnipaad8n7.pkg.?, _yyhw90zkzgmu.pkg.?, _u9w9dpp6p804.pkg.? } }, }; pub const _tnj3qf44tpeq = Package{ .directory = dirs._tnj3qf44tpeq, .pkg = Pkg{ .name = "range", .path = .{ .path = dirs._tnj3qf44tpeq ++ "/src/lib.zig" }, .dependencies = null }, }; pub const _f7dubzb7cyqe = Package{ .directory = dirs._f7dubzb7cyqe, .pkg = Pkg{ .name = "extras", .path = .{ .path = dirs._f7dubzb7cyqe ++ "/src/lib.zig" }, .dependencies = &.{ _tnj3qf44tpeq.pkg.? } }, }; pub const _ocmr9rtohgcc = Package{ .directory = dirs._ocmr9rtohgcc, .pkg = Pkg{ .name = "json", .path = .{ .path = dirs._ocmr9rtohgcc ++ "/src/lib.zig" }, .dependencies = &.{ _f7dubzb7cyqe.pkg.? } }, }; pub const _pt88y5d80m25 = Package{ .directory = dirs._pt88y5d80m25, .pkg = Pkg{ .name = "licenses-text", .path = .{ .path = dirs._pt88y5d80m25 ++ "/src/lib.zig" }, .dependencies = null }, }; pub const _96h80ezrvj7i = Package{ .directory = dirs._96h80ezrvj7i, .pkg = Pkg{ .name = "leven", .path = .{ .path = dirs._96h80ezrvj7i ++ "/src/lib.zig" }, .dependencies = &.{ _tnj3qf44tpeq.pkg.? } }, }; pub const _qyrnfg0iwpzl = Package{ .directory = dirs._qyrnfg0iwpzl, .pkg = Pkg{ .name = "fs-check", .path = .{ .path = dirs._qyrnfg0iwpzl ++ "/src/lib.zig" }, .dependencies = null }, }; pub const _2ovav391ivak = Package{ .directory = dirs._2ovav391ivak, .pkg = Pkg{ .name = "detect-license", .path = .{ .path = dirs._2ovav391ivak ++ "/src/lib.zig" }, .dependencies = &.{ _pt88y5d80m25.pkg.?, _96h80ezrvj7i.pkg.?, _qyrnfg0iwpzl.pkg.? } }, }; pub const _c1xirp1ota5p = Package{ .directory = dirs._c1xirp1ota5p, .pkg = Pkg{ .name = "inquirer", .path = .{ .path = dirs._c1xirp1ota5p ++ "/src/lib.zig" }, .dependencies = &.{ _s84v9o48ucb0.pkg.?, _tnj3qf44tpeq.pkg.? } }, }; pub const _u7sysdckdymi = Package{ .directory = dirs._u7sysdckdymi, .pkg = Pkg{ .name = "ini", .path = .{ .path = dirs._u7sysdckdymi ++ "/src/ini.zig" }, .dependencies = null }, }; pub const _89ujp8gq842x = Package{ .directory = dirs._89ujp8gq842x, .pkg = Pkg{ .name = "zigmod", .path = .{ .path = dirs._89ujp8gq842x ++ "/src/lib.zig" }, .dependencies = &.{ _csbnipaad8n7.pkg.?, _s84v9o48ucb0.pkg.?, _2ta738wrqbaq.pkg.?, _0npcrzfdlrvk.pkg.?, _ejw82j2ipa0e.pkg.?, _ocmr9rtohgcc.pkg.?, _tnj3qf44tpeq.pkg.?, _2ovav391ivak.pkg.?, _c1xirp1ota5p.pkg.?, _u7sysdckdymi.pkg.? } }, }; pub const _o6ogpor87xc2 = Package{ .directory = dirs._o6ogpor87xc2, .pkg = Pkg{ .name = "win32", .path = .{ .path = dirs._o6ogpor87xc2 ++ "/win32.zig" }, .dependencies = null }, }; pub const _root = Package{ .directory = dirs._root, }; }; pub const packages = &[_]Package{ package_data._89ujp8gq842x, package_data._o6ogpor87xc2, }; pub const pkgs = struct { pub const zigmod = package_data._89ujp8gq842x; pub const win32 = package_data._o6ogpor87xc2; }; pub const imports = struct { };
deps.zig
const uefi = @import("std").os.uefi; const Guid = uefi.Guid; const Event = uefi.Event; const Status = uefi.Status; const Time = uefi.Time; const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; const MacAddress = uefi.protocols.MacAddress; pub const ManagedNetworkProtocol = extern struct { _get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status, _configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) Status, _mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) Status, _groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) Status, _transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status, _receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status, _cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) Status, _poll: extern fn (*const ManagedNetworkProtocol) usize, /// Returns the operational parameters for the current MNP child driver. /// May also support returning the underlying SNP driver mode data. pub fn getModeData(self: *const ManagedNetworkProtocol, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { return self._get_mode_data(self, mnp_config_data, snp_mode_data); } /// Sets or clears the operational parameters for the MNP child driver. pub fn configure(self: *const ManagedNetworkProtocol, mnp_config_data: ?*const ManagedNetworkConfigData) Status { return self._configure(self, mnp_config_data); } /// Translates an IP multicast address to a hardware (MAC) multicast address. /// This function may be unsupported in some MNP implementations. pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const c_void, mac_address: *MacAddress) Status { return self._mcast_ip_to_mac(self, ipv6flag, ipaddress); } /// Enables and disables receive filters for multicast address. /// This function may be unsupported in some MNP implementations. pub fn groups(self: *const ManagedNetworkProtocol, join_flag: bool, mac_address: ?*const MacAddress) Status { return self._groups(self, join_flag, mac_address); } /// Places asynchronous outgoing data packets into the transmit queue. pub fn transmit(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status { return self._transmit(self, token); } /// Places an asynchronous receiving request into the receiving queue. pub fn receive(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status { return self._receive(self, token); } /// Aborts an asynchronous transmit or receive request. pub fn cancel(self: *const ManagedNetworkProtocol, token: ?*const ManagedNetworkCompletionToken) Status { return self._cancel(self, token); } /// Polls for incoming data packets and processes outgoing data packets. pub fn poll(self: *const ManagedNetworkProtocol) Status { return self._poll(self); } pub const guid align(8) = Guid{ .time_low = 0x7ab33a91, .time_mid = 0xace5, .time_high_and_version = 0x4326, .clock_seq_high_and_reserved = 0xb5, .clock_seq_low = 0x72, .node = [_]u8{ 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 }, }; }; pub const ManagedNetworkConfigData = extern struct { received_queue_timeout_value: u32, transmit_queue_timeout_value: u32, protocol_type_filter: u16, enable_unicast_receive: bool, enable_multicast_receive: bool, enable_broadcast_receive: bool, enable_promiscuous_receive: bool, flush_queues_on_reset: bool, enable_receive_timestamps: bool, disable_background_polling: bool, }; pub const ManagedNetworkCompletionToken = extern struct { event: Event, status: Status, packet: extern union { RxData: *ManagedNetworkReceiveData, TxData: *ManagedNetworkTransmitData, }, }; pub const ManagedNetworkReceiveData = extern struct { timestamp: Time, recycle_event: Event, packet_length: u32, header_length: u32, address_length: u32, data_length: u32, broadcast_flag: bool, multicast_flag: bool, promiscuous_flag: bool, protocol_type: u16, destination_address: [*]u8, source_address: [*]u8, media_header: [*]u8, packet_data: [*]u8, }; pub const ManagedNetworkTransmitData = extern struct { destination_address: ?*MacAddress, source_address: ?*MacAddress, protocol_type: u16, data_length: u32, header_length: u16, fragment_count: u16, pub fn getFragments(self: *ManagedNetworkTransmitData) []ManagedNetworkFragmentData { return @ptrCast([*]ManagedNetworkFragmentData, @ptrCast([*]u8, self) + @sizeOf(ManagedNetworkTransmitData))[0..self.fragment_count]; } }; pub const ManagedNetworkFragmentData = extern struct { fragment_length: u32, fragment_buffer: [*]u8, };
lib/std/os/uefi/protocols/managed_network_protocol.zig
const std = @import("../index.zig"); const builtin = @import("builtin"); const assert = std.debug.assert; const mem = std.mem; const AtomicRmwOp = builtin.AtomicRmwOp; const AtomicOrder = builtin.AtomicOrder; const Loop = std.event.Loop; /// Thread-safe async/await lock. /// coroutines which are waiting for the lock are suspended, and /// are resumed when the lock is released, in order. /// Allows only one actor to hold the lock. pub const Lock = struct { loop: *Loop, shared_bit: u8, // TODO make this a bool queue: Queue, queue_empty_bit: u8, // TODO make this a bool const Queue = std.atomic.Queue(promise); pub const Held = struct { lock: *Lock, pub fn release(self: Held) void { // Resume the next item from the queue. if (self.lock.queue.get()) |node| { self.lock.loop.onNextTick(node); return; } // We need to release the lock. _ = @atomicRmw(u8, &self.lock.queue_empty_bit, AtomicRmwOp.Xchg, 1, AtomicOrder.SeqCst); _ = @atomicRmw(u8, &self.lock.shared_bit, AtomicRmwOp.Xchg, 0, AtomicOrder.SeqCst); // There might be a queue item. If we know the queue is empty, we can be done, // because the other actor will try to obtain the lock. // But if there's a queue item, we are the actor which must loop and attempt // to grab the lock again. if (@atomicLoad(u8, &self.lock.queue_empty_bit, AtomicOrder.SeqCst) == 1) { return; } while (true) { const old_bit = @atomicRmw(u8, &self.lock.shared_bit, AtomicRmwOp.Xchg, 1, AtomicOrder.SeqCst); if (old_bit != 0) { // We did not obtain the lock. Great, the queue is someone else's problem. return; } // Resume the next item from the queue. if (self.lock.queue.get()) |node| { self.lock.loop.onNextTick(node); return; } // Release the lock again. _ = @atomicRmw(u8, &self.lock.queue_empty_bit, AtomicRmwOp.Xchg, 1, AtomicOrder.SeqCst); _ = @atomicRmw(u8, &self.lock.shared_bit, AtomicRmwOp.Xchg, 0, AtomicOrder.SeqCst); // Find out if we can be done. if (@atomicLoad(u8, &self.lock.queue_empty_bit, AtomicOrder.SeqCst) == 1) { return; } } } }; pub fn init(loop: *Loop) Lock { return Lock{ .loop = loop, .shared_bit = 0, .queue = Queue.init(), .queue_empty_bit = 1, }; } pub fn initLocked(loop: *Loop) Lock { return Lock{ .loop = loop, .shared_bit = 1, .queue = Queue.init(), .queue_empty_bit = 1, }; } /// Must be called when not locked. Not thread safe. /// All calls to acquire() and release() must complete before calling deinit(). pub fn deinit(self: *Lock) void { assert(self.shared_bit == 0); while (self.queue.get()) |node| cancel node.data; } pub async fn acquire(self: *Lock) Held { // TODO explicitly put this memory in the coroutine frame #1194 suspend { resume @handle(); } var my_tick_node = Loop.NextTickNode.init(@handle()); errdefer _ = self.queue.remove(&my_tick_node); // TODO test canceling an acquire suspend { self.queue.put(&my_tick_node); // At this point, we are in the queue, so we might have already been resumed and this coroutine // frame might be destroyed. For the rest of the suspend block we cannot access the coroutine frame. // We set this bit so that later we can rely on the fact, that if queue_empty_bit is 1, some actor // will attempt to grab the lock. _ = @atomicRmw(u8, &self.queue_empty_bit, AtomicRmwOp.Xchg, 0, AtomicOrder.SeqCst); const old_bit = @atomicRmw(u8, &self.shared_bit, AtomicRmwOp.Xchg, 1, AtomicOrder.SeqCst); if (old_bit == 0) { if (self.queue.get()) |node| { // Whether this node is us or someone else, we tail resume it. resume node.data; } } } return Held{ .lock = self }; } }; test "std.event.Lock" { // https://github.com/ziglang/zig/issues/1908 if (builtin.single_threaded) return error.SkipZigTest; var da = std.heap.DirectAllocator.init(); defer da.deinit(); const allocator = &da.allocator; var loop: Loop = undefined; try loop.initMultiThreaded(allocator); defer loop.deinit(); var lock = Lock.init(&loop); defer lock.deinit(); const handle = try async<allocator> testLock(&loop, &lock); defer cancel handle; loop.run(); assert(mem.eql(i32, shared_test_data, [1]i32{3 * @intCast(i32, shared_test_data.len)} ** shared_test_data.len)); } async fn testLock(loop: *Loop, lock: *Lock) void { // TODO explicitly put next tick node memory in the coroutine frame #1194 suspend { resume @handle(); } const handle1 = async lockRunner(lock) catch @panic("out of memory"); var tick_node1 = Loop.NextTickNode{ .prev = undefined, .next = undefined, .data = handle1, }; loop.onNextTick(&tick_node1); const handle2 = async lockRunner(lock) catch @panic("out of memory"); var tick_node2 = Loop.NextTickNode{ .prev = undefined, .next = undefined, .data = handle2, }; loop.onNextTick(&tick_node2); const handle3 = async lockRunner(lock) catch @panic("out of memory"); var tick_node3 = Loop.NextTickNode{ .prev = undefined, .next = undefined, .data = handle3, }; loop.onNextTick(&tick_node3); await handle1; await handle2; await handle3; } var shared_test_data = [1]i32{0} ** 10; var shared_test_index: usize = 0; async fn lockRunner(lock: *Lock) void { suspend; // resumed by onNextTick var i: usize = 0; while (i < shared_test_data.len) : (i += 1) { const lock_promise = async lock.acquire() catch @panic("out of memory"); const handle = await lock_promise; defer handle.release(); shared_test_index = 0; while (shared_test_index < shared_test_data.len) : (shared_test_index += 1) { shared_test_data[shared_test_index] = shared_test_data[shared_test_index] + 1; } } }
std/event/lock.zig
const std = @import("std"); const mem = std.mem; const os = std.os; const io = std.io; const fs = std.fs; const csv = @import("csv"); //const fmapper = @import("fmapper.zig"); const log_ctx = @import("log.zig"); const fmtDuration = std.fmt.fmtDuration; const ansi = @import("ansi_esc.zig"); const heap = std.heap; const c = @cImport({ @cInclude("stb_image.h"); }); pub fn forData(comptime Float: type, input_size: [2]usize, output_len: usize) type { const nnet = @import("nnet.zig").typed(Float); return struct { const Self = @This(); pub const file_header: [8]u8 = [_]u8{ 'I', 'M', 'G', 'T', 'D', 'A', 'T', 'A' }; pub const file_version = 0; pub const TestCase = nnet.TestCase(input_size[0] * input_size[1], output_len); pub const TestAccessor = nnet.TestAccessor(TestCase); pub const log = std.log.scoped(.csv_img_dataset); pub const max_name_len = 31; accessor: TestAccessor, arena: heap.ArenaAllocator, // arrays skip arena to be able to actually test_cases: std.ArrayList(TestCase), test_names: std.ArrayList([max_name_len:0]u8), pub fn init(alloc: *std.mem.Allocator) Self { return .{ .arena = heap.ArenaAllocator.init(alloc), .test_cases = std.ArrayList(TestCase).init(alloc), .test_names = std.ArrayList([max_name_len:0]u8).init(alloc), .accessor = .{ .grabFn = Self.getTest, .countFn = getLen }, }; } pub fn deinit(self: *Self) void { self.test_cases.deinit(); self.test_names.deinit(); self.arena.deinit(); } pub fn load(self: *Self, csv_path: []const u8, img_dir_path: []const u8, batch_path: []const u8, from_source_only: bool) !void { if (!from_source_only) { if ( self.loadBatch(batch_path)){ return; // success } else |err| log.warn("Could not load images from batch: {} : fallback to load from sources", .{err}); } // load from sources try self.loadCsv(csv_path); try self.loadImages(img_dir_path); } pub fn loadCsv(self: *Self, path: []const u8) !void { log.info("Loading csv '{s}'", .{path}); var timer = try std.time.Timer.start(); const file = try std.fs.cwd().openFile(path, .{}); defer file.close(); const buffer = try self.arena.child_allocator.alloc(u8, try file.getEndPos()); defer self.arena.child_allocator.free(buffer); const csv_tokenizer = &try csv.CsvTokenizer(std.fs.File.Reader).init(file.reader(), buffer, .{}); const aprox_capacity = buffer.len / 10; try self.test_cases.ensureTotalCapacity(aprox_capacity); try self.test_names.ensureTotalCapacity(aprox_capacity); const err = error{ CsvExpectsOnlyTwoColumns, CsvMissingColumn }; const cols = read_col: { // read header var ci: usize = 0; while (try csv_tokenizer.next()) |tok| : (ci += 1) { if (tok == .row_end) break; } break :read_col ci; }; if (cols < 1) { log.err("Dataset csv requires at least 1 column. cols in csv: {}", .{cols}); return error.WrongHeaderCSV; } if (cols > 2) { log.warn("Dataset uses only 1 or 2 columns! cols: {}", .{cols}); } var i: i32 = 0; while (try csv_tokenizer.next()) |first_token| : (i += 1) { const tc = try self.test_cases.addOne(); const tn = try self.test_names.addOne(); std.mem.copy(u8, tn, first_token.field[0..@minimum(first_token.field.len, max_name_len)]); tn[first_token.field.len] = 0; if (cols > 1) { if (try csv_tokenizer.next()) |tok| { if (tok != .field) { log.alert("Expected field in csv, got end of line!", .{}); return error.MissingValueCSV; } const digit: u8 = std.fmt.parseInt(u8, tok.field, 10) catch |e| { log.alert("CSV can't parse nubmer: `{s}` err: {}", .{ first_token.field, e }); return error.ExpectedNumberCSV; }; var answer_vec = @splat(output_len, @as(Float, 0)); answer_vec[digit] = 1.0; tc.*.answer = answer_vec; } else return err.CsvMissingColumn; } // skip remaining columns while (try csv_tokenizer.next()) |tok| { if (tok == .row_end) break; } } log.info("CSV loaded {} records in {}", .{ self.test_cases.items.len, fmtDuration(timer.lap()) }); } pub fn loadImages(self: *Self, path_prefix: []const u8) !void { var timer = try std.time.Timer.start(); log.info("Loading images from sources...", .{}); const prcent_mod = self.test_cases.items.len / 100; var path_buff: [512]u8 = undefined; mem.copy(u8, path_buff[0..], path_prefix); var tmp_alloc_buff = try self.arena.child_allocator.alloc(u8, input_size[0] * input_size[1] * 4 + 1024); defer self.arena.child_allocator.free(tmp_alloc_buff); var tmp_alloc = heap.FixedBufferAllocator.init(tmp_alloc_buff); for (self.test_cases.items) |_, i| { if (i % prcent_mod == 0) { log.info("Image loading progress: {}%\r", .{i * 100 / self.test_cases.items.len}); log_ctx.log_ctx.out.flush() catch {}; } const img_name = self.getTestName(i); mem.copy(u8, path_buff[path_prefix.len..], img_name[0..]); const path = path_buff[0..(path_prefix.len + img_name.len)]; //debug.print("Loading image `{s}`\n", .{path}); // read whole file const file = std.fs.cwd().openFile(path, .{}) catch |err| { std.debug.panic("Error opening image '{s}': {}", .{ path, err }); }; defer file.close(); const buffer = try tmp_alloc.allocator.alloc(u8, try file.getEndPos()); defer tmp_alloc.allocator.free(buffer); const read_len = try file.readAll(buffer); if (read_len != buffer.len) std.debug.panic("Read different amount of bytes than in file!", .{}); //const map = try fmapper.FMapper.open(path, .{ .mode = .shared }, 0, 0); //defer map.close(); //const buffer = map.memory.?; var w: i32 = 0; var h: i32 = 0; var chanells_in_file: i32 = 1; const desired_channels: i32 = 1; const pixels = c.stbi_load_from_memory(buffer.ptr, @intCast(i32, buffer.len), &w, &h, &chanells_in_file, desired_channels); defer std.c.free(pixels); if (pixels == null) { std.debug.panic("Can't load image {s} filesize: {}", .{ path, buffer.len }); } if (desired_channels == chanells_in_file) { std.debug.panic("Loaded image has different pixel format: conversion not implemented! {}/{}", .{ desired_channels, chanells_in_file }); } if (w != input_size[0] or h != input_size[1]) { std.debug.panic("Wrong image `{s}` size: expected {}x{} got {}x{}", .{ img_name, input_size[0], input_size[1], w, h }); } for (pixels[0..(input_size[0] * input_size[1])]) |pixel, i_pix| { self.test_cases.items[i].input[i_pix] = @intToFloat(Float, pixel) * (1.0 / 255.0); } } log.info("Images loaded from sources in {}", .{ fmtDuration(timer.lap())}); } pub fn getTestName(self : *Self, idx : usize) []const u8 { return mem.sliceTo(&self.test_names.items[idx], 0); } // saves batch training data in single file for faster loading pub fn saveBatch(self: *Self, path: []const u8) !void { log.info("Saving '{s}' batch...", .{path}); const f = try std.fs.cwd().createFile(path, .{ .truncate = true }); defer f.close(); var w = f.writer(); try w.writeAll(file_header[0..]); try w.writeIntLittle(u32, file_version); try w.writeIntLittle(u32, input_size[0]); try w.writeIntLittle(u32, input_size[1]); try w.writeIntLittle(u64, self.test_cases.items.len); if (comptime std.Target.current.cpu.arch.endian() != .Little) { @panic("TODO: Implement endian conversion!"); } try w.writeAll(std.mem.sliceAsBytes(self.test_names.items)); try w.writeAll(std.mem.sliceAsBytes(self.test_cases.items)); log.notice("Batch '{s}' saved for future speedup. Run preprocess when source data is changed!", .{path}); } // loads batched training data pub fn loadBatch(self: *Self, path: []const u8) !void { log.info("Loading batch '{s}'...", .{path}); var timer = try std.time.Timer.start(); const f = try std.fs.cwd().openFile(path, .{}); var r = f.reader(); var header: [file_header.len]u8 = undefined; try r.readNoEof(&header); const err = error{ HeaderMismatch, VersionMismatch, ImageSizeMismatch }; if (!mem.eql(u8, &header, &file_header)) { return err.HeaderMismatch; } const v = try r.readIntLittle(u32); const w = try r.readIntLittle(u32); const h = try r.readIntLittle(u32); if (v != file_version) return err.VersionMismatch; if (w != input_size[0] or h != input_size[1]) return err.ImageSizeMismatch; var records: u64 = try r.readIntLittle(u64); if (comptime std.Target.current.cpu.arch.endian() != .Little) { @compileError("TODO: Implement endian conversion!"); } try self.test_names.resize(records); try r.readNoEof(std.mem.sliceAsBytes(self.test_names.items)); try self.test_cases.resize(records); try r.readNoEof(std.mem.sliceAsBytes(self.test_cases.items)); log.notice("Batch loaded {} records in {}", .{records, fmtDuration(timer.read())}); } // TestAccessor funcs - private fn getTest(a: *TestAccessor, idx: usize) *TestCase { const self = @fieldParentPtr(Self, "accessor", a); return &self.test_cases.items[idx]; } fn getLen(a: *TestAccessor) usize { const self = @fieldParentPtr(Self, "accessor", a); return self.test_cases.items.len; } }; }
src/csv_img_dataset.zig
usingnamespace @cImport({ @cInclude("SDL2/SDL.h"); }); pub const firstevent = SDL_FIRSTEVENT; pub const quit = SDL_QUIT; pub const app_terminating = SDL_APP_TERMINATING; pub const app_lowmemory = SDL_APP_LOWMEMORY; pub const app_willenterbackground = SDL_APP_WILLENTERBACKGROUND; pub const app_didenterbackground = SDL_APP_DIDENTERBACKGROUND; pub const app_willenterforeground = SDL_APP_WILLENTERFOREGROUND; pub const app_didenterforeground = SDL_APP_DIDENTERFOREGROUND; pub const windowevent = SDL_WINDOWEVENT; pub const syswmevent = SDL_SYSWMEVENT; pub const keydown = SDL_KEYDOWN; pub const keyup = SDL_KEYUP; pub const textediting = SDL_TEXTEDITING; pub const textinput = SDL_TEXTINPUT; pub const keymapchanged = SDL_KEYMAPCHANGED; pub const mousemotion = SDL_MOUSEMOTION; pub const mousebuttondown = SDL_MOUSEBUTTONDOWN; pub const mousebuttonup = SDL_MOUSEBUTTONUP; pub const mousewheel = SDL_MOUSEWHEEL; pub const joyaxismotion = SDL_JOYAXISMOTION; pub const joyballmotion = SDL_JOYBALLMOTION; pub const joyhatmotion = SDL_JOYHATMOTION; pub const joybuttondown = SDL_JOYBUTTONDOWN; pub const joybuttonup = SDL_JOYBUTTONUP; pub const joydeviceadded = SDL_JOYDEVICEADDED; pub const joydeviceremoved = SDL_JOYDEVICEREMOVED; pub const controlleraxismotion = SDL_CONTROLLERAXISMOTION; pub const controllerbuttondown = SDL_CONTROLLERBUTTONDOWN; pub const controllerbuttonup = SDL_CONTROLLERBUTTONUP; pub const controllerdeviceadded = SDL_CONTROLLERDEVICEADDED; pub const controllerdeviceremoved = SDL_CONTROLLERDEVICEREMOVED; pub const controllerdeviceremapped = SDL_CONTROLLERDEVICEREMAPPED; pub const fingerdown = SDL_FINGERDOWN; pub const fingerup = SDL_FINGERUP; pub const fingermotion = SDL_FINGERMOTION; pub const dollargesture = SDL_DOLLARGESTURE; pub const dollarrecord = SDL_DOLLARRECORD; pub const multigesture = SDL_MULTIGESTURE; pub const clipboardupdate = SDL_CLIPBOARDUPDATE; pub const dropfile = SDL_DROPFILE; pub const droptext = SDL_DROPTEXT; pub const dropbegin = SDL_DROPBEGIN; pub const dropcomplete = SDL_DROPCOMPLETE; pub const audiodeviceadded = SDL_AUDIODEVICEADDED; pub const audiodeviceremoved = SDL_AUDIODEVICEREMOVED; pub const render_targets_reset = SDL_RENDER_TARGETS_RESET; pub const render_device_reset = SDL_RENDER_DEVICE_RESET;
sdl/event.zig
const std = @import("std"); const util = @import("util.zig"); fn getMatchingClosing(c: u8) u8 { return switch (c) { '(' => ')', '[' => ']', '{' => '}', '<' => '>', else => unreachable, }; } fn getErrorScore(c: u8) u64 { return switch (c) { ')' => 3, ']' => 57, '}' => 1197, '>' => 25137, else => unreachable, }; } fn getCompletionScore(c: u8) u64 { return switch (c) { ')' => 1, ']' => 2, '}' => 3, '>' => 4, else => unreachable, }; } pub fn part1(input: []const u8) !u64 { var total_score: u64 = 0; var lines = std.mem.tokenize(u8, input, "\n"); while (lines.next()) |line| { var stack = std.ArrayList(u8).init(std.heap.page_allocator); defer stack.deinit(); for (line) |c| { switch (c) { '(', '[', '{', '<' => { try stack.append(c); }, ')', ']', '}', '>' => { const last_opening = stack.pop(); const expected_closing = getMatchingClosing(last_opening); if (expected_closing != c) { total_score += getErrorScore(c); } }, else => unreachable, } } } return total_score; } pub fn part2(input: []const u8) !u64 { var scores = std.ArrayList(u64).init(std.heap.page_allocator); defer scores.deinit(); var lines = std.mem.tokenize(u8, input, "\n"); outer: while (lines.next()) |line| { var stack = std.ArrayList(u8).init(std.heap.page_allocator); defer stack.deinit(); var total_score: u64 = 0; for (line) |c| { switch (c) { '(', '[', '{', '<' => { try stack.append(c); }, ')', ']', '}', '>' => { const last_opening = stack.pop(); const expected_closing = getMatchingClosing(last_opening); if (expected_closing != c) { continue :outer; } }, else => unreachable, } } while (stack.popOrNull()) |c| { const closing = getMatchingClosing(c); total_score = total_score * 5 + getCompletionScore(closing); } try scores.append(total_score); } std.sort.sort(u64, scores.items, {}, comptime std.sort.asc(u64)); const middle = @divFloor(scores.items.len, 2); return scores.items[middle]; } test "day 10 part 1" { const test_input = \\[({(<(())[]>[[{[]{<()<>> \\[(()[<>])]({[<{<<[]>>( \\{([(<{}[<>[]}>{[]{[(<()> \\(((({<>}<{<{<>}{[]{[]{} \\[[<[([]))<([[{}[[()]]] \\[{[{({}]{}}([{[{{{}}([] \\{<[[]]>}<{[{[{[]{()[[[] \\[<(<(<(<{}))><([]([]() \\<{([([[(<>()){}]>(<<{{ \\<{([{{}}[<[[[<>{}]]]>[]] ; try std.testing.expectEqual(part1(test_input), 26397); } test "day 10 part 2" { const test_input = \\[({(<(())[]>[[{[]{<()<>> \\[(()[<>])]({[<{<<[]>>( \\{([(<{}[<>[]}>{[]{[(<()> \\(((({<>}<{<{<>}{[]{[]{} \\[[<[([]))<([[{}[[()]]] \\[{[{({}]{}}([{[{{{}}([] \\{<[[]]>}<{[{[{[]{()[[[] \\[<(<(<(<{}))><([]([]() \\<{([([[(<>()){}]>(<<{{ \\<{([{{}}[<[[[<>{}]]]>[]] ; try std.testing.expectEqual(part2(test_input), 288957); }
zig/src/day10.zig
const std = @import("std"); const vk = @import("../vk.zig"); const c = struct { usingnamespace @cImport({ @cInclude("glslang_c_interface.h"); }); }; const vkctxt = @import("../vulkan_wrapper/vulkan_context.zig"); const printError = @import("../application/print_error.zig").printError; const printErrorNoPanic = @import("../application/print_error.zig").printErrorNoPanic; pub const ShaderStage = enum { vertex, fragment, compute, }; const default_resources: c.glslang_resource_s = .{ .max_lights = 32, .max_clip_planes = 6, .max_texture_units = 32, .max_texture_coords = 32, .max_vertex_attribs = 64, .max_vertex_uniform_components = 4096, .max_varying_floats = 64, .max_vertex_texture_image_units = 32, .max_combined_texture_image_units = 80, .max_texture_image_units = 32, .max_fragment_uniform_components = 4096, .max_draw_buffers = 32, .max_vertex_uniform_vectors = 128, .max_varying_vectors = 8, .max_fragment_uniform_vectors = 16, .max_vertex_output_vectors = 16, .max_fragment_input_vectors = 15, .min_program_texel_offset = -8, .max_program_texel_offset = 7, .max_clip_distances = 8, .max_compute_work_group_count_x = 65535, .max_compute_work_group_count_y = 65535, .max_compute_work_group_count_z = 65535, .max_compute_work_group_size_x = 1024, .max_compute_work_group_size_y = 1024, .max_compute_work_group_size_z = 64, .max_compute_uniform_components = 1024, .max_compute_texture_image_units = 16, .max_compute_image_uniforms = 8, .max_compute_atomic_counters = 8, .max_compute_atomic_counter_buffers = 1, .max_varying_components = 60, .max_vertex_output_components = 64, .max_geometry_input_components = 64, .max_geometry_output_components = 128, .max_fragment_input_components = 128, .max_image_units = 8, .max_combined_image_units_and_fragment_outputs = 8, .max_combined_shader_output_resources = 8, .max_image_samples = 0, .max_vertex_image_uniforms = 0, .max_tess_control_image_uniforms = 0, .max_tess_evaluation_image_uniforms = 0, .max_geometry_image_uniforms = 0, .max_fragment_image_uniforms = 8, .max_combined_image_uniforms = 8, .max_geometry_texture_image_units = 16, .max_geometry_output_vertices = 256, .max_geometry_total_output_components = 1024, .max_geometry_uniform_components = 1024, .max_geometry_varying_components = 64, .max_tess_control_input_components = 128, .max_tess_control_output_components = 128, .max_tess_control_texture_image_units = 16, .max_tess_control_uniform_components = 1024, .max_tess_control_total_output_components = 4096, .max_tess_evaluation_input_components = 128, .max_tess_evaluation_output_components = 128, .max_tess_evaluation_texture_image_units = 16, .max_tess_evaluation_uniform_components = 1024, .max_tess_patch_components = 120, .max_patch_vertices = 32, .max_tess_gen_level = 64, .max_viewports = 16, .max_vertex_atomic_counters = 0, .max_tess_control_atomic_counters = 0, .max_tess_evaluation_atomic_counters = 0, .max_geometry_atomic_counters = 0, .max_fragment_atomic_counters = 8, .max_combined_atomic_counters = 8, .max_atomic_counter_bindings = 1, .max_vertex_atomic_counter_buffers = 0, .max_tess_control_atomic_counter_buffers = 0, .max_tess_evaluation_atomic_counter_buffers = 0, .max_geometry_atomic_counter_buffers = 0, .max_fragment_atomic_counter_buffers = 1, .max_combined_atomic_counter_buffers = 1, .max_atomic_counter_buffer_size = 16384, .max_transform_feedback_buffers = 4, .max_transform_feedback_interleaved_components = 64, .max_cull_distances = 8, .max_combined_clip_and_cull_distances = 8, .max_samples = 4, .max_mesh_output_vertices_nv = 256, .max_mesh_output_primitives_nv = 512, .max_mesh_work_group_size_x_nv = 32, .max_mesh_work_group_size_y_nv = 1, .max_mesh_work_group_size_z_nv = 1, .max_task_work_group_size_x_nv = 32, .max_task_work_group_size_y_nv = 1, .max_task_work_group_size_z_nv = 1, .max_mesh_view_count_nv = 4, .maxDualSourceDrawBuffersEXT = 1, .limits = .{ .non_inductive_for_loops = true, .while_loops = true, .do_while_loops = true, .general_uniform_indexing = true, .general_attribute_matrix_vector_indexing = true, .general_varying_indexing = true, .general_sampler_indexing = true, .general_variable_indexing = true, .general_constant_matrix_vector_indexing = true, }, }; var input: c.glslang_input_t = .{ .language = c.GLSLANG_SOURCE_GLSL, .client = c.GLSLANG_CLIENT_VULKAN, .client_version = c.GLSLANG_TARGET_VULKAN_1_2, .target_language = c.GLSLANG_TARGET_SPV, .target_language_version = c.GLSLANG_TARGET_SPV_1_0, .default_version = 100, .default_profile = c.GLSLANG_NO_PROFILE, .force_default_version_and_profile = 0, .forward_compatible = 0, .messages = c.GLSLANG_MSG_DEFAULT_BIT, .resource = &default_resources, .stage = undefined, .code = undefined, }; fn printGlslangError(err_message: [*c]const u8) void { const stdout = std.io.getStdOut().writer(); stdout.print("\x1b[1;31mGLSLANG ERROR:\x1b[0m {s}\n", .{err_message}) catch unreachable; } fn reportGlslangError(shader: *c.glslang_shader_t, message: []const u8) void { printGlslangError(c.glslang_shader_get_info_log(shader)); printGlslangError(c.glslang_shader_get_info_debug_log(shader)); printError("glslang", message); } pub const CompiledShader = struct { size: usize, pcode: [*]c_uint, }; pub fn initShaderCompilation() void { _ = c.glslang_initialize_process(); } pub fn compileShader(code: [*:0]const u8, stage: ShaderStage) CompiledShader { input.code = code; input.stage = switch (stage) { .vertex => c.GLSLANG_STAGE_VERTEX, .fragment => c.GLSLANG_STAGE_FRAGMENT, .compute => c.GLSLANG_STAGE_COMPUTE, }; var shader: *c.glslang_shader_t = c.glslang_shader_create(&input) orelse unreachable; if (c.glslang_shader_preprocess(shader, &input) != 1) reportGlslangError(shader, "Can't preprocess shader"); if (c.glslang_shader_parse(shader, &input) != 1) reportGlslangError(shader, "Can't parse shader"); var program: *c.glslang_program_t = c.glslang_program_create() orelse unreachable; c.glslang_program_add_shader(program, shader); if (c.glslang_program_link(program, c.GLSLANG_MSG_SPV_RULES_BIT | c.GLSLANG_MSG_VULKAN_RULES_BIT) != 1) reportGlslangError(shader, "Can't link program"); c.glslang_program_SPIRV_generate(program, input.stage); var messages = c.glslang_program_SPIRV_get_messages(program); if (messages != null) printGlslangError(messages); c.glslang_shader_delete(shader); var compiledShader: CompiledShader = undefined; compiledShader.size = c.glslang_program_SPIRV_get_size(program) * @sizeOf(c_uint); compiledShader.pcode = c.glslang_program_SPIRV_get_ptr(program); return compiledShader; } pub fn loadShader(shader_code: [*:0]const u8, stage: ShaderStage) vk.ShaderModule { const shader: CompiledShader = compileShader(shader_code, stage); const module_create_info: vk.ShaderModuleCreateInfo = .{ .code_size = shader.size, .p_code = shader.pcode, .flags = .{}, }; var shader_module: vk.ShaderModule = vkctxt.vkd.createShaderModule(vkctxt.vkc.device, module_create_info, null) catch |err| { vkctxt.printVulkanError("Can't create shader module", err, vkctxt.vkc.allocator); @panic("Can't create shader module"); }; return shader_module; }
src/shaders/shader_util.zig
const std = @import("std"); pub const c_flecs = @import("c_flecs.zig"); pub const Entity = c_flecs.ecs_entity_t; pub const System = Entity; pub const Phase = enum(@TagType(c_flecs.EcsSystemKind)) { OnUpdate = @enumToInt(c_flecs.EcsSystemKind.EcsOnUpdate), }; pub const Rows = struct { type_map: std.StringHashMap(u32), pub inner: *c_flecs.ecs_rows_t, fn init(rows: *c_flecs.ecs_rows_t, type_map: std.StringHashMap(u32)) @This() { return @This() { .inner = rows, .type_map = type_map, }; } pub fn getSystem(self: @This()) System { return self.inner.system; } pub fn getDeltaTime(self: @This()) f32 { return self.inner.delta_time; } pub fn getWorldTime(self: @This()) f32 { return self.inner.world_time; } pub fn getFrameOffset(self: @This()) u32 { return self.inner.frame_offset; } pub fn getOffset(self: @This()) u32 { return self.inner.offset; } pub fn count(self: @This()) u32 { return self.inner.count; } pub fn getInterruptedBy(self: @This()) u32 { return self.inner.count; } /// Return the column at the given ix. ty should be the type of entities in /// that column (see the entity signature). /// If the column is shared, there will be only one data item. /// Otherwise, the length should be equal to self.count(). /// Prefer comp() to this, unless the extra performance is needed (one less hash table lookup) pub fn col_ix(self: @This(), comptime T: type, ix: u32) []T { if (c_flecs.ecs_is_shared(self.inner, ix)) { return @ptrCast([*]T, @alignCast(@alignOf(T), c_flecs._ecs_column(self.inner, @sizeOf(T), 1)))[0..1]; } else { return @ptrCast([*]T, @alignCast(@alignOf(T), c_flecs._ecs_column(self.inner, @sizeOf(T), 1)))[0..self.count()]; } } /// Get a component with a type. This is a convenience, function, and uses a /// hash map to lookup the column of the type name. For maximum performance (but /// slightly uglier code), access by the column index with col() pub fn col(self: @This(), comptime T: type) []T { const ix_opt = self.type_map.get(@typeName(T)); if (ix_opt) |ix| { return self.col_ix(T, ix.value); } else { @panic("Can't find component " ++ @typeName(T) ++ " in system."); } } }; const ColModifier = enum { Self, }; const ColDesc = struct { T: type, modifier: ColModifier, }; pub fn SystemSignature(comptime n: i32, comptime cols: [n]ColDesc) type { // Compute signature as a string comptime const string_sig = c"Pos"; return struct { pub fn count(self: @This()) i32 { return n; } pub fn asStr(self: @This()) [*c]const u8 { return string_sig; } pub fn getCols(self: @This()) comptime [n]ColDesc { return cols; } pub fn getColIndex(comptime col: type) i32 { comptime { for (cols) |c, ix| { if (c.T == col) { return ix; } } } @panic("Can't find col of type " ++ @typeName(col)); } fn ThisPlusOneColumn(comptime T: type) type { comptime const desc = ColDesc {.T = T, .modifier = ColModifier.Self}; return SystemSignature(n + 1, cols ++ [1]ColDesc{desc}); } pub fn col(self: @This(), comptime T: type) ThisPlusOneColumn(T) { return ThisPlusOneColumn(T) {}; } }; } pub fn buildSig() SystemSignature(0, [0]ColDesc {}) { return SystemSignature(0, [0]ColDesc {}) {}; } /// Get static memory with the given id. ID must be supplied so zig caches the /// result for the same T and same id. fn getStaticMemoryInit(comptime id: var, comptime val: var) *@typeOf(val) { return &struct { pub var buf: @typeOf(val) = val; }.buf; } /// Get static memory with the given id. ID must be supplied so zig caches the /// result for the same T and same id. fn getStaticMemory(comptime id: var, comptime T: type) *T { return &struct { pub var buf: T = undefined; }.buf; } /// Get a type map, mapping type names to column indexes fn getTypeMapForSystem(comptime system_id: var, comptime sig: var) std.StringHashMap(u32) { return struct { pub fn get() std.StringHashMap(u32) { const TypeMapAndInitialised = struct { init: bool = false, type_map: std.StringHashMap(u32) = undefined, }; // Initialise type map, to map type names to columns. Allocate // enough for the columns we have, assuming each column takes 40 bytes // for an entry in the hash map. const bytes_per_entry = @sizeOf(std.StringHashMap(u32).Entry); var type_map_memory = getStaticMemory(system_id, [bytes_per_entry * sig.getCols().len]u8); var type_map_and_initialised = getStaticMemoryInit(system_id, TypeMapAndInitialised {}); if (!type_map_and_initialised.init) { type_map_and_initialised.init = true; const type_map = &type_map_and_initialised.type_map; var fixed_alloc = std.heap.FixedBufferAllocator.init(type_map_memory[0..]); var allocator = &fixed_alloc.allocator; type_map.* = std.StringHashMap(u32).init(allocator); type_map.ensureCapacityExact(sig.getCols().len) catch @panic("Error, not enough memory allocated"); // Insert types inline for (sig.getCols()[0..]) |col_desc, ix| { _ = type_map.putAssumeCapacity(@typeName(col_desc.T), ix); } } return type_map_and_initialised.type_map; } }.get(); } /// Wrap a zig function in a C compatible ABI fn initSystemDispatcher(comptime function: fn (rows: Rows) void, comptime system_id: var, comptime sig: var) extern fn (rows: [*c]c_flecs.ecs_rows_t) void { return struct { pub extern "c" fn function(rows: [*c]c_flecs.ecs_rows_t) void { function(Rows.init(rows, getTypeMapForSystem(system_id, sig))); } }.function; } fn toCStringLit(comptime string: []const u8) [*c]const u8 { return (string ++ "\x00")[0..].ptr; } extern "c" fn systemDispatcher(rows: [*c]c_flecs.ecs_rows_t) void { // Wrap the rows const wrapped = Rows.init(rows); // Figure out which system this should be, dispatch that var res_fn = system_map.?.get(rows.*.system); if (res_fn) |function| { function.value(wrapped); } else { std.debug.warn("Error: can't find system {}\n", rows.*.system); } } /// Gets a pointer to some static data for the given type. Useful for storing flecs component handles. fn getComponentHandle(comptime T : type) *u64 { return &(struct { pub var handle : u64 = undefined; }.handle); } pub const World = struct { inner: *c_flecs.ecs_world, allocator: *std.mem.Allocator, frame_delta: f32 = 1.0 / 60.0, pub fn init(allocator: *std.mem.Allocator) @This() { return @This() { .inner = c_flecs.ecs_init().?, .allocator = allocator, }; } pub fn deinit(self: @This()) void { _ = c_flecs.ecs_fini(self.inner); } pub fn setTargetFps(self: *@This(), fps: f32) void { self.frame_delta = 1.0 / fps; c_flecs.ecs_set_target_fps(self.inner, fps); } pub fn registerComponent(self: @This(), comptime T: type) void { comptime var c_string_lit : [@typeName(T).len + 1]u8 = undefined; comptime { inline for (@typeName(T)) |c, ix| { c_string_lit[ix] = c; } c_string_lit[c_string_lit.len - 1] = 0; } getComponentHandle(T).* = c_flecs.ecs_new_component(self.inner, &c_string_lit, @sizeOf(T)); } /// Given a component, get the internal flecs component handle. If T hasn't /// been registered, the result of this function is undefined. pub fn getFlecsComponentHandle(comptime T : type) u64 { return getComponentHandle(T).*; } pub fn progress(self: @This()) void { _ = c_flecs.ecs_progress(self.inner, self.frame_delta); } /// Register a system with the given signature: https://github.com/SanderMertens/flecs/blob/master/Manual.md#system-signatures /// Need to provide a name for the system for better debug info. /// @param sig a SystemSignature pub fn registerSystem(self: @This(), comptime name: []const u8, phase: Phase, comptime function: fn(Rows) void, comptime sig: var) void { const sys = c_flecs.ecs_new_system(self.inner, toCStringLit(name), @bitCast(c_flecs.EcsSystemKind, phase), sig.asStr(), initSystemDispatcher(function, name, sig)); } /// Create a new entity with the given components. Add components later on with set(). pub fn new(self: @This(), component_vals: ...) Entity { const e = c_flecs._ecs_new(self.inner, null); comptime var ii : usize = 0; inline while (ii < component_vals.len) { self.set(e, component_vals[ii]); ii += 1; } return e; } /// Create a prefab and return it. Set values in this prefab, then use newInstance(). pub fn newPrefab(self: @This(), component_vals: ...) Entity { const e = self.new(component_vals); c_flecs._ecs_add(self.inner, e, c_flecs.ecs_type_from_entity(self.inner, c_flecs.EEcsPrefab)); return e; } pub fn newInstance(self: @This(), super: Entity) Entity { return c_flecs._ecs_new_instance(self.inner, super, null); } pub fn set(self: @This(), entity: Entity, val: var) void { comptime const T = @typeOf(val); const handle = getComponentHandle(T).*; var val_copied = val; _ = c_flecs._ecs_set_ptr(self.inner, entity, handle, @sizeOf(@typeOf(val)), &val_copied); } };
zig-src/flecs.zig
const std = @import("std"); const testing = std.testing; const niceware = @import("niceware.zig"); test "bytes to passphrase does not allocate internally" { const bytes = &[_]u8{ 0x00, 0x00 }; const size = niceware.passphraseSize(bytes) catch unreachable; var buf = try testing.allocator.alloc(u8, size); defer testing.allocator.free(buf); try niceware.bytesToPassphrase(buf, bytes); try testing.expectEqualStrings(buf, "a"); } test "passphrase to bytes does not allocate internally" { const passphrase = &[_][]const u8{"<PASSWORD>"}; const size = niceware.bytesSize(passphrase); var buf = try testing.allocator.alloc(u8, size); defer testing.allocator.free(buf); try niceware.passphraseToBytes(buf, passphrase); try testing.expectEqualSlices( u8, &[_]u8{ 0xff, 0xff }, buf, ); } test "generates passphrases of the correct length" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const ally = &arena.allocator; try testing.expectEqual(@as(usize, 1), (try niceware.generatePassphraseAlloc(ally, 2)).len); try testing.expectEqual(@as(usize, 10), (try niceware.generatePassphraseAlloc(ally, 20)).len); try testing.expectEqual(@as(usize, 256), (try niceware.generatePassphraseAlloc(ally, 512)).len); } test "errors when generating passphrase with an odd number of bytes" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const ally = &arena.allocator; try testing.expectError(error.OddSize, niceware.generatePassphraseAlloc(ally, 3)); try testing.expectError(error.OddSize, niceware.generatePassphraseAlloc(ally, 23)); } test "errors when generating passphrases that are too large" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const ally = &arena.allocator; try testing.expectError(error.SizeTooLarge, niceware.generatePassphraseAlloc(ally, 1026)); } test "errors when generating passphrases that are too small" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const ally = &arena.allocator; try testing.expectError(error.SizeTooSmall, niceware.generatePassphraseAlloc(ally, 1)); } test "errors when byte array has odd length" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const ally = &arena.allocator; try testing.expectError(error.OddSize, niceware.bytesToPassphraseAlloc(ally, &[_]u8{0} ** 3)); } test "bytes to passphrase expected" { var arena = std.heap.ArenaAllocator.init(testing.allocator); defer arena.deinit(); const ally = &arena.allocator; try testing.expectEqualSlices( []const u8, &[_][]const u8{"a"}, try niceware.bytesToPassphraseAlloc(ally, &[_]u8{0} ** 2), ); try testing.expectEqualSlices( []const u8, &[_][]const u8{"zyzzyva"}, try niceware.bytesToPassphraseAlloc(ally, &[_]u8{0xff} ** 2), ); try testing.expectEqualSlices( []const u8, &[_][]const u8{ "a", "bioengineering", "balloted", "gobbledegook", "creneled", "written", "depriving", "zyzzyva" }, try niceware.bytesToPassphraseAlloc( ally, &[_]u8{ 0x00, 0x00, 0x11, 0xd4, 0x0c, 0x8c, 0x5a, 0xf7, 0x2e, 0x53, 0xfe, 0x3c, 0x36, 0xa9, 0xff, 0xff }, ), ); } test "errors when input is not in the wordlist" { var buf: [6]u8 = undefined; try testing.expectError( error.WordNotFound, niceware.passphraseToBytes(&buf, &[_][]const u8{ "You", "love", "ninetails" }), ); } test "returns expected bytes" { { var buf: [2]u8 = undefined; try niceware.passphraseToBytes(&buf, &[_][]const u8{"A"}); try testing.expectEqualSlices(u8, &[_]u8{ 0x00, 0x00 }, &buf); } { var buf: [2]u8 = undefined; try niceware.passphraseToBytes(&buf, &[_][]const u8{"zyzzyva"}); try testing.expectEqualSlices(u8, &[_]u8{ 0xff, 0xff }, &buf); } { var buf: [16]u8 = undefined; try niceware.passphraseToBytes(&buf, &[_][]const u8{ "a", "bioengineering", "balloted", "gobbledegook", "creneled", "written", "depriving", "zyzzyva" }); try testing.expectEqualSlices( u8, &[_]u8{ 0x00, 0x00, 0x11, 0xd4, 0x0c, 0x8c, 0x5a, 0xf7, 0x2e, 0x53, 0xfe, 0x3c, 0x36, 0xa9, 0xff, 0xff }, &buf, ); } }
src/test.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; pub const Burrow = struct { const Node = struct { code: u128, cost: usize, pub fn init(code: u128, cost: usize) Node { var self = Node{ .code = code, .cost = cost }; return self; } fn lessThan(l: Node, r: Node) std.math.Order { return std.math.order(l.cost, r.cost); } }; const State = struct { const HALLWAY_SIZE = 11; const HOME_SIZE = 4; const MAX_HOME_ROWS = 4; hallway: [HALLWAY_SIZE]u8, home: [MAX_HOME_ROWS][HOME_SIZE]u8, rows: u4, code: u128, pub fn init() State { var self = State{ .hallway = undefined, .home = undefined, .code = 0, .rows = 0, }; return self; } fn encode_pod(pod: u8) u3 { return switch (pod) { 'A' => 0b100, 'B' => 0b101, 'C' => 0b110, 'D' => 0b111, else => 0b000, }; } fn decode_pod(pod: u3) u8 { return switch (pod) { 0b100 => 'A', 0b101 => 'B', 0b110 => 'C', 0b111 => 'D', else => '.', }; } fn door_pos_for_home(home: u8) u5 { return @intCast(u5, (home - 'A' + 1) * 2); } fn home_for_pos(pos: u5) u8 { return switch (pos) { 2 => 'A', 4 => 'B', 6 => 'C', 8 => 'D', else => '.', }; } fn unit_cost_for_pod(pod: u8) usize { return switch (pod) { 'A' => 1, 'B' => 10, 'C' => 100, 'D' => 1000, else => 0, }; } fn is_valid_home_line(line: []const u8) bool { return (line[3] != '#' and line[5] != '#' and line[7] != '#' and line[9] != '#'); } pub fn encode(self: *State) u128 { if (self.code == 0) { var w: usize = 0; while (w < HALLWAY_SIZE) : (w += 1) { self.code <<= 3; self.code |= encode_pod(self.hallway[w]); } var h: u8 = 'A'; while (h <= 'D') : (h += 1) { var p: usize = 0; while (p < self.rows) : (p += 1) { self.code <<= 3; self.code |= encode_pod(self.get_home(h, p)); } } self.code <<= 4; self.code |= @intCast(u4, self.rows); } return self.code; } pub fn decode(code: u128) State { var c = code; var s = State.init(); s.rows = @intCast(u4, c & 0b1111); c >>= 4; var h: u8 = 'D'; while (h >= 'A') : (h -= 1) { var p: usize = 0; while (p < s.rows) : (p += 1) { var x = @intCast(u3, c & 0b111); c >>= 3; s.set_home(h, s.rows - 1 - p, decode_pod(x)); } } var w: usize = 0; while (w < HALLWAY_SIZE) : (w += 1) { var x = @intCast(u3, c & 0b111); c >>= 3; s.set_hallway(HALLWAY_SIZE - 1 - w, decode_pod(x)); } s.code = code; return s; } fn parse_home_line(self: *State, line: []const u8, row: usize) void { var p: usize = 3; while (p <= 9) : (p += 2) { var h = @intCast(u8, (p - 3) / 2) + 'A'; self.set_home(h, row, line[p]); } } pub fn parse_data(self: *State, data: []const u8) void { var y: usize = 0; var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| : (y += 1) { if (line.len == 0) continue; if (y == 0) continue; if (y == 1) { for (line) |c, x| { if (c == '#') continue; self.hallway[x - 1] = c; } continue; } if (is_valid_home_line(line)) { self.parse_home_line(line, self.rows); self.rows += 1; } } self.code = 0; } pub fn parse_extra(self: *State, data: []const u8) void { var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { if (line.len == 0) continue; if (is_valid_home_line(line)) { var h: u8 = 'A'; while (h <= 'D') : (h += 1) { self.set_home(h, self.rows, self.get_home(h, self.rows - 1)); } self.parse_home_line(line, self.rows - 1); self.rows += 1; } } self.code = 0; } pub fn build_target(self: *State) State { var s = self.*; var r: usize = 0; while (r < self.rows) : (r += 1) { var h: u8 = 'A'; while (h <= 'D') : (h += 1) { s.set_home(h, r, h); } } s.code = 0; return s; } pub fn show(self: State) void { std.debug.warn("#############\n", .{}); std.debug.warn("#", .{}); var w: usize = 0; while (w < HALLWAY_SIZE) : (w += 1) { std.debug.warn("{c}", .{self.hallway[w]}); } std.debug.warn("#\n", .{}); var p: usize = 0; while (p < self.rows) : (p += 1) { const f: u8 = if (p == 0) '#' else ' '; std.debug.warn("{c}{c}", .{ f, f }); var h: u8 = 'A'; while (h <= 'D') : (h += 1) { std.debug.warn("#{c}", .{self.get_home(h, p)}); } std.debug.warn("#{c}{c}\n", .{ f, f }); } std.debug.warn(" ######### \n", .{}); } pub fn get_hallway(self: State, pos: usize) u8 { return self.hallway[pos]; } pub fn set_hallway(self: *State, pos: usize, val: u8) void { self.hallway[pos] = val; self.code = 0; } pub fn get_home(self: State, home: u8, pos: usize) u8 { return self.home[home - 'A'][pos]; } pub fn set_home(self: *State, home: u8, pos: usize, val: u8) void { self.home[home - 'A'][pos] = val; self.code = 0; } pub fn pos_in_home_that_should_go_to_another_home(self: *State, home: u8) usize { var h: usize = 0; while (h < self.rows) : (h += 1) { if (self.get_home(home, h) != '.') break; } if (h >= self.rows) return 9; if (self.get_home(home, h) == home) return 9; return h; } pub fn pos_in_home_that_should_go_to_hallway(self: *State, home: u8) usize { var h: usize = 0; while (h < self.rows) : (h += 1) { if (self.get_home(home, h) != '.') break; } if (h >= self.rows) return 9; var l: usize = h; while (l < self.rows) : (l += 1) { if (self.get_home(home, l) != home) break; } if (l >= self.rows) return 9; return h; } pub fn pos_in_home_where_entering_pod_should_be_placed(self: *State, home: u8) usize { var h: usize = 0; while (h < self.rows) : (h += 1) { if (self.get_home(home, h) != '.') break; } if (h >= self.rows) return self.rows - 1; var l: usize = h; while (l < self.rows) : (l += 1) { if (self.get_home(home, l) != home) break; } if (l >= self.rows) return h - 1; return 9; } }; const Scores = std.AutoHashMap(u128, usize); const Pending = std.PriorityQueue(Node, Node.lessThan); const Path = std.AutoHashMap(u128, Node); ini: State, end: State, min_score: usize, scores: Scores, // score for a given state; default is infinite pending: Pending, // a priority queue with the pending nodes to be analyzed path: Path, // the path to reach a given node pub fn init() Burrow { var self = Burrow{ .ini = State.init(), .end = State.init(), .min_score = std.math.maxInt(usize), .scores = Scores.init(allocator), .pending = Pending.init(allocator), .path = Path.init(allocator), }; return self; } pub fn deinit(self: *Burrow) void { self.path.deinit(); self.pending.deinit(); self.scores.deinit(); } pub fn parse_data(self: *Burrow, data: []const u8) void { self.ini.parse_data(data); self.end = self.ini.build_target(); } pub fn parse_extra(self: *Burrow, data: []const u8) void { self.ini.parse_extra(data); self.end = self.ini.build_target(); } pub fn find_cheapest_solution(self: *Burrow) !usize { self.pending.shrinkAndFree(0); self.scores.clearRetainingCapacity(); self.path.clearRetainingCapacity(); try self.walk_dijkstra(); var moves: usize = 0; var cost: usize = 0; var current = self.end.encode(); while (true) { if (self.path.getEntry(current)) |e| { const node = e.value_ptr.*; moves += 1; cost += node.cost; // const parent = State.decode(node.code); // std.debug.warn("COST: {}\n\n", .{node.cost}); // parent.show(); current = node.code; } else { break; } } // std.debug.warn("Found solution with {} moves, total cost is {}\n", .{ moves, cost }); return cost; } fn update_neighbor(self: *Burrow, piece: u8, length: usize, u: *State, v: *State, su: usize) !void { const cost = length * State.unit_cost_for_pod(piece); const tentative = su + cost; var sv: usize = std.math.maxInt(usize); if (self.scores.getEntry(v.encode())) |e| { sv = e.value_ptr.*; } if (tentative >= sv) return; try self.pending.add(Node.init(v.encode(), tentative)); try self.scores.put(v.encode(), tentative); try self.path.put(v.encode(), Node.init(u.encode(), cost)); } fn walk_dijkstra(self: *Burrow) !void { // we begin the route at the start node, which has a score of 0 try self.pending.add(Node.init(self.ini.encode(), 0)); while (self.pending.count() != 0) { const min_node = self.pending.remove(); const uc = min_node.code; if (uc == self.end.encode()) { // found target -- yay! break; } const su = min_node.cost; var u = State.decode(uc); // *** try to move from wrong home to right home *** { var source: u8 = 'D'; while (source >= 'A') : (source -= 1) { const p0 = u.pos_in_home_that_should_go_to_another_home(source); if (p0 == 9) continue; const target = u.get_home(source, p0); if (target == '.') continue; const p1 = u.pos_in_home_where_entering_pod_should_be_placed(target); if (p1 == 9) continue; var h0 = State.door_pos_for_home(source); var h1 = State.door_pos_for_home(target); if (h0 > h1) { var t = h0; h0 = h1; h1 = t; } var blocked = false; var h = h0; while (h <= h1) : (h += 1) { if (u.hallway[h] != '.') { blocked = true; break; } } if (blocked) continue; var v = u; v.set_home(source, p0, '.'); v.set_home(target, p1, target); // std.debug.warn("NEIGHBOR HOME-TO-HOME\n", .{}); // v.show(); const length = p0 + (h1 - h0 + 1) + p1 + 1; try self.update_neighbor(target, length, &u, &v, su); } } // *** try to move from hallway to right home *** { var w: u5 = 0; while (w < State.HALLWAY_SIZE) : (w += 1) { const target = u.get_hallway(w); if (target == '.') continue; const p1 = u.pos_in_home_where_entering_pod_should_be_placed(target); if (p1 == 9) continue; var h0 = w; var h1 = State.door_pos_for_home(target); if (h0 < h1) { h0 += 1; } else { var t = h0; h0 = h1; h1 = t; h1 -= 1; } var blocked = false; var h = h0; while (h <= h1) : (h += 1) { if (u.hallway[h] != '.') { blocked = true; break; } } if (blocked) continue; var v = u; v.set_hallway(w, '.'); v.set_home(target, p1, target); // std.debug.warn("NEIGHBOR HALLWAY-TO-HOME\n", .{}); // v.show(); const length = (h1 - h0 + 1) + p1 + 1; try self.update_neighbor(target, length, &u, &v, su); } } // *** try to move from wrong home to hallway *** { var source: u8 = 'A'; while (source <= 'D') : (source += 1) { const p0 = u.pos_in_home_that_should_go_to_hallway(source); if (p0 == 9) continue; const target = u.get_home(source, p0); if (target == '.') continue; const door = State.door_pos_for_home(source); // to the left var w: u5 = 0; while (w < door) : (w += 1) { var p: u5 = door - 1 - w; if (u.get_hallway(p) != '.') break; if (State.home_for_pos(p) != '.') continue; var v = u; v.set_hallway(p, target); v.set_home(source, p0, '.'); // std.debug.warn("NEIGHBOR HOME-TO-HALLWAY (left {c} => {})\n", .{ target, p }); // v.show(); const length = p0 + (door - p + 1); try self.update_neighbor(target, length, &u, &v, su); } // to the right var p: u5 = door + 1; while (p < State.HALLWAY_SIZE) : (p += 1) { if (u.get_hallway(p) != '.') break; if (State.home_for_pos(p) != '.') continue; var v = u; v.set_hallway(p, target); v.set_home(source, p0, '.'); // std.debug.warn("NEIGHBOR HOME-TO-HALLWAY (right {c} => {})\n", .{ target, p }); // v.show(); const length = p0 + (p - door + 1); try self.update_neighbor(target, length, &u, &v, su); } } } } } }; test "sample part a" { const data: []const u8 = \\############# \\#...........# \\###B#C#B#D### \\ #A#D#C#A# \\ ######### ; var burrow = Burrow.init(); defer burrow.deinit(); burrow.parse_data(data); const cost = try burrow.find_cheapest_solution(); try testing.expect(cost == 12521); } test "sample part b" { const data: []const u8 = \\############# \\#...........# \\###B#C#B#D### \\ #A#D#C#A# \\ ######### ; const extra: []const u8 = \\ #D#C#B#A# \\ #D#B#A#C# ; var burrow = Burrow.init(); defer burrow.deinit(); burrow.parse_data(data); burrow.parse_extra(extra); const cost = try burrow.find_cheapest_solution(); try testing.expect(cost == 44169); }
2021/p23/burrow.zig
const std = @import("std"); const builtin = @import("builtin"); const Allocator = std.mem.Allocator; const serializer = @import("serializer.zig").serializer; const Message = @import("Message.zig"); const Connection = @This(); const system_bus_address = "unix:path=/var/run/dbus/system_bus_socket"; allocator: *Allocator, socket: std.net.Stream, pub fn connectSystemBus(allocator: *Allocator) !Connection { const address = std.os.getenv("DBUS_SYSTEM_BUS_ADDRESS") orelse system_bus_address; return Connection.connectAddress(allocator, address); } pub fn connectSessionBus(allocator: *Allocator) !Connection { const address = std.os.getenv("DBUS_SESSION_BUS_ADDRESS") orelse return error.EnvironmentVariableNotFound; return Connection.connectAddress(allocator, address); } pub fn connectAddress(allocator: *Allocator, address: []const u8) !Connection { // TODO Parse address according to spec: // https://dbus.freedesktop.org/doc/dbus-specification.html#addresses const expected_address_prefix = "unix:path="; if (!std.mem.startsWith(u8, address, expected_address_prefix)) return error.AddressUnimplemented; const socket_path = address[expected_address_prefix.len..]; return Connection.connectUnixSocket(allocator, socket_path); } pub fn connectUnixSocket(allocator: *Allocator, path: []const u8) !Connection { const socket = try std.net.connectUnixSocket(path); errdefer socket.close(); // Perform authentication // We only support the EXTERNAL authentication mechanism, which // authenticates (on unix systems) based on the user's uid const uid = std.os.system.getuid(); var buffer: [100]u8 = undefined; // TODO use a BufferedReader/BufferedWriter and store them in the Connection var fbs = std.io.fixedBufferStream(&buffer); try fbs.writer().print("{}", .{uid}); try socket.writer().print("\x00AUTH EXTERNAL {}\r\n", .{std.fmt.fmtSliceHexLower(fbs.getWritten())}); const amt = try socket.read(&buffer); const response = buffer[0..amt]; std.log.debug("auth response: «{s}»", .{std.fmt.fmtSliceEscapeLower(response)}); if (std.mem.startsWith(u8, response, "OK ")) { // Rest of response is server GUID in hex, which we don't use } else if (std.mem.startsWith(u8, response, "REJECTED ")) { // Rest of response is a list of authentication mechanisms // supported, but we only support EXTERNAL return error.AuthenticationRejected; } else { return error.UnexpectedAuthenticationResponse; } try socket.writer().print("BEGIN\r\n", .{}); // We now have an authenticated connection that is ready to send/receive D-Bus messages var self = Connection{ .allocator = allocator, .socket = socket, }; // Send a Hello message to receive our connection's unique name try self.callMethod( "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "Hello", .{}, ); return self; } pub fn callMethod( self: Connection, destination: []const u8, path: []const u8, interface: []const u8, member: []const u8, arguments: anytype, ) !void { var array_list = std.ArrayList(u8).init(self.allocator); defer array_list.deinit(); // Message header const endian = comptime builtin.target.cpu.arch.endian(); var ser = serializer(array_list.writer(), endian); // TODO put a BufferedWriter in between try ser.serialize(@as(u8, switch (endian) { .Little => 'l', .Big => 'B', })); try ser.serialize(Message.Type.method_call.toByte()); try ser.serialize((Message.Flags{}).toByte()); try ser.serialize(@as(u8, 1)); // major protocol version try ser.serialize(@as(u32, 0)); // message body length try ser.serialize(@as(u32, 1)); // message serial number (non-zero) // TODO compute try ser.serialize(@as(u32, 110)); // array length in bytes try ser.alignForward(8); try ser.serialize(Message.Field.path.toByte()); // second array element field code: PATH try ser.serialize(@as(u8, 1)); // signature length (excluding nul byte) try ser.writeAll("o\x00"); // signature: object path try ser.serialize(path); // path try ser.alignForward(8); try ser.serialize(Message.Field.destination.toByte()); // first array element field code: MEMBER try ser.serialize(@as(u8, 1)); // signature length (excluding nul byte) try ser.writeAll("s\x00"); // signature: string try ser.serialize(destination); // destination try ser.alignForward(8); try ser.serialize(Message.Field.interface.toByte()); // second array element field code: PATH try ser.serialize(@as(u8, 1)); // signature length (excluding nul byte) try ser.writeAll("s\x00"); // signature: string try ser.serialize(interface); // interface try ser.alignForward(8); try ser.serialize(Message.Field.member.toByte()); // first array element field code: MEMBER try ser.serialize(@as(u8, 1)); // signature length (excluding nul byte) try ser.writeAll("s\x00"); // signature: string try ser.serialize(member); // member try ser.alignForward(8); if (arguments.len > 0) { @compileError("TODO arguments"); } std.log.debug("message {s}", .{std.fmt.fmtSliceHexLower(array_list.items)}); try self.socket.writer().writeAll(array_list.items); std.log.debug("sent message", .{}); // read response? while (true) { var buffer: [4096]u8 = undefined; const amt = try self.socket.read(&buffer); const response = buffer[0..amt]; std.log.debug("response: «{s}»", .{std.fmt.fmtSliceEscapeLower(response)}); std.time.sleep(1 * std.time.ns_per_s); } } pub fn disconnect(self: Connection) void { self.socket.close(); }
src/Connection.zig
pub const TASK_SUNDAY = @as(u32, 1); pub const TASK_MONDAY = @as(u32, 2); pub const TASK_TUESDAY = @as(u32, 4); pub const TASK_WEDNESDAY = @as(u32, 8); pub const TASK_THURSDAY = @as(u32, 16); pub const TASK_FRIDAY = @as(u32, 32); pub const TASK_SATURDAY = @as(u32, 64); pub const TASK_FIRST_WEEK = @as(u32, 1); pub const TASK_SECOND_WEEK = @as(u32, 2); pub const TASK_THIRD_WEEK = @as(u32, 3); pub const TASK_FOURTH_WEEK = @as(u32, 4); pub const TASK_LAST_WEEK = @as(u32, 5); pub const TASK_JANUARY = @as(u32, 1); pub const TASK_FEBRUARY = @as(u32, 2); pub const TASK_MARCH = @as(u32, 4); pub const TASK_APRIL = @as(u32, 8); pub const TASK_MAY = @as(u32, 16); pub const TASK_JUNE = @as(u32, 32); pub const TASK_JULY = @as(u32, 64); pub const TASK_AUGUST = @as(u32, 128); pub const TASK_SEPTEMBER = @as(u32, 256); pub const TASK_OCTOBER = @as(u32, 512); pub const TASK_NOVEMBER = @as(u32, 1024); pub const TASK_DECEMBER = @as(u32, 2048); pub const TASK_FLAG_INTERACTIVE = @as(u32, 1); pub const TASK_FLAG_DELETE_WHEN_DONE = @as(u32, 2); pub const TASK_FLAG_DISABLED = @as(u32, 4); pub const TASK_FLAG_START_ONLY_IF_IDLE = @as(u32, 16); pub const TASK_FLAG_KILL_ON_IDLE_END = @as(u32, 32); pub const TASK_FLAG_DONT_START_IF_ON_BATTERIES = @as(u32, 64); pub const TASK_FLAG_KILL_IF_GOING_ON_BATTERIES = @as(u32, 128); pub const TASK_FLAG_RUN_ONLY_IF_DOCKED = @as(u32, 256); pub const TASK_FLAG_HIDDEN = @as(u32, 512); pub const TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET = @as(u32, 1024); pub const TASK_FLAG_RESTART_ON_IDLE_RESUME = @as(u32, 2048); pub const TASK_FLAG_SYSTEM_REQUIRED = @as(u32, 4096); pub const TASK_FLAG_RUN_ONLY_IF_LOGGED_ON = @as(u32, 8192); pub const TASK_TRIGGER_FLAG_HAS_END_DATE = @as(u32, 1); pub const TASK_TRIGGER_FLAG_KILL_AT_DURATION_END = @as(u32, 2); pub const TASK_TRIGGER_FLAG_DISABLED = @as(u32, 4); pub const TASK_MAX_RUN_TIMES = @as(u32, 1440); pub const CLSID_CTask = Guid.initString("148bd520-a2ab-11ce-b11f-00aa00530503"); pub const CLSID_CTaskScheduler = Guid.initString("148bd52a-a2ab-11ce-b11f-00aa00530503"); //-------------------------------------------------------------------------------- // Section: Types (72) //-------------------------------------------------------------------------------- pub const TASK_TRIGGER_TYPE = enum(i32) { TIME_TRIGGER_ONCE = 0, TIME_TRIGGER_DAILY = 1, TIME_TRIGGER_WEEKLY = 2, TIME_TRIGGER_MONTHLYDATE = 3, TIME_TRIGGER_MONTHLYDOW = 4, EVENT_TRIGGER_ON_IDLE = 5, EVENT_TRIGGER_AT_SYSTEMSTART = 6, EVENT_TRIGGER_AT_LOGON = 7, }; pub const TASK_TIME_TRIGGER_ONCE = TASK_TRIGGER_TYPE.TIME_TRIGGER_ONCE; pub const TASK_TIME_TRIGGER_DAILY = TASK_TRIGGER_TYPE.TIME_TRIGGER_DAILY; pub const TASK_TIME_TRIGGER_WEEKLY = TASK_TRIGGER_TYPE.TIME_TRIGGER_WEEKLY; pub const TASK_TIME_TRIGGER_MONTHLYDATE = TASK_TRIGGER_TYPE.TIME_TRIGGER_MONTHLYDATE; pub const TASK_TIME_TRIGGER_MONTHLYDOW = TASK_TRIGGER_TYPE.TIME_TRIGGER_MONTHLYDOW; pub const TASK_EVENT_TRIGGER_ON_IDLE = TASK_TRIGGER_TYPE.EVENT_TRIGGER_ON_IDLE; pub const TASK_EVENT_TRIGGER_AT_SYSTEMSTART = TASK_TRIGGER_TYPE.EVENT_TRIGGER_AT_SYSTEMSTART; pub const TASK_EVENT_TRIGGER_AT_LOGON = TASK_TRIGGER_TYPE.EVENT_TRIGGER_AT_LOGON; pub const DAILY = extern struct { DaysInterval: u16, }; pub const WEEKLY = extern struct { WeeksInterval: u16, rgfDaysOfTheWeek: u16, }; pub const MONTHLYDATE = extern struct { rgfDays: u32, rgfMonths: u16, }; pub const MONTHLYDOW = extern struct { wWhichWeek: u16, rgfDaysOfTheWeek: u16, rgfMonths: u16, }; pub const TRIGGER_TYPE_UNION = extern union { Daily: DAILY, Weekly: WEEKLY, MonthlyDate: MONTHLYDATE, MonthlyDOW: MONTHLYDOW, }; pub const TASK_TRIGGER = extern struct { cbTriggerSize: u16, Reserved1: u16, wBeginYear: u16, wBeginMonth: u16, wBeginDay: u16, wEndYear: u16, wEndMonth: u16, wEndDay: u16, wStartHour: u16, wStartMinute: u16, MinutesDuration: u32, MinutesInterval: u32, rgFlags: u32, TriggerType: TASK_TRIGGER_TYPE, Type: TRIGGER_TYPE_UNION, Reserved2: u16, wRandomMinutesInterval: u16, }; // TODO: this type is limited to platform 'windows5.0' const IID_ITaskTrigger_Value = @import("../zig.zig").Guid.initString("148bd52b-a2ab-11ce-b11f-00aa00530503"); pub const IID_ITaskTrigger = &IID_ITaskTrigger_Value; pub const ITaskTrigger = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetTrigger: fn( self: *const ITaskTrigger, pTrigger: ?*const TASK_TRIGGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTrigger: fn( self: *const ITaskTrigger, pTrigger: ?*TASK_TRIGGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTriggerString: fn( self: *const ITaskTrigger, ppwszTrigger: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskTrigger_SetTrigger(self: *const T, pTrigger: ?*const TASK_TRIGGER) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskTrigger.VTable, self.vtable).SetTrigger(@ptrCast(*const ITaskTrigger, self), pTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskTrigger_GetTrigger(self: *const T, pTrigger: ?*TASK_TRIGGER) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskTrigger.VTable, self.vtable).GetTrigger(@ptrCast(*const ITaskTrigger, self), pTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskTrigger_GetTriggerString(self: *const T, ppwszTrigger: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskTrigger.VTable, self.vtable).GetTriggerString(@ptrCast(*const ITaskTrigger, self), ppwszTrigger); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IScheduledWorkItem_Value = @import("../zig.zig").Guid.initString("a6b952f0-a4b1-11d0-997d-00aa006887ec"); pub const IID_IScheduledWorkItem = &IID_IScheduledWorkItem_Value; pub const IScheduledWorkItem = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateTrigger: fn( self: *const IScheduledWorkItem, piNewTrigger: ?*u16, ppTrigger: ?*?*ITaskTrigger, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteTrigger: fn( self: *const IScheduledWorkItem, iTrigger: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTriggerCount: fn( self: *const IScheduledWorkItem, pwCount: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTrigger: fn( self: *const IScheduledWorkItem, iTrigger: u16, ppTrigger: ?*?*ITaskTrigger, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTriggerString: fn( self: *const IScheduledWorkItem, iTrigger: u16, ppwszTrigger: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRunTimes: fn( self: *const IScheduledWorkItem, pstBegin: ?*const SYSTEMTIME, pstEnd: ?*const SYSTEMTIME, pCount: ?*u16, rgstTaskTimes: ?*?*SYSTEMTIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNextRunTime: fn( self: *const IScheduledWorkItem, pstNextRun: ?*SYSTEMTIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIdleWait: fn( self: *const IScheduledWorkItem, wIdleMinutes: u16, wDeadlineMinutes: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIdleWait: fn( self: *const IScheduledWorkItem, pwIdleMinutes: ?*u16, pwDeadlineMinutes: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Run: fn( self: *const IScheduledWorkItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Terminate: fn( self: *const IScheduledWorkItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EditWorkItem: fn( self: *const IScheduledWorkItem, hParent: ?HWND, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMostRecentRunTime: fn( self: *const IScheduledWorkItem, pstLastRun: ?*SYSTEMTIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStatus: fn( self: *const IScheduledWorkItem, phrStatus: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExitCode: fn( self: *const IScheduledWorkItem, pdwExitCode: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetComment: fn( self: *const IScheduledWorkItem, pwszComment: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetComment: fn( self: *const IScheduledWorkItem, ppwszComment: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCreator: fn( self: *const IScheduledWorkItem, pwszCreator: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCreator: fn( self: *const IScheduledWorkItem, ppwszCreator: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetWorkItemData: fn( self: *const IScheduledWorkItem, cbData: u16, rgbData: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWorkItemData: fn( self: *const IScheduledWorkItem, pcbData: ?*u16, prgbData: ?*?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetErrorRetryCount: fn( self: *const IScheduledWorkItem, wRetryCount: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetErrorRetryCount: fn( self: *const IScheduledWorkItem, pwRetryCount: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetErrorRetryInterval: fn( self: *const IScheduledWorkItem, wRetryInterval: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetErrorRetryInterval: fn( self: *const IScheduledWorkItem, pwRetryInterval: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFlags: fn( self: *const IScheduledWorkItem, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFlags: fn( self: *const IScheduledWorkItem, pdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAccountInformation: fn( self: *const IScheduledWorkItem, pwszAccountName: ?[*:0]const u16, pwszPassword: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAccountInformation: fn( self: *const IScheduledWorkItem, ppwszAccountName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_CreateTrigger(self: *const T, piNewTrigger: ?*u16, ppTrigger: ?*?*ITaskTrigger) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).CreateTrigger(@ptrCast(*const IScheduledWorkItem, self), piNewTrigger, ppTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_DeleteTrigger(self: *const T, iTrigger: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).DeleteTrigger(@ptrCast(*const IScheduledWorkItem, self), iTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetTriggerCount(self: *const T, pwCount: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetTriggerCount(@ptrCast(*const IScheduledWorkItem, self), pwCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetTrigger(self: *const T, iTrigger: u16, ppTrigger: ?*?*ITaskTrigger) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetTrigger(@ptrCast(*const IScheduledWorkItem, self), iTrigger, ppTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetTriggerString(self: *const T, iTrigger: u16, ppwszTrigger: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetTriggerString(@ptrCast(*const IScheduledWorkItem, self), iTrigger, ppwszTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetRunTimes(self: *const T, pstBegin: ?*const SYSTEMTIME, pstEnd: ?*const SYSTEMTIME, pCount: ?*u16, rgstTaskTimes: ?*?*SYSTEMTIME) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetRunTimes(@ptrCast(*const IScheduledWorkItem, self), pstBegin, pstEnd, pCount, rgstTaskTimes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetNextRunTime(self: *const T, pstNextRun: ?*SYSTEMTIME) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetNextRunTime(@ptrCast(*const IScheduledWorkItem, self), pstNextRun); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetIdleWait(self: *const T, wIdleMinutes: u16, wDeadlineMinutes: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetIdleWait(@ptrCast(*const IScheduledWorkItem, self), wIdleMinutes, wDeadlineMinutes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetIdleWait(self: *const T, pwIdleMinutes: ?*u16, pwDeadlineMinutes: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetIdleWait(@ptrCast(*const IScheduledWorkItem, self), pwIdleMinutes, pwDeadlineMinutes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_Run(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).Run(@ptrCast(*const IScheduledWorkItem, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_Terminate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).Terminate(@ptrCast(*const IScheduledWorkItem, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_EditWorkItem(self: *const T, hParent: ?HWND, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).EditWorkItem(@ptrCast(*const IScheduledWorkItem, self), hParent, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetMostRecentRunTime(self: *const T, pstLastRun: ?*SYSTEMTIME) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetMostRecentRunTime(@ptrCast(*const IScheduledWorkItem, self), pstLastRun); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetStatus(self: *const T, phrStatus: ?*HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetStatus(@ptrCast(*const IScheduledWorkItem, self), phrStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetExitCode(self: *const T, pdwExitCode: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetExitCode(@ptrCast(*const IScheduledWorkItem, self), pdwExitCode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetComment(self: *const T, pwszComment: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetComment(@ptrCast(*const IScheduledWorkItem, self), pwszComment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetComment(self: *const T, ppwszComment: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetComment(@ptrCast(*const IScheduledWorkItem, self), ppwszComment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetCreator(self: *const T, pwszCreator: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetCreator(@ptrCast(*const IScheduledWorkItem, self), pwszCreator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetCreator(self: *const T, ppwszCreator: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetCreator(@ptrCast(*const IScheduledWorkItem, self), ppwszCreator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetWorkItemData(self: *const T, cbData: u16, rgbData: ?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetWorkItemData(@ptrCast(*const IScheduledWorkItem, self), cbData, rgbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetWorkItemData(self: *const T, pcbData: ?*u16, prgbData: ?*?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetWorkItemData(@ptrCast(*const IScheduledWorkItem, self), pcbData, prgbData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetErrorRetryCount(self: *const T, wRetryCount: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetErrorRetryCount(@ptrCast(*const IScheduledWorkItem, self), wRetryCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetErrorRetryCount(self: *const T, pwRetryCount: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetErrorRetryCount(@ptrCast(*const IScheduledWorkItem, self), pwRetryCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetErrorRetryInterval(self: *const T, wRetryInterval: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetErrorRetryInterval(@ptrCast(*const IScheduledWorkItem, self), wRetryInterval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetErrorRetryInterval(self: *const T, pwRetryInterval: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetErrorRetryInterval(@ptrCast(*const IScheduledWorkItem, self), pwRetryInterval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetFlags(self: *const T, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetFlags(@ptrCast(*const IScheduledWorkItem, self), dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetFlags(self: *const T, pdwFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetFlags(@ptrCast(*const IScheduledWorkItem, self), pdwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_SetAccountInformation(self: *const T, pwszAccountName: ?[*:0]const u16, pwszPassword: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).SetAccountInformation(@ptrCast(*const IScheduledWorkItem, self), pwszAccountName, pwszPassword); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IScheduledWorkItem_GetAccountInformation(self: *const T, ppwszAccountName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IScheduledWorkItem.VTable, self.vtable).GetAccountInformation(@ptrCast(*const IScheduledWorkItem, self), ppwszAccountName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ITask_Value = @import("../zig.zig").Guid.initString("148bd524-a2ab-11ce-b11f-00aa00530503"); pub const IID_ITask = &IID_ITask_Value; pub const ITask = extern struct { pub const VTable = extern struct { base: IScheduledWorkItem.VTable, SetApplicationName: fn( self: *const ITask, pwszApplicationName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetApplicationName: fn( self: *const ITask, ppwszApplicationName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetParameters: fn( self: *const ITask, pwszParameters: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParameters: fn( self: *const ITask, ppwszParameters: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetWorkingDirectory: fn( self: *const ITask, pwszWorkingDirectory: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWorkingDirectory: fn( self: *const ITask, ppwszWorkingDirectory: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPriority: fn( self: *const ITask, dwPriority: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPriority: fn( self: *const ITask, pdwPriority: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTaskFlags: fn( self: *const ITask, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTaskFlags: fn( self: *const ITask, pdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMaxRunTime: fn( self: *const ITask, dwMaxRunTimeMS: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMaxRunTime: fn( self: *const ITask, pdwMaxRunTimeMS: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IScheduledWorkItem.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_SetApplicationName(self: *const T, pwszApplicationName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).SetApplicationName(@ptrCast(*const ITask, self), pwszApplicationName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_GetApplicationName(self: *const T, ppwszApplicationName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).GetApplicationName(@ptrCast(*const ITask, self), ppwszApplicationName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_SetParameters(self: *const T, pwszParameters: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).SetParameters(@ptrCast(*const ITask, self), pwszParameters); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_GetParameters(self: *const T, ppwszParameters: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).GetParameters(@ptrCast(*const ITask, self), ppwszParameters); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_SetWorkingDirectory(self: *const T, pwszWorkingDirectory: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).SetWorkingDirectory(@ptrCast(*const ITask, self), pwszWorkingDirectory); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_GetWorkingDirectory(self: *const T, ppwszWorkingDirectory: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).GetWorkingDirectory(@ptrCast(*const ITask, self), ppwszWorkingDirectory); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_SetPriority(self: *const T, dwPriority: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).SetPriority(@ptrCast(*const ITask, self), dwPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_GetPriority(self: *const T, pdwPriority: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).GetPriority(@ptrCast(*const ITask, self), pdwPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_SetTaskFlags(self: *const T, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).SetTaskFlags(@ptrCast(*const ITask, self), dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_GetTaskFlags(self: *const T, pdwFlags: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).GetTaskFlags(@ptrCast(*const ITask, self), pdwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_SetMaxRunTime(self: *const T, dwMaxRunTimeMS: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).SetMaxRunTime(@ptrCast(*const ITask, self), dwMaxRunTimeMS); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITask_GetMaxRunTime(self: *const T, pdwMaxRunTimeMS: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITask.VTable, self.vtable).GetMaxRunTime(@ptrCast(*const ITask, self), pdwMaxRunTimeMS); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumWorkItems_Value = @import("../zig.zig").Guid.initString("148bd528-a2ab-11ce-b11f-00aa00530503"); pub const IID_IEnumWorkItems = &IID_IEnumWorkItems_Value; pub const IEnumWorkItems = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumWorkItems, celt: u32, rgpwszNames: ?*?*?PWSTR, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumWorkItems, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumWorkItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumWorkItems, ppEnumWorkItems: ?*?*IEnumWorkItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumWorkItems_Next(self: *const T, celt: u32, rgpwszNames: ?*?*?PWSTR, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumWorkItems.VTable, self.vtable).Next(@ptrCast(*const IEnumWorkItems, self), celt, rgpwszNames, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumWorkItems_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumWorkItems.VTable, self.vtable).Skip(@ptrCast(*const IEnumWorkItems, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumWorkItems_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumWorkItems.VTable, self.vtable).Reset(@ptrCast(*const IEnumWorkItems, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumWorkItems_Clone(self: *const T, ppEnumWorkItems: ?*?*IEnumWorkItems) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumWorkItems.VTable, self.vtable).Clone(@ptrCast(*const IEnumWorkItems, self), ppEnumWorkItems); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ITaskScheduler_Value = @import("../zig.zig").Guid.initString("148bd527-a2ab-11ce-b11f-00aa00530503"); pub const IID_ITaskScheduler = &IID_ITaskScheduler_Value; pub const ITaskScheduler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetTargetComputer: fn( self: *const ITaskScheduler, pwszComputer: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTargetComputer: fn( self: *const ITaskScheduler, ppwszComputer: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enum: fn( self: *const ITaskScheduler, ppEnumWorkItems: ?*?*IEnumWorkItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Activate: fn( self: *const ITaskScheduler, pwszName: ?[*:0]const u16, riid: ?*const Guid, ppUnk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Delete: fn( self: *const ITaskScheduler, pwszName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NewWorkItem: fn( self: *const ITaskScheduler, pwszTaskName: ?[*:0]const u16, rclsid: ?*const Guid, riid: ?*const Guid, ppUnk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddWorkItem: fn( self: *const ITaskScheduler, pwszTaskName: ?[*:0]const u16, pWorkItem: ?*IScheduledWorkItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsOfType: fn( self: *const ITaskScheduler, pwszName: ?[*:0]const u16, riid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_SetTargetComputer(self: *const T, pwszComputer: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).SetTargetComputer(@ptrCast(*const ITaskScheduler, self), pwszComputer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_GetTargetComputer(self: *const T, ppwszComputer: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).GetTargetComputer(@ptrCast(*const ITaskScheduler, self), ppwszComputer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_Enum(self: *const T, ppEnumWorkItems: ?*?*IEnumWorkItems) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).Enum(@ptrCast(*const ITaskScheduler, self), ppEnumWorkItems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_Activate(self: *const T, pwszName: ?[*:0]const u16, riid: ?*const Guid, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).Activate(@ptrCast(*const ITaskScheduler, self), pwszName, riid, ppUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_Delete(self: *const T, pwszName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).Delete(@ptrCast(*const ITaskScheduler, self), pwszName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_NewWorkItem(self: *const T, pwszTaskName: ?[*:0]const u16, rclsid: ?*const Guid, riid: ?*const Guid, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).NewWorkItem(@ptrCast(*const ITaskScheduler, self), pwszTaskName, rclsid, riid, ppUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_AddWorkItem(self: *const T, pwszTaskName: ?[*:0]const u16, pWorkItem: ?*IScheduledWorkItem) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).AddWorkItem(@ptrCast(*const ITaskScheduler, self), pwszTaskName, pWorkItem); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskScheduler_IsOfType(self: *const T, pwszName: ?[*:0]const u16, riid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskScheduler.VTable, self.vtable).IsOfType(@ptrCast(*const ITaskScheduler, self), pwszName, riid); } };} pub usingnamespace MethodMixin(@This()); }; pub const TASKPAGE = enum(i32) { TASK = 0, SCHEDULE = 1, SETTINGS = 2, }; pub const TASKPAGE_TASK = TASKPAGE.TASK; pub const TASKPAGE_SCHEDULE = TASKPAGE.SCHEDULE; pub const TASKPAGE_SETTINGS = TASKPAGE.SETTINGS; // TODO: this type is limited to platform 'windows5.0' const IID_IProvideTaskPage_Value = @import("../zig.zig").Guid.initString("4086658a-cbbb-11cf-b604-00c04fd8d565"); pub const IID_IProvideTaskPage = &IID_IProvideTaskPage_Value; pub const IProvideTaskPage = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPage: fn( self: *const IProvideTaskPage, tpType: TASKPAGE, fPersistChanges: BOOL, phPage: ?*?HPROPSHEETPAGE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideTaskPage_GetPage(self: *const T, tpType: TASKPAGE, fPersistChanges: BOOL, phPage: ?*?HPROPSHEETPAGE) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideTaskPage.VTable, self.vtable).GetPage(@ptrCast(*const IProvideTaskPage, self), tpType, fPersistChanges, phPage); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_TaskScheduler_Value = @import("../zig.zig").Guid.initString("0f87369f-a4e5-4cfc-bd3e-73e6154572dd"); pub const CLSID_TaskScheduler = &CLSID_TaskScheduler_Value; const CLSID_TaskHandlerPS_Value = @import("../zig.zig").Guid.initString("f2a69db7-da2c-4352-9066-86fee6dacac9"); pub const CLSID_TaskHandlerPS = &CLSID_TaskHandlerPS_Value; const CLSID_TaskHandlerStatusPS_Value = @import("../zig.zig").Guid.initString("9f15266d-d7ba-48f0-93c1-e6895f6fe5ac"); pub const CLSID_TaskHandlerStatusPS = &CLSID_TaskHandlerStatusPS_Value; pub const TASK_RUN_FLAGS = enum(i32) { NO_FLAGS = 0, AS_SELF = 1, IGNORE_CONSTRAINTS = 2, USE_SESSION_ID = 4, USER_SID = 8, }; pub const TASK_RUN_NO_FLAGS = TASK_RUN_FLAGS.NO_FLAGS; pub const TASK_RUN_AS_SELF = TASK_RUN_FLAGS.AS_SELF; pub const TASK_RUN_IGNORE_CONSTRAINTS = TASK_RUN_FLAGS.IGNORE_CONSTRAINTS; pub const TASK_RUN_USE_SESSION_ID = TASK_RUN_FLAGS.USE_SESSION_ID; pub const TASK_RUN_USER_SID = TASK_RUN_FLAGS.USER_SID; pub const TASK_ENUM_FLAGS = enum(i32) { N = 1, }; pub const TASK_ENUM_HIDDEN = TASK_ENUM_FLAGS.N; pub const TASK_LOGON_TYPE = enum(i32) { NONE = 0, PASSWORD = 1, S4U = 2, INTERACTIVE_TOKEN = 3, GROUP = 4, SERVICE_ACCOUNT = 5, INTERACTIVE_TOKEN_OR_PASSWORD = 6, }; pub const TASK_LOGON_NONE = TASK_LOGON_TYPE.NONE; pub const TASK_LOGON_PASSWORD = TASK_LOGON_TYPE.PASSWORD; pub const TASK_LOGON_S4U = TASK_LOGON_TYPE.S4U; pub const TASK_LOGON_INTERACTIVE_TOKEN = TASK_LOGON_TYPE.INTERACTIVE_TOKEN; pub const TASK_LOGON_GROUP = TASK_LOGON_TYPE.GROUP; pub const TASK_LOGON_SERVICE_ACCOUNT = TASK_LOGON_TYPE.SERVICE_ACCOUNT; pub const TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD = TASK_LOGON_TYPE.INTERACTIVE_TOKEN_OR_PASSWORD; pub const TASK_RUNLEVEL_TYPE = enum(i32) { LUA = 0, HIGHEST = 1, }; pub const TASK_RUNLEVEL_LUA = TASK_RUNLEVEL_TYPE.LUA; pub const TASK_RUNLEVEL_HIGHEST = TASK_RUNLEVEL_TYPE.HIGHEST; pub const TASK_PROCESSTOKENSID_TYPE = enum(i32) { NONE = 0, UNRESTRICTED = 1, DEFAULT = 2, }; pub const TASK_PROCESSTOKENSID_NONE = TASK_PROCESSTOKENSID_TYPE.NONE; pub const TASK_PROCESSTOKENSID_UNRESTRICTED = TASK_PROCESSTOKENSID_TYPE.UNRESTRICTED; pub const TASK_PROCESSTOKENSID_DEFAULT = TASK_PROCESSTOKENSID_TYPE.DEFAULT; pub const TASK_STATE = enum(i32) { UNKNOWN = 0, DISABLED = 1, QUEUED = 2, READY = 3, RUNNING = 4, }; pub const TASK_STATE_UNKNOWN = TASK_STATE.UNKNOWN; pub const TASK_STATE_DISABLED = TASK_STATE.DISABLED; pub const TASK_STATE_QUEUED = TASK_STATE.QUEUED; pub const TASK_STATE_READY = TASK_STATE.READY; pub const TASK_STATE_RUNNING = TASK_STATE.RUNNING; pub const TASK_CREATION = enum(i32) { VALIDATE_ONLY = 1, CREATE = 2, UPDATE = 4, CREATE_OR_UPDATE = 6, DISABLE = 8, DONT_ADD_PRINCIPAL_ACE = 16, IGNORE_REGISTRATION_TRIGGERS = 32, }; pub const TASK_VALIDATE_ONLY = TASK_CREATION.VALIDATE_ONLY; pub const TASK_CREATE = TASK_CREATION.CREATE; pub const TASK_UPDATE = TASK_CREATION.UPDATE; pub const TASK_CREATE_OR_UPDATE = TASK_CREATION.CREATE_OR_UPDATE; pub const TASK_DISABLE = TASK_CREATION.DISABLE; pub const TASK_DONT_ADD_PRINCIPAL_ACE = TASK_CREATION.DONT_ADD_PRINCIPAL_ACE; pub const TASK_IGNORE_REGISTRATION_TRIGGERS = TASK_CREATION.IGNORE_REGISTRATION_TRIGGERS; pub const TASK_TRIGGER_TYPE2 = enum(i32) { EVENT = 0, TIME = 1, DAILY = 2, WEEKLY = 3, MONTHLY = 4, MONTHLYDOW = 5, IDLE = 6, REGISTRATION = 7, BOOT = 8, LOGON = 9, SESSION_STATE_CHANGE = 11, CUSTOM_TRIGGER_01 = 12, }; pub const TASK_TRIGGER_EVENT = TASK_TRIGGER_TYPE2.EVENT; pub const TASK_TRIGGER_TIME = TASK_TRIGGER_TYPE2.TIME; pub const TASK_TRIGGER_DAILY = TASK_TRIGGER_TYPE2.DAILY; pub const TASK_TRIGGER_WEEKLY = TASK_TRIGGER_TYPE2.WEEKLY; pub const TASK_TRIGGER_MONTHLY = TASK_TRIGGER_TYPE2.MONTHLY; pub const TASK_TRIGGER_MONTHLYDOW = TASK_TRIGGER_TYPE2.MONTHLYDOW; pub const TASK_TRIGGER_IDLE = TASK_TRIGGER_TYPE2.IDLE; pub const TASK_TRIGGER_REGISTRATION = TASK_TRIGGER_TYPE2.REGISTRATION; pub const TASK_TRIGGER_BOOT = TASK_TRIGGER_TYPE2.BOOT; pub const TASK_TRIGGER_LOGON = TASK_TRIGGER_TYPE2.LOGON; pub const TASK_TRIGGER_SESSION_STATE_CHANGE = TASK_TRIGGER_TYPE2.SESSION_STATE_CHANGE; pub const TASK_TRIGGER_CUSTOM_TRIGGER_01 = TASK_TRIGGER_TYPE2.CUSTOM_TRIGGER_01; pub const TASK_SESSION_STATE_CHANGE_TYPE = enum(i32) { CONSOLE_CONNECT = 1, CONSOLE_DISCONNECT = 2, REMOTE_CONNECT = 3, REMOTE_DISCONNECT = 4, SESSION_LOCK = 7, SESSION_UNLOCK = 8, }; pub const TASK_CONSOLE_CONNECT = TASK_SESSION_STATE_CHANGE_TYPE.CONSOLE_CONNECT; pub const TASK_CONSOLE_DISCONNECT = TASK_SESSION_STATE_CHANGE_TYPE.CONSOLE_DISCONNECT; pub const TASK_REMOTE_CONNECT = TASK_SESSION_STATE_CHANGE_TYPE.REMOTE_CONNECT; pub const TASK_REMOTE_DISCONNECT = TASK_SESSION_STATE_CHANGE_TYPE.REMOTE_DISCONNECT; pub const TASK_SESSION_LOCK = TASK_SESSION_STATE_CHANGE_TYPE.SESSION_LOCK; pub const TASK_SESSION_UNLOCK = TASK_SESSION_STATE_CHANGE_TYPE.SESSION_UNLOCK; pub const TASK_ACTION_TYPE = enum(i32) { EXEC = 0, COM_HANDLER = 5, SEND_EMAIL = 6, SHOW_MESSAGE = 7, }; pub const TASK_ACTION_EXEC = TASK_ACTION_TYPE.EXEC; pub const TASK_ACTION_COM_HANDLER = TASK_ACTION_TYPE.COM_HANDLER; pub const TASK_ACTION_SEND_EMAIL = TASK_ACTION_TYPE.SEND_EMAIL; pub const TASK_ACTION_SHOW_MESSAGE = TASK_ACTION_TYPE.SHOW_MESSAGE; pub const TASK_INSTANCES_POLICY = enum(i32) { PARALLEL = 0, QUEUE = 1, IGNORE_NEW = 2, STOP_EXISTING = 3, }; pub const TASK_INSTANCES_PARALLEL = TASK_INSTANCES_POLICY.PARALLEL; pub const TASK_INSTANCES_QUEUE = TASK_INSTANCES_POLICY.QUEUE; pub const TASK_INSTANCES_IGNORE_NEW = TASK_INSTANCES_POLICY.IGNORE_NEW; pub const TASK_INSTANCES_STOP_EXISTING = TASK_INSTANCES_POLICY.STOP_EXISTING; pub const TASK_COMPATIBILITY = enum(i32) { AT = 0, V1 = 1, V2 = 2, V2_1 = 3, V2_2 = 4, V2_3 = 5, V2_4 = 6, }; pub const TASK_COMPATIBILITY_AT = TASK_COMPATIBILITY.AT; pub const TASK_COMPATIBILITY_V1 = TASK_COMPATIBILITY.V1; pub const TASK_COMPATIBILITY_V2 = TASK_COMPATIBILITY.V2; pub const TASK_COMPATIBILITY_V2_1 = TASK_COMPATIBILITY.V2_1; pub const TASK_COMPATIBILITY_V2_2 = TASK_COMPATIBILITY.V2_2; pub const TASK_COMPATIBILITY_V2_3 = TASK_COMPATIBILITY.V2_3; pub const TASK_COMPATIBILITY_V2_4 = TASK_COMPATIBILITY.V2_4; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskFolderCollection_Value = @import("../zig.zig").Guid.initString("79184a66-8664-423f-97f1-637356a5d812"); pub const IID_ITaskFolderCollection = &IID_ITaskFolderCollection_Value; pub const ITaskFolderCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ITaskFolderCollection, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ITaskFolderCollection, index: VARIANT, ppFolder: ?*?*ITaskFolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ITaskFolderCollection, ppEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolderCollection_get_Count(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolderCollection.VTable, self.vtable).get_Count(@ptrCast(*const ITaskFolderCollection, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolderCollection_get_Item(self: *const T, index: VARIANT, ppFolder: ?*?*ITaskFolder) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolderCollection.VTable, self.vtable).get_Item(@ptrCast(*const ITaskFolderCollection, self), index, ppFolder); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolderCollection_get__NewEnum(self: *const T, ppEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolderCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const ITaskFolderCollection, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskService_Value = @import("../zig.zig").Guid.initString("2faba4c7-4da9-4013-9697-20cc3fd40f85"); pub const IID_ITaskService = &IID_ITaskService_Value; pub const ITaskService = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, GetFolder: fn( self: *const ITaskService, path: ?BSTR, ppFolder: ?*?*ITaskFolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRunningTasks: fn( self: *const ITaskService, flags: i32, ppRunningTasks: ?*?*IRunningTaskCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NewTask: fn( self: *const ITaskService, flags: u32, ppDefinition: ?*?*ITaskDefinition, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Connect: fn( self: *const ITaskService, serverName: VARIANT, user: VARIANT, domain: VARIANT, password: <PASSWORD>, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Connected: fn( self: *const ITaskService, pConnected: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_TargetServer: fn( self: *const ITaskService, pServer: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ConnectedUser: fn( self: *const ITaskService, pUser: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ConnectedDomain: fn( self: *const ITaskService, pDomain: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HighestVersion: fn( self: *const ITaskService, pVersion: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_GetFolder(self: *const T, path: ?BSTR, ppFolder: ?*?*ITaskFolder) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).GetFolder(@ptrCast(*const ITaskService, self), path, ppFolder); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_GetRunningTasks(self: *const T, flags: i32, ppRunningTasks: ?*?*IRunningTaskCollection) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).GetRunningTasks(@ptrCast(*const ITaskService, self), flags, ppRunningTasks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_NewTask(self: *const T, flags: u32, ppDefinition: ?*?*ITaskDefinition) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).NewTask(@ptrCast(*const ITaskService, self), flags, ppDefinition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_Connect(self: *const T, serverName: VARIANT, user: VARIANT, domain: VARIANT, password: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).Connect(@ptrCast(*const ITaskService, self), serverName, user, domain, password); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_get_Connected(self: *const T, pConnected: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).get_Connected(@ptrCast(*const ITaskService, self), pConnected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_get_TargetServer(self: *const T, pServer: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).get_TargetServer(@ptrCast(*const ITaskService, self), pServer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_get_ConnectedUser(self: *const T, pUser: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).get_ConnectedUser(@ptrCast(*const ITaskService, self), pUser); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_get_ConnectedDomain(self: *const T, pDomain: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).get_ConnectedDomain(@ptrCast(*const ITaskService, self), pDomain); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskService_get_HighestVersion(self: *const T, pVersion: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskService.VTable, self.vtable).get_HighestVersion(@ptrCast(*const ITaskService, self), pVersion); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskHandler_Value = @import("../zig.zig").Guid.initString("839d7762-5121-4009-9234-4f0d19394f04"); pub const IID_ITaskHandler = &IID_ITaskHandler_Value; pub const ITaskHandler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Start: fn( self: *const ITaskHandler, pHandlerServices: ?*IUnknown, data: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stop: fn( self: *const ITaskHandler, pRetCode: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Pause: fn( self: *const ITaskHandler, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Resume: fn( self: *const ITaskHandler, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskHandler_Start(self: *const T, pHandlerServices: ?*IUnknown, data: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskHandler.VTable, self.vtable).Start(@ptrCast(*const ITaskHandler, self), pHandlerServices, data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskHandler_Stop(self: *const T, pRetCode: ?*HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskHandler.VTable, self.vtable).Stop(@ptrCast(*const ITaskHandler, self), pRetCode); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskHandler_Pause(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskHandler.VTable, self.vtable).Pause(@ptrCast(*const ITaskHandler, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskHandler_Resume(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskHandler.VTable, self.vtable).Resume(@ptrCast(*const ITaskHandler, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskHandlerStatus_Value = @import("../zig.zig").Guid.initString("eaec7a8f-27a0-4ddc-8675-14726a01a38a"); pub const IID_ITaskHandlerStatus = &IID_ITaskHandlerStatus_Value; pub const ITaskHandlerStatus = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, UpdateStatus: fn( self: *const ITaskHandlerStatus, percentComplete: i16, statusMessage: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TaskCompleted: fn( self: *const ITaskHandlerStatus, taskErrCode: HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskHandlerStatus_UpdateStatus(self: *const T, percentComplete: i16, statusMessage: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskHandlerStatus.VTable, self.vtable).UpdateStatus(@ptrCast(*const ITaskHandlerStatus, self), percentComplete, statusMessage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskHandlerStatus_TaskCompleted(self: *const T, taskErrCode: HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskHandlerStatus.VTable, self.vtable).TaskCompleted(@ptrCast(*const ITaskHandlerStatus, self), taskErrCode); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskVariables_Value = @import("../zig.zig").Guid.initString("3e4c9351-d966-4b8b-bb87-ceba68bb0107"); pub const IID_ITaskVariables = &IID_ITaskVariables_Value; pub const ITaskVariables = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetInput: fn( self: *const ITaskVariables, pInput: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetOutput: fn( self: *const ITaskVariables, input: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContext: fn( self: *const ITaskVariables, pContext: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskVariables_GetInput(self: *const T, pInput: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskVariables.VTable, self.vtable).GetInput(@ptrCast(*const ITaskVariables, self), pInput); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskVariables_SetOutput(self: *const T, input: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskVariables.VTable, self.vtable).SetOutput(@ptrCast(*const ITaskVariables, self), input); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskVariables_GetContext(self: *const T, pContext: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskVariables.VTable, self.vtable).GetContext(@ptrCast(*const ITaskVariables, self), pContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskNamedValuePair_Value = @import("../zig.zig").Guid.initString("39038068-2b46-4afd-8662-7bb6f868d221"); pub const IID_ITaskNamedValuePair = &IID_ITaskNamedValuePair_Value; pub const ITaskNamedValuePair = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ITaskNamedValuePair, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const ITaskNamedValuePair, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Value: fn( self: *const ITaskNamedValuePair, pValue: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Value: fn( self: *const ITaskNamedValuePair, value: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValuePair_get_Name(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValuePair.VTable, self.vtable).get_Name(@ptrCast(*const ITaskNamedValuePair, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValuePair_put_Name(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValuePair.VTable, self.vtable).put_Name(@ptrCast(*const ITaskNamedValuePair, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValuePair_get_Value(self: *const T, pValue: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValuePair.VTable, self.vtable).get_Value(@ptrCast(*const ITaskNamedValuePair, self), pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValuePair_put_Value(self: *const T, value: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValuePair.VTable, self.vtable).put_Value(@ptrCast(*const ITaskNamedValuePair, self), value); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskNamedValueCollection_Value = @import("../zig.zig").Guid.initString("b4ef826b-63c3-46e4-a504-ef69e4f7ea4d"); pub const IID_ITaskNamedValueCollection = &IID_ITaskNamedValueCollection_Value; pub const ITaskNamedValueCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ITaskNamedValueCollection, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ITaskNamedValueCollection, index: i32, ppPair: ?*?*ITaskNamedValuePair, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ITaskNamedValueCollection, ppEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Create: fn( self: *const ITaskNamedValueCollection, name: ?BSTR, value: ?BSTR, ppPair: ?*?*ITaskNamedValuePair, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const ITaskNamedValueCollection, index: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const ITaskNamedValueCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValueCollection_get_Count(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValueCollection.VTable, self.vtable).get_Count(@ptrCast(*const ITaskNamedValueCollection, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValueCollection_get_Item(self: *const T, index: i32, ppPair: ?*?*ITaskNamedValuePair) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValueCollection.VTable, self.vtable).get_Item(@ptrCast(*const ITaskNamedValueCollection, self), index, ppPair); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValueCollection_get__NewEnum(self: *const T, ppEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValueCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const ITaskNamedValueCollection, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValueCollection_Create(self: *const T, name: ?BSTR, value: ?BSTR, ppPair: ?*?*ITaskNamedValuePair) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValueCollection.VTable, self.vtable).Create(@ptrCast(*const ITaskNamedValueCollection, self), name, value, ppPair); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValueCollection_Remove(self: *const T, index: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValueCollection.VTable, self.vtable).Remove(@ptrCast(*const ITaskNamedValueCollection, self), index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskNamedValueCollection_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskNamedValueCollection.VTable, self.vtable).Clear(@ptrCast(*const ITaskNamedValueCollection, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRunningTask_Value = @import("../zig.zig").Guid.initString("653758fb-7b9a-4f1e-a471-beeb8e9b834e"); pub const IID_IRunningTask = &IID_IRunningTask_Value; pub const IRunningTask = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IRunningTask, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_InstanceGuid: fn( self: *const IRunningTask, pGuid: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Path: fn( self: *const IRunningTask, pPath: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const IRunningTask, pState: ?*TASK_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurrentAction: fn( self: *const IRunningTask, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stop: fn( self: *const IRunningTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Refresh: fn( self: *const IRunningTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EnginePID: fn( self: *const IRunningTask, pPID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_get_Name(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).get_Name(@ptrCast(*const IRunningTask, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_get_InstanceGuid(self: *const T, pGuid: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).get_InstanceGuid(@ptrCast(*const IRunningTask, self), pGuid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_get_Path(self: *const T, pPath: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).get_Path(@ptrCast(*const IRunningTask, self), pPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_get_State(self: *const T, pState: ?*TASK_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).get_State(@ptrCast(*const IRunningTask, self), pState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_get_CurrentAction(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).get_CurrentAction(@ptrCast(*const IRunningTask, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_Stop(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).Stop(@ptrCast(*const IRunningTask, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_Refresh(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).Refresh(@ptrCast(*const IRunningTask, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTask_get_EnginePID(self: *const T, pPID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTask.VTable, self.vtable).get_EnginePID(@ptrCast(*const IRunningTask, self), pPID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRunningTaskCollection_Value = @import("../zig.zig").Guid.initString("6a67614b-6828-4fec-aa54-6d52e8f1f2db"); pub const IID_IRunningTaskCollection = &IID_IRunningTaskCollection_Value; pub const IRunningTaskCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IRunningTaskCollection, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IRunningTaskCollection, index: VARIANT, ppRunningTask: ?*?*IRunningTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IRunningTaskCollection, ppEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTaskCollection_get_Count(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTaskCollection.VTable, self.vtable).get_Count(@ptrCast(*const IRunningTaskCollection, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTaskCollection_get_Item(self: *const T, index: VARIANT, ppRunningTask: ?*?*IRunningTask) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTaskCollection.VTable, self.vtable).get_Item(@ptrCast(*const IRunningTaskCollection, self), index, ppRunningTask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRunningTaskCollection_get__NewEnum(self: *const T, ppEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRunningTaskCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const IRunningTaskCollection, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRegisteredTask_Value = @import("../zig.zig").Guid.initString("9c86f320-dee3-4dd1-b972-a303f26b061e"); pub const IID_IRegisteredTask = &IID_IRegisteredTask_Value; pub const IRegisteredTask = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IRegisteredTask, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Path: fn( self: *const IRegisteredTask, pPath: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_State: fn( self: *const IRegisteredTask, pState: ?*TASK_STATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const IRegisteredTask, pEnabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const IRegisteredTask, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Run: fn( self: *const IRegisteredTask, params: VARIANT, ppRunningTask: ?*?*IRunningTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunEx: fn( self: *const IRegisteredTask, params: VARIANT, flags: i32, sessionID: i32, user: ?BSTR, ppRunningTask: ?*?*IRunningTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInstances: fn( self: *const IRegisteredTask, flags: i32, ppRunningTasks: ?*?*IRunningTaskCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LastRunTime: fn( self: *const IRegisteredTask, pLastRunTime: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LastTaskResult: fn( self: *const IRegisteredTask, pLastTaskResult: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NumberOfMissedRuns: fn( self: *const IRegisteredTask, pNumberOfMissedRuns: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NextRunTime: fn( self: *const IRegisteredTask, pNextRunTime: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Definition: fn( self: *const IRegisteredTask, ppDefinition: ?*?*ITaskDefinition, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Xml: fn( self: *const IRegisteredTask, pXml: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSecurityDescriptor: fn( self: *const IRegisteredTask, securityInformation: i32, pSddl: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSecurityDescriptor: fn( self: *const IRegisteredTask, sddl: ?BSTR, flags: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stop: fn( self: *const IRegisteredTask, flags: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRunTimes: fn( self: *const IRegisteredTask, pstStart: ?*const SYSTEMTIME, pstEnd: ?*const SYSTEMTIME, pCount: ?*u32, pRunTimes: ?*?*SYSTEMTIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_Name(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_Name(@ptrCast(*const IRegisteredTask, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_Path(self: *const T, pPath: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_Path(@ptrCast(*const IRegisteredTask, self), pPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_State(self: *const T, pState: ?*TASK_STATE) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_State(@ptrCast(*const IRegisteredTask, self), pState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_Enabled(self: *const T, pEnabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_Enabled(@ptrCast(*const IRegisteredTask, self), pEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).put_Enabled(@ptrCast(*const IRegisteredTask, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_Run(self: *const T, params: VARIANT, ppRunningTask: ?*?*IRunningTask) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).Run(@ptrCast(*const IRegisteredTask, self), params, ppRunningTask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_RunEx(self: *const T, params: VARIANT, flags: i32, sessionID: i32, user: ?BSTR, ppRunningTask: ?*?*IRunningTask) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).RunEx(@ptrCast(*const IRegisteredTask, self), params, flags, sessionID, user, ppRunningTask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_GetInstances(self: *const T, flags: i32, ppRunningTasks: ?*?*IRunningTaskCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).GetInstances(@ptrCast(*const IRegisteredTask, self), flags, ppRunningTasks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_LastRunTime(self: *const T, pLastRunTime: ?*f64) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_LastRunTime(@ptrCast(*const IRegisteredTask, self), pLastRunTime); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_LastTaskResult(self: *const T, pLastTaskResult: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_LastTaskResult(@ptrCast(*const IRegisteredTask, self), pLastTaskResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_NumberOfMissedRuns(self: *const T, pNumberOfMissedRuns: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_NumberOfMissedRuns(@ptrCast(*const IRegisteredTask, self), pNumberOfMissedRuns); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_NextRunTime(self: *const T, pNextRunTime: ?*f64) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_NextRunTime(@ptrCast(*const IRegisteredTask, self), pNextRunTime); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_Definition(self: *const T, ppDefinition: ?*?*ITaskDefinition) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_Definition(@ptrCast(*const IRegisteredTask, self), ppDefinition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_get_Xml(self: *const T, pXml: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).get_Xml(@ptrCast(*const IRegisteredTask, self), pXml); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_GetSecurityDescriptor(self: *const T, securityInformation: i32, pSddl: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).GetSecurityDescriptor(@ptrCast(*const IRegisteredTask, self), securityInformation, pSddl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_SetSecurityDescriptor(self: *const T, sddl: ?BSTR, flags: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).SetSecurityDescriptor(@ptrCast(*const IRegisteredTask, self), sddl, flags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_Stop(self: *const T, flags: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).Stop(@ptrCast(*const IRegisteredTask, self), flags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTask_GetRunTimes(self: *const T, pstStart: ?*const SYSTEMTIME, pstEnd: ?*const SYSTEMTIME, pCount: ?*u32, pRunTimes: ?*?*SYSTEMTIME) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTask.VTable, self.vtable).GetRunTimes(@ptrCast(*const IRegisteredTask, self), pstStart, pstEnd, pCount, pRunTimes); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITrigger_Value = @import("../zig.zig").Guid.initString("09941815-ea89-4b5b-89e0-2a773801fac3"); pub const IID_ITrigger = &IID_ITrigger_Value; pub const ITrigger = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const ITrigger, pType: ?*TASK_TRIGGER_TYPE2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const ITrigger, pId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Id: fn( self: *const ITrigger, id: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Repetition: fn( self: *const ITrigger, ppRepeat: ?*?*IRepetitionPattern, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Repetition: fn( self: *const ITrigger, pRepeat: ?*IRepetitionPattern, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExecutionTimeLimit: fn( self: *const ITrigger, pTimeLimit: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ExecutionTimeLimit: fn( self: *const ITrigger, timelimit: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StartBoundary: fn( self: *const ITrigger, pStart: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_StartBoundary: fn( self: *const ITrigger, start: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_EndBoundary: fn( self: *const ITrigger, pEnd: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_EndBoundary: fn( self: *const ITrigger, end: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const ITrigger, pEnabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const ITrigger, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_get_Type(self: *const T, pType: ?*TASK_TRIGGER_TYPE2) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).get_Type(@ptrCast(*const ITrigger, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_get_Id(self: *const T, pId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).get_Id(@ptrCast(*const ITrigger, self), pId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_put_Id(self: *const T, id: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).put_Id(@ptrCast(*const ITrigger, self), id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_get_Repetition(self: *const T, ppRepeat: ?*?*IRepetitionPattern) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).get_Repetition(@ptrCast(*const ITrigger, self), ppRepeat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_put_Repetition(self: *const T, pRepeat: ?*IRepetitionPattern) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).put_Repetition(@ptrCast(*const ITrigger, self), pRepeat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_get_ExecutionTimeLimit(self: *const T, pTimeLimit: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).get_ExecutionTimeLimit(@ptrCast(*const ITrigger, self), pTimeLimit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_put_ExecutionTimeLimit(self: *const T, timelimit: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).put_ExecutionTimeLimit(@ptrCast(*const ITrigger, self), timelimit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_get_StartBoundary(self: *const T, pStart: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).get_StartBoundary(@ptrCast(*const ITrigger, self), pStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_put_StartBoundary(self: *const T, start: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).put_StartBoundary(@ptrCast(*const ITrigger, self), start); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_get_EndBoundary(self: *const T, pEnd: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).get_EndBoundary(@ptrCast(*const ITrigger, self), pEnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_put_EndBoundary(self: *const T, end: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).put_EndBoundary(@ptrCast(*const ITrigger, self), end); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_get_Enabled(self: *const T, pEnabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).get_Enabled(@ptrCast(*const ITrigger, self), pEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrigger_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITrigger.VTable, self.vtable).put_Enabled(@ptrCast(*const ITrigger, self), enabled); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IIdleTrigger_Value = @import("../zig.zig").Guid.initString("d537d2b0-9fb3-4d34-9739-1ff5ce7b1ef3"); pub const IID_IIdleTrigger = &IID_IIdleTrigger_Value; pub const IIdleTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ILogonTrigger_Value = @import("../zig.zig").Guid.initString("72dade38-fae4-4b3e-baf4-5d009af02b1c"); pub const IID_ILogonTrigger = &IID_ILogonTrigger_Value; pub const ILogonTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Delay: fn( self: *const ILogonTrigger, pDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Delay: fn( self: *const ILogonTrigger, delay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UserId: fn( self: *const ILogonTrigger, pUser: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UserId: fn( self: *const ILogonTrigger, user: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ILogonTrigger_get_Delay(self: *const T, pDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ILogonTrigger.VTable, self.vtable).get_Delay(@ptrCast(*const ILogonTrigger, self), pDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ILogonTrigger_put_Delay(self: *const T, delay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ILogonTrigger.VTable, self.vtable).put_Delay(@ptrCast(*const ILogonTrigger, self), delay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ILogonTrigger_get_UserId(self: *const T, pUser: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ILogonTrigger.VTable, self.vtable).get_UserId(@ptrCast(*const ILogonTrigger, self), pUser); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ILogonTrigger_put_UserId(self: *const T, user: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ILogonTrigger.VTable, self.vtable).put_UserId(@ptrCast(*const ILogonTrigger, self), user); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ISessionStateChangeTrigger_Value = @import("../zig.zig").Guid.initString("754da71b-4385-4475-9dd9-598294fa3641"); pub const IID_ISessionStateChangeTrigger = &IID_ISessionStateChangeTrigger_Value; pub const ISessionStateChangeTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Delay: fn( self: *const ISessionStateChangeTrigger, pDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Delay: fn( self: *const ISessionStateChangeTrigger, delay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UserId: fn( self: *const ISessionStateChangeTrigger, pUser: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UserId: fn( self: *const ISessionStateChangeTrigger, user: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StateChange: fn( self: *const ISessionStateChangeTrigger, pType: ?*TASK_SESSION_STATE_CHANGE_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_StateChange: fn( self: *const ISessionStateChangeTrigger, type: TASK_SESSION_STATE_CHANGE_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISessionStateChangeTrigger_get_Delay(self: *const T, pDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISessionStateChangeTrigger.VTable, self.vtable).get_Delay(@ptrCast(*const ISessionStateChangeTrigger, self), pDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISessionStateChangeTrigger_put_Delay(self: *const T, delay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISessionStateChangeTrigger.VTable, self.vtable).put_Delay(@ptrCast(*const ISessionStateChangeTrigger, self), delay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISessionStateChangeTrigger_get_UserId(self: *const T, pUser: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISessionStateChangeTrigger.VTable, self.vtable).get_UserId(@ptrCast(*const ISessionStateChangeTrigger, self), pUser); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISessionStateChangeTrigger_put_UserId(self: *const T, user: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ISessionStateChangeTrigger.VTable, self.vtable).put_UserId(@ptrCast(*const ISessionStateChangeTrigger, self), user); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISessionStateChangeTrigger_get_StateChange(self: *const T, pType: ?*TASK_SESSION_STATE_CHANGE_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const ISessionStateChangeTrigger.VTable, self.vtable).get_StateChange(@ptrCast(*const ISessionStateChangeTrigger, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISessionStateChangeTrigger_put_StateChange(self: *const T, type_: TASK_SESSION_STATE_CHANGE_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const ISessionStateChangeTrigger.VTable, self.vtable).put_StateChange(@ptrCast(*const ISessionStateChangeTrigger, self), type_); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IEventTrigger_Value = @import("../zig.zig").Guid.initString("d45b0167-9653-4eef-b94f-0732ca7af251"); pub const IID_IEventTrigger = &IID_IEventTrigger_Value; pub const IEventTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Subscription: fn( self: *const IEventTrigger, pQuery: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Subscription: fn( self: *const IEventTrigger, query: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Delay: fn( self: *const IEventTrigger, pDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Delay: fn( self: *const IEventTrigger, delay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ValueQueries: fn( self: *const IEventTrigger, ppNamedXPaths: ?*?*ITaskNamedValueCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ValueQueries: fn( self: *const IEventTrigger, pNamedXPaths: ?*ITaskNamedValueCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventTrigger_get_Subscription(self: *const T, pQuery: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventTrigger.VTable, self.vtable).get_Subscription(@ptrCast(*const IEventTrigger, self), pQuery); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventTrigger_put_Subscription(self: *const T, query: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventTrigger.VTable, self.vtable).put_Subscription(@ptrCast(*const IEventTrigger, self), query); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventTrigger_get_Delay(self: *const T, pDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventTrigger.VTable, self.vtable).get_Delay(@ptrCast(*const IEventTrigger, self), pDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventTrigger_put_Delay(self: *const T, delay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEventTrigger.VTable, self.vtable).put_Delay(@ptrCast(*const IEventTrigger, self), delay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventTrigger_get_ValueQueries(self: *const T, ppNamedXPaths: ?*?*ITaskNamedValueCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IEventTrigger.VTable, self.vtable).get_ValueQueries(@ptrCast(*const IEventTrigger, self), ppNamedXPaths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEventTrigger_put_ValueQueries(self: *const T, pNamedXPaths: ?*ITaskNamedValueCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IEventTrigger.VTable, self.vtable).put_ValueQueries(@ptrCast(*const IEventTrigger, self), pNamedXPaths); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITimeTrigger_Value = @import("../zig.zig").Guid.initString("b45747e0-eba7-4276-9f29-85c5bb300006"); pub const IID_ITimeTrigger = &IID_ITimeTrigger_Value; pub const ITimeTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RandomDelay: fn( self: *const ITimeTrigger, pRandomDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RandomDelay: fn( self: *const ITimeTrigger, randomDelay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITimeTrigger_get_RandomDelay(self: *const T, pRandomDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITimeTrigger.VTable, self.vtable).get_RandomDelay(@ptrCast(*const ITimeTrigger, self), pRandomDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITimeTrigger_put_RandomDelay(self: *const T, randomDelay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITimeTrigger.VTable, self.vtable).put_RandomDelay(@ptrCast(*const ITimeTrigger, self), randomDelay); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IDailyTrigger_Value = @import("../zig.zig").Guid.initString("126c5cd8-b288-41d5-8dbf-e491446adc5c"); pub const IID_IDailyTrigger = &IID_IDailyTrigger_Value; pub const IDailyTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DaysInterval: fn( self: *const IDailyTrigger, pDays: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DaysInterval: fn( self: *const IDailyTrigger, days: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RandomDelay: fn( self: *const IDailyTrigger, pRandomDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RandomDelay: fn( self: *const IDailyTrigger, randomDelay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDailyTrigger_get_DaysInterval(self: *const T, pDays: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IDailyTrigger.VTable, self.vtable).get_DaysInterval(@ptrCast(*const IDailyTrigger, self), pDays); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDailyTrigger_put_DaysInterval(self: *const T, days: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IDailyTrigger.VTable, self.vtable).put_DaysInterval(@ptrCast(*const IDailyTrigger, self), days); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDailyTrigger_get_RandomDelay(self: *const T, pRandomDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDailyTrigger.VTable, self.vtable).get_RandomDelay(@ptrCast(*const IDailyTrigger, self), pRandomDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDailyTrigger_put_RandomDelay(self: *const T, randomDelay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDailyTrigger.VTable, self.vtable).put_RandomDelay(@ptrCast(*const IDailyTrigger, self), randomDelay); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IWeeklyTrigger_Value = @import("../zig.zig").Guid.initString("5038fc98-82ff-436d-8728-a512a57c9dc1"); pub const IID_IWeeklyTrigger = &IID_IWeeklyTrigger_Value; pub const IWeeklyTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DaysOfWeek: fn( self: *const IWeeklyTrigger, pDays: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DaysOfWeek: fn( self: *const IWeeklyTrigger, days: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WeeksInterval: fn( self: *const IWeeklyTrigger, pWeeks: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_WeeksInterval: fn( self: *const IWeeklyTrigger, weeks: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RandomDelay: fn( self: *const IWeeklyTrigger, pRandomDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RandomDelay: fn( self: *const IWeeklyTrigger, randomDelay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWeeklyTrigger_get_DaysOfWeek(self: *const T, pDays: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IWeeklyTrigger.VTable, self.vtable).get_DaysOfWeek(@ptrCast(*const IWeeklyTrigger, self), pDays); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWeeklyTrigger_put_DaysOfWeek(self: *const T, days: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IWeeklyTrigger.VTable, self.vtable).put_DaysOfWeek(@ptrCast(*const IWeeklyTrigger, self), days); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWeeklyTrigger_get_WeeksInterval(self: *const T, pWeeks: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IWeeklyTrigger.VTable, self.vtable).get_WeeksInterval(@ptrCast(*const IWeeklyTrigger, self), pWeeks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWeeklyTrigger_put_WeeksInterval(self: *const T, weeks: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IWeeklyTrigger.VTable, self.vtable).put_WeeksInterval(@ptrCast(*const IWeeklyTrigger, self), weeks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWeeklyTrigger_get_RandomDelay(self: *const T, pRandomDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IWeeklyTrigger.VTable, self.vtable).get_RandomDelay(@ptrCast(*const IWeeklyTrigger, self), pRandomDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IWeeklyTrigger_put_RandomDelay(self: *const T, randomDelay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IWeeklyTrigger.VTable, self.vtable).put_RandomDelay(@ptrCast(*const IWeeklyTrigger, self), randomDelay); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IMonthlyTrigger_Value = @import("../zig.zig").Guid.initString("97c45ef1-6b02-4a1a-9c0e-1ebfba1500ac"); pub const IID_IMonthlyTrigger = &IID_IMonthlyTrigger_Value; pub const IMonthlyTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DaysOfMonth: fn( self: *const IMonthlyTrigger, pDays: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DaysOfMonth: fn( self: *const IMonthlyTrigger, days: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MonthsOfYear: fn( self: *const IMonthlyTrigger, pMonths: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MonthsOfYear: fn( self: *const IMonthlyTrigger, months: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RunOnLastDayOfMonth: fn( self: *const IMonthlyTrigger, pLastDay: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RunOnLastDayOfMonth: fn( self: *const IMonthlyTrigger, lastDay: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RandomDelay: fn( self: *const IMonthlyTrigger, pRandomDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RandomDelay: fn( self: *const IMonthlyTrigger, randomDelay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_get_DaysOfMonth(self: *const T, pDays: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).get_DaysOfMonth(@ptrCast(*const IMonthlyTrigger, self), pDays); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_put_DaysOfMonth(self: *const T, days: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).put_DaysOfMonth(@ptrCast(*const IMonthlyTrigger, self), days); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_get_MonthsOfYear(self: *const T, pMonths: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).get_MonthsOfYear(@ptrCast(*const IMonthlyTrigger, self), pMonths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_put_MonthsOfYear(self: *const T, months: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).put_MonthsOfYear(@ptrCast(*const IMonthlyTrigger, self), months); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_get_RunOnLastDayOfMonth(self: *const T, pLastDay: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).get_RunOnLastDayOfMonth(@ptrCast(*const IMonthlyTrigger, self), pLastDay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_put_RunOnLastDayOfMonth(self: *const T, lastDay: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).put_RunOnLastDayOfMonth(@ptrCast(*const IMonthlyTrigger, self), lastDay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_get_RandomDelay(self: *const T, pRandomDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).get_RandomDelay(@ptrCast(*const IMonthlyTrigger, self), pRandomDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyTrigger_put_RandomDelay(self: *const T, randomDelay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyTrigger.VTable, self.vtable).put_RandomDelay(@ptrCast(*const IMonthlyTrigger, self), randomDelay); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IMonthlyDOWTrigger_Value = @import("../zig.zig").Guid.initString("77d025a3-90fa-43aa-b52e-cda5499b946a"); pub const IID_IMonthlyDOWTrigger = &IID_IMonthlyDOWTrigger_Value; pub const IMonthlyDOWTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DaysOfWeek: fn( self: *const IMonthlyDOWTrigger, pDays: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DaysOfWeek: fn( self: *const IMonthlyDOWTrigger, days: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WeeksOfMonth: fn( self: *const IMonthlyDOWTrigger, pWeeks: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_WeeksOfMonth: fn( self: *const IMonthlyDOWTrigger, weeks: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MonthsOfYear: fn( self: *const IMonthlyDOWTrigger, pMonths: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MonthsOfYear: fn( self: *const IMonthlyDOWTrigger, months: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RunOnLastWeekOfMonth: fn( self: *const IMonthlyDOWTrigger, pLastWeek: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RunOnLastWeekOfMonth: fn( self: *const IMonthlyDOWTrigger, lastWeek: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RandomDelay: fn( self: *const IMonthlyDOWTrigger, pRandomDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RandomDelay: fn( self: *const IMonthlyDOWTrigger, randomDelay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_get_DaysOfWeek(self: *const T, pDays: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).get_DaysOfWeek(@ptrCast(*const IMonthlyDOWTrigger, self), pDays); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_put_DaysOfWeek(self: *const T, days: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).put_DaysOfWeek(@ptrCast(*const IMonthlyDOWTrigger, self), days); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_get_WeeksOfMonth(self: *const T, pWeeks: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).get_WeeksOfMonth(@ptrCast(*const IMonthlyDOWTrigger, self), pWeeks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_put_WeeksOfMonth(self: *const T, weeks: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).put_WeeksOfMonth(@ptrCast(*const IMonthlyDOWTrigger, self), weeks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_get_MonthsOfYear(self: *const T, pMonths: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).get_MonthsOfYear(@ptrCast(*const IMonthlyDOWTrigger, self), pMonths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_put_MonthsOfYear(self: *const T, months: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).put_MonthsOfYear(@ptrCast(*const IMonthlyDOWTrigger, self), months); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_get_RunOnLastWeekOfMonth(self: *const T, pLastWeek: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).get_RunOnLastWeekOfMonth(@ptrCast(*const IMonthlyDOWTrigger, self), pLastWeek); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_put_RunOnLastWeekOfMonth(self: *const T, lastWeek: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).put_RunOnLastWeekOfMonth(@ptrCast(*const IMonthlyDOWTrigger, self), lastWeek); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_get_RandomDelay(self: *const T, pRandomDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).get_RandomDelay(@ptrCast(*const IMonthlyDOWTrigger, self), pRandomDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMonthlyDOWTrigger_put_RandomDelay(self: *const T, randomDelay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMonthlyDOWTrigger.VTable, self.vtable).put_RandomDelay(@ptrCast(*const IMonthlyDOWTrigger, self), randomDelay); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IBootTrigger_Value = @import("../zig.zig").Guid.initString("2a9c35da-d357-41f4-bbc1-207ac1b1f3cb"); pub const IID_IBootTrigger = &IID_IBootTrigger_Value; pub const IBootTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Delay: fn( self: *const IBootTrigger, pDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Delay: fn( self: *const IBootTrigger, delay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBootTrigger_get_Delay(self: *const T, pDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IBootTrigger.VTable, self.vtable).get_Delay(@ptrCast(*const IBootTrigger, self), pDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IBootTrigger_put_Delay(self: *const T, delay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IBootTrigger.VTable, self.vtable).put_Delay(@ptrCast(*const IBootTrigger, self), delay); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRegistrationTrigger_Value = @import("../zig.zig").Guid.initString("4c8fec3a-c218-4e0c-b23d-629024db91a2"); pub const IID_IRegistrationTrigger = &IID_IRegistrationTrigger_Value; pub const IRegistrationTrigger = extern struct { pub const VTable = extern struct { base: ITrigger.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Delay: fn( self: *const IRegistrationTrigger, pDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Delay: fn( self: *const IRegistrationTrigger, delay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITrigger.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationTrigger_get_Delay(self: *const T, pDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationTrigger.VTable, self.vtable).get_Delay(@ptrCast(*const IRegistrationTrigger, self), pDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationTrigger_put_Delay(self: *const T, delay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationTrigger.VTable, self.vtable).put_Delay(@ptrCast(*const IRegistrationTrigger, self), delay); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAction_Value = @import("../zig.zig").Guid.initString("bae54997-48b1-4cbe-9965-d6be263ebea4"); pub const IID_IAction = &IID_IAction_Value; pub const IAction = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IAction, pId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Id: fn( self: *const IAction, Id: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const IAction, pType: ?*TASK_ACTION_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAction_get_Id(self: *const T, pId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAction.VTable, self.vtable).get_Id(@ptrCast(*const IAction, self), pId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAction_put_Id(self: *const T, Id: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAction.VTable, self.vtable).put_Id(@ptrCast(*const IAction, self), Id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAction_get_Type(self: *const T, pType: ?*TASK_ACTION_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IAction.VTable, self.vtable).get_Type(@ptrCast(*const IAction, self), pType); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IExecAction_Value = @import("../zig.zig").Guid.initString("4c3d624d-fd6b-49a3-b9b7-09cb3cd3f047"); pub const IID_IExecAction = &IID_IExecAction_Value; pub const IExecAction = extern struct { pub const VTable = extern struct { base: IAction.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Path: fn( self: *const IExecAction, pPath: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Path: fn( self: *const IExecAction, path: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Arguments: fn( self: *const IExecAction, pArgument: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Arguments: fn( self: *const IExecAction, argument: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WorkingDirectory: fn( self: *const IExecAction, pWorkingDirectory: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_WorkingDirectory: fn( self: *const IExecAction, workingDirectory: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAction.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction_get_Path(self: *const T, pPath: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction.VTable, self.vtable).get_Path(@ptrCast(*const IExecAction, self), pPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction_put_Path(self: *const T, path: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction.VTable, self.vtable).put_Path(@ptrCast(*const IExecAction, self), path); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction_get_Arguments(self: *const T, pArgument: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction.VTable, self.vtable).get_Arguments(@ptrCast(*const IExecAction, self), pArgument); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction_put_Arguments(self: *const T, argument: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction.VTable, self.vtable).put_Arguments(@ptrCast(*const IExecAction, self), argument); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction_get_WorkingDirectory(self: *const T, pWorkingDirectory: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction.VTable, self.vtable).get_WorkingDirectory(@ptrCast(*const IExecAction, self), pWorkingDirectory); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction_put_WorkingDirectory(self: *const T, workingDirectory: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction.VTable, self.vtable).put_WorkingDirectory(@ptrCast(*const IExecAction, self), workingDirectory); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IExecAction2_Value = @import("../zig.zig").Guid.initString("f2a82542-bda5-4e6b-9143-e2bf4f8987b6"); pub const IID_IExecAction2 = &IID_IExecAction2_Value; pub const IExecAction2 = extern struct { pub const VTable = extern struct { base: IExecAction.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HideAppWindow: fn( self: *const IExecAction2, pHideAppWindow: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_HideAppWindow: fn( self: *const IExecAction2, hideAppWindow: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IExecAction.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction2_get_HideAppWindow(self: *const T, pHideAppWindow: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction2.VTable, self.vtable).get_HideAppWindow(@ptrCast(*const IExecAction2, self), pHideAppWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IExecAction2_put_HideAppWindow(self: *const T, hideAppWindow: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IExecAction2.VTable, self.vtable).put_HideAppWindow(@ptrCast(*const IExecAction2, self), hideAppWindow); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IShowMessageAction_Value = @import("../zig.zig").Guid.initString("505e9e68-af89-46b8-a30f-56162a83d537"); pub const IID_IShowMessageAction = &IID_IShowMessageAction_Value; pub const IShowMessageAction = extern struct { pub const VTable = extern struct { base: IAction.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Title: fn( self: *const IShowMessageAction, pTitle: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Title: fn( self: *const IShowMessageAction, title: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MessageBody: fn( self: *const IShowMessageAction, pMessageBody: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MessageBody: fn( self: *const IShowMessageAction, messageBody: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAction.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IShowMessageAction_get_Title(self: *const T, pTitle: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IShowMessageAction.VTable, self.vtable).get_Title(@ptrCast(*const IShowMessageAction, self), pTitle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IShowMessageAction_put_Title(self: *const T, title: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IShowMessageAction.VTable, self.vtable).put_Title(@ptrCast(*const IShowMessageAction, self), title); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IShowMessageAction_get_MessageBody(self: *const T, pMessageBody: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IShowMessageAction.VTable, self.vtable).get_MessageBody(@ptrCast(*const IShowMessageAction, self), pMessageBody); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IShowMessageAction_put_MessageBody(self: *const T, messageBody: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IShowMessageAction.VTable, self.vtable).put_MessageBody(@ptrCast(*const IShowMessageAction, self), messageBody); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IComHandlerAction_Value = @import("../zig.zig").Guid.initString("6d2fd252-75c5-4f66-90ba-2a7d8cc3039f"); pub const IID_IComHandlerAction = &IID_IComHandlerAction_Value; pub const IComHandlerAction = extern struct { pub const VTable = extern struct { base: IAction.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ClassId: fn( self: *const IComHandlerAction, pClsid: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ClassId: fn( self: *const IComHandlerAction, clsid: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Data: fn( self: *const IComHandlerAction, pData: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Data: fn( self: *const IComHandlerAction, data: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAction.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComHandlerAction_get_ClassId(self: *const T, pClsid: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IComHandlerAction.VTable, self.vtable).get_ClassId(@ptrCast(*const IComHandlerAction, self), pClsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComHandlerAction_put_ClassId(self: *const T, clsid: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IComHandlerAction.VTable, self.vtable).put_ClassId(@ptrCast(*const IComHandlerAction, self), clsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComHandlerAction_get_Data(self: *const T, pData: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IComHandlerAction.VTable, self.vtable).get_Data(@ptrCast(*const IComHandlerAction, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComHandlerAction_put_Data(self: *const T, data: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IComHandlerAction.VTable, self.vtable).put_Data(@ptrCast(*const IComHandlerAction, self), data); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IEmailAction_Value = @import("../zig.zig").Guid.initString("10f62c64-7e16-4314-a0c2-0c3683f99d40"); pub const IID_IEmailAction = &IID_IEmailAction_Value; pub const IEmailAction = extern struct { pub const VTable = extern struct { base: IAction.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Server: fn( self: *const IEmailAction, pServer: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Server: fn( self: *const IEmailAction, server: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Subject: fn( self: *const IEmailAction, pSubject: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Subject: fn( self: *const IEmailAction, subject: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_To: fn( self: *const IEmailAction, pTo: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_To: fn( self: *const IEmailAction, to: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Cc: fn( self: *const IEmailAction, pCc: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Cc: fn( self: *const IEmailAction, cc: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Bcc: fn( self: *const IEmailAction, pBcc: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Bcc: fn( self: *const IEmailAction, bcc: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ReplyTo: fn( self: *const IEmailAction, pReplyTo: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ReplyTo: fn( self: *const IEmailAction, replyTo: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_From: fn( self: *const IEmailAction, pFrom: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_From: fn( self: *const IEmailAction, from: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_HeaderFields: fn( self: *const IEmailAction, ppHeaderFields: ?*?*ITaskNamedValueCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_HeaderFields: fn( self: *const IEmailAction, pHeaderFields: ?*ITaskNamedValueCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Body: fn( self: *const IEmailAction, pBody: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Body: fn( self: *const IEmailAction, body: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attachments: fn( self: *const IEmailAction, pAttachements: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Attachments: fn( self: *const IEmailAction, pAttachements: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAction.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_Server(self: *const T, pServer: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_Server(@ptrCast(*const IEmailAction, self), pServer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_Server(self: *const T, server: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_Server(@ptrCast(*const IEmailAction, self), server); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_Subject(self: *const T, pSubject: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_Subject(@ptrCast(*const IEmailAction, self), pSubject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_Subject(self: *const T, subject: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_Subject(@ptrCast(*const IEmailAction, self), subject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_To(self: *const T, pTo: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_To(@ptrCast(*const IEmailAction, self), pTo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_To(self: *const T, to: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_To(@ptrCast(*const IEmailAction, self), to); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_Cc(self: *const T, pCc: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_Cc(@ptrCast(*const IEmailAction, self), pCc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_Cc(self: *const T, cc: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_Cc(@ptrCast(*const IEmailAction, self), cc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_Bcc(self: *const T, pBcc: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_Bcc(@ptrCast(*const IEmailAction, self), pBcc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_Bcc(self: *const T, bcc: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_Bcc(@ptrCast(*const IEmailAction, self), bcc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_ReplyTo(self: *const T, pReplyTo: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_ReplyTo(@ptrCast(*const IEmailAction, self), pReplyTo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_ReplyTo(self: *const T, replyTo: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_ReplyTo(@ptrCast(*const IEmailAction, self), replyTo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_From(self: *const T, pFrom: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_From(@ptrCast(*const IEmailAction, self), pFrom); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_From(self: *const T, from: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_From(@ptrCast(*const IEmailAction, self), from); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_HeaderFields(self: *const T, ppHeaderFields: ?*?*ITaskNamedValueCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_HeaderFields(@ptrCast(*const IEmailAction, self), ppHeaderFields); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_HeaderFields(self: *const T, pHeaderFields: ?*ITaskNamedValueCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_HeaderFields(@ptrCast(*const IEmailAction, self), pHeaderFields); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_Body(self: *const T, pBody: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_Body(@ptrCast(*const IEmailAction, self), pBody); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_Body(self: *const T, body: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_Body(@ptrCast(*const IEmailAction, self), body); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_get_Attachments(self: *const T, pAttachements: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).get_Attachments(@ptrCast(*const IEmailAction, self), pAttachements); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEmailAction_put_Attachments(self: *const T, pAttachements: ?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IEmailAction.VTable, self.vtable).put_Attachments(@ptrCast(*const IEmailAction, self), pAttachements); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITriggerCollection_Value = @import("../zig.zig").Guid.initString("85df5081-1b24-4f32-878a-d9d14df4cb77"); pub const IID_ITriggerCollection = &IID_ITriggerCollection_Value; pub const ITriggerCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const ITriggerCollection, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const ITriggerCollection, index: i32, ppTrigger: ?*?*ITrigger, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const ITriggerCollection, ppEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Create: fn( self: *const ITriggerCollection, type: TASK_TRIGGER_TYPE2, ppTrigger: ?*?*ITrigger, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const ITriggerCollection, index: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const ITriggerCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITriggerCollection_get_Count(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITriggerCollection.VTable, self.vtable).get_Count(@ptrCast(*const ITriggerCollection, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITriggerCollection_get_Item(self: *const T, index: i32, ppTrigger: ?*?*ITrigger) callconv(.Inline) HRESULT { return @ptrCast(*const ITriggerCollection.VTable, self.vtable).get_Item(@ptrCast(*const ITriggerCollection, self), index, ppTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITriggerCollection_get__NewEnum(self: *const T, ppEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITriggerCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const ITriggerCollection, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITriggerCollection_Create(self: *const T, type_: TASK_TRIGGER_TYPE2, ppTrigger: ?*?*ITrigger) callconv(.Inline) HRESULT { return @ptrCast(*const ITriggerCollection.VTable, self.vtable).Create(@ptrCast(*const ITriggerCollection, self), type_, ppTrigger); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITriggerCollection_Remove(self: *const T, index: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ITriggerCollection.VTable, self.vtable).Remove(@ptrCast(*const ITriggerCollection, self), index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITriggerCollection_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ITriggerCollection.VTable, self.vtable).Clear(@ptrCast(*const ITriggerCollection, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IActionCollection_Value = @import("../zig.zig").Guid.initString("02820e19-7b98-4ed2-b2e8-fdccceff619b"); pub const IID_IActionCollection = &IID_IActionCollection_Value; pub const IActionCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IActionCollection, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IActionCollection, index: i32, ppAction: ?*?*IAction, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IActionCollection, ppEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_XmlText: fn( self: *const IActionCollection, pText: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_XmlText: fn( self: *const IActionCollection, text: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Create: fn( self: *const IActionCollection, type: TASK_ACTION_TYPE, ppAction: ?*?*IAction, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Remove: fn( self: *const IActionCollection, index: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clear: fn( self: *const IActionCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Context: fn( self: *const IActionCollection, pContext: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Context: fn( self: *const IActionCollection, context: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_get_Count(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).get_Count(@ptrCast(*const IActionCollection, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_get_Item(self: *const T, index: i32, ppAction: ?*?*IAction) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).get_Item(@ptrCast(*const IActionCollection, self), index, ppAction); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_get__NewEnum(self: *const T, ppEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const IActionCollection, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_get_XmlText(self: *const T, pText: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).get_XmlText(@ptrCast(*const IActionCollection, self), pText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_put_XmlText(self: *const T, text: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).put_XmlText(@ptrCast(*const IActionCollection, self), text); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_Create(self: *const T, type_: TASK_ACTION_TYPE, ppAction: ?*?*IAction) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).Create(@ptrCast(*const IActionCollection, self), type_, ppAction); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_Remove(self: *const T, index: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).Remove(@ptrCast(*const IActionCollection, self), index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_Clear(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).Clear(@ptrCast(*const IActionCollection, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_get_Context(self: *const T, pContext: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).get_Context(@ptrCast(*const IActionCollection, self), pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActionCollection_put_Context(self: *const T, context: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IActionCollection.VTable, self.vtable).put_Context(@ptrCast(*const IActionCollection, self), context); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IPrincipal_Value = @import("../zig.zig").Guid.initString("d98d51e5-c9b4-496a-a9c1-18980261cf0f"); pub const IID_IPrincipal = &IID_IPrincipal_Value; pub const IPrincipal = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const IPrincipal, pId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Id: fn( self: *const IPrincipal, Id: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DisplayName: fn( self: *const IPrincipal, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DisplayName: fn( self: *const IPrincipal, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UserId: fn( self: *const IPrincipal, pUser: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UserId: fn( self: *const IPrincipal, user: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_LogonType: fn( self: *const IPrincipal, pLogon: ?*TASK_LOGON_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_LogonType: fn( self: *const IPrincipal, logon: TASK_LOGON_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_GroupId: fn( self: *const IPrincipal, pGroup: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_GroupId: fn( self: *const IPrincipal, group: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RunLevel: fn( self: *const IPrincipal, pRunLevel: ?*TASK_RUNLEVEL_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RunLevel: fn( self: *const IPrincipal, runLevel: TASK_RUNLEVEL_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_get_Id(self: *const T, pId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).get_Id(@ptrCast(*const IPrincipal, self), pId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_put_Id(self: *const T, Id: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).put_Id(@ptrCast(*const IPrincipal, self), Id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_get_DisplayName(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).get_DisplayName(@ptrCast(*const IPrincipal, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_put_DisplayName(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).put_DisplayName(@ptrCast(*const IPrincipal, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_get_UserId(self: *const T, pUser: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).get_UserId(@ptrCast(*const IPrincipal, self), pUser); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_put_UserId(self: *const T, user: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).put_UserId(@ptrCast(*const IPrincipal, self), user); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_get_LogonType(self: *const T, pLogon: ?*TASK_LOGON_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).get_LogonType(@ptrCast(*const IPrincipal, self), pLogon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_put_LogonType(self: *const T, logon: TASK_LOGON_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).put_LogonType(@ptrCast(*const IPrincipal, self), logon); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_get_GroupId(self: *const T, pGroup: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).get_GroupId(@ptrCast(*const IPrincipal, self), pGroup); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_put_GroupId(self: *const T, group: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).put_GroupId(@ptrCast(*const IPrincipal, self), group); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_get_RunLevel(self: *const T, pRunLevel: ?*TASK_RUNLEVEL_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).get_RunLevel(@ptrCast(*const IPrincipal, self), pRunLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal_put_RunLevel(self: *const T, runLevel: TASK_RUNLEVEL_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal.VTable, self.vtable).put_RunLevel(@ptrCast(*const IPrincipal, self), runLevel); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IPrincipal2_Value = @import("../zig.zig").Guid.initString("248919ae-e345-4a6d-8aeb-e0d3165c904e"); pub const IID_IPrincipal2 = &IID_IPrincipal2_Value; pub const IPrincipal2 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ProcessTokenSidType: fn( self: *const IPrincipal2, pProcessTokenSidType: ?*TASK_PROCESSTOKENSID_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ProcessTokenSidType: fn( self: *const IPrincipal2, processTokenSidType: TASK_PROCESSTOKENSID_TYPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RequiredPrivilegeCount: fn( self: *const IPrincipal2, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RequiredPrivilege: fn( self: *const IPrincipal2, index: i32, pPrivilege: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddRequiredPrivilege: fn( self: *const IPrincipal2, privilege: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal2_get_ProcessTokenSidType(self: *const T, pProcessTokenSidType: ?*TASK_PROCESSTOKENSID_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal2.VTable, self.vtable).get_ProcessTokenSidType(@ptrCast(*const IPrincipal2, self), pProcessTokenSidType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal2_put_ProcessTokenSidType(self: *const T, processTokenSidType: TASK_PROCESSTOKENSID_TYPE) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal2.VTable, self.vtable).put_ProcessTokenSidType(@ptrCast(*const IPrincipal2, self), processTokenSidType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal2_get_RequiredPrivilegeCount(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal2.VTable, self.vtable).get_RequiredPrivilegeCount(@ptrCast(*const IPrincipal2, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal2_get_RequiredPrivilege(self: *const T, index: i32, pPrivilege: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal2.VTable, self.vtable).get_RequiredPrivilege(@ptrCast(*const IPrincipal2, self), index, pPrivilege); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrincipal2_AddRequiredPrivilege(self: *const T, privilege: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPrincipal2.VTable, self.vtable).AddRequiredPrivilege(@ptrCast(*const IPrincipal2, self), privilege); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRegistrationInfo_Value = @import("../zig.zig").Guid.initString("416d8b73-cb41-4ea1-805c-9be9a5ac4a74"); pub const IID_IRegistrationInfo = &IID_IRegistrationInfo_Value; pub const IRegistrationInfo = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Description: fn( self: *const IRegistrationInfo, pDescription: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Description: fn( self: *const IRegistrationInfo, description: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Author: fn( self: *const IRegistrationInfo, pAuthor: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Author: fn( self: *const IRegistrationInfo, author: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Version: fn( self: *const IRegistrationInfo, pVersion: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Version: fn( self: *const IRegistrationInfo, version: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Date: fn( self: *const IRegistrationInfo, pDate: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Date: fn( self: *const IRegistrationInfo, date: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Documentation: fn( self: *const IRegistrationInfo, pDocumentation: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Documentation: fn( self: *const IRegistrationInfo, documentation: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_XmlText: fn( self: *const IRegistrationInfo, pText: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_XmlText: fn( self: *const IRegistrationInfo, text: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_URI: fn( self: *const IRegistrationInfo, pUri: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_URI: fn( self: *const IRegistrationInfo, uri: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_SecurityDescriptor: fn( self: *const IRegistrationInfo, pSddl: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_SecurityDescriptor: fn( self: *const IRegistrationInfo, sddl: VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Source: fn( self: *const IRegistrationInfo, pSource: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Source: fn( self: *const IRegistrationInfo, source: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_Description(self: *const T, pDescription: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_Description(@ptrCast(*const IRegistrationInfo, self), pDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_Description(self: *const T, description: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_Description(@ptrCast(*const IRegistrationInfo, self), description); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_Author(self: *const T, pAuthor: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_Author(@ptrCast(*const IRegistrationInfo, self), pAuthor); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_Author(self: *const T, author: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_Author(@ptrCast(*const IRegistrationInfo, self), author); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_Version(self: *const T, pVersion: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_Version(@ptrCast(*const IRegistrationInfo, self), pVersion); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_Version(self: *const T, version: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_Version(@ptrCast(*const IRegistrationInfo, self), version); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_Date(self: *const T, pDate: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_Date(@ptrCast(*const IRegistrationInfo, self), pDate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_Date(self: *const T, date: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_Date(@ptrCast(*const IRegistrationInfo, self), date); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_Documentation(self: *const T, pDocumentation: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_Documentation(@ptrCast(*const IRegistrationInfo, self), pDocumentation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_Documentation(self: *const T, documentation: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_Documentation(@ptrCast(*const IRegistrationInfo, self), documentation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_XmlText(self: *const T, pText: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_XmlText(@ptrCast(*const IRegistrationInfo, self), pText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_XmlText(self: *const T, text: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_XmlText(@ptrCast(*const IRegistrationInfo, self), text); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_URI(self: *const T, pUri: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_URI(@ptrCast(*const IRegistrationInfo, self), pUri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_URI(self: *const T, uri: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_URI(@ptrCast(*const IRegistrationInfo, self), uri); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_SecurityDescriptor(self: *const T, pSddl: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_SecurityDescriptor(@ptrCast(*const IRegistrationInfo, self), pSddl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_SecurityDescriptor(self: *const T, sddl: VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_SecurityDescriptor(@ptrCast(*const IRegistrationInfo, self), sddl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_get_Source(self: *const T, pSource: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).get_Source(@ptrCast(*const IRegistrationInfo, self), pSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegistrationInfo_put_Source(self: *const T, source: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRegistrationInfo.VTable, self.vtable).put_Source(@ptrCast(*const IRegistrationInfo, self), source); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskDefinition_Value = @import("../zig.zig").Guid.initString("f5bc8fc5-536d-4f77-b852-fbc1356fdeb6"); pub const IID_ITaskDefinition = &IID_ITaskDefinition_Value; pub const ITaskDefinition = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RegistrationInfo: fn( self: *const ITaskDefinition, ppRegistrationInfo: ?*?*IRegistrationInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RegistrationInfo: fn( self: *const ITaskDefinition, pRegistrationInfo: ?*IRegistrationInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Triggers: fn( self: *const ITaskDefinition, ppTriggers: ?*?*ITriggerCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Triggers: fn( self: *const ITaskDefinition, pTriggers: ?*ITriggerCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Settings: fn( self: *const ITaskDefinition, ppSettings: ?*?*ITaskSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Settings: fn( self: *const ITaskDefinition, pSettings: ?*ITaskSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Data: fn( self: *const ITaskDefinition, pData: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Data: fn( self: *const ITaskDefinition, data: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Principal: fn( self: *const ITaskDefinition, ppPrincipal: ?*?*IPrincipal, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Principal: fn( self: *const ITaskDefinition, pPrincipal: ?*IPrincipal, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Actions: fn( self: *const ITaskDefinition, ppActions: ?*?*IActionCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Actions: fn( self: *const ITaskDefinition, pActions: ?*IActionCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_XmlText: fn( self: *const ITaskDefinition, pXml: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_XmlText: fn( self: *const ITaskDefinition, xml: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_get_RegistrationInfo(self: *const T, ppRegistrationInfo: ?*?*IRegistrationInfo) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).get_RegistrationInfo(@ptrCast(*const ITaskDefinition, self), ppRegistrationInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_put_RegistrationInfo(self: *const T, pRegistrationInfo: ?*IRegistrationInfo) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).put_RegistrationInfo(@ptrCast(*const ITaskDefinition, self), pRegistrationInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_get_Triggers(self: *const T, ppTriggers: ?*?*ITriggerCollection) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).get_Triggers(@ptrCast(*const ITaskDefinition, self), ppTriggers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_put_Triggers(self: *const T, pTriggers: ?*ITriggerCollection) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).put_Triggers(@ptrCast(*const ITaskDefinition, self), pTriggers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_get_Settings(self: *const T, ppSettings: ?*?*ITaskSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).get_Settings(@ptrCast(*const ITaskDefinition, self), ppSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_put_Settings(self: *const T, pSettings: ?*ITaskSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).put_Settings(@ptrCast(*const ITaskDefinition, self), pSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_get_Data(self: *const T, pData: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).get_Data(@ptrCast(*const ITaskDefinition, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_put_Data(self: *const T, data: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).put_Data(@ptrCast(*const ITaskDefinition, self), data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_get_Principal(self: *const T, ppPrincipal: ?*?*IPrincipal) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).get_Principal(@ptrCast(*const ITaskDefinition, self), ppPrincipal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_put_Principal(self: *const T, pPrincipal: ?*IPrincipal) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).put_Principal(@ptrCast(*const ITaskDefinition, self), pPrincipal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_get_Actions(self: *const T, ppActions: ?*?*IActionCollection) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).get_Actions(@ptrCast(*const ITaskDefinition, self), ppActions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_put_Actions(self: *const T, pActions: ?*IActionCollection) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).put_Actions(@ptrCast(*const ITaskDefinition, self), pActions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_get_XmlText(self: *const T, pXml: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).get_XmlText(@ptrCast(*const ITaskDefinition, self), pXml); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskDefinition_put_XmlText(self: *const T, xml: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskDefinition.VTable, self.vtable).put_XmlText(@ptrCast(*const ITaskDefinition, self), xml); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskSettings_Value = @import("../zig.zig").Guid.initString("8fd4711d-2d02-4c8c-87e3-eff699de127e"); pub const IID_ITaskSettings = &IID_ITaskSettings_Value; pub const ITaskSettings = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowDemandStart: fn( self: *const ITaskSettings, pAllowDemandStart: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowDemandStart: fn( self: *const ITaskSettings, allowDemandStart: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RestartInterval: fn( self: *const ITaskSettings, pRestartInterval: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RestartInterval: fn( self: *const ITaskSettings, restartInterval: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RestartCount: fn( self: *const ITaskSettings, pRestartCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RestartCount: fn( self: *const ITaskSettings, restartCount: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MultipleInstances: fn( self: *const ITaskSettings, pPolicy: ?*TASK_INSTANCES_POLICY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MultipleInstances: fn( self: *const ITaskSettings, policy: TASK_INSTANCES_POLICY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StopIfGoingOnBatteries: fn( self: *const ITaskSettings, pStopIfOnBatteries: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_StopIfGoingOnBatteries: fn( self: *const ITaskSettings, stopIfOnBatteries: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DisallowStartIfOnBatteries: fn( self: *const ITaskSettings, pDisallowStart: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DisallowStartIfOnBatteries: fn( self: *const ITaskSettings, disallowStart: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_AllowHardTerminate: fn( self: *const ITaskSettings, pAllowHardTerminate: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_AllowHardTerminate: fn( self: *const ITaskSettings, allowHardTerminate: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StartWhenAvailable: fn( self: *const ITaskSettings, pStartWhenAvailable: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_StartWhenAvailable: fn( self: *const ITaskSettings, startWhenAvailable: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_XmlText: fn( self: *const ITaskSettings, pText: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_XmlText: fn( self: *const ITaskSettings, text: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RunOnlyIfNetworkAvailable: fn( self: *const ITaskSettings, pRunOnlyIfNetworkAvailable: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RunOnlyIfNetworkAvailable: fn( self: *const ITaskSettings, runOnlyIfNetworkAvailable: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ExecutionTimeLimit: fn( self: *const ITaskSettings, pExecutionTimeLimit: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_ExecutionTimeLimit: fn( self: *const ITaskSettings, executionTimeLimit: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Enabled: fn( self: *const ITaskSettings, pEnabled: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Enabled: fn( self: *const ITaskSettings, enabled: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DeleteExpiredTaskAfter: fn( self: *const ITaskSettings, pExpirationDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DeleteExpiredTaskAfter: fn( self: *const ITaskSettings, expirationDelay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Priority: fn( self: *const ITaskSettings, pPriority: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Priority: fn( self: *const ITaskSettings, priority: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Compatibility: fn( self: *const ITaskSettings, pCompatLevel: ?*TASK_COMPATIBILITY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Compatibility: fn( self: *const ITaskSettings, compatLevel: TASK_COMPATIBILITY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Hidden: fn( self: *const ITaskSettings, pHidden: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Hidden: fn( self: *const ITaskSettings, hidden: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IdleSettings: fn( self: *const ITaskSettings, ppIdleSettings: ?*?*IIdleSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IdleSettings: fn( self: *const ITaskSettings, pIdleSettings: ?*IIdleSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RunOnlyIfIdle: fn( self: *const ITaskSettings, pRunOnlyIfIdle: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RunOnlyIfIdle: fn( self: *const ITaskSettings, runOnlyIfIdle: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WakeToRun: fn( self: *const ITaskSettings, pWake: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_WakeToRun: fn( self: *const ITaskSettings, wake: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_NetworkSettings: fn( self: *const ITaskSettings, ppNetworkSettings: ?*?*INetworkSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_NetworkSettings: fn( self: *const ITaskSettings, pNetworkSettings: ?*INetworkSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_AllowDemandStart(self: *const T, pAllowDemandStart: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_AllowDemandStart(@ptrCast(*const ITaskSettings, self), pAllowDemandStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_AllowDemandStart(self: *const T, allowDemandStart: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_AllowDemandStart(@ptrCast(*const ITaskSettings, self), allowDemandStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_RestartInterval(self: *const T, pRestartInterval: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_RestartInterval(@ptrCast(*const ITaskSettings, self), pRestartInterval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_RestartInterval(self: *const T, restartInterval: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_RestartInterval(@ptrCast(*const ITaskSettings, self), restartInterval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_RestartCount(self: *const T, pRestartCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_RestartCount(@ptrCast(*const ITaskSettings, self), pRestartCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_RestartCount(self: *const T, restartCount: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_RestartCount(@ptrCast(*const ITaskSettings, self), restartCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_MultipleInstances(self: *const T, pPolicy: ?*TASK_INSTANCES_POLICY) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_MultipleInstances(@ptrCast(*const ITaskSettings, self), pPolicy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_MultipleInstances(self: *const T, policy: TASK_INSTANCES_POLICY) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_MultipleInstances(@ptrCast(*const ITaskSettings, self), policy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_StopIfGoingOnBatteries(self: *const T, pStopIfOnBatteries: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_StopIfGoingOnBatteries(@ptrCast(*const ITaskSettings, self), pStopIfOnBatteries); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_StopIfGoingOnBatteries(self: *const T, stopIfOnBatteries: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_StopIfGoingOnBatteries(@ptrCast(*const ITaskSettings, self), stopIfOnBatteries); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_DisallowStartIfOnBatteries(self: *const T, pDisallowStart: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_DisallowStartIfOnBatteries(@ptrCast(*const ITaskSettings, self), pDisallowStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_DisallowStartIfOnBatteries(self: *const T, disallowStart: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_DisallowStartIfOnBatteries(@ptrCast(*const ITaskSettings, self), disallowStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_AllowHardTerminate(self: *const T, pAllowHardTerminate: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_AllowHardTerminate(@ptrCast(*const ITaskSettings, self), pAllowHardTerminate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_AllowHardTerminate(self: *const T, allowHardTerminate: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_AllowHardTerminate(@ptrCast(*const ITaskSettings, self), allowHardTerminate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_StartWhenAvailable(self: *const T, pStartWhenAvailable: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_StartWhenAvailable(@ptrCast(*const ITaskSettings, self), pStartWhenAvailable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_StartWhenAvailable(self: *const T, startWhenAvailable: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_StartWhenAvailable(@ptrCast(*const ITaskSettings, self), startWhenAvailable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_XmlText(self: *const T, pText: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_XmlText(@ptrCast(*const ITaskSettings, self), pText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_XmlText(self: *const T, text: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_XmlText(@ptrCast(*const ITaskSettings, self), text); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_RunOnlyIfNetworkAvailable(self: *const T, pRunOnlyIfNetworkAvailable: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_RunOnlyIfNetworkAvailable(@ptrCast(*const ITaskSettings, self), pRunOnlyIfNetworkAvailable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_RunOnlyIfNetworkAvailable(self: *const T, runOnlyIfNetworkAvailable: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_RunOnlyIfNetworkAvailable(@ptrCast(*const ITaskSettings, self), runOnlyIfNetworkAvailable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_ExecutionTimeLimit(self: *const T, pExecutionTimeLimit: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_ExecutionTimeLimit(@ptrCast(*const ITaskSettings, self), pExecutionTimeLimit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_ExecutionTimeLimit(self: *const T, executionTimeLimit: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_ExecutionTimeLimit(@ptrCast(*const ITaskSettings, self), executionTimeLimit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_Enabled(self: *const T, pEnabled: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_Enabled(@ptrCast(*const ITaskSettings, self), pEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_Enabled(self: *const T, enabled: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_Enabled(@ptrCast(*const ITaskSettings, self), enabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_DeleteExpiredTaskAfter(self: *const T, pExpirationDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_DeleteExpiredTaskAfter(@ptrCast(*const ITaskSettings, self), pExpirationDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_DeleteExpiredTaskAfter(self: *const T, expirationDelay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_DeleteExpiredTaskAfter(@ptrCast(*const ITaskSettings, self), expirationDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_Priority(self: *const T, pPriority: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_Priority(@ptrCast(*const ITaskSettings, self), pPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_Priority(self: *const T, priority: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_Priority(@ptrCast(*const ITaskSettings, self), priority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_Compatibility(self: *const T, pCompatLevel: ?*TASK_COMPATIBILITY) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_Compatibility(@ptrCast(*const ITaskSettings, self), pCompatLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_Compatibility(self: *const T, compatLevel: TASK_COMPATIBILITY) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_Compatibility(@ptrCast(*const ITaskSettings, self), compatLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_Hidden(self: *const T, pHidden: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_Hidden(@ptrCast(*const ITaskSettings, self), pHidden); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_Hidden(self: *const T, hidden: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_Hidden(@ptrCast(*const ITaskSettings, self), hidden); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_IdleSettings(self: *const T, ppIdleSettings: ?*?*IIdleSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_IdleSettings(@ptrCast(*const ITaskSettings, self), ppIdleSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_IdleSettings(self: *const T, pIdleSettings: ?*IIdleSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_IdleSettings(@ptrCast(*const ITaskSettings, self), pIdleSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_RunOnlyIfIdle(self: *const T, pRunOnlyIfIdle: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_RunOnlyIfIdle(@ptrCast(*const ITaskSettings, self), pRunOnlyIfIdle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_RunOnlyIfIdle(self: *const T, runOnlyIfIdle: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_RunOnlyIfIdle(@ptrCast(*const ITaskSettings, self), runOnlyIfIdle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_WakeToRun(self: *const T, pWake: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_WakeToRun(@ptrCast(*const ITaskSettings, self), pWake); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_WakeToRun(self: *const T, wake: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_WakeToRun(@ptrCast(*const ITaskSettings, self), wake); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_get_NetworkSettings(self: *const T, ppNetworkSettings: ?*?*INetworkSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).get_NetworkSettings(@ptrCast(*const ITaskSettings, self), ppNetworkSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings_put_NetworkSettings(self: *const T, pNetworkSettings: ?*INetworkSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings.VTable, self.vtable).put_NetworkSettings(@ptrCast(*const ITaskSettings, self), pNetworkSettings); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_ITaskSettings2_Value = @import("../zig.zig").Guid.initString("2c05c3f0-6eed-4c05-a15f-ed7d7a98a369"); pub const IID_ITaskSettings2 = &IID_ITaskSettings2_Value; pub const ITaskSettings2 = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DisallowStartOnRemoteAppSession: fn( self: *const ITaskSettings2, pDisallowStart: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DisallowStartOnRemoteAppSession: fn( self: *const ITaskSettings2, disallowStart: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UseUnifiedSchedulingEngine: fn( self: *const ITaskSettings2, pUseUnifiedEngine: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UseUnifiedSchedulingEngine: fn( self: *const ITaskSettings2, useUnifiedEngine: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings2_get_DisallowStartOnRemoteAppSession(self: *const T, pDisallowStart: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings2.VTable, self.vtable).get_DisallowStartOnRemoteAppSession(@ptrCast(*const ITaskSettings2, self), pDisallowStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings2_put_DisallowStartOnRemoteAppSession(self: *const T, disallowStart: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings2.VTable, self.vtable).put_DisallowStartOnRemoteAppSession(@ptrCast(*const ITaskSettings2, self), disallowStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings2_get_UseUnifiedSchedulingEngine(self: *const T, pUseUnifiedEngine: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings2.VTable, self.vtable).get_UseUnifiedSchedulingEngine(@ptrCast(*const ITaskSettings2, self), pUseUnifiedEngine); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings2_put_UseUnifiedSchedulingEngine(self: *const T, useUnifiedEngine: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings2.VTable, self.vtable).put_UseUnifiedSchedulingEngine(@ptrCast(*const ITaskSettings2, self), useUnifiedEngine); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITaskSettings3_Value = @import("../zig.zig").Guid.initString("0ad9d0d7-0c7f-4ebb-9a5f-d1c648dca528"); pub const IID_ITaskSettings3 = &IID_ITaskSettings3_Value; pub const ITaskSettings3 = extern struct { pub const VTable = extern struct { base: ITaskSettings.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DisallowStartOnRemoteAppSession: fn( self: *const ITaskSettings3, pDisallowStart: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_DisallowStartOnRemoteAppSession: fn( self: *const ITaskSettings3, disallowStart: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_UseUnifiedSchedulingEngine: fn( self: *const ITaskSettings3, pUseUnifiedEngine: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_UseUnifiedSchedulingEngine: fn( self: *const ITaskSettings3, useUnifiedEngine: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MaintenanceSettings: fn( self: *const ITaskSettings3, ppMaintenanceSettings: ?*?*IMaintenanceSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_MaintenanceSettings: fn( self: *const ITaskSettings3, pMaintenanceSettings: ?*IMaintenanceSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateMaintenanceSettings: fn( self: *const ITaskSettings3, ppMaintenanceSettings: ?*?*IMaintenanceSettings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Volatile: fn( self: *const ITaskSettings3, pVolatile: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Volatile: fn( self: *const ITaskSettings3, Volatile: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ITaskSettings.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_get_DisallowStartOnRemoteAppSession(self: *const T, pDisallowStart: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).get_DisallowStartOnRemoteAppSession(@ptrCast(*const ITaskSettings3, self), pDisallowStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_put_DisallowStartOnRemoteAppSession(self: *const T, disallowStart: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).put_DisallowStartOnRemoteAppSession(@ptrCast(*const ITaskSettings3, self), disallowStart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_get_UseUnifiedSchedulingEngine(self: *const T, pUseUnifiedEngine: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).get_UseUnifiedSchedulingEngine(@ptrCast(*const ITaskSettings3, self), pUseUnifiedEngine); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_put_UseUnifiedSchedulingEngine(self: *const T, useUnifiedEngine: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).put_UseUnifiedSchedulingEngine(@ptrCast(*const ITaskSettings3, self), useUnifiedEngine); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_get_MaintenanceSettings(self: *const T, ppMaintenanceSettings: ?*?*IMaintenanceSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).get_MaintenanceSettings(@ptrCast(*const ITaskSettings3, self), ppMaintenanceSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_put_MaintenanceSettings(self: *const T, pMaintenanceSettings: ?*IMaintenanceSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).put_MaintenanceSettings(@ptrCast(*const ITaskSettings3, self), pMaintenanceSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_CreateMaintenanceSettings(self: *const T, ppMaintenanceSettings: ?*?*IMaintenanceSettings) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).CreateMaintenanceSettings(@ptrCast(*const ITaskSettings3, self), ppMaintenanceSettings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_get_Volatile(self: *const T, pVolatile: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).get_Volatile(@ptrCast(*const ITaskSettings3, self), pVolatile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskSettings3_put_Volatile(self: *const T, Volatile: i16) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskSettings3.VTable, self.vtable).put_Volatile(@ptrCast(*const ITaskSettings3, self), Volatile); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMaintenanceSettings_Value = @import("../zig.zig").Guid.initString("a6024fa8-9652-4adb-a6bf-5cfcd877a7ba"); pub const IID_IMaintenanceSettings = &IID_IMaintenanceSettings_Value; pub const IMaintenanceSettings = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Period: fn( self: *const IMaintenanceSettings, value: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Period: fn( self: *const IMaintenanceSettings, target: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Deadline: fn( self: *const IMaintenanceSettings, value: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Deadline: fn( self: *const IMaintenanceSettings, target: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Exclusive: fn( self: *const IMaintenanceSettings, value: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Exclusive: fn( self: *const IMaintenanceSettings, target: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMaintenanceSettings_put_Period(self: *const T, value: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMaintenanceSettings.VTable, self.vtable).put_Period(@ptrCast(*const IMaintenanceSettings, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMaintenanceSettings_get_Period(self: *const T, target: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMaintenanceSettings.VTable, self.vtable).get_Period(@ptrCast(*const IMaintenanceSettings, self), target); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMaintenanceSettings_put_Deadline(self: *const T, value: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMaintenanceSettings.VTable, self.vtable).put_Deadline(@ptrCast(*const IMaintenanceSettings, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMaintenanceSettings_get_Deadline(self: *const T, target: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMaintenanceSettings.VTable, self.vtable).get_Deadline(@ptrCast(*const IMaintenanceSettings, self), target); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMaintenanceSettings_put_Exclusive(self: *const T, value: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMaintenanceSettings.VTable, self.vtable).put_Exclusive(@ptrCast(*const IMaintenanceSettings, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMaintenanceSettings_get_Exclusive(self: *const T, target: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMaintenanceSettings.VTable, self.vtable).get_Exclusive(@ptrCast(*const IMaintenanceSettings, self), target); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRegisteredTaskCollection_Value = @import("../zig.zig").Guid.initString("86627eb4-42a7-41e4-a4d9-ac33a72f2d52"); pub const IID_IRegisteredTaskCollection = &IID_IRegisteredTaskCollection_Value; pub const IRegisteredTaskCollection = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IRegisteredTaskCollection, pCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IRegisteredTaskCollection, index: VARIANT, ppRegisteredTask: ?*?*IRegisteredTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IRegisteredTaskCollection, ppEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTaskCollection_get_Count(self: *const T, pCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTaskCollection.VTable, self.vtable).get_Count(@ptrCast(*const IRegisteredTaskCollection, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTaskCollection_get_Item(self: *const T, index: VARIANT, ppRegisteredTask: ?*?*IRegisteredTask) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTaskCollection.VTable, self.vtable).get_Item(@ptrCast(*const IRegisteredTaskCollection, self), index, ppRegisteredTask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRegisteredTaskCollection_get__NewEnum(self: *const T, ppEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IRegisteredTaskCollection.VTable, self.vtable).get__NewEnum(@ptrCast(*const IRegisteredTaskCollection, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ITaskFolder_Value = @import("../zig.zig").Guid.initString("8cfac062-a080-4c15-9a88-aa7c2af80dfc"); pub const IID_ITaskFolder = &IID_ITaskFolder_Value; pub const ITaskFolder = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const ITaskFolder, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Path: fn( self: *const ITaskFolder, pPath: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFolder: fn( self: *const ITaskFolder, path: ?BSTR, ppFolder: ?*?*ITaskFolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFolders: fn( self: *const ITaskFolder, flags: i32, ppFolders: ?*?*ITaskFolderCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateFolder: fn( self: *const ITaskFolder, subFolderName: ?BSTR, sddl: VARIANT, ppFolder: ?*?*ITaskFolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteFolder: fn( self: *const ITaskFolder, subFolderName: ?BSTR, flags: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTask: fn( self: *const ITaskFolder, path: ?BSTR, ppTask: ?*?*IRegisteredTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTasks: fn( self: *const ITaskFolder, flags: i32, ppTasks: ?*?*IRegisteredTaskCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteTask: fn( self: *const ITaskFolder, name: ?BSTR, flags: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterTask: fn( self: *const ITaskFolder, path: ?BSTR, xmlText: ?BSTR, flags: i32, userId: VARIANT, password: <PASSWORD>, logonType: TASK_LOGON_TYPE, sddl: VARIANT, ppTask: ?*?*IRegisteredTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterTaskDefinition: fn( self: *const ITaskFolder, path: ?BSTR, pDefinition: ?*ITaskDefinition, flags: i32, userId: VARIANT, password: <PASSWORD>, logonType: TASK_LOGON_TYPE, sddl: VARIANT, ppTask: ?*?*IRegisteredTask, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSecurityDescriptor: fn( self: *const ITaskFolder, securityInformation: i32, pSddl: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSecurityDescriptor: fn( self: *const ITaskFolder, sddl: ?BSTR, flags: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_get_Name(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).get_Name(@ptrCast(*const ITaskFolder, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_get_Path(self: *const T, pPath: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).get_Path(@ptrCast(*const ITaskFolder, self), pPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_GetFolder(self: *const T, path: ?BSTR, ppFolder: ?*?*ITaskFolder) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).GetFolder(@ptrCast(*const ITaskFolder, self), path, ppFolder); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_GetFolders(self: *const T, flags: i32, ppFolders: ?*?*ITaskFolderCollection) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).GetFolders(@ptrCast(*const ITaskFolder, self), flags, ppFolders); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_CreateFolder(self: *const T, subFolderName: ?BSTR, sddl: VARIANT, ppFolder: ?*?*ITaskFolder) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).CreateFolder(@ptrCast(*const ITaskFolder, self), subFolderName, sddl, ppFolder); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_DeleteFolder(self: *const T, subFolderName: ?BSTR, flags: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).DeleteFolder(@ptrCast(*const ITaskFolder, self), subFolderName, flags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_GetTask(self: *const T, path: ?BSTR, ppTask: ?*?*IRegisteredTask) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).GetTask(@ptrCast(*const ITaskFolder, self), path, ppTask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_GetTasks(self: *const T, flags: i32, ppTasks: ?*?*IRegisteredTaskCollection) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).GetTasks(@ptrCast(*const ITaskFolder, self), flags, ppTasks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_DeleteTask(self: *const T, name: ?BSTR, flags: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).DeleteTask(@ptrCast(*const ITaskFolder, self), name, flags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_RegisterTask(self: *const T, path: ?BSTR, xmlText: ?BSTR, flags: i32, userId: VARIANT, password: <PASSWORD>, logonType: TASK_LOGON_TYPE, sddl: VARIANT, ppTask: ?*?*IRegisteredTask) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).RegisterTask(@ptrCast(*const ITaskFolder, self), path, xmlText, flags, userId, password, logonType, sddl, ppTask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_RegisterTaskDefinition(self: *const T, path: ?BSTR, pDefinition: ?*ITaskDefinition, flags: i32, userId: VARIANT, password: <PASSWORD>, logonType: TASK_LOGON_TYPE, sddl: VARIANT, ppTask: ?*?*IRegisteredTask) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).RegisterTaskDefinition(@ptrCast(*const ITaskFolder, self), path, pDefinition, flags, userId, password, logonType, sddl, ppTask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_GetSecurityDescriptor(self: *const T, securityInformation: i32, pSddl: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).GetSecurityDescriptor(@ptrCast(*const ITaskFolder, self), securityInformation, pSddl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITaskFolder_SetSecurityDescriptor(self: *const T, sddl: ?BSTR, flags: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITaskFolder.VTable, self.vtable).SetSecurityDescriptor(@ptrCast(*const ITaskFolder, self), sddl, flags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IIdleSettings_Value = @import("../zig.zig").Guid.initString("84594461-0053-4342-a8fd-088fabf11f32"); pub const IID_IIdleSettings = &IID_IIdleSettings_Value; pub const IIdleSettings = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_IdleDuration: fn( self: *const IIdleSettings, pDelay: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_IdleDuration: fn( self: *const IIdleSettings, delay: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WaitTimeout: fn( self: *const IIdleSettings, pTimeout: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_WaitTimeout: fn( self: *const IIdleSettings, timeout: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StopOnIdleEnd: fn( self: *const IIdleSettings, pStop: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_StopOnIdleEnd: fn( self: *const IIdleSettings, stop: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_RestartOnIdle: fn( self: *const IIdleSettings, pRestart: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_RestartOnIdle: fn( self: *const IIdleSettings, restart: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_get_IdleDuration(self: *const T, pDelay: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).get_IdleDuration(@ptrCast(*const IIdleSettings, self), pDelay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_put_IdleDuration(self: *const T, delay: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).put_IdleDuration(@ptrCast(*const IIdleSettings, self), delay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_get_WaitTimeout(self: *const T, pTimeout: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).get_WaitTimeout(@ptrCast(*const IIdleSettings, self), pTimeout); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_put_WaitTimeout(self: *const T, timeout: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).put_WaitTimeout(@ptrCast(*const IIdleSettings, self), timeout); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_get_StopOnIdleEnd(self: *const T, pStop: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).get_StopOnIdleEnd(@ptrCast(*const IIdleSettings, self), pStop); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_put_StopOnIdleEnd(self: *const T, stop: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).put_StopOnIdleEnd(@ptrCast(*const IIdleSettings, self), stop); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_get_RestartOnIdle(self: *const T, pRestart: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).get_RestartOnIdle(@ptrCast(*const IIdleSettings, self), pRestart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IIdleSettings_put_RestartOnIdle(self: *const T, restart: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IIdleSettings.VTable, self.vtable).put_RestartOnIdle(@ptrCast(*const IIdleSettings, self), restart); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_INetworkSettings_Value = @import("../zig.zig").Guid.initString("9f7dea84-c30b-4245-80b6-00e9f646f1b4"); pub const IID_INetworkSettings = &IID_INetworkSettings_Value; pub const INetworkSettings = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const INetworkSettings, pName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Name: fn( self: *const INetworkSettings, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Id: fn( self: *const INetworkSettings, pId: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Id: fn( self: *const INetworkSettings, id: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetworkSettings_get_Name(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetworkSettings.VTable, self.vtable).get_Name(@ptrCast(*const INetworkSettings, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetworkSettings_put_Name(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetworkSettings.VTable, self.vtable).put_Name(@ptrCast(*const INetworkSettings, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetworkSettings_get_Id(self: *const T, pId: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetworkSettings.VTable, self.vtable).get_Id(@ptrCast(*const INetworkSettings, self), pId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn INetworkSettings_put_Id(self: *const T, id: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const INetworkSettings.VTable, self.vtable).put_Id(@ptrCast(*const INetworkSettings, self), id); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IRepetitionPattern_Value = @import("../zig.zig").Guid.initString("7fb9acf1-26be-400e-85b5-294b9c75dfd6"); pub const IID_IRepetitionPattern = &IID_IRepetitionPattern_Value; pub const IRepetitionPattern = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Interval: fn( self: *const IRepetitionPattern, pInterval: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Interval: fn( self: *const IRepetitionPattern, interval: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Duration: fn( self: *const IRepetitionPattern, pDuration: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Duration: fn( self: *const IRepetitionPattern, duration: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_StopAtDurationEnd: fn( self: *const IRepetitionPattern, pStop: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_StopAtDurationEnd: fn( self: *const IRepetitionPattern, stop: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRepetitionPattern_get_Interval(self: *const T, pInterval: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRepetitionPattern.VTable, self.vtable).get_Interval(@ptrCast(*const IRepetitionPattern, self), pInterval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRepetitionPattern_put_Interval(self: *const T, interval: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRepetitionPattern.VTable, self.vtable).put_Interval(@ptrCast(*const IRepetitionPattern, self), interval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRepetitionPattern_get_Duration(self: *const T, pDuration: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRepetitionPattern.VTable, self.vtable).get_Duration(@ptrCast(*const IRepetitionPattern, self), pDuration); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRepetitionPattern_put_Duration(self: *const T, duration: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRepetitionPattern.VTable, self.vtable).put_Duration(@ptrCast(*const IRepetitionPattern, self), duration); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRepetitionPattern_get_StopAtDurationEnd(self: *const T, pStop: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRepetitionPattern.VTable, self.vtable).get_StopAtDurationEnd(@ptrCast(*const IRepetitionPattern, self), pStop); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRepetitionPattern_put_StopAtDurationEnd(self: *const T, stop: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IRepetitionPattern.VTable, self.vtable).put_StopAtDurationEnd(@ptrCast(*const IRepetitionPattern, self), stop); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (0) //-------------------------------------------------------------------------------- //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (12) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const HPROPSHEETPAGE = @import("../ui/controls.zig").HPROPSHEETPAGE; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IDispatch = @import("../system/com.zig").IDispatch; const IUnknown = @import("../system/com.zig").IUnknown; const PWSTR = @import("../foundation.zig").PWSTR; const SAFEARRAY = @import("../system/com.zig").SAFEARRAY; const SYSTEMTIME = @import("../foundation.zig").SYSTEMTIME; const VARIANT = @import("../system/com.zig").VARIANT; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
win32/system/task_scheduler.zig
const std = @import("std"); const mem = std.mem; const uefi = std.os.uefi; const assert = std.debug.assert; const Allocator = mem.Allocator; const UefiPoolAllocator = struct { fn getHeader(ptr: [*]u8) *[*]align(8) u8 { return @intToPtr(*[*]align(8) u8, @ptrToInt(ptr) - @sizeOf(usize)); } fn alignedAlloc(len: usize, alignment: usize) ?[*]u8 { var unaligned_ptr: [*]align(8) u8 = undefined; if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, len, &unaligned_ptr) != .Success) return null; const unaligned_addr = @ptrToInt(unaligned_ptr); const aligned_addr = mem.alignForward(unaligned_addr + @sizeOf(usize), alignment); var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr); getHeader(aligned_ptr).* = unaligned_ptr; return aligned_ptr; } fn alignedFree(ptr: [*]u8) void { _ = uefi.system_table.boot_services.?.freePool(getHeader(ptr).*); } fn alloc( _: *anyopaque, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize, ) Allocator.Error![]u8 { _ = ret_addr; assert(len > 0); assert(std.math.isPowerOfTwo(ptr_align)); var ptr = alignedAlloc(len, ptr_align) orelse return error.OutOfMemory; if (len_align == 0) return ptr[0..len]; return ptr[0..mem.alignBackwardAnyAlign(len, len_align)]; } fn resize( _: *anyopaque, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, ret_addr: usize, ) ?usize { _ = buf_align; _ = ret_addr; return if (new_len <= buf.len) mem.alignAllocLen(buf.len, new_len, len_align) else null; } fn free( _: *anyopaque, buf: []u8, buf_align: u29, ret_addr: usize, ) void { _ = buf_align; _ = ret_addr; alignedFree(buf.ptr); } }; /// Supports the full Allocator interface, including alignment. /// For a direct call of `allocatePool`, see `raw_pool_allocator`. pub const pool_allocator = Allocator{ .ptr = undefined, .vtable = &pool_allocator_vtable, }; const pool_allocator_vtable = Allocator.VTable{ .alloc = UefiPoolAllocator.alloc, .resize = UefiPoolAllocator.resize, .free = UefiPoolAllocator.free, }; /// Asserts allocations are 8 byte aligned and calls `boot_services.allocatePool`. pub const raw_pool_allocator = Allocator{ .ptr = undefined, .vtable = &raw_pool_allocator_table, }; const raw_pool_allocator_table = Allocator.VTable{ .alloc = uefi_alloc, .resize = uefi_resize, .free = uefi_free, }; fn uefi_alloc( _: *anyopaque, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize, ) Allocator.Error![]u8 { _ = len_align; _ = ret_addr; std.debug.assert(ptr_align <= 8); var ptr: [*]align(8) u8 = undefined; if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, len, &ptr) != .Success) { return error.OutOfMemory; } return ptr[0..len]; } fn uefi_resize( _: *anyopaque, buf: []u8, old_align: u29, new_len: usize, len_align: u29, ret_addr: usize, ) ?usize { _ = old_align; _ = ret_addr; if (new_len <= buf.len) { return mem.alignAllocLen(buf.len, new_len, len_align); } return null; } fn uefi_free( _: *anyopaque, buf: []u8, buf_align: u29, ret_addr: usize, ) void { _ = buf_align; _ = ret_addr; _ = uefi.system_table.boot_services.?.freePool(@alignCast(8, buf.ptr)); }
lib/std/os/uefi/pool_allocator.zig
const std = @import("std"); const testing = std.testing; const warn = std.debug.warn; const snippet = @import("snippet.zig"); test "Builder" { const fixture = struct { fn case0(self: *snippet.Builder) anyerror!void {} fn case1(self: *snippet.Builder) anyerror!void { try self.writeText( \\hi { } $ | " , / \ ); } fn case2(self: *snippet.Builder) anyerror!void { try self.writePlaceholder(null); } fn case3(self: *snippet.Builder) anyerror!void { try self.writeText("hi "); try self.writePlaceholder(case3Part); } fn case3Part(self: *snippet.Builder) anyerror!void { try self.writeText("there"); } fn case4(self: *snippet.Builder) anyerror!void { try self.writePlaceholder(case4id); } fn case4id(self: *snippet.Builder) anyerror!void { try self.writeText("id="); try self.writePlaceholder(case4nest); } fn case4nest(self: *snippet.Builder) anyerror!void { try self.writeText("{your id}"); } fn case5(self: *snippet.Builder) anyerror!void { try self.writeChoice( [][]const u8{ "one", \\{ } $ | " , / \ , "three", }, ); } }; var a = std.debug.global_allocator; var buf = &try std.Buffer.init(a, ""); defer buf.deinit(); var b = &try snippet.Builder.init(a, buf); try expect(b, "", fixture.case0); try expect( b, \\hi { \} \$ | " , / \\ , fixture.case1, ); try expect( b, \\${1} , fixture.case2, ); try expect( b, \\hi ${1:there} , fixture.case3, ); try expect( b, \\${1:id=${2:{your id\}}} , fixture.case4, ); try expect( b, \\${1|one,{ \} \$ \| " \, / \\,three|} , fixture.case5, ); } fn expect(b: *snippet.Builder, expected: []const u8, cb: fn (*snippet.Builder) anyerror!void) !void { try b.reset(); try cb(b); testing.expect(b.buf.eql(expected)); }
src/lsp/snippet/snippet_test.zig
const std = @import("std"); const assert = std.debug.assert; const event = @import("event.zig"); const GameEvent = event.GameEvent; const GameResult = event.GameResult; // FIXME Check https://github.com/ziglang/zig/issues/10421 pub const @"u16_2" = std.meta.Vector(2, u16); pub const @"i16_2" = std.meta.Vector(2, i16); pub const @"u32_2" = std.meta.Vector(2, u32); const MineSweeperBoardExtentMin = u32_2{ 5, 5 }; const MineSweeperBoardExtentMax = u32_2{ 1024, 1024 }; const UncoverAllMinesAfterLosing = true; const EnableGuessFlag = true; const neighborhood_offset_table = [9]i16_2{ i16_2{ -1, -1 }, i16_2{ -1, 0 }, i16_2{ -1, 1 }, i16_2{ 0, -1 }, i16_2{ 0, 1 }, i16_2{ 1, -1 }, i16_2{ 1, -0 }, i16_2{ 1, 1 }, i16_2{ 0, 0 }, // Center position at the end so we can easily ignore it }; pub const Marking = enum { None, Flag, Guess, }; pub const CellState = struct { is_mine: bool = false, is_covered: bool = true, marking: Marking = Marking.None, mine_neighbors: u4 = 0, }; pub const GameState = struct { extent: u32_2, mine_count: u32, board: [][]CellState, rng: std.rand.Xoroshiro128, // Hardcode PRNG type for forward compatibility is_first_move: bool = true, is_ended: bool = false, flag_count: u32 = 0, // Storage for game events event_history: []GameEvent, event_history_index: usize = 0, children_array: []u16_2, children_array_index: usize = 0, }; pub fn cell_at(game: *GameState, position: u32_2) *CellState { return &game.board[position[0]][position[1]]; } // I borrowed this name from HLSL fn all(vector: anytype) bool { const type_info = @typeInfo(@TypeOf(vector)); assert(type_info.Vector.child == bool); assert(type_info.Vector.len > 1); return @reduce(.And, vector); } fn any(vector: anytype) bool { const type_info = @typeInfo(@TypeOf(vector)); assert(type_info.Vector.child == bool); assert(type_info.Vector.len > 1); return @reduce(.Or, vector); } // Creates blank board without mines. // Placement of mines is done on the first player input. pub fn create_game_state(allocator: std.mem.Allocator, extent: u32_2, mine_count: u32, seed: u64) !GameState { assert(all(extent >= MineSweeperBoardExtentMin)); assert(all(extent <= MineSweeperBoardExtentMax)); const cell_count = extent[0] * extent[1]; assert(mine_count > 0); assert(mine_count <= (cell_count - 9) / 2); // 9 is to take into account the starting position that has no mines in the neighborhood // Allocate board const board = try allocator.alloc([]CellState, extent[0]); errdefer allocator.free(board); for (board) |*column| { column.* = try allocator.alloc(CellState, extent[1]); errdefer allocator.free(column); for (column.*) |*cell| { cell.* = .{}; } } // Allocate array to hold events const max_events = cell_count + 2000; const event_history = try allocator.alloc(GameEvent, max_events); errdefer allocator.free(event_history); // Allocate array to hold cells discovered in events const children_array = try allocator.alloc(u16_2, cell_count); errdefer allocator.free(children_array); return GameState{ .extent = extent, .mine_count = mine_count, .rng = std.rand.Xoroshiro128.init(seed), .board = board, .event_history = event_history, .children_array = children_array, }; } pub fn destroy_game_state(allocator: std.mem.Allocator, game: *GameState) void { allocator.free(game.children_array); allocator.free(game.event_history); for (game.board) |column| { allocator.free(column); } allocator.free(game.board); } // Process an oncover events and propagates the state on the board. pub fn uncover(game: *GameState, uncover_pos: u16_2) void { assert(all(uncover_pos < game.extent)); if (game.is_first_move) { fill_mines(game, uncover_pos); game.is_first_move = false; } if (game.is_ended) return; var uncovered_cell = cell_at(game, uncover_pos); if (uncovered_cell.marking == Marking.Flag) { return; // Nothing happens! } if (!uncovered_cell.is_covered) { if (!uncovered_cell.is_mine and uncovered_cell.mine_neighbors > 0) { const start_children = game.children_array_index; uncover_from_number(game, uncover_pos, uncovered_cell); const end_children = game.children_array_index; event.append_discover_number_event(game, uncover_pos, game.children_array[start_children..end_children]); } else { return; // Nothing happens! } } else if (uncovered_cell.mine_neighbors == 0) { // Create new event const start_children = game.children_array_index; uncover_zero_neighbors(game, uncover_pos); const end_children = game.children_array_index; event.append_discover_many_event(game, uncover_pos, game.children_array[start_children..end_children]); } else { uncovered_cell.is_covered = false; event.append_discover_single_event(game, uncover_pos); } check_win_conditions(game); } fn check_win_conditions(game: *GameState) void { assert(!game.is_ended); { // Did we lose? // It's possible to lose by doing a wrong number discover. // That means we potentially lose on another cell, or multiple // other cells - so we check the full board here. // Also we count the flags here since we're at it. const start_children = game.children_array_index; game.flag_count = 0; for (game.board) |column, x| { for (column) |*cell, y| { // Oops! if (cell.is_mine and !cell.is_covered) { game.is_ended = true; game.children_array[game.children_array_index] = .{ @intCast(u16, x), @intCast(u16, y) }; game.children_array_index += 1; } if (cell.marking == Marking.Flag) game.flag_count += 1; } } const end_children = game.children_array_index; if (game.is_ended) { assert(end_children > start_children); if (UncoverAllMinesAfterLosing) { for (game.board) |column| { for (column) |*cell| { if (cell.is_mine) cell.is_covered = false; } } } event.append_game_end_event(game, GameResult.Lose, game.children_array[start_children..end_children]); } } // Did we win? if (is_board_won(game.board)) { // Uncover the board and flag all mines for (game.board) |column| { for (column) |*cell| { if (cell.is_mine) { // Here we should update the flag count but since we won there's no need cell.marking = Marking.Flag; } else { cell.is_covered = false; } } } game.is_ended = true; event.append_game_end_event(game, GameResult.Win, game.children_array[0..0]); } } fn is_neighbor(a: u32_2, b: u32_2) !bool { const dx = try std.math.absInt(@intCast(i32, a[0]) - @intCast(i32, b[0])); const dy = try std.math.absInt(@intCast(i32, a[1]) - @intCast(i32, b[1])); return dx <= 1 and dy <= 1; } // Feed a blank but initialized board and it will dart throw mines at it until it has the right // number of mines. // We make sure that no mines is placed in the startup location, including its immediate neighborhood. // Often players restart the game until they land on this type of spots anyway, that removes the // frustrating guessing part. fn fill_mines(game: *GameState, start: u16_2) void { var remaining_mines = game.mine_count; // Randomly place the mines on the board while (remaining_mines > 0) { const random_pos = u32_2{ game.rng.random().uintLessThan(u32, game.extent[0]), game.rng.random().uintLessThan(u32, game.extent[1]) }; // Do not generate mines where the player starts if (is_neighbor(random_pos, start) catch false) continue; var random_cell = cell_at(game, random_pos); if (random_cell.is_mine) continue; random_cell.is_mine = true; // Increment the counts for neighboring cells for (neighborhood_offset_table[0..9]) |offset| { const target = @intCast(i16_2, random_pos) + offset; // Out of bounds if (any(target < i16_2{ 0, 0 }) or any(target >= game.extent)) continue; cell_at(game, @intCast(u16_2, target)).mine_neighbors += 1; } remaining_mines -= 1; } } // Discovers all cells adjacents to a zero-neighbor cell. // Assumes that the play is valid. // Careful, this function is recursive! It WILL smash the stack on large boards fn uncover_zero_neighbors(game: *GameState, uncover_pos: u16_2) void { var cell = cell_at(game, uncover_pos); assert(cell.mine_neighbors == 0); // If the user put an invalid flag there by mistake, we clear it for him // That can only happens in recursive calls. cell.marking = Marking.None; cell.is_covered = false; game.children_array[game.children_array_index] = uncover_pos; game.children_array_index += 1; for (neighborhood_offset_table[0..8]) |offset| { const target = @intCast(i16_2, uncover_pos) + offset; // Out of bounds if (any(target < i16_2{ 0, 0 }) or any(target >= game.extent)) continue; const utarget = @intCast(u16_2, target); var target_cell = cell_at(game, utarget); if (!target_cell.is_covered) continue; if (target_cell.mine_neighbors > 0) { target_cell.is_covered = false; game.children_array[game.children_array_index] = utarget; game.children_array_index += 1; } else { uncover_zero_neighbors(game, utarget); } } } // Discovers all adjacent cells around a numbered cell, // if the number of flags around it equals that number. // This can make you lose if your flags aren't set properly. fn uncover_from_number(game: *GameState, number_pos: u16_2, number_cell: *CellState) void { assert(number_cell.mine_neighbors > 0); assert(!number_cell.is_covered); assert(!number_cell.is_mine); var candidates: [8]u16_2 = undefined; var candidate_count: u32 = 0; var flag_count: u32 = 0; for (neighborhood_offset_table[0..8]) |offset| { const target = @intCast(i16_2, number_pos) + offset; // Out of bounds if (any(target < i16_2{ 0, 0 }) or any(target >= game.extent)) continue; const utarget = @intCast(u16_2, target); var target_cell = cell_at(game, utarget); assert(target_cell.is_covered or target_cell.marking == Marking.None); if (target_cell.marking == Marking.Flag) { flag_count += 1; } else if (target_cell.is_covered) { candidates[candidate_count] = utarget; candidate_count += 1; } } if (number_cell.mine_neighbors == flag_count) { var candidate_index: u32 = 0; while (candidate_index < candidate_count) { const candidate_pos = candidates[candidate_index]; var cell = cell_at(game, candidate_pos); assert(cell.marking != Marking.Flag); // We might trigger second-hand big uncovers! if (cell.mine_neighbors == 0) { uncover_zero_neighbors(game, candidate_pos); } else { cell.is_covered = false; } game.children_array[game.children_array_index] = candidate_pos; game.children_array_index += 1; candidate_index += 1; } } } pub fn toggle_flag(game: *GameState, flag_pos: u16_2) void { assert(all(flag_pos < game.extent)); if (game.is_first_move or game.is_ended) return; var cell = cell_at(game, flag_pos); if (!cell.is_covered) return; switch (cell.marking) { Marking.None => { cell.marking = Marking.Flag; game.flag_count += 1; }, Marking.Flag => { if (EnableGuessFlag) { cell.marking = Marking.Guess; } else cell.marking = Marking.None; game.flag_count -= 1; }, Marking.Guess => { cell.marking = Marking.None; }, } } fn is_board_won(board: [][]CellState) bool { for (board) |column| { for (column) |cell| { if (cell.is_covered and !cell.is_mine) return false; } } return true; }
src/minesweeper/game.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; pub const ArgTypeTag = enum { String, None, }; pub const ArgType = union(ArgTypeTag) { String: ?[]u8, None: void, }; pub fn Flag(comptime T: type) type { return struct { // Unique "ID" for flag (use enum) name: T, kind: ArgTypeTag = ArgTypeTag.None, // ignored if 'kind' is None mandatory: bool = false, // Should be unique within the parsing context short: ?u8 = null, long: ?[]const u8 = null, }; } pub fn FlagValue(comptime T: type) type { return struct { name: T, value: ArgType, }; } pub fn FlagIterator(comptime T: type) type { return struct { flags: []Flag(T), argv: [][]u8, count: u16 = 1, argcount: u16 = 1, pos: u16 = 0, stop: bool = false, argstop: bool = false, pub fn init(fl: []Flag(T), arg: [][]u8) FlagIterator(T) { return FlagIterator(T){ .flags = fl, .argv = arg, }; } pub fn next_flag(self: *FlagIterator(T)) !?FlagValue(T) { while (true) { if (self.stop or self.count >= self.argv.len) { return null; } const curr = self.argv[self.count]; if (self.pos == 0 and curr.len >= 2 and std.mem.eql(u8, curr[0..2], "--")) { // Stop parsing after bare -- if (curr.len == 2) { self.stop = true; return null; } return try self.next_long(); } // If - is followed by a character, short option if (curr.len >= 2 and curr[0] == '-') { return try self.next_short(); } // If neither - or --, then this is an argument, not an option, // and we ignore it self.count += 1; self.pos = 0; } } pub fn next_arg(self: *FlagIterator(T)) ?[]u8 { while (true) { if (self.argcount >= self.argv.len) { return null; } const curr = self.argv[self.argcount]; // If previously encountered bare --, then everything after is arg if (self.argstop) { self.argcount += 1; return curr; } // If no - or --, (or bare -) we've hit an arg, return it if (curr[0] != '-' or curr.len == 1) { self.argcount += 1; return curr; } // If bare --, ignore but set argstop to true if (std.mem.eql(u8, curr, "--")) { self.argstop = true; self.argcount += 1; continue; } // If - or --, look ahead and see if next string is arg of flag if (self.check_arg()) { self.argcount += 1; if (self.argcount < self.argv.len) { self.argcount += 1; continue; } return null; } self.argcount += 1; } } fn next_long(self: *FlagIterator(T)) !?FlagValue(T) { const curr = self.argv[self.count]; var eqindex = curr.len; for (curr) |ch, i| { if (ch == '=') { eqindex = i; break; } } const opt_flag = self.flag_from_long(curr[2..eqindex]); if (opt_flag) |flag| { if (flag.kind == ArgType.None) { if (eqindex != curr.len) { warn("{}: option '{}' doesn't allow an argument\n", .{ self.argv[0], curr[0..eqindex] }); warn("Try '{} --help' for more information.\n", .{self.argv[0]}); return error.InvalidFlagArgument; } self.count += 1; return FlagValue(T){ .name = flag.name, .value = ArgType.None }; } // If can take argument and has =, use that if (eqindex != curr.len) { self.count += 1; return FlagValue(T){ .name = flag.name, .value = ArgType{ .String = curr[eqindex + 1 ..] } }; } // If optional, return null string if (!flag.mandatory) { self.count += 1; return FlagValue(T){ .name = flag.name, .value = ArgType{ .String = null } }; } // If mandatory, return next string if (self.count == self.argv.len - 1) { warn("{}: option '{}' requires an argument.\n", .{ self.argv[0], curr[0..] }); warn("Try '{} --help' for more information.\n", .{self.argv[0]}); return error.MissingFlagArgument; } self.count += 2; return FlagValue(T){ .name = flag.name, .value = ArgType{ .String = self.argv[self.count - 1] } }; } else { // Error, invalid flag warn("{}: unrecognized option '{}'\n", .{ self.argv[0], curr[0..eqindex] }); warn("Try '{} --help' for more information.\n", .{self.argv[0]}); return error.InvalidFlag; } } fn next_short(self: *FlagIterator(T)) !?FlagValue(T) { if (self.pos == 0) self.pos = 1; const curr = self.argv[self.count]; const opt_flag = self.flag_from_short(curr[self.pos]); if (opt_flag) |flag| { if (flag.kind == ArgType.None) { // No value and last char means move to next string afterwards if (self.pos == curr.len - 1) { self.pos = 0; self.count += 1; } // No value and not last char means move to next char else { self.pos += 1; } return FlagValue(T){ .name = flag.name, .value = ArgType.None }; } const oldpos = self.pos; self.pos = 0; self.count += 1; // If last character of word, mandatory/optional matters if (oldpos == curr.len - 1) { if (flag.mandatory) { if (self.count < self.argv.len) { return FlagValue(T){ .name = flag.name, .value = ArgType{ .String = self.argv[self.count] }, }; } else { // Error, missing argument warn("{}: option requires an argument -- '{}'\n", .{ self.argv[0], curr[oldpos .. oldpos + 1] }); warn("Try '{} --help' for more information.\n", .{self.argv[0]}); return error.MissingFlagArgument; } } // Flag with optional argument, last char of word return FlagValue(T){ .name = flag.name, .value = ArgType{ .String = null }, }; } // If not last character of word, the rest of the word is value return FlagValue(T){ .name = flag.name, .value = ArgType{ .String = curr[oldpos + 1 ..] }, }; } else { // Error, invalid flag warn("{}: invalid option -- '{}'\n", .{ self.argv[0], curr[self.pos .. self.pos + 1] }); warn("Try '{} --help' for more information.\n", .{self.argv[0]}); return error.InvalidFlag; } } // Check whether the string after the current string in the arg iterator // is a bare arg (false) or an arg of a flag (true). // We assume the current string starts with '-' // (or possibly '--' but not a bare '--') // Also return false if there is no next string. fn check_arg(self: *FlagIterator(T)) bool { if (self.argcount + 1 >= self.argv.len) { return true; } const curr = self.argv[self.argcount]; // Handle -- if (curr[1] == '-') { var eqindex = curr.len; for (curr) |ch, i| { if (ch == '=') { eqindex = i; break; } } const opt_flag = self.flag_from_long(curr[2..eqindex]); if (opt_flag) |flag| { // Mandatory flag value means that = in the current string // implies that the next string is NOT its argument if (flag.mandatory) { return eqindex == curr.len; } } return false; } // Handle - for (curr) |ch, i| { // 0 index is always - if (i == 0) continue; const opt_flag = self.flag_from_short(ch); if (opt_flag) |flag| { if (flag.kind == ArgType.None) continue; // If last string of the word, depends on whether mandatory if (i == curr.len - 1) { return flag.mandatory; } // If can have an argument and not at end of word, // next arg is bare return false; } } // Unreachable return false; } fn flag_from_short(self: *FlagIterator(T), short: u8) ?Flag(T) { for (self.flags) |flag| { if (flag.short) |curr_short| { if (short == curr_short) { return flag; } } } return null; } fn flag_from_long(self: *FlagIterator(T), long: []u8) ?Flag(T) { for (self.flags) |flag| { if (flag.long) |curr_long| { if (std.mem.eql(u8, curr_long, long)) { return flag; } } } return null; } }; }
src/opt.zig
const std = @import("std"); const sdk = @import("sdk"); const log = @import("log.zig"); const event = @import("event.zig"); const ifaces = @import("interface.zig").ifaces; const orig = @import("interface.zig").orig; var count: u8 = 0; const Method = switch (@import("builtin").os.tag) { .windows => std.builtin.CallingConvention.Thiscall, else => std.builtin.CallingConvention.C, }; fn readFuncPtr(comptime T: type, func: anytype, offset: usize) T { const raw = @ptrToInt(func); const diff = @intToPtr(*align(1) const usize, raw + offset).*; const addr = (raw + offset + @sizeOf(usize)) +% diff; return @intToPtr(T, addr); } IEngineVGui: struct { pub fn paint(self: *sdk.IEngineVGui, _mode: c_int) callconv(Method) void { var ret = orig.IEngineVGui.paint(self, _mode); const mode = @bitCast(sdk.PaintMode, @intCast(u2, _mode)); // TODO: proper system for getting non-exposed shit, cuz this is // gross const offsets = switch (@import("builtin").os.tag) { .linux => .{ .startDrawing = 85, .finishDrawing = 204, }, .windows => .{ .startDrawing = 22, .finishDrawing = 117, }, .macos => .{ .startDrawing = 59, .finishDrawing = 217, }, else => @compileError("OS not supported"), }; const startDrawing = readFuncPtr(fn (*sdk.ISurface) callconv(Method) void, orig.ISurface.precacheFontCharacters, offsets.startDrawing); const finishDrawing = readFuncPtr(fn (*sdk.ISurface) callconv(Method) void, orig.ISurface.precacheFontCharacters, offsets.finishDrawing); startDrawing(ifaces.ISurface); if (mode.ui_panels) { @import("thud.zig").drawAll(0); //const str = "Hello from Wormhole!"; // Seriously Valve, what the fuck is with the wchar strings? //var wstr: [str.len]sdk.wchar = undefined; //for (str) |c, i| { // wstr[i] = @intCast(sdk.wchar, c); //} //ifaces.ISurface.drawSetTextPos(100, 100); //ifaces.ISurface.drawSetTextColor(sdk.Color{ .r = 0xCC, .g = 0x22, .b = 0xFF }); //ifaces.ISurface.drawSetTextFont(13); //ifaces.ISurface.drawPrintText(&wstr, wstr.len, sdk.FontDrawType.default); } finishDrawing(ifaces.ISurface); return ret; } }, IServerGameDLL: struct { pub fn gameFrame(self: *sdk.IServerGameDLL, simulating: bool) callconv(Method) void { var sim1 = simulating; event.trigger(null, "pre_tick", &sim1); var ret = orig.IServerGameDLL.gameFrame(self, simulating); event.trigger(null, "post_tick", &sim1); return ret; } },
src/hooks.zig
const std = @import("std"); const Arena = std.heap.ArenaAllocator; const expectEqual = std.testing.expectEqual; const expectEqualStrings = std.testing.expectEqualStrings; const yeti = @import("yeti"); const initCodebase = yeti.initCodebase; const tokenize = yeti.tokenize; const parse = yeti.parse; const analyzeSemantics = yeti.analyzeSemantics; const codegen = yeti.codegen; const printWasm = yeti.printWasm; const components = yeti.components; const literalOf = yeti.query.literalOf; const typeOf = yeti.query.typeOf; const parentType = yeti.query.parentType; const valueType = yeti.query.valueType; const Entity = yeti.ecs.Entity; const MockFileSystem = yeti.FileSystem; test "parse define int literal" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const module = try codebase.createEntity(.{}); const code = \\start() u64 { \\ x = 10 \\ x \\} ; var tokens = try tokenize(module, code); try parse(module, &tokens); const top_level = module.get(components.TopLevel); const start = top_level.findString("start"); const overloads = start.get(components.Overloads).slice(); try expectEqual(overloads.len, 1); const body = overloads[0].get(components.Body).slice(); try expectEqual(body.len, 2); const define = body[0]; try expectEqual(define.get(components.AstKind), .define); try expectEqualStrings(literalOf(define.get(components.Name).entity), "x"); try expectEqualStrings(literalOf(define.get(components.Value).entity), "10"); const x = body[1]; try expectEqual(x.get(components.AstKind), .symbol); try expectEqualStrings(literalOf(x), "x"); } test "parse define with explicit type" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const module = try codebase.createEntity(.{}); const code = \\start() u64 { \\ x: u64 = 10 \\ x \\} ; var tokens = try tokenize(module, code); try parse(module, &tokens); const top_level = module.get(components.TopLevel); const start = top_level.findString("start"); const overloads = start.get(components.Overloads).slice(); try expectEqual(overloads.len, 1); const body = overloads[0].get(components.Body).slice(); try expectEqual(body.len, 2); const define = body[0]; try expectEqual(define.get(components.AstKind), .define); try expectEqualStrings(literalOf(define.get(components.Name).entity), "x"); try expectEqualStrings(literalOf(define.get(components.Value).entity), "10"); try expectEqualStrings(literalOf(define.get(components.TypeAst).entity), "u64"); const x = body[1]; try expectEqual(x.get(components.AstKind), .symbol); try expectEqualStrings(literalOf(x), "x"); } test "analyze semantics define" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const builtins = codebase.get(components.Builtins); const types = [_][]const u8{ "i64", "i32", "u64", "u32", "f64", "f32" }; const builtin_types = [_]Entity{ builtins.I64, builtins.I32, builtins.U64, builtins.U32, builtins.F64, builtins.F32 }; for (types) |type_of, i| { var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", try std.fmt.allocPrint(arena.allocator(), \\start() {s} {{ \\ x = 10 \\ x \\}} , .{type_of})); const module = try analyzeSemantics(codebase, fs, "foo.yeti"); const top_level = module.get(components.TopLevel); const start = top_level.findString("start").get(components.Overloads).slice()[0]; try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo"); try expectEqualStrings(literalOf(start.get(components.Name).entity), "start"); try expectEqual(start.get(components.Parameters).len(), 0); try expectEqual(start.get(components.ReturnType).entity, builtin_types[i]); const body = start.get(components.Body).slice(); try expectEqual(body.len, 2); const define = body[0]; try expectEqual(define.get(components.AstKind), .define); try expectEqual(typeOf(define), builtins.Void); try expectEqualStrings(literalOf(define.get(components.Value).entity), "10"); const x = define.get(components.Local).entity; try expectEqualStrings(literalOf(x.get(components.Name).entity), "x"); try expectEqual(typeOf(x), builtin_types[i]); try expectEqual(body[1], x); } } test "analyze semantics two defines" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const builtins = codebase.get(components.Builtins); const types = [_][]const u8{ "f64", "f32" }; const builtin_types = [_]Entity{ builtins.F64, builtins.F32 }; for (types) |type_of, i| { var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", try std.fmt.allocPrint(arena.allocator(), \\start() {s} {{ \\ x = 10 \\ y = 15 \\ x \\}} , .{type_of})); const module = try analyzeSemantics(codebase, fs, "foo.yeti"); const top_level = module.get(components.TopLevel); const start = top_level.findString("start").get(components.Overloads).slice()[0]; try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo"); try expectEqualStrings(literalOf(start.get(components.Name).entity), "start"); try expectEqual(start.get(components.Parameters).len(), 0); try expectEqual(start.get(components.ReturnType).entity, builtin_types[i]); const body = start.get(components.Body).slice(); try expectEqual(body.len, 3); const x = blk: { const define = body[0]; try expectEqual(define.get(components.AstKind), .define); try expectEqual(typeOf(define), builtins.Void); try expectEqualStrings(literalOf(define.get(components.Value).entity), "10"); const local = define.get(components.Local).entity; try expectEqual(local.get(components.AstKind), .local); try expectEqualStrings(literalOf(local.get(components.Name).entity), "x"); try expectEqual(typeOf(local), builtin_types[i]); break :blk local; }; { const define = body[1]; try expectEqual(define.get(components.AstKind), .define); try expectEqual(typeOf(define), builtins.Void); try expectEqualStrings(literalOf(define.get(components.Value).entity), "15"); const local = define.get(components.Local).entity; try expectEqual(local.get(components.AstKind), .local); try expectEqualStrings(literalOf(local.get(components.Name).entity), "y"); try expectEqual(typeOf(local), builtins.I32); } try expectEqual(body[2], x); } } test "analyze semantics define with explicit float type" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const builtins = codebase.get(components.Builtins); const types = [_][]const u8{ "f64", "f32" }; const builtin_types = [_]Entity{ builtins.F64, builtins.F32 }; for (types) |type_of, i| { var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", try std.fmt.allocPrint(arena.allocator(), \\start() {s} {{ \\ x: {s} = 10 \\ x \\}} , .{ type_of, type_of })); const module = try analyzeSemantics(codebase, fs, "foo.yeti"); const top_level = module.get(components.TopLevel); const start = top_level.findString("start").get(components.Overloads).slice()[0]; try expectEqualStrings(literalOf(start.get(components.Module).entity), "foo"); try expectEqualStrings(literalOf(start.get(components.Name).entity), "start"); try expectEqual(start.get(components.Parameters).len(), 0); try expectEqual(start.get(components.ReturnType).entity, builtin_types[i]); const body = start.get(components.Body).slice(); try expectEqual(body.len, 2); const define = body[0]; try expectEqual(define.get(components.AstKind), .define); try expectEqual(typeOf(define), builtins.Void); try expectEqualStrings(literalOf(define.get(components.Value).entity), "10"); const x = define.get(components.Local).entity; try expectEqual(x.get(components.AstKind), .local); try expectEqualStrings(literalOf(x.get(components.Name).entity), "x"); try expectEqual(typeOf(x), builtin_types[i]); try expectEqual(body[1], x); } } test "codegen define" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const types = [_][]const u8{ "i64", "i32", "u64", "u32", "f64", "f32" }; const const_kinds = [_]components.WasmInstructionKind{ .i64_const, .i32_const, .i64_const, .i32_const, .f64_const, .f32_const }; for (types) |type_, i| { var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", try std.fmt.allocPrint(arena.allocator(), \\start() {s} {{ \\ x: {s} = 10 \\ x \\}} , .{ type_, type_ })); const module = try analyzeSemantics(codebase, fs, "foo.yeti"); try codegen(module); const top_level = module.get(components.TopLevel); const start = top_level.findString("start").get(components.Overloads).slice()[0]; const start_instructions = start.get(components.WasmInstructions).slice(); try expectEqual(start_instructions.len, 1); const constant = start_instructions[0]; try expectEqual(constant.get(components.WasmInstructionKind), const_kinds[i]); try expectEqualStrings(literalOf(constant.get(components.Constant).entity), "10"); } } test "print wasm define int literal" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const types = [_][]const u8{ "i64", "u64", "f64" }; const wasm_types = [_][]const u8{ "i64", "i64", "f64" }; for (types) |type_, i| { var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", try std.fmt.allocPrint(arena.allocator(), \\start() {s} {{ \\ x = 10 \\ x \\}} , .{type_})); const module = try analyzeSemantics(codebase, fs, "foo.yeti"); try codegen(module); const wasm = try printWasm(module); try expectEqualStrings(wasm, try std.fmt.allocPrint(arena.allocator(), \\(module \\ \\ (func $foo/start (result {s}) \\ ({s}.const 10)) \\ \\ (export "_start" (func $foo/start))) , .{ wasm_types[i], wasm_types[i] })); } }
src/tests/test_define.zig
pub const LOGTOKEN_TYPE_MASK = @as(u32, 3); pub const LOGTOKEN_UNSPECIFIED = @as(u32, 0); pub const LOGTOKEN_NO_LOG = @as(u32, 1); pub const LOGTOKEN_SETUPAPI_APPLOG = @as(u32, 2); pub const LOGTOKEN_SETUPAPI_DEVLOG = @as(u32, 3); pub const TXTLOG_SETUPAPI_DEVLOG = @as(u32, 1); pub const TXTLOG_SETUPAPI_CMDLINE = @as(u32, 2); pub const TXTLOG_SETUPAPI_BITS = @as(u32, 3); pub const TXTLOG_ERROR = @as(u32, 1); pub const TXTLOG_WARNING = @as(u32, 2); pub const TXTLOG_SYSTEM_STATE_CHANGE = @as(u32, 3); pub const TXTLOG_SUMMARY = @as(u32, 4); pub const TXTLOG_DETAILS = @as(u32, 5); pub const TXTLOG_VERBOSE = @as(u32, 6); pub const TXTLOG_VERY_VERBOSE = @as(u32, 7); pub const TXTLOG_RESERVED_FLAGS = @as(u32, 65520); pub const TXTLOG_TIMESTAMP = @as(u32, 65536); pub const TXTLOG_DEPTH_INCR = @as(u32, 131072); pub const TXTLOG_DEPTH_DECR = @as(u32, 262144); pub const TXTLOG_TAB_1 = @as(u32, 524288); pub const TXTLOG_FLUSH_FILE = @as(u32, 1048576); pub const TXTLOG_DEVINST = @as(u32, 1); pub const TXTLOG_INF = @as(u32, 2); pub const TXTLOG_FILEQ = @as(u32, 4); pub const TXTLOG_COPYFILES = @as(u32, 8); pub const TXTLOG_SIGVERIF = @as(u32, 32); pub const TXTLOG_BACKUP = @as(u32, 128); pub const TXTLOG_UI = @as(u32, 256); pub const TXTLOG_UTIL = @as(u32, 512); pub const TXTLOG_INFDB = @as(u32, 1024); pub const TXTLOG_DRVSETUP = @as(u32, 4194304); pub const TXTLOG_POLICY = @as(u32, 8388608); pub const TXTLOG_NEWDEV = @as(u32, 16777216); pub const TXTLOG_UMPNPMGR = @as(u32, 33554432); pub const TXTLOG_DRIVER_STORE = @as(u32, 67108864); pub const TXTLOG_SETUP = @as(u32, 134217728); pub const TXTLOG_CMI = @as(u32, 268435456); pub const TXTLOG_DEVMGR = @as(u32, 536870912); pub const TXTLOG_INSTALLER = @as(u32, 1073741824); pub const TXTLOG_VENDOR = @as(u32, 2147483648); pub const CLSID_EvalCom2 = Guid.initString("6e5e1910-8053-4660-b795-6b612e29bc58"); pub const _WIN32_MSM = @as(u32, 100); pub const LIBID_MsmMergeTypeLib = Guid.initString("0adda82f-2c26-11d2-ad65-00a0c9af11a6"); pub const CLSID_MsmMerge2 = Guid.initString("f94985d5-29f9-4743-9805-99bc3f35b678"); pub const NTDDI_WIN2K = @as(u32, 83886080); pub const NTDDI_WINXP = @as(u32, 83951616); pub const NTDDI_WINXPSP2 = @as(u32, 83952128); pub const NTDDI_WS03SP1 = @as(u32, 84017408); pub const NTDDI_VISTA = @as(u32, 100663296); pub const NTDDI_VISTASP1 = @as(u32, 100663552); pub const NTDDI_WIN7 = @as(u32, 100728832); pub const NTDDI_WIN8 = @as(u32, 100794368); pub const NTDDI_WINBLUE = @as(u32, 100859904); pub const NTDDI_WINTHRESHOLD = @as(u32, 100925440); pub const MAX_GUID_CHARS = @as(u32, 38); pub const MAX_FEATURE_CHARS = @as(u32, 38); pub const MSI_INVALID_HASH_IS_FATAL = @as(u32, 1); pub const ERROR_ROLLBACK_DISABLED = @as(u32, 1653); pub const MSI_NULL_INTEGER = @as(u32, 2147483648); pub const INSTALLMESSAGE_TYPEMASK = @as(i32, -16777216); pub const STREAM_FORMAT_COMPLIB_MODULE = @as(u32, 0); pub const STREAM_FORMAT_COMPLIB_MANIFEST = @as(u32, 1); pub const STREAM_FORMAT_WIN32_MODULE = @as(u32, 2); pub const STREAM_FORMAT_WIN32_MANIFEST = @as(u32, 4); pub const IASSEMBLYCACHEITEM_COMMIT_FLAG_REFRESH = @as(u32, 1); pub const ASSEMBLYINFO_FLAG_INSTALLED = @as(u32, 1); pub const ASSEMBLYINFO_FLAG_PAYLOADRESIDENT = @as(u32, 2); pub const IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_INSTALLED = @as(u32, 1); pub const IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_REFRESHED = @as(u32, 2); pub const IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_ALREADY_INSTALLED = @as(u32, 3); pub const FUSION_REFCOUNT_UNINSTALL_SUBKEY_GUID = Guid.initString("<KEY>"); pub const FUSION_REFCOUNT_FILEPATH_GUID = Guid.initString("b02f9d65-fb77-4f7a-afa5-b391309f11c9"); pub const FUSION_REFCOUNT_OPAQUE_STRING_GUID = Guid.initString("2ec93463-b0c3-45e1-8364-327e96aea856"); pub const SFC_DISABLE_NORMAL = @as(u32, 0); pub const SFC_DISABLE_ASK = @as(u32, 1); pub const SFC_DISABLE_ONCE = @as(u32, 2); pub const SFC_DISABLE_SETUP = @as(u32, 3); pub const SFC_DISABLE_NOPOPUPS = @as(u32, 4); pub const SFC_SCAN_NORMAL = @as(u32, 0); pub const SFC_SCAN_ALWAYS = @as(u32, 1); pub const SFC_SCAN_ONCE = @as(u32, 2); pub const SFC_SCAN_IMMEDIATE = @as(u32, 3); pub const SFC_QUOTA_DEFAULT = @as(u32, 50); //-------------------------------------------------------------------------------- // Section: Types (83) //-------------------------------------------------------------------------------- pub const MSIASSEMBLYINFO = enum(u32) { NETASSEMBLY = 0, WIN32ASSEMBLY = 1, }; pub const MSIASSEMBLYINFO_NETASSEMBLY = MSIASSEMBLYINFO.NETASSEMBLY; pub const MSIASSEMBLYINFO_WIN32ASSEMBLY = MSIASSEMBLYINFO.WIN32ASSEMBLY; pub const IASSEMBLYCACHE_UNINSTALL_DISPOSITION = enum(u32) { UNINSTALLED = 1, STILL_IN_USE = 2, ALREADY_UNINSTALLED = 3, DELETE_PENDING = 4, }; pub const IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED = IASSEMBLYCACHE_UNINSTALL_DISPOSITION.UNINSTALLED; pub const IASSEMBLYCACHE_UNINSTALL_DISPOSITION_STILL_IN_USE = IASSEMBLYCACHE_UNINSTALL_DISPOSITION.STILL_IN_USE; pub const IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED = IASSEMBLYCACHE_UNINSTALL_DISPOSITION.ALREADY_UNINSTALLED; pub const IASSEMBLYCACHE_UNINSTALL_DISPOSITION_DELETE_PENDING = IASSEMBLYCACHE_UNINSTALL_DISPOSITION.DELETE_PENDING; pub const QUERYASMINFO_FLAGS = enum(u32) { E = 1, _, pub fn initFlags(o: struct { E: u1 = 0, }) QUERYASMINFO_FLAGS { return @intToEnum(QUERYASMINFO_FLAGS, (if (o.E == 1) @enumToInt(QUERYASMINFO_FLAGS.E) else 0) ); } }; pub const QUERYASMINFO_FLAG_VALIDATE = QUERYASMINFO_FLAGS.E; // TODO: this type has a FreeFunc 'MsiCloseHandle', what can Zig do with this information? pub const MSIHANDLE = u32; pub const ACTIVATION_CONTEXT_QUERY_INDEX = extern struct { ulAssemblyIndex: u32, ulFileIndexInAssembly: u32, }; pub const ASSEMBLY_FILE_DETAILED_INFORMATION = extern struct { ulFlags: u32, ulFilenameLength: u32, ulPathLength: u32, lpFileName: ?[*:0]const u16, lpFilePath: ?[*:0]const u16, }; pub const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION = extern struct { ulFlags: u32, ulEncodedAssemblyIdentityLength: u32, ulManifestPathType: u32, ulManifestPathLength: u32, liManifestLastWriteTime: LARGE_INTEGER, ulPolicyPathType: u32, ulPolicyPathLength: u32, liPolicyLastWriteTime: LARGE_INTEGER, ulMetadataSatelliteRosterIndex: u32, ulManifestVersionMajor: u32, ulManifestVersionMinor: u32, ulPolicyVersionMajor: u32, ulPolicyVersionMinor: u32, ulAssemblyDirectoryNameLength: u32, lpAssemblyEncodedAssemblyIdentity: ?[*:0]const u16, lpAssemblyManifestPath: ?[*:0]const u16, lpAssemblyPolicyPath: ?[*:0]const u16, lpAssemblyDirectoryName: ?[*:0]const u16, ulFileCount: u32, }; pub const ACTCTX_REQUESTED_RUN_LEVEL = enum(i32) { UNSPECIFIED = 0, AS_INVOKER = 1, HIGHEST_AVAILABLE = 2, REQUIRE_ADMIN = 3, NUMBERS = 4, }; pub const ACTCTX_RUN_LEVEL_UNSPECIFIED = ACTCTX_REQUESTED_RUN_LEVEL.UNSPECIFIED; pub const ACTCTX_RUN_LEVEL_AS_INVOKER = ACTCTX_REQUESTED_RUN_LEVEL.AS_INVOKER; pub const ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE = ACTCTX_REQUESTED_RUN_LEVEL.HIGHEST_AVAILABLE; pub const ACTCTX_RUN_LEVEL_REQUIRE_ADMIN = ACTCTX_REQUESTED_RUN_LEVEL.REQUIRE_ADMIN; pub const ACTCTX_RUN_LEVEL_NUMBERS = ACTCTX_REQUESTED_RUN_LEVEL.NUMBERS; pub const ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION = extern struct { ulFlags: u32, RunLevel: ACTCTX_REQUESTED_RUN_LEVEL, UiAccess: u32, }; pub const ACTCTX_COMPATIBILITY_ELEMENT_TYPE = enum(i32) { UNKNOWN = 0, OS = 1, MITIGATION = 2, MAXVERSIONTESTED = 3, }; pub const ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN = ACTCTX_COMPATIBILITY_ELEMENT_TYPE.UNKNOWN; pub const ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS = ACTCTX_COMPATIBILITY_ELEMENT_TYPE.OS; pub const ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION = ACTCTX_COMPATIBILITY_ELEMENT_TYPE.MITIGATION; pub const ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MAXVERSIONTESTED = ACTCTX_COMPATIBILITY_ELEMENT_TYPE.MAXVERSIONTESTED; pub const COMPATIBILITY_CONTEXT_ELEMENT = extern struct { Id: Guid, Type: ACTCTX_COMPATIBILITY_ELEMENT_TYPE, MaxVersionTested: u64, }; pub const ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION = extern struct { ElementCount: u32, Elements: [1]COMPATIBILITY_CONTEXT_ELEMENT, }; pub const ACTIVATION_CONTEXT_DETAILED_INFORMATION = extern struct { dwFlags: u32, ulFormatVersion: u32, ulAssemblyCount: u32, ulRootManifestPathType: u32, ulRootManifestPathChars: u32, ulRootConfigurationPathType: u32, ulRootConfigurationPathChars: u32, ulAppDirPathType: u32, ulAppDirPathChars: u32, lpRootManifestPath: ?[*:0]const u16, lpRootConfigurationPath: ?[*:0]const u16, lpAppDirPath: ?[*:0]const u16, }; pub const RESULTTYPES = enum(i32) { Unknown = 0, Error = 1, Warning = 2, Info = 3, }; pub const ieUnknown = RESULTTYPES.Unknown; pub const ieError = RESULTTYPES.Error; pub const ieWarning = RESULTTYPES.Warning; pub const ieInfo = RESULTTYPES.Info; pub const STATUSTYPES = enum(i32) { GetCUB = 0, ICECount = 1, Merge = 2, SummaryInfo = 3, CreateEngine = 4, Starting = 5, RunICE = 6, Shutdown = 7, Success = 8, Fail = 9, Cancel = 10, }; pub const ieStatusGetCUB = STATUSTYPES.GetCUB; pub const ieStatusICECount = STATUSTYPES.ICECount; pub const ieStatusMerge = STATUSTYPES.Merge; pub const ieStatusSummaryInfo = STATUSTYPES.SummaryInfo; pub const ieStatusCreateEngine = STATUSTYPES.CreateEngine; pub const ieStatusStarting = STATUSTYPES.Starting; pub const ieStatusRunICE = STATUSTYPES.RunICE; pub const ieStatusShutdown = STATUSTYPES.Shutdown; pub const ieStatusSuccess = STATUSTYPES.Success; pub const ieStatusFail = STATUSTYPES.Fail; pub const ieStatusCancel = STATUSTYPES.Cancel; pub const LPDISPLAYVAL = fn( pContext: ?*c_void, uiType: RESULTTYPES, szwVal: ?[*:0]const u16, szwDescription: ?[*:0]const u16, szwLocation: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPEVALCOMCALLBACK = fn( iStatus: STATUSTYPES, szData: ?[*:0]const u16, pContext: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) BOOL; const IID_IValidate_Value = @import("../zig.zig").Guid.initString("e482e5c6-e31e-4143-a2e6-dbc3d8e4b8d3"); pub const IID_IValidate = &IID_IValidate_Value; pub const IValidate = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OpenDatabase: fn( self: *const IValidate, szDatabase: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenCUB: fn( self: *const IValidate, szCUBFile: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseDatabase: fn( self: *const IValidate, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseCUB: fn( self: *const IValidate, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDisplay: fn( self: *const IValidate, pDisplayFunction: ?LPDISPLAYVAL, pContext: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetStatus: fn( self: *const IValidate, pStatusFunction: ?LPEVALCOMCALLBACK, pContext: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Validate: fn( self: *const IValidate, wzICEs: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IValidate_OpenDatabase(self: *const T, szDatabase: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IValidate.VTable, self.vtable).OpenDatabase(@ptrCast(*const IValidate, self), szDatabase); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IValidate_OpenCUB(self: *const T, szCUBFile: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IValidate.VTable, self.vtable).OpenCUB(@ptrCast(*const IValidate, self), szCUBFile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IValidate_CloseDatabase(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IValidate.VTable, self.vtable).CloseDatabase(@ptrCast(*const IValidate, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IValidate_CloseCUB(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IValidate.VTable, self.vtable).CloseCUB(@ptrCast(*const IValidate, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IValidate_SetDisplay(self: *const T, pDisplayFunction: ?LPDISPLAYVAL, pContext: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IValidate.VTable, self.vtable).SetDisplay(@ptrCast(*const IValidate, self), pDisplayFunction, pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IValidate_SetStatus(self: *const T, pStatusFunction: ?LPEVALCOMCALLBACK, pContext: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IValidate.VTable, self.vtable).SetStatus(@ptrCast(*const IValidate, self), pStatusFunction, pContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IValidate_Validate(self: *const T, wzICEs: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IValidate.VTable, self.vtable).Validate(@ptrCast(*const IValidate, self), wzICEs); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_MsmMerge_Value = @import("../zig.zig").Guid.initString("0adda830-2c26-11d2-ad65-00a0c9af11a6"); pub const CLSID_MsmMerge = &CLSID_MsmMerge_Value; pub const msmErrorType = enum(i32) { LanguageUnsupported = 1, LanguageFailed = 2, Exclusion = 3, TableMerge = 4, ResequenceMerge = 5, FileCreate = 6, DirCreate = 7, FeatureRequired = 8, }; pub const msmErrorLanguageUnsupported = msmErrorType.LanguageUnsupported; pub const msmErrorLanguageFailed = msmErrorType.LanguageFailed; pub const msmErrorExclusion = msmErrorType.Exclusion; pub const msmErrorTableMerge = msmErrorType.TableMerge; pub const msmErrorResequenceMerge = msmErrorType.ResequenceMerge; pub const msmErrorFileCreate = msmErrorType.FileCreate; pub const msmErrorDirCreate = msmErrorType.DirCreate; pub const msmErrorFeatureRequired = msmErrorType.FeatureRequired; const IID_IEnumMsmString_Value = @import("../zig.zig").Guid.initString("0adda826-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IEnumMsmString = &IID_IEnumMsmString_Value; pub const IEnumMsmString = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumMsmString, cFetch: u32, rgbstrStrings: ?*?BSTR, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumMsmString, cSkip: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumMsmString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumMsmString, pemsmStrings: ?*?*IEnumMsmString, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmString_Next(self: *const T, cFetch: u32, rgbstrStrings: ?*?BSTR, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmString.VTable, self.vtable).Next(@ptrCast(*const IEnumMsmString, self), cFetch, rgbstrStrings, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmString_Skip(self: *const T, cSkip: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmString.VTable, self.vtable).Skip(@ptrCast(*const IEnumMsmString, self), cSkip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmString_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmString.VTable, self.vtable).Reset(@ptrCast(*const IEnumMsmString, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmString_Clone(self: *const T, pemsmStrings: ?*?*IEnumMsmString) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmString.VTable, self.vtable).Clone(@ptrCast(*const IEnumMsmString, self), pemsmStrings); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMsmStrings_Value = @import("../zig.zig").Guid.initString("0adda827-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IMsmStrings = &IID_IMsmStrings_Value; pub const IMsmStrings = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IMsmStrings, Item: i32, Return: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IMsmStrings, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IMsmStrings, NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmStrings_get_Item(self: *const T, Item: i32, Return: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmStrings.VTable, self.vtable).get_Item(@ptrCast(*const IMsmStrings, self), Item, Return); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmStrings_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmStrings.VTable, self.vtable).get_Count(@ptrCast(*const IMsmStrings, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmStrings_get__NewEnum(self: *const T, NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmStrings.VTable, self.vtable).get__NewEnum(@ptrCast(*const IMsmStrings, self), NewEnum); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMsmError_Value = @import("../zig.zig").Guid.initString("0adda828-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IMsmError = &IID_IMsmError_Value; pub const IMsmError = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const IMsmError, ErrorType: ?*msmErrorType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Path: fn( self: *const IMsmError, ErrorPath: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Language: fn( self: *const IMsmError, ErrorLanguage: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DatabaseTable: fn( self: *const IMsmError, ErrorTable: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_DatabaseKeys: fn( self: *const IMsmError, ErrorKeys: ?*?*IMsmStrings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ModuleTable: fn( self: *const IMsmError, ErrorTable: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ModuleKeys: fn( self: *const IMsmError, ErrorKeys: ?*?*IMsmStrings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmError_get_Type(self: *const T, ErrorType: ?*msmErrorType) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmError.VTable, self.vtable).get_Type(@ptrCast(*const IMsmError, self), ErrorType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmError_get_Path(self: *const T, ErrorPath: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmError.VTable, self.vtable).get_Path(@ptrCast(*const IMsmError, self), ErrorPath); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmError_get_Language(self: *const T, ErrorLanguage: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmError.VTable, self.vtable).get_Language(@ptrCast(*const IMsmError, self), ErrorLanguage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmError_get_DatabaseTable(self: *const T, ErrorTable: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmError.VTable, self.vtable).get_DatabaseTable(@ptrCast(*const IMsmError, self), ErrorTable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmError_get_DatabaseKeys(self: *const T, ErrorKeys: ?*?*IMsmStrings) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmError.VTable, self.vtable).get_DatabaseKeys(@ptrCast(*const IMsmError, self), ErrorKeys); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmError_get_ModuleTable(self: *const T, ErrorTable: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmError.VTable, self.vtable).get_ModuleTable(@ptrCast(*const IMsmError, self), ErrorTable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmError_get_ModuleKeys(self: *const T, ErrorKeys: ?*?*IMsmStrings) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmError.VTable, self.vtable).get_ModuleKeys(@ptrCast(*const IMsmError, self), ErrorKeys); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEnumMsmError_Value = @import("../zig.zig").Guid.initString("0adda829-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IEnumMsmError = &IID_IEnumMsmError_Value; pub const IEnumMsmError = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumMsmError, cFetch: u32, rgmsmErrors: ?*?*IMsmError, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumMsmError, cSkip: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumMsmError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumMsmError, pemsmErrors: ?*?*IEnumMsmError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmError_Next(self: *const T, cFetch: u32, rgmsmErrors: ?*?*IMsmError, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmError.VTable, self.vtable).Next(@ptrCast(*const IEnumMsmError, self), cFetch, rgmsmErrors, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmError_Skip(self: *const T, cSkip: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmError.VTable, self.vtable).Skip(@ptrCast(*const IEnumMsmError, self), cSkip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmError_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmError.VTable, self.vtable).Reset(@ptrCast(*const IEnumMsmError, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmError_Clone(self: *const T, pemsmErrors: ?*?*IEnumMsmError) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmError.VTable, self.vtable).Clone(@ptrCast(*const IEnumMsmError, self), pemsmErrors); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMsmErrors_Value = @import("../zig.zig").Guid.initString("0adda82a-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IMsmErrors = &IID_IMsmErrors_Value; pub const IMsmErrors = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IMsmErrors, Item: i32, Return: ?*?*IMsmError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IMsmErrors, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IMsmErrors, NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmErrors_get_Item(self: *const T, Item: i32, Return: ?*?*IMsmError) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmErrors.VTable, self.vtable).get_Item(@ptrCast(*const IMsmErrors, self), Item, Return); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmErrors_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmErrors.VTable, self.vtable).get_Count(@ptrCast(*const IMsmErrors, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmErrors_get__NewEnum(self: *const T, NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmErrors.VTable, self.vtable).get__NewEnum(@ptrCast(*const IMsmErrors, self), NewEnum); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMsmDependency_Value = @import("../zig.zig").Guid.initString("0adda82b-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IMsmDependency = &IID_IMsmDependency_Value; pub const IMsmDependency = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Module: fn( self: *const IMsmDependency, Module: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Language: fn( self: *const IMsmDependency, Language: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Version: fn( self: *const IMsmDependency, Version: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmDependency_get_Module(self: *const T, Module: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmDependency.VTable, self.vtable).get_Module(@ptrCast(*const IMsmDependency, self), Module); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmDependency_get_Language(self: *const T, Language: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmDependency.VTable, self.vtable).get_Language(@ptrCast(*const IMsmDependency, self), Language); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmDependency_get_Version(self: *const T, Version: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmDependency.VTable, self.vtable).get_Version(@ptrCast(*const IMsmDependency, self), Version); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEnumMsmDependency_Value = @import("../zig.zig").Guid.initString("0adda82c-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IEnumMsmDependency = &IID_IEnumMsmDependency_Value; pub const IEnumMsmDependency = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumMsmDependency, cFetch: u32, rgmsmDependencies: ?*?*IMsmDependency, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumMsmDependency, cSkip: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumMsmDependency, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumMsmDependency, pemsmDependencies: ?*?*IEnumMsmDependency, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmDependency_Next(self: *const T, cFetch: u32, rgmsmDependencies: ?*?*IMsmDependency, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmDependency.VTable, self.vtable).Next(@ptrCast(*const IEnumMsmDependency, self), cFetch, rgmsmDependencies, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmDependency_Skip(self: *const T, cSkip: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmDependency.VTable, self.vtable).Skip(@ptrCast(*const IEnumMsmDependency, self), cSkip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmDependency_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmDependency.VTable, self.vtable).Reset(@ptrCast(*const IEnumMsmDependency, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumMsmDependency_Clone(self: *const T, pemsmDependencies: ?*?*IEnumMsmDependency) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumMsmDependency.VTable, self.vtable).Clone(@ptrCast(*const IEnumMsmDependency, self), pemsmDependencies); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMsmDependencies_Value = @import("../zig.zig").Guid.initString("0adda82d-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IMsmDependencies = &IID_IMsmDependencies_Value; pub const IMsmDependencies = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Item: fn( self: *const IMsmDependencies, Item: i32, Return: ?*?*IMsmDependency, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Count: fn( self: *const IMsmDependencies, Count: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get__NewEnum: fn( self: *const IMsmDependencies, NewEnum: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmDependencies_get_Item(self: *const T, Item: i32, Return: ?*?*IMsmDependency) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmDependencies.VTable, self.vtable).get_Item(@ptrCast(*const IMsmDependencies, self), Item, Return); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmDependencies_get_Count(self: *const T, Count: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmDependencies.VTable, self.vtable).get_Count(@ptrCast(*const IMsmDependencies, self), Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmDependencies_get__NewEnum(self: *const T, NewEnum: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmDependencies.VTable, self.vtable).get__NewEnum(@ptrCast(*const IMsmDependencies, self), NewEnum); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMsmMerge_Value = @import("../zig.zig").Guid.initString("0adda82e-2c26-11d2-ad65-00a0c9af11a6"); pub const IID_IMsmMerge = &IID_IMsmMerge_Value; pub const IMsmMerge = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, OpenDatabase: fn( self: *const IMsmMerge, Path: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenModule: fn( self: *const IMsmMerge, Path: ?BSTR, Language: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseDatabase: fn( self: *const IMsmMerge, Commit: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseModule: fn( self: *const IMsmMerge, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenLog: fn( self: *const IMsmMerge, Path: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseLog: fn( self: *const IMsmMerge, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Log: fn( self: *const IMsmMerge, Message: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Errors: fn( self: *const IMsmMerge, Errors: ?*?*IMsmErrors, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Dependencies: fn( self: *const IMsmMerge, Dependencies: ?*?*IMsmDependencies, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Merge: fn( self: *const IMsmMerge, Feature: ?BSTR, RedirectDir: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Connect: fn( self: *const IMsmMerge, Feature: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ExtractCAB: fn( self: *const IMsmMerge, FileName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ExtractFiles: fn( self: *const IMsmMerge, Path: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_OpenDatabase(self: *const T, Path: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).OpenDatabase(@ptrCast(*const IMsmMerge, self), Path); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_OpenModule(self: *const T, Path: ?BSTR, Language: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).OpenModule(@ptrCast(*const IMsmMerge, self), Path, Language); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_CloseDatabase(self: *const T, Commit: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).CloseDatabase(@ptrCast(*const IMsmMerge, self), Commit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_CloseModule(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).CloseModule(@ptrCast(*const IMsmMerge, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_OpenLog(self: *const T, Path: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).OpenLog(@ptrCast(*const IMsmMerge, self), Path); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_CloseLog(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).CloseLog(@ptrCast(*const IMsmMerge, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_Log(self: *const T, Message: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).Log(@ptrCast(*const IMsmMerge, self), Message); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_get_Errors(self: *const T, Errors: ?*?*IMsmErrors) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).get_Errors(@ptrCast(*const IMsmMerge, self), Errors); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_get_Dependencies(self: *const T, Dependencies: ?*?*IMsmDependencies) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).get_Dependencies(@ptrCast(*const IMsmMerge, self), Dependencies); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_Merge(self: *const T, Feature: ?BSTR, RedirectDir: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).Merge(@ptrCast(*const IMsmMerge, self), Feature, RedirectDir); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_Connect(self: *const T, Feature: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).Connect(@ptrCast(*const IMsmMerge, self), Feature); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_ExtractCAB(self: *const T, FileName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).ExtractCAB(@ptrCast(*const IMsmMerge, self), FileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmMerge_ExtractFiles(self: *const T, Path: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmMerge.VTable, self.vtable).ExtractFiles(@ptrCast(*const IMsmMerge, self), Path); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMsmGetFiles_Value = @import("../zig.zig").Guid.initString("7041ae26-2d78-11d2-888a-00a0c981b015"); pub const IID_IMsmGetFiles = &IID_IMsmGetFiles_Value; pub const IMsmGetFiles = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_ModuleFiles: fn( self: *const IMsmGetFiles, Files: ?*?*IMsmStrings, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMsmGetFiles_get_ModuleFiles(self: *const T, Files: ?*?*IMsmStrings) callconv(.Inline) HRESULT { return @ptrCast(*const IMsmGetFiles.VTable, self.vtable).get_ModuleFiles(@ptrCast(*const IMsmGetFiles, self), Files); } };} pub usingnamespace MethodMixin(@This()); }; pub const PMSIHANDLE = extern struct { m_h: MSIHANDLE, }; pub const INSTALLMESSAGE = enum(i32) { FATALEXIT = 0, ERROR = 16777216, WARNING = 33554432, USER = 50331648, INFO = 67108864, FILESINUSE = 83886080, RESOLVESOURCE = 100663296, OUTOFDISKSPACE = 117440512, ACTIONSTART = 134217728, ACTIONDATA = 150994944, PROGRESS = 167772160, COMMONDATA = 184549376, INITIALIZE = 201326592, TERMINATE = 218103808, SHOWDIALOG = 234881024, PERFORMANCE = 251658240, RMFILESINUSE = 419430400, INSTALLSTART = 436207616, INSTALLEND = 452984832, }; pub const INSTALLMESSAGE_FATALEXIT = INSTALLMESSAGE.FATALEXIT; pub const INSTALLMESSAGE_ERROR = INSTALLMESSAGE.ERROR; pub const INSTALLMESSAGE_WARNING = INSTALLMESSAGE.WARNING; pub const INSTALLMESSAGE_USER = INSTALLMESSAGE.USER; pub const INSTALLMESSAGE_INFO = INSTALLMESSAGE.INFO; pub const INSTALLMESSAGE_FILESINUSE = INSTALLMESSAGE.FILESINUSE; pub const INSTALLMESSAGE_RESOLVESOURCE = INSTALLMESSAGE.RESOLVESOURCE; pub const INSTALLMESSAGE_OUTOFDISKSPACE = INSTALLMESSAGE.OUTOFDISKSPACE; pub const INSTALLMESSAGE_ACTIONSTART = INSTALLMESSAGE.ACTIONSTART; pub const INSTALLMESSAGE_ACTIONDATA = INSTALLMESSAGE.ACTIONDATA; pub const INSTALLMESSAGE_PROGRESS = INSTALLMESSAGE.PROGRESS; pub const INSTALLMESSAGE_COMMONDATA = INSTALLMESSAGE.COMMONDATA; pub const INSTALLMESSAGE_INITIALIZE = INSTALLMESSAGE.INITIALIZE; pub const INSTALLMESSAGE_TERMINATE = INSTALLMESSAGE.TERMINATE; pub const INSTALLMESSAGE_SHOWDIALOG = INSTALLMESSAGE.SHOWDIALOG; pub const INSTALLMESSAGE_PERFORMANCE = INSTALLMESSAGE.PERFORMANCE; pub const INSTALLMESSAGE_RMFILESINUSE = INSTALLMESSAGE.RMFILESINUSE; pub const INSTALLMESSAGE_INSTALLSTART = INSTALLMESSAGE.INSTALLSTART; pub const INSTALLMESSAGE_INSTALLEND = INSTALLMESSAGE.INSTALLEND; pub const INSTALLUI_HANDLERA = fn( pvContext: ?*c_void, iMessageType: u32, szMessage: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) i32; pub const INSTALLUI_HANDLERW = fn( pvContext: ?*c_void, iMessageType: u32, szMessage: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub const PINSTALLUI_HANDLER_RECORD = fn( pvContext: ?*c_void, iMessageType: u32, hRecord: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; pub const INSTALLUILEVEL = enum(i32) { NOCHANGE = 0, DEFAULT = 1, NONE = 2, BASIC = 3, REDUCED = 4, FULL = 5, ENDDIALOG = 128, PROGRESSONLY = 64, HIDECANCEL = 32, SOURCERESONLY = 256, UACONLY = 512, }; pub const INSTALLUILEVEL_NOCHANGE = INSTALLUILEVEL.NOCHANGE; pub const INSTALLUILEVEL_DEFAULT = INSTALLUILEVEL.DEFAULT; pub const INSTALLUILEVEL_NONE = INSTALLUILEVEL.NONE; pub const INSTALLUILEVEL_BASIC = INSTALLUILEVEL.BASIC; pub const INSTALLUILEVEL_REDUCED = INSTALLUILEVEL.REDUCED; pub const INSTALLUILEVEL_FULL = INSTALLUILEVEL.FULL; pub const INSTALLUILEVEL_ENDDIALOG = INSTALLUILEVEL.ENDDIALOG; pub const INSTALLUILEVEL_PROGRESSONLY = INSTALLUILEVEL.PROGRESSONLY; pub const INSTALLUILEVEL_HIDECANCEL = INSTALLUILEVEL.HIDECANCEL; pub const INSTALLUILEVEL_SOURCERESONLY = INSTALLUILEVEL.SOURCERESONLY; pub const INSTALLUILEVEL_UACONLY = INSTALLUILEVEL.UACONLY; pub const INSTALLSTATE = enum(i32) { NOTUSED = -7, BADCONFIG = -6, INCOMPLETE = -5, SOURCEABSENT = -4, MOREDATA = -3, INVALIDARG = -2, UNKNOWN = -1, BROKEN = 0, ADVERTISED = 1, // REMOVED = 1, this enum value conflicts with ADVERTISED ABSENT = 2, LOCAL = 3, SOURCE = 4, DEFAULT = 5, }; pub const INSTALLSTATE_NOTUSED = INSTALLSTATE.NOTUSED; pub const INSTALLSTATE_BADCONFIG = INSTALLSTATE.BADCONFIG; pub const INSTALLSTATE_INCOMPLETE = INSTALLSTATE.INCOMPLETE; pub const INSTALLSTATE_SOURCEABSENT = INSTALLSTATE.SOURCEABSENT; pub const INSTALLSTATE_MOREDATA = INSTALLSTATE.MOREDATA; pub const INSTALLSTATE_INVALIDARG = INSTALLSTATE.INVALIDARG; pub const INSTALLSTATE_UNKNOWN = INSTALLSTATE.UNKNOWN; pub const INSTALLSTATE_BROKEN = INSTALLSTATE.BROKEN; pub const INSTALLSTATE_ADVERTISED = INSTALLSTATE.ADVERTISED; pub const INSTALLSTATE_REMOVED = INSTALLSTATE.ADVERTISED; pub const INSTALLSTATE_ABSENT = INSTALLSTATE.ABSENT; pub const INSTALLSTATE_LOCAL = INSTALLSTATE.LOCAL; pub const INSTALLSTATE_SOURCE = INSTALLSTATE.SOURCE; pub const INSTALLSTATE_DEFAULT = INSTALLSTATE.DEFAULT; pub const USERINFOSTATE = enum(i32) { MOREDATA = -3, INVALIDARG = -2, UNKNOWN = -1, ABSENT = 0, PRESENT = 1, }; pub const USERINFOSTATE_MOREDATA = USERINFOSTATE.MOREDATA; pub const USERINFOSTATE_INVALIDARG = USERINFOSTATE.INVALIDARG; pub const USERINFOSTATE_UNKNOWN = USERINFOSTATE.UNKNOWN; pub const USERINFOSTATE_ABSENT = USERINFOSTATE.ABSENT; pub const USERINFOSTATE_PRESENT = USERINFOSTATE.PRESENT; pub const INSTALLLEVEL = enum(i32) { DEFAULT = 0, MINIMUM = 1, MAXIMUM = 65535, }; pub const INSTALLLEVEL_DEFAULT = INSTALLLEVEL.DEFAULT; pub const INSTALLLEVEL_MINIMUM = INSTALLLEVEL.MINIMUM; pub const INSTALLLEVEL_MAXIMUM = INSTALLLEVEL.MAXIMUM; pub const REINSTALLMODE = enum(i32) { REPAIR = 1, FILEMISSING = 2, FILEOLDERVERSION = 4, FILEEQUALVERSION = 8, FILEEXACT = 16, FILEVERIFY = 32, FILEREPLACE = 64, MACHINEDATA = 128, USERDATA = 256, SHORTCUT = 512, PACKAGE = 1024, }; pub const REINSTALLMODE_REPAIR = REINSTALLMODE.REPAIR; pub const REINSTALLMODE_FILEMISSING = REINSTALLMODE.FILEMISSING; pub const REINSTALLMODE_FILEOLDERVERSION = REINSTALLMODE.FILEOLDERVERSION; pub const REINSTALLMODE_FILEEQUALVERSION = REINSTALLMODE.FILEEQUALVERSION; pub const REINSTALLMODE_FILEEXACT = REINSTALLMODE.FILEEXACT; pub const REINSTALLMODE_FILEVERIFY = REINSTALLMODE.FILEVERIFY; pub const REINSTALLMODE_FILEREPLACE = REINSTALLMODE.FILEREPLACE; pub const REINSTALLMODE_MACHINEDATA = REINSTALLMODE.MACHINEDATA; pub const REINSTALLMODE_USERDATA = REINSTALLMODE.USERDATA; pub const REINSTALLMODE_SHORTCUT = REINSTALLMODE.SHORTCUT; pub const REINSTALLMODE_PACKAGE = REINSTALLMODE.PACKAGE; pub const INSTALLOGMODE = enum(i32) { FATALEXIT = 1, ERROR = 2, WARNING = 4, USER = 8, INFO = 16, RESOLVESOURCE = 64, OUTOFDISKSPACE = 128, ACTIONSTART = 256, ACTIONDATA = 512, COMMONDATA = 2048, PROPERTYDUMP = 1024, VERBOSE = 4096, EXTRADEBUG = 8192, LOGONLYONERROR = 16384, LOGPERFORMANCE = 32768, // PROGRESS = 1024, this enum value conflicts with PROPERTYDUMP // INITIALIZE = 4096, this enum value conflicts with VERBOSE // TERMINATE = 8192, this enum value conflicts with EXTRADEBUG // SHOWDIALOG = 16384, this enum value conflicts with LOGONLYONERROR FILESINUSE = 32, RMFILESINUSE = 33554432, INSTALLSTART = 67108864, INSTALLEND = 134217728, }; pub const INSTALLLOGMODE_FATALEXIT = INSTALLOGMODE.FATALEXIT; pub const INSTALLLOGMODE_ERROR = INSTALLOGMODE.ERROR; pub const INSTALLLOGMODE_WARNING = INSTALLOGMODE.WARNING; pub const INSTALLLOGMODE_USER = INSTALLOGMODE.USER; pub const INSTALLLOGMODE_INFO = INSTALLOGMODE.INFO; pub const INSTALLLOGMODE_RESOLVESOURCE = INSTALLOGMODE.RESOLVESOURCE; pub const INSTALLLOGMODE_OUTOFDISKSPACE = INSTALLOGMODE.OUTOFDISKSPACE; pub const INSTALLLOGMODE_ACTIONSTART = INSTALLOGMODE.ACTIONSTART; pub const INSTALLLOGMODE_ACTIONDATA = INSTALLOGMODE.ACTIONDATA; pub const INSTALLLOGMODE_COMMONDATA = INSTALLOGMODE.COMMONDATA; pub const INSTALLLOGMODE_PROPERTYDUMP = INSTALLOGMODE.PROPERTYDUMP; pub const INSTALLLOGMODE_VERBOSE = INSTALLOGMODE.VERBOSE; pub const INSTALLLOGMODE_EXTRADEBUG = INSTALLOGMODE.EXTRADEBUG; pub const INSTALLLOGMODE_LOGONLYONERROR = INSTALLOGMODE.LOGONLYONERROR; pub const INSTALLLOGMODE_LOGPERFORMANCE = INSTALLOGMODE.LOGPERFORMANCE; pub const INSTALLLOGMODE_PROGRESS = INSTALLOGMODE.PROPERTYDUMP; pub const INSTALLLOGMODE_INITIALIZE = INSTALLOGMODE.VERBOSE; pub const INSTALLLOGMODE_TERMINATE = INSTALLOGMODE.EXTRADEBUG; pub const INSTALLLOGMODE_SHOWDIALOG = INSTALLOGMODE.LOGONLYONERROR; pub const INSTALLLOGMODE_FILESINUSE = INSTALLOGMODE.FILESINUSE; pub const INSTALLLOGMODE_RMFILESINUSE = INSTALLOGMODE.RMFILESINUSE; pub const INSTALLLOGMODE_INSTALLSTART = INSTALLOGMODE.INSTALLSTART; pub const INSTALLLOGMODE_INSTALLEND = INSTALLOGMODE.INSTALLEND; pub const INSTALLLOGATTRIBUTES = enum(i32) { APPEND = 1, FLUSHEACHLINE = 2, }; pub const INSTALLLOGATTRIBUTES_APPEND = INSTALLLOGATTRIBUTES.APPEND; pub const INSTALLLOGATTRIBUTES_FLUSHEACHLINE = INSTALLLOGATTRIBUTES.FLUSHEACHLINE; pub const INSTALLFEATUREATTRIBUTE = enum(i32) { FAVORLOCAL = 1, FAVORSOURCE = 2, FOLLOWPARENT = 4, FAVORADVERTISE = 8, DISALLOWADVERTISE = 16, NOUNSUPPORTEDADVERTISE = 32, }; pub const INSTALLFEATUREATTRIBUTE_FAVORLOCAL = INSTALLFEATUREATTRIBUTE.FAVORLOCAL; pub const INSTALLFEATUREATTRIBUTE_FAVORSOURCE = INSTALLFEATUREATTRIBUTE.FAVORSOURCE; pub const INSTALLFEATUREATTRIBUTE_FOLLOWPARENT = INSTALLFEATUREATTRIBUTE.FOLLOWPARENT; pub const INSTALLFEATUREATTRIBUTE_FAVORADVERTISE = INSTALLFEATUREATTRIBUTE.FAVORADVERTISE; pub const INSTALLFEATUREATTRIBUTE_DISALLOWADVERTISE = INSTALLFEATUREATTRIBUTE.DISALLOWADVERTISE; pub const INSTALLFEATUREATTRIBUTE_NOUNSUPPORTEDADVERTISE = INSTALLFEATUREATTRIBUTE.NOUNSUPPORTEDADVERTISE; pub const INSTALLMODE = enum(i32) { NODETECTION_ANY = -4, NOSOURCERESOLUTION = -3, NODETECTION = -2, EXISTING = -1, DEFAULT = 0, }; pub const INSTALLMODE_NODETECTION_ANY = INSTALLMODE.NODETECTION_ANY; pub const INSTALLMODE_NOSOURCERESOLUTION = INSTALLMODE.NOSOURCERESOLUTION; pub const INSTALLMODE_NODETECTION = INSTALLMODE.NODETECTION; pub const INSTALLMODE_EXISTING = INSTALLMODE.EXISTING; pub const INSTALLMODE_DEFAULT = INSTALLMODE.DEFAULT; pub const MSIPATCHSTATE = enum(i32) { INVALID = 0, APPLIED = 1, SUPERSEDED = 2, OBSOLETED = 4, REGISTERED = 8, ALL = 15, }; pub const MSIPATCHSTATE_INVALID = MSIPATCHSTATE.INVALID; pub const MSIPATCHSTATE_APPLIED = MSIPATCHSTATE.APPLIED; pub const MSIPATCHSTATE_SUPERSEDED = MSIPATCHSTATE.SUPERSEDED; pub const MSIPATCHSTATE_OBSOLETED = MSIPATCHSTATE.OBSOLETED; pub const MSIPATCHSTATE_REGISTERED = MSIPATCHSTATE.REGISTERED; pub const MSIPATCHSTATE_ALL = MSIPATCHSTATE.ALL; pub const MSIINSTALLCONTEXT = enum(i32) { FIRSTVISIBLE = 0, // NONE = 0, this enum value conflicts with FIRSTVISIBLE USERMANAGED = 1, USERUNMANAGED = 2, MACHINE = 4, ALL = 7, ALLUSERMANAGED = 8, }; pub const MSIINSTALLCONTEXT_FIRSTVISIBLE = MSIINSTALLCONTEXT.FIRSTVISIBLE; pub const MSIINSTALLCONTEXT_NONE = MSIINSTALLCONTEXT.FIRSTVISIBLE; pub const MSIINSTALLCONTEXT_USERMANAGED = MSIINSTALLCONTEXT.USERMANAGED; pub const MSIINSTALLCONTEXT_USERUNMANAGED = MSIINSTALLCONTEXT.USERUNMANAGED; pub const MSIINSTALLCONTEXT_MACHINE = MSIINSTALLCONTEXT.MACHINE; pub const MSIINSTALLCONTEXT_ALL = MSIINSTALLCONTEXT.ALL; pub const MSIINSTALLCONTEXT_ALLUSERMANAGED = MSIINSTALLCONTEXT.ALLUSERMANAGED; pub const MSIPATCHDATATYPE = enum(i32) { PATCHFILE = 0, XMLPATH = 1, XMLBLOB = 2, }; pub const MSIPATCH_DATATYPE_PATCHFILE = MSIPATCHDATATYPE.PATCHFILE; pub const MSIPATCH_DATATYPE_XMLPATH = MSIPATCHDATATYPE.XMLPATH; pub const MSIPATCH_DATATYPE_XMLBLOB = MSIPATCHDATATYPE.XMLBLOB; pub const MSIPATCHSEQUENCEINFOA = extern struct { szPatchData: ?[*:0]const u8, ePatchDataType: MSIPATCHDATATYPE, dwOrder: u32, uStatus: u32, }; pub const MSIPATCHSEQUENCEINFOW = extern struct { szPatchData: ?[*:0]const u16, ePatchDataType: MSIPATCHDATATYPE, dwOrder: u32, uStatus: u32, }; pub const SCRIPTFLAGS = enum(i32) { CACHEINFO = 1, SHORTCUTS = 4, MACHINEASSIGN = 8, REGDATA_CNFGINFO = 32, VALIDATE_TRANSFORMS_LIST = 64, REGDATA_CLASSINFO = 128, REGDATA_EXTENSIONINFO = 256, REGDATA_APPINFO = 384, REGDATA = 416, }; pub const SCRIPTFLAGS_CACHEINFO = SCRIPTFLAGS.CACHEINFO; pub const SCRIPTFLAGS_SHORTCUTS = SCRIPTFLAGS.SHORTCUTS; pub const SCRIPTFLAGS_MACHINEASSIGN = SCRIPTFLAGS.MACHINEASSIGN; pub const SCRIPTFLAGS_REGDATA_CNFGINFO = SCRIPTFLAGS.REGDATA_CNFGINFO; pub const SCRIPTFLAGS_VALIDATE_TRANSFORMS_LIST = SCRIPTFLAGS.VALIDATE_TRANSFORMS_LIST; pub const SCRIPTFLAGS_REGDATA_CLASSINFO = SCRIPTFLAGS.REGDATA_CLASSINFO; pub const SCRIPTFLAGS_REGDATA_EXTENSIONINFO = SCRIPTFLAGS.REGDATA_EXTENSIONINFO; pub const SCRIPTFLAGS_REGDATA_APPINFO = SCRIPTFLAGS.REGDATA_APPINFO; pub const SCRIPTFLAGS_REGDATA = SCRIPTFLAGS.REGDATA; pub const ADVERTISEFLAGS = enum(i32) { MACHINEASSIGN = 0, USERASSIGN = 1, }; pub const ADVERTISEFLAGS_MACHINEASSIGN = ADVERTISEFLAGS.MACHINEASSIGN; pub const ADVERTISEFLAGS_USERASSIGN = ADVERTISEFLAGS.USERASSIGN; pub const INSTALLTYPE = enum(i32) { DEFAULT = 0, NETWORK_IMAGE = 1, SINGLE_INSTANCE = 2, }; pub const INSTALLTYPE_DEFAULT = INSTALLTYPE.DEFAULT; pub const INSTALLTYPE_NETWORK_IMAGE = INSTALLTYPE.NETWORK_IMAGE; pub const INSTALLTYPE_SINGLE_INSTANCE = INSTALLTYPE.SINGLE_INSTANCE; pub const MSIFILEHASHINFO = extern struct { dwFileHashInfoSize: u32, dwData: [4]u32, }; pub const MSIARCHITECTUREFLAGS = enum(i32) { X86 = 1, IA64 = 2, AMD64 = 4, ARM = 8, }; pub const MSIARCHITECTUREFLAGS_X86 = MSIARCHITECTUREFLAGS.X86; pub const MSIARCHITECTUREFLAGS_IA64 = MSIARCHITECTUREFLAGS.IA64; pub const MSIARCHITECTUREFLAGS_AMD64 = MSIARCHITECTUREFLAGS.AMD64; pub const MSIARCHITECTUREFLAGS_ARM = MSIARCHITECTUREFLAGS.ARM; pub const MSIOPENPACKAGEFLAGS = enum(i32) { E = 1, }; pub const MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE = MSIOPENPACKAGEFLAGS.E; pub const MSIADVERTISEOPTIONFLAGS = enum(i32) { E = 1, }; pub const MSIADVERTISEOPTIONFLAGS_INSTANCE = MSIADVERTISEOPTIONFLAGS.E; pub const MSISOURCETYPE = enum(i32) { UNKNOWN = 0, NETWORK = 1, URL = 2, MEDIA = 4, }; pub const MSISOURCETYPE_UNKNOWN = MSISOURCETYPE.UNKNOWN; pub const MSISOURCETYPE_NETWORK = MSISOURCETYPE.NETWORK; pub const MSISOURCETYPE_URL = MSISOURCETYPE.URL; pub const MSISOURCETYPE_MEDIA = MSISOURCETYPE.MEDIA; pub const MSICODE = enum(i32) { RODUCT = 0, ATCH = 1073741824, }; pub const MSICODE_PRODUCT = MSICODE.RODUCT; pub const MSICODE_PATCH = MSICODE.ATCH; pub const MSITRANSACTION = enum(i32) { CHAIN_EMBEDDEDUI = 1, JOIN_EXISTING_EMBEDDEDUI = 2, }; pub const MSITRANSACTION_CHAIN_EMBEDDEDUI = MSITRANSACTION.CHAIN_EMBEDDEDUI; pub const MSITRANSACTION_JOIN_EXISTING_EMBEDDEDUI = MSITRANSACTION.JOIN_EXISTING_EMBEDDEDUI; pub const MSITRANSACTIONSTATE = enum(u32) { ROLLBACK = 0, COMMIT = 1, }; pub const MSITRANSACTIONSTATE_ROLLBACK = MSITRANSACTIONSTATE.ROLLBACK; pub const MSITRANSACTIONSTATE_COMMIT = MSITRANSACTIONSTATE.COMMIT; pub const MSIDBSTATE = enum(i32) { ERROR = -1, READ = 0, WRITE = 1, }; pub const MSIDBSTATE_ERROR = MSIDBSTATE.ERROR; pub const MSIDBSTATE_READ = MSIDBSTATE.READ; pub const MSIDBSTATE_WRITE = MSIDBSTATE.WRITE; pub const MSIMODIFY = enum(i32) { SEEK = -1, REFRESH = 0, INSERT = 1, UPDATE = 2, ASSIGN = 3, REPLACE = 4, MERGE = 5, DELETE = 6, INSERT_TEMPORARY = 7, VALIDATE = 8, VALIDATE_NEW = 9, VALIDATE_FIELD = 10, VALIDATE_DELETE = 11, }; pub const MSIMODIFY_SEEK = MSIMODIFY.SEEK; pub const MSIMODIFY_REFRESH = MSIMODIFY.REFRESH; pub const MSIMODIFY_INSERT = MSIMODIFY.INSERT; pub const MSIMODIFY_UPDATE = MSIMODIFY.UPDATE; pub const MSIMODIFY_ASSIGN = MSIMODIFY.ASSIGN; pub const MSIMODIFY_REPLACE = MSIMODIFY.REPLACE; pub const MSIMODIFY_MERGE = MSIMODIFY.MERGE; pub const MSIMODIFY_DELETE = MSIMODIFY.DELETE; pub const MSIMODIFY_INSERT_TEMPORARY = MSIMODIFY.INSERT_TEMPORARY; pub const MSIMODIFY_VALIDATE = MSIMODIFY.VALIDATE; pub const MSIMODIFY_VALIDATE_NEW = MSIMODIFY.VALIDATE_NEW; pub const MSIMODIFY_VALIDATE_FIELD = MSIMODIFY.VALIDATE_FIELD; pub const MSIMODIFY_VALIDATE_DELETE = MSIMODIFY.VALIDATE_DELETE; pub const MSICOLINFO = enum(i32) { NAMES = 0, TYPES = 1, }; pub const MSICOLINFO_NAMES = MSICOLINFO.NAMES; pub const MSICOLINFO_TYPES = MSICOLINFO.TYPES; pub const MSICONDITION = enum(i32) { FALSE = 0, TRUE = 1, NONE = 2, ERROR = 3, }; pub const MSICONDITION_FALSE = MSICONDITION.FALSE; pub const MSICONDITION_TRUE = MSICONDITION.TRUE; pub const MSICONDITION_NONE = MSICONDITION.NONE; pub const MSICONDITION_ERROR = MSICONDITION.ERROR; pub const MSICOSTTREE = enum(i32) { SELFONLY = 0, CHILDREN = 1, PARENTS = 2, RESERVED = 3, }; pub const MSICOSTTREE_SELFONLY = MSICOSTTREE.SELFONLY; pub const MSICOSTTREE_CHILDREN = MSICOSTTREE.CHILDREN; pub const MSICOSTTREE_PARENTS = MSICOSTTREE.PARENTS; pub const MSICOSTTREE_RESERVED = MSICOSTTREE.RESERVED; pub const MSIDBERROR = enum(i32) { INVALIDARG = -3, MOREDATA = -2, FUNCTIONERROR = -1, NOERROR = 0, DUPLICATEKEY = 1, REQUIRED = 2, BADLINK = 3, OVERFLOW = 4, UNDERFLOW = 5, NOTINSET = 6, BADVERSION = 7, BADCASE = 8, BADGUID = 9, BADWILDCARD = 10, BADIDENTIFIER = 11, BADLANGUAGE = 12, BADFILENAME = 13, BADPATH = 14, BADCONDITION = 15, BADFORMATTED = 16, BADTEMPLATE = 17, BADDEFAULTDIR = 18, BADREGPATH = 19, BADCUSTOMSOURCE = 20, BADPROPERTY = 21, MISSINGDATA = 22, BADCATEGORY = 23, BADKEYTABLE = 24, BADMAXMINVALUES = 25, BADCABINET = 26, BADSHORTCUT = 27, STRINGOVERFLOW = 28, BADLOCALIZEATTRIB = 29, }; pub const MSIDBERROR_INVALIDARG = MSIDBERROR.INVALIDARG; pub const MSIDBERROR_MOREDATA = MSIDBERROR.MOREDATA; pub const MSIDBERROR_FUNCTIONERROR = MSIDBERROR.FUNCTIONERROR; pub const MSIDBERROR_NOERROR = MSIDBERROR.NOERROR; pub const MSIDBERROR_DUPLICATEKEY = MSIDBERROR.DUPLICATEKEY; pub const MSIDBERROR_REQUIRED = MSIDBERROR.REQUIRED; pub const MSIDBERROR_BADLINK = MSIDBERROR.BADLINK; pub const MSIDBERROR_OVERFLOW = MSIDBERROR.OVERFLOW; pub const MSIDBERROR_UNDERFLOW = MSIDBERROR.UNDERFLOW; pub const MSIDBERROR_NOTINSET = MSIDBERROR.NOTINSET; pub const MSIDBERROR_BADVERSION = MSIDBERROR.BADVERSION; pub const MSIDBERROR_BADCASE = MSIDBERROR.BADCASE; pub const MSIDBERROR_BADGUID = MSIDBERROR.BADGUID; pub const MSIDBERROR_BADWILDCARD = MSIDBERROR.BADWILDCARD; pub const MSIDBERROR_BADIDENTIFIER = MSIDBERROR.BADIDENTIFIER; pub const MSIDBERROR_BADLANGUAGE = MSIDBERROR.BADLANGUAGE; pub const MSIDBERROR_BADFILENAME = MSIDBERROR.BADFILENAME; pub const MSIDBERROR_BADPATH = MSIDBERROR.BADPATH; pub const MSIDBERROR_BADCONDITION = MSIDBERROR.BADCONDITION; pub const MSIDBERROR_BADFORMATTED = MSIDBERROR.BADFORMATTED; pub const MSIDBERROR_BADTEMPLATE = MSIDBERROR.BADTEMPLATE; pub const MSIDBERROR_BADDEFAULTDIR = MSIDBERROR.BADDEFAULTDIR; pub const MSIDBERROR_BADREGPATH = MSIDBERROR.BADREGPATH; pub const MSIDBERROR_BADCUSTOMSOURCE = MSIDBERROR.BADCUSTOMSOURCE; pub const MSIDBERROR_BADPROPERTY = MSIDBERROR.BADPROPERTY; pub const MSIDBERROR_MISSINGDATA = MSIDBERROR.MISSINGDATA; pub const MSIDBERROR_BADCATEGORY = MSIDBERROR.BADCATEGORY; pub const MSIDBERROR_BADKEYTABLE = MSIDBERROR.BADKEYTABLE; pub const MSIDBERROR_BADMAXMINVALUES = MSIDBERROR.BADMAXMINVALUES; pub const MSIDBERROR_BADCABINET = MSIDBERROR.BADCABINET; pub const MSIDBERROR_BADSHORTCUT = MSIDBERROR.BADSHORTCUT; pub const MSIDBERROR_STRINGOVERFLOW = MSIDBERROR.STRINGOVERFLOW; pub const MSIDBERROR_BADLOCALIZEATTRIB = MSIDBERROR.BADLOCALIZEATTRIB; pub const MSIRUNMODE = enum(i32) { ADMIN = 0, ADVERTISE = 1, MAINTENANCE = 2, ROLLBACKENABLED = 3, LOGENABLED = 4, OPERATIONS = 5, REBOOTATEND = 6, REBOOTNOW = 7, CABINET = 8, SOURCESHORTNAMES = 9, TARGETSHORTNAMES = 10, RESERVED11 = 11, WINDOWS9X = 12, ZAWENABLED = 13, RESERVED14 = 14, RESERVED15 = 15, SCHEDULED = 16, ROLLBACK = 17, COMMIT = 18, }; pub const MSIRUNMODE_ADMIN = MSIRUNMODE.ADMIN; pub const MSIRUNMODE_ADVERTISE = MSIRUNMODE.ADVERTISE; pub const MSIRUNMODE_MAINTENANCE = MSIRUNMODE.MAINTENANCE; pub const MSIRUNMODE_ROLLBACKENABLED = MSIRUNMODE.ROLLBACKENABLED; pub const MSIRUNMODE_LOGENABLED = MSIRUNMODE.LOGENABLED; pub const MSIRUNMODE_OPERATIONS = MSIRUNMODE.OPERATIONS; pub const MSIRUNMODE_REBOOTATEND = MSIRUNMODE.REBOOTATEND; pub const MSIRUNMODE_REBOOTNOW = MSIRUNMODE.REBOOTNOW; pub const MSIRUNMODE_CABINET = MSIRUNMODE.CABINET; pub const MSIRUNMODE_SOURCESHORTNAMES = MSIRUNMODE.SOURCESHORTNAMES; pub const MSIRUNMODE_TARGETSHORTNAMES = MSIRUNMODE.TARGETSHORTNAMES; pub const MSIRUNMODE_RESERVED11 = MSIRUNMODE.RESERVED11; pub const MSIRUNMODE_WINDOWS9X = MSIRUNMODE.WINDOWS9X; pub const MSIRUNMODE_ZAWENABLED = MSIRUNMODE.ZAWENABLED; pub const MSIRUNMODE_RESERVED14 = MSIRUNMODE.RESERVED14; pub const MSIRUNMODE_RESERVED15 = MSIRUNMODE.RESERVED15; pub const MSIRUNMODE_SCHEDULED = MSIRUNMODE.SCHEDULED; pub const MSIRUNMODE_ROLLBACK = MSIRUNMODE.ROLLBACK; pub const MSIRUNMODE_COMMIT = MSIRUNMODE.COMMIT; pub const MSITRANSFORM_ERROR = enum(i32) { ADDEXISTINGROW = 1, DELMISSINGROW = 2, ADDEXISTINGTABLE = 4, DELMISSINGTABLE = 8, UPDATEMISSINGROW = 16, CHANGECODEPAGE = 32, VIEWTRANSFORM = 256, NONE = 0, }; pub const MSITRANSFORM_ERROR_ADDEXISTINGROW = MSITRANSFORM_ERROR.ADDEXISTINGROW; pub const MSITRANSFORM_ERROR_DELMISSINGROW = MSITRANSFORM_ERROR.DELMISSINGROW; pub const MSITRANSFORM_ERROR_ADDEXISTINGTABLE = MSITRANSFORM_ERROR.ADDEXISTINGTABLE; pub const MSITRANSFORM_ERROR_DELMISSINGTABLE = MSITRANSFORM_ERROR.DELMISSINGTABLE; pub const MSITRANSFORM_ERROR_UPDATEMISSINGROW = MSITRANSFORM_ERROR.UPDATEMISSINGROW; pub const MSITRANSFORM_ERROR_CHANGECODEPAGE = MSITRANSFORM_ERROR.CHANGECODEPAGE; pub const MSITRANSFORM_ERROR_VIEWTRANSFORM = MSITRANSFORM_ERROR.VIEWTRANSFORM; pub const MSITRANSFORM_ERROR_NONE = MSITRANSFORM_ERROR.NONE; pub const MSITRANSFORM_VALIDATE = enum(i32) { LANGUAGE = 1, PRODUCT = 2, PLATFORM = 4, MAJORVERSION = 8, MINORVERSION = 16, UPDATEVERSION = 32, NEWLESSBASEVERSION = 64, NEWLESSEQUALBASEVERSION = 128, NEWEQUALBASEVERSION = 256, NEWGREATEREQUALBASEVERSION = 512, NEWGREATERBASEVERSION = 1024, UPGRADECODE = 2048, }; pub const MSITRANSFORM_VALIDATE_LANGUAGE = MSITRANSFORM_VALIDATE.LANGUAGE; pub const MSITRANSFORM_VALIDATE_PRODUCT = MSITRANSFORM_VALIDATE.PRODUCT; pub const MSITRANSFORM_VALIDATE_PLATFORM = MSITRANSFORM_VALIDATE.PLATFORM; pub const MSITRANSFORM_VALIDATE_MAJORVERSION = MSITRANSFORM_VALIDATE.MAJORVERSION; pub const MSITRANSFORM_VALIDATE_MINORVERSION = MSITRANSFORM_VALIDATE.MINORVERSION; pub const MSITRANSFORM_VALIDATE_UPDATEVERSION = MSITRANSFORM_VALIDATE.UPDATEVERSION; pub const MSITRANSFORM_VALIDATE_NEWLESSBASEVERSION = MSITRANSFORM_VALIDATE.NEWLESSBASEVERSION; pub const MSITRANSFORM_VALIDATE_NEWLESSEQUALBASEVERSION = MSITRANSFORM_VALIDATE.NEWLESSEQUALBASEVERSION; pub const MSITRANSFORM_VALIDATE_NEWEQUALBASEVERSION = MSITRANSFORM_VALIDATE.NEWEQUALBASEVERSION; pub const MSITRANSFORM_VALIDATE_NEWGREATEREQUALBASEVERSION = MSITRANSFORM_VALIDATE.NEWGREATEREQUALBASEVERSION; pub const MSITRANSFORM_VALIDATE_NEWGREATERBASEVERSION = MSITRANSFORM_VALIDATE.NEWGREATERBASEVERSION; pub const MSITRANSFORM_VALIDATE_UPGRADECODE = MSITRANSFORM_VALIDATE.UPGRADECODE; pub const ASSEMBLY_INFO = extern struct { cbAssemblyInfo: u32, dwAssemblyFlags: u32, uliAssemblySizeInKB: ULARGE_INTEGER, pszCurrentAssemblyPathBuf: ?PWSTR, cchBuf: u32, }; pub const FUSION_INSTALL_REFERENCE = extern struct { cbSize: u32, dwFlags: u32, guidScheme: Guid, szIdentifier: ?[*:0]const u16, szNonCannonicalData: ?[*:0]const u16, }; pub const ASM_NAME = enum(i32) { PUBLIC_KEY = 0, PUBLIC_KEY_TOKEN = 1, HASH_VALUE = 2, NAME = 3, MAJOR_VERSION = 4, MINOR_VERSION = 5, BUILD_NUMBER = 6, REVISION_NUMBER = 7, CULTURE = 8, PROCESSOR_ID_ARRAY = 9, OSINFO_ARRAY = 10, HASH_ALGID = 11, ALIAS = 12, CODEBASE_URL = 13, CODEBASE_LASTMOD = 14, NULL_PUBLIC_KEY = 15, NULL_PUBLIC_KEY_TOKEN = 16, CUSTOM = 17, NULL_CUSTOM = 18, MVID = 19, MAX_PARAMS = 20, }; pub const ASM_NAME_PUBLIC_KEY = ASM_NAME.PUBLIC_KEY; pub const ASM_NAME_PUBLIC_KEY_TOKEN = ASM_NAME.PUBLIC_KEY_TOKEN; pub const ASM_NAME_HASH_VALUE = ASM_NAME.HASH_VALUE; pub const ASM_NAME_NAME = ASM_NAME.NAME; pub const ASM_NAME_MAJOR_VERSION = ASM_NAME.MAJOR_VERSION; pub const ASM_NAME_MINOR_VERSION = ASM_NAME.MINOR_VERSION; pub const ASM_NAME_BUILD_NUMBER = ASM_NAME.BUILD_NUMBER; pub const ASM_NAME_REVISION_NUMBER = ASM_NAME.REVISION_NUMBER; pub const ASM_NAME_CULTURE = ASM_NAME.CULTURE; pub const ASM_NAME_PROCESSOR_ID_ARRAY = ASM_NAME.PROCESSOR_ID_ARRAY; pub const ASM_NAME_OSINFO_ARRAY = ASM_NAME.OSINFO_ARRAY; pub const ASM_NAME_HASH_ALGID = ASM_NAME.HASH_ALGID; pub const ASM_NAME_ALIAS = ASM_NAME.ALIAS; pub const ASM_NAME_CODEBASE_URL = ASM_NAME.CODEBASE_URL; pub const ASM_NAME_CODEBASE_LASTMOD = ASM_NAME.CODEBASE_LASTMOD; pub const ASM_NAME_NULL_PUBLIC_KEY = ASM_NAME.NULL_PUBLIC_KEY; pub const ASM_NAME_NULL_PUBLIC_KEY_TOKEN = ASM_NAME.NULL_PUBLIC_KEY_TOKEN; pub const ASM_NAME_CUSTOM = ASM_NAME.CUSTOM; pub const ASM_NAME_NULL_CUSTOM = ASM_NAME.NULL_CUSTOM; pub const ASM_NAME_MVID = ASM_NAME.MVID; pub const ASM_NAME_MAX_PARAMS = ASM_NAME.MAX_PARAMS; pub const ASM_BIND_FLAGS = enum(u32) { FORCE_CACHE_INSTALL = 1, RFS_INTEGRITY_CHECK = 2, RFS_MODULE_CHECK = 4, BINPATH_PROBE_ONLY = 8, SHARED_BINPATH_HINT = 16, PARENT_ASM_HINT = 32, _, pub fn initFlags(o: struct { FORCE_CACHE_INSTALL: u1 = 0, RFS_INTEGRITY_CHECK: u1 = 0, RFS_MODULE_CHECK: u1 = 0, BINPATH_PROBE_ONLY: u1 = 0, SHARED_BINPATH_HINT: u1 = 0, PARENT_ASM_HINT: u1 = 0, }) ASM_BIND_FLAGS { return @intToEnum(ASM_BIND_FLAGS, (if (o.FORCE_CACHE_INSTALL == 1) @enumToInt(ASM_BIND_FLAGS.FORCE_CACHE_INSTALL) else 0) | (if (o.RFS_INTEGRITY_CHECK == 1) @enumToInt(ASM_BIND_FLAGS.RFS_INTEGRITY_CHECK) else 0) | (if (o.RFS_MODULE_CHECK == 1) @enumToInt(ASM_BIND_FLAGS.RFS_MODULE_CHECK) else 0) | (if (o.BINPATH_PROBE_ONLY == 1) @enumToInt(ASM_BIND_FLAGS.BINPATH_PROBE_ONLY) else 0) | (if (o.SHARED_BINPATH_HINT == 1) @enumToInt(ASM_BIND_FLAGS.SHARED_BINPATH_HINT) else 0) | (if (o.PARENT_ASM_HINT == 1) @enumToInt(ASM_BIND_FLAGS.PARENT_ASM_HINT) else 0) ); } }; pub const ASM_BINDF_FORCE_CACHE_INSTALL = ASM_BIND_FLAGS.FORCE_CACHE_INSTALL; pub const ASM_BINDF_RFS_INTEGRITY_CHECK = ASM_BIND_FLAGS.RFS_INTEGRITY_CHECK; pub const ASM_BINDF_RFS_MODULE_CHECK = ASM_BIND_FLAGS.RFS_MODULE_CHECK; pub const ASM_BINDF_BINPATH_PROBE_ONLY = ASM_BIND_FLAGS.BINPATH_PROBE_ONLY; pub const ASM_BINDF_SHARED_BINPATH_HINT = ASM_BIND_FLAGS.SHARED_BINPATH_HINT; pub const ASM_BINDF_PARENT_ASM_HINT = ASM_BIND_FLAGS.PARENT_ASM_HINT; pub const ASM_DISPLAY_FLAGS = enum(i32) { VERSION = 1, CULTURE = 2, PUBLIC_KEY_TOKEN = 4, PUBLIC_KEY = 8, CUSTOM = 16, PROCESSORARCHITECTURE = 32, LANGUAGEID = 64, }; pub const ASM_DISPLAYF_VERSION = ASM_DISPLAY_FLAGS.VERSION; pub const ASM_DISPLAYF_CULTURE = ASM_DISPLAY_FLAGS.CULTURE; pub const ASM_DISPLAYF_PUBLIC_KEY_TOKEN = ASM_DISPLAY_FLAGS.PUBLIC_KEY_TOKEN; pub const ASM_DISPLAYF_PUBLIC_KEY = ASM_DISPLAY_FLAGS.PUBLIC_KEY; pub const ASM_DISPLAYF_CUSTOM = ASM_DISPLAY_FLAGS.CUSTOM; pub const ASM_DISPLAYF_PROCESSORARCHITECTURE = ASM_DISPLAY_FLAGS.PROCESSORARCHITECTURE; pub const ASM_DISPLAYF_LANGUAGEID = ASM_DISPLAY_FLAGS.LANGUAGEID; pub const ASM_CMP_FLAGS = enum(i32) { NAME = 1, MAJOR_VERSION = 2, MINOR_VERSION = 4, BUILD_NUMBER = 8, REVISION_NUMBER = 16, PUBLIC_KEY_TOKEN = 32, CULTURE = 64, CUSTOM = 128, ALL = 255, DEFAULT = 256, }; pub const ASM_CMPF_NAME = ASM_CMP_FLAGS.NAME; pub const ASM_CMPF_MAJOR_VERSION = ASM_CMP_FLAGS.MAJOR_VERSION; pub const ASM_CMPF_MINOR_VERSION = ASM_CMP_FLAGS.MINOR_VERSION; pub const ASM_CMPF_BUILD_NUMBER = ASM_CMP_FLAGS.BUILD_NUMBER; pub const ASM_CMPF_REVISION_NUMBER = ASM_CMP_FLAGS.REVISION_NUMBER; pub const ASM_CMPF_PUBLIC_KEY_TOKEN = ASM_CMP_FLAGS.PUBLIC_KEY_TOKEN; pub const ASM_CMPF_CULTURE = ASM_CMP_FLAGS.CULTURE; pub const ASM_CMPF_CUSTOM = ASM_CMP_FLAGS.CUSTOM; pub const ASM_CMPF_ALL = ASM_CMP_FLAGS.ALL; pub const ASM_CMPF_DEFAULT = ASM_CMP_FLAGS.DEFAULT; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAssemblyName_Value = @import("../zig.zig").Guid.initString("cd193bc0-b4bc-11d2-9833-00c04fc31d2e"); pub const IID_IAssemblyName = &IID_IAssemblyName_Value; pub const IAssemblyName = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetProperty: fn( self: *const IAssemblyName, PropertyId: u32, pvProperty: ?*c_void, cbProperty: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IAssemblyName, PropertyId: u32, pvProperty: ?*c_void, pcbProperty: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Finalize: fn( self: *const IAssemblyName, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDisplayName: fn( self: *const IAssemblyName, szDisplayName: ?[*:0]u16, pccDisplayName: ?*u32, dwDisplayFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reserved: fn( self: *const IAssemblyName, refIID: ?*const Guid, pUnkReserved1: ?*IUnknown, pUnkReserved2: ?*IUnknown, szReserved: ?[*:0]const u16, llReserved: i64, pvReserved: ?*c_void, cbReserved: u32, ppReserved: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetName: fn( self: *const IAssemblyName, lpcwBuffer: ?*u32, pwzName: ?[*:0]u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVersion: fn( self: *const IAssemblyName, pdwVersionHi: ?*u32, pdwVersionLow: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEqual: fn( self: *const IAssemblyName, pName: ?*IAssemblyName, dwCmpFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IAssemblyName, pName: ?*?*IAssemblyName, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_SetProperty(self: *const T, PropertyId: u32, pvProperty: ?*c_void, cbProperty: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).SetProperty(@ptrCast(*const IAssemblyName, self), PropertyId, pvProperty, cbProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_GetProperty(self: *const T, PropertyId: u32, pvProperty: ?*c_void, pcbProperty: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).GetProperty(@ptrCast(*const IAssemblyName, self), PropertyId, pvProperty, pcbProperty); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_Finalize(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).Finalize(@ptrCast(*const IAssemblyName, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_GetDisplayName(self: *const T, szDisplayName: ?[*:0]u16, pccDisplayName: ?*u32, dwDisplayFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).GetDisplayName(@ptrCast(*const IAssemblyName, self), szDisplayName, pccDisplayName, dwDisplayFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_Reserved(self: *const T, refIID: ?*const Guid, pUnkReserved1: ?*IUnknown, pUnkReserved2: ?*IUnknown, szReserved: ?[*:0]const u16, llReserved: i64, pvReserved: ?*c_void, cbReserved: u32, ppReserved: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).Reserved(@ptrCast(*const IAssemblyName, self), refIID, pUnkReserved1, pUnkReserved2, szReserved, llReserved, pvReserved, cbReserved, ppReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_GetName(self: *const T, lpcwBuffer: ?*u32, pwzName: ?[*:0]u16) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).GetName(@ptrCast(*const IAssemblyName, self), lpcwBuffer, pwzName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_GetVersion(self: *const T, pdwVersionHi: ?*u32, pdwVersionLow: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).GetVersion(@ptrCast(*const IAssemblyName, self), pdwVersionHi, pdwVersionLow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_IsEqual(self: *const T, pName: ?*IAssemblyName, dwCmpFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).IsEqual(@ptrCast(*const IAssemblyName, self), pName, dwCmpFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyName_Clone(self: *const T, pName: ?*?*IAssemblyName) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyName.VTable, self.vtable).Clone(@ptrCast(*const IAssemblyName, self), pName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAssemblyCacheItem_Value = @import("../zig.zig").Guid.initString("9e3aaeb4-d1cd-11d2-bab9-00c04f8eceae"); pub const IID_IAssemblyCacheItem = &IID_IAssemblyCacheItem_Value; pub const IAssemblyCacheItem = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateStream: fn( self: *const IAssemblyCacheItem, dwFlags: u32, pszStreamName: ?[*:0]const u16, dwFormat: u32, dwFormatFlags: u32, ppIStream: ?*?*IStream, puliMaxSize: ?*ULARGE_INTEGER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Commit: fn( self: *const IAssemblyCacheItem, dwFlags: u32, pulDisposition: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AbortItem: fn( self: *const IAssemblyCacheItem, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCacheItem_CreateStream(self: *const T, dwFlags: u32, pszStreamName: ?[*:0]const u16, dwFormat: u32, dwFormatFlags: u32, ppIStream: ?*?*IStream, puliMaxSize: ?*ULARGE_INTEGER) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCacheItem.VTable, self.vtable).CreateStream(@ptrCast(*const IAssemblyCacheItem, self), dwFlags, pszStreamName, dwFormat, dwFormatFlags, ppIStream, puliMaxSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCacheItem_Commit(self: *const T, dwFlags: u32, pulDisposition: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCacheItem.VTable, self.vtable).Commit(@ptrCast(*const IAssemblyCacheItem, self), dwFlags, pulDisposition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCacheItem_AbortItem(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCacheItem.VTable, self.vtable).AbortItem(@ptrCast(*const IAssemblyCacheItem, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAssemblyCache_Value = @import("../zig.zig").Guid.initString("e707dcde-d1cd-11d2-bab9-00c04f8eceae"); pub const IID_IAssemblyCache = &IID_IAssemblyCache_Value; pub const IAssemblyCache = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, UninstallAssembly: fn( self: *const IAssemblyCache, dwFlags: u32, pszAssemblyName: ?[*:0]const u16, pRefData: ?*FUSION_INSTALL_REFERENCE, pulDisposition: ?*IASSEMBLYCACHE_UNINSTALL_DISPOSITION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryAssemblyInfo: fn( self: *const IAssemblyCache, dwFlags: QUERYASMINFO_FLAGS, pszAssemblyName: ?[*:0]const u16, pAsmInfo: ?*ASSEMBLY_INFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateAssemblyCacheItem: fn( self: *const IAssemblyCache, dwFlags: u32, pvReserved: ?*c_void, ppAsmItem: ?*?*IAssemblyCacheItem, pszAssemblyName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reserved: fn( self: *const IAssemblyCache, ppUnk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InstallAssembly: fn( self: *const IAssemblyCache, dwFlags: u32, pszManifestFilePath: ?[*:0]const u16, pRefData: ?*FUSION_INSTALL_REFERENCE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCache_UninstallAssembly(self: *const T, dwFlags: u32, pszAssemblyName: ?[*:0]const u16, pRefData: ?*FUSION_INSTALL_REFERENCE, pulDisposition: ?*IASSEMBLYCACHE_UNINSTALL_DISPOSITION) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCache.VTable, self.vtable).UninstallAssembly(@ptrCast(*const IAssemblyCache, self), dwFlags, pszAssemblyName, pRefData, pulDisposition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCache_QueryAssemblyInfo(self: *const T, dwFlags: QUERYASMINFO_FLAGS, pszAssemblyName: ?[*:0]const u16, pAsmInfo: ?*ASSEMBLY_INFO) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCache.VTable, self.vtable).QueryAssemblyInfo(@ptrCast(*const IAssemblyCache, self), dwFlags, pszAssemblyName, pAsmInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCache_CreateAssemblyCacheItem(self: *const T, dwFlags: u32, pvReserved: ?*c_void, ppAsmItem: ?*?*IAssemblyCacheItem, pszAssemblyName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCache.VTable, self.vtable).CreateAssemblyCacheItem(@ptrCast(*const IAssemblyCache, self), dwFlags, pvReserved, ppAsmItem, pszAssemblyName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCache_Reserved(self: *const T, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCache.VTable, self.vtable).Reserved(@ptrCast(*const IAssemblyCache, self), ppUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAssemblyCache_InstallAssembly(self: *const T, dwFlags: u32, pszManifestFilePath: ?[*:0]const u16, pRefData: ?*FUSION_INSTALL_REFERENCE) callconv(.Inline) HRESULT { return @ptrCast(*const IAssemblyCache.VTable, self.vtable).InstallAssembly(@ptrCast(*const IAssemblyCache, self), dwFlags, pszManifestFilePath, pRefData); } };} pub usingnamespace MethodMixin(@This()); }; pub const CREATE_ASM_NAME_OBJ_FLAGS = enum(i32) { PARSE_DISPLAY_NAME = 1, SET_DEFAULT_VALUES = 2, }; pub const CANOF_PARSE_DISPLAY_NAME = CREATE_ASM_NAME_OBJ_FLAGS.PARSE_DISPLAY_NAME; pub const CANOF_SET_DEFAULT_VALUES = CREATE_ASM_NAME_OBJ_FLAGS.SET_DEFAULT_VALUES; pub const PROTECTED_FILE_DATA = extern struct { FileName: [260]u16, FileNumber: u32, }; pub const ACTCTXA = extern struct { cbSize: u32, dwFlags: u32, lpSource: ?[*:0]const u8, wProcessorArchitecture: u16, wLangId: u16, lpAssemblyDirectory: ?[*:0]const u8, lpResourceName: ?[*:0]const u8, lpApplicationName: ?[*:0]const u8, hModule: ?HINSTANCE, }; pub const ACTCTXW = extern struct { cbSize: u32, dwFlags: u32, lpSource: ?[*:0]const u16, wProcessorArchitecture: u16, wLangId: u16, lpAssemblyDirectory: ?[*:0]const u16, lpResourceName: ?[*:0]const u16, lpApplicationName: ?[*:0]const u16, hModule: ?HINSTANCE, }; pub const ACTCTX_SECTION_KEYED_DATA = extern struct { cbSize: u32, ulDataFormatVersion: u32, lpData: ?*c_void, ulLength: u32, lpSectionGlobalData: ?*c_void, ulSectionGlobalDataLength: u32, lpSectionBase: ?*c_void, ulSectionTotalLength: u32, hActCtx: ?HANDLE, ulAssemblyRosterIndex: u32, ulFlags: u32, AssemblyMetadata: ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA, }; //-------------------------------------------------------------------------------- // Section: Functions (281) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiCloseHandle( hAny: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiCloseAllHandles( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetInternalUI( dwUILevel: INSTALLUILEVEL, phWnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) INSTALLUILEVEL; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetExternalUIA( puiHandler: ?INSTALLUI_HANDLERA, dwMessageFilter: u32, pvContext: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?INSTALLUI_HANDLERA; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetExternalUIW( puiHandler: ?INSTALLUI_HANDLERW, dwMessageFilter: u32, pvContext: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) ?INSTALLUI_HANDLERW; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetExternalUIRecord( puiHandler: ?PINSTALLUI_HANDLER_RECORD, dwMessageFilter: u32, pvContext: ?*c_void, ppuiPrevHandler: ?PINSTALLUI_HANDLER_RECORD, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnableLogA( dwLogMode: INSTALLOGMODE, szLogFile: ?[*:0]const u8, dwLogAttributes: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnableLogW( dwLogMode: INSTALLOGMODE, szLogFile: ?[*:0]const u16, dwLogAttributes: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryProductStateA( szProduct: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryProductStateW( szProduct: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductInfoA( szProduct: ?[*:0]const u8, szAttribute: ?[*:0]const u8, lpValueBuf: ?[*:0]u8, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductInfoW( szProduct: ?[*:0]const u16, szAttribute: ?[*:0]const u16, lpValueBuf: ?[*:0]u16, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductInfoExA( szProductCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, szProperty: ?[*:0]const u8, szValue: ?[*:0]u8, pcchValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductInfoExW( szProductCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, szProperty: ?[*:0]const u16, szValue: ?[*:0]u16, pcchValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiInstallProductA( szPackagePath: ?[*:0]const u8, szCommandLine: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiInstallProductW( szPackagePath: ?[*:0]const u16, szCommandLine: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiConfigureProductA( szProduct: ?[*:0]const u8, iInstallLevel: INSTALLLEVEL, eInstallState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiConfigureProductW( szProduct: ?[*:0]const u16, iInstallLevel: INSTALLLEVEL, eInstallState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiConfigureProductExA( szProduct: ?[*:0]const u8, iInstallLevel: INSTALLLEVEL, eInstallState: INSTALLSTATE, szCommandLine: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiConfigureProductExW( szProduct: ?[*:0]const u16, iInstallLevel: INSTALLLEVEL, eInstallState: INSTALLSTATE, szCommandLine: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiReinstallProductA( szProduct: ?[*:0]const u8, szReinstallMode: REINSTALLMODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiReinstallProductW( szProduct: ?[*:0]const u16, szReinstallMode: REINSTALLMODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiAdvertiseProductExA( szPackagePath: ?[*:0]const u8, szScriptfilePath: ?[*:0]const u8, szTransforms: ?[*:0]const u8, lgidLanguage: u16, dwPlatform: u32, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiAdvertiseProductExW( szPackagePath: ?[*:0]const u16, szScriptfilePath: ?[*:0]const u16, szTransforms: ?[*:0]const u16, lgidLanguage: u16, dwPlatform: u32, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiAdvertiseProductA( szPackagePath: ?[*:0]const u8, szScriptfilePath: ?[*:0]const u8, szTransforms: ?[*:0]const u8, lgidLanguage: u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiAdvertiseProductW( szPackagePath: ?[*:0]const u16, szScriptfilePath: ?[*:0]const u16, szTransforms: ?[*:0]const u16, lgidLanguage: u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProcessAdvertiseScriptA( szScriptFile: ?[*:0]const u8, szIconFolder: ?[*:0]const u8, hRegData: ?HKEY, fShortcuts: BOOL, fRemoveItems: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProcessAdvertiseScriptW( szScriptFile: ?[*:0]const u16, szIconFolder: ?[*:0]const u16, hRegData: ?HKEY, fShortcuts: BOOL, fRemoveItems: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiAdvertiseScriptA( szScriptFile: ?[*:0]const u8, dwFlags: u32, phRegData: ?*?HKEY, fRemoveItems: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiAdvertiseScriptW( szScriptFile: ?[*:0]const u16, dwFlags: u32, phRegData: ?*?HKEY, fRemoveItems: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductInfoFromScriptA( szScriptFile: ?[*:0]const u8, lpProductBuf39: ?PSTR, plgidLanguage: ?*u16, pdwVersion: ?*u32, lpNameBuf: ?[*:0]u8, pcchNameBuf: ?*u32, lpPackageBuf: ?[*:0]u8, pcchPackageBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductInfoFromScriptW( szScriptFile: ?[*:0]const u16, lpProductBuf39: ?PWSTR, plgidLanguage: ?*u16, pdwVersion: ?*u32, lpNameBuf: ?[*:0]u16, pcchNameBuf: ?*u32, lpPackageBuf: ?[*:0]u16, pcchPackageBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductCodeA( szComponent: ?[*:0]const u8, lpBuf39: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductCodeW( szComponent: ?[*:0]const u16, lpBuf39: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetUserInfoA( szProduct: ?[*:0]const u8, lpUserNameBuf: ?[*:0]u8, pcchUserNameBuf: ?*u32, lpOrgNameBuf: ?[*:0]u8, pcchOrgNameBuf: ?*u32, lpSerialBuf: ?[*:0]u8, pcchSerialBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) USERINFOSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetUserInfoW( szProduct: ?[*:0]const u16, lpUserNameBuf: ?[*:0]u16, pcchUserNameBuf: ?*u32, lpOrgNameBuf: ?[*:0]u16, pcchOrgNameBuf: ?*u32, lpSerialBuf: ?[*:0]u16, pcchSerialBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) USERINFOSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiCollectUserInfoA( szProduct: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiCollectUserInfoW( szProduct: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiApplyPatchA( szPatchPackage: ?[*:0]const u8, szInstallPackage: ?[*:0]const u8, eInstallType: INSTALLTYPE, szCommandLine: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiApplyPatchW( szPatchPackage: ?[*:0]const u16, szInstallPackage: ?[*:0]const u16, eInstallType: INSTALLTYPE, szCommandLine: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPatchInfoA( szPatch: ?[*:0]const u8, szAttribute: ?[*:0]const u8, lpValueBuf: ?[*:0]u8, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPatchInfoW( szPatch: ?[*:0]const u16, szAttribute: ?[*:0]const u16, lpValueBuf: ?[*:0]u16, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumPatchesA( szProduct: ?[*:0]const u8, iPatchIndex: u32, lpPatchBuf: ?PSTR, lpTransformsBuf: [*:0]u8, pcchTransformsBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumPatchesW( szProduct: ?[*:0]const u16, iPatchIndex: u32, lpPatchBuf: ?PWSTR, lpTransformsBuf: [*:0]u16, pcchTransformsBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRemovePatchesA( szPatchList: ?[*:0]const u8, szProductCode: ?[*:0]const u8, eUninstallType: INSTALLTYPE, szPropertyList: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRemovePatchesW( szPatchList: ?[*:0]const u16, szProductCode: ?[*:0]const u16, eUninstallType: INSTALLTYPE, szPropertyList: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows Vista' pub extern "msi" fn MsiExtractPatchXMLDataA( szPatchPath: ?[*:0]const u8, dwReserved: u32, szXMLData: ?[*:0]u8, pcchXMLData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows Vista' pub extern "msi" fn MsiExtractPatchXMLDataW( szPatchPath: ?[*:0]const u16, dwReserved: u32, szXMLData: ?[*:0]u16, pcchXMLData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPatchInfoExA( szPatchCode: ?[*:0]const u8, szProductCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, szProperty: ?[*:0]const u8, lpValue: ?[*:0]u8, pcchValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPatchInfoExW( szPatchCode: ?[*:0]const u16, szProductCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, szProperty: ?[*:0]const u16, lpValue: ?[*:0]u16, pcchValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiApplyMultiplePatchesA( szPatchPackages: ?[*:0]const u8, szProductCode: ?[*:0]const u8, szPropertiesList: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiApplyMultiplePatchesW( szPatchPackages: ?[*:0]const u16, szProductCode: ?[*:0]const u16, szPropertiesList: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDeterminePatchSequenceA( szProductCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, cPatchInfo: u32, pPatchInfo: [*]MSIPATCHSEQUENCEINFOA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDeterminePatchSequenceW( szProductCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, cPatchInfo: u32, pPatchInfo: [*]MSIPATCHSEQUENCEINFOW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDetermineApplicablePatchesA( szProductPackagePath: ?[*:0]const u8, cPatchInfo: u32, pPatchInfo: [*]MSIPATCHSEQUENCEINFOA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDetermineApplicablePatchesW( szProductPackagePath: ?[*:0]const u16, cPatchInfo: u32, pPatchInfo: [*]MSIPATCHSEQUENCEINFOW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumPatchesExA( szProductCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: u32, dwFilter: u32, dwIndex: u32, szPatchCode: ?PSTR, szTargetProductCode: ?PSTR, pdwTargetProductContext: ?*MSIINSTALLCONTEXT, szTargetUserSid: ?[*:0]u8, pcchTargetUserSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumPatchesExW( szProductCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: u32, dwFilter: u32, dwIndex: u32, szPatchCode: ?PWSTR, szTargetProductCode: ?PWSTR, pdwTargetProductContext: ?*MSIINSTALLCONTEXT, szTargetUserSid: ?[*:0]u16, pcchTargetUserSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryFeatureStateA( szProduct: ?[*:0]const u8, szFeature: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryFeatureStateW( szProduct: ?[*:0]const u16, szFeature: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryFeatureStateExA( szProductCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, szFeature: ?[*:0]const u8, pdwState: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryFeatureStateExW( szProductCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, szFeature: ?[*:0]const u16, pdwState: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiUseFeatureA( szProduct: ?[*:0]const u8, szFeature: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiUseFeatureW( szProduct: ?[*:0]const u16, szFeature: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiUseFeatureExA( szProduct: ?[*:0]const u8, szFeature: ?[*:0]const u8, dwInstallMode: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiUseFeatureExW( szProduct: ?[*:0]const u16, szFeature: ?[*:0]const u16, dwInstallMode: u32, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureUsageA( szProduct: ?[*:0]const u8, szFeature: ?[*:0]const u8, pdwUseCount: ?*u32, pwDateUsed: ?*u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureUsageW( szProduct: ?[*:0]const u16, szFeature: ?[*:0]const u16, pdwUseCount: ?*u32, pwDateUsed: ?*u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiConfigureFeatureA( szProduct: ?[*:0]const u8, szFeature: ?[*:0]const u8, eInstallState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiConfigureFeatureW( szProduct: ?[*:0]const u16, szFeature: ?[*:0]const u16, eInstallState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiReinstallFeatureA( szProduct: ?[*:0]const u8, szFeature: ?[*:0]const u8, dwReinstallMode: REINSTALLMODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiReinstallFeatureW( szProduct: ?[*:0]const u16, szFeature: ?[*:0]const u16, dwReinstallMode: REINSTALLMODE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideComponentA( szProduct: ?[*:0]const u8, szFeature: ?[*:0]const u8, szComponent: ?[*:0]const u8, dwInstallMode: INSTALLMODE, lpPathBuf: ?[*:0]u8, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideComponentW( szProduct: ?[*:0]const u16, szFeature: ?[*:0]const u16, szComponent: ?[*:0]const u16, dwInstallMode: INSTALLMODE, lpPathBuf: ?[*:0]u16, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideQualifiedComponentA( szCategory: ?[*:0]const u8, szQualifier: ?[*:0]const u8, dwInstallMode: INSTALLMODE, lpPathBuf: ?[*:0]u8, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideQualifiedComponentW( szCategory: ?[*:0]const u16, szQualifier: ?[*:0]const u16, dwInstallMode: INSTALLMODE, lpPathBuf: ?[*:0]u16, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideQualifiedComponentExA( szCategory: ?[*:0]const u8, szQualifier: ?[*:0]const u8, dwInstallMode: INSTALLMODE, szProduct: ?[*:0]const u8, dwUnused1: u32, dwUnused2: u32, lpPathBuf: ?[*:0]u8, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideQualifiedComponentExW( szCategory: ?[*:0]const u16, szQualifier: ?[*:0]const u16, dwInstallMode: INSTALLMODE, szProduct: ?[*:0]const u16, dwUnused1: u32, dwUnused2: u32, lpPathBuf: ?[*:0]u16, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetComponentPathA( szProduct: ?[*:0]const u8, szComponent: ?[*:0]const u8, lpPathBuf: ?[*:0]u8, pcchBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetComponentPathW( szProduct: ?[*:0]const u16, szComponent: ?[*:0]const u16, lpPathBuf: ?[*:0]u16, pcchBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' // This function from dll 'msi' is being skipped because it has some sort of issue pub fn MsiGetComponentPathExA() void { @panic("this function is not working"); } // TODO: this type is limited to platform 'Windows 8' // This function from dll 'msi' is being skipped because it has some sort of issue pub fn MsiGetComponentPathExW() void { @panic("this function is not working"); } // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideAssemblyA( szAssemblyName: ?[*:0]const u8, szAppContext: ?[*:0]const u8, dwInstallMode: INSTALLMODE, dwAssemblyInfo: MSIASSEMBLYINFO, lpPathBuf: ?[*:0]u8, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProvideAssemblyW( szAssemblyName: ?[*:0]const u16, szAppContext: ?[*:0]const u16, dwInstallMode: INSTALLMODE, dwAssemblyInfo: MSIASSEMBLYINFO, lpPathBuf: ?[*:0]u16, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryComponentStateA( szProductCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, szComponentCode: ?[*:0]const u8, pdwState: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiQueryComponentStateW( szProductCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, szComponentCode: ?[*:0]const u16, pdwState: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumProductsA( iProductIndex: u32, lpProductBuf: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumProductsW( iProductIndex: u32, lpProductBuf: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumProductsExA( szProductCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: u32, dwIndex: u32, szInstalledProductCode: ?PSTR, pdwInstalledContext: ?*MSIINSTALLCONTEXT, szSid: ?[*:0]u8, pcchSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumProductsExW( szProductCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: u32, dwIndex: u32, szInstalledProductCode: ?PWSTR, pdwInstalledContext: ?*MSIINSTALLCONTEXT, szSid: ?[*:0]u16, pcchSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumRelatedProductsA( lpUpgradeCode: ?[*:0]const u8, dwReserved: u32, iProductIndex: u32, lpProductBuf: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumRelatedProductsW( lpUpgradeCode: ?[*:0]const u16, dwReserved: u32, iProductIndex: u32, lpProductBuf: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumFeaturesA( szProduct: ?[*:0]const u8, iFeatureIndex: u32, lpFeatureBuf: ?PSTR, lpParentBuf: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumFeaturesW( szProduct: ?[*:0]const u16, iFeatureIndex: u32, lpFeatureBuf: ?PWSTR, lpParentBuf: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentsA( iComponentIndex: u32, lpComponentBuf: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentsW( iComponentIndex: u32, lpComponentBuf: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentsExA( szUserSid: ?[*:0]const u8, dwContext: u32, dwIndex: u32, szInstalledComponentCode: ?PSTR, pdwInstalledContext: ?*MSIINSTALLCONTEXT, szSid: ?[*:0]u8, pcchSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentsExW( szUserSid: ?[*:0]const u16, dwContext: u32, dwIndex: u32, szInstalledComponentCode: ?PWSTR, pdwInstalledContext: ?*MSIINSTALLCONTEXT, szSid: ?[*:0]u16, pcchSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumClientsA( szComponent: ?[*:0]const u8, iProductIndex: u32, lpProductBuf: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumClientsW( szComponent: ?[*:0]const u16, iProductIndex: u32, lpProductBuf: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumClientsExA( szComponent: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwProductIndex: u32, szProductBuf: ?PSTR, pdwInstalledContext: ?*MSIINSTALLCONTEXT, szSid: ?[*:0]u8, pcchSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumClientsExW( szComponent: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwProductIndex: u32, szProductBuf: ?PWSTR, pdwInstalledContext: ?*MSIINSTALLCONTEXT, szSid: ?[*:0]u16, pcchSid: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentQualifiersA( szComponent: ?[*:0]const u8, iIndex: u32, lpQualifierBuf: [*:0]u8, pcchQualifierBuf: ?*u32, lpApplicationDataBuf: ?[*:0]u8, pcchApplicationDataBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentQualifiersW( szComponent: ?[*:0]const u16, iIndex: u32, lpQualifierBuf: [*:0]u16, pcchQualifierBuf: ?*u32, lpApplicationDataBuf: ?[*:0]u16, pcchApplicationDataBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenProductA( szProduct: ?[*:0]const u8, hProduct: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenProductW( szProduct: ?[*:0]const u16, hProduct: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenPackageA( szPackagePath: ?[*:0]const u8, hProduct: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenPackageW( szPackagePath: ?[*:0]const u16, hProduct: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenPackageExA( szPackagePath: ?[*:0]const u8, dwOptions: u32, hProduct: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenPackageExW( szPackagePath: ?[*:0]const u16, dwOptions: u32, hProduct: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPatchFileListA( szProductCode: ?[*:0]const u8, szPatchPackages: ?[*:0]const u8, pcFiles: ?*u32, pphFileRecords: ?*?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPatchFileListW( szProductCode: ?[*:0]const u16, szPatchPackages: ?[*:0]const u16, pcFiles: ?*u32, pphFileRecords: ?*?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductPropertyA( hProduct: MSIHANDLE, szProperty: ?[*:0]const u8, lpValueBuf: ?[*:0]u8, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetProductPropertyW( hProduct: MSIHANDLE, szProperty: ?[*:0]const u16, lpValueBuf: ?[*:0]u16, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiVerifyPackageA( szPackagePath: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiVerifyPackageW( szPackagePath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureInfoA( hProduct: MSIHANDLE, szFeature: ?[*:0]const u8, lpAttributes: ?*u32, lpTitleBuf: ?[*:0]u8, pcchTitleBuf: ?*u32, lpHelpBuf: ?[*:0]u8, pcchHelpBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureInfoW( hProduct: MSIHANDLE, szFeature: ?[*:0]const u16, lpAttributes: ?*u32, lpTitleBuf: ?[*:0]u16, pcchTitleBuf: ?*u32, lpHelpBuf: ?[*:0]u16, pcchHelpBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiInstallMissingComponentA( szProduct: ?[*:0]const u8, szComponent: ?[*:0]const u8, eInstallState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiInstallMissingComponentW( szProduct: ?[*:0]const u16, szComponent: ?[*:0]const u16, eInstallState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiInstallMissingFileA( szProduct: ?[*:0]const u8, szFile: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiInstallMissingFileW( szProduct: ?[*:0]const u16, szFile: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiLocateComponentA( szComponent: ?[*:0]const u8, lpPathBuf: ?[*:0]u8, pcchBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiLocateComponentW( szComponent: ?[*:0]const u16, lpPathBuf: ?[*:0]u16, pcchBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) INSTALLSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearAllA( szProduct: ?[*:0]const u8, szUserName: ?[*:0]const u8, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearAllW( szProduct: ?[*:0]const u16, szUserName: ?[*:0]const u16, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListAddSourceA( szProduct: ?[*:0]const u8, szUserName: ?[*:0]const u8, dwReserved: u32, szSource: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListAddSourceW( szProduct: ?[*:0]const u16, szUserName: ?[*:0]const u16, dwReserved: u32, szSource: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListForceResolutionA( szProduct: ?[*:0]const u8, szUserName: ?[*:0]const u8, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListForceResolutionW( szProduct: ?[*:0]const u16, szUserName: ?[*:0]const u16, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListAddSourceExA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szSource: ?[*:0]const u8, dwIndex: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListAddSourceExW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szSource: ?[*:0]const u16, dwIndex: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListAddMediaDiskA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwDiskId: u32, szVolumeLabel: ?[*:0]const u8, szDiskPrompt: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListAddMediaDiskW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwDiskId: u32, szVolumeLabel: ?[*:0]const u16, szDiskPrompt: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearSourceA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szSource: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearSourceW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szSource: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearMediaDiskA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwDiskId: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearMediaDiskW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwDiskId: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearAllExA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListClearAllExW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListForceResolutionExA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListForceResolutionExW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListSetInfoA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szProperty: ?[*:0]const u8, szValue: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListSetInfoW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szProperty: ?[*:0]const u16, szValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListGetInfoA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szProperty: ?[*:0]const u8, szValue: ?[*:0]u8, pcchValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListGetInfoW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, szProperty: ?[*:0]const u16, szValue: ?[*:0]u16, pcchValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListEnumSourcesA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwIndex: u32, szSource: ?[*:0]u8, pcchSource: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListEnumSourcesW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwIndex: u32, szSource: ?[*:0]u16, pcchSource: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListEnumMediaDisksA( szProductCodeOrPatchCode: ?[*:0]const u8, szUserSid: ?[*:0]const u8, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwIndex: u32, pdwDiskId: ?*u32, szVolumeLabel: ?[*:0]u8, pcchVolumeLabel: ?*u32, szDiskPrompt: ?[*:0]u8, pcchDiskPrompt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSourceListEnumMediaDisksW( szProductCodeOrPatchCode: ?[*:0]const u16, szUserSid: ?[*:0]const u16, dwContext: MSIINSTALLCONTEXT, dwOptions: u32, dwIndex: u32, pdwDiskId: ?*u32, szVolumeLabel: ?[*:0]u16, pcchVolumeLabel: ?*u32, szDiskPrompt: ?[*:0]u16, pcchDiskPrompt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFileVersionA( szFilePath: ?[*:0]const u8, lpVersionBuf: ?[*:0]u8, pcchVersionBuf: ?*u32, lpLangBuf: ?[*:0]u8, pcchLangBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFileVersionW( szFilePath: ?[*:0]const u16, lpVersionBuf: ?[*:0]u16, pcchVersionBuf: ?*u32, lpLangBuf: ?[*:0]u16, pcchLangBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFileHashA( szFilePath: ?[*:0]const u8, dwOptions: u32, pHash: ?*MSIFILEHASHINFO, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFileHashW( szFilePath: ?[*:0]const u16, dwOptions: u32, pHash: ?*MSIFILEHASHINFO, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFileSignatureInformationA( szSignedObjectPath: ?[*:0]const u8, dwFlags: u32, ppcCertContext: ?*?*CERT_CONTEXT, // TODO: what to do with BytesParamIndex 4? pbHashData: ?*u8, pcbHashData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFileSignatureInformationW( szSignedObjectPath: ?[*:0]const u16, dwFlags: u32, ppcCertContext: ?*?*CERT_CONTEXT, // TODO: what to do with BytesParamIndex 4? pbHashData: ?*u8, pcbHashData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetShortcutTargetA( szShortcutPath: ?[*:0]const u8, szProductCode: ?PSTR, szFeatureId: ?PSTR, szComponentCode: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetShortcutTargetW( szShortcutPath: ?[*:0]const u16, szProductCode: ?PWSTR, szFeatureId: ?PWSTR, szComponentCode: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiIsProductElevatedA( szProduct: ?[*:0]const u8, pfElevated: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiIsProductElevatedW( szProduct: ?[*:0]const u16, pfElevated: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiNotifySidChangeA( pOldSid: ?[*:0]const u8, pNewSid: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiNotifySidChangeW( pOldSid: ?[*:0]const u16, pNewSid: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiBeginTransactionA( szName: ?[*:0]const u8, dwTransactionAttributes: u32, phTransactionHandle: ?*MSIHANDLE, phChangeOfOwnerEvent: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiBeginTransactionW( szName: ?[*:0]const u16, dwTransactionAttributes: u32, phTransactionHandle: ?*MSIHANDLE, phChangeOfOwnerEvent: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEndTransaction( dwTransactionState: MSITRANSACTIONSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiJoinTransaction( hTransactionHandle: MSIHANDLE, dwTransactionAttributes: u32, phChangeOfOwnerEvent: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseOpenViewA( hDatabase: MSIHANDLE, szQuery: ?[*:0]const u8, phView: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseOpenViewW( hDatabase: MSIHANDLE, szQuery: ?[*:0]const u16, phView: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiViewGetErrorA( hView: MSIHANDLE, szColumnNameBuffer: ?[*:0]u8, pcchBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) MSIDBERROR; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiViewGetErrorW( hView: MSIHANDLE, szColumnNameBuffer: ?[*:0]u16, pcchBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) MSIDBERROR; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiViewExecute( hView: MSIHANDLE, hRecord: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiViewFetch( hView: MSIHANDLE, phRecord: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiViewModify( hView: MSIHANDLE, eModifyMode: MSIMODIFY, hRecord: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiViewGetColumnInfo( hView: MSIHANDLE, eColumnInfo: MSICOLINFO, phRecord: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiViewClose( hView: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseGetPrimaryKeysA( hDatabase: MSIHANDLE, szTableName: ?[*:0]const u8, phRecord: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseGetPrimaryKeysW( hDatabase: MSIHANDLE, szTableName: ?[*:0]const u16, phRecord: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseIsTablePersistentA( hDatabase: MSIHANDLE, szTableName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) MSICONDITION; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseIsTablePersistentW( hDatabase: MSIHANDLE, szTableName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) MSICONDITION; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetSummaryInformationA( hDatabase: MSIHANDLE, szDatabasePath: ?[*:0]const u8, uiUpdateCount: u32, phSummaryInfo: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetSummaryInformationW( hDatabase: MSIHANDLE, szDatabasePath: ?[*:0]const u16, uiUpdateCount: u32, phSummaryInfo: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSummaryInfoGetPropertyCount( hSummaryInfo: MSIHANDLE, puiPropertyCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSummaryInfoSetPropertyA( hSummaryInfo: MSIHANDLE, uiProperty: u32, uiDataType: u32, iValue: i32, pftValue: ?*FILETIME, szValue: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSummaryInfoSetPropertyW( hSummaryInfo: MSIHANDLE, uiProperty: u32, uiDataType: u32, iValue: i32, pftValue: ?*FILETIME, szValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSummaryInfoGetPropertyA( hSummaryInfo: MSIHANDLE, uiProperty: u32, puiDataType: ?*u32, piValue: ?*i32, pftValue: ?*FILETIME, szValueBuf: ?[*:0]u8, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSummaryInfoGetPropertyW( hSummaryInfo: MSIHANDLE, uiProperty: u32, puiDataType: ?*u32, piValue: ?*i32, pftValue: ?*FILETIME, szValueBuf: ?[*:0]u16, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSummaryInfoPersist( hSummaryInfo: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenDatabaseA( szDatabasePath: ?[*:0]const u8, szPersist: ?[*:0]const u8, phDatabase: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiOpenDatabaseW( szDatabasePath: ?[*:0]const u16, szPersist: ?[*:0]const u16, phDatabase: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseImportA( hDatabase: MSIHANDLE, szFolderPath: ?[*:0]const u8, szFileName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseImportW( hDatabase: MSIHANDLE, szFolderPath: ?[*:0]const u16, szFileName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseExportA( hDatabase: MSIHANDLE, szTableName: ?[*:0]const u8, szFolderPath: ?[*:0]const u8, szFileName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseExportW( hDatabase: MSIHANDLE, szTableName: ?[*:0]const u16, szFolderPath: ?[*:0]const u16, szFileName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseMergeA( hDatabase: MSIHANDLE, hDatabaseMerge: MSIHANDLE, szTableName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseMergeW( hDatabase: MSIHANDLE, hDatabaseMerge: MSIHANDLE, szTableName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseGenerateTransformA( hDatabase: MSIHANDLE, hDatabaseReference: MSIHANDLE, szTransformFile: ?[*:0]const u8, iReserved1: i32, iReserved2: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseGenerateTransformW( hDatabase: MSIHANDLE, hDatabaseReference: MSIHANDLE, szTransformFile: ?[*:0]const u16, iReserved1: i32, iReserved2: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseApplyTransformA( hDatabase: MSIHANDLE, szTransformFile: ?[*:0]const u8, iErrorConditions: MSITRANSFORM_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseApplyTransformW( hDatabase: MSIHANDLE, szTransformFile: ?[*:0]const u16, iErrorConditions: MSITRANSFORM_ERROR, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiCreateTransformSummaryInfoA( hDatabase: MSIHANDLE, hDatabaseReference: MSIHANDLE, szTransformFile: ?[*:0]const u8, iErrorConditions: MSITRANSFORM_ERROR, iValidation: MSITRANSFORM_VALIDATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiCreateTransformSummaryInfoW( hDatabase: MSIHANDLE, hDatabaseReference: MSIHANDLE, szTransformFile: ?[*:0]const u16, iErrorConditions: MSITRANSFORM_ERROR, iValidation: MSITRANSFORM_VALIDATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDatabaseCommit( hDatabase: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetDatabaseState( hDatabase: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) MSIDBSTATE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiCreateRecord( cParams: u32, ) callconv(@import("std").os.windows.WINAPI) MSIHANDLE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordIsNull( hRecord: MSIHANDLE, iField: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordDataSize( hRecord: MSIHANDLE, iField: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordSetInteger( hRecord: MSIHANDLE, iField: u32, iValue: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordSetStringA( hRecord: MSIHANDLE, iField: u32, szValue: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordSetStringW( hRecord: MSIHANDLE, iField: u32, szValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordGetInteger( hRecord: MSIHANDLE, iField: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordGetStringA( hRecord: MSIHANDLE, iField: u32, szValueBuf: ?[*:0]u8, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordGetStringW( hRecord: MSIHANDLE, iField: u32, szValueBuf: ?[*:0]u16, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordGetFieldCount( hRecord: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordSetStreamA( hRecord: MSIHANDLE, iField: u32, szFilePath: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordSetStreamW( hRecord: MSIHANDLE, iField: u32, szFilePath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordReadStream( hRecord: MSIHANDLE, iField: u32, // TODO: what to do with BytesParamIndex 3? szDataBuf: ?PSTR, pcbDataBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiRecordClearData( hRecord: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetActiveDatabase( hInstall: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) MSIHANDLE; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetPropertyA( hInstall: MSIHANDLE, szName: ?[*:0]const u8, szValue: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetPropertyW( hInstall: MSIHANDLE, szName: ?[*:0]const u16, szValue: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPropertyA( hInstall: MSIHANDLE, szName: ?[*:0]const u8, szValueBuf: ?[*:0]u8, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetPropertyW( hInstall: MSIHANDLE, szName: ?[*:0]const u16, szValueBuf: ?[*:0]u16, pcchValueBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetLanguage( hInstall: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u16; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetMode( hInstall: MSIHANDLE, eRunMode: MSIRUNMODE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetMode( hInstall: MSIHANDLE, eRunMode: MSIRUNMODE, fState: BOOL, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiFormatRecordA( hInstall: MSIHANDLE, hRecord: MSIHANDLE, szResultBuf: ?[*:0]u8, pcchResultBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiFormatRecordW( hInstall: MSIHANDLE, hRecord: MSIHANDLE, szResultBuf: ?[*:0]u16, pcchResultBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDoActionA( hInstall: MSIHANDLE, szAction: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiDoActionW( hInstall: MSIHANDLE, szAction: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSequenceA( hInstall: MSIHANDLE, szTable: ?[*:0]const u8, iSequenceMode: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSequenceW( hInstall: MSIHANDLE, szTable: ?[*:0]const u16, iSequenceMode: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiProcessMessage( hInstall: MSIHANDLE, eMessageType: INSTALLMESSAGE, hRecord: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEvaluateConditionA( hInstall: MSIHANDLE, szCondition: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) MSICONDITION; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEvaluateConditionW( hInstall: MSIHANDLE, szCondition: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) MSICONDITION; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureStateA( hInstall: MSIHANDLE, szFeature: ?[*:0]const u8, piInstalled: ?*INSTALLSTATE, piAction: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureStateW( hInstall: MSIHANDLE, szFeature: ?[*:0]const u16, piInstalled: ?*INSTALLSTATE, piAction: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetFeatureStateA( hInstall: MSIHANDLE, szFeature: ?[*:0]const u8, iState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetFeatureStateW( hInstall: MSIHANDLE, szFeature: ?[*:0]const u16, iState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetFeatureAttributesA( hInstall: MSIHANDLE, szFeature: ?[*:0]const u8, dwAttributes: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetFeatureAttributesW( hInstall: MSIHANDLE, szFeature: ?[*:0]const u16, dwAttributes: u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetComponentStateA( hInstall: MSIHANDLE, szComponent: ?[*:0]const u8, piInstalled: ?*INSTALLSTATE, piAction: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetComponentStateW( hInstall: MSIHANDLE, szComponent: ?[*:0]const u16, piInstalled: ?*INSTALLSTATE, piAction: ?*INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetComponentStateA( hInstall: MSIHANDLE, szComponent: ?[*:0]const u8, iState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetComponentStateW( hInstall: MSIHANDLE, szComponent: ?[*:0]const u16, iState: INSTALLSTATE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureCostA( hInstall: MSIHANDLE, szFeature: ?[*:0]const u8, iCostTree: MSICOSTTREE, iState: INSTALLSTATE, piCost: ?*i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureCostW( hInstall: MSIHANDLE, szFeature: ?[*:0]const u16, iCostTree: MSICOSTTREE, iState: INSTALLSTATE, piCost: ?*i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentCostsA( hInstall: MSIHANDLE, szComponent: ?[*:0]const u8, dwIndex: u32, iState: INSTALLSTATE, szDriveBuf: [*:0]u8, pcchDriveBuf: ?*u32, piCost: ?*i32, piTempCost: ?*i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnumComponentCostsW( hInstall: MSIHANDLE, szComponent: ?[*:0]const u16, dwIndex: u32, iState: INSTALLSTATE, szDriveBuf: [*:0]u16, pcchDriveBuf: ?*u32, piCost: ?*i32, piTempCost: ?*i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetInstallLevel( hInstall: MSIHANDLE, iInstallLevel: i32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureValidStatesA( hInstall: MSIHANDLE, szFeature: ?[*:0]const u8, lpInstallStates: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetFeatureValidStatesW( hInstall: MSIHANDLE, szFeature: ?[*:0]const u16, lpInstallStates: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetSourcePathA( hInstall: MSIHANDLE, szFolder: ?[*:0]const u8, szPathBuf: ?[*:0]u8, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetSourcePathW( hInstall: MSIHANDLE, szFolder: ?[*:0]const u16, szPathBuf: ?[*:0]u16, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetTargetPathA( hInstall: MSIHANDLE, szFolder: ?[*:0]const u8, szPathBuf: ?[*:0]u8, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetTargetPathW( hInstall: MSIHANDLE, szFolder: ?[*:0]const u16, szPathBuf: ?[*:0]u16, pcchPathBuf: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetTargetPathA( hInstall: MSIHANDLE, szFolder: ?[*:0]const u8, szFolderPath: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiSetTargetPathW( hInstall: MSIHANDLE, szFolder: ?[*:0]const u16, szFolderPath: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiVerifyDiskSpace( hInstall: MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiEnableUIPreview( hDatabase: MSIHANDLE, phPreview: ?*MSIHANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiPreviewDialogA( hPreview: MSIHANDLE, szDialogName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiPreviewDialogW( hPreview: MSIHANDLE, szDialogName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiPreviewBillboardA( hPreview: MSIHANDLE, szControlName: ?[*:0]const u8, szBillboard: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiPreviewBillboardW( hPreview: MSIHANDLE, szControlName: ?[*:0]const u16, szBillboard: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'Windows 8' pub extern "msi" fn MsiGetLastErrorRecord( ) callconv(@import("std").os.windows.WINAPI) MSIHANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "sfc" fn SfcGetNextProtectedFile( RpcHandle: ?HANDLE, ProtFileData: ?*PROTECTED_FILE_DATA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "sfc" fn SfcIsFileProtected( RpcHandle: ?HANDLE, ProtFileName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "sfc" fn SfcIsKeyProtected( KeyHandle: ?HKEY, SubKeyName: ?[*:0]const u16, KeySam: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "sfc" fn SfpVerifyFile( pszFileName: ?[*:0]const u8, pszError: [*:0]u8, dwErrSize: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn CreateActCtxA( pActCtx: ?*ACTCTXA, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn CreateActCtxW( pActCtx: ?*ACTCTXW, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn AddRefActCtx( hActCtx: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn ReleaseActCtx( hActCtx: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn ZombifyActCtx( hActCtx: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn ActivateActCtx( hActCtx: ?HANDLE, lpCookie: ?*usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn DeactivateActCtx( dwFlags: u32, ulCookie: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn GetCurrentActCtx( lphActCtx: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn FindActCtxSectionStringA( dwFlags: u32, lpExtensionGuid: ?*const Guid, ulSectionId: u32, lpStringToFind: ?[*:0]const u8, ReturnedData: ?*ACTCTX_SECTION_KEYED_DATA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn FindActCtxSectionStringW( dwFlags: u32, lpExtensionGuid: ?*const Guid, ulSectionId: u32, lpStringToFind: ?[*:0]const u16, ReturnedData: ?*ACTCTX_SECTION_KEYED_DATA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn FindActCtxSectionGuid( dwFlags: u32, lpExtensionGuid: ?*const Guid, ulSectionId: u32, lpGuidToFind: ?*const Guid, ReturnedData: ?*ACTCTX_SECTION_KEYED_DATA, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "KERNEL32" fn QueryActCtxW( dwFlags: u32, hActCtx: ?HANDLE, pvSubInstance: ?*c_void, ulInfoClass: u32, // TODO: what to do with BytesParamIndex 5? pvBuffer: ?*c_void, cbBuffer: usize, pcbWrittenOrRequired: ?*usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows6.0.6000' pub extern "KERNEL32" fn QueryActCtxSettingsW( dwFlags: u32, hActCtx: ?HANDLE, settingsNameSpace: ?[*:0]const u16, settingName: ?[*:0]const u16, // TODO: what to do with BytesParamIndex 5? pvBuffer: ?PWSTR, dwBuffer: usize, pdwWrittenOrRequired: ?*usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (121) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const INSTALLUI_HANDLER = thismodule.INSTALLUI_HANDLERA; pub const MSIPATCHSEQUENCEINFO = thismodule.MSIPATCHSEQUENCEINFOA; pub const ACTCTX = thismodule.ACTCTXA; pub const MsiSetExternalUI = thismodule.MsiSetExternalUIA; pub const MsiEnableLog = thismodule.MsiEnableLogA; pub const MsiQueryProductState = thismodule.MsiQueryProductStateA; pub const MsiGetProductInfo = thismodule.MsiGetProductInfoA; pub const MsiGetProductInfoEx = thismodule.MsiGetProductInfoExA; pub const MsiInstallProduct = thismodule.MsiInstallProductA; pub const MsiConfigureProduct = thismodule.MsiConfigureProductA; pub const MsiConfigureProductEx = thismodule.MsiConfigureProductExA; pub const MsiReinstallProduct = thismodule.MsiReinstallProductA; pub const MsiAdvertiseProductEx = thismodule.MsiAdvertiseProductExA; pub const MsiAdvertiseProduct = thismodule.MsiAdvertiseProductA; pub const MsiProcessAdvertiseScript = thismodule.MsiProcessAdvertiseScriptA; pub const MsiAdvertiseScript = thismodule.MsiAdvertiseScriptA; pub const MsiGetProductInfoFromScript = thismodule.MsiGetProductInfoFromScriptA; pub const MsiGetProductCode = thismodule.MsiGetProductCodeA; pub const MsiGetUserInfo = thismodule.MsiGetUserInfoA; pub const MsiCollectUserInfo = thismodule.MsiCollectUserInfoA; pub const MsiApplyPatch = thismodule.MsiApplyPatchA; pub const MsiGetPatchInfo = thismodule.MsiGetPatchInfoA; pub const MsiEnumPatches = thismodule.MsiEnumPatchesA; pub const MsiRemovePatches = thismodule.MsiRemovePatchesA; pub const MsiExtractPatchXMLData = thismodule.MsiExtractPatchXMLDataA; pub const MsiGetPatchInfoEx = thismodule.MsiGetPatchInfoExA; pub const MsiApplyMultiplePatches = thismodule.MsiApplyMultiplePatchesA; pub const MsiDeterminePatchSequence = thismodule.MsiDeterminePatchSequenceA; pub const MsiDetermineApplicablePatches = thismodule.MsiDetermineApplicablePatchesA; pub const MsiEnumPatchesEx = thismodule.MsiEnumPatchesExA; pub const MsiQueryFeatureState = thismodule.MsiQueryFeatureStateA; pub const MsiQueryFeatureStateEx = thismodule.MsiQueryFeatureStateExA; pub const MsiUseFeature = thismodule.MsiUseFeatureA; pub const MsiUseFeatureEx = thismodule.MsiUseFeatureExA; pub const MsiGetFeatureUsage = thismodule.MsiGetFeatureUsageA; pub const MsiConfigureFeature = thismodule.MsiConfigureFeatureA; pub const MsiReinstallFeature = thismodule.MsiReinstallFeatureA; pub const MsiProvideComponent = thismodule.MsiProvideComponentA; pub const MsiProvideQualifiedComponent = thismodule.MsiProvideQualifiedComponentA; pub const MsiProvideQualifiedComponentEx = thismodule.MsiProvideQualifiedComponentExA; pub const MsiGetComponentPath = thismodule.MsiGetComponentPathA; pub const MsiGetComponentPathEx = thismodule.MsiGetComponentPathExA; pub const MsiProvideAssembly = thismodule.MsiProvideAssemblyA; pub const MsiQueryComponentState = thismodule.MsiQueryComponentStateA; pub const MsiEnumProducts = thismodule.MsiEnumProductsA; pub const MsiEnumProductsEx = thismodule.MsiEnumProductsExA; pub const MsiEnumRelatedProducts = thismodule.MsiEnumRelatedProductsA; pub const MsiEnumFeatures = thismodule.MsiEnumFeaturesA; pub const MsiEnumComponents = thismodule.MsiEnumComponentsA; pub const MsiEnumComponentsEx = thismodule.MsiEnumComponentsExA; pub const MsiEnumClients = thismodule.MsiEnumClientsA; pub const MsiEnumClientsEx = thismodule.MsiEnumClientsExA; pub const MsiEnumComponentQualifiers = thismodule.MsiEnumComponentQualifiersA; pub const MsiOpenProduct = thismodule.MsiOpenProductA; pub const MsiOpenPackage = thismodule.MsiOpenPackageA; pub const MsiOpenPackageEx = thismodule.MsiOpenPackageExA; pub const MsiGetPatchFileList = thismodule.MsiGetPatchFileListA; pub const MsiGetProductProperty = thismodule.MsiGetProductPropertyA; pub const MsiVerifyPackage = thismodule.MsiVerifyPackageA; pub const MsiGetFeatureInfo = thismodule.MsiGetFeatureInfoA; pub const MsiInstallMissingComponent = thismodule.MsiInstallMissingComponentA; pub const MsiInstallMissingFile = thismodule.MsiInstallMissingFileA; pub const MsiLocateComponent = thismodule.MsiLocateComponentA; pub const MsiSourceListClearAll = thismodule.MsiSourceListClearAllA; pub const MsiSourceListAddSource = thismodule.MsiSourceListAddSourceA; pub const MsiSourceListForceResolution = thismodule.MsiSourceListForceResolutionA; pub const MsiSourceListAddSourceEx = thismodule.MsiSourceListAddSourceExA; pub const MsiSourceListAddMediaDisk = thismodule.MsiSourceListAddMediaDiskA; pub const MsiSourceListClearSource = thismodule.MsiSourceListClearSourceA; pub const MsiSourceListClearMediaDisk = thismodule.MsiSourceListClearMediaDiskA; pub const MsiSourceListClearAllEx = thismodule.MsiSourceListClearAllExA; pub const MsiSourceListForceResolutionEx = thismodule.MsiSourceListForceResolutionExA; pub const MsiSourceListSetInfo = thismodule.MsiSourceListSetInfoA; pub const MsiSourceListGetInfo = thismodule.MsiSourceListGetInfoA; pub const MsiSourceListEnumSources = thismodule.MsiSourceListEnumSourcesA; pub const MsiSourceListEnumMediaDisks = thismodule.MsiSourceListEnumMediaDisksA; pub const MsiGetFileVersion = thismodule.MsiGetFileVersionA; pub const MsiGetFileHash = thismodule.MsiGetFileHashA; pub const MsiGetFileSignatureInformation = thismodule.MsiGetFileSignatureInformationA; pub const MsiGetShortcutTarget = thismodule.MsiGetShortcutTargetA; pub const MsiIsProductElevated = thismodule.MsiIsProductElevatedA; pub const MsiNotifySidChange = thismodule.MsiNotifySidChangeA; pub const MsiBeginTransaction = thismodule.MsiBeginTransactionA; pub const MsiDatabaseOpenView = thismodule.MsiDatabaseOpenViewA; pub const MsiViewGetError = thismodule.MsiViewGetErrorA; pub const MsiDatabaseGetPrimaryKeys = thismodule.MsiDatabaseGetPrimaryKeysA; pub const MsiDatabaseIsTablePersistent = thismodule.MsiDatabaseIsTablePersistentA; pub const MsiGetSummaryInformation = thismodule.MsiGetSummaryInformationA; pub const MsiSummaryInfoSetProperty = thismodule.MsiSummaryInfoSetPropertyA; pub const MsiSummaryInfoGetProperty = thismodule.MsiSummaryInfoGetPropertyA; pub const MsiOpenDatabase = thismodule.MsiOpenDatabaseA; pub const MsiDatabaseImport = thismodule.MsiDatabaseImportA; pub const MsiDatabaseExport = thismodule.MsiDatabaseExportA; pub const MsiDatabaseMerge = thismodule.MsiDatabaseMergeA; pub const MsiDatabaseGenerateTransform = thismodule.MsiDatabaseGenerateTransformA; pub const MsiDatabaseApplyTransform = thismodule.MsiDatabaseApplyTransformA; pub const MsiCreateTransformSummaryInfo = thismodule.MsiCreateTransformSummaryInfoA; pub const MsiRecordSetString = thismodule.MsiRecordSetStringA; pub const MsiRecordGetString = thismodule.MsiRecordGetStringA; pub const MsiRecordSetStream = thismodule.MsiRecordSetStreamA; pub const MsiSetProperty = thismodule.MsiSetPropertyA; pub const MsiGetProperty = thismodule.MsiGetPropertyA; pub const MsiFormatRecord = thismodule.MsiFormatRecordA; pub const MsiDoAction = thismodule.MsiDoActionA; pub const MsiSequence = thismodule.MsiSequenceA; pub const MsiEvaluateCondition = thismodule.MsiEvaluateConditionA; pub const MsiGetFeatureState = thismodule.MsiGetFeatureStateA; pub const MsiSetFeatureState = thismodule.MsiSetFeatureStateA; pub const MsiSetFeatureAttributes = thismodule.MsiSetFeatureAttributesA; pub const MsiGetComponentState = thismodule.MsiGetComponentStateA; pub const MsiSetComponentState = thismodule.MsiSetComponentStateA; pub const MsiGetFeatureCost = thismodule.MsiGetFeatureCostA; pub const MsiEnumComponentCosts = thismodule.MsiEnumComponentCostsA; pub const MsiGetFeatureValidStates = thismodule.MsiGetFeatureValidStatesA; pub const MsiGetSourcePath = thismodule.MsiGetSourcePathA; pub const MsiGetTargetPath = thismodule.MsiGetTargetPathA; pub const MsiSetTargetPath = thismodule.MsiSetTargetPathA; pub const MsiPreviewDialog = thismodule.MsiPreviewDialogA; pub const MsiPreviewBillboard = thismodule.MsiPreviewBillboardA; pub const CreateActCtx = thismodule.CreateActCtxA; pub const FindActCtxSectionString = thismodule.FindActCtxSectionStringA; }, .wide => struct { pub const INSTALLUI_HANDLER = thismodule.INSTALLUI_HANDLERW; pub const MSIPATCHSEQUENCEINFO = thismodule.MSIPATCHSEQUENCEINFOW; pub const ACTCTX = thismodule.ACTCTXW; pub const MsiSetExternalUI = thismodule.MsiSetExternalUIW; pub const MsiEnableLog = thismodule.MsiEnableLogW; pub const MsiQueryProductState = thismodule.MsiQueryProductStateW; pub const MsiGetProductInfo = thismodule.MsiGetProductInfoW; pub const MsiGetProductInfoEx = thismodule.MsiGetProductInfoExW; pub const MsiInstallProduct = thismodule.MsiInstallProductW; pub const MsiConfigureProduct = thismodule.MsiConfigureProductW; pub const MsiConfigureProductEx = thismodule.MsiConfigureProductExW; pub const MsiReinstallProduct = thismodule.MsiReinstallProductW; pub const MsiAdvertiseProductEx = thismodule.MsiAdvertiseProductExW; pub const MsiAdvertiseProduct = thismodule.MsiAdvertiseProductW; pub const MsiProcessAdvertiseScript = thismodule.MsiProcessAdvertiseScriptW; pub const MsiAdvertiseScript = thismodule.MsiAdvertiseScriptW; pub const MsiGetProductInfoFromScript = thismodule.MsiGetProductInfoFromScriptW; pub const MsiGetProductCode = thismodule.MsiGetProductCodeW; pub const MsiGetUserInfo = thismodule.MsiGetUserInfoW; pub const MsiCollectUserInfo = thismodule.MsiCollectUserInfoW; pub const MsiApplyPatch = thismodule.MsiApplyPatchW; pub const MsiGetPatchInfo = thismodule.MsiGetPatchInfoW; pub const MsiEnumPatches = thismodule.MsiEnumPatchesW; pub const MsiRemovePatches = thismodule.MsiRemovePatchesW; pub const MsiExtractPatchXMLData = thismodule.MsiExtractPatchXMLDataW; pub const MsiGetPatchInfoEx = thismodule.MsiGetPatchInfoExW; pub const MsiApplyMultiplePatches = thismodule.MsiApplyMultiplePatchesW; pub const MsiDeterminePatchSequence = thismodule.MsiDeterminePatchSequenceW; pub const MsiDetermineApplicablePatches = thismodule.MsiDetermineApplicablePatchesW; pub const MsiEnumPatchesEx = thismodule.MsiEnumPatchesExW; pub const MsiQueryFeatureState = thismodule.MsiQueryFeatureStateW; pub const MsiQueryFeatureStateEx = thismodule.MsiQueryFeatureStateExW; pub const MsiUseFeature = thismodule.MsiUseFeatureW; pub const MsiUseFeatureEx = thismodule.MsiUseFeatureExW; pub const MsiGetFeatureUsage = thismodule.MsiGetFeatureUsageW; pub const MsiConfigureFeature = thismodule.MsiConfigureFeatureW; pub const MsiReinstallFeature = thismodule.MsiReinstallFeatureW; pub const MsiProvideComponent = thismodule.MsiProvideComponentW; pub const MsiProvideQualifiedComponent = thismodule.MsiProvideQualifiedComponentW; pub const MsiProvideQualifiedComponentEx = thismodule.MsiProvideQualifiedComponentExW; pub const MsiGetComponentPath = thismodule.MsiGetComponentPathW; pub const MsiGetComponentPathEx = thismodule.MsiGetComponentPathExW; pub const MsiProvideAssembly = thismodule.MsiProvideAssemblyW; pub const MsiQueryComponentState = thismodule.MsiQueryComponentStateW; pub const MsiEnumProducts = thismodule.MsiEnumProductsW; pub const MsiEnumProductsEx = thismodule.MsiEnumProductsExW; pub const MsiEnumRelatedProducts = thismodule.MsiEnumRelatedProductsW; pub const MsiEnumFeatures = thismodule.MsiEnumFeaturesW; pub const MsiEnumComponents = thismodule.MsiEnumComponentsW; pub const MsiEnumComponentsEx = thismodule.MsiEnumComponentsExW; pub const MsiEnumClients = thismodule.MsiEnumClientsW; pub const MsiEnumClientsEx = thismodule.MsiEnumClientsExW; pub const MsiEnumComponentQualifiers = thismodule.MsiEnumComponentQualifiersW; pub const MsiOpenProduct = thismodule.MsiOpenProductW; pub const MsiOpenPackage = thismodule.MsiOpenPackageW; pub const MsiOpenPackageEx = thismodule.MsiOpenPackageExW; pub const MsiGetPatchFileList = thismodule.MsiGetPatchFileListW; pub const MsiGetProductProperty = thismodule.MsiGetProductPropertyW; pub const MsiVerifyPackage = thismodule.MsiVerifyPackageW; pub const MsiGetFeatureInfo = thismodule.MsiGetFeatureInfoW; pub const MsiInstallMissingComponent = thismodule.MsiInstallMissingComponentW; pub const MsiInstallMissingFile = thismodule.MsiInstallMissingFileW; pub const MsiLocateComponent = thismodule.MsiLocateComponentW; pub const MsiSourceListClearAll = thismodule.MsiSourceListClearAllW; pub const MsiSourceListAddSource = thismodule.MsiSourceListAddSourceW; pub const MsiSourceListForceResolution = thismodule.MsiSourceListForceResolutionW; pub const MsiSourceListAddSourceEx = thismodule.MsiSourceListAddSourceExW; pub const MsiSourceListAddMediaDisk = thismodule.MsiSourceListAddMediaDiskW; pub const MsiSourceListClearSource = thismodule.MsiSourceListClearSourceW; pub const MsiSourceListClearMediaDisk = thismodule.MsiSourceListClearMediaDiskW; pub const MsiSourceListClearAllEx = thismodule.MsiSourceListClearAllExW; pub const MsiSourceListForceResolutionEx = thismodule.MsiSourceListForceResolutionExW; pub const MsiSourceListSetInfo = thismodule.MsiSourceListSetInfoW; pub const MsiSourceListGetInfo = thismodule.MsiSourceListGetInfoW; pub const MsiSourceListEnumSources = thismodule.MsiSourceListEnumSourcesW; pub const MsiSourceListEnumMediaDisks = thismodule.MsiSourceListEnumMediaDisksW; pub const MsiGetFileVersion = thismodule.MsiGetFileVersionW; pub const MsiGetFileHash = thismodule.MsiGetFileHashW; pub const MsiGetFileSignatureInformation = thismodule.MsiGetFileSignatureInformationW; pub const MsiGetShortcutTarget = thismodule.MsiGetShortcutTargetW; pub const MsiIsProductElevated = thismodule.MsiIsProductElevatedW; pub const MsiNotifySidChange = thismodule.MsiNotifySidChangeW; pub const MsiBeginTransaction = thismodule.MsiBeginTransactionW; pub const MsiDatabaseOpenView = thismodule.MsiDatabaseOpenViewW; pub const MsiViewGetError = thismodule.MsiViewGetErrorW; pub const MsiDatabaseGetPrimaryKeys = thismodule.MsiDatabaseGetPrimaryKeysW; pub const MsiDatabaseIsTablePersistent = thismodule.MsiDatabaseIsTablePersistentW; pub const MsiGetSummaryInformation = thismodule.MsiGetSummaryInformationW; pub const MsiSummaryInfoSetProperty = thismodule.MsiSummaryInfoSetPropertyW; pub const MsiSummaryInfoGetProperty = thismodule.MsiSummaryInfoGetPropertyW; pub const MsiOpenDatabase = thismodule.MsiOpenDatabaseW; pub const MsiDatabaseImport = thismodule.MsiDatabaseImportW; pub const MsiDatabaseExport = thismodule.MsiDatabaseExportW; pub const MsiDatabaseMerge = thismodule.MsiDatabaseMergeW; pub const MsiDatabaseGenerateTransform = thismodule.MsiDatabaseGenerateTransformW; pub const MsiDatabaseApplyTransform = thismodule.MsiDatabaseApplyTransformW; pub const MsiCreateTransformSummaryInfo = thismodule.MsiCreateTransformSummaryInfoW; pub const MsiRecordSetString = thismodule.MsiRecordSetStringW; pub const MsiRecordGetString = thismodule.MsiRecordGetStringW; pub const MsiRecordSetStream = thismodule.MsiRecordSetStreamW; pub const MsiSetProperty = thismodule.MsiSetPropertyW; pub const MsiGetProperty = thismodule.MsiGetPropertyW; pub const MsiFormatRecord = thismodule.MsiFormatRecordW; pub const MsiDoAction = thismodule.MsiDoActionW; pub const MsiSequence = thismodule.MsiSequenceW; pub const MsiEvaluateCondition = thismodule.MsiEvaluateConditionW; pub const MsiGetFeatureState = thismodule.MsiGetFeatureStateW; pub const MsiSetFeatureState = thismodule.MsiSetFeatureStateW; pub const MsiSetFeatureAttributes = thismodule.MsiSetFeatureAttributesW; pub const MsiGetComponentState = thismodule.MsiGetComponentStateW; pub const MsiSetComponentState = thismodule.MsiSetComponentStateW; pub const MsiGetFeatureCost = thismodule.MsiGetFeatureCostW; pub const MsiEnumComponentCosts = thismodule.MsiEnumComponentCostsW; pub const MsiGetFeatureValidStates = thismodule.MsiGetFeatureValidStatesW; pub const MsiGetSourcePath = thismodule.MsiGetSourcePathW; pub const MsiGetTargetPath = thismodule.MsiGetTargetPathW; pub const MsiSetTargetPath = thismodule.MsiSetTargetPathW; pub const MsiPreviewDialog = thismodule.MsiPreviewDialogW; pub const MsiPreviewBillboard = thismodule.MsiPreviewBillboardW; pub const CreateActCtx = thismodule.CreateActCtxW; pub const FindActCtxSectionString = thismodule.FindActCtxSectionStringW; }, .unspecified => if (@import("builtin").is_test) struct { pub const INSTALLUI_HANDLER = *opaque{}; pub const MSIPATCHSEQUENCEINFO = *opaque{}; pub const ACTCTX = *opaque{}; pub const MsiSetExternalUI = *opaque{}; pub const MsiEnableLog = *opaque{}; pub const MsiQueryProductState = *opaque{}; pub const MsiGetProductInfo = *opaque{}; pub const MsiGetProductInfoEx = *opaque{}; pub const MsiInstallProduct = *opaque{}; pub const MsiConfigureProduct = *opaque{}; pub const MsiConfigureProductEx = *opaque{}; pub const MsiReinstallProduct = *opaque{}; pub const MsiAdvertiseProductEx = *opaque{}; pub const MsiAdvertiseProduct = *opaque{}; pub const MsiProcessAdvertiseScript = *opaque{}; pub const MsiAdvertiseScript = *opaque{}; pub const MsiGetProductInfoFromScript = *opaque{}; pub const MsiGetProductCode = *opaque{}; pub const MsiGetUserInfo = *opaque{}; pub const MsiCollectUserInfo = *opaque{}; pub const MsiApplyPatch = *opaque{}; pub const MsiGetPatchInfo = *opaque{}; pub const MsiEnumPatches = *opaque{}; pub const MsiRemovePatches = *opaque{}; pub const MsiExtractPatchXMLData = *opaque{}; pub const MsiGetPatchInfoEx = *opaque{}; pub const MsiApplyMultiplePatches = *opaque{}; pub const MsiDeterminePatchSequence = *opaque{}; pub const MsiDetermineApplicablePatches = *opaque{}; pub const MsiEnumPatchesEx = *opaque{}; pub const MsiQueryFeatureState = *opaque{}; pub const MsiQueryFeatureStateEx = *opaque{}; pub const MsiUseFeature = *opaque{}; pub const MsiUseFeatureEx = *opaque{}; pub const MsiGetFeatureUsage = *opaque{}; pub const MsiConfigureFeature = *opaque{}; pub const MsiReinstallFeature = *opaque{}; pub const MsiProvideComponent = *opaque{}; pub const MsiProvideQualifiedComponent = *opaque{}; pub const MsiProvideQualifiedComponentEx = *opaque{}; pub const MsiGetComponentPath = *opaque{}; pub const MsiGetComponentPathEx = *opaque{}; pub const MsiProvideAssembly = *opaque{}; pub const MsiQueryComponentState = *opaque{}; pub const MsiEnumProducts = *opaque{}; pub const MsiEnumProductsEx = *opaque{}; pub const MsiEnumRelatedProducts = *opaque{}; pub const MsiEnumFeatures = *opaque{}; pub const MsiEnumComponents = *opaque{}; pub const MsiEnumComponentsEx = *opaque{}; pub const MsiEnumClients = *opaque{}; pub const MsiEnumClientsEx = *opaque{}; pub const MsiEnumComponentQualifiers = *opaque{}; pub const MsiOpenProduct = *opaque{}; pub const MsiOpenPackage = *opaque{}; pub const MsiOpenPackageEx = *opaque{}; pub const MsiGetPatchFileList = *opaque{}; pub const MsiGetProductProperty = *opaque{}; pub const MsiVerifyPackage = *opaque{}; pub const MsiGetFeatureInfo = *opaque{}; pub const MsiInstallMissingComponent = *opaque{}; pub const MsiInstallMissingFile = *opaque{}; pub const MsiLocateComponent = *opaque{}; pub const MsiSourceListClearAll = *opaque{}; pub const MsiSourceListAddSource = *opaque{}; pub const MsiSourceListForceResolution = *opaque{}; pub const MsiSourceListAddSourceEx = *opaque{}; pub const MsiSourceListAddMediaDisk = *opaque{}; pub const MsiSourceListClearSource = *opaque{}; pub const MsiSourceListClearMediaDisk = *opaque{}; pub const MsiSourceListClearAllEx = *opaque{}; pub const MsiSourceListForceResolutionEx = *opaque{}; pub const MsiSourceListSetInfo = *opaque{}; pub const MsiSourceListGetInfo = *opaque{}; pub const MsiSourceListEnumSources = *opaque{}; pub const MsiSourceListEnumMediaDisks = *opaque{}; pub const MsiGetFileVersion = *opaque{}; pub const MsiGetFileHash = *opaque{}; pub const MsiGetFileSignatureInformation = *opaque{}; pub const MsiGetShortcutTarget = *opaque{}; pub const MsiIsProductElevated = *opaque{}; pub const MsiNotifySidChange = *opaque{}; pub const MsiBeginTransaction = *opaque{}; pub const MsiDatabaseOpenView = *opaque{}; pub const MsiViewGetError = *opaque{}; pub const MsiDatabaseGetPrimaryKeys = *opaque{}; pub const MsiDatabaseIsTablePersistent = *opaque{}; pub const MsiGetSummaryInformation = *opaque{}; pub const MsiSummaryInfoSetProperty = *opaque{}; pub const MsiSummaryInfoGetProperty = *opaque{}; pub const MsiOpenDatabase = *opaque{}; pub const MsiDatabaseImport = *opaque{}; pub const MsiDatabaseExport = *opaque{}; pub const MsiDatabaseMerge = *opaque{}; pub const MsiDatabaseGenerateTransform = *opaque{}; pub const MsiDatabaseApplyTransform = *opaque{}; pub const MsiCreateTransformSummaryInfo = *opaque{}; pub const MsiRecordSetString = *opaque{}; pub const MsiRecordGetString = *opaque{}; pub const MsiRecordSetStream = *opaque{}; pub const MsiSetProperty = *opaque{}; pub const MsiGetProperty = *opaque{}; pub const MsiFormatRecord = *opaque{}; pub const MsiDoAction = *opaque{}; pub const MsiSequence = *opaque{}; pub const MsiEvaluateCondition = *opaque{}; pub const MsiGetFeatureState = *opaque{}; pub const MsiSetFeatureState = *opaque{}; pub const MsiSetFeatureAttributes = *opaque{}; pub const MsiGetComponentState = *opaque{}; pub const MsiSetComponentState = *opaque{}; pub const MsiGetFeatureCost = *opaque{}; pub const MsiEnumComponentCosts = *opaque{}; pub const MsiGetFeatureValidStates = *opaque{}; pub const MsiGetSourcePath = *opaque{}; pub const MsiGetTargetPath = *opaque{}; pub const MsiSetTargetPath = *opaque{}; pub const MsiPreviewDialog = *opaque{}; pub const MsiPreviewBillboard = *opaque{}; pub const CreateActCtx = *opaque{}; pub const FindActCtxSectionString = *opaque{}; } else struct { pub const INSTALLUI_HANDLER = @compileError("'INSTALLUI_HANDLER' requires that UNICODE be set to true or false in the root module"); pub const MSIPATCHSEQUENCEINFO = @compileError("'MSIPATCHSEQUENCEINFO' requires that UNICODE be set to true or false in the root module"); pub const ACTCTX = @compileError("'ACTCTX' requires that UNICODE be set to true or false in the root module"); pub const MsiSetExternalUI = @compileError("'MsiSetExternalUI' requires that UNICODE be set to true or false in the root module"); pub const MsiEnableLog = @compileError("'MsiEnableLog' requires that UNICODE be set to true or false in the root module"); pub const MsiQueryProductState = @compileError("'MsiQueryProductState' requires that UNICODE be set to true or false in the root module"); pub const MsiGetProductInfo = @compileError("'MsiGetProductInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiGetProductInfoEx = @compileError("'MsiGetProductInfoEx' requires that UNICODE be set to true or false in the root module"); pub const MsiInstallProduct = @compileError("'MsiInstallProduct' requires that UNICODE be set to true or false in the root module"); pub const MsiConfigureProduct = @compileError("'MsiConfigureProduct' requires that UNICODE be set to true or false in the root module"); pub const MsiConfigureProductEx = @compileError("'MsiConfigureProductEx' requires that UNICODE be set to true or false in the root module"); pub const MsiReinstallProduct = @compileError("'MsiReinstallProduct' requires that UNICODE be set to true or false in the root module"); pub const MsiAdvertiseProductEx = @compileError("'MsiAdvertiseProductEx' requires that UNICODE be set to true or false in the root module"); pub const MsiAdvertiseProduct = @compileError("'MsiAdvertiseProduct' requires that UNICODE be set to true or false in the root module"); pub const MsiProcessAdvertiseScript = @compileError("'MsiProcessAdvertiseScript' requires that UNICODE be set to true or false in the root module"); pub const MsiAdvertiseScript = @compileError("'MsiAdvertiseScript' requires that UNICODE be set to true or false in the root module"); pub const MsiGetProductInfoFromScript = @compileError("'MsiGetProductInfoFromScript' requires that UNICODE be set to true or false in the root module"); pub const MsiGetProductCode = @compileError("'MsiGetProductCode' requires that UNICODE be set to true or false in the root module"); pub const MsiGetUserInfo = @compileError("'MsiGetUserInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiCollectUserInfo = @compileError("'MsiCollectUserInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiApplyPatch = @compileError("'MsiApplyPatch' requires that UNICODE be set to true or false in the root module"); pub const MsiGetPatchInfo = @compileError("'MsiGetPatchInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumPatches = @compileError("'MsiEnumPatches' requires that UNICODE be set to true or false in the root module"); pub const MsiRemovePatches = @compileError("'MsiRemovePatches' requires that UNICODE be set to true or false in the root module"); pub const MsiExtractPatchXMLData = @compileError("'MsiExtractPatchXMLData' requires that UNICODE be set to true or false in the root module"); pub const MsiGetPatchInfoEx = @compileError("'MsiGetPatchInfoEx' requires that UNICODE be set to true or false in the root module"); pub const MsiApplyMultiplePatches = @compileError("'MsiApplyMultiplePatches' requires that UNICODE be set to true or false in the root module"); pub const MsiDeterminePatchSequence = @compileError("'MsiDeterminePatchSequence' requires that UNICODE be set to true or false in the root module"); pub const MsiDetermineApplicablePatches = @compileError("'MsiDetermineApplicablePatches' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumPatchesEx = @compileError("'MsiEnumPatchesEx' requires that UNICODE be set to true or false in the root module"); pub const MsiQueryFeatureState = @compileError("'MsiQueryFeatureState' requires that UNICODE be set to true or false in the root module"); pub const MsiQueryFeatureStateEx = @compileError("'MsiQueryFeatureStateEx' requires that UNICODE be set to true or false in the root module"); pub const MsiUseFeature = @compileError("'MsiUseFeature' requires that UNICODE be set to true or false in the root module"); pub const MsiUseFeatureEx = @compileError("'MsiUseFeatureEx' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFeatureUsage = @compileError("'MsiGetFeatureUsage' requires that UNICODE be set to true or false in the root module"); pub const MsiConfigureFeature = @compileError("'MsiConfigureFeature' requires that UNICODE be set to true or false in the root module"); pub const MsiReinstallFeature = @compileError("'MsiReinstallFeature' requires that UNICODE be set to true or false in the root module"); pub const MsiProvideComponent = @compileError("'MsiProvideComponent' requires that UNICODE be set to true or false in the root module"); pub const MsiProvideQualifiedComponent = @compileError("'MsiProvideQualifiedComponent' requires that UNICODE be set to true or false in the root module"); pub const MsiProvideQualifiedComponentEx = @compileError("'MsiProvideQualifiedComponentEx' requires that UNICODE be set to true or false in the root module"); pub const MsiGetComponentPath = @compileError("'MsiGetComponentPath' requires that UNICODE be set to true or false in the root module"); pub const MsiGetComponentPathEx = @compileError("'MsiGetComponentPathEx' requires that UNICODE be set to true or false in the root module"); pub const MsiProvideAssembly = @compileError("'MsiProvideAssembly' requires that UNICODE be set to true or false in the root module"); pub const MsiQueryComponentState = @compileError("'MsiQueryComponentState' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumProducts = @compileError("'MsiEnumProducts' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumProductsEx = @compileError("'MsiEnumProductsEx' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumRelatedProducts = @compileError("'MsiEnumRelatedProducts' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumFeatures = @compileError("'MsiEnumFeatures' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumComponents = @compileError("'MsiEnumComponents' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumComponentsEx = @compileError("'MsiEnumComponentsEx' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumClients = @compileError("'MsiEnumClients' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumClientsEx = @compileError("'MsiEnumClientsEx' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumComponentQualifiers = @compileError("'MsiEnumComponentQualifiers' requires that UNICODE be set to true or false in the root module"); pub const MsiOpenProduct = @compileError("'MsiOpenProduct' requires that UNICODE be set to true or false in the root module"); pub const MsiOpenPackage = @compileError("'MsiOpenPackage' requires that UNICODE be set to true or false in the root module"); pub const MsiOpenPackageEx = @compileError("'MsiOpenPackageEx' requires that UNICODE be set to true or false in the root module"); pub const MsiGetPatchFileList = @compileError("'MsiGetPatchFileList' requires that UNICODE be set to true or false in the root module"); pub const MsiGetProductProperty = @compileError("'MsiGetProductProperty' requires that UNICODE be set to true or false in the root module"); pub const MsiVerifyPackage = @compileError("'MsiVerifyPackage' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFeatureInfo = @compileError("'MsiGetFeatureInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiInstallMissingComponent = @compileError("'MsiInstallMissingComponent' requires that UNICODE be set to true or false in the root module"); pub const MsiInstallMissingFile = @compileError("'MsiInstallMissingFile' requires that UNICODE be set to true or false in the root module"); pub const MsiLocateComponent = @compileError("'MsiLocateComponent' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListClearAll = @compileError("'MsiSourceListClearAll' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListAddSource = @compileError("'MsiSourceListAddSource' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListForceResolution = @compileError("'MsiSourceListForceResolution' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListAddSourceEx = @compileError("'MsiSourceListAddSourceEx' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListAddMediaDisk = @compileError("'MsiSourceListAddMediaDisk' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListClearSource = @compileError("'MsiSourceListClearSource' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListClearMediaDisk = @compileError("'MsiSourceListClearMediaDisk' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListClearAllEx = @compileError("'MsiSourceListClearAllEx' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListForceResolutionEx = @compileError("'MsiSourceListForceResolutionEx' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListSetInfo = @compileError("'MsiSourceListSetInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListGetInfo = @compileError("'MsiSourceListGetInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListEnumSources = @compileError("'MsiSourceListEnumSources' requires that UNICODE be set to true or false in the root module"); pub const MsiSourceListEnumMediaDisks = @compileError("'MsiSourceListEnumMediaDisks' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFileVersion = @compileError("'MsiGetFileVersion' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFileHash = @compileError("'MsiGetFileHash' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFileSignatureInformation = @compileError("'MsiGetFileSignatureInformation' requires that UNICODE be set to true or false in the root module"); pub const MsiGetShortcutTarget = @compileError("'MsiGetShortcutTarget' requires that UNICODE be set to true or false in the root module"); pub const MsiIsProductElevated = @compileError("'MsiIsProductElevated' requires that UNICODE be set to true or false in the root module"); pub const MsiNotifySidChange = @compileError("'MsiNotifySidChange' requires that UNICODE be set to true or false in the root module"); pub const MsiBeginTransaction = @compileError("'MsiBeginTransaction' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseOpenView = @compileError("'MsiDatabaseOpenView' requires that UNICODE be set to true or false in the root module"); pub const MsiViewGetError = @compileError("'MsiViewGetError' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseGetPrimaryKeys = @compileError("'MsiDatabaseGetPrimaryKeys' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseIsTablePersistent = @compileError("'MsiDatabaseIsTablePersistent' requires that UNICODE be set to true or false in the root module"); pub const MsiGetSummaryInformation = @compileError("'MsiGetSummaryInformation' requires that UNICODE be set to true or false in the root module"); pub const MsiSummaryInfoSetProperty = @compileError("'MsiSummaryInfoSetProperty' requires that UNICODE be set to true or false in the root module"); pub const MsiSummaryInfoGetProperty = @compileError("'MsiSummaryInfoGetProperty' requires that UNICODE be set to true or false in the root module"); pub const MsiOpenDatabase = @compileError("'MsiOpenDatabase' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseImport = @compileError("'MsiDatabaseImport' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseExport = @compileError("'MsiDatabaseExport' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseMerge = @compileError("'MsiDatabaseMerge' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseGenerateTransform = @compileError("'MsiDatabaseGenerateTransform' requires that UNICODE be set to true or false in the root module"); pub const MsiDatabaseApplyTransform = @compileError("'MsiDatabaseApplyTransform' requires that UNICODE be set to true or false in the root module"); pub const MsiCreateTransformSummaryInfo = @compileError("'MsiCreateTransformSummaryInfo' requires that UNICODE be set to true or false in the root module"); pub const MsiRecordSetString = @compileError("'MsiRecordSetString' requires that UNICODE be set to true or false in the root module"); pub const MsiRecordGetString = @compileError("'MsiRecordGetString' requires that UNICODE be set to true or false in the root module"); pub const MsiRecordSetStream = @compileError("'MsiRecordSetStream' requires that UNICODE be set to true or false in the root module"); pub const MsiSetProperty = @compileError("'MsiSetProperty' requires that UNICODE be set to true or false in the root module"); pub const MsiGetProperty = @compileError("'MsiGetProperty' requires that UNICODE be set to true or false in the root module"); pub const MsiFormatRecord = @compileError("'MsiFormatRecord' requires that UNICODE be set to true or false in the root module"); pub const MsiDoAction = @compileError("'MsiDoAction' requires that UNICODE be set to true or false in the root module"); pub const MsiSequence = @compileError("'MsiSequence' requires that UNICODE be set to true or false in the root module"); pub const MsiEvaluateCondition = @compileError("'MsiEvaluateCondition' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFeatureState = @compileError("'MsiGetFeatureState' requires that UNICODE be set to true or false in the root module"); pub const MsiSetFeatureState = @compileError("'MsiSetFeatureState' requires that UNICODE be set to true or false in the root module"); pub const MsiSetFeatureAttributes = @compileError("'MsiSetFeatureAttributes' requires that UNICODE be set to true or false in the root module"); pub const MsiGetComponentState = @compileError("'MsiGetComponentState' requires that UNICODE be set to true or false in the root module"); pub const MsiSetComponentState = @compileError("'MsiSetComponentState' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFeatureCost = @compileError("'MsiGetFeatureCost' requires that UNICODE be set to true or false in the root module"); pub const MsiEnumComponentCosts = @compileError("'MsiEnumComponentCosts' requires that UNICODE be set to true or false in the root module"); pub const MsiGetFeatureValidStates = @compileError("'MsiGetFeatureValidStates' requires that UNICODE be set to true or false in the root module"); pub const MsiGetSourcePath = @compileError("'MsiGetSourcePath' requires that UNICODE be set to true or false in the root module"); pub const MsiGetTargetPath = @compileError("'MsiGetTargetPath' requires that UNICODE be set to true or false in the root module"); pub const MsiSetTargetPath = @compileError("'MsiSetTargetPath' requires that UNICODE be set to true or false in the root module"); pub const MsiPreviewDialog = @compileError("'MsiPreviewDialog' requires that UNICODE be set to true or false in the root module"); pub const MsiPreviewBillboard = @compileError("'MsiPreviewBillboard' requires that UNICODE be set to true or false in the root module"); pub const CreateActCtx = @compileError("'CreateActCtx' requires that UNICODE be set to true or false in the root module"); pub const FindActCtxSectionString = @compileError("'FindActCtxSectionString' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (18) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA = @import("../system/windows_programming.zig").ACTCTX_SECTION_KEYED_DATA_ASSEMBLY_METADATA; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const CERT_CONTEXT = @import("../security/cryptography/core.zig").CERT_CONTEXT; const FILETIME = @import("../foundation.zig").FILETIME; const HANDLE = @import("../foundation.zig").HANDLE; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HKEY = @import("../system/registry.zig").HKEY; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IDispatch = @import("../system/ole_automation.zig").IDispatch; const IStream = @import("../storage/structured_storage.zig").IStream; const IUnknown = @import("../system/com.zig").IUnknown; const LARGE_INTEGER = @import("../system/system_services.zig").LARGE_INTEGER; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const ULARGE_INTEGER = @import("../system/system_services.zig").ULARGE_INTEGER; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "LPDISPLAYVAL")) { _ = LPDISPLAYVAL; } if (@hasDecl(@This(), "LPEVALCOMCALLBACK")) { _ = LPEVALCOMCALLBACK; } if (@hasDecl(@This(), "INSTALLUI_HANDLERA")) { _ = INSTALLUI_HANDLERA; } if (@hasDecl(@This(), "INSTALLUI_HANDLERW")) { _ = INSTALLUI_HANDLERW; } if (@hasDecl(@This(), "PINSTALLUI_HANDLER_RECORD")) { _ = PINSTALLUI_HANDLER_RECORD; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
deps/zigwin32/win32/system/application_installation_and_servicing.zig
const std = @import("std"); const upaya = @import("upaya"); const editor = @import("../editor.zig"); usingnamespace @import("imgui"); var name_buf: [25]u8 = undefined; pub fn draw(state: *editor.AppState) void { igSetNextWindowSize(.{ .x = 500, .y = -1 }, ImGuiCond_Always); var open: bool = true; if (igBeginPopupModal("Component Editor", &open, ImGuiWindowFlags_AlwaysAutoResize)) { defer igEndPopup(); igColumns(2, "id", true); igSetColumnWidth(0, 150); igPushItemWidth(-1); if (igListBoxHeaderVec2("", .{})) { defer igListBoxFooter(); if (igSelectableBool("Transform", false, ImGuiSelectableFlags_DontClosePopups, .{})) {} if (igSelectableBool("BoxCollider", false, ImGuiSelectableFlags_DontClosePopups, .{})) {} } igPopItemWidth(); igNextColumn(); drawDetailsPane(state); igColumns(1, "id", false); if (ogButton("Add Component")) { igOpenPopup("##new-component"); std.mem.copy(u8, &name_buf, "NewComponent"); } igSetNextWindowPos(igGetIO().MousePos, ImGuiCond_Appearing, .{ .x = 0.5 }); if (igBeginPopup("##new-component", ImGuiWindowFlags_None)) { _ = ogInputText("##name", &name_buf, name_buf.len); if (igButton("Create Component", .{ .x = -1, .y = 0 })) { igCloseCurrentPopup(); const label_sentinel_index = std.mem.indexOfScalar(u8, &name_buf, 0).?; std.debug.print("new comp name: {s}\n", .{name_buf[0..label_sentinel_index]}); } igEndPopup(); } } } fn drawDetailsPane(state: *editor.AppState) void { if (igButton("Add Field", ImVec2{})) { igOpenPopup("##add-field"); } igPushItemWidth(igGetColumnWidth(1) / 2 - 20); _ = ogInputText("##key", &name_buf, name_buf.len); igSameLine(0, 5); _ = ogInputText("##value", &name_buf, name_buf.len); igSameLine(0, 5); igPopItemWidth(); if (ogButton(icons.trash)) {} addFieldPopup(state); } fn addFieldPopup(state: *editor.AppState) void { _ = state; igSetNextWindowPos(igGetIO().MousePos, ImGuiCond_Appearing, .{ .x = 0.5 }); if (igBeginPopup("##add-field", ImGuiWindowFlags_None)) { igText("Field Type"); if (igButton("bool", .{ .x = 100 })) { igCloseCurrentPopup(); } if (igButton("string", .{ .x = 100 })) { igCloseCurrentPopup(); } if (igButton("float", .{ .x = 100 })) { igCloseCurrentPopup(); } if (igButton("int", .{ .x = 100 })) { igCloseCurrentPopup(); } igEndPopup(); } }
examples/editor/windows/component_editor.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const template = @import("template.zig"); const rendering = @import("rendering/rendering.zig"); pub const ParseError = template.ParseError; pub const ParseErrorDetail = template.ParseErrorDetail; pub const ParseResult = template.ParseResult; pub const options = @import("options.zig"); pub const Delimiters = template.Delimiters; pub const Element = template.Element; pub const Template = template.Template; pub const parseText = template.parseText; pub const parseFile = template.parseFile; pub const parseComptime = template.parseComptime; pub const render = rendering.render; pub const renderWithOptions = rendering.renderWithOptions; pub const renderPartials = rendering.renderPartials; pub const renderPartialsWithOptions = rendering.renderPartialsWithOptions; pub const allocRender = rendering.allocRender; pub const allocRenderWithOptions = rendering.allocRenderWithOptions; pub const allocRenderPartials = rendering.allocRenderPartials; pub const allocRenderPartialsWithOptions = rendering.allocRenderPartialsWithOptions; pub const allocRenderZ = rendering.allocRenderZ; pub const allocRenderZWithOptions = rendering.allocRenderZWithOptions; pub const allocRenderZPartials = rendering.allocRenderZPartials; pub const allocRenderZPartialsWithOptions = rendering.allocRenderZPartialsWithOptions; pub const bufRender = rendering.bufRender; pub const bufRenderWithOptions = rendering.bufRenderWithOptions; pub const bufRenderPartials = rendering.bufRenderPartials; pub const bufRenderPartialsWithOptions = rendering.bufRenderPartialsWithOptions; pub const bufRenderZ = rendering.bufRenderZ; pub const bufRenderZWithOptions = rendering.bufRenderZWithOptions; pub const bufRenderZPartials = rendering.bufRenderZPartials; pub const bufRenderZPartialsWithOptions = rendering.bufRenderZPartialsWithOptions; pub const renderText = rendering.renderText; pub const renderTextWithOptions = rendering.renderTextWithOptions; pub const renderTextPartials = rendering.renderTextPartials; pub const renderTextPartialsWithOptions = rendering.renderTextPartialsWithOptions; pub const allocRenderText = rendering.allocRenderText; pub const allocRenderTextWithOptions = rendering.allocRenderTextWithOptions; pub const allocRenderTextPartials = rendering.allocRenderTextPartials; pub const allocRenderTextPartialsWithOptions = rendering.allocRenderTextPartialsWithOptions; pub const allocRenderTextZ = rendering.allocRenderTextZ; pub const allocRenderTextZWithOptions = rendering.allocRenderTextZWithOptions; pub const allocRenderTextZPartials = rendering.allocRenderTextZPartials; pub const allocRenderTextZPartialsWithOptions = rendering.allocRenderTextZPartialsWithOptions; pub const renderFile = rendering.renderFile; pub const renderFileWithOptions = rendering.renderFileWithOptions; pub const renderFilePartials = rendering.renderFilePartials; pub const renderFilePartialsWithOptions = rendering.renderFilePartialsWithOptions; pub const allocRenderFile = rendering.allocRenderFile; pub const allocRenderFileWithOptions = rendering.allocRenderFileWithOptions; pub const allocRenderFilePartials = rendering.allocRenderFilePartials; pub const allocRenderFilePartialsWithOptions = rendering.allocRenderFilePartialsWithOptions; pub const allocRenderFileZ = rendering.allocRenderFileZ; pub const allocRenderFileZWithOptions = rendering.allocRenderFileZWithOptions; pub const allocRenderFileZPartials = rendering.allocRenderFileZPartials; pub const allocRenderFileZPartialsWithOptions = rendering.allocRenderFileZPartialsWithOptions; pub const LambdaContext = rendering.LambdaContext; test { _ = template; _ = rendering; }
src/mustache.zig
const std = @import("std"); const audio = @import("audio.zig"); const console_ = @import("console.zig"); const Config = console_.Config; const Console = console_.Console; const Cpu = @import("cpu.zig").Cpu; const flags = @import("flags.zig"); const cpu_freq = 1789773; const frame_counter_rate = 1 / 240.0; const length_counter_table = [_]u8{ 10, 254, 20, 2, 40, 4, 80, 6, 160, 8, 60, 10, 14, 12, 26, 14, 12, 16, 24, 18, 48, 20, 96, 22, 192, 24, 72, 26, 16, 28, 32, 30, }; const pulse_duty_values = [4][8]u1{ [8]u1{ 0, 1, 0, 0, 0, 0, 0, 0 }, [8]u1{ 0, 1, 1, 0, 0, 0, 0, 0 }, [8]u1{ 0, 1, 1, 1, 1, 0, 0, 0 }, [8]u1{ 1, 0, 0, 1, 1, 1, 1, 1 }, }; const triangle_duty_values = [_]u4{ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }; pub fn Apu(comptime config: Config) type { return struct { const Self = @This(); cpu: *Cpu(config), reg: Registers, cycles: usize = 0, frame_counter: usize = 0, audio_context: *audio.Context(config.method), frame_counter_timer: CycleTimer = blk: { var timer = CycleTimer.init(@intToFloat(f32, cpu_freq) * frame_counter_rate); timer.setNext(); break :blk timer; }, output_timer: CycleTimer = blk: { const freq_f = @intToFloat(f32, cpu_freq); const sample_f = @intToFloat(f32, audio.Context(config.method).sample_rate); var timer = CycleTimer.init(freq_f / sample_f); timer.setNext(); break :blk timer; }, const CycleTimer = struct { period: f32, whole: usize, frac: f32, fn init(period: f32) CycleTimer { return CycleTimer{ .period = period, .whole = 0, .frac = 0, }; } fn setNext(self: *CycleTimer) void { self.frac += self.period; const mod = std.math.modf(self.frac); self.frac -= mod.ipart; self.whole += @floatToInt(usize, mod.ipart); } fn setNextFrom(self: *CycleTimer, cycle: usize) void { self.whole = cycle; self.frac = 0; self.setNext(); } fn isDone(self: CycleTimer, cycle: usize) bool { return self.whole == cycle; } }; pub const Registers = struct { pulse1: PulseChannel, pulse2: PulseChannel, triangle: TriangleChannel, noise: NoiseChannel, frame_counter_mode: u1 = 0, irq_inhibit: bool = false, frame_interrupt: bool = false, fn init() Registers { return Registers{ .pulse1 = PulseChannel.init(0), .pulse2 = PulseChannel.init(1), .triangle = std.mem.zeroes(TriangleChannel), .noise = NoiseChannel{}, }; } }; pub fn init(console: *Console(config), audio_context: *audio.Context(config.method)) Self { return Self{ .cpu = &console.cpu, .reg = Registers.init(), .audio_context = audio_context, }; } pub fn read(self: *Self, addr: u5) u8 { const reg = &self.reg; switch (addr) { 0x15 => { var val: u8 = 0; val |= @as(u7, @boolToInt(reg.frame_interrupt)) << 6; val |= @as(u4, @boolToInt(reg.noise.length_counter.value > 0)) << 3; val |= @as(u3, @boolToInt(reg.triangle.length_counter.value > 0)) << 2; val |= @as(u2, @boolToInt(reg.pulse2.length_counter.value > 0)) << 1; val |= @boolToInt(reg.pulse1.length_counter.value > 0); reg.frame_interrupt = false; self.cpu.clearIrqSource("apu_frame_counter"); return val; }, else => return 0, } } pub fn write(self: *Self, addr: u5, val: u8) void { // TODO: probably move these into functions in the registers const reg = &self.reg; switch (addr) { // pulse 0x00...0x03 => reg.pulse1.write(@truncate(u2, addr), val), 0x04...0x07 => reg.pulse2.write(@truncate(u2, addr), val), // triangle 0x08 => { reg.triangle.length_counter.halt = flags.getMaskBool(u8, val, 0x80); reg.triangle.linear_counter.period = @truncate(u7, val); }, 0x0a => { flags.setMask(u11, &reg.triangle.timer.period, val, 0xff); }, 0x0b => { reg.triangle.linear_counter.reload = true; reg.triangle.length_counter.setValue(length_counter_table[val >> 3]); flags.setMask(u11, &reg.triangle.timer.period, @as(u11, val) << 8, 0x700); }, // noise 0x0c => { reg.noise.length_counter.halt = flags.getMaskBool(u8, val, 0x20); reg.noise.envelope.constant_volume = flags.getMaskBool(u8, val, 0x10); reg.noise.envelope.divider_period = @truncate(u4, val); }, 0x0e => { reg.noise.mode = flags.getMaskBool(u8, val, 0x80); const period_table = [_]u13{ 4, 8, 16, 32, 64, 96, 128, 160, 202, 254, 380, 508, 762, 1016, 2034, 4068, }; reg.noise.timer.period = period_table[@truncate(u4, val)]; }, 0x0f => { reg.noise.length_counter.setValue(length_counter_table[val >> 3]); reg.noise.envelope.start = true; }, 0x15 => { _ = flags.getMaskBool(u8, val, 0x10); // DMC enable reg.noise.length_counter.setEnabled(flags.getMaskBool(u8, val, 0x08)); reg.triangle.length_counter.setEnabled(flags.getMaskBool(u8, val, 0x04)); reg.pulse2.length_counter.setEnabled(flags.getMaskBool(u8, val, 0x02)); reg.pulse1.length_counter.setEnabled(flags.getMaskBool(u8, val, 0x01)); }, 0x17 => { // TODO: not sure if accurate reg.frame_counter_mode = @truncate(u1, val >> 7); reg.irq_inhibit = flags.getMaskBool(u8, val, 0x40); if (reg.irq_inhibit) { reg.frame_interrupt = false; self.cpu.clearIrqSource("apu_frame_counter"); } self.frame_counter_timer.setNextFrom(self.cycles); self.frame_counter = 0; if (reg.frame_counter_mode == 1) { self.stepQuarterFrame(); self.stepHalfFrame(); } }, else => {}, } } fn stepQuarterFrame(self: *Self) void { self.reg.pulse1.stepEnvelope(); self.reg.pulse2.stepEnvelope(); self.reg.triangle.stepLinear(); self.reg.noise.stepEnvelope(); } fn stepHalfFrame(self: *Self) void { _ = self.reg.pulse1.length_counter.step(); _ = self.reg.pulse2.length_counter.step(); _ = self.reg.triangle.length_counter.step(); _ = self.reg.noise.length_counter.step(); self.reg.pulse1.stepSweep(); self.reg.pulse2.stepSweep(); } fn getOutput(self: *Self) f32 { const p1_out = @intToFloat(f32, self.reg.pulse1.output()); const p2_out = @intToFloat(f32, self.reg.pulse2.output()); const pulse_out = 0.00752 * (p1_out + p2_out); const tri_out = @intToFloat(f32, self.reg.triangle.output()); const noise_out = @intToFloat(f32, self.reg.noise.output()); const tnd_out = 0.00851 * tri_out + 0.00494 * noise_out; return pulse_out + tnd_out; } pub fn runCycle(self: *Self) void { self.reg.triangle.stepTimer(); if (self.cycles & 1 == 1) { self.reg.pulse1.stepTimer(); self.reg.pulse2.stepTimer(); self.reg.noise.stepTimer(); } if (self.frame_counter_timer.isDone(self.cycles)) { if (self.reg.frame_counter_mode == 0) { switch (@truncate(u2, self.frame_counter)) { 0, 2 => { self.stepQuarterFrame(); }, 1 => { self.stepQuarterFrame(); self.stepHalfFrame(); }, 3 => { self.stepQuarterFrame(); self.stepHalfFrame(); if (!self.reg.irq_inhibit) { self.reg.frame_interrupt = true; self.cpu.setIrqSource("apu_frame_counter"); } }, } } else { switch (self.frame_counter % 5) { 0, 2 => { self.stepQuarterFrame(); }, 1 => { self.stepQuarterFrame(); self.stepHalfFrame(); }, 3 => {}, 4 => { self.stepQuarterFrame(); self.stepHalfFrame(); }, else => unreachable, } } self.frame_counter +%= 1; self.frame_counter_timer.setNext(); } if (self.output_timer.isDone(self.cycles)) { self.audio_context.addSample(self.getOutput()) catch { std.log.err("Couldn't add sample", .{}); }; self.output_timer.setNext(); } self.cycles +%= 1; } }; } fn Timer(comptime T: type) type { return struct { value: T = 0, period: T = 0, fn reset(self: *Timer(T)) void { self.value = self.period; } }; } const LengthCounter = struct { enabled: bool = false, halt: bool = false, value: u8 = 0, fn setEnabled(self: *LengthCounter, enabled: bool) void { self.enabled = enabled; if (!enabled) { self.value = 0; } } fn setValue(self: *LengthCounter, val: u8) void { if (self.enabled) { self.value = val; } } fn gate(self: LengthCounter) bool { return self.value != 0; } fn step(self: *LengthCounter) bool { const condition = self.enabled and !self.halt and self.value != 0; if (condition) { self.value -= 1; } return condition; } }; const Envelope = struct { start: bool = false, constant_volume: bool = false, divider_counter: u5 = 0, divider_period: u4 = 0, decay_level_counter: u4 = 0, fn step(self: *Envelope, loop: bool) void { if (self.start) { self.start = false; self.decay_level_counter = 15; self.divider_counter = self.divider_period; return; } if (self.divider_counter == 0) { self.divider_counter = self.divider_period; } else { self.divider_counter -= 1; return; } if (self.decay_level_counter != 0) { self.decay_level_counter -= 1; return; } if (loop) { self.decay_level_counter = 15; } } fn output(self: Envelope) u4 { if (self.constant_volume) { return self.divider_period; } else { return self.decay_level_counter; } } }; const PulseChannel = struct { duty_table: u2 = 0, duty_index: u3 = 0, timer: Timer(u11) = Timer(u11){}, length_counter: LengthCounter = LengthCounter{}, sweep: Sweep, envelope: Envelope = Envelope{}, // maybe put timer in sweep? const Sweep = struct { channel: u1, enabled: bool = false, negate: bool = false, reload: bool = false, divider_counter: u4 = 0, divider_period: u3 = 0, shift_count: u3 = 0, target_period: u12 = 0, fn isMuting(self: Sweep, timer: Timer(u11)) bool { return timer.period < 8 or flags.getMaskBool(u12, self.target_period, 0x800); } fn step(self: *Sweep, timer: *Timer(u11)) void { var delta: u12 = timer.period >> self.shift_count; if (self.negate) { delta = ~delta; if (self.channel == 1) { delta +%= 1; } } self.target_period = @as(u12, timer.period) +% delta; if (self.divider_counter == 0 and self.enabled and !self.isMuting(timer.*) and self.shift_count != 0) { timer.period = @truncate(u11, self.target_period); } if (self.divider_counter == 0 or self.reload) { self.divider_counter = self.divider_period; self.reload = false; } else { self.divider_counter -= 1; } } }; fn init(channel: u1) PulseChannel { return PulseChannel{ .sweep = Sweep{ .channel = channel, }, }; } fn write(self: *PulseChannel, addr: u2, val: u8) void { switch (addr) { 0x00 => { self.duty_table = @truncate(u2, val >> 6); self.length_counter.halt = flags.getMaskBool(u8, val, 0x20); self.envelope.constant_volume = flags.getMaskBool(u8, val, 0x10); self.envelope.divider_period = @truncate(u4, val); }, 0x01 => { self.sweep.enabled = (val & 0x80) != 0; self.sweep.negate = (val & 0x08) != 0; self.sweep.reload = true; self.sweep.divider_period = @truncate(u3, val >> 4); self.sweep.shift_count = @truncate(u3, val); }, 0x02 => { flags.setMask(u11, &self.timer.period, val, 0xff); }, 0x03 => { self.length_counter.setValue(length_counter_table[val >> 3]); flags.setMask(u11, &self.timer.period, @as(u11, val) << 8, 0x700); self.duty_index = 0; self.envelope.start = true; }, } } fn stepTimer(self: *PulseChannel) void { if (self.timer.value == 0) { self.timer.reset(); self.duty_index -%= 1; } else { self.timer.value -= 1; } } fn stepSweep(self: *PulseChannel) void { self.sweep.step(&self.timer); } fn stepEnvelope(self: *PulseChannel) void { self.envelope.step(self.length_counter.halt); } fn gateSweep(self: PulseChannel) bool { return !self.sweep.isMuting(self.timer); } fn gateSequencer(self: PulseChannel) bool { return pulse_duty_values[self.duty_table][self.duty_index] != 0; } fn output(self: PulseChannel) u4 { if (self.gateSweep() and self.gateSequencer() and self.length_counter.gate()) { return self.envelope.output(); } return 0; } }; const TriangleChannel = struct { duty_index: u5, timer: Timer(u11), linear_counter: LinearCounter, length_counter: LengthCounter, const LinearCounter = struct { value: u7, period: u7, reload: bool, fn reset(self: *LinearCounter) void { self.value = self.period; } }; fn stepTimer(self: *TriangleChannel) void { if (self.timer.value == 0) { self.timer.reset(); if (self.length_counter.value > 0 and self.linear_counter.value > 0 and self.timer.period > 2) { self.duty_index +%= 1; } } else { self.timer.value -= 1; } } fn stepLinear(self: *TriangleChannel) void { if (self.linear_counter.reload) { self.linear_counter.reset(); } else if (self.linear_counter.value > 0) { self.linear_counter.value -= 1; } if (!self.length_counter.halt) { self.linear_counter.reload = false; } } fn gateLinearCounter(self: TriangleChannel) bool { return self.linear_counter.value != 0; } fn output(self: TriangleChannel) u4 { return triangle_duty_values[self.duty_index]; } }; pub const NoiseChannel = struct { timer: Timer(u13) = Timer(u13){}, length_counter: LengthCounter = LengthCounter{}, envelope: Envelope = Envelope{}, shift: u15 = 1, mode: bool = false, fn stepTimer(self: *NoiseChannel) void { if (self.timer.value == 0) { self.timer.reset(); const second_bit = if (self.mode) @as(u3, 6) else 1; const feedback: u1 = @truncate(u1, (self.shift & 1) ^ (self.shift >> second_bit)); self.shift >>= 1; flags.setMask(u15, &self.shift, @as(u15, feedback) << 14, 0x4000); } else { self.timer.value -= 1; } } fn stepEnvelope(self: *NoiseChannel) void { self.envelope.step(self.length_counter.halt); } fn gateShift(self: NoiseChannel) bool { return !flags.getMaskBool(u15, self.shift, 1); } fn output(self: NoiseChannel) u4 { if (self.gateShift() and self.length_counter.gate()) { return self.envelope.output(); } return 0; } };
src/apu.zig
const c = @import("c.zig"); const std = @import("std"); const Context = @import("context.zig").Context; const Device = @import("device.zig").Device; const fromLibusb = @import("constructor.zig").fromLibusb; const err = @import("error.zig"); pub const DeviceHandle = struct { ctx: *Context, raw: *c.libusb_device_handle, interfaces: u256, pub fn deinit(self: DeviceHandle) void { var iface: u9 = 0; while (iface < 256) : (iface += 1) { if ((self.interfaces >> @truncate(u8, iface)) & 1 == 1) { _ = c.libusb_release_interface(self.raw, @as(c_int, iface)); } } c.libusb_close(self.raw); } pub fn claimInterface(self: *DeviceHandle, iface: u8) err.Error!void { try err.failable(c.libusb_claim_interface(self.raw, @as(c_int, iface))); self.interfaces |= @as(u256, 1) << iface; } pub fn releaseInterface(self: *DeviceHandle, iface: u8) err.Error!void { try err.failable(c.libusb_release_interface(self.raw, @as(c_int, iface))); self.interfaces &= ~(@as(u256, 1) << iface); } pub fn device(self: DeviceHandle) Device { return fromLibusb(Device, .{ self.ctx, c.libusb_get_device(self.raw).? }); } pub fn writeControl( self: DeviceHandle, requestType: u8, request: u8, value: u16, index: u16, buf: []const u8, timeout_ms: u64, ) (error{Overflow} || err.Error)!usize { if (requestType & c.LIBUSB_ENDPOINT_DIR_MASK != c.LIBUSB_ENDPOINT_OUT) { return error.InvalidParam; } const res = c.libusb_control_transfer( self.raw, requestType, request, value, index, @intToPtr([*c]u8, @ptrToInt(buf.ptr)), try std.math.cast(u16, buf.len), try std.math.cast(c_uint, timeout_ms), ); if (res < 0) { return err.errorFromLibusb(res); } else { return @intCast(usize, res); } } pub fn readInterrupt( self: DeviceHandle, endpoint: u8, buf: []u8, timeout_ms: u64, ) (error{Overflow} || err.Error)!usize { if (endpoint & c.LIBUSB_ENDPOINT_DIR_MASK != c.LIBUSB_ENDPOINT_IN) { return error.InvalidParam; } var transferred: c_int = undefined; const ret = c.libusb_interrupt_transfer( self.raw, endpoint, buf.ptr, try std.math.cast(c_int, buf.len), &transferred, try std.math.cast(c_uint, timeout_ms), ); if (ret == 0 or ret == c.LIBUSB_ERROR_INTERRUPTED and transferred > 0) { return @intCast(usize, transferred); } else { return err.errorFromLibusb(ret); } } pub fn writeInterrupt( self: DeviceHandle, endpoint: u8, buf: []const u8, timeout_ms: u64, ) (error{Overflow} || err.Error)!usize { if (endpoint & c.LIBUSB_ENDPOINT_DIR_MASK != c.LIBUSB_ENDPOINT_OUT) { return error.InvalidParam; } var transferred: c_int = undefined; const ret = c.libusb_interrupt_transfer( self.raw, endpoint, @intToPtr([*c]u8, @ptrToInt(buf.ptr)), try std.math.cast(c_int, buf.len), &transferred, try std.math.cast(c_uint, timeout_ms), ); if (ret == 0 or ret == c.LIBUSB_ERROR_INTERRUPTED and transferred > 0) { return @intCast(usize, transferred); } else { return err.errorFromLibusb(ret); } } };
src/device_handle.zig
const std = @import("std"); const input = @embedFile("data/input09"); usingnamespace @import("util.zig"); pub fn main() !void { var allocator_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer allocator_state.deinit(); const allocator = &allocator_state.allocator; const values = try parse(allocator, input); const part1 = try firstInvalidNumber(25, values); const part2 = try findWeakness(25, values, part1); print("[Part1] First invalid number: {}", .{part1}); print("[Part2] Weakness: {}", .{part2}); } fn parse(allocator: *std.mem.Allocator, inputStr: []const u8) ![]usize { var values = std.ArrayList(usize).init(allocator); errdefer values.deinit(); var reader = uintLines(usize, inputStr); while (try reader.next()) |value| { try values.append(value); } return values.toOwnedSlice(); } fn firstInvalidNumber(comptime preambleSize: usize, values: []usize) !usize { var preamble = Preamble(preambleSize){}; for (values) |value| { if (preamble.isFull() and !preamble.isSumOfTwoNumbers(value)) { return value; } preamble.push(value); } return error.NoInvalidNumber; } fn findWeakness(comptime preambleSize: usize, values: []usize, invalidNumber: usize) !usize { var range_start: usize = 0; var range_end: usize = 0; var sum: usize = 0; while (range_end < values.len) : (range_end += 1) { sum += values[range_end]; if (sum == invalidNumber) { var min: usize = std.math.maxInt(usize); var max: usize = 0; for (values[range_start..range_end+1]) |v| { min = std.math.min(min, v); max = std.math.max(max, v); } return min + max; } else if (sum > invalidNumber) { range_start += 1; range_end = range_start + 1; sum = values[range_start] + values[range_end]; } } return error.NoWeakness; } fn Preamble(comptime size: usize) type { return struct { const Self = @This(); values: [size]usize = std.mem.zeroes([size]usize), insert_pos: usize = 0, count: usize = 0, pub fn push(self: *Self, val: usize) void { self.values[self.insert_pos] = val; self.insert_pos = (self.insert_pos + 1) % size; self.count = std.math.min(size, self.count + 1); } pub fn isFull(self: Self) bool { return self.count == size; } pub fn isSumOfTwoNumbers(self: Self, value: usize) bool { for (self.values) |a, i| { for (self.values[(i + 1)..]) |b| { if ((a + b) == value) { return true; } } } return false; } }; } const expectEqual = std.testing.expectEqual; const testInput = \\35 \\20 \\15 \\25 \\47 \\40 \\62 \\55 \\65 \\95 \\102 \\117 \\150 \\182 \\127 \\219 \\299 \\277 \\309 \\576 ; test "firstInvalidNumber" { var allocator_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer allocator_state.deinit(); const allocator = &allocator_state.allocator; expectEqual(@as(usize, 127), try firstInvalidNumber(5, try parse(allocator, testInput))); } test "findWeakness" { var allocator_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer allocator_state.deinit(); const allocator = &allocator_state.allocator; expectEqual(@as(usize, 62), try findWeakness(5, try parse(allocator, testInput), 127)); }
src/day09.zig
const std = @import("std"); const slimy = @import("slimy.zig"); export fn searchInit( world_seed: i64, threshold: i32, x0: i32, x1: i32, z0: i32, z1: i32, ) ?*AsyncSearcher { return AsyncSearcher.init(std.heap.page_allocator, .{ .world_seed = world_seed, .threshold = threshold, .x0 = x0, .x1 = x1, .z0 = z0, .z1 = z1, .method = .{ .cpu = 1 }, }) catch null; } export fn searchStep(searcher: *AsyncSearcher) bool { return searcher.step(); } export fn searchProgress(searcher: *AsyncSearcher) f64 { return searcher.progress; } export fn searchDeinit(searcher: *AsyncSearcher) void { searcher.deinit(); } const AsyncSearcher = struct { allocator: std.mem.Allocator, progress: f64 = 0, done: bool = false, frame: anyframe = undefined, frame_storage: @Frame(search) = undefined, pub fn init(allocator: std.mem.Allocator, params: slimy.SearchParams) !*AsyncSearcher { const self = try allocator.create(AsyncSearcher); self.* = .{ .allocator = allocator }; self.frame_storage = async self.search(params); return self; } pub fn deinit(self: *AsyncSearcher) void { self.allocator.destroy(self); } pub fn step(self: *AsyncSearcher) bool { if (!self.done) { resume self.frame; } return !self.done; } fn yield(self: *AsyncSearcher) void { suspend { self.frame = @frame(); } } fn search(self: *AsyncSearcher, params: slimy.SearchParams) void { self.yield(); slimy.cpu.Searcher(*AsyncSearcher) .init(params, self) .searchSinglethread(); self.done = true; } pub fn reportResult(_: *AsyncSearcher, res: slimy.Result) void { resultCallback(res.x, res.z, res.count); } pub fn reportProgress(self: *AsyncSearcher, completed: u64, total: u64) void { const resolution = 10_000; const progress = resolution * completed / total; const fraction = @intToFloat(f64, progress) / resolution; self.progress = fraction; self.yield(); } }; extern "slimy" fn resultCallback(x: i32, z: i32, count: u32) void; fn debugLog(comptime fmt: []const u8, args: anytype) void { var buf: [4096]u8 = undefined; const str = std.fmt.bufPrint(&buf, fmt, args) catch return; consoleLog(str.ptr, str.len); } extern "slimy" fn consoleLog(ptr: [*]const u8, len: usize) void;
src/web.zig
const std = @import("std"); const Builder = std.build.Builder; const Pkg = std.build.Pkg; const FileSource = std.build.FileSource; const examples = [3][]const u8{ "analogWrite", "rgb_led", "random" }; const uno = std.zig.CrossTarget{ .cpu_arch = .avr, .cpu_model = .{ .explicit = &std.Target.avr.cpu.atmega328p }, .os_tag = .freestanding, .abi = .none, }; pub fn build(b: *Builder) !void { const exe = b.addExecutable("avr-arduino-zig", "boilerplate/start.zig"); exe.setTarget(uno); exe.setBuildMode(.ReleaseSafe); const example = b.option( []const u8, "example", "Specify the example name", ) orelse "analogWrite"; const UART = Pkg{ .name = "uart", .path = FileSource{ .path = "boilerplate/uart.zig" } }; const GPIO = Pkg{ .name = "gpio", .path = FileSource{ .path = "boilerplate/gpio.zig" } }; inline for (examples) |entry| { if (std.mem.eql(u8, example, entry)) { exe.addPackage(Pkg{ .name = "main", .path = FileSource{ .path = "examples/" ++ entry ++ ".zig" }, .dependencies = &.{ UART, GPIO } }); break; } } exe.bundle_compiler_rt = false; exe.setLinkerScriptPath(FileSource{ .path = "boilerplate/linker.ld" }); exe.install(); const tty = b.option( []const u8, "tty", "Specify the port to which the Arduino is connected (defaults to /dev/ttyACM1)", ) orelse "/dev/ttyACM1"; const bin_path = b.getInstallPath(exe.install_step.?.dest_dir, exe.out_filename); const flash_command = blk: { var tmp = std.ArrayList(u8).init(b.allocator); try tmp.appendSlice("-Uflash:w:"); try tmp.appendSlice(bin_path); try tmp.appendSlice(":e"); break :blk tmp.toOwnedSlice(); }; const upload = b.step("upload", "Upload the code to an Arduino device using avrdude"); const avrdude = b.addSystemCommand(&.{ "avrdude", "-carduino", "-patmega328p", "-D", "-P", tty, flash_command, }); upload.dependOn(&avrdude.step); avrdude.step.dependOn(&exe.install_step.?.step); const objdump = b.step("objdump", "Show dissassembly of the code using avr-objdump"); const avr_objdump = b.addSystemCommand(&.{ "avr-objdump", "-dh", bin_path, }); objdump.dependOn(&avr_objdump.step); avr_objdump.step.dependOn(&exe.install_step.?.step); const monitor = b.step("monitor", "Opens a monitor to the serial output"); const screen = b.addSystemCommand(&.{ "screen", tty, "115200", }); monitor.dependOn(&screen.step); b.default_step.dependOn(&exe.step); }
build.zig
const sf = struct { pub usingnamespace @import("../sfml.zig"); pub usingnamespace sf.audio; }; const Sound = @This(); // Constructor/destructor /// Inits an empty sound pub fn create() !Sound { var sound = sf.c.sfSound_create(); if (sound == null) return sf.Error.nullptrUnknownReason; return Sound{ ._ptr = sound.? }; } /// Inits a sound with a SoundBuffer object pub fn createFromBuffer(buffer: sf.SoundBuffer) !Sound { var sound = try Sound.create(); sound.setBuffer(buffer); return sound; } /// Destroys this sound object pub fn destroy(self: *Sound) void { sf.c.sfSound_destroy(self._ptr); } // Sound control functions /// Plays the sound pub fn play(self: *Sound) void { sf.c.sfSound_play(self._ptr); } /// Pauses the sound pub fn pause(self: *Sound) void { sf.c.sfSound_pause(self._ptr); } /// Stops the sound and resets the player position pub fn stop(self: *Sound) void { sf.c.sfSound_stop(self._ptr); } // Getters / Setters /// Gets the buffer this sound is attached to pub fn getBuffer(self: Sound) ?sf.SoundBuffer { var buf = sf.c.sfSound_getBuffer(self._ptr); if (buf) |buffer| { return .{ ._ptr = buffer }; } else return null; } /// Sets the buffer this sound will play pub fn setBuffer(self: *Sound, buffer: sf.SoundBuffer) void { sf.c.sfSound_setBuffer(self._ptr, buffer._ptr); } /// Gets the current playing offset of the sound pub fn getPlayingOffset(self: Sound) sf.Time { return sf.Time._fromCSFML(sf.c.sfSound_getPlayingOffset(self._ptr)); } /// Sets the current playing offset of the sound pub fn setPlayingOffset(self: *Sound, offset: sf.Time) void { sf.c.sfSound_setPlayingOffset(self._ptr, offset._toCSFML()); } /// Tells whether or not this sound is in loop mode pub fn getLoop(self: Sound) bool { return sf.c.sfSound_getLoop(self._ptr) != 0; } /// Enable or disable auto loop pub fn setLoop(self: *Sound, loop: bool) void { sf.c.sfSound_setLoop(self._ptr, @boolToInt(loop)); } /// Sets the pitch of the sound pub fn getPitch(self: Sound) f32 { return sf.c.sfSound_getPitch(self._ptr); } /// Gets the pitch of the sound pub fn setPitch(self: *Sound, pitch: f32) void { sf.c.sfSound_setPitch(self._ptr, pitch); } /// Sets the volume of the sound pub fn getVolume(self: Sound) f32 { return sf.c.sfSound_getVolume(self._ptr); } /// Gets the volume of the sound pub fn setVolume(self: *Sound, volume: f32) void { sf.c.sfSound_setVolume(self._ptr, volume); } pub const getStatus = @compileError("Function is not implemented yet."); pub const setRelativeToListener = @compileError("Function is not implemented yet."); pub const isRelativeToListener = @compileError("Function is not implemented yet."); pub const setMinDistance = @compileError("Function is not implemented yet."); pub const setAttenuation = @compileError("Function is not implemented yet."); pub const getMinDistance = @compileError("Function is not implemented yet."); pub const getAttenuation = @compileError("Function is not implemented yet."); /// Pointer to the csfml sound _ptr: *sf.c.sfSound,
src/sfml/audio/Sound.zig
pub const preamble = @import("../preamble.zig"); usingnamespace preamble; const log = lib.output.log.scoped(.{ .prefix = "Stivale2", .filter = .info, }).write; const memory = os.memory; const platform = os.platform; const drivers = os.drivers; const libalign = lib.util.libalign; const builtin = std.builtin; var display: os.drivers.output.single_mode_display.SingleModeDisplay = undefined; var display_buffer: lib.graphics.single_buffer.SingleBuffer = undefined; pub const putchar = os.kernel.logger.putch; const MemmapEntry = packed struct { base: u64, length: u64, kind: u32, unused: u32, pub fn format( self: *const MemmapEntry, fmt: anytype, ) void { fmt("Base: 0x{0X}, length: 0x{0X}, type=0x{0X}", .{ self.base, self.length, self.kind, }); } }; const Tag = packed struct { identifier: u64, next: ?*Tag, pub fn format(self: *const @This(), fmt: anytype) void { @compileError("Cannot format stivale2 tags"); } }; const Info = packed struct { bootloader_brand: [64]u8, bootloader_version: [64]u8, tags: ?*Tag, pub fn format(self: *const @This(), fmt: anytype) void { fmt( \\Bootloader info: \\ Bootloader brand: {s} \\ Bootloader version: {s} \\ , .{ @ptrCast([*:0]const u8, &self.bootloader_brand[0]), @ptrCast([*:0]const u8, &self.bootloader_version[0]), }); } }; const MemmapTag = packed struct { tag: Tag, entries: u64, pub fn get(self: *const @This()) []MemmapEntry { return @intToPtr([*]MemmapEntry, @ptrToInt(&self.entries) + 8)[0..self.entries]; } pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("{d} entries:\n", .{self.entries}); for (self.get()) |ent| { fmt(" {}\n", .{ent}); } } }; const CmdLineTag = packed struct { tag: Tag, commandline: [*:0]u8, pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("Commandline: {s}", .{self.commandline}); } }; const FramebufferTag = packed struct { tag: Tag, addr: u64, width: u16, height: u16, pitch: u16, bpp: u16, pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("0x{X}, {d}x{d}, bpp={d}, pitch={d}", .{ self.addr, self.width, self.height, self.bpp, self.pitch, }); } }; const RsdpTag = packed struct { tag: Tag, rsdp: u64, }; const SMPTag = packed struct { tag: Tag, flags: u64, bsp_lapic_id: u32, _: u32, entries: u64, pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("{} CPU(s): {}", .{ self.entries, self.get() }); } pub fn get(self: *const @This()) []CoreInfo { return @intToPtr([*]CoreInfo, @ptrToInt(&self.entries) + 8)[0..self.entries]; } }; const CoreInfo = extern struct { acpi_proc_uid: u32, lapic_id: u32, target_stack: u64, goto_address: u64, argument: u64, }; const Mmio32UartTag = packed struct { tag: Tag, uart_addr: u64, pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("0x{X}", .{self.uart_addr}); } }; const Mmio32StatusUartTag = packed struct { tag: Tag, uart_addr: u64, uart_status: u64, status_mask: u32, status_value: u32, pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("0x{X}, 0x{X}, (val & 0x{X}) == 0x{X}", .{ self.uart_addr, self.uart_status, self.status_mask, self.status_value, }); } }; const DtbTag = packed struct { tag: Tag, addr: [*]u8, size: u64, pub fn slice(self: *const @This()) []u8 { return self.addr[0..self.size]; } pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("0x{X} bytes at 0x{X}", .{ self.size, @ptrToInt(self.addr) }); } }; const KernelFileTag = packed struct { tag: Tag, addr: u64, pub fn format( self: *const @This(), fmt: anytype, ) void { fmt("ELF at 0x{X}", .{self.addr}); } }; const ParsedInfo = struct { memmap: ?*MemmapTag = null, framebuffer: ?FramebufferTag = null, rsdp: ?platform.phys_ptr([*]u8) = null, smp: ?platform.phys_ptr(*SMPTag) = null, dtb: ?DtbTag = null, uart: ?Mmio32UartTag = null, uart_status: ?Mmio32StatusUartTag = null, kernel_file: ?KernelFileTag = null, pub fn valid(self: *const ParsedInfo) bool { if (self.memmap == null) return false; return true; } pub fn format( self: *const ParsedInfo, fmt: anytype, ) void { fmt( \\Parsed tag dump: \\ MemmapTag: {} \\ FramebufferTag: {} \\ RSDP: {} \\ SMP: {} \\ DTB: {} \\ UART: {} \\ UART with status: {} \\ Kernel file: {} \\ , .{ self.memmap.?, self.framebuffer, self.rsdp, self.smp, self.dtb, self.uart, self.uart_status, self.kernel_file, }); } }; fn consumePhysMem(ent: *const MemmapEntry) void { if (ent.kind == 1) { log(.info, "Consuming 0x{0X} to 0x{0X}", .{ ent.base, ent.base + ent.length }); os.memory.pmm.consume(ent.base, ent.length); } } fn mapPhys(ent: *const MemmapEntry, context: *platform.paging.PagingContext) void { if (ent.kind != 1 and ent.kind != 0x1000) { return; } var new_ent = ent.*; new_ent.base = libalign.alignDown(u64, platform.paging.page_sizes[0], new_ent.base); // If there is nothing left of the entry if (new_ent.base >= ent.base + ent.length) return; new_ent.length = libalign.alignUp(u64, platform.paging.page_sizes[0], new_ent.length); if (new_ent.length == 0) return; log(.info, "Stivale: Mapping phys mem 0x{X} to 0x{X}", .{ new_ent.base, new_ent.base + new_ent.length, }); os.vital(paging.add_physical_mapping(.{ .context = context, .phys = new_ent.base, .size = new_ent.length, }), "mapping physical stivale mem"); } fn getPhysLimit(map: []const MemmapEntry) usize { if (map.len == 0) { @panic("No memmap!"); } const ent = map[map.len - 1]; return ent.base + ent.length; } fn initPaging() void { os.platform.paging.init(); const base: usize = switch (os.platform.arch) { .aarch64 => 0xFFFF800000000000, .x86_64 => if (os.platform.paging.is_5levelpaging()) @as(usize, 0xFF00000000000000) else 0xFFFF800000000000, else => @panic("Phys base for platform unknown!"), }; const context = &os.memory.paging.kernel_context; context.wb_virt_base = base; context.wc_virt_base = base; context.uc_virt_base = base; context.max_phys = 0x7F0000000000; } fn smpEntry(info_in: u64) callconv(.C) noreturn { const smp_info = platform.phys_ptr(*CoreInfo).from_int(info_in); const core_id = smp_info.get_writeback().argument; const cpu = &platform.smp.cpus[core_id]; platform.thread.set_current_cpu(cpu); cpu.booted = true; platform.ap_init(); cpu.bootstrap_tasking(); } export fn stivale2Main(info_in: *Info) noreturn { platform.platform_early_init(); log(.info, "Entry point reached", .{}); var info = ParsedInfo{}; var tag = info_in.tags; while (tag != null) : (tag = tag.?.next) { switch (tag.?.identifier) { 0x2187F79E8612DE07 => info.memmap = @ptrCast(*MemmapTag, tag), 0xE5E76A1B4597A781 => log(.info, "{}", .{@ptrCast(*CmdLineTag, tag)}), 0x506461D2950408FA => info.framebuffer = @ptrCast(*FramebufferTag, tag).*, 0x9E1786930A375E78 => info.rsdp = platform.phys_ptr([*]u8).from_int(@ptrCast(*RsdpTag, tag).rsdp), 0x34D1D96339647025 => info.smp = platform.phys_ptr(*SMPTag).from_int(@ptrToInt(tag)), 0xABB29BD49A2833FA => info.dtb = @ptrCast(*DtbTag, tag).*, 0xB813F9B8DBC78797 => info.uart = @ptrCast(*Mmio32UartTag, tag).*, 0xF77485DBFEB260F9 => info.uart_status = @ptrCast(*Mmio32StatusUartTag, tag).*, 0xE599D90C2975584A => info.kernel_file = @ptrCast(*KernelFileTag, tag).*, 0x566A7BED888E1407 => {}, // epoch 0x274BD246C62BF7D1 => {}, // smbios 0x4B6FE466AADE04CE => {}, // modules 0x359D837855E3858C => {}, // firmware 0xEE80847D01506C57 => {}, // kernel slide else => |ident| log(.warn, "Unknown struct tag identifier: 0x{0X}", .{ident}), } } initPaging(); if (info.uart) |uart| { drivers.output.mmio_serial.register_mmio32_serial(uart.uart_addr); log(.info, "Registered UART", .{}); } if (info.uart_status) |u| { drivers.output.mmio_serial.register_mmio32_status_serial( u.uart_addr, u.uart_status, u.status_mask, u.status_value, ); log(.info, "Registered status UART", .{}); } log(.debug, "Initializing framebuffer", .{}); if (info.framebuffer) |fb| { const ptr = os.platform.phys_ptr([*]u8).from_int(fb.addr).get_writeback(); display.init( ptr[0 .. @as(usize, fb.height) * @as(usize, fb.pitch)], fb.width, fb.height, fb.pitch, if (fb.bpp == 32) .rgbx else .rgb, null, // No invalidation needed for stivale2 framebuffer ); drivers.output.vesa_log.use(&display.context.region); log(.debug, "Using non-buffered output", .{}); } else { drivers.output.vga_log.register(); log(.debug, "Using VGA output", .{}); } log(.notice, "{}", .{info_in.*}); log(.notice, "{}", .{info}); if (!info.valid()) { @panic("Stivale2: Info not valid!"); } if (info.dtb) |dtb| { os.vital(platform.devicetree.parse_dt(dtb.slice()), "parsing devicetree blob"); log(.debug, "Stivale2: Parsed devicetree blob!", .{}); } for (info.memmap.?.get()) |*ent| { consumePhysMem(ent); } if (info.kernel_file) |file| { const pp = os.platform.phys_ptr([*]u8).from_int(file.addr); os.kernel.debug.addDebugElf(pp.get_writeback()); } var phys_high = getPhysLimit(info.memmap.?.get()); // Eagerly map UART too, as it's initialized before exc handlers if (info.uart) |uart| { phys_high = std.math.max(phys_high, uart.uart_addr + 4); } if (info.uart_status) |uart| { phys_high = std.math.max(phys_high, uart.uart_addr + 4); phys_high = std.math.max(phys_high, uart.uart_status + 4); } // Attempt to speed up log scrolling using a buffer if (info.framebuffer) |_| { blk: { display_buffer.init(&display.context.region) catch |err| { log(.err, "Stivale2: Error while allocating buffer: {e}", .{err}); break :blk; }; drivers.output.vesa_log.use(&display_buffer.buffered_region); log(.debug, "Stivale2: Using buffered output", .{}); } } const page_size = platform.paging.page_sizes[0]; phys_high += page_size - 1; phys_high &= ~(page_size - 1); var context = os.vital(memory.paging.bootstrapKernelPaging(), "bootstrapping kernel paging"); os.vital(memory.paging.mapPhysmem(.{ .context = &context, .map_limit = phys_high, }), "Mapping physmem"); memory.paging.kernel_context = context; platform.thread.bsp_task.paging_context = &memory.paging.kernel_context; context.apply(); // Use the write combining framebuffer if (info.framebuffer) |fb| { const ptr = os.platform.phys_ptr([*]u8).from_int(fb.addr).get_write_combining(); display.context.region.bytes = ptr[0 .. @as(usize, fb.height) * @as(usize, fb.pitch)]; } log(.debug, "Doing vmm", .{}); const heap_base = memory.paging.kernel_context.make_heap_base(); os.vital(memory.vmm.init(heap_base), "initializing vmm"); log(.debug, "Doing scheduler", .{}); os.thread.scheduler.init(&platform.thread.bsp_task); log(.debug, "Doing SMP", .{}); if (info.smp) |smp| { var cpus = smp.get_writeback().get(); platform.smp.init(cpus.len); cpus.len = platform.smp.cpus.len; const ap_init_stack_size = platform.thread.ap_init_stack_size; // Allocate stacks for all CPUs var bootstrap_stack_pool_sz = ap_init_stack_size * cpus.len; var stacks = os.vital(memory.pmm.allocPhys(bootstrap_stack_pool_sz), "no ap stacks"); // Setup counter used for waiting @atomicStore(usize, &platform.smp.cpus_left, cpus.len - 1, .Release); // Initiate startup sequence for all cores in parallel for (cpus) |*cpu_info, i| { const cpu = &platform.smp.cpus[i]; cpu.acpi_id = cpu_info.acpi_proc_uid; if (i == 0) continue; cpu.booted = false; // Boot it! const stack = stacks + ap_init_stack_size * i; cpu_info.argument = i; const stack_top = stack + ap_init_stack_size - 16; cpu_info.target_stack = memory.paging.physToWriteBackVirt(stack_top); @atomicStore(u64, &cpu_info.goto_address, @ptrToInt(smpEntry), .Release); } // Wait for the counter to become 0 while (@atomicLoad(usize, &platform.smp.cpus_left, .Acquire) != 0) { platform.spin_hint(); } // Free memory pool used for stacks. Unreachable for now memory.pmm.freePhys(stacks, bootstrap_stack_pool_sz); log(.debug, "All cores are ready for tasks!", .{}); } if (info.rsdp) |rsdp| { log(.debug, "Registering rsdp: {}!", .{rsdp}); platform.acpi.register_rsdp(rsdp); } os.vital(platform.platform_init(), "calling platform_init"); os.kernel.kmain(); }
subprojects/flork/src/boot/stivale2.zig
const std = @import("std"); const max = std.math.max; const min = std.math.min; const parseInt = std.fmt.parseInt; const print = std.debug.print; const testing = std.testing; const tokenize = std.mem.tokenize; const input = @embedFile("./input.txt"); const size = 1000; pub fn main() anyerror!void { print("--- Part One ---\n", .{}); print("Result: {d}\n", .{part1()}); print("--- Part Two ---\n", .{}); print("Result: {d}\n", .{part2()}); } /// /// --- Part One --- /// fn part1() !u32 { var overlap: u32 = 0; var diagram = [_][size]u16{[_]u16{0} ** size} ** size; var lines = tokenize(u8, input, "\r\n"); while (lines.next()) |line| { var numbers = tokenize(u8, line, " ,->"); var x1 = try parseInt(u16, numbers.next() orelse "", 10); var y1 = try parseInt(u16, numbers.next() orelse "", 10); var x2 = try parseInt(u16, numbers.next() orelse "", 10); var y2 = try parseInt(u16, numbers.next() orelse "", 10); overlap += coverLine(&diagram, x1, y1, x2, y2, false); } return overlap; } test "day05.part1" { @setEvalBranchQuota(1_000_000); // 🤯 try testing.expectEqual(7436, comptime try part1()); } /// /// --- Part Two --- /// fn part2() !u32 { var overlap: u32 = 0; var diagram = [_][size]u16{[_]u16{0} ** size} ** size; var lines = tokenize(u8, input, "\r\n"); while (lines.next()) |line| { var numbers = tokenize(u8, line, " ,->"); var x1 = try parseInt(u16, numbers.next() orelse "", 10); var y1 = try parseInt(u16, numbers.next() orelse "", 10); var x2 = try parseInt(u16, numbers.next() orelse "", 10); var y2 = try parseInt(u16, numbers.next() orelse "", 10); overlap += coverLine(&diagram, x1, y1, x2, y2, true); } return overlap; } test "day05.part2" { @setEvalBranchQuota(2_000_000); // 🤯🤯🤯 try testing.expectEqual(21104, comptime try part2()); } /// /// coverLine covers all points in the line (and diagonal, optionally) from (x1, y1) to (x2, y2) /// fn coverLine(diagram: *[size][size]u16, x1: u16, y1: u16, x2: u16, y2: u16, diagonal: bool) u32 { var overlap: u32 = 0; if (x1 == x2 or y1 == y2) { var x = min(x1, x2); while (x <= max(x1, x2)) : (x += 1) { var y = min(y1, y2); while (y <= max(y1, y2)) : (y += 1) { diagram[x][y] += 1; if (diagram[x][y] == 2) { overlap += 1; } } } } else if (diagonal) { var x = x1; var y = y1; while (true) : ({ x = if (x1 < x2) x + 1 else x - 1; y = if (y1 < y2) y + 1 else y - 1; }) { diagram[x][y] += 1; if (diagram[x][y] == 2) { overlap += 1; } if (x == x2 or y == y2) { break; } } } return overlap; }
src/day05/day05.zig
const std = @import("std"); const is64bit = @bitSizeOf(usize) == 64; fn isStringLiteral(comptime T: type) bool { return switch (@typeInfo(T)) { else => false, .Pointer => |ptr| { return switch (@typeInfo(ptr.child)) { else => false, .Array => |arr| arr.child == u8 and arr.sentinel == @as(u8, 0), }; }, }; } pub const JsModuleLoader = struct { normalizefn: ?fn (self: *@This(), ctx: *JsContext, base: [*:0]const u8, name: [*:0]const u8) [*:0]const u8 = null, loaderfn: fn (self: *@This(), ctx: *JsContext, name: [*:0]const u8) ?*JsModuleDef, fn normalize(ctx: *JsContext, base: [*:0]const u8, name: [*:0]const u8, ptr: ?*c_void) callconv(.C) [*:0]const u8 { const self = @ptrCast(*@This(), @alignCast(@alignOf(*@This()), ptr.?)); const f = self.*.normalizefn.?; return f(self, ctx, base, name); } fn trampoline(ctx: *JsContext, name: [*:0]const u8, ptr: ?*c_void) callconv(.C) ?*JsModuleDef { const self = @ptrCast(*@This(), @alignCast(@alignOf(*@This()), ptr.?)); return self.*.loaderfn(self, ctx, name); } }; pub const JsRuntime = opaque { extern fn JS_ExecutePendingJob(rt: *JsRuntime, pctx: *?*JsContext) c_int; pub fn init() *@This() { return JS_NewRuntime().?; } pub fn deinit(self: *@This()) void { JS_FreeRuntime(self); } pub fn gc(self: *@This()) void { JS_RunGC(self); } pub fn setModuleLoader(self: *@This(), loader: *JsModuleLoader) void { JS_SetModuleLoaderFunc( self, if (loader.normalizefn != null) JsModuleLoader.normalize else null, JsModuleLoader.trampoline, @ptrCast(?*c_void, loader), ); } pub fn setOpaque(self: *@This(), ptr: ?*c_void) void { JS_SetRuntimeOpaque(self, ptr); } pub fn getOpaque(self: *@This()) ?*c_void { return JS_GetRuntimeOpaque(self); } pub fn getOpaqueT(self: *@This(), comptime T: type) ?*T { return @ptrCast(?*T, @alignCast(@alignOf(*T), self.getOpaque())); } pub fn pending(self: *@This()) bool { var ctx: ?*JsContext = null; const ret = JS_ExecutePendingJob(self, &ctx); return ret > 0; } }; pub const JsContext = opaque { pub fn init(rt: *JsRuntime) !*@This() { return JS_NewContext(rt) orelse return error.FailedToCreateContext; } pub fn deinit(self: *@This()) void { JS_FreeContext(self); } pub fn clone(self: *@This()) !*@This() { return JS_DupContext(self) orelse return error.FailedToCreateContext; } pub fn getRuntime(self: *@This()) *JsRuntime { return JS_GetRuntime(self); } pub fn getException(self: *@This()) JsValue { return JS_GetException(self); } pub fn detect(self: *@This(), class: Detect, val: JsValue) bool { return switch (class) { .Error => JS_IsError(self, val), .Function => JS_IsFunction(self, val), .Constructor => JS_IsConstructor(self, val), .Array => JS_IsArray(self, val), }; } pub fn resetUncatchableError(self: *@This()) void { JS_ResetUncatchableError(self); } pub fn throw(self: *@This(), err: JsError) JsValue { return switch (err) { .OutOfMemory => JS_ThrowOutOfMemory(self), .Syntax => |str| JS_ThrowSyntaxError(self, "%.*s", str.len, str.ptr), .Type => |str| JS_ThrowTypeError(self, "%.*s", str.len, str.ptr), .Reference => |str| JS_ThrowReferenceError(self, "%.*s", str.len, str.ptr), .Range => |str| JS_ThrowRangeError(self, "%.*s", str.len, str.ptr), .Internal => |str| JS_ThrowInternalError(self, "%.*s", str.len, str.ptr), }; } pub fn setConstructorBit(self: *@This(), val: JsValue, bit: bool) !void { if (!JS_SetConstructorBit(self, val, bit)) return error.FailedToSetConstructorBit; } pub fn eval(self: *@This(), input: [:0]const u8, filename: [*:0]const u8, flags: packed struct { module: bool = false, unused: u2 = 0, strict: bool = false, strip: bool = false, compile: bool = false, backtrace: bool = false, }) JsValue { return JS_Eval( self, input.ptr, input.len, filename, @intCast(c_int, @bitCast(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(flags))), flags)), ); } pub fn evalFunction(self: *@This(), func: JsValue) JsValue { return JS_EvalFunction(self, func); } pub fn getGlobal(self: *@This()) JsValue { return JS_GetGlobalObject(self); } fn dumpObject(self: *@This(), out: anytype, ex: JsValue) void { if (ex.getTag() == .Null) return; const str = ex.as(JsString, self) catch return; defer str.deinit(self); out.print("{s}\n", .{str.data}) catch {}; } fn dumpException(self: *@This(), ex: JsValue) void { const writer = std.io.getStdErr().writer(); self.dumpObject(writer, ex); if (ex.getProperty(self, JsAtom.comptimeAtom(self, "stack"))) |stack| { defer stack.deinit(self); self.dumpObject(writer, stack); } } pub fn dumpError(self: *@This()) void { const ex = self.getException(); defer ex.deinit(self); self.dumpException(ex); } pub fn setConstructor(self: *@This(), func: JsValue, proto: JsValue) void { JS_SetConstructor(self, func, proto); } }; pub const JsClassID = extern enum(u32) { initial, _, pub fn init(self: *@This()) void { _ = JS_NewClassID(self); } pub fn define(self: @This(), rt: *JsRuntime, def: *const JsClassDef) void { if (!JS_IsRegisteredClass(rt, self)) _ = JS_NewClass(rt, self, def); } pub fn setProto(self: @This(), ctx: *JsContext, proto: JsValue) void { JS_SetClassProto(ctx, self, proto); } pub fn getProto(self: @This(), ctx: *JsContext) JsValue { return JS_GetClassProto(ctx, self); } }; pub const JsAtom = extern enum(u32) { invalid, _, extern fn JS_NewAtomLen(ctx: *JsContext, str: [*]const u8, len: usize) JsAtom; extern fn JS_NewAtom(ctx: *JsContext, str: [*:0]const u8) JsAtom; extern fn JS_NewAtomUInt32(ctx: *JsContext, n: u32) JsAtom; extern fn JS_DupAtom(ctx: *JsContext, v: JsAtom) JsAtom; extern fn JS_FreeAtom(ctx: *JsContext, v: JsAtom) void; extern fn JS_FreeAtomRT(rt: *JsRuntime, v: JsAtom) void; extern fn JS_AtomToValue(ctx: *JsContext, atom: JsAtom) JsValue; extern fn JS_AtomToString(ctx: *JsContext, atom: JsAtom) JsValue; extern fn JS_AtomToCString(ctx: *JsContext, atom: JsAtom) ?[*:0]const u8; extern fn JS_ValueToAtom(ctx: *JsContext, val: JsValue) JsAtom; pub fn comptimeAtom(ctx: *JsContext, comptime name: []const u8) @This() { const Storage = opaque { threadlocal var atom: JsAtom = .invalid; }; if (Storage.atom == .invalid) Storage.atom = initAtom(ctx, name); return Storage.atom; } pub fn initAtom(ctx: *JsContext, val: anytype) @This() { return switch (@TypeOf(val)) { []const u8 => JS_NewAtomLen(ctx, val.ptr, val.len), [*:0]const u8 => JS_NewAtom(ctx, val), u32 => JS_NewAtomUInt32(ctx, val), i32, usize, i64, u64 => JS_ValueToAtom(ctx, JsValue.from(val)), JsValue => JS_ValueToAtom(ctx, val), else => if (comptime isStringLiteral(@TypeOf(val))) initAtom(ctx, @as([*:0]const u8, val)) else @compileError("unsupported type: " ++ @typeName(@TypeOf(val))), }; } pub fn clone(self: @This(), ctx: *JsContext) @This() { return JS_DupAtom(ctx, self); } pub fn deinit(self: @This(), ctx: *JsContext) void { JS_FreeAtom(ctx, self); } pub fn deinitRT(self: @This(), rt: *JsRuntime) void { JS_FreeAtomRT(rt, self); } pub fn toValue(self: @This(), ctx: *JsContext) JsValue { return Js_AtomToValue(ctx, self); } pub fn toString(self: @This(), ctx: *JsContext) JsValue { return JS_AtomToString(ctx, self); } pub fn toCString(self: @This(), ctx: *JsContext) ?JsString { const ret = JS_AtomToCString(ctx, self) orelse return null; return JsString{ .data = ret[0..std.mem.lenZ(ret) :0] }; } }; pub const JsPropertyEnum = extern struct { enumerable: bool, atom: JsAtom, }; pub const JsPropertyDescriptor = extern struct { flags: c_int, value: JsValue, getter: JsValue, setter: JsValue, }; const JsTag = extern enum(isize) { First = -11, BigDecimal = -11, BigInt = -10, BigFloat = -9, Symbol = -8, String = -7, Module = -3, FunctionByteCode = -2, Object = -1, Integer = 0, Boolean = 1, Null = 2, Undefined = 3, Uninitialized = 4, CatchOffset = 5, Exception = 6, Float64 = 7, _, }; pub const RawValue = union(JsTag) { BigDecimal: usize, First: usize, BigInt: usize, BigFloat: usize, Symbol: usize, String: usize, Module: *JsModuleDef, FunctionByteCode: usize, Object: usize, Integer: i32, Boolean: bool, Null: void, Undefined: void, Uninitialized: void, CatchOffset: i32, Exception: i32, Float64: f64, }; pub const ValueSource = union(enum) { Uninitialized: void, Undefined: void, Null: void, Boolean: bool, Integer: i32, Float64: f64, Error: void, Array: void, Object: struct { proto: ?JsValue = null, class: ?JsClassID = null, temp: ?[]const JsCFunctionListEntry = null, }, String: []const u8, ArrayBuffer: []const u8, Function: struct { name: [*:0]const u8 = "", length: c_int, func: JsCFunctionTypeZ, magic: c_int = 0, data: ?[]const JsValue = null, }, }; const JSRefCountHeader = extern struct { rc: c_int, }; fn safeIntCast(comptime T: type, val: anytype) ?T { if (val >= std.math.minInt(T) and val <= std.math.maxInt(T)) return @intCast(T, val); return null; } pub const JsString = struct { data: [:0]const u8, pub fn deinit(self: @This(), ctx: *JsContext) void { JS_FreeCString(ctx, self.data.ptr); } pub fn dupe(self: @This(), ctx: *JsContext, allocator: *std.mem.Allocator) ![:0]u8 { defer self.deinit(ctx); return allocator.dupeZ(u8, self.data); } }; pub const PropertyDefinition = struct { configurable: bool, writable: bool, enumerable: bool, data: union(enum) { getset: struct { getter: ?JsValue = null, setter: ?JsValue = null, }, value: JsValue, none: void, }, fn toFlags(self: @This()) c_int { var ret: c_int = 0; ret |= 1 << 8; if (self.configurable) ret |= 1 << 0; ret |= 1 << 9; if (self.writable) ret |= 1 << 1; ret |= 1 << 10; if (self.enumerable) ret |= 1 << 2; switch (self.data) { .none => {}, .getset => |data| { ret |= 1 << 4; if (data.getter != null) ret |= 1 << 11; if (data.setter != null) ret |= 1 << 12; }, .value => ret |= 1 << 13, } return ret; } }; pub const JsValue = extern struct { storage: if (is64bit) extern struct { a: u64, b: i64, } else extern struct { a: u32, b: i32, }, pub fn format(value: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { try writer.print("{}", .{value.getValue()}); } fn box(comptime T: type) type { const ret = if (is64bit) extern struct { val: T align(8), tag: i64, pub fn init(val: T, tag: i64) @This() { return .{ .val = val, .tag = tag }; } pub fn transmit(val: T, tag: i64) u128 { return @bitCast(u128, init(val, tag)); } pub fn from(e: JsValue) @This() { return @bitCast(@This(), e); } } else switch (T) { bool, i32, usize => extern struct { val: T align(4), tag: i32, pub fn init(val: T, tag: i32) @This() { return .{ .val = val, .tag = tag }; } pub fn transmit(val: T, tag: i32) u64 { return @bitCast(u64, init(val, tag)); } pub fn from(e: JsValue) @This() { return @bitCast(@This(), e); } }, f64 => extern struct { val: T, pub fn init(val: T, tag: i32) @This() { return .{ .val = val }; } pub fn transmit(val: T, tag: i32) u64 { return @bitCast(u64, init(val, tag)) + (JS_FLOAT64_TAG_ADDEND << 32); } pub fn from(e: JsValue) @This() { return @bitCast(@This(), @bitCast(u64, e.storage) - (JS_FLOAT64_TAG_ADDEND << 32)); } }, else => @compileError("unsupported type: " ++ @typeName(T)), }; comptime { std.debug.assert(@sizeOf(ret) == @sizeOf(@This())); } return ret; } const JS_FLOAT64_TAG_ADDEND: comptime_int = 0x7ff80000 - @enumToInt(JsTag.First) + 1; const JS_NAN: comptime_int = 0x7ff8000000000000 - (JS_FLOAT64_TAG_ADDEND << 32); pub fn getTag(self: @This()) JsTag { const r = box(bool).from(self).tag; return @intToEnum(JsTag, r); } fn tagIsFloat64(tag: JsTag) bool { return if (is64bit) tag == JsTag.Float64 else @bitCast(u32, @enumToInt(tag) - @enumToInt(JsTag.First)) >= @bitCast(u32, @enumToInt(JsTag.Float64) - @enumToInt(JsTag.First)); } pub fn isFloat64(self: @This()) bool { const tag = self.getTag(); return tagIsFloat64(tag); } pub fn isNumber(self: @This()) bool { const tag = self.getTag(); return tag == JsTag.Integer or tagIsFloat64(tag); } pub fn getNormTag(self: @This()) JsTag { const tag = self.getTag(); return if (is64bit or !self.isFloat64()) tag else JsTag.Float64; } pub fn isNan(self: @This()) bool { if (is64bit) { if (self.getTag() != JsTag.Float64) return false; return std.math.isNan(box(f64).from(self).val); } else { return self.getTag() == JS_NAN >> 32; } } pub fn getPointer(self: @This()) usize { return box(usize).from(self).val; } pub fn getPointerT(self: @This(), comptime T: type) ?*T { return @intToPtr(?*T, self.getPointer()); } pub fn getValue(self: @This()) RawValue { const integer = box(i32).from(self).val; const boolean = box(bool).from(self).val; const pointer = self.getPointer(); const float64 = box(f64).from(self).val; return switch (self.getNormTag()) { .BigDecimal => .{ .BigDecimal = pointer }, .BigInt => .{ .BigInt = pointer }, .BigFloat => .{ .BigFloat = pointer }, .Symbol => .{ .Symbol = pointer }, .String => .{ .String = pointer }, .Module => .{ .Module = @intToPtr(*JsModuleDef, pointer) }, .FunctionByteCode => .{ .FunctionByteCode = pointer }, .Object => .{ .Object = pointer }, .Integer => .{ .Integer = integer }, .Boolean => .{ .Boolean = boolean }, .Null => .Null, .Undefined => .Undefined, .Uninitialized => .Uninitialized, .CatchOffset => .{ .CatchOffset = integer }, .Exception => .{ .Exception = integer }, .Float64 => .{ .Float64 = float64 }, else => @panic("invalid data"), }; } pub fn make(val: anytype, tag: JsTag) @This() { const r = switch (@TypeOf(val)) { bool, usize, i32, f64 => box(@TypeOf(val)).transmit(val, @enumToInt(tag)), else => @compileError("unsupported type: " ++ @typeName(@TypeOf(val))), }; return @bitCast(@This(), r); } pub fn fromRaw(val: RawValue) @This() { return switch (val) { .Integer => |int| make(int, .Integer), .Boolean => |b| make(b, .Boolean), .Null => make(false, .Null), .Undefined => make(false, .Undefined), .Uninitialized => make(false, .Uninitialized), .Float64 => |double| make(double, .Float64), else => @panic("unsupported value"), }; } pub fn from(val: anytype) @This() { return switch (@TypeOf(val)) { i8, i16, u8, u16, c_int => fromRaw(.{ .Integer = @intCast(i32, val) }), i32 => fromRaw(.{ .Integer = val }), u32, i64, u64, usize => if (safeIntCast(i32, val)) |safe| fromRaw(.{ .Integer = safe }) else fromRaw(.{ .Float64 = @intToFloat(f64, val) }), f64 => blk: { if (val >= @intToFloat(f64, std.math.minInt(i32)) and val <= @intToFloat(f64, std.math.maxInt(i32))) { const ru = @bitCast(u64, val); const i = @floatToInt(i32, val); const rdu = @bitCast(u64, @intToFloat(f64, i)); if (ru == rdu) { break :blk fromRaw(.{ .Integer = i }); } } break :blk fromRaw(.{ .Float64 = val }); }, bool => fromRaw(.{ .Boolean = val }), else => @compileError("unsupported type: " ++ @typeName(@TypeOf(val))), }; } pub fn init(ctx: *JsContext, src: ValueSource) @This() { return switch (src) { .Integer => |int| make(int, .Integer), .Boolean => |b| make(b, .Boolean), .Null => make(false, .Null), .Undefined => make(false, .Undefined), .Uninitialized => make(false, .Uninitialized), .Float64 => |double| make(double, .Float64), .Error => JS_NewError(ctx), .Array => JS_NewArray(ctx), .Object => |opts| blk: { const ret = inner: { if (opts.proto) |proto| { if (opts.class) |class| { break :inner JS_NewObjectProtoClass(ctx, proto, class); } else { break :inner JS_NewObjectProto(ctx, proto); } } else { if (opts.class) |class| { break :inner JS_NewObjectClass(ctx, class); } else { break :inner JS_NewObject(ctx); } } }; if (opts.temp) |temp| JS_SetPropertyFunctionList(ctx, ret, temp.ptr, @intCast(c_int, temp.len)); break :blk ret; }, .String => |data| JS_NewStringLen(ctx, data.ptr, data.len), .ArrayBuffer => |data| JS_NewArrayBufferCopy(ctx, data.ptr, data.len), .Function => |def| if (def.data) |data| JS_NewCFunctionData( ctx, def.func.dump(), def.name, def.length, std.meta.activeTag(def.func), def.magic, @intCast(c_int, data.len), data.ptr, ) else JS_NewCFunction2( ctx, def.func.dump(), def.name, def.length, std.meta.activeTag(def.func), def.magic, ), }; } pub fn fromBig(ctx: *JsContext, val: anytype) @This() { return switch (@TypeOf(val)) { i64 => JS_NewBigInt64(ctx, val), u64 => JS_NewBigUint64(ctx, val), isize => JS_NewBigInt64(ctx, @intCast(i64, val)), usize => JS_NewBigUint64(ctx, @intCast(u64, val)), else => @compileError("unsupported type: " ++ @typeName(@TypeOf(val))), }; } pub fn hasRefCount(self: @This()) bool { return @bitCast(usize, self.getTag()) >= @bitCast(usize, @enumToInt(JsTag.First)); } fn canBeFreed(self: @This()) bool { return self.hasRefCount() and self.getTag() != .Module; } pub fn deinit(self: @This(), ctx: *JsContext) void { self.deinitRT(ctx.getRuntime()); } pub fn deinitRT(self: @This(), rt: *JsRuntime) void { if (self.canBeFreed()) { const header = @intToPtr(*JSRefCountHeader, self.getPointer()); header.rc -= 1; if (header.rc <= 0) __JS_FreeValueRT(rt, self); } } pub fn clone(self: @This()) @This() { if (self.hasRefCount()) { const header = @intToPtr(*JSRefCountHeader, self.getPointer()); header.rc += 1; } return self; } pub fn as(self: @This(), comptime T: type, ctx: *JsContext) !T { switch (T) { bool => { const r = JS_ToBool(ctx, self); if (r == -1) return error.FailedError; return r != 0; }, i32 => { var res: i32 = undefined; const r = JS_ToInt32(ctx, &res, self); if (r == -1) return error.FailedToConvert; return res; }, u32 => { var res: i32 = undefined; const r = JS_ToInt64Ext(ctx, &res, self); if (r == -1) return error.FailedToConvert; return @intCast(u32, res); }, i64 => { var res: i64 = undefined; const r = JS_ToInt64Ext(ctx, &res, self); if (r == -1) return error.FailedToConvert; return res; }, u64 => { var res: u64 = undefined; const r = JS_ToIndex(ctx, &res, self); if (r == -1) return error.FailedToConvert; return res; }, f64 => { var res: f64 = undefined; const r = JS_ToFloat64(ctx, &res, self); if (r == -1) return error.FailedToConvert; return res; }, usize => { var res: u64 = undefined; const r = JS_ToIndex(ctx, &res, self); if (r == -1) return error.FailedToConvert; return @intCast(usize, res); }, JsString => { var len: usize = undefined; const r = JS_ToCStringLen2(ctx, &len, self, 0) orelse return error.FailedToConvert; return T{ .data = r[0..len :0] }; }, []u8 => { var len: usize = undefined; const r = JS_GetArrayBuffer(ctx, &len, self) orelse return error.FailedToConvert; return r[0..len]; }, else => @compileError("unsupported type: " ++ @typeName(T)), } } pub fn toString(self: @This()) @This() { return JS_ToString(ctx, self); } pub fn toPropertyKey(self: @This()) @This() { return JS_ToPropertyKey(ctx, self); } pub fn getProperty(self: @This(), ctx: *JsContext, key: anytype) ?@This() { const atom = toAtom(ctx, key); defer killAtom(ctx, key, atom); const ret = JS_GetPropertyInternal(ctx, self, atom, self, 0); if (ret.getTag() == .Undefined) return null; return ret; } pub fn setProperty(self: @This(), ctx: *JsContext, key: anytype, value: JsValue) !void { const atom = toAtom(ctx, key); defer killAtom(ctx, key, atom); const ret = JS_SetPropertyInternal(ctx, self, atom, value, 1 << 14); if (ret == -1) return error.FailedToSetProperty; } pub fn hasProperty(self: @This(), ctx: *JsContext, key: JsAtom) !bool { const ret = JS_HasProperty(ctx, self, key); if (ret == -1) return error.NotAnObject; return ret != 0; } pub fn deleteProperty(self: @This(), ctx: *JsContext, key: JsAtom) !bool { const ret = JS_DeleteProperty(ctx, self, key, 1 << 15); if (ret == -1) return error.NotAnObject; return ret != 0; } pub fn isExtensible(self: @This(), ctx: *JsContext) !bool { const ret = JS_IsExtensible(ctx, self); if (ret == -1) return error.NotAnObject; return ret != 0; } pub fn preventExtensions(self: @This(), ctx: *JsContext) !bool { const ret = JS_PreventExtensions(ctx, self); if (ret == -1) return error.NotAnObject; return ret != 0; } pub fn setPrototype(self: @This(), ctx: *JsContext, target: @This()) !bool { const ret = JS_SetPrototype(ctx, self, target); if (ret == -1) return error.NotAnObject; return ret != 0; } pub fn getPrototype(self: @This(), ctx: *JsContext) ?@This() { const ret = JS_GetPrototype(ctx, self); if (ret.getTag() == .Undefined) return null; return ret; } pub fn getOwnPropertyNames(self: @This(), ctx: *JsContext, options: packed struct { string: bool = true, symbol: bool = false, private: bool = false, enumOnly: bool = false, setEnum: bool = false, }) ![]JsPropertyEnum { var arr: [*]JsPropertyEnum = undefined; var len: u32 = 0; const ret = JS_GetOwnPropertyNames(ctx, &arr, &len, self, @intCast(c_int, @bitCast(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(options))), options))); if (ret != 0) return error.NotAnObject; return arr[0..len]; } pub fn getOwnProperty(self: @This(), ctx: *JsContext, key: JsAtom) !JsPropertyDescriptor { var desc: JsPropertyDescriptor = undefined; const ret = JS_GetOwnProperty(ctx, &desc, self, key); if (ret == -1) return error.NotAnObject; return desc; } pub fn call(self: @This(), ctx: *JsContext, this: @This(), args: []const @This()) @This() { return JS_Call(ctx, self, this, @intCast(c_int, args.len), args.ptr); } pub fn invoke(self: @This(), ctx: *JsContext, key: JsAtom, this: @This(), args: []const @This()) @This() { return JS_Call(ctx, self, key, this, @intCast(c_int, args.len), args.ptr); } pub fn construct(self: @This(), ctx: *JsContext, args: []const @This()) @This() { return JS_CallConstructor(ctx, self, @intCast(c_int, args.len), args.ptr); } pub fn instanceOf(self: @This(), ctx: *JsContext, constructor: @This()) !bool { const ret = JS_IsInstanceOf(ctx, self, constructor); if (ret == -1) return error.NotAnObject; return ret != 0; } fn toAtom(ctx: *JsContext, key: anytype) JsAtom { return switch (@TypeOf(key)) { JsAtom => key, else => JsAtom.initAtom(ctx, key), }; } fn killAtom(ctx: *JsContext, key: anytype, atom: JsAtom) void { if (@TypeOf(key) == JsAtom) return; atom.deinit(ctx); } pub fn defineProperty(self: @This(), ctx: *JsContext, atom: JsAtom, def: PropertyDefinition) !bool { switch (def.data) { .none => {}, .getset => |data| { const getter = data.getter orelse fromRaw(.Undefined); const setter = data.setter orelse fromRaw(.Undefined); const ret = JS_DefinePropertyGetSet(ctx, self, atom, getter, setter, def.toFlags()); if (ret == -1) return error.NotAnObject; return ret != 0; }, .value => |data| { const ret = JS_DefinePropertyValue(ctx, self, atom, data, def.toFlags()); if (ret == -1) return error.NotAnObject; return ret != 0; }, } const ret = JS_DefineProperty(ctx, self, atom, fromRaw(.Undefined), fromRaw(.Undefined), fromRaw(.Undefined), def.toFlags()); if (ret == -1) return error.NotAnObject; return ret != 0; } pub fn setOpaque(self: @This(), data: ?*c_void) void { JS_SetOpaque(self, data); } pub fn getOpaque(self: @This(), class_id: JsClassID) ?*c_void { return JS_GetOpaque(self, class_id); } pub fn getOpaqueT(self: @This(), comptime T: type, class_id: JsClassID) ?*T { return @ptrCast(?*T, @alignCast(@alignOf(*T), JS_GetOpaque(self, class_id))); } pub fn fromJSON(self: @This(), ctx: *JsContext, data: [:0]const u8, ext: bool) !@This() { const ret = JS_ParseJSON2(ctx, data.ptr, data.len, "<input>", if (ext) 1 else 0); if (ctx.detect(.Exception, ret)) return error.FailedToParseJSON; return ret; } pub fn jsonStringify(self: @This(), ctx: *JsContext, replacer: @This(), space0: @This()) !@This() { const ret = JS_JSONStringify(ctx, self, replacer, space0); if (ctx.detect(.Exception, ret)) return error.FailedToStringify; return ret; } pub fn mark(self: @This(), tt: *JsRuntime, markFunc: JS_MarkFunc) void { JS_MarkValue(tt, self, markFunc); } }; const JsGCObjectHeader = opaque {}; pub const JS_MarkFunc = fn (rt: *JsRuntime, gp: *JsGCObjectHeader) callconv(.C) void; extern fn JS_NewRuntime() ?*JsRuntime; extern fn JS_FreeRuntime(rt: *JsRuntime) void; extern fn JS_RunGC(rt: *JsRuntime) void; extern fn JS_MarkValue(tt: *JsRuntime, val: JsValue, markFunc: JS_MarkFunc) void; extern fn JS_GetRuntimeOpaque(rt: *JsRuntime) ?*c_void; extern fn JS_SetRuntimeOpaque(rt: *JsRuntime, ptr: ?*c_void) void; extern fn JS_NewContext(rt: *JsRuntime) ?*JsContext; extern fn JS_FreeContext(ctx: *JsContext) void; extern fn JS_DupContext(ctx: *JsContext) ?*JsContext; extern fn JS_GetRuntime(ctx: *JsContext) *JsRuntime; extern fn JS_SetClassProto(ctx: *JsContext, class_id: JsClassID, obj: JsValue) void; extern fn JS_GetClassProto(ctx: *JsContext, class_id: JsClassID) JsValue; extern fn JS_NewClassID(pclass_id: *JsClassID) JsClassID; extern fn JS_NewClass(rt: *JsRuntime, class_id: JsClassID, class_def: *const JsClassDef) c_int; extern fn JS_IsRegisteredClass(rt: *JsRuntime, class_id: JsClassID) bool; extern fn __JS_FreeValue(ctx: *JsContext, v: JsValue) void; extern fn __JS_FreeValueRT(rt: *JsRuntime, v: JsValue) void; extern fn JS_ToBool(ctx: *JsContext, val: JsValue) c_int; extern fn JS_ToInt32(ctx: *JsContext, pres: *i32, val: JsValue) c_int; extern fn JS_ToInt64Ext(ctx: *JsContext, pres: *i64, val: JsValue) c_int; extern fn JS_ToIndex(ctx: *JsContext, pres: *u64, val: JsValue) c_int; extern fn JS_ToFloat64(ctx: *JsContext, pres: *f64, val: JsValue) c_int; extern fn JS_NewStringLen(ctx: *JsContext, str: [*]const u8, len: usize) JsValue; extern fn JS_NewString(ctx: *JsContext, str: [*:0]const u8) JsValue; extern fn JS_NewAtomString(ctx: *JsContext, str: [*:0]const u8) JsValue; extern fn JS_ToString(ctx: *JsContext, val: JsValue) JsValue; extern fn JS_ToPropertyKey(ctx: *JsContext, val: JsValue) JsValue; extern fn JS_ToCStringLen2(ctx: *JsContext, plen: *usize, val1: JsValue, cesu8: c_int) ?[*]const u8; extern fn JS_FreeCString(ctx: *JsContext, ptr: [*]const u8) void; extern fn JS_GetArrayBuffer(ctx: *JsContext, size: *usize, obj: JsValue) ?[*]u8; extern fn JS_NewObjectProtoClass(ctx: *JsContext, proto: JsValue, class_id: JsClassID) JsValue; extern fn JS_NewObjectClass(ctx: *JsContext, class_id: JsClassID) JsValue; extern fn JS_NewObjectProto(ctx: *JsContext, proto: JsValue) JsValue; extern fn JS_NewObject(ctx: *JsContext) JsValue; extern fn JS_IsFunction(ctx: *JsContext, val: JsValue) bool; extern fn JS_IsConstructor(ctx: *JsContext, val: JsValue) bool; extern fn JS_SetConstructorBit(ctx: *JsContext, func_obj: JsValue, val: bool) bool; extern fn JS_NewArray(ctx: *JsContext) JsValue; extern fn JS_IsArray(ctx: *JsContext, val: JsValue) bool; extern fn JS_GetPropertyInternal(ctx: *JsContext, obj: JsValue, prop: JsAtom, receiver: JsValue, throw_ref_error: c_int) JsValue; extern fn JS_GetPropertyStr(ctx: *JsContext, this_obj: JsValue, prop: [*:0]const u8) JsValue; extern fn JS_GetPropertyUint32(ctx: *JsContext, this_obj: JsValue, idx: u32) JsValue; extern fn JS_SetPropertyInternal(ctx: *JsContext, this_obj: JsValue, prop: JsAtom, val: JsValue, flags: c_int) c_int; extern fn JS_SetPropertyUint32(ctx: *JsContext, this_obj: JsValue, idx: u32, val: JsValue) c_int; extern fn JS_SetPropertyInt64(ctx: *JsContext, this_obj: JsValue, idx: i64, val: JsValue) c_int; extern fn JS_SetPropertyStr(ctx: *JsContext, this_obj: JsValue, prop: [*c]const u8, val: JsValue) c_int; extern fn JS_HasProperty(ctx: *JsContext, this_obj: JsValue, prop: JsAtom) c_int; extern fn JS_IsExtensible(ctx: *JsContext, obj: JsValue) c_int; extern fn JS_PreventExtensions(ctx: *JsContext, obj: JsValue) c_int; extern fn JS_DeleteProperty(ctx: *JsContext, obj: JsValue, prop: JsAtom, flags: c_int) c_int; extern fn JS_SetPrototype(ctx: *JsContext, obj: JsValue, proto_val: JsValue) c_int; extern fn JS_GetPrototype(ctx: *JsContext, val: JsValue) JsValue; extern fn JS_GetOwnPropertyNames(ctx: *JsContext, ptab: *[*]JsPropertyEnum, plen: *u32, obj: JsValue, flags: c_int) c_int; extern fn JS_GetOwnProperty(ctx: *JsContext, desc: *JsPropertyDescriptor, obj: JsValue, prop: JsAtom) c_int; extern fn JS_Call(ctx: *JsContext, func_obj: JsValue, this_obj: JsValue, argc: c_int, argv: [*]const JsValue) JsValue; extern fn JS_Invoke(ctx: *JsContext, this_val: JsValue, atom: JsAtom, argc: c_int, argv: [*]const JsValue) JsValue; extern fn JS_CallConstructor(ctx: *JsContext, func_obj: JsValue, argc: c_int, argv: [*]const JsValue) JsValue; extern fn JS_CallConstructor2(ctx: *JsContext, func_obj: JsValue, new_target: JsValue, argc: c_int, argv: [*]const JsValue) JsValue; extern fn JS_DetectModule(input: [*:0]const u8, input_len: usize) c_int; extern fn JS_Eval(ctx: *JsContext, input: [*:0]const u8, input_len: usize, filename: [*:0]const u8, eval_flags: c_int) JsValue; extern fn JS_EvalFunction(ctx: *JsContext, fun_obj: JsValue) JsValue; extern fn JS_GetGlobalObject(ctx: *JsContext) JsValue; extern fn JS_IsInstanceOf(ctx: *JsContext, val: JsValue, obj: JsValue) c_int; extern fn JS_DefineProperty(ctx: *JsContext, this_obj: JsValue, prop: JsAtom, val: JsValue, getter: JsValue, setter: JsValue, flags: c_int) c_int; extern fn JS_DefinePropertyValue(ctx: *JsContext, this_obj: JsValue, prop: JsAtom, val: JsValue, flags: c_int) c_int; extern fn JS_DefinePropertyValueUint32(ctx: *JsContext, this_obj: JsValue, idx: u32, val: JsValue, flags: c_int) c_int; extern fn JS_DefinePropertyValueStr(ctx: *JsContext, this_obj: JsValue, prop: [*c]const u8, val: JsValue, flags: c_int) c_int; extern fn JS_DefinePropertyGetSet(ctx: *JsContext, this_obj: JsValue, prop: JsAtom, getter: JsValue, setter: JsValue, flags: c_int) c_int; extern fn JS_SetOpaque(obj: JsValue, ptr: ?*c_void) void; extern fn JS_GetOpaque(obj: JsValue, class_id: JsClassID) ?*c_void; extern fn JS_GetOpaque2(ctx: *JsContext, obj: JsValue, class_id: JsClassID) ?*c_void; extern fn JS_ParseJSON(ctx: *JsContext, buf: [*:0]const u8, buf_len: usize, filename: [*:0]const u8) JsValue; extern fn JS_ParseJSON2(ctx: *JsContext, buf: [*:0]const u8, buf_len: usize, filename: [*:0]const u8, flags: c_int) JsValue; extern fn JS_JSONStringify(ctx: *JsContext, obj: JsValue, replacer: JsValue, space0: JsValue) JsValue; extern fn JS_NewArrayBufferCopy(ctx: *JsContext, buf: [*]const u8, len: usize) JsValue; const JsModuleNormalizeFunc = fn (*JsContext, [*:0]const u8, [*:0]const u8, ?*c_void) callconv(.C) [*:0]const u8; const JsModuleLoaderFunc = fn (*JsContext, [*:0]const u8, ?*c_void) callconv(.C) ?*JsModuleDef; extern fn JS_SetModuleLoaderFunc(rt: *JsRuntime, module_normalize: ?JsModuleNormalizeFunc, module_loader: JsModuleLoaderFunc, ptr: ?*c_void) void; extern fn JS_GetImportMeta(ctx: *JsContext, m: *JsModuleDef) JsValue; extern fn JS_GetModuleName(ctx: *JsContext, m: *JsModuleDef) JsAtom; const JsCFunction = fn (*JsContext, JsValue, c_int, [*]JsValue) callconv(.C) JsValue; const JsCFunctionMagic = fn (*JsContext, JsValue, c_int, [*]JsValue, c_int) callconv(.C) JsValue; const JsCFunctionData = fn (*JsContext, JsValue, c_int, [*]JsValue, c_int, [*]JsValue) callconv(.C) JsValue; extern fn JS_NewCFunction2( ctx: *JsContext, func: JsCFunctionType, name: [*:0]const u8, length: c_int, cproto: JsCFunctionEnum, magic: c_int, ) JsValue; extern fn JS_NewCFunctionData( ctx: *JsContext, func: JsCFunctionType, name: [*:0]const u8, length: c_int, cproto: JsCFunctionEnum, magic: c_int, data_len: c_int, data: [*]const JsValue, ) JsValue; extern fn JS_SetConstructor(ctx: *JsContext, func: JsValue, proto: JsValue) void; const JsCFunctionEnum = extern enum(u8) { generic, generic_magic, constructor, constructor_magic, constructor_or_func, f_f, f_f_f, getter, setter, getter_magic, setter_magic, iterator_next, }; const JsCFunctionTypeZ = union(JsCFunctionEnum) { generic: JsCFunction, generic_magic: fn (ctx: *JsContext, this: JsValue, argc: c_int, argv: [*]JsValue, magic: c_int) callconv(.C) JsValue, constructor: JsCFunction, constructor_magic: fn (ctx: *JsContext, this: JsValue, argc: c_int, argv: [*]JsValue, magic: c_int) callconv(.C) JsValue, constructor_or_func: JsCFunction, f_f: fn (f64) callconv(.C) f64, f_f_f: fn (f64, f64) callconv(.C) f64, getter: fn (*JsContext, JsValue) callconv(.C) JsValue, setter: fn (*JsContext, JsValue, JsValue) callconv(.C) JsValue, getter_magic: fn (*JsContext, JsValue, c_int) callconv(.C) JsValue, setter_magic: fn (*JsContext, JsValue, JsValue, c_int) callconv(.C) JsValue, iterator_next: fn (*JsContext, JsValue, c_int, *JsValue, *c_int, c_int) callconv(.C) JsValue, pub fn dump(self: @This()) JsCFunctionType { return switch (self) { .generic => |origin| .{ .generic = origin }, .generic_magic => |origin| .{ .generic_magic = origin }, .constructor => |origin| .{ .constructor = origin }, .constructor_magic => |origin| .{ .constructor_magic = origin }, .constructor_or_func => |origin| .{ .constructor_or_func = origin }, .f_f => |origin| .{ .f_f = origin }, .f_f_f => |origin| .{ .f_f_f = origin }, .getter => |origin| .{ .getter = origin }, .setter => |origin| .{ .setter = origin }, .getter_magic => |origin| .{ .getter_magic = origin }, .setter_magic => |origin| .{ .setter_magic = origin }, .iterator_next => |origin| .{ .iterator_next = origin }, }; } }; const JsCGetter = fn (*JsContext, JsValue) callconv(.C) JsValue; const JsCSetter = fn (*JsContext, JsValue, JsValue) callconv(.C) JsValue; const JsCGetterMagic = fn (*JsContext, JsValue, c_int) callconv(.C) JsValue; const JsCSetterMagic = fn (*JsContext, JsValue, JsValue, c_int) callconv(.C) JsValue; const JsCFunctionType = extern union { none: usize, generic: JsCFunction, generic_magic: fn (ctx: *JsContext, this: JsValue, argc: c_int, argv: [*]JsValue, magic: c_int) callconv(.C) JsValue, constructor: JsCFunction, constructor_magic: fn (ctx: *JsContext, this: JsValue, argc: c_int, argv: [*]JsValue, magic: c_int) callconv(.C) JsValue, constructor_or_func: JsCFunction, f_f: fn (f64) callconv(.C) f64, f_f_f: fn (f64, f64) callconv(.C) f64, getter: JsCGetter, setter: JsCSetter, getter_magic: JsCGetterMagic, setter_magic: JsCSetterMagic, iterator_next: fn (*JsContext, JsValue, c_int, *JsValue, *c_int, c_int) callconv(.C) JsValue, }; pub const JsCFunctionListEntry = extern struct { name: [*:0]const u8, prop_flags: u8, def_type: u8, magic: i16, u: U, const U = extern union { func: extern struct { length: u8, cproto: JsCFunctionEnum, cfunc: JsCFunctionType, // to avoid zig compiler TODO buf_read_value_bytes }, getset: extern struct { get: JsCFunctionType, set: JsCFunctionType, }, alias: extern struct { name: [*:0]const u8, base: c_int, }, prop_list: extern struct { tab: [*]const JsCFunctionListEntry, len: c_int, }, str: [*:0]const u8, int: i32, long: i64, double: f64, }; pub const PropFlags = packed struct { configurable: bool = false, writeable: bool = false, enumerable: bool = false, fn dump(self: @This()) u8 { return @intCast(u8, @bitCast(u3, self)); } }; pub const Helper = struct { const Function = struct { length: u8, magic: i16 = 0, func: JsCFunctionTypeZ, }; const GetSet = struct { get: ?JsCGetter = null, set: ?JsCSetter = null, }; const GetSetMagic = struct { get: ?JsCGetterMagic = null, set: ?JsCSetterMagic = null, magic: i16, }; const PropValue = union(enum) { str: [*:0]const u8, int: i32, long: i64, double: f64, undef: void, }; const Prop = struct { value: PropValue, flags: PropFlags = .{}, }; const Object = struct { list: []const JsCFunctionListEntry, flags: PropFlags = .{}, }; const Alias = struct { name: [*:0]const u8, base: c_int = -1, }; name: [*:0]const u8, def: union(enum) { func: Function, getset: GetSet, getsetMagic: GetSetMagic, prop: Prop, object: Object, alias: Alias, }, }; pub fn from(helper: Helper) @This() { const JS_PROP_CONFIGURABLE = 1 << 0; const JS_PROP_WRITABLE = 1 << 1; const JS_PROP_ENUMERABLE = 1 << 2; const JS_PROP_C_W_E = JS_PROP_CONFIGURABLE | (JS_PROP_WRITABLE | JS_PROP_ENUMERABLE); const JS_PROP_LENGTH = 1 << 3; const JS_PROP_TMASK = 3 << 4; const JS_PROP_NORMAL = 0 << 4; const JS_PROP_GETSET = 1 << 4; const JS_PROP_VARREF = 2 << 4; const JS_PROP_AUTOINIT = 3 << 4; const JS_DEF_CFUNC: u8 = 0; const JS_DEF_CGETSET: u8 = 1; const JS_DEF_CGETSET_MAGIC: u8 = 2; const JS_DEF_PROP_STRING: u8 = 3; const JS_DEF_PROP_INT32: u8 = 4; const JS_DEF_PROP_INT64: u8 = 5; const JS_DEF_PROP_DOUBLE: u8 = 6; const JS_DEF_PROP_UNDEFINED: u8 = 7; const JS_DEF_OBJECT: u8 = 8; const JS_DEF_ALIAS: u8 = 9; var ret = @This(){ .name = helper.name, .prop_flags = switch (helper.def) { .func => JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, .getset => JS_PROP_CONFIGURABLE, .getsetMagic => JS_PROP_CONFIGURABLE, .prop => |prop| prop.flags.dump(), .object => |obj| obj.flags.dump(), .alias => JS_PROP_WRITABLE | JS_PROP_CONFIGURABLE, }, .def_type = switch (helper.def) { .func => JS_DEF_CFUNC, .getset => JS_DEF_CGETSET, .getsetMagic => JS_DEF_CGETSET_MAGIC, .prop => |prop| switch (prop.value) { .str => JS_DEF_PROP_STRING, .int => JS_DEF_PROP_INT32, .long => JS_DEF_PROP_INT64, .double => JS_DEF_PROP_DOUBLE, .undef => JS_DEF_PROP_UNDEFINED, }, .object => JS_DEF_OBJECT, .alias => JS_DEF_ALIAS, }, .magic = switch (helper.def) { .func => |f| f.magic, .getsetMagic => |getset| getset.magic, else => 0, }, .u = undefined, }; ret.u = switch (helper.def) { .func => |f| .{ .func = .{ .length = f.length, .cproto = std.meta.activeTag(f.func), .cfunc = f.func.dump(), }, }, .getset => |gs| .{ .getset = .{ .get = if (gs.get) |get| .{ .getter = get } else .{ .none = 0 }, .set = if (gs.set) |set| .{ .setter = set } else .{ .none = 0 }, }, }, .getsetMagic => |gs| .{ .getset = .{ .get = if (gs.get) |get| .{ .getter_magic = get } else .{ .none = 0 }, .set = if (gs.set) |set| .{ .setter_magic = set } else .{ .none = 0 }, }, }, .prop => |prop| switch (prop.value) { .str => |v| U{ .str = v }, .int => |v| U{ .int = v }, .long => |v| U{ .long = v }, .double => |v| U{ .double = v }, .undef => U{ .int = 0 }, }, .object => |object| .{ .prop_list = .{ .tab = object.list.ptr, .len = @intCast(c_int, object.list.len), }, }, .alias => |alias| .{ .alias = .{ .name = alias.name, .base = alias.base, }, }, }; return ret; } pub fn genFunction(name: [*:0]const u8, def: Helper.Function) @This() { return from(.{ .name = name, .def = .{ .func = def } }); } pub fn genGetSet(name: [*:0]const u8, def: Helper.GetSet) @This() { return from(.{ .name = name, .def = .{ .getset = def } }); } pub fn genGetSetMagic(name: [*:0]const u8, def: Helper.GetSetMagic) @This() { return from(.{ .name = name, .def = .{ .getsetMagic = def } }); } pub fn genProp(name: [*:0]const u8, def: Helper.PropValue, flags: PropFlags) @This() { return from(.{ .name = name, .def = .{ .prop = .{ .value = def, .flags = flags } } }); } pub fn genObject(name: [*:0]const u8, def: Helper.Object) @This() { return from(.{ .name = name, .def = .{ .object = def } }); } pub fn genAlias(name: [*:0]const u8, def: Helper.Alias) @This() { return from(.{ .name = name, .def = .{ .alias = def } }); } }; extern fn JS_SetPropertyFunctionList(ctx: *JsContext, obj: JsValue, tab: [*]const JsCFunctionListEntry, len: c_int) void; const JsModuleInitFunc = fn (*JsContext, *JsModuleDef) callconv(.C) c_int; extern fn JS_NewCModule(ctx: *JsContext, name_str: [*:0]const u8, func: JsModuleInitFunc) ?*JsModuleDef; // can only be called before the module is instantiated extern fn JS_AddModuleExport(ctx: *JsContext, m: *JsModuleDef, name_str: [*:0]const u8) c_int; extern fn JS_AddModuleExportList(ctx: *JsContext, m: *JsModuleDef, tab: [*]const JsCFunctionListEntry, len: c_int) c_int; // can only be called after the module is instantiated extern fn JS_SetModuleExport(ctx: *JsContext, m: *JsModuleDef, export_name: [*:0]const u8, val: JsValue) c_int; extern fn JS_SetModuleExportList(ctx: *JsContext, m: *JsModuleDef, tab: [*]const JsCFunctionListEntry, len: c_int) c_int; extern fn JS_NewBigInt64(ctx: *JsContext, v: i64) JsValue; extern fn JS_NewBigUint64(ctx: *JsContext, v: u64) JsValue; extern fn JS_Throw(ctx: *JsContext, obj: JsValue) JsValue; extern fn JS_GetException(ctx: *JsContext) JsValue; extern fn JS_IsError(ctx: *JsContext, val: JsValue) bool; extern fn JS_ResetUncatchableError(ctx: *JsContext) void; extern fn JS_NewError(ctx: *JsContext) JsValue; extern fn JS_ThrowSyntaxError(ctx: *JsContext, fmt: [*:0]const u8, ...) JsValue; extern fn JS_ThrowTypeError(ctx: *JsContext, fmt: [*:0]const u8, ...) JsValue; extern fn JS_ThrowReferenceError(ctx: *JsContext, fmt: [*:0]const u8, ...) JsValue; extern fn JS_ThrowRangeError(ctx: *JsContext, fmt: [*:0]const u8, ...) JsValue; extern fn JS_ThrowInternalError(ctx: *JsContext, fmt: [*:0]const u8, ...) JsValue; extern fn JS_ThrowOutOfMemory(ctx: *JsContext) JsValue; pub const JsError = union(enum) { Syntax: []const u8, Type: []const u8, Reference: []const u8, Range: []const u8, Internal: []const u8, OutOfMemory: void, }; pub const Detect = enum { Error, Function, Constructor, Array, }; pub const JsModuleDef = opaque { const scoped = std.log.scoped(.@"js module"); pub fn getImportMeta(self: *@This(), ctx: *JsContext) JsValue { return JS_GetImportMeta(ctx, self); } pub fn getModuleName(self: *@This(), ctx: *JsContext) JsAtom { return JS_GetModuleName(ctx, self); } pub fn setModuleExport(self: *@This(), ctx: *JsContext, name: [*:0]const u8, value: JsValue) void { _ = JS_SetModuleExport(ctx, self, name, value); } pub fn init(comptime name: [*:0]const u8, ctx: *JsContext, comptime T: type) !*@This() { const Trampoline = opaque { fn on_load(_ctx: *JsContext, mod: *JsModuleDef) callconv(.C) c_int { scoped.info("load c module: {s}", .{name}); _ = JS_SetModuleExportList(_ctx, mod, &T.storage, @intCast(c_int, T.storage.len)); if (@hasDecl(T, "load")) T.load(_ctx, mod); return 0; } }; scoped.info("new c module: {s}", .{name}); const ret = JS_NewCModule(ctx, name, Trampoline.on_load) orelse return error.FailedToCreateModule; if (@hasDecl(T, "init")) try T.init(ctx, ret); for (T.storage) |item| { const r = JS_AddModuleExport(ctx, ret, item.name); if (r != 0) return error.FailedToLoadModule; } if (@hasDecl(T, "extra")) { for (T.extra) |ename| { _ = JS_AddModuleExport(ctx, ret, ename); } } return ret; } }; pub const JsClassExoticMethods = extern struct { getOwnProperty: ?fn (ctx: *JsContext, desc: *JsPropertyDescriptor, obj: JsValue, prop: JsAtom) callconv(.C) c_int, getOwnPropertyNames: ?fn (ctx: *JsContext, ptab: **JsPropertyEnum, plen: *u32, obj: JsValue) callconv(.C) c_int, deleteProperty: ?fn (ctx: *JsContext, obj: JsValue, prop: JsAtom) callconv(.C) c_int, defineOwnProperty: ?fn (ctx: *JsContext, this: JsValue, prop: JsAtom, val: JsValue, getter: JsValue, setter: JsValue, flags: c_int) callconv(.C) c_int, hasProperty: ?fn (ctx: *JsContext, this_obj: JsValue, prop: JsAtom) callconv(.C) c_int, getProperty: ?fn (ctx: *JsContext, obj: JsValue, prop: JsAtom, receiver: JsValue) callconv(.C) c_int, setProperty: ?fn (ctx: *JsContext, obj: JsValue, atom: JsAtom, value: JsValue, receiver: JsValue, flags: c_int) callconv(.C) c_int, }; pub const JsClassDef = extern struct { name: [*:0]const u8, finalizer: ?fn (rt: *JsRuntime, val: JsValue) callconv(.C) void = null, gcMark: ?fn (rt: *JsRuntime, val: JsValue, mark: JS_MarkFunc) callconv(.C) void = null, call: ?fn (ctx: *JsContext, func: JsValue, this: JsValue, argc: c_int, argv: [*]JsValue, construct: bool) callconv(.C) JsValue = null, extoic: ?*const JsClassExoticMethods = null, };
src/quickjs.zig
const std = @import("std"); const data = @import("data.zig"); usingnamespace @import("wren.zig"); const HashedArrayList = @import("libs/hashed_array_list.zig").HashedArrayList; /// Registers our Zig-backed fn so it can be called from Wren pub fn registerMethod( vm:?*VM, module:[]const u8, className:[]const u8, signature:[]const u8, isStatic:bool, ptr:ForeignMethodFn ) !void { if(vm) |vm_ptr| { data.method_lookup.append(@ptrToInt(vm_ptr),ForeignMethod { .module = module, .className = className, .signature = signature, .isStatic = isStatic, .ptr = @ptrCast(ForeignMethodFnC,ptr), }) catch return error.FailedToRegisterMethod; } else return error.NullVmPtr; } /// Finds and returns a forign method fn signature from our registered methods pub fn findMethod ( vm:?*VM, module:[]const u8, className:[]const u8, signature:[]const u8, isStatic:bool, ) !ForeignMethodFnC { // TODO: Iterator vs direct array iteration? // TODO: Change this to some kind of hash-based structure, maybe hashmap of array lists // keyed on something like a concatenation of the params? Might have faster lookup // if this is heavily loaded out, bench it at some point and see where the tipping // point is. if(vm) |vm_ptr| { if(data.method_lookup.getKey(@ptrToInt(vm_ptr))) |a_list| { for(a_list.items) |item| { if(std.mem.eql(u8,item.module,module) and std.mem.eql(u8,item.className,className) and std.mem.eql(u8,item.signature,signature) and item.isStatic == isStatic) { return item.ptr; } } } else return error.InvalidVm; return error.ForeignMethodNotFound; } else return error.NullVmPointer; } /// Registers our Zig-backed struct so it can be used/instantiated from Wren /// Requires 2 Zig functions, one called on creation, and one on destruction. pub fn registerClass( vm:?*VM, module:[]const u8, className:[]const u8, allocate_fn:AllocateFnSig, finalize_fn:FinalizeFnSig, ) !void { if(vm) |vm_ptr| { data.class_lookup.append(@ptrToInt(vm_ptr),ForeignClass{ .module = module, .className = className, .methods = ForeignClassMethods { .allocate = @ptrCast(AllocateFnSigC,allocate_fn), .finalize = @ptrCast(FinalizeFnSigC,finalize_fn), } }) catch return error.FailedToRegisterClass; } else return error.NullVmPtr; } /// Finds and returns out cached Zig-backed class for Wren usage pub fn findClass ( vm:?*VM, module:[]const u8, className:[]const u8, ) !ForeignClassMethods { // TODO: Iterator vs direct array iteration? // TODO: See notes on findMethod above, same thing applies here. if(vm) |vm_ptr| { if(data.class_lookup.getKey(@ptrToInt(vm_ptr))) |a_list| { for(a_list.items) |item| { if(std.mem.eql(u8,item.module,module) and std.mem.eql(u8,item.className,className)) { return item.methods; } } return error.ForeignClassNotFound; } else return error.InvalidVm; } else return error.NullVmPointer; } pub fn castDataPtr(comptime T: type, pointer: ?*c_void) *T { // TODO: Sanity check, change to error union return @ptrCast(*T,@alignCast(@alignOf(*T),pointer)); }
src/foreign.zig
pub const AUDCLNT_STREAMFLAGS_CROSSPROCESS = @as(u32, 65536); pub const AUDCLNT_STREAMFLAGS_LOOPBACK = @as(u32, 131072); pub const AUDCLNT_STREAMFLAGS_EVENTCALLBACK = @as(u32, 262144); pub const AUDCLNT_STREAMFLAGS_NOPERSIST = @as(u32, 524288); pub const AUDCLNT_STREAMFLAGS_RATEADJUST = @as(u32, 1048576); pub const AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY = @as(u32, 134217728); pub const AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM = @as(u32, 2147483648); pub const AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED = @as(u32, 268435456); pub const AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE = @as(u32, 536870912); pub const AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED = @as(u32, 1073741824); pub const WAVE_FORMAT_EXTENSIBLE = @as(u32, 65534); pub const KSDSOUND_BUFFER_PRIMARY = @as(u32, 1); pub const KSDSOUND_BUFFER_STATIC = @as(u32, 2); pub const KSDSOUND_BUFFER_LOCHARDWARE = @as(u32, 4); pub const KSDSOUND_BUFFER_LOCSOFTWARE = @as(u32, 8); pub const KSDSOUND_BUFFER_CTRL_3D = @as(u32, 1); pub const KSDSOUND_BUFFER_CTRL_FREQUENCY = @as(u32, 2); pub const KSDSOUND_BUFFER_CTRL_PAN = @as(u32, 4); pub const KSDSOUND_BUFFER_CTRL_VOLUME = @as(u32, 8); pub const KSDSOUND_BUFFER_CTRL_POSITIONNOTIFY = @as(u32, 16); pub const DEVPKEY_KsAudio_PacketSize_Constraints = PROPERTYKEY { .fmtid = @import("../../zig.zig").Guid.initString("13e004d6-b066-43bd-913b-a415cd13da87"), .pid = 2 }; pub const DEVPKEY_KsAudio_Controller_DeviceInterface_Path = PROPERTYKEY { .fmtid = @import("../../zig.zig").Guid.initString("13e004d6-b066-43bd-913b-a415cd13da87"), .pid = 3 }; pub const DEVPKEY_KsAudio_PacketSize_Constraints2 = PROPERTYKEY { .fmtid = @import("../../zig.zig").Guid.initString("9404f781-7191-409b-8b0b-80bf6ec229ae"), .pid = 2 }; pub const KSAUDIO_STEREO_SPEAKER_GEOMETRY_HEADPHONE = @as(i32, -1); pub const KSAUDIO_STEREO_SPEAKER_GEOMETRY_MIN = @as(u32, 5); pub const KSAUDIO_STEREO_SPEAKER_GEOMETRY_NARROW = @as(u32, 10); pub const KSAUDIO_STEREO_SPEAKER_GEOMETRY_WIDE = @as(u32, 20); pub const KSAUDIO_STEREO_SPEAKER_GEOMETRY_MAX = @as(u32, 180); pub const KSDSOUND_3D_MODE_NORMAL = @as(u32, 0); pub const KSDSOUND_3D_MODE_HEADRELATIVE = @as(u32, 1); pub const KSDSOUND_3D_MODE_DISABLE = @as(u32, 2); pub const KSDSOUND_BUFFER_CTRL_HRTF_3D = @as(u32, 1073741824); pub const KSAUDIO_QUALITY_WORST = @as(u32, 0); pub const KSAUDIO_QUALITY_PC = @as(u32, 1); pub const KSAUDIO_QUALITY_BASIC = @as(u32, 2); pub const KSAUDIO_QUALITY_ADVANCED = @as(u32, 3); pub const KSAUDIO_CPU_RESOURCES_NOT_HOST_CPU = @as(u32, 0); pub const KSAUDIO_CPU_RESOURCES_HOST_CPU = @as(u32, 2147483647); pub const SPEAKER_FRONT_LEFT = @as(u32, 1); pub const SPEAKER_FRONT_RIGHT = @as(u32, 2); pub const SPEAKER_FRONT_CENTER = @as(u32, 4); pub const SPEAKER_LOW_FREQUENCY = @as(u32, 8); pub const SPEAKER_BACK_LEFT = @as(u32, 16); pub const SPEAKER_BACK_RIGHT = @as(u32, 32); pub const SPEAKER_FRONT_LEFT_OF_CENTER = @as(u32, 64); pub const SPEAKER_FRONT_RIGHT_OF_CENTER = @as(u32, 128); pub const SPEAKER_BACK_CENTER = @as(u32, 256); pub const SPEAKER_SIDE_LEFT = @as(u32, 512); pub const SPEAKER_SIDE_RIGHT = @as(u32, 1024); pub const SPEAKER_TOP_CENTER = @as(u32, 2048); pub const SPEAKER_TOP_FRONT_LEFT = @as(u32, 4096); pub const SPEAKER_TOP_FRONT_CENTER = @as(u32, 8192); pub const SPEAKER_TOP_FRONT_RIGHT = @as(u32, 16384); pub const SPEAKER_TOP_BACK_LEFT = @as(u32, 32768); pub const SPEAKER_TOP_BACK_CENTER = @as(u32, 65536); pub const SPEAKER_TOP_BACK_RIGHT = @as(u32, 131072); pub const SPEAKER_RESERVED = @as(u32, 2147221504); pub const SPEAKER_ALL = @as(u32, 2147483648); pub const KSAUDIO_SPEAKER_DIRECTOUT = @as(u32, 0); pub const KSNODEPIN_STANDARD_IN = @as(u32, 1); pub const KSNODEPIN_STANDARD_OUT = @as(u32, 0); pub const KSNODEPIN_SUM_MUX_IN = @as(u32, 1); pub const KSNODEPIN_SUM_MUX_OUT = @as(u32, 0); pub const KSNODEPIN_DEMUX_IN = @as(u32, 0); pub const KSNODEPIN_DEMUX_OUT = @as(u32, 1); pub const KSNODEPIN_AEC_RENDER_IN = @as(u32, 1); pub const KSNODEPIN_AEC_RENDER_OUT = @as(u32, 0); pub const KSNODEPIN_AEC_CAPTURE_IN = @as(u32, 2); pub const KSNODEPIN_AEC_CAPTURE_OUT = @as(u32, 3); pub const AEC_STATUS_FD_HISTORY_UNINITIALIZED = @as(u32, 0); pub const AEC_STATUS_FD_HISTORY_CONTINUOUSLY_CONVERGED = @as(u32, 1); pub const AEC_STATUS_FD_HISTORY_PREVIOUSLY_DIVERGED = @as(u32, 2); pub const AEC_STATUS_FD_CURRENTLY_CONVERGED = @as(u32, 8); pub const AEC_MODE_PASS_THROUGH = @as(u32, 0); pub const AEC_MODE_HALF_DUPLEX = @as(u32, 1); pub const AEC_MODE_FULL_DUPLEX = @as(u32, 2); pub const KSPROPERTY_WAVE_QUEUED_POSITION = @as(u32, 1); pub const KSMETHOD_WAVE_QUEUED_BREAKLOOP = @as(u32, 1); pub const KSWAVE_COMPATCAPS_INPUT = @as(u32, 0); pub const KSWAVE_COMPATCAPS_OUTPUT = @as(u32, 1); pub const KSWAVE_BUFFER_ATTRIBUTEF_LOOPING = @as(u32, 1); pub const KSWAVE_BUFFER_ATTRIBUTEF_STATIC = @as(u32, 2); pub const SYSAUDIO_FLAGS_DONT_COMBINE_PINS = @as(u32, 1); pub const SYSAUDIO_FLAGS_CLEAR_PREFERRED = @as(u32, 2); pub const KSMPEGVIDMODE_PANSCAN = @as(u32, 1); pub const KSMPEGVIDMODE_LTRBOX = @as(u32, 2); pub const KSMPEGVIDMODE_SCALE = @as(u32, 4); pub const KSAC3_ALTERNATE_AUDIO_1 = @as(u32, 1); pub const KSAC3_ALTERNATE_AUDIO_2 = @as(u32, 2); pub const KSAC3_ALTERNATE_AUDIO_BOTH = @as(u32, 3); pub const KSAC3_SERVICE_MAIN_AUDIO = @as(u32, 0); pub const KSAC3_SERVICE_NO_DIALOG = @as(u32, 1); pub const KSAC3_SERVICE_VISUALLY_IMPAIRED = @as(u32, 2); pub const KSAC3_SERVICE_HEARING_IMPAIRED = @as(u32, 3); pub const KSAC3_SERVICE_DIALOG_ONLY = @as(u32, 4); pub const KSAC3_SERVICE_COMMENTARY = @as(u32, 5); pub const KSAC3_SERVICE_EMERGENCY_FLASH = @as(u32, 6); pub const KSAC3_SERVICE_VOICE_OVER = @as(u32, 7); pub const KSAUDDECOUTMODE_STEREO_ANALOG = @as(u32, 1); pub const KSAUDDECOUTMODE_PCM_51 = @as(u32, 2); pub const KSAUDDECOUTMODE_SPDIFF = @as(u32, 4); pub const KS_DVD_CGMS_RESERVED_MASK = @as(u32, 120); pub const KS_DVD_CGMS_COPY_PROTECT_MASK = @as(u32, 24); pub const KS_DVD_CGMS_COPY_PERMITTED = @as(u32, 0); pub const KS_DVD_CGMS_COPY_ONCE = @as(u32, 16); pub const KS_DVD_CGMS_NO_COPY = @as(u32, 24); pub const KS_DVD_COPYRIGHT_MASK = @as(u32, 64); pub const KS_DVD_NOT_COPYRIGHTED = @as(u32, 0); pub const KS_DVD_COPYRIGHTED = @as(u32, 64); pub const KS_DVD_SECTOR_PROTECT_MASK = @as(u32, 32); pub const KS_DVD_SECTOR_NOT_PROTECTED = @as(u32, 0); pub const KS_DVD_SECTOR_PROTECTED = @as(u32, 32); pub const KS_BI_RGB = @as(i32, 0); pub const KS_BI_RLE8 = @as(i32, 1); pub const KS_BI_RLE4 = @as(i32, 2); pub const KS_BI_BITFIELDS = @as(i32, 3); pub const KS_BI_JPEG = @as(i32, 4); pub const KS_iPALETTE_COLORS = @as(u32, 256); pub const KS_iEGA_COLORS = @as(u32, 16); pub const KS_iMASK_COLORS = @as(u32, 3); pub const KS_iTRUECOLOR = @as(u32, 16); pub const KS_iRED = @as(u32, 0); pub const KS_iGREEN = @as(u32, 1); pub const KS_iBLUE = @as(u32, 2); pub const KS_iPALETTE = @as(u32, 8); pub const KS_iMAXBITS = @as(u32, 8); pub const KS_VBIDATARATE_NABTS = @as(i32, 5727272); pub const KS_VBIDATARATE_CC = @as(i32, 503493); pub const KS_TVTUNER_CHANGE_BEGIN_TUNE = @as(i32, 1); pub const KS_TVTUNER_CHANGE_END_TUNE = @as(i32, 2); pub const KS_INTERLACE_IsInterlaced = @as(u32, 1); pub const KS_INTERLACE_1FieldPerSample = @as(u32, 2); pub const KS_INTERLACE_Field1First = @as(u32, 4); pub const KS_INTERLACE_UNUSED = @as(u32, 8); pub const KS_INTERLACE_FieldPatternMask = @as(u32, 48); pub const KS_INTERLACE_FieldPatField1Only = @as(u32, 0); pub const KS_INTERLACE_FieldPatField2Only = @as(u32, 16); pub const KS_INTERLACE_FieldPatBothRegular = @as(u32, 32); pub const KS_INTERLACE_FieldPatBothIrregular = @as(u32, 48); pub const KS_INTERLACE_DisplayModeMask = @as(u32, 192); pub const KS_INTERLACE_DisplayModeBobOnly = @as(u32, 0); pub const KS_INTERLACE_DisplayModeWeaveOnly = @as(u32, 64); pub const KS_INTERLACE_DisplayModeBobOrWeave = @as(u32, 128); pub const KS_COPYPROTECT_RestrictDuplication = @as(u32, 1); pub const KS_MPEG2_DoPanScan = @as(u32, 1); pub const KS_MPEG2_DVDLine21Field1 = @as(u32, 2); pub const KS_MPEG2_DVDLine21Field2 = @as(u32, 4); pub const KS_MPEG2_SourceIsLetterboxed = @as(u32, 8); pub const KS_MPEG2_FilmCameraMode = @as(u32, 16); pub const KS_MPEG2_LetterboxAnalogOut = @as(u32, 32); pub const KS_MPEG2_DSS_UserData = @as(u32, 64); pub const KS_MPEG2_DVB_UserData = @as(u32, 128); pub const KS_MPEG2_27MhzTimebase = @as(u32, 256); pub const KS_MPEG2_WidescreenAnalogOut = @as(u32, 512); pub const KS_AMCONTROL_USED = @as(u32, 1); pub const KS_AMCONTROL_PAD_TO_4x3 = @as(u32, 2); pub const KS_AMCONTROL_PAD_TO_16x9 = @as(u32, 4); pub const KS_AMCONTROL_COLORINFO_PRESENT = @as(u32, 128); pub const KS_MAX_SIZE_MPEG1_SEQUENCE_INFO = @as(u32, 140); pub const KS_MPEGAUDIOINFO_27MhzTimebase = @as(u32, 1); pub const KS_VIDEOSTREAM_PREVIEW = @as(u32, 1); pub const KS_VIDEOSTREAM_CAPTURE = @as(u32, 2); pub const KS_VIDEOSTREAM_VBI = @as(u32, 16); pub const KS_VIDEOSTREAM_NABTS = @as(u32, 32); pub const KS_VIDEOSTREAM_CC = @as(u32, 256); pub const KS_VIDEOSTREAM_EDS = @as(u32, 512); pub const KS_VIDEOSTREAM_TELETEXT = @as(u32, 1024); pub const KS_VIDEOSTREAM_STILL = @as(u32, 4096); pub const KS_VIDEOSTREAM_IS_VPE = @as(u32, 32768); pub const KS_VIDEO_ALLOC_VPE_SYSTEM = @as(u32, 1); pub const KS_VIDEO_ALLOC_VPE_DISPLAY = @as(u32, 2); pub const KS_VIDEO_ALLOC_VPE_AGP = @as(u32, 4); pub const KS_VBICAP_PROTECTION_MV_PRESENT = @as(i32, 1); pub const KS_VBICAP_PROTECTION_MV_HARDWARE = @as(i32, 2); pub const KS_VBICAP_PROTECTION_MV_DETECTED = @as(i32, 4); pub const KS_NABTS_GROUPID_ORIGINAL_CONTENT_BASE = @as(u32, 2048); pub const KS_NABTS_GROUPID_ORIGINAL_CONTENT_ADVERTISER_BASE = @as(u32, 2064); pub const KS_NABTS_GROUPID_PRODUCTION_COMPANY_CONTENT_BASE = @as(u32, 2080); pub const KS_NABTS_GROUPID_PRODUCTION_COMPANY_ADVERTISER_BASE = @as(u32, 2096); pub const KS_NABTS_GROUPID_SYNDICATED_SHOW_CONTENT_BASE = @as(u32, 2112); pub const KS_NABTS_GROUPID_SYNDICATED_SHOW_ADVERTISER_BASE = @as(u32, 2128); pub const KS_NABTS_GROUPID_NETWORK_WIDE_CONTENT_BASE = @as(u32, 2144); pub const KS_NABTS_GROUPID_NETWORK_WIDE_ADVERTISER_BASE = @as(u32, 2160); pub const KS_NABTS_GROUPID_TELEVISION_STATION_CONTENT_BASE = @as(u32, 2176); pub const KS_NABTS_GROUPID_TELEVISION_STATION_ADVERTISER_BASE = @as(u32, 2192); pub const KS_NABTS_GROUPID_LOCAL_CABLE_SYSTEM_CONTENT_BASE = @as(u32, 2208); pub const KS_NABTS_GROUPID_LOCAL_CABLE_SYSTEM_ADVERTISER_BASE = @as(u32, 2224); pub const KS_NABTS_GROUPID_MICROSOFT_RESERVED_TEST_DATA_BASE = @as(u32, 2288); pub const MAX_NABTS_VBI_LINES_PER_FIELD = @as(u32, 11); pub const NABTS_LINES_PER_BUNDLE = @as(u32, 16); pub const NABTS_PAYLOAD_PER_LINE = @as(u32, 28); pub const NABTS_BYTES_PER_LINE = @as(u32, 36); pub const KS_CC_SUBSTREAM_ODD = @as(i32, 1); pub const KS_CC_SUBSTREAM_EVEN = @as(i32, 2); pub const KS_CC_SUBSTREAM_FIELD1_MASK = @as(i32, 240); pub const KS_CC_SUBSTREAM_SERVICE_CC1 = @as(i32, 16); pub const KS_CC_SUBSTREAM_SERVICE_CC2 = @as(i32, 32); pub const KS_CC_SUBSTREAM_SERVICE_T1 = @as(i32, 64); pub const KS_CC_SUBSTREAM_SERVICE_T2 = @as(i32, 128); pub const KS_CC_SUBSTREAM_FIELD2_MASK = @as(i32, 7936); pub const KS_CC_SUBSTREAM_SERVICE_CC3 = @as(i32, 256); pub const KS_CC_SUBSTREAM_SERVICE_CC4 = @as(i32, 512); pub const KS_CC_SUBSTREAM_SERVICE_T3 = @as(i32, 1024); pub const KS_CC_SUBSTREAM_SERVICE_T4 = @as(i32, 2048); pub const KS_CC_SUBSTREAM_SERVICE_XDS = @as(i32, 4096); pub const CC_MAX_HW_DECODE_LINES = @as(u32, 12); pub const NABTS_BUFFER_PICTURENUMBER_SUPPORT = @as(u32, 1); pub const WST_TVTUNER_CHANGE_BEGIN_TUNE = @as(i32, 4096); pub const WST_TVTUNER_CHANGE_END_TUNE = @as(i32, 8192); pub const MAX_WST_VBI_LINES_PER_FIELD = @as(u32, 17); pub const WST_BYTES_PER_LINE = @as(u32, 42); pub const KS_VIDEO_FLAG_FIELD_MASK = @as(i32, 3); pub const KS_VIDEO_FLAG_FRAME = @as(i32, 0); pub const KS_VIDEO_FLAG_FIELD1 = @as(i32, 1); pub const KS_VIDEO_FLAG_FIELD2 = @as(i32, 2); pub const KS_VIDEO_FLAG_FIELD1FIRST = @as(i32, 4); pub const KS_VIDEO_FLAG_WEAVE = @as(i32, 8); pub const KS_VIDEO_FLAG_IPB_MASK = @as(i32, 48); pub const KS_VIDEO_FLAG_I_FRAME = @as(i32, 0); pub const KS_VIDEO_FLAG_P_FRAME = @as(i32, 16); pub const KS_VIDEO_FLAG_B_FRAME = @as(i32, 32); pub const KS_VIDEO_FLAG_REPEAT_FIELD = @as(i32, 64); pub const KS_VBI_FLAG_FRAME = @as(i32, 0); pub const KS_VBI_FLAG_FIELD1 = @as(i32, 1); pub const KS_VBI_FLAG_FIELD2 = @as(i32, 2); pub const KS_VBI_FLAG_MV_PRESENT = @as(i32, 256); pub const KS_VBI_FLAG_MV_HARDWARE = @as(i32, 512); pub const KS_VBI_FLAG_MV_DETECTED = @as(i32, 1024); pub const KS_VBI_FLAG_TVTUNER_CHANGE = @as(i32, 16); pub const KS_VBI_FLAG_VBIINFOHEADER_CHANGE = @as(i32, 32); pub const KS_AnalogVideo_NTSC_Mask = @as(u32, 7); pub const KS_AnalogVideo_PAL_Mask = @as(u32, 1052656); pub const KS_AnalogVideo_SECAM_Mask = @as(u32, 1044480); pub const KSPROPERTY_VIDEOPROCAMP_FLAGS_AUTO = @as(i32, 1); pub const KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL = @as(i32, 2); pub const KSPROPERTY_CAMERACONTROL_FLAGS_AUTO = @as(i32, 1); pub const KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL = @as(i32, 2); pub const KSPROPERTY_CAMERACONTROL_FLAGS_ASYNCHRONOUS = @as(i32, 4); pub const KSPROPERTY_CAMERACONTROL_FLAGS_ABSOLUTE = @as(i32, 0); pub const KSPROPERTY_CAMERACONTROL_FLAGS_RELATIVE = @as(i32, 16); pub const KSPROPERTY_CAMERACONTROL_FLASH_OFF = @as(i32, 0); pub const KSPROPERTY_CAMERACONTROL_FLASH_ON = @as(i32, 1); pub const KSPROPERTY_CAMERACONTROL_FLASH_AUTO = @as(i32, 2); pub const KSPROPERTY_CAMERACONTROL_FLASH_FLAGS_AUTO = @as(i32, 1); pub const KSPROPERTY_CAMERACONTROL_FLASH_FLAGS_MANUAL = @as(i32, 2); pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_OFF = @as(i32, 0); pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_HIGH = @as(i32, 1); pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_MEDIUM = @as(i32, 2); pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_LOW = @as(i32, 3); pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_AUTO = @as(i32, 4); pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_FLAGS_AUTO = @as(i32, 1); pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_FLAGS_MANUAL = @as(i32, 2); pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_FLAGS_AUTO = @as(i32, 1); pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_FLAGS_MANUAL = @as(i32, 2); pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_FLAGS_ASYNC = @as(i32, -2147483648); pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_CONFIG_FOCUS = @as(i32, 256); pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_CONFIG_EXPOSURE = @as(i32, 512); pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_CONFIG_WB = @as(i32, 1024); pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_CONVERGEMODE = @as(i32, 1073741824); pub const KSPROPERTY_CAMERACONTROL_IMAGE_PIN_CAPABILITY_EXCLUSIVE_WITH_RECORD = @as(i32, 1); pub const KSPROPERTY_CAMERACONTROL_IMAGE_PIN_CAPABILITY_SEQUENCE_EXCLUSIVE_WITH_RECORD = @as(i32, 2); pub const KSCAMERA_EXTENDEDPROP_FILTERSCOPE = @as(u32, 4294967295); pub const KSCAMERA_EXTENDEDPROP_CAPS_RESERVED = @as(u64, 18374686479671623680); pub const KSCAMERA_EXTENDEDPROP_CAPS_ASYNCCONTROL = @as(u64, 9223372036854775808); pub const KSCAMERA_EXTENDEDPROP_CAPS_CANCELLABLE = @as(u64, 4611686018427387904); pub const KSCAMERA_EXTENDEDPROP_FLAG_CANCELOPERATION = @as(u64, 9223372036854775808); pub const KSCAMERA_EXTENDEDPROP_CAPS_MASK = @as(u64, 18374686479671623680); pub const KSCAMERA_EXTENDEDPROP_FLAG_MASK = @as(u64, 18374686479671623680); pub const KSCAMERA_EXTENDEDPROP_PHOTOMODE_NORMAL = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_PHOTOMODE_SEQUENCE = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_WARMSTART_MODE_DISABLED = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_WARMSTART_MODE_ENABLED = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_PHOTOTHUMBNAIL_DISABLE = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_PHOTOTHUMBNAIL_2X = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_PHOTOTHUMBNAIL_4X = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_PHOTOTHUMBNAIL_8X = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_PHOTOTHUMBNAIL_16X = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_AUTO = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_MACRO = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_PORTRAIT = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_SPORT = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_SNOW = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_NIGHT = @as(u64, 16); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_BEACH = @as(u64, 32); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_SUNSET = @as(u64, 64); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_CANDLELIGHT = @as(u64, 128); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_LANDSCAPE = @as(u64, 256); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_NIGHTPORTRAIT = @as(u64, 512); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_BACKLIT = @as(u64, 1024); pub const KSCAMERA_EXTENDEDPROP_SCENEMODE_MANUAL = @as(u64, 36028797018963968); pub const KSCAMERA_EXTENDEDPROP_VIDEOTORCH_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_VIDEOTORCH_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_VIDEOTORCH_ON_ADJUSTABLEPOWER = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_FLASH_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_FLASH_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_FLASH_ON_ADJUSTABLEPOWER = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_FLASH_AUTO = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_FLASH_AUTO_ADJUSTABLEPOWER = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_FLASH_REDEYEREDUCTION = @as(u64, 16); pub const KSCAMERA_EXTENDEDPROP_FLASH_SINGLEFLASH = @as(u64, 32); pub const KSCAMERA_EXTENDEDPROP_FLASH_MULTIFLASHSUPPORTED = @as(u64, 64); pub const KSCAMERA_EXTENDEDPROP_OPTIMIZATION_PHOTO = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_OPTIMIZATION_VIDEO = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_OPTIMIZATION_DEFAULT = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_OPTIMIZATION_QUALITY = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_OPTIMIZATION_LATENCY = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_OPTIMIZATION_POWER = @as(u64, 16); pub const KSCAMERA_EXTENDEDPROP_VIDEOPROCFLAG_AUTO = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_VIDEOPROCFLAG_MANUAL = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_VIDEOPROCFLAG_LOCK = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_FOCUS_CONTINUOUS = @as(u64, 256); pub const KSCAMERA_EXTENDEDPROP_FOCUS_RANGE_MACRO = @as(u64, 65536); pub const KSCAMERA_EXTENDEDPROP_FOCUS_RANGE_NORMAL = @as(u64, 131072); pub const KSCAMERA_EXTENDEDPROP_FOCUS_RANGE_FULLRANGE = @as(u64, 262144); pub const KSCAMERA_EXTENDEDPROP_FOCUS_RANGE_INFINITY = @as(u64, 524288); pub const KSCAMERA_EXTENDEDPROP_FOCUS_RANGE_HYPERFOCAL = @as(u64, 1048576); pub const KSCAMERA_EXTENDEDPROP_FOCUS_DISTANCE_INFINITY = @as(u64, 16777216); pub const KSCAMERA_EXTENDEDPROP_FOCUS_DISTANCE_HYPERFOCAL = @as(u64, 33554432); pub const KSCAMERA_EXTENDEDPROP_FOCUS_DISTANCE_NEAREST = @as(u64, 67108864); pub const KSCAMERA_EXTENDEDPROP_ISO_AUTO = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_ISO_50 = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_ISO_80 = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_ISO_100 = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_ISO_200 = @as(u64, 16); pub const KSCAMERA_EXTENDEDPROP_ISO_400 = @as(u64, 32); pub const KSCAMERA_EXTENDEDPROP_ISO_800 = @as(u64, 64); pub const KSCAMERA_EXTENDEDPROP_ISO_1600 = @as(u64, 128); pub const KSCAMERA_EXTENDEDPROP_ISO_3200 = @as(u64, 256); pub const KSCAMERA_EXTENDEDPROP_ISO_6400 = @as(u64, 512); pub const KSCAMERA_EXTENDEDPROP_ISO_12800 = @as(u64, 1024); pub const KSCAMERA_EXTENDEDPROP_ISO_25600 = @as(u64, 2048); pub const KSCAMERA_EXTENDEDPROP_FOCUS_CONTINUOUSLOCK = @as(u64, 512); pub const KSCAMERA_EXTENDEDPROP_FOCUS_UNLOCK = @as(u64, 1024); pub const KSCAMERA_EXTENDEDPROP_FOCUS_DRIVERFALLBACK_OFF = @as(u64, 2048); pub const KSCAMERA_EXTENDEDPROP_FOCUS_REGIONBASED = @as(u64, 4096); pub const KSCAMERA_EXTENDEDPROP_ISO_MANUAL = @as(u64, 36028797018963968); pub const KSCAMERA_EXTENDEDPROP_FLASH_ASSISTANT_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_FLASH_ASSISTANT_ON = @as(u64, 128); pub const KSCAMERA_EXTENDEDPROP_FLASH_ASSISTANT_AUTO = @as(u64, 256); pub const KSCAMERA_EXTENDEDPROP_EVCOMP_SIXTHSTEP = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_EVCOMP_QUARTERSTEP = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_EVCOMP_THIRDSTEP = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_EVCOMP_HALFSTEP = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_EVCOMP_FULLSTEP = @as(u64, 16); pub const KSCAMERA_EXTENDEDPROP_PHOTOMODE_SEQUENCE_SUB_NONE = @as(u32, 0); pub const KSCAMERA_EXTENDEDPROP_PHOTOMODE_SEQUENCE_SUB_VARIABLE = @as(u32, 1); pub const KSCAMERA_EXTENDEDPROP_METADATA_MEMORYTYPE_MASK = @as(u64, 255); pub const KSCAMERA_EXTENDEDPROP_METADATA_SYSTEMMEMORY = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_METADATA_ALIGNMENTREQUIRED = @as(u64, 256); pub const KSCAMERA_METADATA_FRAMEILLUMINATION_FLAG_ON = @as(u32, 1); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_EXPOSURETIME = @as(u32, 1); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_EXPOSURECOMPENSATION = @as(u32, 2); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_ISOSPEED = @as(u32, 4); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_FOCUSSTATE = @as(u32, 8); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_LENSPOSITION = @as(u32, 16); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_WHITEBALANCE = @as(u32, 32); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_FLASH = @as(u32, 64); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_FLASHPOWER = @as(u32, 128); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_ZOOMFACTOR = @as(u32, 256); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_SCENEMODE = @as(u32, 512); pub const KSCAMERA_METADATA_CAPTURESTATS_FLAG_SENSORFRAMERATE = @as(u32, 1024); pub const KSCAMERA_EXTENDEDPROP_FOCUSPRIORITY_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_FOCUSPRIORITY_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_PHOTOCONFIRMATION_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_PHOTOCONFIRMATION_ON = @as(u64, 1); pub const KSCAMERA_PERFRAMESETTING_AUTO = @as(u64, 4294967296); pub const KSCAMERA_PERFRAMESETTING_MANUAL = @as(u64, 8589934592); pub const KSCAMERA_EXTENDEDPROP_VIDEOSTABILIZATION_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_VIDEOSTABILIZATION_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_VIDEOSTABILIZATION_AUTO = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_VFR_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_VFR_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_FACEDETECTION_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_FACEDETECTION_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_FACEDETECTION_PREVIEW = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_FACEDETECTION_VIDEO = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_FACEDETECTION_PHOTO = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_FACEDETECTION_BLINK = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_FACEDETECTION_SMILE = @as(u64, 16); pub const KSCAMERA_EXTENDEDPROP_VIDEOHDR_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_VIDEOHDR_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_VIDEOHDR_AUTO = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_HISTOGRAM_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_HISTOGRAM_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_OIS_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_OIS_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_OIS_AUTO = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_ADVANCEDPHOTO_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_ADVANCEDPHOTO_AUTO = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_ADVANCEDPHOTO_HDR = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_ADVANCEDPHOTO_FNF = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_ADVANCEDPHOTO_ULTRALOWLIGHT = @as(u64, 8); pub const KSCAMERA_EXTENDEDPROP_ZOOM_DEFAULT = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_ZOOM_DIRECT = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_ZOOM_SMOOTH = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_FACEAUTH_MODE_DISABLED = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_FACEAUTH_MODE_ALTERNATIVE_FRAME_ILLUMINATION = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_FACEAUTH_MODE_BACKGROUND_SUBTRACTION = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_SECUREMODE_DISABLED = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_SECUREMODE_ENABLED = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_VIDEOTEMPORALDENOISING_AUTO = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_VIDEOTEMPORALDENOISING_OFF = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_VIDEOTEMPORALDENOISING_ON = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_IRTORCHMODE_OFF = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_IRTORCHMODE_ALWAYS_ON = @as(u64, 2); pub const KSCAMERA_EXTENDEDPROP_IRTORCHMODE_ALTERNATING_FRAME_ILLUMINATION = @as(u64, 4); pub const KSCAMERA_EXTENDEDPROP_RELATIVEPANELOPTIMIZATION_OFF = @as(u64, 0); pub const KSCAMERA_EXTENDEDPROP_RELATIVEPANELOPTIMIZATION_ON = @as(u64, 1); pub const KSCAMERA_EXTENDEDPROP_RELATIVEPANELOPTIMIZATION_DYNAMIC = @as(u64, 2); pub const KSCAMERAPROFILE_FLAGS_VIDEOSTABLIZATION = @as(u64, 1); pub const KSCAMERAPROFILE_FLAGS_VIDEOHDR = @as(u64, 2); pub const KSCAMERAPROFILE_FLAGS_PHOTOHDR = @as(u64, 4); pub const KSCAMERAPROFILE_FLAGS_FACEDETECTION = @as(u64, 8); pub const KSCAMERAPROFILE_FLAGS_VARIABLEPHOTOSEQUENCE = @as(u64, 16); pub const KSCAMERAPROFILE_FLAGS_PREVIEW_RES_MUSTMATCH = @as(u64, 32); pub const KSDEVICE_PROFILE_TYPE_UNKNOWN = @as(u32, 0); pub const KSDEVICE_PROFILE_TYPE_CAMERA = @as(u32, 1); pub const KSCameraProfileSensorType_RGB = @as(u32, 1); pub const KSCameraProfileSensorType_Infrared = @as(u32, 2); pub const KSCameraProfileSensorType_Depth = @as(u32, 4); pub const KSCameraProfileSensorType_PoseTracking = @as(u32, 8); pub const KSCameraProfileSensorType_ImageSegmentation = @as(u32, 16); pub const KSCameraProfileSensorType_Custom = @as(u32, 128); pub const KS_TVAUDIO_MODE_MONO = @as(u32, 1); pub const KS_TVAUDIO_MODE_STEREO = @as(u32, 2); pub const KS_TVAUDIO_MODE_LANG_A = @as(u32, 16); pub const KS_TVAUDIO_MODE_LANG_B = @as(u32, 32); pub const KS_TVAUDIO_MODE_LANG_C = @as(u32, 64); pub const KS_TVAUDIO_PRESET_STEREO = @as(u32, 512); pub const KS_TVAUDIO_PRESET_LANG_A = @as(u32, 4096); pub const KS_TVAUDIO_PRESET_LANG_B = @as(u32, 8192); pub const KS_TVAUDIO_PRESET_LANG_C = @as(u32, 16384); pub const DDPF_FOURCC = @as(i32, 4); pub const KS_AM_UseNewCSSKey = @as(i32, 1); pub const MAX_SINK_DESCRIPTION_NAME_LENGTH = @as(u32, 32); pub const JACKDESC2_PRESENCE_DETECT_CAPABILITY = @as(u32, 1); pub const JACKDESC2_DYNAMIC_FORMAT_CHANGE_CAPABILITY = @as(u32, 2); pub const KSPROPERTY_AUDIO_BUFFER_DURATION = @as(u32, 1); pub const AUDIOMODULE_MAX_DATA_SIZE = @as(u32, 64000); pub const AUDIOMODULE_MAX_NAME_CCH_SIZE = @as(u32, 128); pub const IOCTL_KS_PROPERTY = @as(u32, 3080195); pub const IOCTL_KS_ENABLE_EVENT = @as(u32, 3080199); pub const IOCTL_KS_DISABLE_EVENT = @as(u32, 3080203); pub const IOCTL_KS_METHOD = @as(u32, 3080207); pub const IOCTL_KS_WRITE_STREAM = @as(u32, 3112979); pub const IOCTL_KS_READ_STREAM = @as(u32, 3096599); pub const IOCTL_KS_RESET_STATE = @as(u32, 3080219); pub const KSPRIORITY_LOW = @as(u32, 1); pub const KSPRIORITY_NORMAL = @as(u32, 1073741824); pub const KSPRIORITY_HIGH = @as(u32, 2147483648); pub const KSPRIORITY_EXCLUSIVE = @as(u32, 4294967295); pub const KSMETHOD_TYPE_NONE = @as(u32, 0); pub const KSMETHOD_TYPE_READ = @as(u32, 1); pub const KSMETHOD_TYPE_WRITE = @as(u32, 2); pub const KSMETHOD_TYPE_MODIFY = @as(u32, 3); pub const KSMETHOD_TYPE_SOURCE = @as(u32, 4); pub const KSMETHOD_TYPE_SEND = @as(u32, 1); pub const KSMETHOD_TYPE_SETSUPPORT = @as(u32, 256); pub const KSMETHOD_TYPE_BASICSUPPORT = @as(u32, 512); pub const KSMETHOD_TYPE_TOPOLOGY = @as(u32, 268435456); pub const KSPROPERTY_TYPE_GET = @as(u32, 1); pub const KSPROPERTY_TYPE_GETPAYLOADSIZE = @as(u32, 4); pub const KSPROPERTY_TYPE_SET = @as(u32, 2); pub const KSPROPERTY_TYPE_SETSUPPORT = @as(u32, 256); pub const KSPROPERTY_TYPE_BASICSUPPORT = @as(u32, 512); pub const KSPROPERTY_TYPE_RELATIONS = @as(u32, 1024); pub const KSPROPERTY_TYPE_SERIALIZESET = @as(u32, 2048); pub const KSPROPERTY_TYPE_UNSERIALIZESET = @as(u32, 4096); pub const KSPROPERTY_TYPE_SERIALIZERAW = @as(u32, 8192); pub const KSPROPERTY_TYPE_UNSERIALIZERAW = @as(u32, 16384); pub const KSPROPERTY_TYPE_SERIALIZESIZE = @as(u32, 32768); pub const KSPROPERTY_TYPE_DEFAULTVALUES = @as(u32, 65536); pub const KSPROPERTY_TYPE_TOPOLOGY = @as(u32, 268435456); pub const KSPROPERTY_TYPE_HIGHPRIORITY = @as(u32, 134217728); pub const KSPROPERTY_TYPE_FSFILTERSCOPE = @as(u32, 1073741824); pub const KSPROPERTY_TYPE_COPYPAYLOAD = @as(u32, 2147483648); pub const KSPROPERTY_MEMBER_RANGES = @as(u32, 1); pub const KSPROPERTY_MEMBER_STEPPEDRANGES = @as(u32, 2); pub const KSPROPERTY_MEMBER_VALUES = @as(u32, 3); pub const KSPROPERTY_MEMBER_FLAG_DEFAULT = @as(u32, 1); pub const KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_MULTICHANNEL = @as(u32, 2); pub const KSPROPERTY_MEMBER_FLAG_BASICSUPPORT_UNIFORM = @as(u32, 4); pub const KSEVENTF_EVENT_HANDLE = @as(u32, 1); pub const KSEVENTF_SEMAPHORE_HANDLE = @as(u32, 2); pub const KSEVENTF_EVENT_OBJECT = @as(u32, 4); pub const KSEVENTF_SEMAPHORE_OBJECT = @as(u32, 8); pub const KSEVENTF_DPC = @as(u32, 16); pub const KSEVENTF_WORKITEM = @as(u32, 32); pub const KSEVENTF_KSWORKITEM = @as(u32, 128); pub const KSEVENT_TYPE_ENABLE = @as(u32, 1); pub const KSEVENT_TYPE_ONESHOT = @as(u32, 2); pub const KSEVENT_TYPE_ENABLEBUFFERED = @as(u32, 4); pub const KSEVENT_TYPE_SETSUPPORT = @as(u32, 256); pub const KSEVENT_TYPE_BASICSUPPORT = @as(u32, 512); pub const KSEVENT_TYPE_QUERYBUFFER = @as(u32, 1024); pub const KSEVENT_TYPE_TOPOLOGY = @as(u32, 268435456); pub const KSRELATIVEEVENT_FLAG_HANDLE = @as(u32, 1); pub const KSRELATIVEEVENT_FLAG_POINTER = @as(u32, 2); pub const KSMEDIUM_TYPE_ANYINSTANCE = @as(u32, 0); pub const KSPROPERTY_PIN_FLAGS_ATTRIBUTE_RANGE_AWARE = @as(u32, 1); pub const KSDATAFORMAT_BIT_TEMPORAL_COMPRESSION = @as(u32, 0); pub const KSDATAFORMAT_BIT_ATTRIBUTES = @as(u32, 1); pub const KSDATARANGE_BIT_ATTRIBUTES = @as(u32, 1); pub const KSDATARANGE_BIT_REQUIRED_ATTRIBUTES = @as(u32, 2); pub const KSATTRIBUTE_REQUIRED = @as(u32, 1); pub const KSALLOCATOR_REQUIREMENTF_INPLACE_MODIFIER = @as(u32, 1); pub const KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY = @as(u32, 2); pub const KSALLOCATOR_REQUIREMENTF_FRAME_INTEGRITY = @as(u32, 4); pub const KSALLOCATOR_REQUIREMENTF_MUST_ALLOCATE = @as(u32, 8); pub const KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY_CUSTOM_ALLOCATION = @as(u32, 16); pub const KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY = @as(u32, 2147483648); pub const KSALLOCATOR_OPTIONF_COMPATIBLE = @as(u32, 1); pub const KSALLOCATOR_OPTIONF_SYSTEM_MEMORY = @as(u32, 2); pub const KSALLOCATOR_OPTIONF_VALID = @as(u32, 3); pub const KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT = @as(u32, 16); pub const KSALLOCATOR_FLAG_DEVICE_SPECIFIC = @as(u32, 32); pub const KSALLOCATOR_FLAG_CAN_ALLOCATE = @as(u32, 64); pub const KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO = @as(u32, 128); pub const KSALLOCATOR_FLAG_NO_FRAME_INTEGRITY = @as(u32, 256); pub const KSALLOCATOR_FLAG_MULTIPLE_OUTPUT = @as(u32, 512); pub const KSALLOCATOR_FLAG_CYCLE = @as(u32, 1024); pub const KSALLOCATOR_FLAG_ALLOCATOR_EXISTS = @as(u32, 2048); pub const KSALLOCATOR_FLAG_INDEPENDENT_RANGES = @as(u32, 4096); pub const KSALLOCATOR_FLAG_ATTENTION_STEPPING = @as(u32, 8192); pub const KSALLOCATOR_FLAG_ENABLE_CACHED_MDL = @as(u32, 16384); pub const KSALLOCATOR_FLAG_2D_BUFFER_REQUIRED = @as(u32, 32768); pub const KSSTREAM_HEADER_OPTIONSF_SPLICEPOINT = @as(u32, 1); pub const KSSTREAM_HEADER_OPTIONSF_PREROLL = @as(u32, 2); pub const KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY = @as(u32, 4); pub const KSSTREAM_HEADER_OPTIONSF_TYPECHANGED = @as(u32, 8); pub const KSSTREAM_HEADER_OPTIONSF_TIMEVALID = @as(u32, 16); pub const KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY = @as(u32, 64); pub const KSSTREAM_HEADER_OPTIONSF_FLUSHONPAUSE = @as(u32, 128); pub const KSSTREAM_HEADER_OPTIONSF_DURATIONVALID = @as(u32, 256); pub const KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM = @as(u32, 512); pub const KSSTREAM_HEADER_OPTIONSF_BUFFEREDTRANSFER = @as(u32, 1024); pub const KSSTREAM_HEADER_OPTIONSF_VRAM_DATA_TRANSFER = @as(u32, 2048); pub const KSSTREAM_HEADER_OPTIONSF_METADATA = @as(u32, 4096); pub const KSSTREAM_HEADER_OPTIONSF_ENDOFPHOTOSEQUENCE = @as(u32, 8192); pub const KSSTREAM_HEADER_OPTIONSF_FRAMEINFO = @as(u32, 16384); pub const KSSTREAM_HEADER_OPTIONSF_PERSIST_SAMPLE = @as(u32, 32768); pub const KSSTREAM_HEADER_OPTIONSF_SAMPLE_PERSISTED = @as(u32, 65536); pub const KSSTREAM_HEADER_TRACK_COMPLETION_NUMBERS = @as(u32, 131072); pub const KSSTREAM_HEADER_OPTIONSF_SECUREBUFFERTRANSFER = @as(u32, 262144); pub const KSSTREAM_HEADER_OPTIONSF_LOOPEDDATA = @as(u32, 2147483648); pub const KSSTREAM_UVC_SECURE_ATTRIBUTE_SIZE = @as(u32, 8192); pub const KSFRAMETIME_VARIABLESIZE = @as(u32, 1); pub const KSRATE_NOPRESENTATIONSTART = @as(u32, 1); pub const KSRATE_NOPRESENTATIONDURATION = @as(u32, 2); pub const NANOSECONDS = @as(u32, 10000000); pub const KSPROBE_STREAMREAD = @as(u32, 0); pub const KSPROBE_STREAMWRITE = @as(u32, 1); pub const KSPROBE_ALLOCATEMDL = @as(u32, 16); pub const KSPROBE_PROBEANDLOCK = @as(u32, 32); pub const KSPROBE_SYSTEMADDRESS = @as(u32, 64); pub const KSPROBE_MODIFY = @as(u32, 512); pub const KSPROBE_ALLOWFORMATCHANGE = @as(u32, 128); pub const KSSTREAM_PAGED_DATA = @as(u32, 0); pub const KSSTREAM_NONPAGED_DATA = @as(u32, 256); pub const KSSTREAM_SYNCHRONOUS = @as(u32, 4096); pub const KSSTREAM_FAILUREEXCEPTION = @as(u32, 8192); pub const KSEVENT_ENTRY_DELETED = @as(u32, 1); pub const KSEVENT_ENTRY_ONESHOT = @as(u32, 2); pub const KSEVENT_ENTRY_BUFFERED = @as(u32, 4); pub const KSDISPATCH_FASTIO = @as(u32, 2147483648); pub const KSCREATE_ITEM_SECURITYCHANGED = @as(u32, 1); pub const KSCREATE_ITEM_WILDCARD = @as(u32, 2); pub const KSCREATE_ITEM_NOPARAMETERS = @as(u32, 4); pub const KSCREATE_ITEM_FREEONSTOP = @as(u32, 8); pub const BUS_INTERFACE_REFERENCE_VERSION = @as(u32, 256); pub const IOCTL_KS_HANDSHAKE = @as(u32, 3080223); pub const MIN_DEV_VER_FOR_QI = @as(u32, 256); pub const KSDEVICE_DESCRIPTOR_VERSION = @as(u32, 256); pub const KSDEVICE_DESCRIPTOR_VERSION_2 = @as(u32, 272); pub const MIN_DEV_VER_FOR_FLAGS = @as(u32, 272); pub const KSDEVICE_FLAG_ENABLE_REMOTE_WAKEUP = @as(u32, 1); pub const KSDEVICE_FLAG_LOWPOWER_PASSTHROUGH = @as(u32, 2); pub const KSDEVICE_FLAG_ENABLE_QUERYINTERFACE = @as(u32, 4); pub const KSFILTER_FLAG_DISPATCH_LEVEL_PROCESSING = @as(u32, 1); pub const KSFILTER_FLAG_CRITICAL_PROCESSING = @as(u32, 2); pub const KSFILTER_FLAG_HYPERCRITICAL_PROCESSING = @as(u32, 4); pub const KSFILTER_FLAG_RECEIVE_ZERO_LENGTH_SAMPLES = @as(u32, 8); pub const KSFILTER_FLAG_DENY_USERMODE_ACCESS = @as(u32, 2147483648); pub const KSFILTER_FLAG_PRIORITIZE_REFERENCEGUID = @as(u32, 16); pub const KSPIN_FLAG_ASYNCHRONOUS_PROCESSING = @as(u32, 8); pub const KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING = @as(u32, 16); pub const KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL = @as(u32, 32); pub const KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING = @as(u32, 64); pub const KSPIN_FLAG_ENFORCE_FIFO = @as(u32, 128); pub const KSPIN_FLAG_GENERATE_MAPPINGS = @as(u32, 256); pub const KSPIN_FLAG_DISTINCT_TRAILING_EDGE = @as(u32, 512); pub const KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY = @as(u32, 65536); pub const KSPIN_FLAG_SPLITTER = @as(u32, 131072); pub const KSPIN_FLAG_USE_STANDARD_TRANSPORT = @as(u32, 262144); pub const KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT = @as(u32, 524288); pub const KSPIN_FLAG_FIXED_FORMAT = @as(u32, 1048576); pub const KSPIN_FLAG_GENERATE_EOS_EVENTS = @as(u32, 2097152); pub const KSPIN_FLAG_IMPLEMENT_CLOCK = @as(u32, 4194304); pub const KSPIN_FLAG_SOME_FRAMES_REQUIRED_FOR_PROCESSING = @as(u32, 8388608); pub const KSPIN_FLAG_PROCESS_IF_ANY_IN_RUN_STATE = @as(u32, 16777216); pub const KSPIN_FLAG_DENY_USERMODE_ACCESS = @as(u32, 2147483648); pub const RT_STRING = @import("../../zig.zig").typedConst([*:0]const u16, @as(i32, 6)); pub const RT_RCDATA = @import("../../zig.zig").typedConst([*:0]const u16, @as(i32, 10)); pub const MCIERR_INVALID_DEVICE_ID = @as(u32, 257); pub const MCIERR_UNRECOGNIZED_KEYWORD = @as(u32, 259); pub const MCIERR_UNRECOGNIZED_COMMAND = @as(u32, 261); pub const MCIERR_HARDWARE = @as(u32, 262); pub const MCIERR_INVALID_DEVICE_NAME = @as(u32, 263); pub const MCIERR_OUT_OF_MEMORY = @as(u32, 264); pub const MCIERR_DEVICE_OPEN = @as(u32, 265); pub const MCIERR_CANNOT_LOAD_DRIVER = @as(u32, 266); pub const MCIERR_MISSING_COMMAND_STRING = @as(u32, 267); pub const MCIERR_PARAM_OVERFLOW = @as(u32, 268); pub const MCIERR_MISSING_STRING_ARGUMENT = @as(u32, 269); pub const MCIERR_BAD_INTEGER = @as(u32, 270); pub const MCIERR_PARSER_INTERNAL = @as(u32, 271); pub const MCIERR_DRIVER_INTERNAL = @as(u32, 272); pub const MCIERR_MISSING_PARAMETER = @as(u32, 273); pub const MCIERR_UNSUPPORTED_FUNCTION = @as(u32, 274); pub const MCIERR_FILE_NOT_FOUND = @as(u32, 275); pub const MCIERR_DEVICE_NOT_READY = @as(u32, 276); pub const MCIERR_INTERNAL = @as(u32, 277); pub const MCIERR_DRIVER = @as(u32, 278); pub const MCIERR_CANNOT_USE_ALL = @as(u32, 279); pub const MCIERR_MULTIPLE = @as(u32, 280); pub const MCIERR_EXTENSION_NOT_FOUND = @as(u32, 281); pub const MCIERR_OUTOFRANGE = @as(u32, 282); pub const MCIERR_FLAGS_NOT_COMPATIBLE = @as(u32, 284); pub const MCIERR_FILE_NOT_SAVED = @as(u32, 286); pub const MCIERR_DEVICE_TYPE_REQUIRED = @as(u32, 287); pub const MCIERR_DEVICE_LOCKED = @as(u32, 288); pub const MCIERR_DUPLICATE_ALIAS = @as(u32, 289); pub const MCIERR_BAD_CONSTANT = @as(u32, 290); pub const MCIERR_MUST_USE_SHAREABLE = @as(u32, 291); pub const MCIERR_MISSING_DEVICE_NAME = @as(u32, 292); pub const MCIERR_BAD_TIME_FORMAT = @as(u32, 293); pub const MCIERR_NO_CLOSING_QUOTE = @as(u32, 294); pub const MCIERR_DUPLICATE_FLAGS = @as(u32, 295); pub const MCIERR_INVALID_FILE = @as(u32, 296); pub const MCIERR_NULL_PARAMETER_BLOCK = @as(u32, 297); pub const MCIERR_UNNAMED_RESOURCE = @as(u32, 298); pub const MCIERR_NEW_REQUIRES_ALIAS = @as(u32, 299); pub const MCIERR_NOTIFY_ON_AUTO_OPEN = @as(u32, 300); pub const MCIERR_NO_ELEMENT_ALLOWED = @as(u32, 301); pub const MCIERR_NONAPPLICABLE_FUNCTION = @as(u32, 302); pub const MCIERR_ILLEGAL_FOR_AUTO_OPEN = @as(u32, 303); pub const MCIERR_FILENAME_REQUIRED = @as(u32, 304); pub const MCIERR_EXTRA_CHARACTERS = @as(u32, 305); pub const MCIERR_DEVICE_NOT_INSTALLED = @as(u32, 306); pub const MCIERR_GET_CD = @as(u32, 307); pub const MCIERR_SET_CD = @as(u32, 308); pub const MCIERR_SET_DRIVE = @as(u32, 309); pub const MCIERR_DEVICE_LENGTH = @as(u32, 310); pub const MCIERR_DEVICE_ORD_LENGTH = @as(u32, 311); pub const MCIERR_NO_INTEGER = @as(u32, 312); pub const MCIERR_WAVE_OUTPUTSINUSE = @as(u32, 320); pub const MCIERR_WAVE_SETOUTPUTINUSE = @as(u32, 321); pub const MCIERR_WAVE_INPUTSINUSE = @as(u32, 322); pub const MCIERR_WAVE_SETINPUTINUSE = @as(u32, 323); pub const MCIERR_WAVE_OUTPUTUNSPECIFIED = @as(u32, 324); pub const MCIERR_WAVE_INPUTUNSPECIFIED = @as(u32, 325); pub const MCIERR_WAVE_OUTPUTSUNSUITABLE = @as(u32, 326); pub const MCIERR_WAVE_SETOUTPUTUNSUITABLE = @as(u32, 327); pub const MCIERR_WAVE_INPUTSUNSUITABLE = @as(u32, 328); pub const MCIERR_WAVE_SETINPUTUNSUITABLE = @as(u32, 329); pub const MCIERR_SEQ_DIV_INCOMPATIBLE = @as(u32, 336); pub const MCIERR_SEQ_PORT_INUSE = @as(u32, 337); pub const MCIERR_SEQ_PORT_NONEXISTENT = @as(u32, 338); pub const MCIERR_SEQ_PORT_MAPNODEVICE = @as(u32, 339); pub const MCIERR_SEQ_PORT_MISCERROR = @as(u32, 340); pub const MCIERR_SEQ_TIMER = @as(u32, 341); pub const MCIERR_SEQ_PORTUNSPECIFIED = @as(u32, 342); pub const MCIERR_SEQ_NOMIDIPRESENT = @as(u32, 343); pub const MCIERR_NO_WINDOW = @as(u32, 346); pub const MCIERR_CREATEWINDOW = @as(u32, 347); pub const MCIERR_FILE_READ = @as(u32, 348); pub const MCIERR_FILE_WRITE = @as(u32, 349); pub const MCIERR_NO_IDENTITY = @as(u32, 350); pub const MCIERR_CUSTOM_DRIVER_BASE = @as(u32, 512); pub const MCI_OPEN = @as(u32, 2051); pub const MCI_CLOSE = @as(u32, 2052); pub const MCI_ESCAPE = @as(u32, 2053); pub const MCI_PLAY = @as(u32, 2054); pub const MCI_SEEK = @as(u32, 2055); pub const MCI_STOP = @as(u32, 2056); pub const MCI_PAUSE = @as(u32, 2057); pub const MCI_INFO = @as(u32, 2058); pub const MCI_GETDEVCAPS = @as(u32, 2059); pub const MCI_SPIN = @as(u32, 2060); pub const MCI_SET = @as(u32, 2061); pub const MCI_STEP = @as(u32, 2062); pub const MCI_RECORD = @as(u32, 2063); pub const MCI_SYSINFO = @as(u32, 2064); pub const MCI_BREAK = @as(u32, 2065); pub const MCI_SAVE = @as(u32, 2067); pub const MCI_STATUS = @as(u32, 2068); pub const MCI_CUE = @as(u32, 2096); pub const MCI_REALIZE = @as(u32, 2112); pub const MCI_WINDOW = @as(u32, 2113); pub const MCI_PUT = @as(u32, 2114); pub const MCI_WHERE = @as(u32, 2115); pub const MCI_FREEZE = @as(u32, 2116); pub const MCI_UNFREEZE = @as(u32, 2117); pub const MCI_LOAD = @as(u32, 2128); pub const MCI_CUT = @as(u32, 2129); pub const MCI_COPY = @as(u32, 2130); pub const MCI_PASTE = @as(u32, 2131); pub const MCI_UPDATE = @as(u32, 2132); pub const MCI_RESUME = @as(u32, 2133); pub const MCI_DELETE = @as(u32, 2134); pub const MCI_USER_MESSAGES = @as(u32, 3072); pub const MCI_LAST = @as(u32, 4095); pub const MCI_DEVTYPE_VCR = @as(u32, 513); pub const MCI_DEVTYPE_VIDEODISC = @as(u32, 514); pub const MCI_DEVTYPE_OVERLAY = @as(u32, 515); pub const MCI_DEVTYPE_CD_AUDIO = @as(u32, 516); pub const MCI_DEVTYPE_DAT = @as(u32, 517); pub const MCI_DEVTYPE_SCANNER = @as(u32, 518); pub const MCI_DEVTYPE_ANIMATION = @as(u32, 519); pub const MCI_DEVTYPE_DIGITAL_VIDEO = @as(u32, 520); pub const MCI_DEVTYPE_OTHER = @as(u32, 521); pub const MCI_DEVTYPE_WAVEFORM_AUDIO = @as(u32, 522); pub const MCI_DEVTYPE_SEQUENCER = @as(u32, 523); pub const MCI_DEVTYPE_FIRST_USER = @as(u32, 4096); pub const MCI_MODE_NOT_READY = @as(u32, 524); pub const MCI_MODE_STOP = @as(u32, 525); pub const MCI_MODE_PLAY = @as(u32, 526); pub const MCI_MODE_RECORD = @as(u32, 527); pub const MCI_MODE_SEEK = @as(u32, 528); pub const MCI_MODE_PAUSE = @as(u32, 529); pub const MCI_MODE_OPEN = @as(u32, 530); pub const MCI_FORMAT_MILLISECONDS = @as(u32, 0); pub const MCI_FORMAT_HMS = @as(u32, 1); pub const MCI_FORMAT_MSF = @as(u32, 2); pub const MCI_FORMAT_FRAMES = @as(u32, 3); pub const MCI_FORMAT_SMPTE_24 = @as(u32, 4); pub const MCI_FORMAT_SMPTE_25 = @as(u32, 5); pub const MCI_FORMAT_SMPTE_30 = @as(u32, 6); pub const MCI_FORMAT_SMPTE_30DROP = @as(u32, 7); pub const MCI_FORMAT_BYTES = @as(u32, 8); pub const MCI_FORMAT_SAMPLES = @as(u32, 9); pub const MCI_FORMAT_TMSF = @as(u32, 10); pub const MCI_NOTIFY_SUCCESSFUL = @as(u32, 1); pub const MCI_NOTIFY_SUPERSEDED = @as(u32, 2); pub const MCI_NOTIFY_ABORTED = @as(u32, 4); pub const MCI_NOTIFY_FAILURE = @as(u32, 8); pub const MCI_NOTIFY = @as(i32, 1); pub const MCI_WAIT = @as(i32, 2); pub const MCI_FROM = @as(i32, 4); pub const MCI_TO = @as(i32, 8); pub const MCI_TRACK = @as(i32, 16); pub const MCI_OPEN_SHAREABLE = @as(i32, 256); pub const MCI_OPEN_ELEMENT = @as(i32, 512); pub const MCI_OPEN_ALIAS = @as(i32, 1024); pub const MCI_OPEN_ELEMENT_ID = @as(i32, 2048); pub const MCI_OPEN_TYPE_ID = @as(i32, 4096); pub const MCI_OPEN_TYPE = @as(i32, 8192); pub const MCI_SEEK_TO_START = @as(i32, 256); pub const MCI_SEEK_TO_END = @as(i32, 512); pub const MCI_STATUS_ITEM = @as(i32, 256); pub const MCI_STATUS_START = @as(i32, 512); pub const MCI_STATUS_LENGTH = @as(i32, 1); pub const MCI_STATUS_POSITION = @as(i32, 2); pub const MCI_STATUS_NUMBER_OF_TRACKS = @as(i32, 3); pub const MCI_STATUS_MODE = @as(i32, 4); pub const MCI_STATUS_MEDIA_PRESENT = @as(i32, 5); pub const MCI_STATUS_TIME_FORMAT = @as(i32, 6); pub const MCI_STATUS_READY = @as(i32, 7); pub const MCI_STATUS_CURRENT_TRACK = @as(i32, 8); pub const MCI_INFO_PRODUCT = @as(i32, 256); pub const MCI_INFO_FILE = @as(i32, 512); pub const MCI_INFO_MEDIA_UPC = @as(i32, 1024); pub const MCI_INFO_MEDIA_IDENTITY = @as(i32, 2048); pub const MCI_INFO_NAME = @as(i32, 4096); pub const MCI_INFO_COPYRIGHT = @as(i32, 8192); pub const MCI_GETDEVCAPS_ITEM = @as(i32, 256); pub const MCI_GETDEVCAPS_CAN_RECORD = @as(i32, 1); pub const MCI_GETDEVCAPS_HAS_AUDIO = @as(i32, 2); pub const MCI_GETDEVCAPS_HAS_VIDEO = @as(i32, 3); pub const MCI_GETDEVCAPS_DEVICE_TYPE = @as(i32, 4); pub const MCI_GETDEVCAPS_USES_FILES = @as(i32, 5); pub const MCI_GETDEVCAPS_COMPOUND_DEVICE = @as(i32, 6); pub const MCI_GETDEVCAPS_CAN_EJECT = @as(i32, 7); pub const MCI_GETDEVCAPS_CAN_PLAY = @as(i32, 8); pub const MCI_GETDEVCAPS_CAN_SAVE = @as(i32, 9); pub const MCI_SYSINFO_QUANTITY = @as(i32, 256); pub const MCI_SYSINFO_OPEN = @as(i32, 512); pub const MCI_SYSINFO_NAME = @as(i32, 1024); pub const MCI_SYSINFO_INSTALLNAME = @as(i32, 2048); pub const MCI_SET_DOOR_OPEN = @as(i32, 256); pub const MCI_SET_DOOR_CLOSED = @as(i32, 512); pub const MCI_SET_TIME_FORMAT = @as(i32, 1024); pub const MCI_SET_AUDIO = @as(i32, 2048); pub const MCI_SET_VIDEO = @as(i32, 4096); pub const MCI_SET_ON = @as(i32, 8192); pub const MCI_SET_OFF = @as(i32, 16384); pub const MCI_SET_AUDIO_ALL = @as(i32, 0); pub const MCI_SET_AUDIO_LEFT = @as(i32, 1); pub const MCI_SET_AUDIO_RIGHT = @as(i32, 2); pub const MCI_BREAK_KEY = @as(i32, 256); pub const MCI_BREAK_HWND = @as(i32, 512); pub const MCI_BREAK_OFF = @as(i32, 1024); pub const MCI_RECORD_INSERT = @as(i32, 256); pub const MCI_RECORD_OVERWRITE = @as(i32, 512); pub const MCI_SAVE_FILE = @as(i32, 256); pub const MCI_LOAD_FILE = @as(i32, 256); pub const MCI_VD_MODE_PARK = @as(u32, 1025); pub const MCI_VD_MEDIA_CLV = @as(u32, 1026); pub const MCI_VD_MEDIA_CAV = @as(u32, 1027); pub const MCI_VD_MEDIA_OTHER = @as(u32, 1028); pub const MCI_VD_FORMAT_TRACK = @as(u32, 16385); pub const MCI_VD_PLAY_REVERSE = @as(i32, 65536); pub const MCI_VD_PLAY_FAST = @as(i32, 131072); pub const MCI_VD_PLAY_SPEED = @as(i32, 262144); pub const MCI_VD_PLAY_SCAN = @as(i32, 524288); pub const MCI_VD_PLAY_SLOW = @as(i32, 1048576); pub const MCI_VD_SEEK_REVERSE = @as(i32, 65536); pub const MCI_VD_STATUS_SPEED = @as(i32, 16386); pub const MCI_VD_STATUS_FORWARD = @as(i32, 16387); pub const MCI_VD_STATUS_MEDIA_TYPE = @as(i32, 16388); pub const MCI_VD_STATUS_SIDE = @as(i32, 16389); pub const MCI_VD_STATUS_DISC_SIZE = @as(i32, 16390); pub const MCI_VD_GETDEVCAPS_CLV = @as(i32, 65536); pub const MCI_VD_GETDEVCAPS_CAV = @as(i32, 131072); pub const MCI_VD_SPIN_UP = @as(i32, 65536); pub const MCI_VD_SPIN_DOWN = @as(i32, 131072); pub const MCI_VD_GETDEVCAPS_CAN_REVERSE = @as(i32, 16386); pub const MCI_VD_GETDEVCAPS_FAST_RATE = @as(i32, 16387); pub const MCI_VD_GETDEVCAPS_SLOW_RATE = @as(i32, 16388); pub const MCI_VD_GETDEVCAPS_NORMAL_RATE = @as(i32, 16389); pub const MCI_VD_STEP_FRAMES = @as(i32, 65536); pub const MCI_VD_STEP_REVERSE = @as(i32, 131072); pub const MCI_VD_ESCAPE_STRING = @as(i32, 256); pub const MCI_CDA_STATUS_TYPE_TRACK = @as(i32, 16385); pub const MCI_CDA_TRACK_AUDIO = @as(u32, 1088); pub const MCI_CDA_TRACK_OTHER = @as(u32, 1089); pub const MCI_WAVE_PCM = @as(u32, 1152); pub const MCI_WAVE_MAPPER = @as(u32, 1153); pub const MCI_WAVE_OPEN_BUFFER = @as(i32, 65536); pub const MCI_WAVE_SET_FORMATTAG = @as(i32, 65536); pub const MCI_WAVE_SET_CHANNELS = @as(i32, 131072); pub const MCI_WAVE_SET_SAMPLESPERSEC = @as(i32, 262144); pub const MCI_WAVE_SET_AVGBYTESPERSEC = @as(i32, 524288); pub const MCI_WAVE_SET_BLOCKALIGN = @as(i32, 1048576); pub const MCI_WAVE_SET_BITSPERSAMPLE = @as(i32, 2097152); pub const MCI_WAVE_INPUT = @as(i32, 4194304); pub const MCI_WAVE_OUTPUT = @as(i32, 8388608); pub const MCI_WAVE_STATUS_FORMATTAG = @as(i32, 16385); pub const MCI_WAVE_STATUS_CHANNELS = @as(i32, 16386); pub const MCI_WAVE_STATUS_SAMPLESPERSEC = @as(i32, 16387); pub const MCI_WAVE_STATUS_AVGBYTESPERSEC = @as(i32, 16388); pub const MCI_WAVE_STATUS_BLOCKALIGN = @as(i32, 16389); pub const MCI_WAVE_STATUS_BITSPERSAMPLE = @as(i32, 16390); pub const MCI_WAVE_STATUS_LEVEL = @as(i32, 16391); pub const MCI_WAVE_SET_ANYINPUT = @as(i32, 67108864); pub const MCI_WAVE_SET_ANYOUTPUT = @as(i32, 134217728); pub const MCI_WAVE_GETDEVCAPS_INPUTS = @as(i32, 16385); pub const MCI_WAVE_GETDEVCAPS_OUTPUTS = @as(i32, 16386); pub const MCI_SEQ_FORMAT_SONGPTR = @as(u32, 16385); pub const MCI_SEQ_FILE = @as(u32, 16386); pub const MCI_SEQ_MIDI = @as(u32, 16387); pub const MCI_SEQ_SMPTE = @as(u32, 16388); pub const MCI_SEQ_NONE = @as(u32, 65533); pub const MCI_SEQ_MAPPER = @as(u32, 65535); pub const MCI_SEQ_STATUS_TEMPO = @as(i32, 16386); pub const MCI_SEQ_STATUS_PORT = @as(i32, 16387); pub const MCI_SEQ_STATUS_SLAVE = @as(i32, 16391); pub const MCI_SEQ_STATUS_MASTER = @as(i32, 16392); pub const MCI_SEQ_STATUS_OFFSET = @as(i32, 16393); pub const MCI_SEQ_STATUS_DIVTYPE = @as(i32, 16394); pub const MCI_SEQ_STATUS_NAME = @as(i32, 16395); pub const MCI_SEQ_STATUS_COPYRIGHT = @as(i32, 16396); pub const MCI_SEQ_SET_TEMPO = @as(i32, 65536); pub const MCI_SEQ_SET_PORT = @as(i32, 131072); pub const MCI_SEQ_SET_SLAVE = @as(i32, 262144); pub const MCI_SEQ_SET_MASTER = @as(i32, 524288); pub const MCI_SEQ_SET_OFFSET = @as(i32, 16777216); pub const MCI_ANIM_OPEN_WS = @as(i32, 65536); pub const MCI_ANIM_OPEN_PARENT = @as(i32, 131072); pub const MCI_ANIM_OPEN_NOSTATIC = @as(i32, 262144); pub const MCI_ANIM_PLAY_SPEED = @as(i32, 65536); pub const MCI_ANIM_PLAY_REVERSE = @as(i32, 131072); pub const MCI_ANIM_PLAY_FAST = @as(i32, 262144); pub const MCI_ANIM_PLAY_SLOW = @as(i32, 524288); pub const MCI_ANIM_PLAY_SCAN = @as(i32, 1048576); pub const MCI_ANIM_STEP_REVERSE = @as(i32, 65536); pub const MCI_ANIM_STEP_FRAMES = @as(i32, 131072); pub const MCI_ANIM_STATUS_SPEED = @as(i32, 16385); pub const MCI_ANIM_STATUS_FORWARD = @as(i32, 16386); pub const MCI_ANIM_STATUS_HWND = @as(i32, 16387); pub const MCI_ANIM_STATUS_HPAL = @as(i32, 16388); pub const MCI_ANIM_STATUS_STRETCH = @as(i32, 16389); pub const MCI_ANIM_INFO_TEXT = @as(i32, 65536); pub const MCI_ANIM_GETDEVCAPS_CAN_REVERSE = @as(i32, 16385); pub const MCI_ANIM_GETDEVCAPS_FAST_RATE = @as(i32, 16386); pub const MCI_ANIM_GETDEVCAPS_SLOW_RATE = @as(i32, 16387); pub const MCI_ANIM_GETDEVCAPS_NORMAL_RATE = @as(i32, 16388); pub const MCI_ANIM_GETDEVCAPS_PALETTES = @as(i32, 16390); pub const MCI_ANIM_GETDEVCAPS_CAN_STRETCH = @as(i32, 16391); pub const MCI_ANIM_GETDEVCAPS_MAX_WINDOWS = @as(i32, 16392); pub const MCI_ANIM_REALIZE_NORM = @as(i32, 65536); pub const MCI_ANIM_REALIZE_BKGD = @as(i32, 131072); pub const MCI_ANIM_WINDOW_HWND = @as(i32, 65536); pub const MCI_ANIM_WINDOW_STATE = @as(i32, 262144); pub const MCI_ANIM_WINDOW_TEXT = @as(i32, 524288); pub const MCI_ANIM_WINDOW_ENABLE_STRETCH = @as(i32, 1048576); pub const MCI_ANIM_WINDOW_DISABLE_STRETCH = @as(i32, 2097152); pub const MCI_ANIM_WINDOW_DEFAULT = @as(i32, 0); pub const MCI_ANIM_RECT = @as(i32, 65536); pub const MCI_ANIM_PUT_SOURCE = @as(i32, 131072); pub const MCI_ANIM_PUT_DESTINATION = @as(i32, 262144); pub const MCI_ANIM_WHERE_SOURCE = @as(i32, 131072); pub const MCI_ANIM_WHERE_DESTINATION = @as(i32, 262144); pub const MCI_ANIM_UPDATE_HDC = @as(i32, 131072); pub const MCI_OVLY_OPEN_WS = @as(i32, 65536); pub const MCI_OVLY_OPEN_PARENT = @as(i32, 131072); pub const MCI_OVLY_STATUS_HWND = @as(i32, 16385); pub const MCI_OVLY_STATUS_STRETCH = @as(i32, 16386); pub const MCI_OVLY_INFO_TEXT = @as(i32, 65536); pub const MCI_OVLY_GETDEVCAPS_CAN_STRETCH = @as(i32, 16385); pub const MCI_OVLY_GETDEVCAPS_CAN_FREEZE = @as(i32, 16386); pub const MCI_OVLY_GETDEVCAPS_MAX_WINDOWS = @as(i32, 16387); pub const MCI_OVLY_WINDOW_HWND = @as(i32, 65536); pub const MCI_OVLY_WINDOW_STATE = @as(i32, 262144); pub const MCI_OVLY_WINDOW_TEXT = @as(i32, 524288); pub const MCI_OVLY_WINDOW_ENABLE_STRETCH = @as(i32, 1048576); pub const MCI_OVLY_WINDOW_DISABLE_STRETCH = @as(i32, 2097152); pub const MCI_OVLY_WINDOW_DEFAULT = @as(i32, 0); pub const MCI_OVLY_RECT = @as(i32, 65536); pub const MCI_OVLY_PUT_SOURCE = @as(i32, 131072); pub const MCI_OVLY_PUT_DESTINATION = @as(i32, 262144); pub const MCI_OVLY_PUT_FRAME = @as(i32, 524288); pub const MCI_OVLY_PUT_VIDEO = @as(i32, 1048576); pub const MCI_OVLY_WHERE_SOURCE = @as(i32, 131072); pub const MCI_OVLY_WHERE_DESTINATION = @as(i32, 262144); pub const MCI_OVLY_WHERE_FRAME = @as(i32, 524288); pub const MCI_OVLY_WHERE_VIDEO = @as(i32, 1048576); pub const ENDPOINT_FORMAT_RESET_MIX_ONLY = @as(u32, 1); pub const SPTLAUDCLNT_E_DESTROYED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287232)); pub const SPTLAUDCLNT_E_OUT_OF_ORDER = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287231)); pub const SPTLAUDCLNT_E_RESOURCES_INVALIDATED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287230)); pub const SPTLAUDCLNT_E_NO_MORE_OBJECTS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287229)); pub const SPTLAUDCLNT_E_PROPERTY_NOT_SUPPORTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287228)); pub const SPTLAUDCLNT_E_ERRORS_IN_OBJECT_CALLS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287227)); pub const SPTLAUDCLNT_E_METADATA_FORMAT_NOT_SUPPORTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287226)); pub const SPTLAUDCLNT_E_STREAM_NOT_AVAILABLE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287225)); pub const SPTLAUDCLNT_E_INVALID_LICENSE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287224)); pub const SPTLAUDCLNT_E_STREAM_NOT_STOPPED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287222)); pub const SPTLAUDCLNT_E_STATIC_OBJECT_NOT_AVAILABLE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287221)); pub const SPTLAUDCLNT_E_OBJECT_ALREADY_ACTIVE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287220)); pub const SPTLAUDCLNT_E_INTERNAL = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287219)); pub const DEVICE_STATE_ACTIVE = @as(u32, 1); pub const DEVICE_STATE_DISABLED = @as(u32, 2); pub const DEVICE_STATE_NOTPRESENT = @as(u32, 4); pub const DEVICE_STATE_UNPLUGGED = @as(u32, 8); pub const DEVICE_STATEMASK_ALL = @as(u32, 15); pub const ENDPOINT_SYSFX_ENABLED = @as(u32, 0); pub const ENDPOINT_SYSFX_DISABLED = @as(u32, 1); pub const DEVINTERFACE_AUDIO_RENDER = Guid.initString("e6327cad-dcec-4949-ae8a-991e976a79d2"); pub const DEVINTERFACE_AUDIO_CAPTURE = Guid.initString("2eef81be-33fa-4800-9670-1cd474972c3f"); pub const DEVINTERFACE_MIDI_OUTPUT = Guid.initString("6dc23320-ab33-4ce4-80d4-bbb3ebbf2814"); pub const DEVINTERFACE_MIDI_INPUT = Guid.initString("504be32c-ccf6-4d2c-b73f-6f8b3747e22b"); pub const EVENTCONTEXT_VOLUMESLIDER = Guid.initString("e2c2e9de-09b1-4b04-84e5-07931225ee04"); pub const AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ = @as(u32, 1); pub const AMBISONICS_PARAM_VERSION_1 = @as(u32, 1); pub const AUDCLNT_E_NOT_INITIALIZED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287487)); pub const AUDCLNT_E_ALREADY_INITIALIZED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287486)); pub const AUDCLNT_E_WRONG_ENDPOINT_TYPE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287485)); pub const AUDCLNT_E_DEVICE_INVALIDATED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287484)); pub const AUDCLNT_E_NOT_STOPPED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287483)); pub const AUDCLNT_E_BUFFER_TOO_LARGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287482)); pub const AUDCLNT_E_OUT_OF_ORDER = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287481)); pub const AUDCLNT_E_UNSUPPORTED_FORMAT = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287480)); pub const AUDCLNT_E_INVALID_SIZE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287479)); pub const AUDCLNT_E_DEVICE_IN_USE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287478)); pub const AUDCLNT_E_BUFFER_OPERATION_PENDING = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287477)); pub const AUDCLNT_E_THREAD_NOT_REGISTERED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287476)); pub const AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287474)); pub const AUDCLNT_E_ENDPOINT_CREATE_FAILED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287473)); pub const AUDCLNT_E_SERVICE_NOT_RUNNING = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287472)); pub const AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287471)); pub const AUDCLNT_E_EXCLUSIVE_MODE_ONLY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287470)); pub const AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287469)); pub const AUDCLNT_E_EVENTHANDLE_NOT_SET = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287468)); pub const AUDCLNT_E_INCORRECT_BUFFER_SIZE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287467)); pub const AUDCLNT_E_BUFFER_SIZE_ERROR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287466)); pub const AUDCLNT_E_CPUUSAGE_EXCEEDED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287465)); pub const AUDCLNT_E_BUFFER_ERROR = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287464)); pub const AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287463)); pub const AUDCLNT_E_INVALID_DEVICE_PERIOD = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287456)); pub const AUDCLNT_E_INVALID_STREAM_FLAG = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287455)); pub const AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287454)); pub const AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287453)); pub const AUDCLNT_E_OFFLOAD_MODE_ONLY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287452)); pub const AUDCLNT_E_NONOFFLOAD_MODE_ONLY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287451)); pub const AUDCLNT_E_RESOURCES_INVALIDATED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287450)); pub const AUDCLNT_E_RAW_MODE_UNSUPPORTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287449)); pub const AUDCLNT_E_ENGINE_PERIODICITY_LOCKED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287448)); pub const AUDCLNT_E_ENGINE_FORMAT_LOCKED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287447)); pub const AUDCLNT_E_HEADTRACKING_ENABLED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287440)); pub const AUDCLNT_E_HEADTRACKING_UNSUPPORTED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004287424)); pub const AUDCLNT_S_BUFFER_EMPTY = @import("../../zig.zig").typedConst(HRESULT, @as(i32, 143196161)); pub const AUDCLNT_S_THREAD_ALREADY_REGISTERED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, 143196162)); pub const AUDCLNT_S_POSITION_STALLED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, 143196163)); pub const ENDPOINT_HARDWARE_SUPPORT_VOLUME = @as(u32, 1); pub const ENDPOINT_HARDWARE_SUPPORT_MUTE = @as(u32, 2); pub const ENDPOINT_HARDWARE_SUPPORT_METER = @as(u32, 4); pub const SPATIAL_AUDIO_STANDARD_COMMANDS_START = @as(u32, 200); pub const SPTLAUD_MD_CLNT_E_COMMAND_NOT_FOUND = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286976)); pub const SPTLAUD_MD_CLNT_E_OBJECT_NOT_INITIALIZED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286975)); pub const SPTLAUD_MD_CLNT_E_INVALID_ARGS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286974)); pub const SPTLAUD_MD_CLNT_E_METADATA_FORMAT_NOT_FOUND = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286973)); pub const SPTLAUD_MD_CLNT_E_VALUE_BUFFER_INCORRECT_SIZE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286972)); pub const SPTLAUD_MD_CLNT_E_MEMORY_BOUNDS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286971)); pub const SPTLAUD_MD_CLNT_E_NO_MORE_COMMANDS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286970)); pub const SPTLAUD_MD_CLNT_E_BUFFER_ALREADY_ATTACHED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286969)); pub const SPTLAUD_MD_CLNT_E_BUFFER_NOT_ATTACHED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286968)); pub const SPTLAUD_MD_CLNT_E_FRAMECOUNT_OUT_OF_RANGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286967)); pub const SPTLAUD_MD_CLNT_E_NO_ITEMS_FOUND = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286960)); pub const SPTLAUD_MD_CLNT_E_ITEM_COPY_OVERFLOW = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286959)); pub const SPTLAUD_MD_CLNT_E_NO_ITEMS_OPEN = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286958)); pub const SPTLAUD_MD_CLNT_E_ITEMS_ALREADY_OPEN = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286957)); pub const SPTLAUD_MD_CLNT_E_ATTACH_FAILED_INTERNAL_BUFFER = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286956)); pub const SPTLAUD_MD_CLNT_E_DETACH_FAILED_INTERNAL_BUFFER = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286955)); pub const SPTLAUD_MD_CLNT_E_NO_BUFFER_ATTACHED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286954)); pub const SPTLAUD_MD_CLNT_E_NO_MORE_ITEMS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286953)); pub const SPTLAUD_MD_CLNT_E_FRAMEOFFSET_OUT_OF_RANGE = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286952)); pub const SPTLAUD_MD_CLNT_E_ITEM_MUST_HAVE_COMMANDS = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286951)); pub const SPTLAUD_MD_CLNT_E_NO_ITEMOFFSET_WRITTEN = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286944)); pub const SPTLAUD_MD_CLNT_E_NO_ITEMS_WRITTEN = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286943)); pub const SPTLAUD_MD_CLNT_E_COMMAND_ALREADY_WRITTEN = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286942)); pub const SPTLAUD_MD_CLNT_E_FORMAT_MISMATCH = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286941)); pub const SPTLAUD_MD_CLNT_E_BUFFER_STILL_ATTACHED = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286940)); pub const SPTLAUD_MD_CLNT_E_ITEMS_LOCKED_FOR_WRITING = @import("../../zig.zig").typedConst(HRESULT, @as(i32, -2004286939)); pub const KSPROPERTY_MEMORY_TRANSPORT = @as(i32, 1); //-------------------------------------------------------------------------------- // Section: Types (1173) //-------------------------------------------------------------------------------- pub const HTASK = *opaque{}; pub const YIELDPROC = fn( mciId: u32, dwYieldData: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const MCI_GENERIC_PARMS = packed struct { dwCallback: usize, }; pub const MCI_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, }; pub const MCI_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, }; pub const MCI_PLAY_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, }; pub const MCI_SEEK_PARMS = packed struct { dwCallback: usize, dwTo: u32, }; pub const MCI_STATUS_PARMS = packed struct { dwCallback: usize, dwReturn: usize, dwItem: u32, dwTrack: u32, }; pub const MCI_INFO_PARMSA = packed struct { dwCallback: usize, lpstrReturn: ?PSTR, dwRetSize: u32, }; pub const MCI_INFO_PARMSW = packed struct { dwCallback: usize, lpstrReturn: ?PWSTR, dwRetSize: u32, }; pub const MCI_GETDEVCAPS_PARMS = packed struct { dwCallback: usize, dwReturn: u32, dwItem: u32, }; pub const MCI_SYSINFO_PARMSA = packed struct { dwCallback: usize, lpstrReturn: ?PSTR, dwRetSize: u32, dwNumber: u32, wDeviceType: u32, }; pub const MCI_SYSINFO_PARMSW = packed struct { dwCallback: usize, lpstrReturn: ?PWSTR, dwRetSize: u32, dwNumber: u32, wDeviceType: u32, }; pub const MCI_SET_PARMS = packed struct { dwCallback: usize, dwTimeFormat: u32, dwAudio: u32, }; pub const MCI_BREAK_PARMS = packed struct { dwCallback: usize, nVirtKey: i32, hwndBreak: ?HWND, }; pub const MCI_SAVE_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, }; pub const MCI_SAVE_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, }; pub const MCI_LOAD_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, }; pub const MCI_LOAD_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, }; pub const MCI_RECORD_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, }; pub const MCI_VD_PLAY_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, dwSpeed: u32, }; pub const MCI_VD_STEP_PARMS = packed struct { dwCallback: usize, dwFrames: u32, }; pub const MCI_VD_ESCAPE_PARMSA = packed struct { dwCallback: usize, lpstrCommand: ?[*:0]const u8, }; pub const MCI_VD_ESCAPE_PARMSW = packed struct { dwCallback: usize, lpstrCommand: ?[*:0]const u16, }; pub const MCI_WAVE_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, dwBufferSeconds: u32, }; pub const MCI_WAVE_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, dwBufferSeconds: u32, }; pub const MCI_WAVE_DELETE_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, }; pub const MCI_WAVE_SET_PARMS = packed struct { dwCallback: usize, dwTimeFormat: u32, dwAudio: u32, wInput: u32, wOutput: u32, wFormatTag: u16, wReserved2: u16, nChannels: u16, wReserved3: u16, nSamplesPerSec: u32, nAvgBytesPerSec: u32, nBlockAlign: u16, wReserved4: u16, wBitsPerSample: u16, wReserved5: u16, }; pub const MCI_SEQ_SET_PARMS = packed struct { dwCallback: usize, dwTimeFormat: u32, dwAudio: u32, dwTempo: u32, dwPort: u32, dwSlave: u32, dwMaster: u32, dwOffset: u32, }; pub const MCI_ANIM_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_ANIM_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_ANIM_PLAY_PARMS = packed struct { dwCallback: usize, dwFrom: u32, dwTo: u32, dwSpeed: u32, }; pub const MCI_ANIM_STEP_PARMS = packed struct { dwCallback: usize, dwFrames: u32, }; pub const MCI_ANIM_WINDOW_PARMSA = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u8, }; pub const MCI_ANIM_WINDOW_PARMSW = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u16, }; pub const MCI_ANIM_RECT_PARMS = packed struct { dwCallback: usize, rc: RECT, }; pub const MCI_ANIM_UPDATE_PARMS = packed struct { dwCallback: usize, rc: RECT, hDC: ?HDC, }; pub const MCI_OVLY_OPEN_PARMSA = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u8, lpstrElementName: ?[*:0]const u8, lpstrAlias: ?[*:0]const u8, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_OVLY_OPEN_PARMSW = packed struct { dwCallback: usize, wDeviceID: u32, lpstrDeviceType: ?[*:0]const u16, lpstrElementName: ?[*:0]const u16, lpstrAlias: ?[*:0]const u16, dwStyle: u32, hWndParent: ?HWND, }; pub const MCI_OVLY_WINDOW_PARMSA = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u8, }; pub const MCI_OVLY_WINDOW_PARMSW = packed struct { dwCallback: usize, hWnd: ?HWND, nCmdShow: u32, lpstrText: ?[*:0]const u16, }; pub const MCI_OVLY_RECT_PARMS = packed struct { dwCallback: usize, rc: RECT, }; pub const MCI_OVLY_SAVE_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, rc: RECT, }; pub const MCI_OVLY_SAVE_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, rc: RECT, }; pub const MCI_OVLY_LOAD_PARMSA = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u8, rc: RECT, }; pub const MCI_OVLY_LOAD_PARMSW = packed struct { dwCallback: usize, lpfilename: ?[*:0]const u16, rc: RECT, }; pub const AUDCLNT_SHAREMODE = enum(i32) { SHARED = 0, EXCLUSIVE = 1, }; pub const AUDCLNT_SHAREMODE_SHARED = AUDCLNT_SHAREMODE.SHARED; pub const AUDCLNT_SHAREMODE_EXCLUSIVE = AUDCLNT_SHAREMODE.EXCLUSIVE; pub const AUDIO_STREAM_CATEGORY = enum(i32) { Other = 0, ForegroundOnlyMedia = 1, Communications = 3, Alerts = 4, SoundEffects = 5, GameEffects = 6, GameMedia = 7, GameChat = 8, Speech = 9, Movie = 10, Media = 11, }; pub const AudioCategory_Other = AUDIO_STREAM_CATEGORY.Other; pub const AudioCategory_ForegroundOnlyMedia = AUDIO_STREAM_CATEGORY.ForegroundOnlyMedia; pub const AudioCategory_Communications = AUDIO_STREAM_CATEGORY.Communications; pub const AudioCategory_Alerts = AUDIO_STREAM_CATEGORY.Alerts; pub const AudioCategory_SoundEffects = AUDIO_STREAM_CATEGORY.SoundEffects; pub const AudioCategory_GameEffects = AUDIO_STREAM_CATEGORY.GameEffects; pub const AudioCategory_GameMedia = AUDIO_STREAM_CATEGORY.GameMedia; pub const AudioCategory_GameChat = AUDIO_STREAM_CATEGORY.GameChat; pub const AudioCategory_Speech = AUDIO_STREAM_CATEGORY.Speech; pub const AudioCategory_Movie = AUDIO_STREAM_CATEGORY.Movie; pub const AudioCategory_Media = AUDIO_STREAM_CATEGORY.Media; pub const AudioSessionState = enum(i32) { Inactive = 0, Active = 1, Expired = 2, }; pub const AudioSessionStateInactive = AudioSessionState.Inactive; pub const AudioSessionStateActive = AudioSessionState.Active; pub const AudioSessionStateExpired = AudioSessionState.Expired; const CLSID_GUID_NULL_Value = @import("../../zig.zig").Guid.initString("00000000-0000-0000-0000-000000000000"); pub const CLSID_GUID_NULL = &CLSID_GUID_NULL_Value; pub const KSRESET = enum(i32) { BEGIN = 0, END = 1, }; pub const KSRESET_BEGIN = KSRESET.BEGIN; pub const KSRESET_END = KSRESET.END; pub const KSSTATE = enum(i32) { STOP = 0, ACQUIRE = 1, PAUSE = 2, RUN = 3, }; pub const KSSTATE_STOP = KSSTATE.STOP; pub const KSSTATE_ACQUIRE = KSSTATE.ACQUIRE; pub const KSSTATE_PAUSE = KSSTATE.PAUSE; pub const KSSTATE_RUN = KSSTATE.RUN; pub const KSPRIORITY = extern struct { PriorityClass: u32, PrioritySubClass: u32, }; pub const KSIDENTIFIER = extern struct { Anonymous: extern union { Anonymous: extern struct { Set: Guid, Id: u32, Flags: u32, }, Alignment: i64, }, }; pub const KSP_NODE = extern struct { Property: KSIDENTIFIER, NodeId: u32, Reserved: u32, }; pub const KSM_NODE = extern struct { Method: KSIDENTIFIER, NodeId: u32, Reserved: u32, }; pub const KSE_NODE = extern struct { Event: KSIDENTIFIER, NodeId: u32, Reserved: u32, }; const CLSID_KSPROPTYPESETID_General_Value = @import("../../zig.zig").Guid.initString("97e99ba0-bdea-11cf-a5d6-28db04c10000"); pub const CLSID_KSPROPTYPESETID_General = &CLSID_KSPROPTYPESETID_General_Value; pub const KSMULTIPLE_ITEM = extern struct { Size: u32, Count: u32, }; pub const KSPROPERTY_DESCRIPTION = extern struct { AccessFlags: u32, DescriptionSize: u32, PropTypeSet: KSIDENTIFIER, MembersListCount: u32, Reserved: u32, }; pub const KSPROPERTY_MEMBERSHEADER = extern struct { MembersFlags: u32, MembersSize: u32, MembersCount: u32, Flags: u32, }; pub const KSPROPERTY_BOUNDS_LONG = extern union { Anonymous1: extern struct { SignedMinimum: i32, SignedMaximum: i32, }, Anonymous2: extern struct { UnsignedMinimum: u32, UnsignedMaximum: u32, }, }; pub const KSPROPERTY_BOUNDS_LONGLONG = extern union { Anonymous1: extern struct { SignedMinimum: i64, SignedMaximum: i64, }, Anonymous2: extern struct { UnsignedMinimum: u64, UnsignedMaximum: u64, }, }; pub const KSPROPERTY_STEPPING_LONG = extern struct { SteppingDelta: u32, Reserved: u32, Bounds: KSPROPERTY_BOUNDS_LONG, }; pub const KSPROPERTY_STEPPING_LONGLONG = extern struct { SteppingDelta: u64, Bounds: KSPROPERTY_BOUNDS_LONGLONG, }; pub const KSEVENTDATA = extern struct { NotificationType: u32, Anonymous: extern union { EventHandle: extern struct { Event: ?HANDLE, Reserved: [2]usize, }, SemaphoreHandle: extern struct { Semaphore: ?HANDLE, Reserved: u32, Adjustment: i32, }, Alignment: extern struct { Unused: ?*c_void, Alignment: [2]isize, }, }, }; pub const KSQUERYBUFFER = extern struct { Event: KSIDENTIFIER, EventData: ?*KSEVENTDATA, Reserved: ?*c_void, }; pub const KSRELATIVEEVENT = extern struct { Size: u32, Flags: u32, Anonymous: extern union { ObjectHandle: ?HANDLE, ObjectPointer: ?*c_void, }, Reserved: ?*c_void, Event: KSIDENTIFIER, EventData: KSEVENTDATA, }; pub const KSEVENT_TIME_MARK = extern struct { EventData: KSEVENTDATA, MarkTime: i64, }; pub const KSEVENT_TIME_INTERVAL = extern struct { EventData: KSEVENTDATA, TimeBase: i64, Interval: i64, }; pub const KSINTERVAL = extern struct { TimeBase: i64, Interval: i64, }; const CLSID_KSPROPSETID_General_Value = @import("../../zig.zig").Guid.initString("1464eda5-6a8f-11d1-9aa7-00a0c9223196"); pub const CLSID_KSPROPSETID_General = &CLSID_KSPROPSETID_General_Value; pub const KSPROPERTY_GENERAL = enum(i32) { D = 0, }; pub const KSPROPERTY_GENERAL_COMPONENTID = KSPROPERTY_GENERAL.D; pub const KSCOMPONENTID = extern struct { Manufacturer: Guid, Product: Guid, Component: Guid, Name: Guid, Version: u32, Revision: u32, }; const CLSID_KSMETHODSETID_StreamIo_Value = @import("../../zig.zig").Guid.initString("65d003ca-1523-11d2-b27a-00a0c9223196"); pub const CLSID_KSMETHODSETID_StreamIo = &CLSID_KSMETHODSETID_StreamIo_Value; pub const KSMETHOD_STREAMIO = enum(i32) { READ = 0, WRITE = 1, }; pub const KSMETHOD_STREAMIO_READ = KSMETHOD_STREAMIO.READ; pub const KSMETHOD_STREAMIO_WRITE = KSMETHOD_STREAMIO.WRITE; const CLSID_KSPROPSETID_MediaSeeking_Value = @import("../../zig.zig").Guid.initString("ee904f0c-d09b-11d0-abe9-00a0c9223196"); pub const CLSID_KSPROPSETID_MediaSeeking = &CLSID_KSPROPSETID_MediaSeeking_Value; pub const KSPROPERTY_MEDIASEEKING = enum(i32) { CAPABILITIES = 0, FORMATS = 1, TIMEFORMAT = 2, POSITION = 3, STOPPOSITION = 4, POSITIONS = 5, DURATION = 6, AVAILABLE = 7, PREROLL = 8, CONVERTTIMEFORMAT = 9, }; pub const KSPROPERTY_MEDIASEEKING_CAPABILITIES = KSPROPERTY_MEDIASEEKING.CAPABILITIES; pub const KSPROPERTY_MEDIASEEKING_FORMATS = KSPROPERTY_MEDIASEEKING.FORMATS; pub const KSPROPERTY_MEDIASEEKING_TIMEFORMAT = KSPROPERTY_MEDIASEEKING.TIMEFORMAT; pub const KSPROPERTY_MEDIASEEKING_POSITION = KSPROPERTY_MEDIASEEKING.POSITION; pub const KSPROPERTY_MEDIASEEKING_STOPPOSITION = KSPROPERTY_MEDIASEEKING.STOPPOSITION; pub const KSPROPERTY_MEDIASEEKING_POSITIONS = KSPROPERTY_MEDIASEEKING.POSITIONS; pub const KSPROPERTY_MEDIASEEKING_DURATION = KSPROPERTY_MEDIASEEKING.DURATION; pub const KSPROPERTY_MEDIASEEKING_AVAILABLE = KSPROPERTY_MEDIASEEKING.AVAILABLE; pub const KSPROPERTY_MEDIASEEKING_PREROLL = KSPROPERTY_MEDIASEEKING.PREROLL; pub const KSPROPERTY_MEDIASEEKING_CONVERTTIMEFORMAT = KSPROPERTY_MEDIASEEKING.CONVERTTIMEFORMAT; pub const KS_SEEKING_FLAGS = enum(i32) { NoPositioning = 0, AbsolutePositioning = 1, RelativePositioning = 2, IncrementalPositioning = 3, // PositioningBitsMask = 3, this enum value conflicts with IncrementalPositioning SeekToKeyFrame = 4, ReturnTime = 8, }; pub const KS_SEEKING_NoPositioning = KS_SEEKING_FLAGS.NoPositioning; pub const KS_SEEKING_AbsolutePositioning = KS_SEEKING_FLAGS.AbsolutePositioning; pub const KS_SEEKING_RelativePositioning = KS_SEEKING_FLAGS.RelativePositioning; pub const KS_SEEKING_IncrementalPositioning = KS_SEEKING_FLAGS.IncrementalPositioning; pub const KS_SEEKING_PositioningBitsMask = KS_SEEKING_FLAGS.IncrementalPositioning; pub const KS_SEEKING_SeekToKeyFrame = KS_SEEKING_FLAGS.SeekToKeyFrame; pub const KS_SEEKING_ReturnTime = KS_SEEKING_FLAGS.ReturnTime; pub const KS_SEEKING_CAPABILITIES = enum(i32) { SeekAbsolute = 1, SeekForwards = 2, SeekBackwards = 4, GetCurrentPos = 8, GetStopPos = 16, GetDuration = 32, PlayBackwards = 64, }; pub const KS_SEEKING_CanSeekAbsolute = KS_SEEKING_CAPABILITIES.SeekAbsolute; pub const KS_SEEKING_CanSeekForwards = KS_SEEKING_CAPABILITIES.SeekForwards; pub const KS_SEEKING_CanSeekBackwards = KS_SEEKING_CAPABILITIES.SeekBackwards; pub const KS_SEEKING_CanGetCurrentPos = KS_SEEKING_CAPABILITIES.GetCurrentPos; pub const KS_SEEKING_CanGetStopPos = KS_SEEKING_CAPABILITIES.GetStopPos; pub const KS_SEEKING_CanGetDuration = KS_SEEKING_CAPABILITIES.GetDuration; pub const KS_SEEKING_CanPlayBackwards = KS_SEEKING_CAPABILITIES.PlayBackwards; pub const KSPROPERTY_POSITIONS = extern struct { Current: i64, Stop: i64, CurrentFlags: KS_SEEKING_FLAGS, StopFlags: KS_SEEKING_FLAGS, }; pub const KSPROPERTY_MEDIAAVAILABLE = extern struct { Earliest: i64, Latest: i64, }; pub const KSP_TIMEFORMAT = extern struct { Property: KSIDENTIFIER, SourceFormat: Guid, TargetFormat: Guid, Time: i64, }; const CLSID_KSPROPSETID_Topology_Value = @import("../../zig.zig").Guid.initString("720d4ac0-7533-11d0-a5d6-28db04c10000"); pub const CLSID_KSPROPSETID_Topology = &CLSID_KSPROPSETID_Topology_Value; pub const KSPROPERTY_TOPOLOGY = enum(i32) { CATEGORIES = 0, NODES = 1, CONNECTIONS = 2, NAME = 3, }; pub const KSPROPERTY_TOPOLOGY_CATEGORIES = KSPROPERTY_TOPOLOGY.CATEGORIES; pub const KSPROPERTY_TOPOLOGY_NODES = KSPROPERTY_TOPOLOGY.NODES; pub const KSPROPERTY_TOPOLOGY_CONNECTIONS = KSPROPERTY_TOPOLOGY.CONNECTIONS; pub const KSPROPERTY_TOPOLOGY_NAME = KSPROPERTY_TOPOLOGY.NAME; const CLSID_KSCATEGORY_BRIDGE_Value = @import("../../zig.zig").Guid.initString("085aff00-62ce-11cf-a5d6-28db04c10000"); pub const CLSID_KSCATEGORY_BRIDGE = &CLSID_KSCATEGORY_BRIDGE_Value; const CLSID_KSCATEGORY_CAPTURE_Value = @import("../../zig.zig").Guid.initString("65e8773d-8f56-11d0-a3b9-00a0c9223196"); pub const CLSID_KSCATEGORY_CAPTURE = &CLSID_KSCATEGORY_CAPTURE_Value; const CLSID_KSCATEGORY_VIDEO_CAMERA_Value = @import("../../zig.zig").Guid.initString("e5323777-f976-4f5b-9b55-b94699c46e44"); pub const CLSID_KSCATEGORY_VIDEO_CAMERA = &CLSID_KSCATEGORY_VIDEO_CAMERA_Value; const CLSID_KSCATEGORY_SENSOR_CAMERA_Value = @import("../../zig.zig").Guid.initString("24e552d7-6523-47f7-a647-d3465bf1f5ca"); pub const CLSID_KSCATEGORY_SENSOR_CAMERA = &CLSID_KSCATEGORY_SENSOR_CAMERA_Value; const CLSID_KSCATEGORY_NETWORK_CAMERA_Value = @import("../../zig.zig").Guid.initString("b8238652-b500-41eb-b4f3-4234f7f5ae99"); pub const CLSID_KSCATEGORY_NETWORK_CAMERA = &CLSID_KSCATEGORY_NETWORK_CAMERA_Value; const CLSID_KSCATEGORY_SENSOR_GROUP_Value = @import("../../zig.zig").Guid.initString("669c7214-0a88-4311-a7f3-4e79820e33bd"); pub const CLSID_KSCATEGORY_SENSOR_GROUP = &CLSID_KSCATEGORY_SENSOR_GROUP_Value; const CLSID_KSCATEGORY_RENDER_Value = @import("../../zig.zig").Guid.initString("65e8773e-8f56-11d0-a3b9-00a0c9223196"); pub const CLSID_KSCATEGORY_RENDER = &CLSID_KSCATEGORY_RENDER_Value; const CLSID_KSCATEGORY_MIXER_Value = @import("../../zig.zig").Guid.initString("ad809c00-7b88-11d0-a5d6-28db04c10000"); pub const CLSID_KSCATEGORY_MIXER = &CLSID_KSCATEGORY_MIXER_Value; const CLSID_KSCATEGORY_SPLITTER_Value = @import("../../zig.zig").Guid.initString("0a4252a0-7e70-11d0-a5d6-28db04c10000"); pub const CLSID_KSCATEGORY_SPLITTER = &CLSID_KSCATEGORY_SPLITTER_Value; const CLSID_KSCATEGORY_DATACOMPRESSOR_Value = @import("../../zig.zig").Guid.initString("1e84c900-7e70-11d0-a5d6-28db04c10000"); pub const CLSID_KSCATEGORY_DATACOMPRESSOR = &CLSID_KSCATEGORY_DATACOMPRESSOR_Value; const CLSID_KSCATEGORY_DATADECOMPRESSOR_Value = @import("../../zig.zig").Guid.initString("2721ae20-7e70-11d0-a5d6-28db04c10000"); pub const CLSID_KSCATEGORY_DATADECOMPRESSOR = &CLSID_KSCATEGORY_DATADECOMPRESSOR_Value; const CLSID_KSCATEGORY_DATATRANSFORM_Value = @import("../../zig.zig").Guid.initString("2eb07ea0-7e70-11d0-a5d6-28db04c10000"); pub const CLSID_KSCATEGORY_DATATRANSFORM = &CLSID_KSCATEGORY_DATATRANSFORM_Value; const CLSID_KSMFT_CATEGORY_VIDEO_DECODER_Value = @import("../../zig.zig").Guid.initString("d6c02d4b-6833-45b4-971a-05a4b04bab91"); pub const CLSID_KSMFT_CATEGORY_VIDEO_DECODER = &CLSID_KSMFT_CATEGORY_VIDEO_DECODER_Value; const CLSID_KSMFT_CATEGORY_VIDEO_ENCODER_Value = @import("../../zig.zig").Guid.initString("f79eac7d-e545-4387-bdee-d647d7bde42a"); pub const CLSID_KSMFT_CATEGORY_VIDEO_ENCODER = &CLSID_KSMFT_CATEGORY_VIDEO_ENCODER_Value; const CLSID_KSMFT_CATEGORY_VIDEO_EFFECT_Value = @import("../../zig.zig").Guid.initString("12e17c21-532c-4a6e-8a1c-40825a736397"); pub const CLSID_KSMFT_CATEGORY_VIDEO_EFFECT = &CLSID_KSMFT_CATEGORY_VIDEO_EFFECT_Value; const CLSID_KSMFT_CATEGORY_MULTIPLEXER_Value = @import("../../zig.zig").Guid.initString("059c561e-05ae-4b61-b69d-55b61ee54a7b"); pub const CLSID_KSMFT_CATEGORY_MULTIPLEXER = &CLSID_KSMFT_CATEGORY_MULTIPLEXER_Value; const CLSID_KSMFT_CATEGORY_DEMULTIPLEXER_Value = @import("../../zig.zig").Guid.initString("a8700a7a-939b-44c5-99d7-76226b23b3f1"); pub const CLSID_KSMFT_CATEGORY_DEMULTIPLEXER = &CLSID_KSMFT_CATEGORY_DEMULTIPLEXER_Value; const CLSID_KSMFT_CATEGORY_AUDIO_DECODER_Value = @import("../../zig.zig").Guid.initString("9ea73fb4-ef7a-4559-8d5d-719d8f0426c7"); pub const CLSID_KSMFT_CATEGORY_AUDIO_DECODER = &CLSID_KSMFT_CATEGORY_AUDIO_DECODER_Value; const CLSID_KSMFT_CATEGORY_AUDIO_ENCODER_Value = @import("../../zig.zig").Guid.initString("91c64bd0-f91e-4d8c-9276-db248279d975"); pub const CLSID_KSMFT_CATEGORY_AUDIO_ENCODER = &CLSID_KSMFT_CATEGORY_AUDIO_ENCODER_Value; const CLSID_KSMFT_CATEGORY_AUDIO_EFFECT_Value = @import("../../zig.zig").Guid.initString("11064c48-3648-4ed0-932e-05ce8ac811b7"); pub const CLSID_KSMFT_CATEGORY_AUDIO_EFFECT = &CLSID_KSMFT_CATEGORY_AUDIO_EFFECT_Value; const CLSID_KSMFT_CATEGORY_VIDEO_PROCESSOR_Value = @import("../../zig.zig").Guid.initString("302ea3fc-aa5f-47f9-9f7a-c2188bb16302"); pub const CLSID_KSMFT_CATEGORY_VIDEO_PROCESSOR = &CLSID_KSMFT_CATEGORY_VIDEO_PROCESSOR_Value; const CLSID_KSMFT_CATEGORY_OTHER_Value = @import("../../zig.zig").Guid.initString("90175d57-b7ea-4901-aeb3-933a8747756f"); pub const CLSID_KSMFT_CATEGORY_OTHER = &CLSID_KSMFT_CATEGORY_OTHER_Value; const CLSID_KSCATEGORY_COMMUNICATIONSTRANSFORM_Value = @import("../../zig.zig").Guid.initString("cf1dda2c-9743-11d0-a3ee-00a0c9223196"); pub const CLSID_KSCATEGORY_COMMUNICATIONSTRANSFORM = &CLSID_KSCATEGORY_COMMUNICATIONSTRANSFORM_Value; const CLSID_KSCATEGORY_INTERFACETRANSFORM_Value = @import("../../zig.zig").Guid.initString("cf1dda2d-9743-11d0-a3ee-00a0c9223196"); pub const CLSID_KSCATEGORY_INTERFACETRANSFORM = &CLSID_KSCATEGORY_INTERFACETRANSFORM_Value; const CLSID_KSCATEGORY_MEDIUMTRANSFORM_Value = @import("../../zig.zig").Guid.initString("cf1dda2e-9743-11d0-a3ee-00a0c9223196"); pub const CLSID_KSCATEGORY_MEDIUMTRANSFORM = &CLSID_KSCATEGORY_MEDIUMTRANSFORM_Value; const CLSID_KSCATEGORY_FILESYSTEM_Value = @import("../../zig.zig").Guid.initString("760fed5e-9357-11d0-a3cc-00a0c9223196"); pub const CLSID_KSCATEGORY_FILESYSTEM = &CLSID_KSCATEGORY_FILESYSTEM_Value; const CLSID_KSCATEGORY_CLOCK_Value = @import("../../zig.zig").Guid.initString("53172480-4791-11d0-a5d6-28db04c10000"); pub const CLSID_KSCATEGORY_CLOCK = &CLSID_KSCATEGORY_CLOCK_Value; const CLSID_KSCATEGORY_PROXY_Value = @import("../../zig.zig").Guid.initString("97ebaaca-95bd-11d0-a3ea-00a0c9223196"); pub const CLSID_KSCATEGORY_PROXY = &CLSID_KSCATEGORY_PROXY_Value; const CLSID_KSCATEGORY_QUALITY_Value = @import("../../zig.zig").Guid.initString("97ebaacb-95bd-11d0-a3ea-00a0c9223196"); pub const CLSID_KSCATEGORY_QUALITY = &CLSID_KSCATEGORY_QUALITY_Value; pub const KSTOPOLOGY = extern struct { CategoriesCount: u32, Categories: ?*const Guid, TopologyNodesCount: u32, TopologyNodes: ?*const Guid, TopologyConnectionsCount: u32, TopologyConnections: ?*const KSTOPOLOGY_CONNECTION, TopologyNodesNames: ?*const Guid, Reserved: u32, }; pub const KSNODE_CREATE = extern struct { CreateFlags: u32, Node: u32, }; const CLSID_KSTIME_FORMAT_FRAME_Value = @import("../../zig.zig").Guid.initString("7b785570-8c82-11cf-bc0c-00aa00ac74f6"); pub const CLSID_KSTIME_FORMAT_FRAME = &CLSID_KSTIME_FORMAT_FRAME_Value; const CLSID_KSTIME_FORMAT_BYTE_Value = @import("../../zig.zig").Guid.initString("7b785571-8c82-11cf-bc0c-00aa00ac74f6"); pub const CLSID_KSTIME_FORMAT_BYTE = &CLSID_KSTIME_FORMAT_BYTE_Value; const CLSID_KSTIME_FORMAT_SAMPLE_Value = @import("../../zig.zig").Guid.initString("7b785572-8c82-11cf-bc0c-00aa00ac74f6"); pub const CLSID_KSTIME_FORMAT_SAMPLE = &CLSID_KSTIME_FORMAT_SAMPLE_Value; const CLSID_KSTIME_FORMAT_FIELD_Value = @import("../../zig.zig").Guid.initString("7b785573-8c82-11cf-bc0c-00aa00ac74f6"); pub const CLSID_KSTIME_FORMAT_FIELD = &CLSID_KSTIME_FORMAT_FIELD_Value; const CLSID_KSTIME_FORMAT_MEDIA_TIME_Value = @import("../../zig.zig").Guid.initString("7b785574-8c82-11cf-bc0c-00aa00ac74f6"); pub const CLSID_KSTIME_FORMAT_MEDIA_TIME = &CLSID_KSTIME_FORMAT_MEDIA_TIME_Value; const CLSID_KSINTERFACESETID_Standard_Value = @import("../../zig.zig").Guid.initString("1a8766a0-62ce-11cf-a5d6-28db04c10000"); pub const CLSID_KSINTERFACESETID_Standard = &CLSID_KSINTERFACESETID_Standard_Value; pub const KSINTERFACE_STANDARD = enum(i32) { STREAMING = 0, LOOPED_STREAMING = 1, CONTROL = 2, }; pub const KSINTERFACE_STANDARD_STREAMING = KSINTERFACE_STANDARD.STREAMING; pub const KSINTERFACE_STANDARD_LOOPED_STREAMING = KSINTERFACE_STANDARD.LOOPED_STREAMING; pub const KSINTERFACE_STANDARD_CONTROL = KSINTERFACE_STANDARD.CONTROL; const CLSID_KSINTERFACESETID_FileIo_Value = @import("../../zig.zig").Guid.initString("8c6f932c-e771-11d0-b8ff-00a0c9223196"); pub const CLSID_KSINTERFACESETID_FileIo = &CLSID_KSINTERFACESETID_FileIo_Value; pub const KSINTERFACE_FILEIO = enum(i32) { G = 0, }; pub const KSINTERFACE_FILEIO_STREAMING = KSINTERFACE_FILEIO.G; const CLSID_KSMEDIUMSETID_Standard_Value = @import("../../zig.zig").Guid.initString("4747b320-62ce-11cf-a5d6-28db04c10000"); pub const CLSID_KSMEDIUMSETID_Standard = &CLSID_KSMEDIUMSETID_Standard_Value; const CLSID_KSPROPSETID_Pin_Value = @import("../../zig.zig").Guid.initString("8c134960-51ad-11cf-878a-94f801c10000"); pub const CLSID_KSPROPSETID_Pin = &CLSID_KSPROPSETID_Pin_Value; pub const KSPROPERTY_PIN = enum(i32) { CINSTANCES = 0, CTYPES = 1, DATAFLOW = 2, DATARANGES = 3, DATAINTERSECTION = 4, INTERFACES = 5, MEDIUMS = 6, COMMUNICATION = 7, GLOBALCINSTANCES = 8, NECESSARYINSTANCES = 9, PHYSICALCONNECTION = 10, CATEGORY = 11, NAME = 12, CONSTRAINEDDATARANGES = 13, PROPOSEDATAFORMAT = 14, PROPOSEDATAFORMAT2 = 15, MODEDATAFORMATS = 16, }; pub const KSPROPERTY_PIN_CINSTANCES = KSPROPERTY_PIN.CINSTANCES; pub const KSPROPERTY_PIN_CTYPES = KSPROPERTY_PIN.CTYPES; pub const KSPROPERTY_PIN_DATAFLOW = KSPROPERTY_PIN.DATAFLOW; pub const KSPROPERTY_PIN_DATARANGES = KSPROPERTY_PIN.DATARANGES; pub const KSPROPERTY_PIN_DATAINTERSECTION = KSPROPERTY_PIN.DATAINTERSECTION; pub const KSPROPERTY_PIN_INTERFACES = KSPROPERTY_PIN.INTERFACES; pub const KSPROPERTY_PIN_MEDIUMS = KSPROPERTY_PIN.MEDIUMS; pub const KSPROPERTY_PIN_COMMUNICATION = KSPROPERTY_PIN.COMMUNICATION; pub const KSPROPERTY_PIN_GLOBALCINSTANCES = KSPROPERTY_PIN.GLOBALCINSTANCES; pub const KSPROPERTY_PIN_NECESSARYINSTANCES = KSPROPERTY_PIN.NECESSARYINSTANCES; pub const KSPROPERTY_PIN_PHYSICALCONNECTION = KSPROPERTY_PIN.PHYSICALCONNECTION; pub const KSPROPERTY_PIN_CATEGORY = KSPROPERTY_PIN.CATEGORY; pub const KSPROPERTY_PIN_NAME = KSPROPERTY_PIN.NAME; pub const KSPROPERTY_PIN_CONSTRAINEDDATARANGES = KSPROPERTY_PIN.CONSTRAINEDDATARANGES; pub const KSPROPERTY_PIN_PROPOSEDATAFORMAT = KSPROPERTY_PIN.PROPOSEDATAFORMAT; pub const KSPROPERTY_PIN_PROPOSEDATAFORMAT2 = KSPROPERTY_PIN.PROPOSEDATAFORMAT2; pub const KSPROPERTY_PIN_MODEDATAFORMATS = KSPROPERTY_PIN.MODEDATAFORMATS; pub const KSP_PIN = extern struct { Property: KSIDENTIFIER, PinId: u32, Anonymous: extern union { Reserved: u32, Flags: u32, }, }; pub const KSE_PIN = extern struct { Event: KSIDENTIFIER, PinId: u32, Reserved: u32, }; pub const KSPIN_CINSTANCES = extern struct { PossibleCount: u32, CurrentCount: u32, }; pub const KSPIN_DATAFLOW = enum(i32) { IN = 1, OUT = 2, }; pub const KSPIN_DATAFLOW_IN = KSPIN_DATAFLOW.IN; pub const KSPIN_DATAFLOW_OUT = KSPIN_DATAFLOW.OUT; pub const KSDATAFORMAT = extern union { Anonymous: extern struct { FormatSize: u32, Flags: u32, SampleSize: u32, Reserved: u32, MajorFormat: Guid, SubFormat: Guid, Specifier: Guid, }, Alignment: i64, }; pub const KSATTRIBUTE = extern struct { Size: u32, Flags: u32, Attribute: Guid, }; pub const KSPIN_COMMUNICATION = enum(i32) { NONE = 0, SINK = 1, SOURCE = 2, BOTH = 3, BRIDGE = 4, }; pub const KSPIN_COMMUNICATION_NONE = KSPIN_COMMUNICATION.NONE; pub const KSPIN_COMMUNICATION_SINK = KSPIN_COMMUNICATION.SINK; pub const KSPIN_COMMUNICATION_SOURCE = KSPIN_COMMUNICATION.SOURCE; pub const KSPIN_COMMUNICATION_BOTH = KSPIN_COMMUNICATION.BOTH; pub const KSPIN_COMMUNICATION_BRIDGE = KSPIN_COMMUNICATION.BRIDGE; pub const KSPIN_CONNECT = extern struct { Interface: KSIDENTIFIER, Medium: KSIDENTIFIER, PinId: u32, PinToHandle: ?HANDLE, Priority: KSPRIORITY, }; pub const KSPIN_PHYSICALCONNECTION = extern struct { Size: u32, Pin: u32, SymbolicLinkName: [1]u16, }; const CLSID_KSEVENTSETID_PinCapsChange_Value = @import("../../zig.zig").Guid.initString("dd4f192e-3b78-49ad-a534-2c315b822000"); pub const CLSID_KSEVENTSETID_PinCapsChange = &CLSID_KSEVENTSETID_PinCapsChange_Value; pub const KSEVENT_PINCAPS_CHANGENOTIFICATIONS = enum(i32) { FORMATCHANGE = 0, JACKINFOCHANGE = 1, }; pub const KSEVENT_PINCAPS_FORMATCHANGE = KSEVENT_PINCAPS_CHANGENOTIFICATIONS.FORMATCHANGE; pub const KSEVENT_PINCAPS_JACKINFOCHANGE = KSEVENT_PINCAPS_CHANGENOTIFICATIONS.JACKINFOCHANGE; const CLSID_KSEVENTSETID_VolumeLimit_Value = @import("../../zig.zig").Guid.initString("da168465-3a7c-4858-9d4a-3e8e24701aef"); pub const CLSID_KSEVENTSETID_VolumeLimit = &CLSID_KSEVENTSETID_VolumeLimit_Value; pub const KSEVENT_VOLUMELIMIT = enum(i32) { D = 0, }; pub const KSEVENT_VOLUMELIMIT_CHANGED = KSEVENT_VOLUMELIMIT.D; const CLSID_KSNAME_Filter_Value = @import("../../zig.zig").Guid.initString("9b365890-165f-11d0-a195-0020afd156e4"); pub const CLSID_KSNAME_Filter = &CLSID_KSNAME_Filter_Value; const CLSID_KSNAME_Pin_Value = @import("../../zig.zig").Guid.initString("146f1a80-4791-11d0-a5d6-28db04c10000"); pub const CLSID_KSNAME_Pin = &CLSID_KSNAME_Pin_Value; const CLSID_KSNAME_Clock_Value = @import("../../zig.zig").Guid.initString("53172480-4791-11d0-a5d6-28db04c10000"); pub const CLSID_KSNAME_Clock = &CLSID_KSNAME_Clock_Value; const CLSID_KSNAME_Allocator_Value = @import("../../zig.zig").Guid.initString("642f5d00-4791-11d0-a5d6-28db04c10000"); pub const CLSID_KSNAME_Allocator = &CLSID_KSNAME_Allocator_Value; const CLSID_KSNAME_TopologyNode_Value = @import("../../zig.zig").Guid.initString("0621061a-ee75-11d0-b915-00a0c9223196"); pub const CLSID_KSNAME_TopologyNode = &CLSID_KSNAME_TopologyNode_Value; const CLSID_KSDATAFORMAT_TYPE_STREAM_Value = @import("../../zig.zig").Guid.initString("e436eb83-524f-11ce-9f53-0020af0ba770"); pub const CLSID_KSDATAFORMAT_TYPE_STREAM = &CLSID_KSDATAFORMAT_TYPE_STREAM_Value; const CLSID_KSDATAFORMAT_SUBTYPE_NONE_Value = @import("../../zig.zig").Guid.initString("e436eb8e-524f-11ce-9f53-0020af0ba770"); pub const CLSID_KSDATAFORMAT_SUBTYPE_NONE = &CLSID_KSDATAFORMAT_SUBTYPE_NONE_Value; const CLSID_KSDATAFORMAT_SPECIFIER_FILENAME_Value = @import("../../zig.zig").Guid.initString("aa797b40-e974-11cf-a5d6-28db04c10000"); pub const CLSID_KSDATAFORMAT_SPECIFIER_FILENAME = &CLSID_KSDATAFORMAT_SPECIFIER_FILENAME_Value; const CLSID_KSDATAFORMAT_SPECIFIER_FILEHANDLE_Value = @import("../../zig.zig").Guid.initString("65e8773c-8f56-11d0-a3b9-00a0c9223196"); pub const CLSID_KSDATAFORMAT_SPECIFIER_FILEHANDLE = &CLSID_KSDATAFORMAT_SPECIFIER_FILEHANDLE_Value; const CLSID_KSDATAFORMAT_SPECIFIER_NONE_Value = @import("../../zig.zig").Guid.initString("0f6417d6-c318-11d0-a43f-00a0c9223196"); pub const CLSID_KSDATAFORMAT_SPECIFIER_NONE = &CLSID_KSDATAFORMAT_SPECIFIER_NONE_Value; const CLSID_KSPROPSETID_Quality_Value = @import("../../zig.zig").Guid.initString("d16ad380-ac1a-11cf-a5d6-28db04c10000"); pub const CLSID_KSPROPSETID_Quality = &CLSID_KSPROPSETID_Quality_Value; pub const KSPROPERTY_QUALITY = enum(i32) { REPORT = 0, ERROR = 1, }; pub const KSPROPERTY_QUALITY_REPORT = KSPROPERTY_QUALITY.REPORT; pub const KSPROPERTY_QUALITY_ERROR = KSPROPERTY_QUALITY.ERROR; const CLSID_KSPROPSETID_Connection_Value = @import("../../zig.zig").Guid.initString("1d58c920-ac9b-11cf-a5d6-28db04c10000"); pub const CLSID_KSPROPSETID_Connection = &CLSID_KSPROPSETID_Connection_Value; pub const KSPROPERTY_CONNECTION = enum(i32) { STATE = 0, PRIORITY = 1, DATAFORMAT = 2, ALLOCATORFRAMING = 3, PROPOSEDATAFORMAT = 4, ACQUIREORDERING = 5, ALLOCATORFRAMING_EX = 6, STARTAT = 7, }; pub const KSPROPERTY_CONNECTION_STATE = KSPROPERTY_CONNECTION.STATE; pub const KSPROPERTY_CONNECTION_PRIORITY = KSPROPERTY_CONNECTION.PRIORITY; pub const KSPROPERTY_CONNECTION_DATAFORMAT = KSPROPERTY_CONNECTION.DATAFORMAT; pub const KSPROPERTY_CONNECTION_ALLOCATORFRAMING = KSPROPERTY_CONNECTION.ALLOCATORFRAMING; pub const KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT = KSPROPERTY_CONNECTION.PROPOSEDATAFORMAT; pub const KSPROPERTY_CONNECTION_ACQUIREORDERING = KSPROPERTY_CONNECTION.ACQUIREORDERING; pub const KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX = KSPROPERTY_CONNECTION.ALLOCATORFRAMING_EX; pub const KSPROPERTY_CONNECTION_STARTAT = KSPROPERTY_CONNECTION.STARTAT; const CLSID_KSPROPSETID_MemoryTransport_Value = @import("../../zig.zig").Guid.initString("0a3d1c5d-5243-4819-9ed0-aee8044cee2b"); pub const CLSID_KSPROPSETID_MemoryTransport = &CLSID_KSPROPSETID_MemoryTransport_Value; pub const KSALLOCATOR_FRAMING = extern struct { Anonymous1: extern union { OptionsFlags: u32, RequirementsFlags: u32, }, PoolType: u32, Frames: u32, FrameSize: u32, Anonymous2: extern union { FileAlignment: u32, FramePitch: i32, }, Reserved: u32, }; pub const KS_FRAMING_RANGE = extern struct { MinFrameSize: u32, MaxFrameSize: u32, Stepping: u32, }; pub const KS_FRAMING_RANGE_WEIGHTED = extern struct { Range: KS_FRAMING_RANGE, InPlaceWeight: u32, NotInPlaceWeight: u32, }; pub const KS_COMPRESSION = extern struct { RatioNumerator: u32, RatioDenominator: u32, RatioConstantMargin: u32, }; pub const KS_FRAMING_ITEM = extern struct { MemoryType: Guid, BusType: Guid, MemoryFlags: u32, BusFlags: u32, Flags: u32, Frames: u32, Anonymous: extern union { FileAlignment: u32, FramePitch: i32, }, MemoryTypeWeight: u32, PhysicalRange: KS_FRAMING_RANGE, FramingRange: KS_FRAMING_RANGE_WEIGHTED, }; pub const KSALLOCATOR_FRAMING_EX = extern struct { CountItems: u32, PinFlags: u32, OutputCompression: KS_COMPRESSION, PinWeight: u32, FramingItem: [1]KS_FRAMING_ITEM, }; const CLSID_KSMEMORY_TYPE_SYSTEM_Value = @import("../../zig.zig").Guid.initString("091bb638-603f-11d1-b067-00a0c9062802"); pub const CLSID_KSMEMORY_TYPE_SYSTEM = &CLSID_KSMEMORY_TYPE_SYSTEM_Value; const CLSID_KSMEMORY_TYPE_USER_Value = @import("../../zig.zig").Guid.initString("8cb0fc28-7893-11d1-b069-00a0c9062802"); pub const CLSID_KSMEMORY_TYPE_USER = &CLSID_KSMEMORY_TYPE_USER_Value; const CLSID_KSMEMORY_TYPE_KERNEL_PAGED_Value = @import("../../zig.zig").Guid.initString("d833f8f8-7894-11d1-b069-00a0c9062802"); pub const CLSID_KSMEMORY_TYPE_KERNEL_PAGED = &CLSID_KSMEMORY_TYPE_KERNEL_PAGED_Value; const CLSID_KSMEMORY_TYPE_KERNEL_NONPAGED_Value = @import("../../zig.zig").Guid.initString("4a6d5fc4-7895-11d1-b069-00a0c9062802"); pub const CLSID_KSMEMORY_TYPE_KERNEL_NONPAGED = &CLSID_KSMEMORY_TYPE_KERNEL_NONPAGED_Value; const CLSID_KSMEMORY_TYPE_DEVICE_UNKNOWN_Value = @import("../../zig.zig").Guid.initString("091bb639-603f-11d1-b067-00a0c9062802"); pub const CLSID_KSMEMORY_TYPE_DEVICE_UNKNOWN = &CLSID_KSMEMORY_TYPE_DEVICE_UNKNOWN_Value; const CLSID_KSEVENTSETID_StreamAllocator_Value = @import("../../zig.zig").Guid.initString("75d95571-073c-11d0-a161-0020afd156e4"); pub const CLSID_KSEVENTSETID_StreamAllocator = &CLSID_KSEVENTSETID_StreamAllocator_Value; pub const KSEVENT_STREAMALLOCATOR = enum(i32) { INTERNAL_FREEFRAME = 0, FREEFRAME = 1, }; pub const KSEVENT_STREAMALLOCATOR_INTERNAL_FREEFRAME = KSEVENT_STREAMALLOCATOR.INTERNAL_FREEFRAME; pub const KSEVENT_STREAMALLOCATOR_FREEFRAME = KSEVENT_STREAMALLOCATOR.FREEFRAME; const CLSID_KSMETHODSETID_StreamAllocator_Value = @import("../../zig.zig").Guid.initString("cf6e4341-ec87-11cf-a130-0020afd156e4"); pub const CLSID_KSMETHODSETID_StreamAllocator = &CLSID_KSMETHODSETID_StreamAllocator_Value; pub const KSMETHOD_STREAMALLOCATOR = enum(i32) { ALLOC = 0, FREE = 1, }; pub const KSMETHOD_STREAMALLOCATOR_ALLOC = KSMETHOD_STREAMALLOCATOR.ALLOC; pub const KSMETHOD_STREAMALLOCATOR_FREE = KSMETHOD_STREAMALLOCATOR.FREE; const CLSID_KSPROPSETID_StreamAllocator_Value = @import("../../zig.zig").Guid.initString("cf6e4342-ec87-11cf-a130-0020afd156e4"); pub const CLSID_KSPROPSETID_StreamAllocator = &CLSID_KSPROPSETID_StreamAllocator_Value; pub const KSSTREAMALLOCATOR_STATUS = extern struct { Framing: KSALLOCATOR_FRAMING, AllocatedFrames: u32, Reserved: u32, }; pub const KSSTREAMALLOCATOR_STATUS_EX = extern struct { Framing: KSALLOCATOR_FRAMING_EX, AllocatedFrames: u32, Reserved: u32, }; pub const KSTIME = extern struct { Time: i64, Numerator: u32, Denominator: u32, }; pub const KSSTREAM_METADATA_INFO = extern struct { BufferSize: u32, UsedSize: u32, Data: ?*c_void, SystemVa: ?*c_void, Flags: u32, Reserved: u32, }; pub const KSSTREAM_UVC_METADATATYPE_TIMESTAMP = extern struct { PresentationTimeStamp: u32, SourceClockReference: u32, Anonymous: extern union { Anonymous: extern struct { _bitfield: u16, }, SCRToken: u16, }, Reserved0: u16, Reserved1: u32, }; pub const KSSTREAM_UVC_METADATA = extern struct { StartOfFrameTimestamp: KSSTREAM_UVC_METADATATYPE_TIMESTAMP, EndOfFrameTimestamp: KSSTREAM_UVC_METADATATYPE_TIMESTAMP, }; pub const KSPIN_MDL_CACHING_EVENT = enum(i32) { CLEANUP = 0, CLEANALL_WAIT = 1, CLEANALL_NOWAIT = 2, ADDSAMPLE = 3, }; pub const KSPIN_MDL_CACHING_NOTIFY_CLEANUP = KSPIN_MDL_CACHING_EVENT.CLEANUP; pub const KSPIN_MDL_CACHING_NOTIFY_CLEANALL_WAIT = KSPIN_MDL_CACHING_EVENT.CLEANALL_WAIT; pub const KSPIN_MDL_CACHING_NOTIFY_CLEANALL_NOWAIT = KSPIN_MDL_CACHING_EVENT.CLEANALL_NOWAIT; pub const KSPIN_MDL_CACHING_NOTIFY_ADDSAMPLE = KSPIN_MDL_CACHING_EVENT.ADDSAMPLE; pub const KSPIN_MDL_CACHING_NOTIFICATION = extern struct { Event: KSPIN_MDL_CACHING_EVENT, Buffer: ?*c_void, }; pub const KSPIN_MDL_CACHING_NOTIFICATION32 = extern struct { Event: KSPIN_MDL_CACHING_EVENT, Buffer: u32, }; const CLSID_KSPROPSETID_StreamInterface_Value = @import("../../zig.zig").Guid.initString("1fdd8ee1-9cd3-11d0-82aa-0000f822fe8a"); pub const CLSID_KSPROPSETID_StreamInterface = &CLSID_KSPROPSETID_StreamInterface_Value; pub const KSPROPERTY_STREAMINTERFACE = enum(i32) { E = 0, }; pub const KSPROPERTY_STREAMINTERFACE_HEADERSIZE = KSPROPERTY_STREAMINTERFACE.E; const CLSID_KSPROPSETID_Stream_Value = @import("../../zig.zig").Guid.initString("65aaba60-98ae-11cf-a10d-0020afd156e4"); pub const CLSID_KSPROPSETID_Stream = &CLSID_KSPROPSETID_Stream_Value; pub const KSPROPERTY_STREAM = enum(i32) { ALLOCATOR = 0, QUALITY = 1, DEGRADATION = 2, MASTERCLOCK = 3, TIMEFORMAT = 4, PRESENTATIONTIME = 5, PRESENTATIONEXTENT = 6, FRAMETIME = 7, RATECAPABILITY = 8, RATE = 9, PIPE_ID = 10, }; pub const KSPROPERTY_STREAM_ALLOCATOR = KSPROPERTY_STREAM.ALLOCATOR; pub const KSPROPERTY_STREAM_QUALITY = KSPROPERTY_STREAM.QUALITY; pub const KSPROPERTY_STREAM_DEGRADATION = KSPROPERTY_STREAM.DEGRADATION; pub const KSPROPERTY_STREAM_MASTERCLOCK = KSPROPERTY_STREAM.MASTERCLOCK; pub const KSPROPERTY_STREAM_TIMEFORMAT = KSPROPERTY_STREAM.TIMEFORMAT; pub const KSPROPERTY_STREAM_PRESENTATIONTIME = KSPROPERTY_STREAM.PRESENTATIONTIME; pub const KSPROPERTY_STREAM_PRESENTATIONEXTENT = KSPROPERTY_STREAM.PRESENTATIONEXTENT; pub const KSPROPERTY_STREAM_FRAMETIME = KSPROPERTY_STREAM.FRAMETIME; pub const KSPROPERTY_STREAM_RATECAPABILITY = KSPROPERTY_STREAM.RATECAPABILITY; pub const KSPROPERTY_STREAM_RATE = KSPROPERTY_STREAM.RATE; pub const KSPROPERTY_STREAM_PIPE_ID = KSPROPERTY_STREAM.PIPE_ID; pub const KSPPROPERTY_ALLOCATOR_MDLCACHING = enum(i32) { S = 1, }; pub const KSPROPERTY_ALLOCATOR_CLEANUP_CACHEDMDLPAGES = KSPPROPERTY_ALLOCATOR_MDLCACHING.S; const CLSID_KSPROPSETID_PinMDLCacheClearProp_Value = @import("../../zig.zig").Guid.initString("bd718a7b-97fc-40c7-88ce-d3ff06f55b16"); pub const CLSID_KSPROPSETID_PinMDLCacheClearProp = &CLSID_KSPROPSETID_PinMDLCacheClearProp_Value; pub const KSQUALITY_MANAGER = extern struct { QualityManager: ?HANDLE, Context: ?*c_void, }; pub const KSFRAMETIME = extern struct { Duration: i64, FrameFlags: u32, Reserved: u32, }; pub const KSRATE = extern struct { PresentationStart: i64, Duration: i64, Interface: KSIDENTIFIER, Rate: i32, Flags: u32, }; pub const KSRATE_CAPABILITY = extern struct { Property: KSIDENTIFIER, Rate: KSRATE, }; const CLSID_KSPROPSETID_Clock_Value = @import("../../zig.zig").Guid.initString("df12a4c0-ac17-11cf-a5d6-28db04c10000"); pub const CLSID_KSPROPSETID_Clock = &CLSID_KSPROPSETID_Clock_Value; pub const KSCLOCK_CREATE = extern struct { CreateFlags: u32, }; pub const KSCORRELATED_TIME = extern struct { Time: i64, SystemTime: i64, }; pub const KSRESOLUTION = extern struct { Granularity: i64, Error: i64, }; pub const KSPROPERTY_CLOCK = enum(i32) { TIME = 0, PHYSICALTIME = 1, CORRELATEDTIME = 2, CORRELATEDPHYSICALTIME = 3, RESOLUTION = 4, STATE = 5, }; pub const KSPROPERTY_CLOCK_TIME = KSPROPERTY_CLOCK.TIME; pub const KSPROPERTY_CLOCK_PHYSICALTIME = KSPROPERTY_CLOCK.PHYSICALTIME; pub const KSPROPERTY_CLOCK_CORRELATEDTIME = KSPROPERTY_CLOCK.CORRELATEDTIME; pub const KSPROPERTY_CLOCK_CORRELATEDPHYSICALTIME = KSPROPERTY_CLOCK.CORRELATEDPHYSICALTIME; pub const KSPROPERTY_CLOCK_RESOLUTION = KSPROPERTY_CLOCK.RESOLUTION; pub const KSPROPERTY_CLOCK_STATE = KSPROPERTY_CLOCK.STATE; const CLSID_KSEVENTSETID_Clock_Value = @import("../../zig.zig").Guid.initString("364d8e20-62c7-11cf-a5d6-28db04c10000"); pub const CLSID_KSEVENTSETID_Clock = &CLSID_KSEVENTSETID_Clock_Value; pub const KSEVENT_CLOCK_POSITION = enum(i32) { INTERVAL_MARK = 0, POSITION_MARK = 1, }; pub const KSEVENT_CLOCK_INTERVAL_MARK = KSEVENT_CLOCK_POSITION.INTERVAL_MARK; pub const KSEVENT_CLOCK_POSITION_MARK = KSEVENT_CLOCK_POSITION.POSITION_MARK; const CLSID_KSEVENTSETID_Connection_Value = @import("../../zig.zig").Guid.initString("7f4bcbe0-9ea5-11cf-a5d6-28db04c10000"); pub const CLSID_KSEVENTSETID_Connection = &CLSID_KSEVENTSETID_Connection_Value; pub const KSEVENT_CONNECTION = enum(i32) { POSITIONUPDATE = 0, DATADISCONTINUITY = 1, TIMEDISCONTINUITY = 2, PRIORITY = 3, ENDOFSTREAM = 4, }; pub const KSEVENT_CONNECTION_POSITIONUPDATE = KSEVENT_CONNECTION.POSITIONUPDATE; pub const KSEVENT_CONNECTION_DATADISCONTINUITY = KSEVENT_CONNECTION.DATADISCONTINUITY; pub const KSEVENT_CONNECTION_TIMEDISCONTINUITY = KSEVENT_CONNECTION.TIMEDISCONTINUITY; pub const KSEVENT_CONNECTION_PRIORITY = KSEVENT_CONNECTION.PRIORITY; pub const KSEVENT_CONNECTION_ENDOFSTREAM = KSEVENT_CONNECTION.ENDOFSTREAM; pub const KSQUALITY = extern struct { Context: ?*c_void, Proportion: u32, DeltaTime: i64, }; pub const KSERROR = extern struct { Context: ?*c_void, Status: u32, }; pub const KSDEVICE_THERMAL_STATE = enum(i32) { LOW = 0, HIGH = 1, }; pub const KSDEVICE_THERMAL_STATE_LOW = KSDEVICE_THERMAL_STATE.LOW; pub const KSDEVICE_THERMAL_STATE_HIGH = KSDEVICE_THERMAL_STATE.HIGH; const CLSID_KSEVENTSETID_Device_Value = @import("../../zig.zig").Guid.initString("288296ec-9f94-41b4-a153-aa31aeecb33f"); pub const CLSID_KSEVENTSETID_Device = &CLSID_KSEVENTSETID_Device_Value; pub const KSEVENT_DEVICE = enum(i32) { LOST = 0, PREEMPTED = 1, THERMAL_HIGH = 2, THERMAL_LOW = 3, }; pub const KSEVENT_DEVICE_LOST = KSEVENT_DEVICE.LOST; pub const KSEVENT_DEVICE_PREEMPTED = KSEVENT_DEVICE.PREEMPTED; pub const KSEVENT_DEVICE_THERMAL_HIGH = KSEVENT_DEVICE.THERMAL_HIGH; pub const KSEVENT_DEVICE_THERMAL_LOW = KSEVENT_DEVICE.THERMAL_LOW; const CLSID_KSDEGRADESETID_Standard_Value = @import("../../zig.zig").Guid.initString("9f564180-704c-11d0-a5d6-28db04c10000"); pub const CLSID_KSDEGRADESETID_Standard = &CLSID_KSDEGRADESETID_Standard_Value; pub const KSDEGRADE_STANDARD = enum(i32) { SAMPLE = 0, QUALITY = 1, COMPUTATION = 2, SKIP = 3, }; pub const KSDEGRADE_STANDARD_SAMPLE = KSDEGRADE_STANDARD.SAMPLE; pub const KSDEGRADE_STANDARD_QUALITY = KSDEGRADE_STANDARD.QUALITY; pub const KSDEGRADE_STANDARD_COMPUTATION = KSDEGRADE_STANDARD.COMPUTATION; pub const KSDEGRADE_STANDARD_SKIP = KSDEGRADE_STANDARD.SKIP; pub const KSPROPERTY_SERIALHDR = packed struct { PropertySet: Guid, Count: u32, }; pub const KSPROPERTY_SERIAL = extern struct { PropTypeSet: KSIDENTIFIER, Id: u32, PropertyLength: u32, }; pub const MF_MDL_SHARED_PAYLOAD_KEY = extern union { combined: extern struct { pHandle: u32, fHandle: u32, uPayload: u64, }, GMDLHandle: Guid, }; pub const KSMULTIPLE_DATA_PROP = extern struct { Property: KSIDENTIFIER, MultipleItem: KSMULTIPLE_ITEM, }; const CLSID_KSMEDIUMSETID_MidiBus_Value = @import("../../zig.zig").Guid.initString("05908040-3246-11d0-a5d6-28db04c10000"); pub const CLSID_KSMEDIUMSETID_MidiBus = &CLSID_KSMEDIUMSETID_MidiBus_Value; const CLSID_KSMEDIUMSETID_VPBus_Value = @import("../../zig.zig").Guid.initString("a18c15ec-ce43-11d0-abe7-00a0c9223196"); pub const CLSID_KSMEDIUMSETID_VPBus = &CLSID_KSMEDIUMSETID_VPBus_Value; const CLSID_KSINTERFACESETID_Media_Value = @import("../../zig.zig").Guid.initString("3a13eb40-30a7-11d0-a5d6-28db04c10000"); pub const CLSID_KSINTERFACESETID_Media = &CLSID_KSINTERFACESETID_Media_Value; pub const KSINTERFACE_MEDIA = enum(i32) { MUSIC = 0, WAVE_BUFFERED = 1, WAVE_QUEUED = 2, }; pub const KSINTERFACE_MEDIA_MUSIC = KSINTERFACE_MEDIA.MUSIC; pub const KSINTERFACE_MEDIA_WAVE_BUFFERED = KSINTERFACE_MEDIA.WAVE_BUFFERED; pub const KSINTERFACE_MEDIA_WAVE_QUEUED = KSINTERFACE_MEDIA.WAVE_QUEUED; const CLSID_KSCOMPONENTID_USBAUDIO_Value = @import("../../zig.zig").Guid.initString("8f1275f0-26e9-4264-ba4d-39fff01d94aa"); pub const CLSID_KSCOMPONENTID_USBAUDIO = &CLSID_KSCOMPONENTID_USBAUDIO_Value; const CLSID_KSNODETYPE_INPUT_UNDEFINED_Value = @import("../../zig.zig").Guid.initString("dff21be0-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_INPUT_UNDEFINED = &CLSID_KSNODETYPE_INPUT_UNDEFINED_Value; const CLSID_KSNODETYPE_MICROPHONE_Value = @import("../../zig.zig").Guid.initString("dff21be1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_MICROPHONE = &CLSID_KSNODETYPE_MICROPHONE_Value; const CLSID_KSNODETYPE_DESKTOP_MICROPHONE_Value = @import("../../zig.zig").Guid.initString("dff21be2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DESKTOP_MICROPHONE = &CLSID_KSNODETYPE_DESKTOP_MICROPHONE_Value; const CLSID_KSNODETYPE_PERSONAL_MICROPHONE_Value = @import("../../zig.zig").Guid.initString("dff21be3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_PERSONAL_MICROPHONE = &CLSID_KSNODETYPE_PERSONAL_MICROPHONE_Value; const CLSID_KSNODETYPE_OMNI_DIRECTIONAL_MICROPHONE_Value = @import("../../zig.zig").Guid.initString("dff21be4-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_OMNI_DIRECTIONAL_MICROPHONE = &CLSID_KSNODETYPE_OMNI_DIRECTIONAL_MICROPHONE_Value; const CLSID_KSNODETYPE_MICROPHONE_ARRAY_Value = @import("../../zig.zig").Guid.initString("dff21be5-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_MICROPHONE_ARRAY = &CLSID_KSNODETYPE_MICROPHONE_ARRAY_Value; const CLSID_KSNODETYPE_PROCESSING_MICROPHONE_ARRAY_Value = @import("../../zig.zig").Guid.initString("dff21be6-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_PROCESSING_MICROPHONE_ARRAY = &CLSID_KSNODETYPE_PROCESSING_MICROPHONE_ARRAY_Value; const CLSID_KSCATEGORY_MICROPHONE_ARRAY_PROCESSOR_Value = @import("../../zig.zig").Guid.initString("830a44f2-a32d-476b-be97-42845673b35a"); pub const CLSID_KSCATEGORY_MICROPHONE_ARRAY_PROCESSOR = &CLSID_KSCATEGORY_MICROPHONE_ARRAY_PROCESSOR_Value; const CLSID_KSNODETYPE_OUTPUT_UNDEFINED_Value = @import("../../zig.zig").Guid.initString("dff21ce0-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_OUTPUT_UNDEFINED = &CLSID_KSNODETYPE_OUTPUT_UNDEFINED_Value; const CLSID_KSNODETYPE_SPEAKER_Value = @import("../../zig.zig").Guid.initString("dff21ce1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_SPEAKER = &CLSID_KSNODETYPE_SPEAKER_Value; const CLSID_KSNODETYPE_HEADPHONES_Value = @import("../../zig.zig").Guid.initString("dff21ce2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_HEADPHONES = &CLSID_KSNODETYPE_HEADPHONES_Value; const CLSID_KSNODETYPE_HEAD_MOUNTED_DISPLAY_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff21ce3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_HEAD_MOUNTED_DISPLAY_AUDIO = &CLSID_KSNODETYPE_HEAD_MOUNTED_DISPLAY_AUDIO_Value; const CLSID_KSNODETYPE_DESKTOP_SPEAKER_Value = @import("../../zig.zig").Guid.initString("dff21ce4-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DESKTOP_SPEAKER = &CLSID_KSNODETYPE_DESKTOP_SPEAKER_Value; const CLSID_KSNODETYPE_ROOM_SPEAKER_Value = @import("../../zig.zig").Guid.initString("dff21ce5-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_ROOM_SPEAKER = &CLSID_KSNODETYPE_ROOM_SPEAKER_Value; const CLSID_KSNODETYPE_COMMUNICATION_SPEAKER_Value = @import("../../zig.zig").Guid.initString("dff21ce6-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_COMMUNICATION_SPEAKER = &CLSID_KSNODETYPE_COMMUNICATION_SPEAKER_Value; const CLSID_KSNODETYPE_LOW_FREQUENCY_EFFECTS_SPEAKER_Value = @import("../../zig.zig").Guid.initString("dff21ce7-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_LOW_FREQUENCY_EFFECTS_SPEAKER = &CLSID_KSNODETYPE_LOW_FREQUENCY_EFFECTS_SPEAKER_Value; const CLSID_KSNODETYPE_BIDIRECTIONAL_UNDEFINED_Value = @import("../../zig.zig").Guid.initString("dff21de0-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_BIDIRECTIONAL_UNDEFINED = &CLSID_KSNODETYPE_BIDIRECTIONAL_UNDEFINED_Value; const CLSID_KSNODETYPE_HANDSET_Value = @import("../../zig.zig").Guid.initString("dff21de1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_HANDSET = &CLSID_KSNODETYPE_HANDSET_Value; const CLSID_KSNODETYPE_HEADSET_Value = @import("../../zig.zig").Guid.initString("dff21de2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_HEADSET = &CLSID_KSNODETYPE_HEADSET_Value; const CLSID_KSNODETYPE_SPEAKERPHONE_NO_ECHO_REDUCTION_Value = @import("../../zig.zig").Guid.initString("dff21de3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_SPEAKERPHONE_NO_ECHO_REDUCTION = &CLSID_KSNODETYPE_SPEAKERPHONE_NO_ECHO_REDUCTION_Value; const CLSID_KSNODETYPE_ECHO_SUPPRESSING_SPEAKERPHONE_Value = @import("../../zig.zig").Guid.initString("dff21de4-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_ECHO_SUPPRESSING_SPEAKERPHONE = &CLSID_KSNODETYPE_ECHO_SUPPRESSING_SPEAKERPHONE_Value; const CLSID_KSNODETYPE_ECHO_CANCELING_SPEAKERPHONE_Value = @import("../../zig.zig").Guid.initString("dff21de5-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_ECHO_CANCELING_SPEAKERPHONE = &CLSID_KSNODETYPE_ECHO_CANCELING_SPEAKERPHONE_Value; const CLSID_KSNODETYPE_TELEPHONY_UNDEFINED_Value = @import("../../zig.zig").Guid.initString("dff21ee0-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_TELEPHONY_UNDEFINED = &CLSID_KSNODETYPE_TELEPHONY_UNDEFINED_Value; const CLSID_KSNODETYPE_PHONE_LINE_Value = @import("../../zig.zig").Guid.initString("dff21ee1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_PHONE_LINE = &CLSID_KSNODETYPE_PHONE_LINE_Value; const CLSID_KSNODETYPE_TELEPHONE_Value = @import("../../zig.zig").Guid.initString("dff21ee2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_TELEPHONE = &CLSID_KSNODETYPE_TELEPHONE_Value; const CLSID_KSNODETYPE_DOWN_LINE_PHONE_Value = @import("../../zig.zig").Guid.initString("dff21ee3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DOWN_LINE_PHONE = &CLSID_KSNODETYPE_DOWN_LINE_PHONE_Value; const CLSID_KSNODETYPE_EXTERNAL_UNDEFINED_Value = @import("../../zig.zig").Guid.initString("dff21fe0-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_EXTERNAL_UNDEFINED = &CLSID_KSNODETYPE_EXTERNAL_UNDEFINED_Value; const CLSID_KSNODETYPE_ANALOG_CONNECTOR_Value = @import("../../zig.zig").Guid.initString("dff21fe1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_ANALOG_CONNECTOR = &CLSID_KSNODETYPE_ANALOG_CONNECTOR_Value; const CLSID_KSNODETYPE_DIGITAL_AUDIO_INTERFACE_Value = @import("../../zig.zig").Guid.initString("dff21fe2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DIGITAL_AUDIO_INTERFACE = &CLSID_KSNODETYPE_DIGITAL_AUDIO_INTERFACE_Value; const CLSID_KSNODETYPE_LINE_CONNECTOR_Value = @import("../../zig.zig").Guid.initString("dff21fe3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_LINE_CONNECTOR = &CLSID_KSNODETYPE_LINE_CONNECTOR_Value; const CLSID_KSNODETYPE_LEGACY_AUDIO_CONNECTOR_Value = @import("../../zig.zig").Guid.initString("dff21fe4-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_LEGACY_AUDIO_CONNECTOR = &CLSID_KSNODETYPE_LEGACY_AUDIO_CONNECTOR_Value; const CLSID_KSNODETYPE_SPDIF_INTERFACE_Value = @import("../../zig.zig").Guid.initString("dff21fe5-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_SPDIF_INTERFACE = &CLSID_KSNODETYPE_SPDIF_INTERFACE_Value; const CLSID_KSNODETYPE_1394_DA_STREAM_Value = @import("../../zig.zig").Guid.initString("dff21fe6-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_1394_DA_STREAM = &CLSID_KSNODETYPE_1394_DA_STREAM_Value; const CLSID_KSNODETYPE_1394_DV_STREAM_SOUNDTRACK_Value = @import("../../zig.zig").Guid.initString("dff21fe7-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_1394_DV_STREAM_SOUNDTRACK = &CLSID_KSNODETYPE_1394_DV_STREAM_SOUNDTRACK_Value; const CLSID_KSNODETYPE_EMBEDDED_UNDEFINED_Value = @import("../../zig.zig").Guid.initString("dff220e0-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_EMBEDDED_UNDEFINED = &CLSID_KSNODETYPE_EMBEDDED_UNDEFINED_Value; const CLSID_KSNODETYPE_LEVEL_CALIBRATION_NOISE_SOURCE_Value = @import("../../zig.zig").Guid.initString("dff220e1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_LEVEL_CALIBRATION_NOISE_SOURCE = &CLSID_KSNODETYPE_LEVEL_CALIBRATION_NOISE_SOURCE_Value; const CLSID_KSNODETYPE_EQUALIZATION_NOISE_Value = @import("../../zig.zig").Guid.initString("dff220e2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_EQUALIZATION_NOISE = &CLSID_KSNODETYPE_EQUALIZATION_NOISE_Value; const CLSID_KSNODETYPE_CD_PLAYER_Value = @import("../../zig.zig").Guid.initString("dff220e3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_CD_PLAYER = &CLSID_KSNODETYPE_CD_PLAYER_Value; const CLSID_KSNODETYPE_DAT_IO_DIGITAL_AUDIO_TAPE_Value = @import("../../zig.zig").Guid.initString("dff220e4-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DAT_IO_DIGITAL_AUDIO_TAPE = &CLSID_KSNODETYPE_DAT_IO_DIGITAL_AUDIO_TAPE_Value; const CLSID_KSNODETYPE_DCC_IO_DIGITAL_COMPACT_CASSETTE_Value = @import("../../zig.zig").Guid.initString("dff220e5-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DCC_IO_DIGITAL_COMPACT_CASSETTE = &CLSID_KSNODETYPE_DCC_IO_DIGITAL_COMPACT_CASSETTE_Value; const CLSID_KSNODETYPE_MINIDISK_Value = @import("../../zig.zig").Guid.initString("dff220e6-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_MINIDISK = &CLSID_KSNODETYPE_MINIDISK_Value; const CLSID_KSNODETYPE_ANALOG_TAPE_Value = @import("../../zig.zig").Guid.initString("dff220e7-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_ANALOG_TAPE = &CLSID_KSNODETYPE_ANALOG_TAPE_Value; const CLSID_KSNODETYPE_PHONOGRAPH_Value = @import("../../zig.zig").Guid.initString("dff220e8-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_PHONOGRAPH = &CLSID_KSNODETYPE_PHONOGRAPH_Value; const CLSID_KSNODETYPE_VCR_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff220e9-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VCR_AUDIO = &CLSID_KSNODETYPE_VCR_AUDIO_Value; const CLSID_KSNODETYPE_VIDEO_DISC_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff220ea-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_DISC_AUDIO = &CLSID_KSNODETYPE_VIDEO_DISC_AUDIO_Value; const CLSID_KSNODETYPE_DVD_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff220eb-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DVD_AUDIO = &CLSID_KSNODETYPE_DVD_AUDIO_Value; const CLSID_KSNODETYPE_TV_TUNER_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff220ec-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_TV_TUNER_AUDIO = &CLSID_KSNODETYPE_TV_TUNER_AUDIO_Value; const CLSID_KSNODETYPE_SATELLITE_RECEIVER_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff220ed-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_SATELLITE_RECEIVER_AUDIO = &CLSID_KSNODETYPE_SATELLITE_RECEIVER_AUDIO_Value; const CLSID_KSNODETYPE_CABLE_TUNER_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff220ee-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_CABLE_TUNER_AUDIO = &CLSID_KSNODETYPE_CABLE_TUNER_AUDIO_Value; const CLSID_KSNODETYPE_DSS_AUDIO_Value = @import("../../zig.zig").Guid.initString("dff220ef-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_DSS_AUDIO = &CLSID_KSNODETYPE_DSS_AUDIO_Value; const CLSID_KSNODETYPE_RADIO_RECEIVER_Value = @import("../../zig.zig").Guid.initString("dff220f0-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_RADIO_RECEIVER = &CLSID_KSNODETYPE_RADIO_RECEIVER_Value; const CLSID_KSNODETYPE_RADIO_TRANSMITTER_Value = @import("../../zig.zig").Guid.initString("dff220f1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_RADIO_TRANSMITTER = &CLSID_KSNODETYPE_RADIO_TRANSMITTER_Value; const CLSID_KSNODETYPE_MULTITRACK_RECORDER_Value = @import("../../zig.zig").Guid.initString("dff220f2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_MULTITRACK_RECORDER = &CLSID_KSNODETYPE_MULTITRACK_RECORDER_Value; const CLSID_KSNODETYPE_SYNTHESIZER_Value = @import("../../zig.zig").Guid.initString("dff220f3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_SYNTHESIZER = &CLSID_KSNODETYPE_SYNTHESIZER_Value; const CLSID_KSNODETYPE_HDMI_INTERFACE_Value = @import("../../zig.zig").Guid.initString("d1b9cc2a-f519-417f-91c9-55fa65481001"); pub const CLSID_KSNODETYPE_HDMI_INTERFACE = &CLSID_KSNODETYPE_HDMI_INTERFACE_Value; const CLSID_KSNODETYPE_DISPLAYPORT_INTERFACE_Value = @import("../../zig.zig").Guid.initString("e47e4031-3ea6-418d-8f9b-b73843ccba97"); pub const CLSID_KSNODETYPE_DISPLAYPORT_INTERFACE = &CLSID_KSNODETYPE_DISPLAYPORT_INTERFACE_Value; const CLSID_KSNODETYPE_AUDIO_LOOPBACK_Value = @import("../../zig.zig").Guid.initString("8f42c0b2-91ce-4bcf-9ccd-0e599037ab35"); pub const CLSID_KSNODETYPE_AUDIO_LOOPBACK = &CLSID_KSNODETYPE_AUDIO_LOOPBACK_Value; const CLSID_KSNODETYPE_AUDIO_KEYWORDDETECTOR_Value = @import("../../zig.zig").Guid.initString("3817e0b8-df58-4375-b669-c49634331f9d"); pub const CLSID_KSNODETYPE_AUDIO_KEYWORDDETECTOR = &CLSID_KSNODETYPE_AUDIO_KEYWORDDETECTOR_Value; const CLSID_KSNODETYPE_MIDI_JACK_Value = @import("../../zig.zig").Guid.initString("265e0c3f-fa39-4df3-ab04-be01b91e299a"); pub const CLSID_KSNODETYPE_MIDI_JACK = &CLSID_KSNODETYPE_MIDI_JACK_Value; const CLSID_KSNODETYPE_MIDI_ELEMENT_Value = @import("../../zig.zig").Guid.initString("01c6fe66-6e48-4c65-ac9b-52db5d656c7e"); pub const CLSID_KSNODETYPE_MIDI_ELEMENT = &CLSID_KSNODETYPE_MIDI_ELEMENT_Value; const CLSID_KSNODETYPE_AUDIO_ENGINE_Value = @import("../../zig.zig").Guid.initString("35caf6e4-f3b3-4168-bb4b-55e77a461c7e"); pub const CLSID_KSNODETYPE_AUDIO_ENGINE = &CLSID_KSNODETYPE_AUDIO_ENGINE_Value; const CLSID_KSNODETYPE_SPEAKERS_STATIC_JACK_Value = @import("../../zig.zig").Guid.initString("28e04f87-4dbe-4f8d-8589-025d209dfb4a"); pub const CLSID_KSNODETYPE_SPEAKERS_STATIC_JACK = &CLSID_KSNODETYPE_SPEAKERS_STATIC_JACK_Value; const CLSID_PINNAME_SPDIF_OUT_Value = @import("../../zig.zig").Guid.initString("3a264481-e52c-4b82-8e7a-c8e2f91dc380"); pub const CLSID_PINNAME_SPDIF_OUT = &CLSID_PINNAME_SPDIF_OUT_Value; const CLSID_PINNAME_SPDIF_IN_Value = @import("../../zig.zig").Guid.initString("15dc9025-22ad-41b3-8875-f4ceb0299e20"); pub const CLSID_PINNAME_SPDIF_IN = &CLSID_PINNAME_SPDIF_IN_Value; const CLSID_PINNAME_HDMI_OUT_Value = @import("../../zig.zig").Guid.initString("387bfc03-e7ef-4901-86e0-35b7c32b00ef"); pub const CLSID_PINNAME_HDMI_OUT = &CLSID_PINNAME_HDMI_OUT_Value; const CLSID_PINNAME_DISPLAYPORT_OUT_Value = @import("../../zig.zig").Guid.initString("21fbb329-1a4a-48da-a076-2318a3c59b26"); pub const CLSID_PINNAME_DISPLAYPORT_OUT = &CLSID_PINNAME_DISPLAYPORT_OUT_Value; const CLSID_KSNODETYPE_DRM_DESCRAMBLE_Value = @import("../../zig.zig").Guid.initString("ffbb6e3f-ccfe-4d84-90d9-421418b03a8e"); pub const CLSID_KSNODETYPE_DRM_DESCRAMBLE = &CLSID_KSNODETYPE_DRM_DESCRAMBLE_Value; const CLSID_KSNODETYPE_TELEPHONY_BIDI_Value = @import("../../zig.zig").Guid.initString("686d7cc0-d903-4258-b443-3a3d3580741c"); pub const CLSID_KSNODETYPE_TELEPHONY_BIDI = &CLSID_KSNODETYPE_TELEPHONY_BIDI_Value; const CLSID_KSNODETYPE_FM_RX_Value = @import("../../zig.zig").Guid.initString("834a733c-f485-41c0-a62b-513025014e40"); pub const CLSID_KSNODETYPE_FM_RX = &CLSID_KSNODETYPE_FM_RX_Value; const CLSID_KSCATEGORY_AUDIO_Value = @import("../../zig.zig").Guid.initString("6994ad04-93ef-11d0-a3cc-00a0c9223196"); pub const CLSID_KSCATEGORY_AUDIO = &CLSID_KSCATEGORY_AUDIO_Value; const CLSID_KSCATEGORY_VIDEO_Value = @import("../../zig.zig").Guid.initString("6994ad05-93ef-11d0-a3cc-00a0c9223196"); pub const CLSID_KSCATEGORY_VIDEO = &CLSID_KSCATEGORY_VIDEO_Value; const CLSID_KSCATEGORY_REALTIME_Value = @import("../../zig.zig").Guid.initString("eb115ffc-10c8-4964-831d-6dcb02e6f23f"); pub const CLSID_KSCATEGORY_REALTIME = &CLSID_KSCATEGORY_REALTIME_Value; const CLSID_KSCATEGORY_TEXT_Value = @import("../../zig.zig").Guid.initString("6994ad06-93ef-11d0-a3cc-00a0c9223196"); pub const CLSID_KSCATEGORY_TEXT = &CLSID_KSCATEGORY_TEXT_Value; const CLSID_KSCATEGORY_NETWORK_Value = @import("../../zig.zig").Guid.initString("67c9cc3c-69c4-11d2-8759-00a0c9223196"); pub const CLSID_KSCATEGORY_NETWORK = &CLSID_KSCATEGORY_NETWORK_Value; const CLSID_KSCATEGORY_TOPOLOGY_Value = @import("../../zig.zig").Guid.initString("dda54a40-1e4c-11d1-a050-405705c10000"); pub const CLSID_KSCATEGORY_TOPOLOGY = &CLSID_KSCATEGORY_TOPOLOGY_Value; const CLSID_KSCATEGORY_VIRTUAL_Value = @import("../../zig.zig").Guid.initString("3503eac4-1f26-11d1-8ab0-00a0c9223196"); pub const CLSID_KSCATEGORY_VIRTUAL = &CLSID_KSCATEGORY_VIRTUAL_Value; const CLSID_KSCATEGORY_ACOUSTIC_ECHO_CANCEL_Value = @import("../../zig.zig").Guid.initString("bf963d80-c559-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSCATEGORY_ACOUSTIC_ECHO_CANCEL = &CLSID_KSCATEGORY_ACOUSTIC_ECHO_CANCEL_Value; const CLSID_KSCATEGORY_WDMAUD_USE_PIN_NAME_Value = @import("../../zig.zig").Guid.initString("47a4fa20-a251-11d1-a050-0000f8004788"); pub const CLSID_KSCATEGORY_WDMAUD_USE_PIN_NAME = &CLSID_KSCATEGORY_WDMAUD_USE_PIN_NAME_Value; const CLSID_KSCATEGORY_ESCALANTE_PLATFORM_DRIVER_Value = @import("../../zig.zig").Guid.initString("74f3aea8-9768-11d1-8e07-00a0c95ec22e"); pub const CLSID_KSCATEGORY_ESCALANTE_PLATFORM_DRIVER = &CLSID_KSCATEGORY_ESCALANTE_PLATFORM_DRIVER_Value; const CLSID_KSDATAFORMAT_TYPE_VIDEO_Value = @import("../../zig.zig").Guid.initString("73646976-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_TYPE_VIDEO = &CLSID_KSDATAFORMAT_TYPE_VIDEO_Value; const CLSID_KSDATAFORMAT_TYPE_AUDIO_Value = @import("../../zig.zig").Guid.initString("73647561-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_TYPE_AUDIO = &CLSID_KSDATAFORMAT_TYPE_AUDIO_Value; const CLSID_KSDATAFORMAT_TYPE_TEXT_Value = @import("../../zig.zig").Guid.initString("73747874-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_TYPE_TEXT = &CLSID_KSDATAFORMAT_TYPE_TEXT_Value; const CLSID_KSDATAFORMAT_SUBTYPE_ANALOG_Value = @import("../../zig.zig").Guid.initString("6dba3190-67bd-11cf-a0f7-0020afd156e4"); pub const CLSID_KSDATAFORMAT_SUBTYPE_ANALOG = &CLSID_KSDATAFORMAT_SUBTYPE_ANALOG_Value; const CLSID_KSDATAFORMAT_SUBTYPE_DRM_Value = @import("../../zig.zig").Guid.initString("00000009-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_DRM = &CLSID_KSDATAFORMAT_SUBTYPE_DRM_Value; const CLSID_KSDATAFORMAT_SUBTYPE_ALAW_Value = @import("../../zig.zig").Guid.initString("00000006-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_ALAW = &CLSID_KSDATAFORMAT_SUBTYPE_ALAW_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MULAW_Value = @import("../../zig.zig").Guid.initString("00000007-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MULAW = &CLSID_KSDATAFORMAT_SUBTYPE_MULAW_Value; const CLSID_KSDATAFORMAT_SUBTYPE_ADPCM_Value = @import("../../zig.zig").Guid.initString("00000002-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_ADPCM = &CLSID_KSDATAFORMAT_SUBTYPE_ADPCM_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MPEG_Value = @import("../../zig.zig").Guid.initString("00000050-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEG = &CLSID_KSDATAFORMAT_SUBTYPE_MPEG_Value; const CLSID_KSDATAFORMAT_SPECIFIER_VC_ID_Value = @import("../../zig.zig").Guid.initString("ad98d184-aac3-11d0-a41c-00a0c9223196"); pub const CLSID_KSDATAFORMAT_SPECIFIER_VC_ID = &CLSID_KSDATAFORMAT_SPECIFIER_VC_ID_Value; const CLSID_KSDATAFORMAT_SPECIFIER_WAVEFORMATEX_Value = @import("../../zig.zig").Guid.initString("05589f81-c356-11ce-bf01-00aa0055595a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_WAVEFORMATEX = &CLSID_KSDATAFORMAT_SPECIFIER_WAVEFORMATEX_Value; const CLSID_KSDATAFORMAT_SPECIFIER_DSOUND_Value = @import("../../zig.zig").Guid.initString("518590a2-a184-11d0-8522-00c04fd9baf3"); pub const CLSID_KSDATAFORMAT_SPECIFIER_DSOUND = &CLSID_KSDATAFORMAT_SPECIFIER_DSOUND_Value; pub const KSDATAFORMAT_WAVEFORMATEX = packed struct { DataFormat: KSDATAFORMAT, WaveFormatEx: WAVEFORMATEX, }; pub const WAVEFORMATEXTENSIBLE_IEC61937 = packed struct { FormatExt: WAVEFORMATEXTENSIBLE, dwEncodedSamplesPerSec: u32, dwEncodedChannelCount: u32, dwAverageBytesPerSec: u32, }; pub const KSDATAFORMAT_WAVEFORMATEXTENSIBLE = packed struct { DataFormat: KSDATAFORMAT, WaveFormatExt: WAVEFORMATEXTENSIBLE, }; pub const KSDSOUND_BUFFERDESC = packed struct { Flags: u32, Control: u32, WaveFormatEx: WAVEFORMATEX, }; pub const KSDATAFORMAT_DSOUND = packed struct { DataFormat: KSDATAFORMAT, BufferDesc: KSDSOUND_BUFFERDESC, }; pub const KSAUDIO_POSITION = extern struct { PlayOffset: u64, WriteOffset: u64, }; pub const KSAUDIO_PRESENTATION_POSITION = extern struct { u64PositionInBlocks: u64, u64QPCPosition: u64, }; pub const CONSTRICTOR_OPTION = enum(i32) { DISABLE = 0, MUTE = 1, }; pub const CONSTRICTOR_OPTION_DISABLE = CONSTRICTOR_OPTION.DISABLE; pub const CONSTRICTOR_OPTION_MUTE = CONSTRICTOR_OPTION.MUTE; pub const _KSAUDIO_PACKETSIZE_SIGNALPROCESSINGMODE_CONSTRAINT = extern struct { ProcessingMode: Guid, SamplesPerProcessingPacket: u32, ProcessingPacketDurationInHns: u32, }; pub const KSAUDIO_PACKETSIZE_CONSTRAINTS = extern struct { MinPacketPeriodInHns: u32, PacketSizeFileAlignment: u32, Reserved: u32, NumProcessingModeConstraints: u32, ProcessingModeConstraints: [1]_KSAUDIO_PACKETSIZE_SIGNALPROCESSINGMODE_CONSTRAINT, }; pub const KSAUDIO_PACKETSIZE_CONSTRAINTS2 = extern struct { MinPacketPeriodInHns: u32, PacketSizeFileAlignment: u32, MaxPacketSizeInBytes: u32, NumProcessingModeConstraints: u32, ProcessingModeConstraints: [1]_KSAUDIO_PACKETSIZE_SIGNALPROCESSINGMODE_CONSTRAINT, }; pub const KSMICARRAY_MICTYPE = enum(i32) { OMNIDIRECTIONAL = 0, SUBCARDIOID = 1, CARDIOID = 2, SUPERCARDIOID = 3, HYPERCARDIOID = 4, @"8SHAPED" = 5, VENDORDEFINED = 15, }; pub const KSMICARRAY_MICTYPE_OMNIDIRECTIONAL = KSMICARRAY_MICTYPE.OMNIDIRECTIONAL; pub const KSMICARRAY_MICTYPE_SUBCARDIOID = KSMICARRAY_MICTYPE.SUBCARDIOID; pub const KSMICARRAY_MICTYPE_CARDIOID = KSMICARRAY_MICTYPE.CARDIOID; pub const KSMICARRAY_MICTYPE_SUPERCARDIOID = KSMICARRAY_MICTYPE.SUPERCARDIOID; pub const KSMICARRAY_MICTYPE_HYPERCARDIOID = KSMICARRAY_MICTYPE.HYPERCARDIOID; pub const KSMICARRAY_MICTYPE_8SHAPED = KSMICARRAY_MICTYPE.@"8SHAPED"; pub const KSMICARRAY_MICTYPE_VENDORDEFINED = KSMICARRAY_MICTYPE.VENDORDEFINED; pub const KSAUDIO_MICROPHONE_COORDINATES = extern struct { usType: u16, wXCoord: i16, wYCoord: i16, wZCoord: i16, wVerticalAngle: i16, wHorizontalAngle: i16, }; pub const KSMICARRAY_MICARRAYTYPE = enum(i32) { LINEAR = 0, PLANAR = 1, @"3D" = 2, }; pub const KSMICARRAY_MICARRAYTYPE_LINEAR = KSMICARRAY_MICARRAYTYPE.LINEAR; pub const KSMICARRAY_MICARRAYTYPE_PLANAR = KSMICARRAY_MICARRAYTYPE.PLANAR; pub const KSMICARRAY_MICARRAYTYPE_3D = KSMICARRAY_MICARRAYTYPE.@"3D"; pub const KSAUDIO_MIC_ARRAY_GEOMETRY = extern struct { usVersion: u16, usMicArrayType: u16, wVerticalAngleBegin: i16, wVerticalAngleEnd: i16, wHorizontalAngleBegin: i16, wHorizontalAngleEnd: i16, usFrequencyBandLo: u16, usFrequencyBandHi: u16, usNumberOfMicrophones: u16, KsMicCoord: [1]KSAUDIO_MICROPHONE_COORDINATES, }; pub const DS3DVECTOR = extern struct { Anonymous1: extern union { x: f32, dvX: f32, }, Anonymous2: extern union { y: f32, dvY: f32, }, Anonymous3: extern union { z: f32, dvZ: f32, }, }; const CLSID_KSPROPSETID_DirectSound3DListener_Value = @import("../../zig.zig").Guid.initString("437b3414-d060-11d0-8583-00c04fd9baf3"); pub const CLSID_KSPROPSETID_DirectSound3DListener = &CLSID_KSPROPSETID_DirectSound3DListener_Value; pub const KSPROPERTY_DIRECTSOUND3DLISTENER = enum(i32) { ALL = 0, POSITION = 1, VELOCITY = 2, ORIENTATION = 3, DISTANCEFACTOR = 4, ROLLOFFFACTOR = 5, DOPPLERFACTOR = 6, BATCH = 7, ALLOCATION = 8, }; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_ALL = KSPROPERTY_DIRECTSOUND3DLISTENER.ALL; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_POSITION = KSPROPERTY_DIRECTSOUND3DLISTENER.POSITION; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY = KSPROPERTY_DIRECTSOUND3DLISTENER.VELOCITY; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_ORIENTATION = KSPROPERTY_DIRECTSOUND3DLISTENER.ORIENTATION; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_DISTANCEFACTOR = KSPROPERTY_DIRECTSOUND3DLISTENER.DISTANCEFACTOR; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_ROLLOFFFACTOR = KSPROPERTY_DIRECTSOUND3DLISTENER.ROLLOFFFACTOR; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_DOPPLERFACTOR = KSPROPERTY_DIRECTSOUND3DLISTENER.DOPPLERFACTOR; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_BATCH = KSPROPERTY_DIRECTSOUND3DLISTENER.BATCH; pub const KSPROPERTY_DIRECTSOUND3DLISTENER_ALLOCATION = KSPROPERTY_DIRECTSOUND3DLISTENER.ALLOCATION; pub const KSDS3D_LISTENER_ALL = extern struct { Position: DS3DVECTOR, Velocity: DS3DVECTOR, OrientFront: DS3DVECTOR, OrientTop: DS3DVECTOR, DistanceFactor: f32, RolloffFactor: f32, DopplerFactor: f32, }; pub const KSDS3D_LISTENER_ORIENTATION = extern struct { Front: DS3DVECTOR, Top: DS3DVECTOR, }; const CLSID_KSPROPSETID_DirectSound3DBuffer_Value = @import("../../zig.zig").Guid.initString("437b3411-d060-11d0-8583-00c04fd9baf3"); pub const CLSID_KSPROPSETID_DirectSound3DBuffer = &CLSID_KSPROPSETID_DirectSound3DBuffer_Value; pub const KSPROPERTY_DIRECTSOUND3DBUFFER = enum(i32) { ALL = 0, POSITION = 1, VELOCITY = 2, CONEANGLES = 3, CONEORIENTATION = 4, CONEOUTSIDEVOLUME = 5, MINDISTANCE = 6, MAXDISTANCE = 7, MODE = 8, }; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_ALL = KSPROPERTY_DIRECTSOUND3DBUFFER.ALL; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_POSITION = KSPROPERTY_DIRECTSOUND3DBUFFER.POSITION; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_VELOCITY = KSPROPERTY_DIRECTSOUND3DBUFFER.VELOCITY; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_CONEANGLES = KSPROPERTY_DIRECTSOUND3DBUFFER.CONEANGLES; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_CONEORIENTATION = KSPROPERTY_DIRECTSOUND3DBUFFER.CONEORIENTATION; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_CONEOUTSIDEVOLUME = KSPROPERTY_DIRECTSOUND3DBUFFER.CONEOUTSIDEVOLUME; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_MINDISTANCE = KSPROPERTY_DIRECTSOUND3DBUFFER.MINDISTANCE; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_MAXDISTANCE = KSPROPERTY_DIRECTSOUND3DBUFFER.MAXDISTANCE; pub const KSPROPERTY_DIRECTSOUND3DBUFFER_MODE = KSPROPERTY_DIRECTSOUND3DBUFFER.MODE; pub const KSDS3D_BUFFER_ALL = extern struct { Position: DS3DVECTOR, Velocity: DS3DVECTOR, InsideConeAngle: u32, OutsideConeAngle: u32, ConeOrientation: DS3DVECTOR, ConeOutsideVolume: i32, MinDistance: f32, MaxDistance: f32, Mode: u32, }; pub const KSDS3D_BUFFER_CONE_ANGLES = extern struct { InsideConeAngle: u32, OutsideConeAngle: u32, }; pub const KSDS3D_HRTF_PARAMS_MSG = extern struct { Size: u32, Enabled: u32, SwapChannels: BOOL, ZeroAzimuth: BOOL, CrossFadeOutput: BOOL, FilterSize: u32, }; pub const KSDS3D_HRTF_FILTER_QUALITY = enum(i32) { FULL_FILTER = 0, LIGHT_FILTER = 1, KSDS3D_FILTER_QUALITY_COUNT = 2, }; pub const FULL_FILTER = KSDS3D_HRTF_FILTER_QUALITY.FULL_FILTER; pub const LIGHT_FILTER = KSDS3D_HRTF_FILTER_QUALITY.LIGHT_FILTER; pub const KSDS3D_FILTER_QUALITY_COUNT = KSDS3D_HRTF_FILTER_QUALITY.KSDS3D_FILTER_QUALITY_COUNT; pub const KSDS3D_HRTF_INIT_MSG = extern struct { Size: u32, Quality: KSDS3D_HRTF_FILTER_QUALITY, SampleRate: f32, MaxFilterSize: u32, FilterTransientMuteLength: u32, FilterOverlapBufferLength: u32, OutputOverlapBufferLength: u32, Reserved: u32, }; pub const KSDS3D_HRTF_COEFF_FORMAT = enum(i32) { FLOAT_COEFF = 0, SHORT_COEFF = 1, KSDS3D_COEFF_COUNT = 2, }; pub const FLOAT_COEFF = KSDS3D_HRTF_COEFF_FORMAT.FLOAT_COEFF; pub const SHORT_COEFF = KSDS3D_HRTF_COEFF_FORMAT.SHORT_COEFF; pub const KSDS3D_COEFF_COUNT = KSDS3D_HRTF_COEFF_FORMAT.KSDS3D_COEFF_COUNT; pub const KSDS3D_HRTF_FILTER_METHOD = enum(i32) { DIRECT_FORM = 0, CASCADE_FORM = 1, KSDS3D_FILTER_METHOD_COUNT = 2, }; pub const DIRECT_FORM = KSDS3D_HRTF_FILTER_METHOD.DIRECT_FORM; pub const CASCADE_FORM = KSDS3D_HRTF_FILTER_METHOD.CASCADE_FORM; pub const KSDS3D_FILTER_METHOD_COUNT = KSDS3D_HRTF_FILTER_METHOD.KSDS3D_FILTER_METHOD_COUNT; pub const KSDS3D_HRTF_FILTER_VERSION = enum(i32) { @"1" = 0, }; pub const DS3D_HRTF_VERSION_1 = KSDS3D_HRTF_FILTER_VERSION.@"1"; pub const KSDS3D_HRTF_FILTER_FORMAT_MSG = extern struct { FilterMethod: KSDS3D_HRTF_FILTER_METHOD, CoeffFormat: KSDS3D_HRTF_COEFF_FORMAT, Version: KSDS3D_HRTF_FILTER_VERSION, Reserved: u32, }; const CLSID_KSPROPSETID_Hrtf3d_Value = @import("../../zig.zig").Guid.initString("b66decb0-a083-11d0-851e-00c04fd9baf3"); pub const CLSID_KSPROPSETID_Hrtf3d = &CLSID_KSPROPSETID_Hrtf3d_Value; pub const KSPROPERTY_HRTF3D = enum(i32) { PARAMS = 0, INITIALIZE = 1, FILTER_FORMAT = 2, }; pub const KSPROPERTY_HRTF3D_PARAMS = KSPROPERTY_HRTF3D.PARAMS; pub const KSPROPERTY_HRTF3D_INITIALIZE = KSPROPERTY_HRTF3D.INITIALIZE; pub const KSPROPERTY_HRTF3D_FILTER_FORMAT = KSPROPERTY_HRTF3D.FILTER_FORMAT; pub const KSDS3D_ITD_PARAMS = extern struct { Channel: i32, VolSmoothScale: f32, TotalDryAttenuation: f32, TotalWetAttenuation: f32, SmoothFrequency: i32, Delay: i32, }; pub const KSDS3D_ITD_PARAMS_MSG = extern struct { Enabled: u32, LeftParams: KSDS3D_ITD_PARAMS, RightParams: KSDS3D_ITD_PARAMS, Reserved: u32, }; const CLSID_KSPROPSETID_Itd3d_Value = @import("../../zig.zig").Guid.initString("6429f090-9fd9-11d0-a75b-00a0c90365e3"); pub const CLSID_KSPROPSETID_Itd3d = &CLSID_KSPROPSETID_Itd3d_Value; pub const KSPROPERTY_ITD3D = enum(i32) { S = 0, }; pub const KSPROPERTY_ITD3D_PARAMS = KSPROPERTY_ITD3D.S; pub const KSDATARANGE_AUDIO = extern struct { DataRange: KSDATAFORMAT, MaximumChannels: u32, MinimumBitsPerSample: u32, MaximumBitsPerSample: u32, MinimumSampleFrequency: u32, MaximumSampleFrequency: u32, }; const CLSID_KSDATAFORMAT_SUBTYPE_RIFF_Value = @import("../../zig.zig").Guid.initString("4995daee-9ee6-11d0-a40e-00a0c9223196"); pub const CLSID_KSDATAFORMAT_SUBTYPE_RIFF = &CLSID_KSDATAFORMAT_SUBTYPE_RIFF_Value; const CLSID_KSDATAFORMAT_SUBTYPE_RIFFWAVE_Value = @import("../../zig.zig").Guid.initString("e436eb8b-524f-11ce-9f53-0020af0ba770"); pub const CLSID_KSDATAFORMAT_SUBTYPE_RIFFWAVE = &CLSID_KSDATAFORMAT_SUBTYPE_RIFFWAVE_Value; const CLSID_KSPROPSETID_Bibliographic_Value = @import("../../zig.zig").Guid.initString("07ba150e-e2b1-11d0-ac17-00a0c9223196"); pub const CLSID_KSPROPSETID_Bibliographic = &CLSID_KSPROPSETID_Bibliographic_Value; pub const KSPROPERTY_BIBLIOGRAPHIC = enum(i32) { LEADER = 1380207648, LCCN = 808529952, ISBN = 808595488, ISSN = 842149920, CATALOGINGSOURCE = 808726560, MAINPERSONALNAME = 808464672, MAINCORPORATEBODY = 808530208, MAINMEETINGNAME = 825307424, MAINUNIFORMTITLE = 808661280, UNIFORMTITLE = 808727072, TITLESTATEMENT = 892613152, VARYINGFORMTITLE = 909390368, PUBLICATION = 808858144, PHYSICALDESCRIPTION = 808465184, ADDEDENTRYTITLE = 808727584, SERIESSTATEMENT = 809055264, GENERALNOTE = 808465696, BIBLIOGRAPHYNOTE = 875574560, CONTENTSNOTE = 892351776, CREATIONCREDIT = 942683424, CITATION = 808531232, PARTICIPANT = 825308448, SUMMARY = 808596768, TARGETAUDIENCE = 825373984, ADDEDFORMAVAILABLE = 808662304, SYSTEMDETAILS = 942880032, AWARDS = 909653280, ADDEDENTRYPERSONALNAME = 808465952, ADDEDENTRYTOPICALTERM = 808793632, ADDEDENTRYGEOGRAPHIC = 825570848, INDEXTERMGENRE = 892679712, INDEXTERMCURRICULUM = 943011360, ADDEDENTRYUNIFORMTITLE = 808662816, ADDEDENTRYRELATED = 808728352, SERIESSTATEMENTPERSONALNAME = 808466464, SERIESSTATEMENTUNIFORMTITLE = 808663072, }; pub const KSPROPERTY_BIBLIOGRAPHIC_LEADER = KSPROPERTY_BIBLIOGRAPHIC.LEADER; pub const KSPROPERTY_BIBLIOGRAPHIC_LCCN = KSPROPERTY_BIBLIOGRAPHIC.LCCN; pub const KSPROPERTY_BIBLIOGRAPHIC_ISBN = KSPROPERTY_BIBLIOGRAPHIC.ISBN; pub const KSPROPERTY_BIBLIOGRAPHIC_ISSN = KSPROPERTY_BIBLIOGRAPHIC.ISSN; pub const KSPROPERTY_BIBLIOGRAPHIC_CATALOGINGSOURCE = KSPROPERTY_BIBLIOGRAPHIC.CATALOGINGSOURCE; pub const KSPROPERTY_BIBLIOGRAPHIC_MAINPERSONALNAME = KSPROPERTY_BIBLIOGRAPHIC.MAINPERSONALNAME; pub const KSPROPERTY_BIBLIOGRAPHIC_MAINCORPORATEBODY = KSPROPERTY_BIBLIOGRAPHIC.MAINCORPORATEBODY; pub const KSPROPERTY_BIBLIOGRAPHIC_MAINMEETINGNAME = KSPROPERTY_BIBLIOGRAPHIC.MAINMEETINGNAME; pub const KSPROPERTY_BIBLIOGRAPHIC_MAINUNIFORMTITLE = KSPROPERTY_BIBLIOGRAPHIC.MAINUNIFORMTITLE; pub const KSPROPERTY_BIBLIOGRAPHIC_UNIFORMTITLE = KSPROPERTY_BIBLIOGRAPHIC.UNIFORMTITLE; pub const KSPROPERTY_BIBLIOGRAPHIC_TITLESTATEMENT = KSPROPERTY_BIBLIOGRAPHIC.TITLESTATEMENT; pub const KSPROPERTY_BIBLIOGRAPHIC_VARYINGFORMTITLE = KSPROPERTY_BIBLIOGRAPHIC.VARYINGFORMTITLE; pub const KSPROPERTY_BIBLIOGRAPHIC_PUBLICATION = KSPROPERTY_BIBLIOGRAPHIC.PUBLICATION; pub const KSPROPERTY_BIBLIOGRAPHIC_PHYSICALDESCRIPTION = KSPROPERTY_BIBLIOGRAPHIC.PHYSICALDESCRIPTION; pub const KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYTITLE = KSPROPERTY_BIBLIOGRAPHIC.ADDEDENTRYTITLE; pub const KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENT = KSPROPERTY_BIBLIOGRAPHIC.SERIESSTATEMENT; pub const KSPROPERTY_BIBLIOGRAPHIC_GENERALNOTE = KSPROPERTY_BIBLIOGRAPHIC.GENERALNOTE; pub const KSPROPERTY_BIBLIOGRAPHIC_BIBLIOGRAPHYNOTE = KSPROPERTY_BIBLIOGRAPHIC.BIBLIOGRAPHYNOTE; pub const KSPROPERTY_BIBLIOGRAPHIC_CONTENTSNOTE = KSPROPERTY_BIBLIOGRAPHIC.CONTENTSNOTE; pub const KSPROPERTY_BIBLIOGRAPHIC_CREATIONCREDIT = KSPROPERTY_BIBLIOGRAPHIC.CREATIONCREDIT; pub const KSPROPERTY_BIBLIOGRAPHIC_CITATION = KSPROPERTY_BIBLIOGRAPHIC.CITATION; pub const KSPROPERTY_BIBLIOGRAPHIC_PARTICIPANT = KSPROPERTY_BIBLIOGRAPHIC.PARTICIPANT; pub const KSPROPERTY_BIBLIOGRAPHIC_SUMMARY = KSPROPERTY_BIBLIOGRAPHIC.SUMMARY; pub const KSPROPERTY_BIBLIOGRAPHIC_TARGETAUDIENCE = KSPROPERTY_BIBLIOGRAPHIC.TARGETAUDIENCE; pub const KSPROPERTY_BIBLIOGRAPHIC_ADDEDFORMAVAILABLE = KSPROPERTY_BIBLIOGRAPHIC.ADDEDFORMAVAILABLE; pub const KSPROPERTY_BIBLIOGRAPHIC_SYSTEMDETAILS = KSPROPERTY_BIBLIOGRAPHIC.SYSTEMDETAILS; pub const KSPROPERTY_BIBLIOGRAPHIC_AWARDS = KSPROPERTY_BIBLIOGRAPHIC.AWARDS; pub const KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYPERSONALNAME = KSPROPERTY_BIBLIOGRAPHIC.ADDEDENTRYPERSONALNAME; pub const KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYTOPICALTERM = KSPROPERTY_BIBLIOGRAPHIC.ADDEDENTRYTOPICALTERM; pub const KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYGEOGRAPHIC = KSPROPERTY_BIBLIOGRAPHIC.ADDEDENTRYGEOGRAPHIC; pub const KSPROPERTY_BIBLIOGRAPHIC_INDEXTERMGENRE = KSPROPERTY_BIBLIOGRAPHIC.INDEXTERMGENRE; pub const KSPROPERTY_BIBLIOGRAPHIC_INDEXTERMCURRICULUM = KSPROPERTY_BIBLIOGRAPHIC.INDEXTERMCURRICULUM; pub const KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYUNIFORMTITLE = KSPROPERTY_BIBLIOGRAPHIC.ADDEDENTRYUNIFORMTITLE; pub const KSPROPERTY_BIBLIOGRAPHIC_ADDEDENTRYRELATED = KSPROPERTY_BIBLIOGRAPHIC.ADDEDENTRYRELATED; pub const KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENTPERSONALNAME = KSPROPERTY_BIBLIOGRAPHIC.SERIESSTATEMENTPERSONALNAME; pub const KSPROPERTY_BIBLIOGRAPHIC_SERIESSTATEMENTUNIFORMTITLE = KSPROPERTY_BIBLIOGRAPHIC.SERIESSTATEMENTUNIFORMTITLE; const CLSID_KSPROPSETID_TopologyNode_Value = @import("../../zig.zig").Guid.initString("45ffaaa1-6e1b-11d0-bcf2-444553540000"); pub const CLSID_KSPROPSETID_TopologyNode = &CLSID_KSPROPSETID_TopologyNode_Value; pub const KSPROPERTY_TOPOLOGYNODE = enum(i32) { ENABLE = 1, RESET = 2, }; pub const KSPROPERTY_TOPOLOGYNODE_ENABLE = KSPROPERTY_TOPOLOGYNODE.ENABLE; pub const KSPROPERTY_TOPOLOGYNODE_RESET = KSPROPERTY_TOPOLOGYNODE.RESET; const CLSID_KSPROPSETID_RtAudio_Value = @import("../../zig.zig").Guid.initString("a855a48c-2f78-4729-9051-1968746b9eef"); pub const CLSID_KSPROPSETID_RtAudio = &CLSID_KSPROPSETID_RtAudio_Value; pub const KSPROPERTY_RTAUDIO = enum(i32) { GETPOSITIONFUNCTION = 0, BUFFER = 1, HWLATENCY = 2, POSITIONREGISTER = 3, CLOCKREGISTER = 4, BUFFER_WITH_NOTIFICATION = 5, REGISTER_NOTIFICATION_EVENT = 6, UNREGISTER_NOTIFICATION_EVENT = 7, QUERY_NOTIFICATION_SUPPORT = 8, PACKETCOUNT = 9, PRESENTATION_POSITION = 10, GETREADPACKET = 11, SETWRITEPACKET = 12, PACKETVREGISTER = 13, }; pub const KSPROPERTY_RTAUDIO_GETPOSITIONFUNCTION = KSPROPERTY_RTAUDIO.GETPOSITIONFUNCTION; pub const KSPROPERTY_RTAUDIO_BUFFER = KSPROPERTY_RTAUDIO.BUFFER; pub const KSPROPERTY_RTAUDIO_HWLATENCY = KSPROPERTY_RTAUDIO.HWLATENCY; pub const KSPROPERTY_RTAUDIO_POSITIONREGISTER = KSPROPERTY_RTAUDIO.POSITIONREGISTER; pub const KSPROPERTY_RTAUDIO_CLOCKREGISTER = KSPROPERTY_RTAUDIO.CLOCKREGISTER; pub const KSPROPERTY_RTAUDIO_BUFFER_WITH_NOTIFICATION = KSPROPERTY_RTAUDIO.BUFFER_WITH_NOTIFICATION; pub const KSPROPERTY_RTAUDIO_REGISTER_NOTIFICATION_EVENT = KSPROPERTY_RTAUDIO.REGISTER_NOTIFICATION_EVENT; pub const KSPROPERTY_RTAUDIO_UNREGISTER_NOTIFICATION_EVENT = KSPROPERTY_RTAUDIO.UNREGISTER_NOTIFICATION_EVENT; pub const KSPROPERTY_RTAUDIO_QUERY_NOTIFICATION_SUPPORT = KSPROPERTY_RTAUDIO.QUERY_NOTIFICATION_SUPPORT; pub const KSPROPERTY_RTAUDIO_PACKETCOUNT = KSPROPERTY_RTAUDIO.PACKETCOUNT; pub const KSPROPERTY_RTAUDIO_PRESENTATION_POSITION = KSPROPERTY_RTAUDIO.PRESENTATION_POSITION; pub const KSPROPERTY_RTAUDIO_GETREADPACKET = KSPROPERTY_RTAUDIO.GETREADPACKET; pub const KSPROPERTY_RTAUDIO_SETWRITEPACKET = KSPROPERTY_RTAUDIO.SETWRITEPACKET; pub const KSPROPERTY_RTAUDIO_PACKETVREGISTER = KSPROPERTY_RTAUDIO.PACKETVREGISTER; pub const KSRTAUDIO_BUFFER_PROPERTY = extern struct { Property: KSIDENTIFIER, BaseAddress: ?*c_void, RequestedBufferSize: u32, }; pub const KSRTAUDIO_BUFFER_PROPERTY32 = extern struct { Property: KSIDENTIFIER, BaseAddress: u32, RequestedBufferSize: u32, }; pub const KSRTAUDIO_BUFFER_PROPERTY_WITH_NOTIFICATION = extern struct { Property: KSIDENTIFIER, BaseAddress: ?*c_void, RequestedBufferSize: u32, NotificationCount: u32, }; pub const KSRTAUDIO_BUFFER_PROPERTY_WITH_NOTIFICATION32 = extern struct { Property: KSIDENTIFIER, BaseAddress: u32, RequestedBufferSize: u32, NotificationCount: u32, }; pub const KSRTAUDIO_BUFFER = extern struct { BufferAddress: ?*c_void, ActualBufferSize: u32, CallMemoryBarrier: BOOL, }; pub const KSRTAUDIO_BUFFER32 = extern struct { BufferAddress: u32, ActualBufferSize: u32, CallMemoryBarrier: BOOL, }; pub const KSRTAUDIO_HWLATENCY = extern struct { FifoSize: u32, ChipsetDelay: u32, CodecDelay: u32, }; pub const KSRTAUDIO_HWREGISTER_PROPERTY = extern struct { Property: KSIDENTIFIER, BaseAddress: ?*c_void, }; pub const KSRTAUDIO_HWREGISTER_PROPERTY32 = extern struct { Property: KSIDENTIFIER, BaseAddress: u32, }; pub const KSRTAUDIO_HWREGISTER = extern struct { Register: ?*c_void, Width: u32, Numerator: u64, Denominator: u64, Accuracy: u32, }; pub const KSRTAUDIO_HWREGISTER32 = extern struct { Register: u32, Width: u32, Numerator: u64, Denominator: u64, Accuracy: u32, }; pub const KSRTAUDIO_NOTIFICATION_EVENT_PROPERTY = extern struct { Property: KSIDENTIFIER, NotificationEvent: ?HANDLE, }; pub const KSRTAUDIO_NOTIFICATION_EVENT_PROPERTY32 = extern struct { Property: KSIDENTIFIER, NotificationEvent: u32, }; pub const KSRTAUDIO_GETREADPACKET_INFO = extern struct { PacketNumber: u32, Flags: u32, PerformanceCounterValue: u64, MoreData: BOOL, }; pub const KSRTAUDIO_SETWRITEPACKET_INFO = extern struct { PacketNumber: u32, Flags: u32, EosPacketLength: u32, }; pub const KSRTAUDIO_PACKETVREGISTER_PROPERTY = extern struct { Property: KSIDENTIFIER, BaseAddress: ?*c_void, }; pub const KSRTAUDIO_PACKETVREGISTER = extern struct { CompletedPacketCount: ?*u64, CompletedPacketQPC: ?*u64, CompletedPacketHash: ?*u64, }; const CLSID_KSPROPSETID_BtAudio_Value = @import("../../zig.zig").Guid.initString("7fa06c40-b8f6-4c7e-8556-e8c33a12e54d"); pub const CLSID_KSPROPSETID_BtAudio = &CLSID_KSPROPSETID_BtAudio_Value; pub const KSPROPERTY_BTAUDIO = enum(i32) { RECONNECT = 0, DISCONNECT = 1, }; pub const KSPROPERTY_ONESHOT_RECONNECT = KSPROPERTY_BTAUDIO.RECONNECT; pub const KSPROPERTY_ONESHOT_DISCONNECT = KSPROPERTY_BTAUDIO.DISCONNECT; const CLSID_KSPROPSETID_DrmAudioStream_Value = @import("../../zig.zig").Guid.initString("2f2c8ddd-4198-4fac-ba29-61bb05b7de06"); pub const CLSID_KSPROPSETID_DrmAudioStream = &CLSID_KSPROPSETID_DrmAudioStream_Value; pub const KSPROPERTY_DRMAUDIOSTREAM = enum(i32) { D = 0, }; pub const KSPROPERTY_DRMAUDIOSTREAM_CONTENTID = KSPROPERTY_DRMAUDIOSTREAM.D; const CLSID_KSPROPSETID_SoundDetector_Value = @import("../../zig.zig").Guid.initString("113c425e-fd17-4057-b422-ed4074f1afdf"); pub const CLSID_KSPROPSETID_SoundDetector = &CLSID_KSPROPSETID_SoundDetector_Value; const CLSID_KSPROPSETID_SoundDetector2_Value = @import("../../zig.zig").Guid.initString("fe07e322-450c-4bd5-84ca-a948500ea6aa"); pub const CLSID_KSPROPSETID_SoundDetector2 = &CLSID_KSPROPSETID_SoundDetector2_Value; const CLSID_KSPROPSETID_InterleavedAudio_Value = @import("../../zig.zig").Guid.initString("e9ebe550-d619-4c0a-976b-7062322b3006"); pub const CLSID_KSPROPSETID_InterleavedAudio = &CLSID_KSPROPSETID_InterleavedAudio_Value; pub const KSPROPERTY_INTERLEAVEDAUDIO = enum(i32) { N = 1, }; pub const KSPROPERTY_INTERLEAVEDAUDIO_FORMATINFORMATION = KSPROPERTY_INTERLEAVEDAUDIO.N; pub const INTERLEAVED_AUDIO_FORMAT_INFORMATION = extern struct { Size: u32, PrimaryChannelCount: u32, PrimaryChannelStartPosition: u32, PrimaryChannelMask: u32, InterleavedChannelCount: u32, InterleavedChannelStartPosition: u32, InterleavedChannelMask: u32, }; pub const KSSOUNDDETECTORPROPERTY = extern struct { Property: KSIDENTIFIER, EventId: Guid, }; pub const KSPROPERTY_SOUNDDETECTOR = enum(i32) { SUPPORTEDPATTERNS = 1, PATTERNS = 2, ARMED = 3, MATCHRESULT = 4, RESET = 5, STREAMINGSUPPORT = 6, }; pub const KSPROPERTY_SOUNDDETECTOR_SUPPORTEDPATTERNS = KSPROPERTY_SOUNDDETECTOR.SUPPORTEDPATTERNS; pub const KSPROPERTY_SOUNDDETECTOR_PATTERNS = KSPROPERTY_SOUNDDETECTOR.PATTERNS; pub const KSPROPERTY_SOUNDDETECTOR_ARMED = KSPROPERTY_SOUNDDETECTOR.ARMED; pub const KSPROPERTY_SOUNDDETECTOR_MATCHRESULT = KSPROPERTY_SOUNDDETECTOR.MATCHRESULT; pub const KSPROPERTY_SOUNDDETECTOR_RESET = KSPROPERTY_SOUNDDETECTOR.RESET; pub const KSPROPERTY_SOUNDDETECTOR_STREAMINGSUPPORT = KSPROPERTY_SOUNDDETECTOR.STREAMINGSUPPORT; pub const SOUNDDETECTOR_PATTERNHEADER = extern struct { Size: u32, PatternType: Guid, }; const CLSID_KSEVENTSETID_SoundDetector_Value = @import("../../zig.zig").Guid.initString("69785c9b-fc2d-49d6-ac32-4799f87de9f6"); pub const CLSID_KSEVENTSETID_SoundDetector = &CLSID_KSEVENTSETID_SoundDetector_Value; pub const KSEVENT_SOUNDDETECTOR = enum(i32) { D = 1, }; pub const KSEVENT_SOUNDDETECTOR_MATCHDETECTED = KSEVENT_SOUNDDETECTOR.D; const CLSID_KSNOTIFICATIONID_SoundDetector_Value = @import("../../zig.zig").Guid.initString("6389d844-bb32-4c4c-a802-f4b4b77afead"); pub const CLSID_KSNOTIFICATIONID_SoundDetector = &CLSID_KSNOTIFICATIONID_SoundDetector_Value; const CLSID_KSPROPSETID_Audio_Value = @import("../../zig.zig").Guid.initString("45ffaaa0-6e1b-11d0-bcf2-444553540000"); pub const CLSID_KSPROPSETID_Audio = &CLSID_KSPROPSETID_Audio_Value; pub const KSPROPERTY_AUDIO = enum(i32) { LATENCY = 1, COPY_PROTECTION = 2, CHANNEL_CONFIG = 3, VOLUMELEVEL = 4, POSITION = 5, DYNAMIC_RANGE = 6, QUALITY = 7, SAMPLING_RATE = 8, DYNAMIC_SAMPLING_RATE = 9, MIX_LEVEL_TABLE = 10, MIX_LEVEL_CAPS = 11, MUX_SOURCE = 12, MUTE = 13, BASS = 14, MID = 15, TREBLE = 16, BASS_BOOST = 17, EQ_LEVEL = 18, NUM_EQ_BANDS = 19, EQ_BANDS = 20, AGC = 21, DELAY = 22, LOUDNESS = 23, WIDE_MODE = 24, WIDENESS = 25, REVERB_LEVEL = 26, CHORUS_LEVEL = 27, DEV_SPECIFIC = 28, DEMUX_DEST = 29, STEREO_ENHANCE = 30, MANUFACTURE_GUID = 31, PRODUCT_GUID = 32, CPU_RESOURCES = 33, STEREO_SPEAKER_GEOMETRY = 34, SURROUND_ENCODE = 35, @"3D_INTERFACE" = 36, PEAKMETER = 37, ALGORITHM_INSTANCE = 38, FILTER_STATE = 39, PREFERRED_STATUS = 40, PEQ_MAX_BANDS = 41, PEQ_NUM_BANDS = 42, PEQ_BAND_CENTER_FREQ = 43, PEQ_BAND_Q_FACTOR = 44, PEQ_BAND_LEVEL = 45, CHORUS_MODULATION_RATE = 46, CHORUS_MODULATION_DEPTH = 47, REVERB_TIME = 48, REVERB_DELAY_FEEDBACK = 49, POSITIONEX = 50, MIC_ARRAY_GEOMETRY = 51, PRESENTATION_POSITION = 52, WAVERT_CURRENT_WRITE_POSITION = 53, LINEAR_BUFFER_POSITION = 54, PEAKMETER2 = 55, WAVERT_CURRENT_WRITE_LASTBUFFER_POSITION = 56, VOLUMELIMIT_ENGAGED = 57, MIC_SENSITIVITY = 58, MIC_SNR = 59, MIC_SENSITIVITY2 = 60, }; pub const KSPROPERTY_AUDIO_LATENCY = KSPROPERTY_AUDIO.LATENCY; pub const KSPROPERTY_AUDIO_COPY_PROTECTION = KSPROPERTY_AUDIO.COPY_PROTECTION; pub const KSPROPERTY_AUDIO_CHANNEL_CONFIG = KSPROPERTY_AUDIO.CHANNEL_CONFIG; pub const KSPROPERTY_AUDIO_VOLUMELEVEL = KSPROPERTY_AUDIO.VOLUMELEVEL; pub const KSPROPERTY_AUDIO_POSITION = KSPROPERTY_AUDIO.POSITION; pub const KSPROPERTY_AUDIO_DYNAMIC_RANGE = KSPROPERTY_AUDIO.DYNAMIC_RANGE; pub const KSPROPERTY_AUDIO_QUALITY = KSPROPERTY_AUDIO.QUALITY; pub const KSPROPERTY_AUDIO_SAMPLING_RATE = KSPROPERTY_AUDIO.SAMPLING_RATE; pub const KSPROPERTY_AUDIO_DYNAMIC_SAMPLING_RATE = KSPROPERTY_AUDIO.DYNAMIC_SAMPLING_RATE; pub const KSPROPERTY_AUDIO_MIX_LEVEL_TABLE = KSPROPERTY_AUDIO.MIX_LEVEL_TABLE; pub const KSPROPERTY_AUDIO_MIX_LEVEL_CAPS = KSPROPERTY_AUDIO.MIX_LEVEL_CAPS; pub const KSPROPERTY_AUDIO_MUX_SOURCE = KSPROPERTY_AUDIO.MUX_SOURCE; pub const KSPROPERTY_AUDIO_MUTE = KSPROPERTY_AUDIO.MUTE; pub const KSPROPERTY_AUDIO_BASS = KSPROPERTY_AUDIO.BASS; pub const KSPROPERTY_AUDIO_MID = KSPROPERTY_AUDIO.MID; pub const KSPROPERTY_AUDIO_TREBLE = KSPROPERTY_AUDIO.TREBLE; pub const KSPROPERTY_AUDIO_BASS_BOOST = KSPROPERTY_AUDIO.BASS_BOOST; pub const KSPROPERTY_AUDIO_EQ_LEVEL = KSPROPERTY_AUDIO.EQ_LEVEL; pub const KSPROPERTY_AUDIO_NUM_EQ_BANDS = KSPROPERTY_AUDIO.NUM_EQ_BANDS; pub const KSPROPERTY_AUDIO_EQ_BANDS = KSPROPERTY_AUDIO.EQ_BANDS; pub const KSPROPERTY_AUDIO_AGC = KSPROPERTY_AUDIO.AGC; pub const KSPROPERTY_AUDIO_DELAY = KSPROPERTY_AUDIO.DELAY; pub const KSPROPERTY_AUDIO_LOUDNESS = KSPROPERTY_AUDIO.LOUDNESS; pub const KSPROPERTY_AUDIO_WIDE_MODE = KSPROPERTY_AUDIO.WIDE_MODE; pub const KSPROPERTY_AUDIO_WIDENESS = KSPROPERTY_AUDIO.WIDENESS; pub const KSPROPERTY_AUDIO_REVERB_LEVEL = KSPROPERTY_AUDIO.REVERB_LEVEL; pub const KSPROPERTY_AUDIO_CHORUS_LEVEL = KSPROPERTY_AUDIO.CHORUS_LEVEL; pub const KSPROPERTY_AUDIO_DEV_SPECIFIC = KSPROPERTY_AUDIO.DEV_SPECIFIC; pub const KSPROPERTY_AUDIO_DEMUX_DEST = KSPROPERTY_AUDIO.DEMUX_DEST; pub const KSPROPERTY_AUDIO_STEREO_ENHANCE = KSPROPERTY_AUDIO.STEREO_ENHANCE; pub const KSPROPERTY_AUDIO_MANUFACTURE_GUID = KSPROPERTY_AUDIO.MANUFACTURE_GUID; pub const KSPROPERTY_AUDIO_PRODUCT_GUID = KSPROPERTY_AUDIO.PRODUCT_GUID; pub const KSPROPERTY_AUDIO_CPU_RESOURCES = KSPROPERTY_AUDIO.CPU_RESOURCES; pub const KSPROPERTY_AUDIO_STEREO_SPEAKER_GEOMETRY = KSPROPERTY_AUDIO.STEREO_SPEAKER_GEOMETRY; pub const KSPROPERTY_AUDIO_SURROUND_ENCODE = KSPROPERTY_AUDIO.SURROUND_ENCODE; pub const KSPROPERTY_AUDIO_3D_INTERFACE = KSPROPERTY_AUDIO.@"3D_INTERFACE"; pub const KSPROPERTY_AUDIO_PEAKMETER = KSPROPERTY_AUDIO.PEAKMETER; pub const KSPROPERTY_AUDIO_ALGORITHM_INSTANCE = KSPROPERTY_AUDIO.ALGORITHM_INSTANCE; pub const KSPROPERTY_AUDIO_FILTER_STATE = KSPROPERTY_AUDIO.FILTER_STATE; pub const KSPROPERTY_AUDIO_PREFERRED_STATUS = KSPROPERTY_AUDIO.PREFERRED_STATUS; pub const KSPROPERTY_AUDIO_PEQ_MAX_BANDS = KSPROPERTY_AUDIO.PEQ_MAX_BANDS; pub const KSPROPERTY_AUDIO_PEQ_NUM_BANDS = KSPROPERTY_AUDIO.PEQ_NUM_BANDS; pub const KSPROPERTY_AUDIO_PEQ_BAND_CENTER_FREQ = KSPROPERTY_AUDIO.PEQ_BAND_CENTER_FREQ; pub const KSPROPERTY_AUDIO_PEQ_BAND_Q_FACTOR = KSPROPERTY_AUDIO.PEQ_BAND_Q_FACTOR; pub const KSPROPERTY_AUDIO_PEQ_BAND_LEVEL = KSPROPERTY_AUDIO.PEQ_BAND_LEVEL; pub const KSPROPERTY_AUDIO_CHORUS_MODULATION_RATE = KSPROPERTY_AUDIO.CHORUS_MODULATION_RATE; pub const KSPROPERTY_AUDIO_CHORUS_MODULATION_DEPTH = KSPROPERTY_AUDIO.CHORUS_MODULATION_DEPTH; pub const KSPROPERTY_AUDIO_REVERB_TIME = KSPROPERTY_AUDIO.REVERB_TIME; pub const KSPROPERTY_AUDIO_REVERB_DELAY_FEEDBACK = KSPROPERTY_AUDIO.REVERB_DELAY_FEEDBACK; pub const KSPROPERTY_AUDIO_POSITIONEX = KSPROPERTY_AUDIO.POSITIONEX; pub const KSPROPERTY_AUDIO_MIC_ARRAY_GEOMETRY = KSPROPERTY_AUDIO.MIC_ARRAY_GEOMETRY; pub const KSPROPERTY_AUDIO_PRESENTATION_POSITION = KSPROPERTY_AUDIO.PRESENTATION_POSITION; pub const KSPROPERTY_AUDIO_WAVERT_CURRENT_WRITE_POSITION = KSPROPERTY_AUDIO.WAVERT_CURRENT_WRITE_POSITION; pub const KSPROPERTY_AUDIO_LINEAR_BUFFER_POSITION = KSPROPERTY_AUDIO.LINEAR_BUFFER_POSITION; pub const KSPROPERTY_AUDIO_PEAKMETER2 = KSPROPERTY_AUDIO.PEAKMETER2; pub const KSPROPERTY_AUDIO_WAVERT_CURRENT_WRITE_LASTBUFFER_POSITION = KSPROPERTY_AUDIO.WAVERT_CURRENT_WRITE_LASTBUFFER_POSITION; pub const KSPROPERTY_AUDIO_VOLUMELIMIT_ENGAGED = KSPROPERTY_AUDIO.VOLUMELIMIT_ENGAGED; pub const KSPROPERTY_AUDIO_MIC_SENSITIVITY = KSPROPERTY_AUDIO.MIC_SENSITIVITY; pub const KSPROPERTY_AUDIO_MIC_SNR = KSPROPERTY_AUDIO.MIC_SNR; pub const KSPROPERTY_AUDIO_MIC_SENSITIVITY2 = KSPROPERTY_AUDIO.MIC_SENSITIVITY2; pub const KSAUDIO_COPY_PROTECTION = extern struct { fCopyrighted: BOOL, fOriginal: BOOL, }; pub const KSAUDIO_CHANNEL_CONFIG = extern struct { ActiveSpeakerPositions: i32, }; pub const KSAUDIO_DYNAMIC_RANGE = extern struct { QuietCompression: u32, LoudCompression: u32, }; pub const KSAUDIO_MIXLEVEL = extern struct { Mute: BOOL, Level: i32, }; pub const KSAUDIO_MIX_CAPS = extern struct { Mute: BOOL, Minimum: i32, Maximum: i32, Anonymous: extern union { Reset: i32, Resolution: i32, }, }; pub const KSAUDIO_MIXCAP_TABLE = extern struct { InputChannels: u32, OutputChannels: u32, Capabilities: [1]KSAUDIO_MIX_CAPS, }; pub const KSAUDIO_POSITIONEX = extern struct { TimerFrequency: LARGE_INTEGER, TimeStamp1: LARGE_INTEGER, Position: KSAUDIO_POSITION, TimeStamp2: LARGE_INTEGER, }; const CLSID_KSPROPSETID_TelephonyControl_Value = @import("../../zig.zig").Guid.initString("b6df7eb1-d099-489f-a6a0-c0106f0887a7"); pub const CLSID_KSPROPSETID_TelephonyControl = &CLSID_KSPROPSETID_TelephonyControl_Value; pub const KSPROPERTY_TELEPHONY_CONTROL = enum(i32) { PROVIDERID = 0, CALLINFO = 1, CALLCONTROL = 2, PROVIDERCHANGE = 3, CALLHOLD = 4, MUTE_TX = 5, }; pub const KSPROPERTY_TELEPHONY_PROVIDERID = KSPROPERTY_TELEPHONY_CONTROL.PROVIDERID; pub const KSPROPERTY_TELEPHONY_CALLINFO = KSPROPERTY_TELEPHONY_CONTROL.CALLINFO; pub const KSPROPERTY_TELEPHONY_CALLCONTROL = KSPROPERTY_TELEPHONY_CONTROL.CALLCONTROL; pub const KSPROPERTY_TELEPHONY_PROVIDERCHANGE = KSPROPERTY_TELEPHONY_CONTROL.PROVIDERCHANGE; pub const KSPROPERTY_TELEPHONY_CALLHOLD = KSPROPERTY_TELEPHONY_CONTROL.CALLHOLD; pub const KSPROPERTY_TELEPHONY_MUTE_TX = KSPROPERTY_TELEPHONY_CONTROL.MUTE_TX; pub const TELEPHONY_CALLTYPE = enum(i32) { CIRCUITSWITCHED = 0, PACKETSWITCHED_LTE = 1, PACKETSWITCHED_WLAN = 2, }; pub const TELEPHONY_CALLTYPE_CIRCUITSWITCHED = TELEPHONY_CALLTYPE.CIRCUITSWITCHED; pub const TELEPHONY_CALLTYPE_PACKETSWITCHED_LTE = TELEPHONY_CALLTYPE.PACKETSWITCHED_LTE; pub const TELEPHONY_CALLTYPE_PACKETSWITCHED_WLAN = TELEPHONY_CALLTYPE.PACKETSWITCHED_WLAN; pub const TELEPHONY_CALLCONTROLOP = enum(i32) { DISABLE = 0, ENABLE = 1, }; pub const TELEPHONY_CALLCONTROLOP_DISABLE = TELEPHONY_CALLCONTROLOP.DISABLE; pub const TELEPHONY_CALLCONTROLOP_ENABLE = TELEPHONY_CALLCONTROLOP.ENABLE; pub const KSTELEPHONY_CALLCONTROL = extern struct { CallType: TELEPHONY_CALLTYPE, CallControlOp: TELEPHONY_CALLCONTROLOP, }; pub const TELEPHONY_PROVIDERCHANGEOP = enum(i32) { END = 0, BEGIN = 1, CANCEL = 2, }; pub const TELEPHONY_PROVIDERCHANGEOP_END = TELEPHONY_PROVIDERCHANGEOP.END; pub const TELEPHONY_PROVIDERCHANGEOP_BEGIN = TELEPHONY_PROVIDERCHANGEOP.BEGIN; pub const TELEPHONY_PROVIDERCHANGEOP_CANCEL = TELEPHONY_PROVIDERCHANGEOP.CANCEL; pub const KSTELEPHONY_PROVIDERCHANGE = extern struct { CallType: TELEPHONY_CALLTYPE, ProviderChangeOp: TELEPHONY_PROVIDERCHANGEOP, }; pub const TELEPHONY_CALLSTATE = enum(i32) { DISABLED = 0, ENABLED = 1, HOLD = 2, PROVIDERTRANSITION = 3, }; pub const TELEPHONY_CALLSTATE_DISABLED = TELEPHONY_CALLSTATE.DISABLED; pub const TELEPHONY_CALLSTATE_ENABLED = TELEPHONY_CALLSTATE.ENABLED; pub const TELEPHONY_CALLSTATE_HOLD = TELEPHONY_CALLSTATE.HOLD; pub const TELEPHONY_CALLSTATE_PROVIDERTRANSITION = TELEPHONY_CALLSTATE.PROVIDERTRANSITION; pub const KSTELEPHONY_CALLINFO = extern struct { CallType: TELEPHONY_CALLTYPE, CallState: TELEPHONY_CALLSTATE, }; const CLSID_KSPROPSETID_TelephonyTopology_Value = @import("../../zig.zig").Guid.initString("abf25c7e-0e64-4e32-b190-d0f6d7c53e97"); pub const CLSID_KSPROPSETID_TelephonyTopology = &CLSID_KSPROPSETID_TelephonyTopology_Value; pub const KSPROPERTY_TELEPHONY_TOPOLOGY = enum(i32) { ENDPOINTIDPAIR = 0, VOLUME = 1, }; pub const KSPROPERTY_TELEPHONY_ENDPOINTIDPAIR = KSPROPERTY_TELEPHONY_TOPOLOGY.ENDPOINTIDPAIR; pub const KSPROPERTY_TELEPHONY_VOLUME = KSPROPERTY_TELEPHONY_TOPOLOGY.VOLUME; pub const KSTOPOLOGY_ENDPOINTID = extern struct { TopologyName: [260]u16, PinId: u32, }; pub const KSTOPOLOGY_ENDPOINTIDPAIR = extern struct { RenderEndpoint: KSTOPOLOGY_ENDPOINTID, CaptureEndpoint: KSTOPOLOGY_ENDPOINTID, }; const CLSID_KSPROPSETID_FMRXTopology_Value = @import("../../zig.zig").Guid.initString("0c46ce8f-dc2d-4204-9dc9-f58963366563"); pub const CLSID_KSPROPSETID_FMRXTopology = &CLSID_KSPROPSETID_FMRXTopology_Value; pub const KSPROPERTY_FMRX_TOPOLOGY = enum(i32) { ENDPOINTID = 0, VOLUME = 1, ANTENNAENDPOINTID = 2, }; pub const KSPROPERTY_FMRX_ENDPOINTID = KSPROPERTY_FMRX_TOPOLOGY.ENDPOINTID; pub const KSPROPERTY_FMRX_VOLUME = KSPROPERTY_FMRX_TOPOLOGY.VOLUME; pub const KSPROPERTY_FMRX_ANTENNAENDPOINTID = KSPROPERTY_FMRX_TOPOLOGY.ANTENNAENDPOINTID; const CLSID_KSPROPSETID_FMRXControl_Value = @import("../../zig.zig").Guid.initString("947bba3a-e8ee-4786-90c4-8428185f05be"); pub const CLSID_KSPROPSETID_FMRXControl = &CLSID_KSPROPSETID_FMRXControl_Value; pub const KSPROPERTY_FMRX_CONTROL = enum(i32) { E = 0, }; pub const KSPROPERTY_FMRX_STATE = KSPROPERTY_FMRX_CONTROL.E; const CLSID_KSEVENTSETID_Telephony_Value = @import("../../zig.zig").Guid.initString("b77f12b4-ceb4-4484-8d5e-52c1e7d8762d"); pub const CLSID_KSEVENTSETID_Telephony = &CLSID_KSEVENTSETID_Telephony_Value; pub const KSEVENT_TELEPHONY = enum(i32) { D = 0, }; pub const KSEVENT_TELEPHONY_ENDPOINTPAIRS_CHANGED = KSEVENT_TELEPHONY.D; const CLSID_KSNODETYPE_DAC_Value = @import("../../zig.zig").Guid.initString("507ae360-c554-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_DAC = &CLSID_KSNODETYPE_DAC_Value; const CLSID_KSNODETYPE_ADC_Value = @import("../../zig.zig").Guid.initString("4d837fe0-c555-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_ADC = &CLSID_KSNODETYPE_ADC_Value; const CLSID_KSNODETYPE_SRC_Value = @import("../../zig.zig").Guid.initString("9db7b9e0-c555-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_SRC = &CLSID_KSNODETYPE_SRC_Value; const CLSID_KSNODETYPE_SUPERMIX_Value = @import("../../zig.zig").Guid.initString("e573adc0-c555-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_SUPERMIX = &CLSID_KSNODETYPE_SUPERMIX_Value; const CLSID_KSNODETYPE_MUX_Value = @import("../../zig.zig").Guid.initString("2ceaf780-c556-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_MUX = &CLSID_KSNODETYPE_MUX_Value; const CLSID_KSNODETYPE_DEMUX_Value = @import("../../zig.zig").Guid.initString("c0eb67d4-e807-11d0-958a-00c04fb925d3"); pub const CLSID_KSNODETYPE_DEMUX = &CLSID_KSNODETYPE_DEMUX_Value; const CLSID_KSNODETYPE_SUM_Value = @import("../../zig.zig").Guid.initString("da441a60-c556-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_SUM = &CLSID_KSNODETYPE_SUM_Value; const CLSID_KSNODETYPE_MUTE_Value = @import("../../zig.zig").Guid.initString("02b223c0-c557-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_MUTE = &CLSID_KSNODETYPE_MUTE_Value; const CLSID_KSNODETYPE_VOLUME_Value = @import("../../zig.zig").Guid.initString("3a5acc00-c557-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_VOLUME = &CLSID_KSNODETYPE_VOLUME_Value; const CLSID_KSNODETYPE_TONE_Value = @import("../../zig.zig").Guid.initString("7607e580-c557-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_TONE = &CLSID_KSNODETYPE_TONE_Value; const CLSID_KSNODETYPE_EQUALIZER_Value = @import("../../zig.zig").Guid.initString("9d41b4a0-c557-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_EQUALIZER = &CLSID_KSNODETYPE_EQUALIZER_Value; const CLSID_KSNODETYPE_AGC_Value = @import("../../zig.zig").Guid.initString("e88c9ba0-c557-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_AGC = &CLSID_KSNODETYPE_AGC_Value; const CLSID_KSNODETYPE_NOISE_SUPPRESS_Value = @import("../../zig.zig").Guid.initString("e07f903f-62fd-4e60-8cdd-dea7236665b5"); pub const CLSID_KSNODETYPE_NOISE_SUPPRESS = &CLSID_KSNODETYPE_NOISE_SUPPRESS_Value; const CLSID_KSNODETYPE_DELAY_Value = @import("../../zig.zig").Guid.initString("144981e0-c558-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_DELAY = &CLSID_KSNODETYPE_DELAY_Value; const CLSID_KSNODETYPE_LOUDNESS_Value = @import("../../zig.zig").Guid.initString("41887440-c558-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_LOUDNESS = &CLSID_KSNODETYPE_LOUDNESS_Value; const CLSID_KSNODETYPE_PROLOGIC_DECODER_Value = @import("../../zig.zig").Guid.initString("831c2c80-c558-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_PROLOGIC_DECODER = &CLSID_KSNODETYPE_PROLOGIC_DECODER_Value; const CLSID_KSNODETYPE_STEREO_WIDE_Value = @import("../../zig.zig").Guid.initString("a9e69800-c558-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_STEREO_WIDE = &CLSID_KSNODETYPE_STEREO_WIDE_Value; const CLSID_KSNODETYPE_REVERB_Value = @import("../../zig.zig").Guid.initString("ef0328e0-c558-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_REVERB = &CLSID_KSNODETYPE_REVERB_Value; const CLSID_KSNODETYPE_CHORUS_Value = @import("../../zig.zig").Guid.initString("20173f20-c559-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_CHORUS = &CLSID_KSNODETYPE_CHORUS_Value; const CLSID_KSNODETYPE_3D_EFFECTS_Value = @import("../../zig.zig").Guid.initString("55515860-c559-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_3D_EFFECTS = &CLSID_KSNODETYPE_3D_EFFECTS_Value; const CLSID_KSNODETYPE_PARAMETRIC_EQUALIZER_Value = @import("../../zig.zig").Guid.initString("19bb3a6a-ce2b-4442-87ec-6727c3cab477"); pub const CLSID_KSNODETYPE_PARAMETRIC_EQUALIZER = &CLSID_KSNODETYPE_PARAMETRIC_EQUALIZER_Value; const CLSID_KSNODETYPE_UPDOWN_MIX_Value = @import("../../zig.zig").Guid.initString("b7edc5cf-7b63-4ee2-a100-29ee2cb6b2de"); pub const CLSID_KSNODETYPE_UPDOWN_MIX = &CLSID_KSNODETYPE_UPDOWN_MIX_Value; const CLSID_KSNODETYPE_DYN_RANGE_COMPRESSOR_Value = @import("../../zig.zig").Guid.initString("08c8a6a8-601f-4af8-8793-d905ff4ca97d"); pub const CLSID_KSNODETYPE_DYN_RANGE_COMPRESSOR = &CLSID_KSNODETYPE_DYN_RANGE_COMPRESSOR_Value; const CLSID_KSALGORITHMINSTANCE_SYSTEM_ACOUSTIC_ECHO_CANCEL_Value = @import("../../zig.zig").Guid.initString("1c22c56d-9879-4f5b-a389-27996ddc2810"); pub const CLSID_KSALGORITHMINSTANCE_SYSTEM_ACOUSTIC_ECHO_CANCEL = &CLSID_KSALGORITHMINSTANCE_SYSTEM_ACOUSTIC_ECHO_CANCEL_Value; const CLSID_KSALGORITHMINSTANCE_SYSTEM_NOISE_SUPPRESS_Value = @import("../../zig.zig").Guid.initString("5ab0882e-7274-4516-877d-4eee99ba4fd0"); pub const CLSID_KSALGORITHMINSTANCE_SYSTEM_NOISE_SUPPRESS = &CLSID_KSALGORITHMINSTANCE_SYSTEM_NOISE_SUPPRESS_Value; const CLSID_KSALGORITHMINSTANCE_SYSTEM_AGC_Value = @import("../../zig.zig").Guid.initString("950e55b9-877c-4c67-be08-e47b5611130a"); pub const CLSID_KSALGORITHMINSTANCE_SYSTEM_AGC = &CLSID_KSALGORITHMINSTANCE_SYSTEM_AGC_Value; const CLSID_KSALGORITHMINSTANCE_SYSTEM_MICROPHONE_ARRAY_PROCESSOR_Value = @import("../../zig.zig").Guid.initString("b6f5a0a0-9e61-4f8c-91e3-76cf0f3c471f"); pub const CLSID_KSALGORITHMINSTANCE_SYSTEM_MICROPHONE_ARRAY_PROCESSOR = &CLSID_KSALGORITHMINSTANCE_SYSTEM_MICROPHONE_ARRAY_PROCESSOR_Value; const CLSID_KSNODETYPE_DEV_SPECIFIC_Value = @import("../../zig.zig").Guid.initString("941c7ac0-c559-11d0-8a2b-00a0c9255ac1"); pub const CLSID_KSNODETYPE_DEV_SPECIFIC = &CLSID_KSNODETYPE_DEV_SPECIFIC_Value; const CLSID_KSNODETYPE_PROLOGIC_ENCODER_Value = @import("../../zig.zig").Guid.initString("8074c5b2-3c66-11d2-b45a-3078302c2030"); pub const CLSID_KSNODETYPE_PROLOGIC_ENCODER = &CLSID_KSNODETYPE_PROLOGIC_ENCODER_Value; const CLSID_KSNODETYPE_PEAKMETER_Value = @import("../../zig.zig").Guid.initString("a085651e-5f0d-4b36-a869-d195d6ab4b9e"); pub const CLSID_KSNODETYPE_PEAKMETER = &CLSID_KSNODETYPE_PEAKMETER_Value; const CLSID_KSAUDFNAME_BASS_Value = @import("../../zig.zig").Guid.initString("185fede0-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_BASS = &CLSID_KSAUDFNAME_BASS_Value; const CLSID_KSAUDFNAME_TREBLE_Value = @import("../../zig.zig").Guid.initString("185fede1-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_TREBLE = &CLSID_KSAUDFNAME_TREBLE_Value; const CLSID_KSAUDFNAME_MIDRANGE_Value = @import("../../zig.zig").Guid.initString("a2cbe478-ae84-49a1-8b72-4ad09b78ed34"); pub const CLSID_KSAUDFNAME_MIDRANGE = &CLSID_KSAUDFNAME_MIDRANGE_Value; const CLSID_KSAUDFNAME_3D_STEREO_Value = @import("../../zig.zig").Guid.initString("185fede2-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_3D_STEREO = &CLSID_KSAUDFNAME_3D_STEREO_Value; const CLSID_KSAUDFNAME_MASTER_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fede3-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MASTER_VOLUME = &CLSID_KSAUDFNAME_MASTER_VOLUME_Value; const CLSID_KSAUDFNAME_MASTER_MUTE_Value = @import("../../zig.zig").Guid.initString("185fede4-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MASTER_MUTE = &CLSID_KSAUDFNAME_MASTER_MUTE_Value; const CLSID_KSAUDFNAME_WAVE_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fede5-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_WAVE_VOLUME = &CLSID_KSAUDFNAME_WAVE_VOLUME_Value; const CLSID_KSAUDFNAME_WAVE_MUTE_Value = @import("../../zig.zig").Guid.initString("185fede6-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_WAVE_MUTE = &CLSID_KSAUDFNAME_WAVE_MUTE_Value; const CLSID_KSAUDFNAME_MIDI_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fede7-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MIDI_VOLUME = &CLSID_KSAUDFNAME_MIDI_VOLUME_Value; const CLSID_KSAUDFNAME_MIDI_MUTE_Value = @import("../../zig.zig").Guid.initString("185fede8-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MIDI_MUTE = &CLSID_KSAUDFNAME_MIDI_MUTE_Value; const CLSID_KSAUDFNAME_CD_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fede9-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_CD_VOLUME = &CLSID_KSAUDFNAME_CD_VOLUME_Value; const CLSID_KSAUDFNAME_CD_MUTE_Value = @import("../../zig.zig").Guid.initString("185fedea-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_CD_MUTE = &CLSID_KSAUDFNAME_CD_MUTE_Value; const CLSID_KSAUDFNAME_LINE_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedeb-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_LINE_VOLUME = &CLSID_KSAUDFNAME_LINE_VOLUME_Value; const CLSID_KSAUDFNAME_LINE_MUTE_Value = @import("../../zig.zig").Guid.initString("185fedec-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_LINE_MUTE = &CLSID_KSAUDFNAME_LINE_MUTE_Value; const CLSID_KSAUDFNAME_MIC_VOLUME_Value = @import("../../zig.zig").Guid.initString("185feded-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MIC_VOLUME = &CLSID_KSAUDFNAME_MIC_VOLUME_Value; const CLSID_KSAUDFNAME_MIC_MUTE_Value = @import("../../zig.zig").Guid.initString("185fedee-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MIC_MUTE = &CLSID_KSAUDFNAME_MIC_MUTE_Value; const CLSID_KSAUDFNAME_RECORDING_SOURCE_Value = @import("../../zig.zig").Guid.initString("185fedef-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_RECORDING_SOURCE = &CLSID_KSAUDFNAME_RECORDING_SOURCE_Value; const CLSID_KSAUDFNAME_PC_SPEAKER_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedf0-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_PC_SPEAKER_VOLUME = &CLSID_KSAUDFNAME_PC_SPEAKER_VOLUME_Value; const CLSID_KSAUDFNAME_PC_SPEAKER_MUTE_Value = @import("../../zig.zig").Guid.initString("185fedf1-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_PC_SPEAKER_MUTE = &CLSID_KSAUDFNAME_PC_SPEAKER_MUTE_Value; const CLSID_KSAUDFNAME_MIDI_IN_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedf2-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MIDI_IN_VOLUME = &CLSID_KSAUDFNAME_MIDI_IN_VOLUME_Value; const CLSID_KSAUDFNAME_CD_IN_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedf3-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_CD_IN_VOLUME = &CLSID_KSAUDFNAME_CD_IN_VOLUME_Value; const CLSID_KSAUDFNAME_LINE_IN_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedf4-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_LINE_IN_VOLUME = &CLSID_KSAUDFNAME_LINE_IN_VOLUME_Value; const CLSID_KSAUDFNAME_MIC_IN_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedf5-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MIC_IN_VOLUME = &CLSID_KSAUDFNAME_MIC_IN_VOLUME_Value; const CLSID_KSAUDFNAME_WAVE_IN_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedf6-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_WAVE_IN_VOLUME = &CLSID_KSAUDFNAME_WAVE_IN_VOLUME_Value; const CLSID_KSAUDFNAME_VOLUME_CONTROL_Value = @import("../../zig.zig").Guid.initString("185fedf7-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_VOLUME_CONTROL = &CLSID_KSAUDFNAME_VOLUME_CONTROL_Value; const CLSID_KSAUDFNAME_MIDI_Value = @import("../../zig.zig").Guid.initString("185fedf8-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_MIDI = &CLSID_KSAUDFNAME_MIDI_Value; const CLSID_KSAUDFNAME_LINE_IN_Value = @import("../../zig.zig").Guid.initString("185fedf9-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_LINE_IN = &CLSID_KSAUDFNAME_LINE_IN_Value; const CLSID_KSAUDFNAME_RECORDING_CONTROL_Value = @import("../../zig.zig").Guid.initString("185fedfa-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_RECORDING_CONTROL = &CLSID_KSAUDFNAME_RECORDING_CONTROL_Value; const CLSID_KSAUDFNAME_CD_AUDIO_Value = @import("../../zig.zig").Guid.initString("185fedfb-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_CD_AUDIO = &CLSID_KSAUDFNAME_CD_AUDIO_Value; const CLSID_KSAUDFNAME_AUX_VOLUME_Value = @import("../../zig.zig").Guid.initString("185fedfc-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_AUX_VOLUME = &CLSID_KSAUDFNAME_AUX_VOLUME_Value; const CLSID_KSAUDFNAME_AUX_MUTE_Value = @import("../../zig.zig").Guid.initString("185fedfd-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_AUX_MUTE = &CLSID_KSAUDFNAME_AUX_MUTE_Value; const CLSID_KSAUDFNAME_AUX_Value = @import("../../zig.zig").Guid.initString("185fedfe-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_AUX = &CLSID_KSAUDFNAME_AUX_Value; const CLSID_KSAUDFNAME_PC_SPEAKER_Value = @import("../../zig.zig").Guid.initString("185fedff-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_PC_SPEAKER = &CLSID_KSAUDFNAME_PC_SPEAKER_Value; const CLSID_KSAUDFNAME_WAVE_OUT_MIX_Value = @import("../../zig.zig").Guid.initString("185fee00-9905-11d1-95a9-00c04fb925d3"); pub const CLSID_KSAUDFNAME_WAVE_OUT_MIX = &CLSID_KSAUDFNAME_WAVE_OUT_MIX_Value; const CLSID_KSAUDFNAME_MONO_OUT_Value = @import("../../zig.zig").Guid.initString("f9b41dc3-96e2-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_MONO_OUT = &CLSID_KSAUDFNAME_MONO_OUT_Value; const CLSID_KSAUDFNAME_STEREO_MIX_Value = @import("../../zig.zig").Guid.initString("00dff077-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_STEREO_MIX = &CLSID_KSAUDFNAME_STEREO_MIX_Value; const CLSID_KSAUDFNAME_MONO_MIX_Value = @import("../../zig.zig").Guid.initString("00dff078-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_MONO_MIX = &CLSID_KSAUDFNAME_MONO_MIX_Value; const CLSID_KSAUDFNAME_MONO_OUT_VOLUME_Value = @import("../../zig.zig").Guid.initString("1ad247eb-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_MONO_OUT_VOLUME = &CLSID_KSAUDFNAME_MONO_OUT_VOLUME_Value; const CLSID_KSAUDFNAME_MONO_OUT_MUTE_Value = @import("../../zig.zig").Guid.initString("1ad247ec-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_MONO_OUT_MUTE = &CLSID_KSAUDFNAME_MONO_OUT_MUTE_Value; const CLSID_KSAUDFNAME_STEREO_MIX_VOLUME_Value = @import("../../zig.zig").Guid.initString("1ad247ed-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_STEREO_MIX_VOLUME = &CLSID_KSAUDFNAME_STEREO_MIX_VOLUME_Value; const CLSID_KSAUDFNAME_STEREO_MIX_MUTE_Value = @import("../../zig.zig").Guid.initString("22b0eafd-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_STEREO_MIX_MUTE = &CLSID_KSAUDFNAME_STEREO_MIX_MUTE_Value; const CLSID_KSAUDFNAME_MONO_MIX_VOLUME_Value = @import("../../zig.zig").Guid.initString("22b0eafe-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_MONO_MIX_VOLUME = &CLSID_KSAUDFNAME_MONO_MIX_VOLUME_Value; const CLSID_KSAUDFNAME_MONO_MIX_MUTE_Value = @import("../../zig.zig").Guid.initString("2bc31d69-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_MONO_MIX_MUTE = &CLSID_KSAUDFNAME_MONO_MIX_MUTE_Value; const CLSID_KSAUDFNAME_MICROPHONE_BOOST_Value = @import("../../zig.zig").Guid.initString("2bc31d6a-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_MICROPHONE_BOOST = &CLSID_KSAUDFNAME_MICROPHONE_BOOST_Value; const CLSID_KSAUDFNAME_ALTERNATE_MICROPHONE_Value = @import("../../zig.zig").Guid.initString("2bc31d6b-96e3-11d2-ac4c-00c04f8efb68"); pub const CLSID_KSAUDFNAME_ALTERNATE_MICROPHONE = &CLSID_KSAUDFNAME_ALTERNATE_MICROPHONE_Value; const CLSID_KSAUDFNAME_3D_DEPTH_Value = @import("../../zig.zig").Guid.initString("63ff5747-991f-11d2-ac4d-00c04f8efb68"); pub const CLSID_KSAUDFNAME_3D_DEPTH = &CLSID_KSAUDFNAME_3D_DEPTH_Value; const CLSID_KSAUDFNAME_3D_CENTER_Value = @import("../../zig.zig").Guid.initString("9f0670b4-991f-11d2-ac4d-00c04f8efb68"); pub const CLSID_KSAUDFNAME_3D_CENTER = &CLSID_KSAUDFNAME_3D_CENTER_Value; const CLSID_KSAUDFNAME_VIDEO_VOLUME_Value = @import("../../zig.zig").Guid.initString("9b46e708-992a-11d2-ac4d-00c04f8efb68"); pub const CLSID_KSAUDFNAME_VIDEO_VOLUME = &CLSID_KSAUDFNAME_VIDEO_VOLUME_Value; const CLSID_KSAUDFNAME_VIDEO_MUTE_Value = @import("../../zig.zig").Guid.initString("9b46e709-992a-11d2-ac4d-00c04f8efb68"); pub const CLSID_KSAUDFNAME_VIDEO_MUTE = &CLSID_KSAUDFNAME_VIDEO_MUTE_Value; const CLSID_KSAUDFNAME_VIDEO_Value = @import("../../zig.zig").Guid.initString("915daec4-a434-11d2-ac52-00c04f8efb68"); pub const CLSID_KSAUDFNAME_VIDEO = &CLSID_KSAUDFNAME_VIDEO_Value; const CLSID_KSAUDFNAME_PEAKMETER_Value = @import("../../zig.zig").Guid.initString("57e24340-fc5b-4612-a562-72b11a29dfae"); pub const CLSID_KSAUDFNAME_PEAKMETER = &CLSID_KSAUDFNAME_PEAKMETER_Value; const CLSID_KSMETHODSETID_Wavetable_Value = @import("../../zig.zig").Guid.initString("dcef31eb-d907-11d0-9583-00c04fb925d3"); pub const CLSID_KSMETHODSETID_Wavetable = &CLSID_KSMETHODSETID_Wavetable_Value; pub const KSMETHOD_WAVETABLE = enum(i32) { ALLOC = 0, FREE = 1, FIND = 2, WRITE = 3, }; pub const KSMETHOD_WAVETABLE_WAVE_ALLOC = KSMETHOD_WAVETABLE.ALLOC; pub const KSMETHOD_WAVETABLE_WAVE_FREE = KSMETHOD_WAVETABLE.FREE; pub const KSMETHOD_WAVETABLE_WAVE_FIND = KSMETHOD_WAVETABLE.FIND; pub const KSMETHOD_WAVETABLE_WAVE_WRITE = KSMETHOD_WAVETABLE.WRITE; pub const KSWAVETABLE_WAVE_DESC = extern struct { Identifier: KSIDENTIFIER, Size: u32, Looped: BOOL, LoopPoint: u32, InROM: BOOL, Format: KSDATAFORMAT, }; const CLSID_KSPROPSETID_Wave_Value = @import("../../zig.zig").Guid.initString("924e54b0-630f-11cf-ada7-08003e30494a"); pub const CLSID_KSPROPSETID_Wave = &CLSID_KSPROPSETID_Wave_Value; pub const KSPROPERTY_WAVE = enum(i32) { COMPATIBLE_CAPABILITIES = 0, INPUT_CAPABILITIES = 1, OUTPUT_CAPABILITIES = 2, BUFFER = 3, FREQUENCY = 4, VOLUME = 5, PAN = 6, }; pub const KSPROPERTY_WAVE_COMPATIBLE_CAPABILITIES = KSPROPERTY_WAVE.COMPATIBLE_CAPABILITIES; pub const KSPROPERTY_WAVE_INPUT_CAPABILITIES = KSPROPERTY_WAVE.INPUT_CAPABILITIES; pub const KSPROPERTY_WAVE_OUTPUT_CAPABILITIES = KSPROPERTY_WAVE.OUTPUT_CAPABILITIES; pub const KSPROPERTY_WAVE_BUFFER = KSPROPERTY_WAVE.BUFFER; pub const KSPROPERTY_WAVE_FREQUENCY = KSPROPERTY_WAVE.FREQUENCY; pub const KSPROPERTY_WAVE_VOLUME = KSPROPERTY_WAVE.VOLUME; pub const KSPROPERTY_WAVE_PAN = KSPROPERTY_WAVE.PAN; pub const KSWAVE_COMPATCAPS = extern struct { ulDeviceType: u32, }; pub const KSWAVE_INPUT_CAPABILITIES = extern struct { MaximumChannelsPerConnection: u32, MinimumBitsPerSample: u32, MaximumBitsPerSample: u32, MinimumSampleFrequency: u32, MaximumSampleFrequency: u32, TotalConnections: u32, ActiveConnections: u32, }; pub const KSWAVE_OUTPUT_CAPABILITIES = extern struct { MaximumChannelsPerConnection: u32, MinimumBitsPerSample: u32, MaximumBitsPerSample: u32, MinimumSampleFrequency: u32, MaximumSampleFrequency: u32, TotalConnections: u32, StaticConnections: u32, StreamingConnections: u32, ActiveConnections: u32, ActiveStaticConnections: u32, ActiveStreamingConnections: u32, Total3DConnections: u32, Static3DConnections: u32, Streaming3DConnections: u32, Active3DConnections: u32, ActiveStatic3DConnections: u32, ActiveStreaming3DConnections: u32, TotalSampleMemory: u32, FreeSampleMemory: u32, LargestFreeContiguousSampleMemory: u32, }; pub const KSWAVE_VOLUME = extern struct { LeftAttenuation: i32, RightAttenuation: i32, }; pub const KSWAVE_BUFFER = extern struct { Attributes: u32, BufferSize: u32, BufferAddress: ?*c_void, }; const CLSID_KSMUSIC_TECHNOLOGY_PORT_Value = @import("../../zig.zig").Guid.initString("86c92e60-62e8-11cf-a5d6-28db04c10000"); pub const CLSID_KSMUSIC_TECHNOLOGY_PORT = &CLSID_KSMUSIC_TECHNOLOGY_PORT_Value; const CLSID_KSMUSIC_TECHNOLOGY_SQSYNTH_Value = @import("../../zig.zig").Guid.initString("0ecf4380-62e9-11cf-a5d6-28db04c10000"); pub const CLSID_KSMUSIC_TECHNOLOGY_SQSYNTH = &CLSID_KSMUSIC_TECHNOLOGY_SQSYNTH_Value; const CLSID_KSMUSIC_TECHNOLOGY_FMSYNTH_Value = @import("../../zig.zig").Guid.initString("252c5c80-62e9-11cf-a5d6-28db04c10000"); pub const CLSID_KSMUSIC_TECHNOLOGY_FMSYNTH = &CLSID_KSMUSIC_TECHNOLOGY_FMSYNTH_Value; const CLSID_KSMUSIC_TECHNOLOGY_WAVETABLE_Value = @import("../../zig.zig").Guid.initString("394ec7c0-62e9-11cf-a5d6-28db04c10000"); pub const CLSID_KSMUSIC_TECHNOLOGY_WAVETABLE = &CLSID_KSMUSIC_TECHNOLOGY_WAVETABLE_Value; const CLSID_KSMUSIC_TECHNOLOGY_SWSYNTH_Value = @import("../../zig.zig").Guid.initString("37407736-3620-11d1-85d3-0000f8754380"); pub const CLSID_KSMUSIC_TECHNOLOGY_SWSYNTH = &CLSID_KSMUSIC_TECHNOLOGY_SWSYNTH_Value; pub const KSDATARANGE_MUSIC = extern struct { DataRange: KSDATAFORMAT, Technology: Guid, Channels: u32, Notes: u32, ChannelMask: u32, }; const CLSID_KSPROPSETID_Cyclic_Value = @import("../../zig.zig").Guid.initString("3ffeaea0-2bee-11cf-a5d6-28db04c10000"); pub const CLSID_KSPROPSETID_Cyclic = &CLSID_KSPROPSETID_Cyclic_Value; pub const KSPROPERTY_CYCLIC = enum(i32) { N = 0, }; pub const KSPROPERTY_CYCLIC_POSITION = KSPROPERTY_CYCLIC.N; const CLSID_KSEVENTSETID_AudioControlChange_Value = @import("../../zig.zig").Guid.initString("e85e9698-fa2f-11d1-95bd-00c04fb925d3"); pub const CLSID_KSEVENTSETID_AudioControlChange = &CLSID_KSEVENTSETID_AudioControlChange_Value; pub const KSEVENT_AUDIO_CONTROL_CHANGE = enum(i32) { E = 0, }; pub const KSEVENT_CONTROL_CHANGE = KSEVENT_AUDIO_CONTROL_CHANGE.E; const CLSID_KSEVENTSETID_LoopedStreaming_Value = @import("../../zig.zig").Guid.initString("4682b940-c6ef-11d0-96d8-00aa0051e51d"); pub const CLSID_KSEVENTSETID_LoopedStreaming = &CLSID_KSEVENTSETID_LoopedStreaming_Value; pub const KSEVENT_LOOPEDSTREAMING = enum(i32) { N = 0, }; pub const KSEVENT_LOOPEDSTREAMING_POSITION = KSEVENT_LOOPEDSTREAMING.N; pub const LOOPEDSTREAMING_POSITION_EVENT_DATA = extern struct { KsEventData: KSEVENTDATA, Position: u64, }; pub const KSNODEPROPERTY = extern struct { Property: KSIDENTIFIER, NodeId: u32, Reserved: u32, }; pub const KSNODEPROPERTY_AUDIO_CHANNEL = extern struct { NodeProperty: KSNODEPROPERTY, Channel: i32, Reserved: u32, }; pub const KSNODEPROPERTY_AUDIO_DEV_SPECIFIC = extern struct { NodeProperty: KSNODEPROPERTY, DevSpecificId: u32, DeviceInfo: u32, Length: u32, }; const CLSID_KSDATAFORMAT_TYPE_MUSIC_Value = @import("../../zig.zig").Guid.initString("e725d360-62cc-11cf-a5d6-28db04c10000"); pub const CLSID_KSDATAFORMAT_TYPE_MUSIC = &CLSID_KSDATAFORMAT_TYPE_MUSIC_Value; const CLSID_KSDATAFORMAT_TYPE_MIDI_Value = @import("../../zig.zig").Guid.initString("7364696d-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_TYPE_MIDI = &CLSID_KSDATAFORMAT_TYPE_MIDI_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MIDI_Value = @import("../../zig.zig").Guid.initString("1d262760-e957-11cf-a5d6-28db04c10000"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MIDI = &CLSID_KSDATAFORMAT_SUBTYPE_MIDI_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MIDI_BUS_Value = @import("../../zig.zig").Guid.initString("2ca15fa0-6cfe-11cf-a5d6-28db04c10000"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MIDI_BUS = &CLSID_KSDATAFORMAT_SUBTYPE_MIDI_BUS_Value; const CLSID_KSDATAFORMAT_SUBTYPE_RIFFMIDI_Value = @import("../../zig.zig").Guid.initString("4995daf0-9ee6-11d0-a40e-00a0c9223196"); pub const CLSID_KSDATAFORMAT_SUBTYPE_RIFFMIDI = &CLSID_KSDATAFORMAT_SUBTYPE_RIFFMIDI_Value; pub const KSMUSICFORMAT = extern struct { TimeDeltaMs: u32, ByteCount: u32, }; const CLSID_KSDATAFORMAT_TYPE_STANDARD_ELEMENTARY_STREAM_Value = @import("../../zig.zig").Guid.initString("36523b11-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_TYPE_STANDARD_ELEMENTARY_STREAM = &CLSID_KSDATAFORMAT_TYPE_STANDARD_ELEMENTARY_STREAM_Value; const CLSID_KSDATAFORMAT_TYPE_STANDARD_PES_PACKET_Value = @import("../../zig.zig").Guid.initString("36523b12-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_TYPE_STANDARD_PES_PACKET = &CLSID_KSDATAFORMAT_TYPE_STANDARD_PES_PACKET_Value; const CLSID_KSDATAFORMAT_TYPE_STANDARD_PACK_HEADER_Value = @import("../../zig.zig").Guid.initString("36523b13-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_TYPE_STANDARD_PACK_HEADER = &CLSID_KSDATAFORMAT_TYPE_STANDARD_PACK_HEADER_Value; const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO_Value = @import("../../zig.zig").Guid.initString("36523b21-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO = &CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_VIDEO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO_Value = @import("../../zig.zig").Guid.initString("36523b22-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG1_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO_Value = @import("../../zig.zig").Guid.initString("36523b23-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO = &CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_VIDEO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO_Value = @import("../../zig.zig").Guid.initString("36523b24-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_MPEG2_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO_Value = @import("../../zig.zig").Guid.initString("36523b25-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_STANDARD_AC3_AUDIO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO_Value = @import("../../zig.zig").Guid.initString("36523b31-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO = &CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_VIDEO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO_Value = @import("../../zig.zig").Guid.initString("36523b32-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO = &CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG1_AUDIO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO_Value = @import("../../zig.zig").Guid.initString("36523b33-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO = &CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_VIDEO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO_Value = @import("../../zig.zig").Guid.initString("36523b34-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO = &CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_MPEG2_AUDIO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO_Value = @import("../../zig.zig").Guid.initString("36523b35-8ee5-11d1-8ca3-0060b057664a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO = &CLSID_KSDATAFORMAT_SPECIFIER_DIALECT_AC3_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_DSS_VIDEO_Value = @import("../../zig.zig").Guid.initString("a0af4f81-e163-11d0-bad9-00609744111a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_DSS_VIDEO = &CLSID_KSDATAFORMAT_SUBTYPE_DSS_VIDEO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_DSS_AUDIO_Value = @import("../../zig.zig").Guid.initString("a0af4f82-e163-11d0-bad9-00609744111a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_DSS_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_DSS_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Packet_Value = @import("../../zig.zig").Guid.initString("e436eb80-524f-11ce-9f53-0020af0ba770"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Packet = &CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Packet_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Payload_Value = @import("../../zig.zig").Guid.initString("e436eb81-524f-11ce-9f53-0020af0ba770"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Payload = &CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Payload_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Video_Value = @import("../../zig.zig").Guid.initString("e436eb86-524f-11ce-9f53-0020af0ba770"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Video = &CLSID_KSDATAFORMAT_SUBTYPE_MPEG1Video_Value; const CLSID_KSDATAFORMAT_SPECIFIER_MPEG1_VIDEO_Value = @import("../../zig.zig").Guid.initString("05589f82-c356-11ce-bf01-00aa0055595a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_MPEG1_VIDEO = &CLSID_KSDATAFORMAT_SPECIFIER_MPEG1_VIDEO_Value; const CLSID_KSDATAFORMAT_TYPE_MPEG2_PES_Value = @import("../../zig.zig").Guid.initString("e06d8020-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_TYPE_MPEG2_PES = &CLSID_KSDATAFORMAT_TYPE_MPEG2_PES_Value; const CLSID_KSDATAFORMAT_TYPE_MPEG2_PROGRAM_Value = @import("../../zig.zig").Guid.initString("e06d8022-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_TYPE_MPEG2_PROGRAM = &CLSID_KSDATAFORMAT_TYPE_MPEG2_PROGRAM_Value; const CLSID_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_Value = @import("../../zig.zig").Guid.initString("e06d8023-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT = &CLSID_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MPEG2_VIDEO_Value = @import("../../zig.zig").Guid.initString("e06d8026-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEG2_VIDEO = &CLSID_KSDATAFORMAT_SUBTYPE_MPEG2_VIDEO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_MPEG2_VIDEO_Value = @import("../../zig.zig").Guid.initString("e06d80e3-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SPECIFIER_MPEG2_VIDEO = &CLSID_KSDATAFORMAT_SPECIFIER_MPEG2_VIDEO_Value; const CLSID_KSPROPSETID_Mpeg2Vid_Value = @import("../../zig.zig").Guid.initString("c8e11b60-0cc9-11d0-bd69-003505c103a9"); pub const CLSID_KSPROPSETID_Mpeg2Vid = &CLSID_KSPROPSETID_Mpeg2Vid_Value; pub const KSPROPERTY_MPEG2VID = enum(i32) { MODES = 0, CUR_MODE = 1, @"4_3_RECT" = 2, @"16_9_RECT" = 3, @"16_9_PANSCAN" = 4, }; pub const KSPROPERTY_MPEG2VID_MODES = KSPROPERTY_MPEG2VID.MODES; pub const KSPROPERTY_MPEG2VID_CUR_MODE = KSPROPERTY_MPEG2VID.CUR_MODE; pub const KSPROPERTY_MPEG2VID_4_3_RECT = KSPROPERTY_MPEG2VID.@"4_3_RECT"; pub const KSPROPERTY_MPEG2VID_16_9_RECT = KSPROPERTY_MPEG2VID.@"16_9_RECT"; pub const KSPROPERTY_MPEG2VID_16_9_PANSCAN = KSPROPERTY_MPEG2VID.@"16_9_PANSCAN"; pub const KSMPEGVID_RECT = extern struct { StartX: u32, StartY: u32, EndX: u32, EndY: u32, }; const CLSID_KSDATAFORMAT_SUBTYPE_MPEG2_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d802b-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEG2_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_MPEG2_AUDIO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_MPEG2_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d80e5-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SPECIFIER_MPEG2_AUDIO = &CLSID_KSDATAFORMAT_SPECIFIER_MPEG2_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_LPCM_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d8032-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SUBTYPE_LPCM_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_LPCM_AUDIO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_LPCM_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d80e6-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SPECIFIER_LPCM_AUDIO = &CLSID_KSDATAFORMAT_SPECIFIER_LPCM_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_AC3_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d802c-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SUBTYPE_AC3_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_AC3_AUDIO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_AC3_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d80e4-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SPECIFIER_AC3_AUDIO = &CLSID_KSDATAFORMAT_SPECIFIER_AC3_AUDIO_Value; const CLSID_KSPROPSETID_AC3_Value = @import("../../zig.zig").Guid.initString("bfabe720-6e1f-11d0-bcf2-444553540000"); pub const CLSID_KSPROPSETID_AC3 = &CLSID_KSPROPSETID_AC3_Value; pub const KSPROPERTY_AC3 = enum(i32) { ERROR_CONCEALMENT = 1, ALTERNATE_AUDIO = 2, DOWNMIX = 3, BIT_STREAM_MODE = 4, DIALOGUE_LEVEL = 5, LANGUAGE_CODE = 6, ROOM_TYPE = 7, }; pub const KSPROPERTY_AC3_ERROR_CONCEALMENT = KSPROPERTY_AC3.ERROR_CONCEALMENT; pub const KSPROPERTY_AC3_ALTERNATE_AUDIO = KSPROPERTY_AC3.ALTERNATE_AUDIO; pub const KSPROPERTY_AC3_DOWNMIX = KSPROPERTY_AC3.DOWNMIX; pub const KSPROPERTY_AC3_BIT_STREAM_MODE = KSPROPERTY_AC3.BIT_STREAM_MODE; pub const KSPROPERTY_AC3_DIALOGUE_LEVEL = KSPROPERTY_AC3.DIALOGUE_LEVEL; pub const KSPROPERTY_AC3_LANGUAGE_CODE = KSPROPERTY_AC3.LANGUAGE_CODE; pub const KSPROPERTY_AC3_ROOM_TYPE = KSPROPERTY_AC3.ROOM_TYPE; pub const KSAC3_ERROR_CONCEALMENT = extern struct { fRepeatPreviousBlock: BOOL, fErrorInCurrentBlock: BOOL, }; pub const KSAC3_ALTERNATE_AUDIO = extern struct { fStereo: BOOL, DualMode: u32, }; pub const KSAC3_DOWNMIX = extern struct { fDownMix: BOOL, fDolbySurround: BOOL, }; pub const KSAC3_BIT_STREAM_MODE = extern struct { BitStreamMode: i32, }; pub const KSAC3_DIALOGUE_LEVEL = extern struct { DialogueLevel: u32, }; pub const KSAC3_ROOM_TYPE = extern struct { fLargeRoom: BOOL, }; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_Value = @import("../../zig.zig").Guid.initString("00000092-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_WMA_PRO_Value = @import("../../zig.zig").Guid.initString("00000164-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_WMA_PRO = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_WMA_PRO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DTS_Value = @import("../../zig.zig").Guid.initString("00000008-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DTS = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DTS_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG1_Value = @import("../../zig.zig").Guid.initString("00000003-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG1 = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG1_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG2_Value = @import("../../zig.zig").Guid.initString("00000004-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG2 = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG2_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG3_Value = @import("../../zig.zig").Guid.initString("00000005-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG3 = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_MPEG3_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_AAC_Value = @import("../../zig.zig").Guid.initString("00000006-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_AAC = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_AAC_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_ATRAC_Value = @import("../../zig.zig").Guid.initString("00000008-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_ATRAC = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_ATRAC_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_ONE_BIT_AUDIO_Value = @import("../../zig.zig").Guid.initString("00000009-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_ONE_BIT_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_ONE_BIT_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS_Value = @import("../../zig.zig").Guid.initString("0000000a-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS_ATMOS_Value = @import("../../zig.zig").Guid.initString("0000010a-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS_ATMOS = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS_ATMOS_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD_Value = @import("../../zig.zig").Guid.initString("0000000b-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP_Value = @import("../../zig.zig").Guid.initString("0000000c-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT20_Value = @import("../../zig.zig").Guid.initString("0000010c-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT20 = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT20_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT21_Value = @import("../../zig.zig").Guid.initString("0000030c-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT21 = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MAT21_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DST_Value = @import("../../zig.zig").Guid.initString("0000000d-0cea-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DST = &CLSID_KSDATAFORMAT_SUBTYPE_IEC61937_DST_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MPEGLAYER3_Value = @import("../../zig.zig").Guid.initString("00000055-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEGLAYER3 = &CLSID_KSDATAFORMAT_SUBTYPE_MPEGLAYER3_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MPEG_HEAAC_Value = @import("../../zig.zig").Guid.initString("00001610-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MPEG_HEAAC = &CLSID_KSDATAFORMAT_SUBTYPE_MPEG_HEAAC_Value; const CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO2_Value = @import("../../zig.zig").Guid.initString("00000161-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO2 = &CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO2_Value; const CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO3_Value = @import("../../zig.zig").Guid.initString("00000162-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO3 = &CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO3_Value; const CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO_LOSSLESS_Value = @import("../../zig.zig").Guid.initString("00000163-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO_LOSSLESS = &CLSID_KSDATAFORMAT_SUBTYPE_WMAUDIO_LOSSLESS_Value; const CLSID_KSDATAFORMAT_SUBTYPE_DTS_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d8033-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SUBTYPE_DTS_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_DTS_AUDIO_Value; const CLSID_KSDATAFORMAT_SUBTYPE_SDDS_AUDIO_Value = @import("../../zig.zig").Guid.initString("e06d8034-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SUBTYPE_SDDS_AUDIO = &CLSID_KSDATAFORMAT_SUBTYPE_SDDS_AUDIO_Value; const CLSID_KSPROPSETID_AudioDecoderOut_Value = @import("../../zig.zig").Guid.initString("6ca6e020-43bd-11d0-bd6a-003505c103a9"); pub const CLSID_KSPROPSETID_AudioDecoderOut = &CLSID_KSPROPSETID_AudioDecoderOut_Value; pub const KSPROPERTY_AUDDECOUT = enum(i32) { MODES = 0, CUR_MODE = 1, }; pub const KSPROPERTY_AUDDECOUT_MODES = KSPROPERTY_AUDDECOUT.MODES; pub const KSPROPERTY_AUDDECOUT_CUR_MODE = KSPROPERTY_AUDDECOUT.CUR_MODE; const CLSID_KSDATAFORMAT_SUBTYPE_SUBPICTURE_Value = @import("../../zig.zig").Guid.initString("e06d802d-db46-11cf-b4d1-00805f6cbbea"); pub const CLSID_KSDATAFORMAT_SUBTYPE_SUBPICTURE = &CLSID_KSDATAFORMAT_SUBTYPE_SUBPICTURE_Value; const CLSID_KSPROPSETID_DvdSubPic_Value = @import("../../zig.zig").Guid.initString("ac390460-43af-11d0-bd6a-003505c103a9"); pub const CLSID_KSPROPSETID_DvdSubPic = &CLSID_KSPROPSETID_DvdSubPic_Value; pub const KSPROPERTY_DVDSUBPIC = enum(i32) { PALETTE = 0, HLI = 1, COMPOSIT_ON = 2, }; pub const KSPROPERTY_DVDSUBPIC_PALETTE = KSPROPERTY_DVDSUBPIC.PALETTE; pub const KSPROPERTY_DVDSUBPIC_HLI = KSPROPERTY_DVDSUBPIC.HLI; pub const KSPROPERTY_DVDSUBPIC_COMPOSIT_ON = KSPROPERTY_DVDSUBPIC.COMPOSIT_ON; pub const KS_DVD_YCrCb = extern struct { Reserved: u8, Y: u8, Cr: u8, Cb: u8, }; pub const KS_DVD_YUV = extern struct { Reserved: u8, Y: u8, V: u8, U: u8, }; pub const KSPROPERTY_SPPAL = extern struct { sppal: [16]KS_DVD_YUV, }; pub const KS_COLCON = extern struct { _bitfield1: u8, _bitfield2: u8, _bitfield3: u8, _bitfield4: u8, }; pub const KSPROPERTY_SPHLI = extern struct { HLISS: u16, Reserved: u16, StartPTM: u32, EndPTM: u32, StartX: u16, StartY: u16, StopX: u16, StopY: u16, ColCon: KS_COLCON, }; const CLSID_KSPROPSETID_CopyProt_Value = @import("../../zig.zig").Guid.initString("0e8a0a40-6aef-11d0-9ed0-00a024ca19b3"); pub const CLSID_KSPROPSETID_CopyProt = &CLSID_KSPROPSETID_CopyProt_Value; pub const KSPROPERTY_COPYPROT = enum(i32) { DVDCOPY_CHLG_KEY = 1, DVDCOPY_DVD_KEY1 = 2, DVDCOPY_DEC_KEY2 = 3, DVDCOPY_TITLE_KEY = 4, COPY_MACROVISION = 5, DVDCOPY_REGION = 6, DVDCOPY_SET_COPY_STATE = 7, DVDCOPY_DISC_KEY = 128, }; pub const KSPROPERTY_DVDCOPY_CHLG_KEY = KSPROPERTY_COPYPROT.DVDCOPY_CHLG_KEY; pub const KSPROPERTY_DVDCOPY_DVD_KEY1 = KSPROPERTY_COPYPROT.DVDCOPY_DVD_KEY1; pub const KSPROPERTY_DVDCOPY_DEC_KEY2 = KSPROPERTY_COPYPROT.DVDCOPY_DEC_KEY2; pub const KSPROPERTY_DVDCOPY_TITLE_KEY = KSPROPERTY_COPYPROT.DVDCOPY_TITLE_KEY; pub const KSPROPERTY_COPY_MACROVISION = KSPROPERTY_COPYPROT.COPY_MACROVISION; pub const KSPROPERTY_DVDCOPY_REGION = KSPROPERTY_COPYPROT.DVDCOPY_REGION; pub const KSPROPERTY_DVDCOPY_SET_COPY_STATE = KSPROPERTY_COPYPROT.DVDCOPY_SET_COPY_STATE; pub const KSPROPERTY_DVDCOPY_DISC_KEY = KSPROPERTY_COPYPROT.DVDCOPY_DISC_KEY; pub const KS_DVDCOPY_CHLGKEY = extern struct { ChlgKey: [10]u8, Reserved: [2]u8, }; pub const KS_DVDCOPY_BUSKEY = extern struct { BusKey: [5]u8, Reserved: [1]u8, }; pub const KS_DVDCOPY_DISCKEY = extern struct { DiscKey: [2048]u8, }; pub const KS_DVDCOPY_REGION = extern struct { Reserved: u8, RegionData: u8, Reserved2: [2]u8, }; pub const KS_DVDCOPY_TITLEKEY = extern struct { KeyFlags: u32, ReservedNT: [2]u32, TitleKey: [6]u8, Reserved: [2]u8, }; pub const KS_COPY_MACROVISION = extern struct { MACROVISIONLevel: u32, }; pub const KS_DVDCOPY_SET_COPY_STATE = extern struct { DVDCopyState: u32, }; pub const KS_DVDCOPYSTATE = enum(i32) { INITIALIZE = 0, INITIALIZE_TITLE = 1, AUTHENTICATION_NOT_REQUIRED = 2, AUTHENTICATION_REQUIRED = 3, DONE = 4, }; pub const KS_DVDCOPYSTATE_INITIALIZE = KS_DVDCOPYSTATE.INITIALIZE; pub const KS_DVDCOPYSTATE_INITIALIZE_TITLE = KS_DVDCOPYSTATE.INITIALIZE_TITLE; pub const KS_DVDCOPYSTATE_AUTHENTICATION_NOT_REQUIRED = KS_DVDCOPYSTATE.AUTHENTICATION_NOT_REQUIRED; pub const KS_DVDCOPYSTATE_AUTHENTICATION_REQUIRED = KS_DVDCOPYSTATE.AUTHENTICATION_REQUIRED; pub const KS_DVDCOPYSTATE_DONE = KS_DVDCOPYSTATE.DONE; pub const KS_COPY_MACROVISION_LEVEL = enum(i32) { DISABLED = 0, LEVEL1 = 1, LEVEL2 = 2, LEVEL3 = 3, }; pub const KS_MACROVISION_DISABLED = KS_COPY_MACROVISION_LEVEL.DISABLED; pub const KS_MACROVISION_LEVEL1 = KS_COPY_MACROVISION_LEVEL.LEVEL1; pub const KS_MACROVISION_LEVEL2 = KS_COPY_MACROVISION_LEVEL.LEVEL2; pub const KS_MACROVISION_LEVEL3 = KS_COPY_MACROVISION_LEVEL.LEVEL3; const CLSID_KSCATEGORY_TVTUNER_Value = @import("../../zig.zig").Guid.initString("a799a800-a46d-11d0-a18c-00a02401dcd4"); pub const CLSID_KSCATEGORY_TVTUNER = &CLSID_KSCATEGORY_TVTUNER_Value; const CLSID_KSCATEGORY_CROSSBAR_Value = @import("../../zig.zig").Guid.initString("a799a801-a46d-11d0-a18c-00a02401dcd4"); pub const CLSID_KSCATEGORY_CROSSBAR = &CLSID_KSCATEGORY_CROSSBAR_Value; const CLSID_KSCATEGORY_TVAUDIO_Value = @import("../../zig.zig").Guid.initString("a799a802-a46d-11d0-a18c-00a02401dcd4"); pub const CLSID_KSCATEGORY_TVAUDIO = &CLSID_KSCATEGORY_TVAUDIO_Value; const CLSID_KSCATEGORY_VPMUX_Value = @import("../../zig.zig").Guid.initString("a799a803-a46d-11d0-a18c-00a02401dcd4"); pub const CLSID_KSCATEGORY_VPMUX = &CLSID_KSCATEGORY_VPMUX_Value; const CLSID_KSCATEGORY_VBICODEC_Value = @import("../../zig.zig").Guid.initString("07dad660-22f1-11d1-a9f4-00c04fbbde8f"); pub const CLSID_KSCATEGORY_VBICODEC = &CLSID_KSCATEGORY_VBICODEC_Value; const CLSID_KSDATAFORMAT_SUBTYPE_VPVideo_Value = @import("../../zig.zig").Guid.initString("5a9b6a40-1a22-11d1-bad9-00609744111a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_VPVideo = &CLSID_KSDATAFORMAT_SUBTYPE_VPVideo_Value; const CLSID_KSDATAFORMAT_SUBTYPE_VPVBI_Value = @import("../../zig.zig").Guid.initString("5a9b6a41-1a22-11d1-bad9-00609744111a"); pub const CLSID_KSDATAFORMAT_SUBTYPE_VPVBI = &CLSID_KSDATAFORMAT_SUBTYPE_VPVBI_Value; const CLSID_KSDATAFORMAT_SPECIFIER_VIDEOINFO_Value = @import("../../zig.zig").Guid.initString("05589f80-c356-11ce-bf01-00aa0055595a"); pub const CLSID_KSDATAFORMAT_SPECIFIER_VIDEOINFO = &CLSID_KSDATAFORMAT_SPECIFIER_VIDEOINFO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_VIDEOINFO2_Value = @import("../../zig.zig").Guid.initString("f72a76a0-eb0a-11d0-ace4-0000c0cc16ba"); pub const CLSID_KSDATAFORMAT_SPECIFIER_VIDEOINFO2 = &CLSID_KSDATAFORMAT_SPECIFIER_VIDEOINFO2_Value; const CLSID_KSDATAFORMAT_SPECIFIER_H264_VIDEO_Value = @import("../../zig.zig").Guid.initString("2017be05-6629-4248-aaed-7e1a47bc9b9c"); pub const CLSID_KSDATAFORMAT_SPECIFIER_H264_VIDEO = &CLSID_KSDATAFORMAT_SPECIFIER_H264_VIDEO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_JPEG_IMAGE_Value = @import("../../zig.zig").Guid.initString("692fa379-d3e8-4651-b5b4-0b94b013eeaf"); pub const CLSID_KSDATAFORMAT_SPECIFIER_JPEG_IMAGE = &CLSID_KSDATAFORMAT_SPECIFIER_JPEG_IMAGE_Value; const CLSID_KSDATAFORMAT_SPECIFIER_IMAGE_Value = @import("../../zig.zig").Guid.initString("692fa379-d3e8-4651-b5b4-0b94b013eeaf"); pub const CLSID_KSDATAFORMAT_SPECIFIER_IMAGE = &CLSID_KSDATAFORMAT_SPECIFIER_IMAGE_Value; const CLSID_KSDATAFORMAT_TYPE_IMAGE_Value = @import("../../zig.zig").Guid.initString("72178c23-e45b-11d5-bc2a-00b0d0f3f4ab"); pub const CLSID_KSDATAFORMAT_TYPE_IMAGE = &CLSID_KSDATAFORMAT_TYPE_IMAGE_Value; const CLSID_KSDATAFORMAT_SUBTYPE_JPEG_Value = @import("../../zig.zig").Guid.initString("19e4a5aa-5662-4fc5-a0c0-1758028e1057"); pub const CLSID_KSDATAFORMAT_SUBTYPE_JPEG = &CLSID_KSDATAFORMAT_SUBTYPE_JPEG_Value; const CLSID_KSDATAFORMAT_SUBTYPE_IMAGE_RGB32_Value = @import("../../zig.zig").Guid.initString("00000016-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_IMAGE_RGB32 = &CLSID_KSDATAFORMAT_SUBTYPE_IMAGE_RGB32_Value; const CLSID_KSDATAFORMAT_SUBTYPE_L8_Value = @import("../../zig.zig").Guid.initString("00000032-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_L8 = &CLSID_KSDATAFORMAT_SUBTYPE_L8_Value; const CLSID_KSDATAFORMAT_SUBTYPE_L8_IR_Value = @import("../../zig.zig").Guid.initString("00000032-0002-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_L8_IR = &CLSID_KSDATAFORMAT_SUBTYPE_L8_IR_Value; const CLSID_KSDATAFORMAT_SUBTYPE_L8_CUSTOM_Value = @import("../../zig.zig").Guid.initString("00000032-8000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_L8_CUSTOM = &CLSID_KSDATAFORMAT_SUBTYPE_L8_CUSTOM_Value; const CLSID_KSDATAFORMAT_SUBTYPE_L16_Value = @import("../../zig.zig").Guid.initString("00000051-0000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_L16 = &CLSID_KSDATAFORMAT_SUBTYPE_L16_Value; const CLSID_KSDATAFORMAT_SUBTYPE_L16_IR_Value = @import("../../zig.zig").Guid.initString("00000051-0002-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_L16_IR = &CLSID_KSDATAFORMAT_SUBTYPE_L16_IR_Value; const CLSID_KSDATAFORMAT_SUBTYPE_D16_Value = @import("../../zig.zig").Guid.initString("00000050-0004-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_D16 = &CLSID_KSDATAFORMAT_SUBTYPE_D16_Value; const CLSID_KSDATAFORMAT_SUBTYPE_L16_CUSTOM_Value = @import("../../zig.zig").Guid.initString("00000051-8000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_L16_CUSTOM = &CLSID_KSDATAFORMAT_SUBTYPE_L16_CUSTOM_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MJPG_IR_Value = @import("../../zig.zig").Guid.initString("47504a4d-0002-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MJPG_IR = &CLSID_KSDATAFORMAT_SUBTYPE_MJPG_IR_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MJPG_DEPTH_Value = @import("../../zig.zig").Guid.initString("47504a4d-0004-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MJPG_DEPTH = &CLSID_KSDATAFORMAT_SUBTYPE_MJPG_DEPTH_Value; const CLSID_KSDATAFORMAT_SUBTYPE_MJPG_CUSTOM_Value = @import("../../zig.zig").Guid.initString("47504a4d-8000-0010-8000-00aa00389b71"); pub const CLSID_KSDATAFORMAT_SUBTYPE_MJPG_CUSTOM = &CLSID_KSDATAFORMAT_SUBTYPE_MJPG_CUSTOM_Value; const CLSID_KSDATAFORMAT_TYPE_ANALOGVIDEO_Value = @import("../../zig.zig").Guid.initString("0482dde1-7817-11cf-8a03-00aa006ecb65"); pub const CLSID_KSDATAFORMAT_TYPE_ANALOGVIDEO = &CLSID_KSDATAFORMAT_TYPE_ANALOGVIDEO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_ANALOGVIDEO_Value = @import("../../zig.zig").Guid.initString("0482dde0-7817-11cf-8a03-00aa006ecb65"); pub const CLSID_KSDATAFORMAT_SPECIFIER_ANALOGVIDEO = &CLSID_KSDATAFORMAT_SPECIFIER_ANALOGVIDEO_Value; const CLSID_KSDATAFORMAT_TYPE_ANALOGAUDIO_Value = @import("../../zig.zig").Guid.initString("0482dee1-7817-11cf-8a03-00aa006ecb65"); pub const CLSID_KSDATAFORMAT_TYPE_ANALOGAUDIO = &CLSID_KSDATAFORMAT_TYPE_ANALOGAUDIO_Value; const CLSID_KSDATAFORMAT_SPECIFIER_VBI_Value = @import("../../zig.zig").Guid.initString("f72a76e0-eb0a-11d0-ace4-0000c0cc16ba"); pub const CLSID_KSDATAFORMAT_SPECIFIER_VBI = &CLSID_KSDATAFORMAT_SPECIFIER_VBI_Value; const CLSID_KSDATAFORMAT_TYPE_VBI_Value = @import("../../zig.zig").Guid.initString("f72a76e1-eb0a-11d0-ace4-0000c0cc16ba"); pub const CLSID_KSDATAFORMAT_TYPE_VBI = &CLSID_KSDATAFORMAT_TYPE_VBI_Value; const CLSID_KSDATAFORMAT_SUBTYPE_RAW8_Value = @import("../../zig.zig").Guid.initString("ca20d9a0-3e3e-11d1-9bf9-00c04fbbdebf"); pub const CLSID_KSDATAFORMAT_SUBTYPE_RAW8 = &CLSID_KSDATAFORMAT_SUBTYPE_RAW8_Value; const CLSID_KSDATAFORMAT_SUBTYPE_CC_Value = @import("../../zig.zig").Guid.initString("33214cc1-011f-11d2-b4b1-00a0d102cfbe"); pub const CLSID_KSDATAFORMAT_SUBTYPE_CC = &CLSID_KSDATAFORMAT_SUBTYPE_CC_Value; const CLSID_KSDATAFORMAT_SUBTYPE_NABTS_Value = @import("../../zig.zig").Guid.initString("f72a76e2-eb0a-11d0-ace4-0000c0cc16ba"); pub const CLSID_KSDATAFORMAT_SUBTYPE_NABTS = &CLSID_KSDATAFORMAT_SUBTYPE_NABTS_Value; const CLSID_KSDATAFORMAT_SUBTYPE_TELETEXT_Value = @import("../../zig.zig").Guid.initString("f72a76e3-eb0a-11d0-ace4-0000c0cc16ba"); pub const CLSID_KSDATAFORMAT_SUBTYPE_TELETEXT = &CLSID_KSDATAFORMAT_SUBTYPE_TELETEXT_Value; pub const KS_RGBQUAD = extern struct { rgbBlue: u8, rgbGreen: u8, rgbRed: u8, rgbReserved: u8, }; pub const KS_BITMAPINFOHEADER = extern struct { biSize: u32, biWidth: i32, biHeight: i32, biPlanes: u16, biBitCount: u16, biCompression: u32, biSizeImage: u32, biXPelsPerMeter: i32, biYPelsPerMeter: i32, biClrUsed: u32, biClrImportant: u32, }; pub const KS_TRUECOLORINFO = extern struct { dwBitMasks: [3]u32, bmiColors: [256]KS_RGBQUAD, }; pub const KS_VIDEOINFOHEADER = extern struct { rcSource: RECT, rcTarget: RECT, dwBitRate: u32, dwBitErrorRate: u32, AvgTimePerFrame: i64, bmiHeader: KS_BITMAPINFOHEADER, }; pub const KS_VIDEOINFO = extern struct { rcSource: RECT, rcTarget: RECT, dwBitRate: u32, dwBitErrorRate: u32, AvgTimePerFrame: i64, bmiHeader: KS_BITMAPINFOHEADER, Anonymous: extern union { bmiColors: [256]KS_RGBQUAD, dwBitMasks: [3]u32, TrueColorInfo: KS_TRUECOLORINFO, }, }; pub const KS_VBIINFOHEADER = extern struct { StartLine: u32, EndLine: u32, SamplingFrequency: u32, MinLineStartTime: u32, MaxLineStartTime: u32, ActualLineStartTime: u32, ActualLineEndTime: u32, VideoStandard: u32, SamplesPerLine: u32, StrideInBytes: u32, BufferSize: u32, }; pub const KS_AnalogVideoInfo = extern struct { rcSource: RECT, rcTarget: RECT, dwActiveWidth: u32, dwActiveHeight: u32, AvgTimePerFrame: i64, }; pub const KS_TVTUNER_CHANGE_INFO = extern struct { dwFlags: u32, dwCountryCode: u32, dwAnalogVideoStandard: u32, dwChannel: u32, }; pub const KS_MPEG2Level = enum(i32) { Low = 0, Main = 1, High1440 = 2, High = 3, }; pub const KS_MPEG2Level_Low = KS_MPEG2Level.Low; pub const KS_MPEG2Level_Main = KS_MPEG2Level.Main; pub const KS_MPEG2Level_High1440 = KS_MPEG2Level.High1440; pub const KS_MPEG2Level_High = KS_MPEG2Level.High; pub const KS_MPEG2Profile = enum(i32) { Simple = 0, Main = 1, SNRScalable = 2, SpatiallyScalable = 3, High = 4, }; pub const KS_MPEG2Profile_Simple = KS_MPEG2Profile.Simple; pub const KS_MPEG2Profile_Main = KS_MPEG2Profile.Main; pub const KS_MPEG2Profile_SNRScalable = KS_MPEG2Profile.SNRScalable; pub const KS_MPEG2Profile_SpatiallyScalable = KS_MPEG2Profile.SpatiallyScalable; pub const KS_MPEG2Profile_High = KS_MPEG2Profile.High; pub const KS_VIDEOINFOHEADER2 = extern struct { rcSource: RECT, rcTarget: RECT, dwBitRate: u32, dwBitErrorRate: u32, AvgTimePerFrame: i64, dwInterlaceFlags: u32, dwCopyProtectFlags: u32, dwPictAspectRatioX: u32, dwPictAspectRatioY: u32, Anonymous: extern union { dwControlFlags: u32, dwReserved1: u32, }, dwReserved2: u32, bmiHeader: KS_BITMAPINFOHEADER, }; pub const KS_MPEG1VIDEOINFO = extern struct { hdr: KS_VIDEOINFOHEADER, dwStartTimeCode: u32, cbSequenceHeader: u32, bSequenceHeader: [1]u8, }; pub const KS_MPEGVIDEOINFO2 = extern struct { hdr: KS_VIDEOINFOHEADER2, dwStartTimeCode: u32, cbSequenceHeader: u32, dwProfile: u32, dwLevel: u32, dwFlags: u32, bSequenceHeader: [1]u32, }; pub const KS_H264VIDEOINFO = extern struct { wWidth: u16, wHeight: u16, wSARwidth: u16, wSARheight: u16, wProfile: u16, bLevelIDC: u8, wConstrainedToolset: u16, bmSupportedUsages: u32, bmCapabilities: u16, bmSVCCapabilities: u32, bmMVCCapabilities: u32, dwFrameInterval: u32, bMaxCodecConfigDelay: u8, bmSupportedSliceModes: u8, bmSupportedSyncFrameTypes: u8, bResolutionScaling: u8, bSimulcastSupport: u8, bmSupportedRateControlModes: u8, wMaxMBperSecOneResolutionNoScalability: u16, wMaxMBperSecTwoResolutionsNoScalability: u16, wMaxMBperSecThreeResolutionsNoScalability: u16, wMaxMBperSecFourResolutionsNoScalability: u16, wMaxMBperSecOneResolutionTemporalScalability: u16, wMaxMBperSecTwoResolutionsTemporalScalablility: u16, wMaxMBperSecThreeResolutionsTemporalScalability: u16, wMaxMBperSecFourResolutionsTemporalScalability: u16, wMaxMBperSecOneResolutionTemporalQualityScalability: u16, wMaxMBperSecTwoResolutionsTemporalQualityScalability: u16, wMaxMBperSecThreeResolutionsTemporalQualityScalablity: u16, wMaxMBperSecFourResolutionsTemporalQualityScalability: u16, wMaxMBperSecOneResolutionTemporalSpatialScalability: u16, wMaxMBperSecTwoResolutionsTemporalSpatialScalability: u16, wMaxMBperSecThreeResolutionsTemporalSpatialScalablity: u16, wMaxMBperSecFourResolutionsTemporalSpatialScalability: u16, wMaxMBperSecOneResolutionFullScalability: u16, wMaxMBperSecTwoResolutionsFullScalability: u16, wMaxMBperSecThreeResolutionsFullScalability: u16, wMaxMBperSecFourResolutionsFullScalability: u16, }; pub const KS_MPEAUDIOINFO = extern struct { dwFlags: u32, dwReserved1: u32, dwReserved2: u32, dwReserved3: u32, }; pub const KS_DATAFORMAT_VIDEOINFOHEADER = extern struct { DataFormat: KSDATAFORMAT, VideoInfoHeader: KS_VIDEOINFOHEADER, }; pub const KS_DATAFORMAT_VIDEOINFOHEADER2 = extern struct { DataFormat: KSDATAFORMAT, VideoInfoHeader2: KS_VIDEOINFOHEADER2, }; pub const KS_DATAFORMAT_MPEGVIDEOINFO2 = extern struct { DataFormat: KSDATAFORMAT, MpegVideoInfoHeader2: KS_MPEGVIDEOINFO2, }; pub const KS_DATAFORMAT_H264VIDEOINFO = extern struct { DataFormat: KSDATAFORMAT, H264VideoInfoHeader: KS_H264VIDEOINFO, }; pub const KS_DATAFORMAT_IMAGEINFO = extern struct { DataFormat: KSDATAFORMAT, ImageInfoHeader: KS_BITMAPINFOHEADER, }; pub const KS_DATAFORMAT_VIDEOINFO_PALETTE = extern struct { DataFormat: KSDATAFORMAT, VideoInfo: KS_VIDEOINFO, }; pub const KS_DATAFORMAT_VBIINFOHEADER = extern struct { DataFormat: KSDATAFORMAT, VBIInfoHeader: KS_VBIINFOHEADER, }; pub const KS_VIDEO_STREAM_CONFIG_CAPS = extern struct { guid: Guid, VideoStandard: u32, InputSize: SIZE, MinCroppingSize: SIZE, MaxCroppingSize: SIZE, CropGranularityX: i32, CropGranularityY: i32, CropAlignX: i32, CropAlignY: i32, MinOutputSize: SIZE, MaxOutputSize: SIZE, OutputGranularityX: i32, OutputGranularityY: i32, StretchTapsX: i32, StretchTapsY: i32, ShrinkTapsX: i32, ShrinkTapsY: i32, MinFrameInterval: i64, MaxFrameInterval: i64, MinBitsPerSecond: i32, MaxBitsPerSecond: i32, }; pub const KS_DATARANGE_VIDEO = extern struct { DataRange: KSDATAFORMAT, bFixedSizeSamples: BOOL, bTemporalCompression: BOOL, StreamDescriptionFlags: u32, MemoryAllocationFlags: u32, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, VideoInfoHeader: KS_VIDEOINFOHEADER, }; pub const KS_DATARANGE_VIDEO2 = extern struct { DataRange: KSDATAFORMAT, bFixedSizeSamples: BOOL, bTemporalCompression: BOOL, StreamDescriptionFlags: u32, MemoryAllocationFlags: u32, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, VideoInfoHeader: KS_VIDEOINFOHEADER2, }; pub const KS_DATARANGE_MPEG1_VIDEO = extern struct { DataRange: KSDATAFORMAT, bFixedSizeSamples: BOOL, bTemporalCompression: BOOL, StreamDescriptionFlags: u32, MemoryAllocationFlags: u32, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, VideoInfoHeader: KS_MPEG1VIDEOINFO, }; pub const KS_DATARANGE_MPEG2_VIDEO = extern struct { DataRange: KSDATAFORMAT, bFixedSizeSamples: BOOL, bTemporalCompression: BOOL, StreamDescriptionFlags: u32, MemoryAllocationFlags: u32, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, VideoInfoHeader: KS_MPEGVIDEOINFO2, }; pub const KS_DATARANGE_H264_VIDEO = extern struct { DataRange: KSDATAFORMAT, bFixedSizeSamples: BOOL, bTemporalCompression: BOOL, StreamDescriptionFlags: u32, MemoryAllocationFlags: u32, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, VideoInfoHeader: KS_H264VIDEOINFO, }; pub const KS_DATARANGE_IMAGE = extern struct { DataRange: KSDATAFORMAT, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, ImageInfoHeader: KS_BITMAPINFOHEADER, }; pub const KS_DATARANGE_VIDEO_PALETTE = extern struct { DataRange: KSDATAFORMAT, bFixedSizeSamples: BOOL, bTemporalCompression: BOOL, StreamDescriptionFlags: u32, MemoryAllocationFlags: u32, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, VideoInfo: KS_VIDEOINFO, }; pub const KS_DATARANGE_VIDEO_VBI = extern struct { DataRange: KSDATAFORMAT, bFixedSizeSamples: BOOL, bTemporalCompression: BOOL, StreamDescriptionFlags: u32, MemoryAllocationFlags: u32, ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS, VBIInfoHeader: KS_VBIINFOHEADER, }; pub const KS_DATARANGE_ANALOGVIDEO = extern struct { DataRange: KSDATAFORMAT, AnalogVideoInfo: KS_AnalogVideoInfo, }; const CLSID_KSPROPSETID_VBICAP_PROPERTIES_Value = @import("../../zig.zig").Guid.initString("f162c607-7b35-496f-ad7f-2dca3b46b718"); pub const CLSID_KSPROPSETID_VBICAP_PROPERTIES = &CLSID_KSPROPSETID_VBICAP_PROPERTIES_Value; pub const KSPROPERTY_VBICAP = enum(i32) { N = 1, }; pub const KSPROPERTY_VBICAP_PROPERTIES_PROTECTION = KSPROPERTY_VBICAP.N; pub const VBICAP_PROPERTIES_PROTECTION_S = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, Status: u32, }; const CLSID_KSDATAFORMAT_TYPE_NABTS_Value = @import("../../zig.zig").Guid.initString("e757bca0-39ac-11d1-a9f5-00c04fbbde8f"); pub const CLSID_KSDATAFORMAT_TYPE_NABTS = &CLSID_KSDATAFORMAT_TYPE_NABTS_Value; const CLSID_KSDATAFORMAT_SUBTYPE_NABTS_FEC_Value = @import("../../zig.zig").Guid.initString("e757bca1-39ac-11d1-a9f5-00c04fbbde8f"); pub const CLSID_KSDATAFORMAT_SUBTYPE_NABTS_FEC = &CLSID_KSDATAFORMAT_SUBTYPE_NABTS_FEC_Value; pub const NABTSFEC_BUFFER = extern struct { dataSize: u32, groupID: u16, Reserved: u16, data: [448]u8, }; const CLSID_KSPROPSETID_VBICodecFiltering_Value = @import("../../zig.zig").Guid.initString("cafeb0ca-8715-11d0-bd6a-0035c0edbabe"); pub const CLSID_KSPROPSETID_VBICodecFiltering = &CLSID_KSPROPSETID_VBICodecFiltering_Value; pub const KSPROPERTY_VBICODECFILTERING = enum(i32) { CANLINES_REQUESTED_BIT_ARRAY = 1, CANLINES_DISCOVERED_BIT_ARRAY = 2, UBSTREAMS_REQUESTED_BIT_ARRAY = 3, UBSTREAMS_DISCOVERED_BIT_ARRAY = 4, TATISTICS = 5, }; pub const KSPROPERTY_VBICODECFILTERING_SCANLINES_REQUESTED_BIT_ARRAY = KSPROPERTY_VBICODECFILTERING.CANLINES_REQUESTED_BIT_ARRAY; pub const KSPROPERTY_VBICODECFILTERING_SCANLINES_DISCOVERED_BIT_ARRAY = KSPROPERTY_VBICODECFILTERING.CANLINES_DISCOVERED_BIT_ARRAY; pub const KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_REQUESTED_BIT_ARRAY = KSPROPERTY_VBICODECFILTERING.UBSTREAMS_REQUESTED_BIT_ARRAY; pub const KSPROPERTY_VBICODECFILTERING_SUBSTREAMS_DISCOVERED_BIT_ARRAY = KSPROPERTY_VBICODECFILTERING.UBSTREAMS_DISCOVERED_BIT_ARRAY; pub const KSPROPERTY_VBICODECFILTERING_STATISTICS = KSPROPERTY_VBICODECFILTERING.TATISTICS; pub const VBICODECFILTERING_SCANLINES = extern struct { DwordBitArray: [32]u32, }; pub const VBICODECFILTERING_NABTS_SUBSTREAMS = extern struct { SubstreamMask: [128]u32, }; pub const VBICODECFILTERING_CC_SUBSTREAMS = extern struct { SubstreamMask: u32, }; pub const CC_BYTE_PAIR = extern struct { Decoded: [2]u8, Reserved: u16, }; pub const CC_HW_FIELD = extern struct { ScanlinesRequested: VBICODECFILTERING_SCANLINES, fieldFlags: u32, PictureNumber: i64, Lines: [12]CC_BYTE_PAIR, }; pub const NABTS_BUFFER_LINE = extern struct { Confidence: u8, Bytes: [36]u8, }; pub const NABTS_BUFFER = packed struct { ScanlinesRequested: VBICODECFILTERING_SCANLINES, PictureNumber: i64, NabtsLines: [11]NABTS_BUFFER_LINE, }; pub const WST_BUFFER_LINE = extern struct { Confidence: u8, Bytes: [42]u8, }; pub const WST_BUFFER = extern struct { ScanlinesRequested: VBICODECFILTERING_SCANLINES, WstLines: [17]WST_BUFFER_LINE, }; pub const VBICODECFILTERING_STATISTICS_COMMON = extern struct { InputSRBsProcessed: u32, OutputSRBsProcessed: u32, SRBsIgnored: u32, InputSRBsMissing: u32, OutputSRBsMissing: u32, OutputFailures: u32, InternalErrors: u32, ExternalErrors: u32, InputDiscontinuities: u32, DSPFailures: u32, TvTunerChanges: u32, VBIHeaderChanges: u32, LineConfidenceAvg: u32, BytesOutput: u32, }; pub const VBICODECFILTERING_STATISTICS_COMMON_PIN = extern struct { SRBsProcessed: u32, SRBsIgnored: u32, SRBsMissing: u32, InternalErrors: u32, ExternalErrors: u32, Discontinuities: u32, LineConfidenceAvg: u32, BytesOutput: u32, }; pub const VBICODECFILTERING_STATISTICS_NABTS = extern struct { Common: VBICODECFILTERING_STATISTICS_COMMON, FECBundleBadLines: u32, FECQueueOverflows: u32, FECCorrectedLines: u32, FECUncorrectableLines: u32, BundlesProcessed: u32, BundlesSent2IP: u32, FilteredLines: u32, }; pub const VBICODECFILTERING_STATISTICS_NABTS_PIN = extern struct { Common: VBICODECFILTERING_STATISTICS_COMMON_PIN, }; pub const VBICODECFILTERING_STATISTICS_CC = extern struct { Common: VBICODECFILTERING_STATISTICS_COMMON, }; pub const VBICODECFILTERING_STATISTICS_CC_PIN = extern struct { Common: VBICODECFILTERING_STATISTICS_COMMON_PIN, }; pub const VBICODECFILTERING_STATISTICS_TELETEXT = extern struct { Common: VBICODECFILTERING_STATISTICS_COMMON, }; pub const VBICODECFILTERING_STATISTICS_TELETEXT_PIN = extern struct { Common: VBICODECFILTERING_STATISTICS_COMMON_PIN, }; pub const KSPROPERTY_VBICODECFILTERING_SCANLINES_S = extern struct { Property: KSIDENTIFIER, Scanlines: VBICODECFILTERING_SCANLINES, }; pub const KSPROPERTY_VBICODECFILTERING_NABTS_SUBSTREAMS_S = extern struct { Property: KSIDENTIFIER, Substreams: VBICODECFILTERING_NABTS_SUBSTREAMS, }; pub const KSPROPERTY_VBICODECFILTERING_CC_SUBSTREAMS_S = extern struct { Property: KSIDENTIFIER, Substreams: VBICODECFILTERING_CC_SUBSTREAMS, }; pub const KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_S = extern struct { Property: KSIDENTIFIER, Statistics: VBICODECFILTERING_STATISTICS_COMMON, }; pub const KSPROPERTY_VBICODECFILTERING_STATISTICS_COMMON_PIN_S = extern struct { Property: KSIDENTIFIER, Statistics: VBICODECFILTERING_STATISTICS_COMMON_PIN, }; pub const KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_S = extern struct { Property: KSIDENTIFIER, Statistics: VBICODECFILTERING_STATISTICS_NABTS, }; pub const KSPROPERTY_VBICODECFILTERING_STATISTICS_NABTS_PIN_S = extern struct { Property: KSIDENTIFIER, Statistics: VBICODECFILTERING_STATISTICS_NABTS_PIN, }; pub const KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_S = extern struct { Property: KSIDENTIFIER, Statistics: VBICODECFILTERING_STATISTICS_CC, }; pub const KSPROPERTY_VBICODECFILTERING_STATISTICS_CC_PIN_S = extern struct { Property: KSIDENTIFIER, Statistics: VBICODECFILTERING_STATISTICS_CC_PIN, }; const CLSID_PINNAME_VIDEO_CAPTURE_Value = @import("../../zig.zig").Guid.initString("fb6c4281-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_CAPTURE = &CLSID_PINNAME_VIDEO_CAPTURE_Value; const CLSID_PINNAME_VIDEO_CC_CAPTURE_Value = @import("../../zig.zig").Guid.initString("1aad8061-012d-11d2-b4b1-00a0d102cfbe"); pub const CLSID_PINNAME_VIDEO_CC_CAPTURE = &CLSID_PINNAME_VIDEO_CC_CAPTURE_Value; const CLSID_PINNAME_VIDEO_NABTS_CAPTURE_Value = @import("../../zig.zig").Guid.initString("29703660-498a-11d2-b4b1-00a0d102cfbe"); pub const CLSID_PINNAME_VIDEO_NABTS_CAPTURE = &CLSID_PINNAME_VIDEO_NABTS_CAPTURE_Value; const CLSID_PINNAME_VIDEO_PREVIEW_Value = @import("../../zig.zig").Guid.initString("fb6c4282-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_PREVIEW = &CLSID_PINNAME_VIDEO_PREVIEW_Value; const CLSID_PINNAME_VIDEO_ANALOGVIDEOIN_Value = @import("../../zig.zig").Guid.initString("fb6c4283-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_ANALOGVIDEOIN = &CLSID_PINNAME_VIDEO_ANALOGVIDEOIN_Value; const CLSID_PINNAME_VIDEO_VBI_Value = @import("../../zig.zig").Guid.initString("fb6c4284-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_VBI = &CLSID_PINNAME_VIDEO_VBI_Value; const CLSID_PINNAME_VIDEO_VIDEOPORT_Value = @import("../../zig.zig").Guid.initString("fb6c4285-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_VIDEOPORT = &CLSID_PINNAME_VIDEO_VIDEOPORT_Value; const CLSID_PINNAME_VIDEO_NABTS_Value = @import("../../zig.zig").Guid.initString("fb6c4286-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_NABTS = &CLSID_PINNAME_VIDEO_NABTS_Value; const CLSID_PINNAME_VIDEO_EDS_Value = @import("../../zig.zig").Guid.initString("fb6c4287-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_EDS = &CLSID_PINNAME_VIDEO_EDS_Value; const CLSID_PINNAME_VIDEO_TELETEXT_Value = @import("../../zig.zig").Guid.initString("fb6c4288-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_TELETEXT = &CLSID_PINNAME_VIDEO_TELETEXT_Value; const CLSID_PINNAME_VIDEO_CC_Value = @import("../../zig.zig").Guid.initString("fb6c4289-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_CC = &CLSID_PINNAME_VIDEO_CC_Value; const CLSID_PINNAME_VIDEO_STILL_Value = @import("../../zig.zig").Guid.initString("fb6c428a-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_STILL = &CLSID_PINNAME_VIDEO_STILL_Value; const CLSID_PINNAME_IMAGE_Value = @import("../../zig.zig").Guid.initString("38a0cd98-d49b-4ce8-b48a-344667a17830"); pub const CLSID_PINNAME_IMAGE = &CLSID_PINNAME_IMAGE_Value; const CLSID_PINNAME_VIDEO_TIMECODE_Value = @import("../../zig.zig").Guid.initString("fb6c428b-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_TIMECODE = &CLSID_PINNAME_VIDEO_TIMECODE_Value; const CLSID_PINNAME_VIDEO_VIDEOPORT_VBI_Value = @import("../../zig.zig").Guid.initString("fb6c428c-0353-11d1-905f-0000c0cc16ba"); pub const CLSID_PINNAME_VIDEO_VIDEOPORT_VBI = &CLSID_PINNAME_VIDEO_VIDEOPORT_VBI_Value; pub const CAPTURE_MEMORY_ALLOCATION_FLAGS = enum(i32) { INVALID = 0, SYSTEM = 1, VRAM = 2, SYSTEM_AGP = 4, VRAM_MAPPED = 8, SECURE_BUFFER = 16, }; pub const KS_CAPTURE_ALLOC_INVALID = CAPTURE_MEMORY_ALLOCATION_FLAGS.INVALID; pub const KS_CAPTURE_ALLOC_SYSTEM = CAPTURE_MEMORY_ALLOCATION_FLAGS.SYSTEM; pub const KS_CAPTURE_ALLOC_VRAM = CAPTURE_MEMORY_ALLOCATION_FLAGS.VRAM; pub const KS_CAPTURE_ALLOC_SYSTEM_AGP = CAPTURE_MEMORY_ALLOCATION_FLAGS.SYSTEM_AGP; pub const KS_CAPTURE_ALLOC_VRAM_MAPPED = CAPTURE_MEMORY_ALLOCATION_FLAGS.VRAM_MAPPED; pub const KS_CAPTURE_ALLOC_SECURE_BUFFER = CAPTURE_MEMORY_ALLOCATION_FLAGS.SECURE_BUFFER; const CLSID_KSPROPSETID_VramCapture_Value = @import("../../zig.zig").Guid.initString("e73face3-2880-4902-b799-88d0cd634e0f"); pub const CLSID_KSPROPSETID_VramCapture = &CLSID_KSPROPSETID_VramCapture_Value; pub const KSPROPERTY_VIDMEM_TRANSPORT = enum(i32) { DISPLAY_ADAPTER_GUID = 1, PREFERRED_CAPTURE_SURFACE = 2, CURRENT_CAPTURE_SURFACE = 3, MAP_CAPTURE_HANDLE_TO_VRAM_ADDRESS = 4, }; pub const KSPROPERTY_DISPLAY_ADAPTER_GUID = KSPROPERTY_VIDMEM_TRANSPORT.DISPLAY_ADAPTER_GUID; pub const KSPROPERTY_PREFERRED_CAPTURE_SURFACE = KSPROPERTY_VIDMEM_TRANSPORT.PREFERRED_CAPTURE_SURFACE; pub const KSPROPERTY_CURRENT_CAPTURE_SURFACE = KSPROPERTY_VIDMEM_TRANSPORT.CURRENT_CAPTURE_SURFACE; pub const KSPROPERTY_MAP_CAPTURE_HANDLE_TO_VRAM_ADDRESS = KSPROPERTY_VIDMEM_TRANSPORT.MAP_CAPTURE_HANDLE_TO_VRAM_ADDRESS; pub const VRAM_SURFACE_INFO = extern struct { hSurface: usize, VramPhysicalAddress: i64, cbCaptured: u32, dwWidth: u32, dwHeight: u32, dwLinearSize: u32, lPitch: i32, ullReserved: [16]u64, }; pub const VRAM_SURFACE_INFO_PROPERTY_S = extern struct { Property: KSIDENTIFIER, pVramSurfaceInfo: ?*VRAM_SURFACE_INFO, }; pub const SECURE_BUFFER_INFO = extern struct { guidBufferIdentifier: Guid, cbBufferSize: u32, cbCaptured: u32, ullReserved: [16]u64, }; const CLSID_KS_SECURE_CAMERA_SCENARIO_ID_Value = @import("../../zig.zig").Guid.initString("ae53fc6e-8d89-4488-9d2e-4d008731c5fd"); pub const CLSID_KS_SECURE_CAMERA_SCENARIO_ID = &CLSID_KS_SECURE_CAMERA_SCENARIO_ID_Value; const CLSID_KSPROPSETID_MPEG4_MediaType_Attributes_Value = @import("../../zig.zig").Guid.initString("ff6c4bfa-07a9-4c7b-a237-672f9d68065f"); pub const CLSID_KSPROPSETID_MPEG4_MediaType_Attributes = &CLSID_KSPROPSETID_MPEG4_MediaType_Attributes_Value; pub const KSPROPERTY_MPEG4_MEDIATYPE_ATTRIBUTES = enum(i32) { X = 1, }; pub const KSPROPERTY_MPEG4_MEDIATYPE_SD_BOX = KSPROPERTY_MPEG4_MEDIATYPE_ATTRIBUTES.X; const CLSID_KSEVENTSETID_DynamicFormatChange_Value = @import("../../zig.zig").Guid.initString("162ac456-83d7-4239-96df-c75ffa138bc6"); pub const CLSID_KSEVENTSETID_DynamicFormatChange = &CLSID_KSEVENTSETID_DynamicFormatChange_Value; pub const KSEVENT_DYNAMICFORMATCHANGE = enum(i32) { E = 0, }; pub const KSEVENT_DYNAMIC_FORMAT_CHANGE = KSEVENT_DYNAMICFORMATCHANGE.E; pub const KS_FRAME_INFO = extern struct { ExtendedHeaderSize: u32, dwFrameFlags: u32, PictureNumber: i64, DropCount: i64, hDirectDraw: ?HANDLE, hSurfaceHandle: ?HANDLE, DirectDrawRect: RECT, Anonymous1: extern union { lSurfacePitch: i32, Reserved1: u32, }, Reserved2: u32, Anonymous2: extern union { Anonymous: extern struct { Reserved3: u32, Reserved4: u32, }, FrameCompletionNumber: u64, }, }; pub const KS_VBI_FRAME_INFO = extern struct { ExtendedHeaderSize: u32, dwFrameFlags: u32, PictureNumber: i64, DropCount: i64, dwSamplingFrequency: u32, TvTunerChangeInfo: KS_TVTUNER_CHANGE_INFO, VBIInfoHeader: KS_VBIINFOHEADER, }; pub const KS_AnalogVideoStandard = enum(i32) { None = 0, NTSC_M = 1, NTSC_M_J = 2, NTSC_433 = 4, PAL_B = 16, PAL_D = 32, PAL_G = 64, PAL_H = 128, PAL_I = 256, PAL_M = 512, PAL_N = 1024, PAL_60 = 2048, SECAM_B = 4096, SECAM_D = 8192, SECAM_G = 16384, SECAM_H = 32768, SECAM_K = 65536, SECAM_K1 = 131072, SECAM_L = 262144, SECAM_L1 = 524288, PAL_N_COMBO = 1048576, }; pub const KS_AnalogVideo_None = KS_AnalogVideoStandard.None; pub const KS_AnalogVideo_NTSC_M = KS_AnalogVideoStandard.NTSC_M; pub const KS_AnalogVideo_NTSC_M_J = KS_AnalogVideoStandard.NTSC_M_J; pub const KS_AnalogVideo_NTSC_433 = KS_AnalogVideoStandard.NTSC_433; pub const KS_AnalogVideo_PAL_B = KS_AnalogVideoStandard.PAL_B; pub const KS_AnalogVideo_PAL_D = KS_AnalogVideoStandard.PAL_D; pub const KS_AnalogVideo_PAL_G = KS_AnalogVideoStandard.PAL_G; pub const KS_AnalogVideo_PAL_H = KS_AnalogVideoStandard.PAL_H; pub const KS_AnalogVideo_PAL_I = KS_AnalogVideoStandard.PAL_I; pub const KS_AnalogVideo_PAL_M = KS_AnalogVideoStandard.PAL_M; pub const KS_AnalogVideo_PAL_N = KS_AnalogVideoStandard.PAL_N; pub const KS_AnalogVideo_PAL_60 = KS_AnalogVideoStandard.PAL_60; pub const KS_AnalogVideo_SECAM_B = KS_AnalogVideoStandard.SECAM_B; pub const KS_AnalogVideo_SECAM_D = KS_AnalogVideoStandard.SECAM_D; pub const KS_AnalogVideo_SECAM_G = KS_AnalogVideoStandard.SECAM_G; pub const KS_AnalogVideo_SECAM_H = KS_AnalogVideoStandard.SECAM_H; pub const KS_AnalogVideo_SECAM_K = KS_AnalogVideoStandard.SECAM_K; pub const KS_AnalogVideo_SECAM_K1 = KS_AnalogVideoStandard.SECAM_K1; pub const KS_AnalogVideo_SECAM_L = KS_AnalogVideoStandard.SECAM_L; pub const KS_AnalogVideo_SECAM_L1 = KS_AnalogVideoStandard.SECAM_L1; pub const KS_AnalogVideo_PAL_N_COMBO = KS_AnalogVideoStandard.PAL_N_COMBO; const CLSID_PROPSETID_ALLOCATOR_CONTROL_Value = @import("../../zig.zig").Guid.initString("53171960-148e-11d2-9979-0000c0cc16ba"); pub const CLSID_PROPSETID_ALLOCATOR_CONTROL = &CLSID_PROPSETID_ALLOCATOR_CONTROL_Value; pub const KSPROPERTY_ALLOCATOR_CONTROL = enum(i32) { HONOR_COUNT = 0, SURFACE_SIZE = 1, CAPTURE_CAPS = 2, CAPTURE_INTERLEAVE = 3, }; pub const KSPROPERTY_ALLOCATOR_CONTROL_HONOR_COUNT = KSPROPERTY_ALLOCATOR_CONTROL.HONOR_COUNT; pub const KSPROPERTY_ALLOCATOR_CONTROL_SURFACE_SIZE = KSPROPERTY_ALLOCATOR_CONTROL.SURFACE_SIZE; pub const KSPROPERTY_ALLOCATOR_CONTROL_CAPTURE_CAPS = KSPROPERTY_ALLOCATOR_CONTROL.CAPTURE_CAPS; pub const KSPROPERTY_ALLOCATOR_CONTROL_CAPTURE_INTERLEAVE = KSPROPERTY_ALLOCATOR_CONTROL.CAPTURE_INTERLEAVE; pub const KSPROPERTY_ALLOCATOR_CONTROL_SURFACE_SIZE_S = extern struct { CX: u32, CY: u32, }; pub const KSPROPERTY_ALLOCATOR_CONTROL_CAPTURE_CAPS_S = extern struct { InterleavedCapSupported: u32, }; pub const KSPROPERTY_ALLOCATOR_CONTROL_CAPTURE_INTERLEAVE_S = extern struct { InterleavedCapPossible: u32, }; const CLSID_PROPSETID_VIDCAP_VIDEOPROCAMP_Value = @import("../../zig.zig").Guid.initString("c6e13360-30ac-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_VIDEOPROCAMP = &CLSID_PROPSETID_VIDCAP_VIDEOPROCAMP_Value; pub const KSPROPERTY_VIDCAP_VIDEOPROCAMP = enum(i32) { BRIGHTNESS = 0, CONTRAST = 1, HUE = 2, SATURATION = 3, SHARPNESS = 4, GAMMA = 5, COLORENABLE = 6, WHITEBALANCE = 7, BACKLIGHT_COMPENSATION = 8, GAIN = 9, DIGITAL_MULTIPLIER = 10, DIGITAL_MULTIPLIER_LIMIT = 11, WHITEBALANCE_COMPONENT = 12, POWERLINE_FREQUENCY = 13, }; pub const KSPROPERTY_VIDEOPROCAMP_BRIGHTNESS = KSPROPERTY_VIDCAP_VIDEOPROCAMP.BRIGHTNESS; pub const KSPROPERTY_VIDEOPROCAMP_CONTRAST = KSPROPERTY_VIDCAP_VIDEOPROCAMP.CONTRAST; pub const KSPROPERTY_VIDEOPROCAMP_HUE = KSPROPERTY_VIDCAP_VIDEOPROCAMP.HUE; pub const KSPROPERTY_VIDEOPROCAMP_SATURATION = KSPROPERTY_VIDCAP_VIDEOPROCAMP.SATURATION; pub const KSPROPERTY_VIDEOPROCAMP_SHARPNESS = KSPROPERTY_VIDCAP_VIDEOPROCAMP.SHARPNESS; pub const KSPROPERTY_VIDEOPROCAMP_GAMMA = KSPROPERTY_VIDCAP_VIDEOPROCAMP.GAMMA; pub const KSPROPERTY_VIDEOPROCAMP_COLORENABLE = KSPROPERTY_VIDCAP_VIDEOPROCAMP.COLORENABLE; pub const KSPROPERTY_VIDEOPROCAMP_WHITEBALANCE = KSPROPERTY_VIDCAP_VIDEOPROCAMP.WHITEBALANCE; pub const KSPROPERTY_VIDEOPROCAMP_BACKLIGHT_COMPENSATION = KSPROPERTY_VIDCAP_VIDEOPROCAMP.BACKLIGHT_COMPENSATION; pub const KSPROPERTY_VIDEOPROCAMP_GAIN = KSPROPERTY_VIDCAP_VIDEOPROCAMP.GAIN; pub const KSPROPERTY_VIDEOPROCAMP_DIGITAL_MULTIPLIER = KSPROPERTY_VIDCAP_VIDEOPROCAMP.DIGITAL_MULTIPLIER; pub const KSPROPERTY_VIDEOPROCAMP_DIGITAL_MULTIPLIER_LIMIT = KSPROPERTY_VIDCAP_VIDEOPROCAMP.DIGITAL_MULTIPLIER_LIMIT; pub const KSPROPERTY_VIDEOPROCAMP_WHITEBALANCE_COMPONENT = KSPROPERTY_VIDCAP_VIDEOPROCAMP.WHITEBALANCE_COMPONENT; pub const KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY = KSPROPERTY_VIDCAP_VIDEOPROCAMP.POWERLINE_FREQUENCY; pub const KSPROPERTY_VIDEOPROCAMP_S = extern struct { Property: KSIDENTIFIER, Value: i32, Flags: u32, Capabilities: u32, }; pub const KSPROPERTY_VIDEOPROCAMP_NODE_S = extern struct { NodeProperty: KSP_NODE, Value: i32, Flags: u32, Capabilities: u32, }; pub const KSPROPERTY_VIDEOPROCAMP_S2 = extern struct { Property: KSIDENTIFIER, Value1: i32, Flags: u32, Capabilities: u32, Value2: i32, }; pub const KSPROPERTY_VIDEOPROCAMP_NODE_S2 = extern struct { NodeProperty: KSP_NODE, Value1: i32, Flags: u32, Capabilities: u32, Value2: i32, }; const CLSID_PROPSETID_VIDCAP_SELECTOR_Value = @import("../../zig.zig").Guid.initString("1abdaeca-68b6-4f83-9371-b413907c7b9f"); pub const CLSID_PROPSETID_VIDCAP_SELECTOR = &CLSID_PROPSETID_VIDCAP_SELECTOR_Value; pub const KSPROPERTY_VIDCAP_SELECTOR = enum(i32) { SOURCE_NODE_ID = 0, NUM_SOURCES = 1, }; pub const KSPROPERTY_SELECTOR_SOURCE_NODE_ID = KSPROPERTY_VIDCAP_SELECTOR.SOURCE_NODE_ID; pub const KSPROPERTY_SELECTOR_NUM_SOURCES = KSPROPERTY_VIDCAP_SELECTOR.NUM_SOURCES; pub const KSPROPERTY_SELECTOR_S = extern struct { Property: KSIDENTIFIER, Value: i32, Flags: u32, Capabilities: u32, }; pub const KSPROPERTY_SELECTOR_NODE_S = extern struct { NodeProperty: KSP_NODE, Value: i32, Flags: u32, Capabilities: u32, }; const CLSID_PROPSETID_TUNER_Value = @import("../../zig.zig").Guid.initString("6a2e0605-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_TUNER = &CLSID_PROPSETID_TUNER_Value; pub const KSPROPERTY_TUNER = enum(i32) { CAPS = 0, MODE_CAPS = 1, MODE = 2, STANDARD = 3, FREQUENCY = 4, INPUT = 5, STATUS = 6, IF_MEDIUM = 7, SCAN_CAPS = 8, SCAN_STATUS = 9, STANDARD_MODE = 10, NETWORKTYPE_SCAN_CAPS = 11, }; pub const KSPROPERTY_TUNER_CAPS = KSPROPERTY_TUNER.CAPS; pub const KSPROPERTY_TUNER_MODE_CAPS = KSPROPERTY_TUNER.MODE_CAPS; pub const KSPROPERTY_TUNER_MODE = KSPROPERTY_TUNER.MODE; pub const KSPROPERTY_TUNER_STANDARD = KSPROPERTY_TUNER.STANDARD; pub const KSPROPERTY_TUNER_FREQUENCY = KSPROPERTY_TUNER.FREQUENCY; pub const KSPROPERTY_TUNER_INPUT = KSPROPERTY_TUNER.INPUT; pub const KSPROPERTY_TUNER_STATUS = KSPROPERTY_TUNER.STATUS; pub const KSPROPERTY_TUNER_IF_MEDIUM = KSPROPERTY_TUNER.IF_MEDIUM; pub const KSPROPERTY_TUNER_SCAN_CAPS = KSPROPERTY_TUNER.SCAN_CAPS; pub const KSPROPERTY_TUNER_SCAN_STATUS = KSPROPERTY_TUNER.SCAN_STATUS; pub const KSPROPERTY_TUNER_STANDARD_MODE = KSPROPERTY_TUNER.STANDARD_MODE; pub const KSPROPERTY_TUNER_NETWORKTYPE_SCAN_CAPS = KSPROPERTY_TUNER.NETWORKTYPE_SCAN_CAPS; pub const KSPROPERTY_TUNER_MODES = enum(i32) { TV = 1, FM_RADIO = 2, AM_RADIO = 4, DSS = 8, ATSC = 16, }; pub const KSPROPERTY_TUNER_MODE_TV = KSPROPERTY_TUNER_MODES.TV; pub const KSPROPERTY_TUNER_MODE_FM_RADIO = KSPROPERTY_TUNER_MODES.FM_RADIO; pub const KSPROPERTY_TUNER_MODE_AM_RADIO = KSPROPERTY_TUNER_MODES.AM_RADIO; pub const KSPROPERTY_TUNER_MODE_DSS = KSPROPERTY_TUNER_MODES.DSS; pub const KSPROPERTY_TUNER_MODE_ATSC = KSPROPERTY_TUNER_MODES.ATSC; pub const KS_TUNER_TUNING_FLAGS = enum(i32) { EXACT = 1, FINE = 2, COARSE = 3, }; pub const KS_TUNER_TUNING_EXACT = KS_TUNER_TUNING_FLAGS.EXACT; pub const KS_TUNER_TUNING_FINE = KS_TUNER_TUNING_FLAGS.FINE; pub const KS_TUNER_TUNING_COARSE = KS_TUNER_TUNING_FLAGS.COARSE; pub const KS_TUNER_STRATEGY = enum(i32) { PLL = 1, SIGNAL_STRENGTH = 2, DRIVER_TUNES = 4, }; pub const KS_TUNER_STRATEGY_PLL = KS_TUNER_STRATEGY.PLL; pub const KS_TUNER_STRATEGY_SIGNAL_STRENGTH = KS_TUNER_STRATEGY.SIGNAL_STRENGTH; pub const KS_TUNER_STRATEGY_DRIVER_TUNES = KS_TUNER_STRATEGY.DRIVER_TUNES; pub const KSPROPERTY_TUNER_CAPS_S = extern struct { Property: KSIDENTIFIER, ModesSupported: u32, VideoMedium: KSIDENTIFIER, TVAudioMedium: KSIDENTIFIER, RadioAudioMedium: KSIDENTIFIER, }; pub const KSPROPERTY_TUNER_IF_MEDIUM_S = extern struct { Property: KSIDENTIFIER, IFMedium: KSIDENTIFIER, }; pub const KSPROPERTY_TUNER_MODE_CAPS_S = extern struct { Property: KSIDENTIFIER, Mode: u32, StandardsSupported: u32, MinFrequency: u32, MaxFrequency: u32, TuningGranularity: u32, NumberOfInputs: u32, SettlingTime: u32, Strategy: u32, }; pub const KSPROPERTY_TUNER_MODE_S = extern struct { Property: KSIDENTIFIER, Mode: u32, }; pub const KSPROPERTY_TUNER_FREQUENCY_S = extern struct { Property: KSIDENTIFIER, Frequency: u32, LastFrequency: u32, TuningFlags: u32, VideoSubChannel: u32, AudioSubChannel: u32, Channel: u32, Country: u32, }; pub const KSPROPERTY_TUNER_STANDARD_S = extern struct { Property: KSIDENTIFIER, Standard: u32, }; pub const KSPROPERTY_TUNER_STANDARD_MODE_S = extern struct { Property: KSIDENTIFIER, AutoDetect: BOOL, }; pub const KSPROPERTY_TUNER_INPUT_S = extern struct { Property: KSIDENTIFIER, InputIndex: u32, }; pub const KSPROPERTY_TUNER_STATUS_S = extern struct { Property: KSIDENTIFIER, CurrentFrequency: u32, PLLOffset: u32, SignalStrength: u32, Busy: u32, }; pub const _TunerDecoderLockType = enum(i32) { None = 0, Within_Scan_Sensing_Range = 1, Locked = 2, }; pub const Tuner_LockType_None = _TunerDecoderLockType.None; pub const Tuner_LockType_Within_Scan_Sensing_Range = _TunerDecoderLockType.Within_Scan_Sensing_Range; pub const Tuner_LockType_Locked = _TunerDecoderLockType.Locked; pub const TUNER_ANALOG_CAPS_S = extern struct { Mode: u32, StandardsSupported: u32, MinFrequency: u32, MaxFrequency: u32, TuningGranularity: u32, SettlingTime: u32, ScanSensingRange: u32, FineTuneSensingRange: u32, }; const CLSID_EVENTSETID_TUNER_Value = @import("../../zig.zig").Guid.initString("6a2e0606-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_EVENTSETID_TUNER = &CLSID_EVENTSETID_TUNER_Value; pub const KSEVENT_TUNER = enum(i32) { CHANGED = 0, INITIATE_SCAN = 1, }; pub const KSEVENT_TUNER_CHANGED = KSEVENT_TUNER.CHANGED; pub const KSEVENT_TUNER_INITIATE_SCAN = KSEVENT_TUNER.INITIATE_SCAN; pub const KSPROPERTY_TUNER_SCAN_CAPS_S = extern struct { Property: KSIDENTIFIER, fSupportsHardwareAssistedScanning: BOOL, SupportedBroadcastStandards: u32, GUIDBucket: ?*c_void, lengthofBucket: u32, }; pub const KSPROPERTY_TUNER_NETWORKTYPE_SCAN_CAPS_S = extern struct { Property: KSIDENTIFIER, NetworkType: Guid, BufferSize: u32, NetworkTunerCapabilities: ?*c_void, }; pub const KSPROPERTY_TUNER_SCAN_STATUS_S = extern struct { Property: KSIDENTIFIER, LockStatus: _TunerDecoderLockType, CurrentFrequency: u32, }; pub const KSEVENT_TUNER_INITIATE_SCAN_S = extern struct { EventData: KSEVENTDATA, StartFrequency: u32, EndFrequency: u32, }; const CLSID_KSNODETYPE_VIDEO_STREAMING_Value = @import("../../zig.zig").Guid.initString("dff229e1-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_STREAMING = &CLSID_KSNODETYPE_VIDEO_STREAMING_Value; const CLSID_KSNODETYPE_VIDEO_INPUT_TERMINAL_Value = @import("../../zig.zig").Guid.initString("dff229e2-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_INPUT_TERMINAL = &CLSID_KSNODETYPE_VIDEO_INPUT_TERMINAL_Value; const CLSID_KSNODETYPE_VIDEO_OUTPUT_TERMINAL_Value = @import("../../zig.zig").Guid.initString("dff229e3-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_OUTPUT_TERMINAL = &CLSID_KSNODETYPE_VIDEO_OUTPUT_TERMINAL_Value; const CLSID_KSNODETYPE_VIDEO_SELECTOR_Value = @import("../../zig.zig").Guid.initString("dff229e4-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_SELECTOR = &CLSID_KSNODETYPE_VIDEO_SELECTOR_Value; const CLSID_KSNODETYPE_VIDEO_PROCESSING_Value = @import("../../zig.zig").Guid.initString("dff229e5-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_PROCESSING = &CLSID_KSNODETYPE_VIDEO_PROCESSING_Value; const CLSID_KSNODETYPE_VIDEO_CAMERA_TERMINAL_Value = @import("../../zig.zig").Guid.initString("dff229e6-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_CAMERA_TERMINAL = &CLSID_KSNODETYPE_VIDEO_CAMERA_TERMINAL_Value; const CLSID_KSNODETYPE_VIDEO_INPUT_MTT_Value = @import("../../zig.zig").Guid.initString("dff229e7-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_INPUT_MTT = &CLSID_KSNODETYPE_VIDEO_INPUT_MTT_Value; const CLSID_KSNODETYPE_VIDEO_OUTPUT_MTT_Value = @import("../../zig.zig").Guid.initString("dff229e8-f70f-11d0-b917-00a0c9223196"); pub const CLSID_KSNODETYPE_VIDEO_OUTPUT_MTT = &CLSID_KSNODETYPE_VIDEO_OUTPUT_MTT_Value; const CLSID_PROPSETID_VIDCAP_VIDEOENCODER_Value = @import("../../zig.zig").Guid.initString("6a2e0610-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_VIDEOENCODER = &CLSID_PROPSETID_VIDCAP_VIDEOENCODER_Value; pub const KSPROPERTY_VIDCAP_VIDEOENCODER = enum(i32) { CAPS = 0, STANDARD = 1, COPYPROTECTION = 2, CC_ENABLE = 3, }; pub const KSPROPERTY_VIDEOENCODER_CAPS = KSPROPERTY_VIDCAP_VIDEOENCODER.CAPS; pub const KSPROPERTY_VIDEOENCODER_STANDARD = KSPROPERTY_VIDCAP_VIDEOENCODER.STANDARD; pub const KSPROPERTY_VIDEOENCODER_COPYPROTECTION = KSPROPERTY_VIDCAP_VIDEOENCODER.COPYPROTECTION; pub const KSPROPERTY_VIDEOENCODER_CC_ENABLE = KSPROPERTY_VIDCAP_VIDEOENCODER.CC_ENABLE; pub const KSPROPERTY_VIDEOENCODER_S = extern struct { Property: KSIDENTIFIER, Value: i32, Flags: u32, Capabilities: u32, }; const CLSID_PROPSETID_VIDCAP_VIDEODECODER_Value = @import("../../zig.zig").Guid.initString("c6e13350-30ac-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_VIDEODECODER = &CLSID_PROPSETID_VIDCAP_VIDEODECODER_Value; pub const KSPROPERTY_VIDCAP_VIDEODECODER = enum(i32) { CAPS = 0, STANDARD = 1, STATUS = 2, OUTPUT_ENABLE = 3, VCR_TIMING = 4, STATUS2 = 5, }; pub const KSPROPERTY_VIDEODECODER_CAPS = KSPROPERTY_VIDCAP_VIDEODECODER.CAPS; pub const KSPROPERTY_VIDEODECODER_STANDARD = KSPROPERTY_VIDCAP_VIDEODECODER.STANDARD; pub const KSPROPERTY_VIDEODECODER_STATUS = KSPROPERTY_VIDCAP_VIDEODECODER.STATUS; pub const KSPROPERTY_VIDEODECODER_OUTPUT_ENABLE = KSPROPERTY_VIDCAP_VIDEODECODER.OUTPUT_ENABLE; pub const KSPROPERTY_VIDEODECODER_VCR_TIMING = KSPROPERTY_VIDCAP_VIDEODECODER.VCR_TIMING; pub const KSPROPERTY_VIDEODECODER_STATUS2 = KSPROPERTY_VIDCAP_VIDEODECODER.STATUS2; pub const KS_VIDEODECODER_FLAGS = enum(i32) { DISABLE_OUTPUT = 1, USE_VCR_LOCKING = 2, INDICATE_LOCKED = 4, }; pub const KS_VIDEODECODER_FLAGS_CAN_DISABLE_OUTPUT = KS_VIDEODECODER_FLAGS.DISABLE_OUTPUT; pub const KS_VIDEODECODER_FLAGS_CAN_USE_VCR_LOCKING = KS_VIDEODECODER_FLAGS.USE_VCR_LOCKING; pub const KS_VIDEODECODER_FLAGS_CAN_INDICATE_LOCKED = KS_VIDEODECODER_FLAGS.INDICATE_LOCKED; pub const KSPROPERTY_VIDEODECODER_CAPS_S = extern struct { Property: KSIDENTIFIER, StandardsSupported: u32, Capabilities: u32, SettlingTime: u32, HSyncPerVSync: u32, }; pub const KSPROPERTY_VIDEODECODER_STATUS_S = extern struct { Property: KSIDENTIFIER, NumberOfLines: u32, SignalLocked: u32, }; pub const KSPROPERTY_VIDEODECODER_STATUS2_S = extern struct { Property: KSIDENTIFIER, NumberOfLines: u32, SignalLocked: u32, ChromaLock: u32, }; pub const KSPROPERTY_VIDEODECODER_S = extern struct { Property: KSIDENTIFIER, Value: u32, }; const CLSID_EVENTSETID_VIDEODECODER_Value = @import("../../zig.zig").Guid.initString("6a2e0621-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_EVENTSETID_VIDEODECODER = &CLSID_EVENTSETID_VIDEODECODER_Value; pub const KSEVENT_VIDEODECODER = enum(i32) { D = 0, }; pub const KSEVENT_VIDEODECODER_CHANGED = KSEVENT_VIDEODECODER.D; const CLSID_KSEVENTSETID_CameraAsyncControl_Value = @import("../../zig.zig").Guid.initString("22a11754-9701-4088-b33f-6b9cbc52df5e"); pub const CLSID_KSEVENTSETID_CameraAsyncControl = &CLSID_KSEVENTSETID_CameraAsyncControl_Value; pub const KSEVENT_CAMERACONTROL = enum(i32) { FOCUS = 0, ZOOM = 1, }; pub const KSEVENT_CAMERACONTROL_FOCUS = KSEVENT_CAMERACONTROL.FOCUS; pub const KSEVENT_CAMERACONTROL_ZOOM = KSEVENT_CAMERACONTROL.ZOOM; const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_Value = @import("../../zig.zig").Guid.initString("c6e13370-30ac-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_CAMERACONTROL = &CLSID_PROPSETID_VIDCAP_CAMERACONTROL_Value; pub const KSPROPERTY_VIDCAP_CAMERACONTROL = enum(i32) { PAN = 0, TILT = 1, ROLL = 2, ZOOM = 3, EXPOSURE = 4, IRIS = 5, FOCUS = 6, SCANMODE = 7, PRIVACY = 8, PANTILT = 9, PAN_RELATIVE = 10, TILT_RELATIVE = 11, ROLL_RELATIVE = 12, ZOOM_RELATIVE = 13, EXPOSURE_RELATIVE = 14, IRIS_RELATIVE = 15, FOCUS_RELATIVE = 16, PANTILT_RELATIVE = 17, FOCAL_LENGTH = 18, AUTO_EXPOSURE_PRIORITY = 19, }; pub const KSPROPERTY_CAMERACONTROL_PAN = KSPROPERTY_VIDCAP_CAMERACONTROL.PAN; pub const KSPROPERTY_CAMERACONTROL_TILT = KSPROPERTY_VIDCAP_CAMERACONTROL.TILT; pub const KSPROPERTY_CAMERACONTROL_ROLL = KSPROPERTY_VIDCAP_CAMERACONTROL.ROLL; pub const KSPROPERTY_CAMERACONTROL_ZOOM = KSPROPERTY_VIDCAP_CAMERACONTROL.ZOOM; pub const KSPROPERTY_CAMERACONTROL_EXPOSURE = KSPROPERTY_VIDCAP_CAMERACONTROL.EXPOSURE; pub const KSPROPERTY_CAMERACONTROL_IRIS = KSPROPERTY_VIDCAP_CAMERACONTROL.IRIS; pub const KSPROPERTY_CAMERACONTROL_FOCUS = KSPROPERTY_VIDCAP_CAMERACONTROL.FOCUS; pub const KSPROPERTY_CAMERACONTROL_SCANMODE = KSPROPERTY_VIDCAP_CAMERACONTROL.SCANMODE; pub const KSPROPERTY_CAMERACONTROL_PRIVACY = KSPROPERTY_VIDCAP_CAMERACONTROL.PRIVACY; pub const KSPROPERTY_CAMERACONTROL_PANTILT = KSPROPERTY_VIDCAP_CAMERACONTROL.PANTILT; pub const KSPROPERTY_CAMERACONTROL_PAN_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.PAN_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_TILT_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.TILT_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_ROLL_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.ROLL_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_ZOOM_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.ZOOM_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_EXPOSURE_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.EXPOSURE_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_IRIS_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.IRIS_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_FOCUS_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.FOCUS_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_PANTILT_RELATIVE = KSPROPERTY_VIDCAP_CAMERACONTROL.PANTILT_RELATIVE; pub const KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH = KSPROPERTY_VIDCAP_CAMERACONTROL.FOCAL_LENGTH; pub const KSPROPERTY_CAMERACONTROL_AUTO_EXPOSURE_PRIORITY = KSPROPERTY_VIDCAP_CAMERACONTROL.AUTO_EXPOSURE_PRIORITY; pub const KS_CameraControlAsyncOperation = enum(i32) { START = 1, STOP = 2, RESET = 3, }; pub const KS_CAMERACONTROL_ASYNC_START = KS_CameraControlAsyncOperation.START; pub const KS_CAMERACONTROL_ASYNC_STOP = KS_CameraControlAsyncOperation.STOP; pub const KS_CAMERACONTROL_ASYNC_RESET = KS_CameraControlAsyncOperation.RESET; pub const KSPROPERTY_CAMERACONTROL_S_EX = extern struct { Property: KSIDENTIFIER, Value: i32, Flags: u32, Capabilities: u32, FocusRect: RECT, }; pub const KSPROPERTY_CAMERACONTROL_S = extern struct { Property: KSIDENTIFIER, Value: i32, Flags: u32, Capabilities: u32, }; pub const KSPROPERTY_CAMERACONTROL_NODE_S = extern struct { NodeProperty: KSP_NODE, Value: i32, Flags: u32, Capabilities: u32, }; pub const KSPROPERTY_CAMERACONTROL_S2 = extern struct { Property: KSIDENTIFIER, Value1: i32, Flags: u32, Capabilities: u32, Value2: i32, }; pub const KSPROPERTY_CAMERACONTROL_NODE_S2 = extern struct { NodeProperty: KSP_NODE, Value1: i32, Flags: u32, Capabilities: u32, Value2: i32, }; pub const KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH_S = extern struct { Property: KSIDENTIFIER, lOcularFocalLength: i32, lObjectiveFocalLengthMin: i32, lObjectiveFocalLengthMax: i32, }; pub const KSPROPERTY_CAMERACONTROL_NODE_FOCAL_LENGTH_S = extern struct { NodeProperty: KSNODEPROPERTY, lOcularFocalLength: i32, lObjectiveFocalLengthMin: i32, lObjectiveFocalLengthMax: i32, }; const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_FLASH_Value = @import("../../zig.zig").Guid.initString("785e8f49-63a2-4144-ab70-ffb278fa26ce"); pub const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_FLASH = &CLSID_PROPSETID_VIDCAP_CAMERACONTROL_FLASH_Value; pub const KSPROPERTY_CAMERACONTROL_FLASH = enum(i32) { D = 0, }; pub const KSPROPERTY_CAMERACONTROL_FLASH_PROPERTY_ID = KSPROPERTY_CAMERACONTROL_FLASH.D; pub const KSPROPERTY_CAMERACONTROL_FLASH_S = extern struct { Flash: u32, Capabilities: u32, }; const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_VIDEO_STABILIZATION_Value = @import("../../zig.zig").Guid.initString("43964bd3-7716-404e-8be1-d299b20e50fd"); pub const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_VIDEO_STABILIZATION = &CLSID_PROPSETID_VIDCAP_CAMERACONTROL_VIDEO_STABILIZATION_Value; pub const KSPROPERTY_CAMERACONTROL_VIDEO_STABILIZATION_MODE = enum(i32) { D = 0, }; pub const KSPROPERTY_CAMERACONTROL_VIDEO_STABILIZATION_MODE_PROPERTY_ID = KSPROPERTY_CAMERACONTROL_VIDEO_STABILIZATION_MODE.D; pub const KSPROPERTY_CAMERACONTROL_VIDEOSTABILIZATION_MODE_S = extern struct { VideoStabilizationMode: u32, Capabilities: u32, }; const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_REGION_OF_INTEREST_Value = @import("../../zig.zig").Guid.initString("9d12d198-f86c-4fed-b023-5d87653da793"); pub const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_REGION_OF_INTEREST = &CLSID_PROPSETID_VIDCAP_CAMERACONTROL_REGION_OF_INTEREST_Value; pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST = enum(i32) { D = 0, }; pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_PROPERTY_ID = KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST.D; const CLSID_EVENTSETID_VIDCAP_CAMERACONTROL_REGION_OF_INTEREST_Value = @import("../../zig.zig").Guid.initString("2fdffc5d-c732-4ba6-b5df-6b4d7fc88b8b"); pub const CLSID_EVENTSETID_VIDCAP_CAMERACONTROL_REGION_OF_INTEREST = &CLSID_EVENTSETID_VIDCAP_CAMERACONTROL_REGION_OF_INTEREST_Value; pub const KSPROPERTY_CAMERACONTROL_REGION_OF_INTEREST_S = extern struct { FocusRect: RECT, AutoFocusLock: BOOL, AutoExposureLock: BOOL, AutoWhitebalanceLock: BOOL, Anonymous: extern union { Capabilities: u32, Configuration: u32, }, }; const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_IMAGE_PIN_CAPABILITY_Value = @import("../../zig.zig").Guid.initString("9d3d7bbf-5c6d-4138-bb00-584edd20f7c5"); pub const CLSID_PROPSETID_VIDCAP_CAMERACONTROL_IMAGE_PIN_CAPABILITY = &CLSID_PROPSETID_VIDCAP_CAMERACONTROL_IMAGE_PIN_CAPABILITY_Value; pub const KSPROPERTY_CAMERACONTROL_IMAGE_PIN_CAPABILITY = enum(i32) { D = 0, }; pub const KSPROPERTY_CAMERACONTROL_IMAGE_PIN_CAPABILITY_PROPERTY_ID = KSPROPERTY_CAMERACONTROL_IMAGE_PIN_CAPABILITY.D; pub const KSPROPERTY_CAMERACONTROL_IMAGE_PIN_CAPABILITY_S = extern struct { Capabilities: u32, Reserved0: u32, }; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY = enum(i32) { PHOTOMODE = 0, PHOTOFRAMERATE = 1, PHOTOMAXFRAMERATE = 2, PHOTOTRIGGERTIME = 3, WARMSTART = 4, MAXVIDFPS_PHOTORES = 5, PHOTOTHUMBNAIL = 6, SCENEMODE = 7, TORCHMODE = 8, FLASHMODE = 9, OPTIMIZATIONHINT = 10, WHITEBALANCEMODE = 11, EXPOSUREMODE = 12, FOCUSMODE = 13, ISO = 14, FIELDOFVIEW = 15, EVCOMPENSATION = 16, CAMERAANGLEOFFSET = 17, METADATA = 18, FOCUSPRIORITY = 19, FOCUSSTATE = 20, ROI_CONFIGCAPS = 21, ROI_ISPCONTROL = 22, PHOTOCONFIRMATION = 23, ZOOM = 24, MCC = 25, ISO_ADVANCED = 26, VIDEOSTABILIZATION = 27, VFR = 28, FACEDETECTION = 29, VIDEOHDR = 30, HISTOGRAM = 31, OIS = 32, ADVANCEDPHOTO = 33, PROFILE = 34, FACEAUTH_MODE = 35, SECURE_MODE = 36, VIDEOTEMPORALDENOISING = 37, IRTORCHMODE = 38, RELATIVEPANELOPTIMIZATION = 39, END = 40, // END2 = 40, this enum value conflicts with END }; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.PHOTOMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOFRAMERATE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.PHOTOFRAMERATE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOMAXFRAMERATE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.PHOTOMAXFRAMERATE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOTRIGGERTIME = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.PHOTOTRIGGERTIME; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_WARMSTART = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.WARMSTART; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_MAXVIDFPS_PHOTORES = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.MAXVIDFPS_PHOTORES; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOTHUMBNAIL = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.PHOTOTHUMBNAIL; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_SCENEMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.SCENEMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_TORCHMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.TORCHMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_FLASHMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.FLASHMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_OPTIMIZATIONHINT = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.OPTIMIZATIONHINT; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_WHITEBALANCEMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.WHITEBALANCEMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_EXPOSUREMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.EXPOSUREMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_FOCUSMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.FOCUSMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_ISO = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.ISO; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_FIELDOFVIEW = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.FIELDOFVIEW; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_EVCOMPENSATION = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.EVCOMPENSATION; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_CAMERAANGLEOFFSET = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.CAMERAANGLEOFFSET; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_METADATA = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.METADATA; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_FOCUSPRIORITY = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.FOCUSPRIORITY; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_FOCUSSTATE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.FOCUSSTATE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_ROI_CONFIGCAPS = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.ROI_CONFIGCAPS; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_ROI_ISPCONTROL = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.ROI_ISPCONTROL; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PHOTOCONFIRMATION = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.PHOTOCONFIRMATION; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_ZOOM = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.ZOOM; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_MCC = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.MCC; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_ISO_ADVANCED = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.ISO_ADVANCED; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_VIDEOSTABILIZATION = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.VIDEOSTABILIZATION; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_VFR = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.VFR; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_FACEDETECTION = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.FACEDETECTION; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_VIDEOHDR = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.VIDEOHDR; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_HISTOGRAM = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.HISTOGRAM; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_OIS = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.OIS; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_ADVANCEDPHOTO = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.ADVANCEDPHOTO; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.PROFILE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_FACEAUTH_MODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.FACEAUTH_MODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_SECURE_MODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.SECURE_MODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_VIDEOTEMPORALDENOISING = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.VIDEOTEMPORALDENOISING; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_IRTORCHMODE = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.IRTORCHMODE; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_RELATIVEPANELOPTIMIZATION = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.RELATIVEPANELOPTIMIZATION; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_END = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.END; pub const KSPROPERTY_CAMERACONTROL_EXTENDED_END2 = KSPROPERTY_CAMERACONTROL_EXTENDED_PROPERTY.END; const CLSID_KSPROPERTYSETID_ExtendedCameraControl_Value = @import("../../zig.zig").Guid.initString("1cb79112-c0d2-4213-9ca6-cd4fdb927972"); pub const CLSID_KSPROPERTYSETID_ExtendedCameraControl = &CLSID_KSPROPERTYSETID_ExtendedCameraControl_Value; const CLSID_KSEVENTSETID_ExtendedCameraControl_Value = @import("../../zig.zig").Guid.initString("571c92c9-13a2-47e3-a649-d2a778166384"); pub const CLSID_KSEVENTSETID_ExtendedCameraControl = &CLSID_KSEVENTSETID_ExtendedCameraControl_Value; const CLSID_KSEVENTSETID_CameraEvent_Value = @import("../../zig.zig").Guid.initString("7899b2e0-6b43-4964-9d2a-a21f4061f576"); pub const CLSID_KSEVENTSETID_CameraEvent = &CLSID_KSEVENTSETID_CameraEvent_Value; pub const KSEVENT_CAMERAEVENT = enum(i32) { D = 0, }; pub const KSEVENT_PHOTO_SAMPLE_SCANNED = KSEVENT_CAMERAEVENT.D; pub const KSCAMERA_EXTENDEDPROP_WHITEBALANCE_MODE = enum(i32) { TEMPERATURE = 1, PRESET = 2, }; pub const KSCAMERA_EXTENDEDPROP_WHITEBALANCE_TEMPERATURE = KSCAMERA_EXTENDEDPROP_WHITEBALANCE_MODE.TEMPERATURE; pub const KSCAMERA_EXTENDEDPROP_WHITEBALANCE_PRESET = KSCAMERA_EXTENDEDPROP_WHITEBALANCE_MODE.PRESET; pub const KSCAMERA_EXTENDEDPROP_WBPRESET = enum(i32) { CLOUDY = 1, DAYLIGHT = 2, FLASH = 3, FLUORESCENT = 4, TUNGSTEN = 5, CANDLELIGHT = 6, }; pub const KSCAMERA_EXTENDEDPROP_WBPRESET_CLOUDY = KSCAMERA_EXTENDEDPROP_WBPRESET.CLOUDY; pub const KSCAMERA_EXTENDEDPROP_WBPRESET_DAYLIGHT = KSCAMERA_EXTENDEDPROP_WBPRESET.DAYLIGHT; pub const KSCAMERA_EXTENDEDPROP_WBPRESET_FLASH = KSCAMERA_EXTENDEDPROP_WBPRESET.FLASH; pub const KSCAMERA_EXTENDEDPROP_WBPRESET_FLUORESCENT = KSCAMERA_EXTENDEDPROP_WBPRESET.FLUORESCENT; pub const KSCAMERA_EXTENDEDPROP_WBPRESET_TUNGSTEN = KSCAMERA_EXTENDEDPROP_WBPRESET.TUNGSTEN; pub const KSCAMERA_EXTENDEDPROP_WBPRESET_CANDLELIGHT = KSCAMERA_EXTENDEDPROP_WBPRESET.CANDLELIGHT; pub const KSPROPERTY_CAMERA_PHOTOTRIGGERTIME_FLAGS = enum(i32) { CLEAR = 0, SET = 1, }; pub const KSPROPERTY_CAMERA_PHOTOTRIGGERTIME_CLEAR = KSPROPERTY_CAMERA_PHOTOTRIGGERTIME_FLAGS.CLEAR; pub const KSPROPERTY_CAMERA_PHOTOTRIGGERTIME_SET = KSPROPERTY_CAMERA_PHOTOTRIGGERTIME_FLAGS.SET; pub const KSCAMERA_EXTENDEDPROP_HEADER = extern struct { Version: u32, PinId: u32, Size: u32, Result: u32, Flags: u64, Capability: u64, }; pub const KSCAMERA_EXTENDEDPROP_VALUE = extern struct { Value: extern union { dbl: f64, ull: u64, ul: u32, ratio: ULARGE_INTEGER, l: i32, ll: i64, }, }; pub const KSCAMERA_MAXVIDEOFPS_FORPHOTORES = extern struct { PhotoResWidth: u32, PhotoResHeight: u32, PreviewFPSNum: u32, PreviewFPSDenom: u32, CaptureFPSNum: u32, CaptureFPSDenom: u32, }; pub const KSCAMERA_EXTENDEDPROP_PHOTOMODE = extern struct { RequestedHistoryFrames: u32, MaxHistoryFrames: u32, SubMode: u32, Reserved: u32, }; pub const KSCAMERA_EXTENDEDPROP_VIDEOPROCSETTING = extern struct { Mode: u32, Min: i32, Max: i32, Step: i32, VideoProc: KSCAMERA_EXTENDEDPROP_VALUE, Reserved: u64, }; pub const KSCAMERA_EXTENDEDPROP_EVCOMPENSATION = extern struct { Mode: u32, Min: i32, Max: i32, Value: i32, Reserved: u64, }; pub const KSCAMERA_EXTENDEDPROP_FIELDOFVIEW = extern struct { NormalizedFocalLengthX: u32, NormalizedFocalLengthY: u32, Flag: u32, Reserved: u32, }; pub const KSCAMERA_EXTENDEDPROP_CAMERAOFFSET = extern struct { PitchAngle: i32, YawAngle: i32, Flag: u32, Reserved: u32, }; pub const KSCAMERA_EXTENDEDPROP_METADATAINFO = extern struct { BufferAlignment: i32, MaxMetadataBufferSize: u32, }; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment = enum(i32) { @"16" = 4, @"32" = 5, @"64" = 6, @"128" = 7, @"256" = 8, @"512" = 9, @"1024" = 10, @"2048" = 11, @"4096" = 12, @"8192" = 13, }; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_16 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"16"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_32 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"32"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_64 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"64"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_128 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"128"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_256 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"256"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_512 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"512"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_1024 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"1024"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_2048 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"2048"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_4096 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"4096"; pub const KSCAMERA_EXTENDEDPROP_MetadataAlignment_8192 = KSCAMERA_EXTENDEDPROP_MetadataAlignment.@"8192"; pub const KSCAMERA_MetadataId = enum(i32) { Standard_Start = 1, // PhotoConfirmation = 1, this enum value conflicts with Standard_Start UsbVideoHeader = 2, CaptureStats = 3, CameraExtrinsics = 4, CameraIntrinsics = 5, FrameIllumination = 6, // Standard_End = 6, this enum value conflicts with FrameIllumination Custom_Start = -2147483648, }; pub const MetadataId_Standard_Start = KSCAMERA_MetadataId.Standard_Start; pub const MetadataId_PhotoConfirmation = KSCAMERA_MetadataId.Standard_Start; pub const MetadataId_UsbVideoHeader = KSCAMERA_MetadataId.UsbVideoHeader; pub const MetadataId_CaptureStats = KSCAMERA_MetadataId.CaptureStats; pub const MetadataId_CameraExtrinsics = KSCAMERA_MetadataId.CameraExtrinsics; pub const MetadataId_CameraIntrinsics = KSCAMERA_MetadataId.CameraIntrinsics; pub const MetadataId_FrameIllumination = KSCAMERA_MetadataId.FrameIllumination; pub const MetadataId_Standard_End = KSCAMERA_MetadataId.FrameIllumination; pub const MetadataId_Custom_Start = KSCAMERA_MetadataId.Custom_Start; pub const KSCAMERA_METADATA_ITEMHEADER = extern struct { MetadataId: u32, Size: u32, }; pub const KSCAMERA_METADATA_PHOTOCONFIRMATION = extern struct { Header: KSCAMERA_METADATA_ITEMHEADER, PhotoConfirmationIndex: u32, Reserved: u32, }; pub const KSCAMERA_METADATA_FRAMEILLUMINATION = extern struct { Header: KSCAMERA_METADATA_ITEMHEADER, Flags: u32, Reserved: u32, }; pub const KSCAMERA_METADATA_CAPTURESTATS = extern struct { Header: KSCAMERA_METADATA_ITEMHEADER, Flags: u32, Reserved: u32, ExposureTime: u64, ExposureCompensationFlags: u64, ExposureCompensationValue: i32, IsoSpeed: u32, FocusState: u32, LensPosition: u32, WhiteBalance: u32, Flash: u32, FlashPower: u32, ZoomFactor: u32, SceneMode: u64, SensorFramerate: u64, }; pub const KSCAMERA_EXTENDEDPROP_FOCUSSTATE = enum(i32) { UNINITIALIZED = 0, LOST = 1, SEARCHING = 2, FOCUSED = 3, FAILED = 4, }; pub const KSCAMERA_EXTENDEDPROP_FOCUSSTATE_UNINITIALIZED = KSCAMERA_EXTENDEDPROP_FOCUSSTATE.UNINITIALIZED; pub const KSCAMERA_EXTENDEDPROP_FOCUSSTATE_LOST = KSCAMERA_EXTENDEDPROP_FOCUSSTATE.LOST; pub const KSCAMERA_EXTENDEDPROP_FOCUSSTATE_SEARCHING = KSCAMERA_EXTENDEDPROP_FOCUSSTATE.SEARCHING; pub const KSCAMERA_EXTENDEDPROP_FOCUSSTATE_FOCUSED = KSCAMERA_EXTENDEDPROP_FOCUSSTATE.FOCUSED; pub const KSCAMERA_EXTENDEDPROP_FOCUSSTATE_FAILED = KSCAMERA_EXTENDEDPROP_FOCUSSTATE.FAILED; pub const KSCAMERA_EXTENDEDPROP_ROI_CONFIGCAPSHEADER = extern struct { Size: u32, ConfigCapCount: u32, Reserved: u64, }; pub const KSCAMERA_EXTENDEDPROP_ROI_CONFIGCAPS = extern struct { ControlId: u32, MaxNumberOfROIs: u32, Capability: u64, }; pub const KSCAMERA_EXTENDEDPROP_ROI_ISPCONTROLHEADER = extern struct { Size: u32, ControlCount: u32, Reserved: u64, }; pub const KSCAMERA_EXTENDEDPROP_ROI_ISPCONTROL = extern struct { ControlId: u32, ROICount: u32, Result: u32, Reserved: u32, }; pub const KSCAMERA_EXTENDEDPROP_ROI_INFO = extern struct { Region: RECT, Flags: u64, Weight: i32, RegionOfInterestType: i32, }; pub const KSCAMERA_EXTENDEDPROP_ROITYPE = enum(i32) { UNKNOWN = 0, FACE = 1, }; pub const KSCAMERA_EXTENDEDPROP_ROITYPE_UNKNOWN = KSCAMERA_EXTENDEDPROP_ROITYPE.UNKNOWN; pub const KSCAMERA_EXTENDEDPROP_ROITYPE_FACE = KSCAMERA_EXTENDEDPROP_ROITYPE.FACE; pub const KSCAMERA_EXTENDEDPROP_ROI_WHITEBALANCE = extern struct { ROIInfo: KSCAMERA_EXTENDEDPROP_ROI_INFO, Reserved: u64, }; pub const KSCAMERA_EXTENDEDPROP_ROI_EXPOSURE = extern struct { ROIInfo: KSCAMERA_EXTENDEDPROP_ROI_INFO, Reserved: u64, }; pub const KSCAMERA_EXTENDEDPROP_ROI_FOCUS = extern struct { ROIInfo: KSCAMERA_EXTENDEDPROP_ROI_INFO, Reserved: u64, }; const CLSID_KSPROPERTYSETID_PerFrameSettingControl_Value = @import("../../zig.zig").Guid.initString("f1f3e261-dee6-4537-bff5-ee206db54aac"); pub const CLSID_KSPROPERTYSETID_PerFrameSettingControl = &CLSID_KSPROPERTYSETID_PerFrameSettingControl_Value; pub const KSPROPERTY_CAMERACONTROL_PERFRAMESETTING_PROPERTY = enum(i32) { CAPABILITY = 0, SET = 1, CLEAR = 2, }; pub const KSPROPERTY_CAMERACONTROL_PERFRAMESETTING_CAPABILITY = KSPROPERTY_CAMERACONTROL_PERFRAMESETTING_PROPERTY.CAPABILITY; pub const KSPROPERTY_CAMERACONTROL_PERFRAMESETTING_SET = KSPROPERTY_CAMERACONTROL_PERFRAMESETTING_PROPERTY.SET; pub const KSPROPERTY_CAMERACONTROL_PERFRAMESETTING_CLEAR = KSPROPERTY_CAMERACONTROL_PERFRAMESETTING_PROPERTY.CLEAR; pub const KSCAMERA_PERFRAMESETTING_ITEM_TYPE = enum(i32) { EXPOSURE_TIME = 1, FLASH = 2, EXPOSURE_COMPENSATION = 3, ISO = 4, FOCUS = 5, PHOTOCONFIRMATION = 6, CUSTOM = 7, }; pub const KSCAMERA_PERFRAMESETTING_ITEM_EXPOSURE_TIME = KSCAMERA_PERFRAMESETTING_ITEM_TYPE.EXPOSURE_TIME; pub const KSCAMERA_PERFRAMESETTING_ITEM_FLASH = KSCAMERA_PERFRAMESETTING_ITEM_TYPE.FLASH; pub const KSCAMERA_PERFRAMESETTING_ITEM_EXPOSURE_COMPENSATION = KSCAMERA_PERFRAMESETTING_ITEM_TYPE.EXPOSURE_COMPENSATION; pub const KSCAMERA_PERFRAMESETTING_ITEM_ISO = KSCAMERA_PERFRAMESETTING_ITEM_TYPE.ISO; pub const KSCAMERA_PERFRAMESETTING_ITEM_FOCUS = KSCAMERA_PERFRAMESETTING_ITEM_TYPE.FOCUS; pub const KSCAMERA_PERFRAMESETTING_ITEM_PHOTOCONFIRMATION = KSCAMERA_PERFRAMESETTING_ITEM_TYPE.PHOTOCONFIRMATION; pub const KSCAMERA_PERFRAMESETTING_ITEM_CUSTOM = KSCAMERA_PERFRAMESETTING_ITEM_TYPE.CUSTOM; pub const KSCAMERA_PERFRAMESETTING_CAP_ITEM_HEADER = extern struct { Size: u32, Type: u32, Flags: u64, }; pub const KSCAMERA_PERFRAMESETTING_CAP_HEADER = extern struct { Size: u32, ItemCount: u32, Flags: u64, }; pub const KSCAMERA_PERFRAMESETTING_CUSTOM_ITEM = extern struct { Size: u32, Reserved: u32, Id: Guid, }; pub const KSCAMERA_PERFRAMESETTING_ITEM_HEADER = extern struct { Size: u32, Type: u32, Flags: u64, }; pub const KSCAMERA_PERFRAMESETTING_FRAME_HEADER = extern struct { Size: u32, Id: u32, ItemCount: u32, Reserved: u32, }; pub const KSCAMERA_PERFRAMESETTING_HEADER = extern struct { Size: u32, FrameCount: u32, Id: Guid, Flags: u64, LoopCount: u32, Reserved: u32, }; pub const KSCAMERA_EXTENDEDPROP_PROFILE = extern struct { ProfileId: Guid, Index: u32, Reserved: u32, }; const CLSID_KSCAMERAPROFILE_Legacy_Value = @import("../../zig.zig").Guid.initString("b4894d81-62b7-4eec-8740-80658c4a9d3e"); pub const CLSID_KSCAMERAPROFILE_Legacy = &CLSID_KSCAMERAPROFILE_Legacy_Value; const CLSID_KSCAMERAPROFILE_VideoRecording_Value = @import("../../zig.zig").Guid.initString("a0e517e8-8f8c-4f6f-9a57-46fc2f647ec0"); pub const CLSID_KSCAMERAPROFILE_VideoRecording = &CLSID_KSCAMERAPROFILE_VideoRecording_Value; const CLSID_KSCAMERAPROFILE_HighQualityPhoto_Value = @import("../../zig.zig").Guid.initString("32440725-961b-4ca3-b5b2-854e719d9e1b"); pub const CLSID_KSCAMERAPROFILE_HighQualityPhoto = &CLSID_KSCAMERAPROFILE_HighQualityPhoto_Value; const CLSID_KSCAMERAPROFILE_BalancedVideoAndPhoto_Value = @import("../../zig.zig").Guid.initString("6b52b017-42c7-4a21-bfe3-23f009149887"); pub const CLSID_KSCAMERAPROFILE_BalancedVideoAndPhoto = &CLSID_KSCAMERAPROFILE_BalancedVideoAndPhoto_Value; const CLSID_KSCAMERAPROFILE_VideoConferencing_Value = @import("../../zig.zig").Guid.initString("c5444a88-e1bf-4597-b2dd-9e1ead864bb8"); pub const CLSID_KSCAMERAPROFILE_VideoConferencing = &CLSID_KSCAMERAPROFILE_VideoConferencing_Value; const CLSID_KSCAMERAPROFILE_PhotoSequence_Value = @import("../../zig.zig").Guid.initString("02399d9d-4ee8-49ba-bc07-5ff156531413"); pub const CLSID_KSCAMERAPROFILE_PhotoSequence = &CLSID_KSCAMERAPROFILE_PhotoSequence_Value; const CLSID_KSCAMERAPROFILE_FaceAuth_Mode_Value = @import("../../zig.zig").Guid.initString("81361b22-700b-4546-a2d4-c52e907bfc27"); pub const CLSID_KSCAMERAPROFILE_FaceAuth_Mode = &CLSID_KSCAMERAPROFILE_FaceAuth_Mode_Value; const CLSID_KSCAMERAPROFILE_HighFrameRate_Value = @import("../../zig.zig").Guid.initString("566e6113-8c35-48e7-b89f-d23fdc1219dc"); pub const CLSID_KSCAMERAPROFILE_HighFrameRate = &CLSID_KSCAMERAPROFILE_HighFrameRate_Value; const CLSID_KSCAMERAPROFILE_HDRWithWCGVideo_Value = @import("../../zig.zig").Guid.initString("4b27c336-4924-4989-b994-fdaf1dc7cd85"); pub const CLSID_KSCAMERAPROFILE_HDRWithWCGVideo = &CLSID_KSCAMERAPROFILE_HDRWithWCGVideo_Value; const CLSID_KSCAMERAPROFILE_HDRWithWCGPhoto_Value = @import("../../zig.zig").Guid.initString("9bf6f1ff-b555-4625-b326-a46def318fb7"); pub const CLSID_KSCAMERAPROFILE_HDRWithWCGPhoto = &CLSID_KSCAMERAPROFILE_HDRWithWCGPhoto_Value; const CLSID_KSCAMERAPROFILE_VariablePhotoSequence_Value = @import("../../zig.zig").Guid.initString("9ff2cb56-e75a-49b1-a928-9985d5946f87"); pub const CLSID_KSCAMERAPROFILE_VariablePhotoSequence = &CLSID_KSCAMERAPROFILE_VariablePhotoSequence_Value; const CLSID_KSCAMERAPROFILE_VideoHDR8_Value = @import("../../zig.zig").Guid.initString("d4f3f4ec-bdff-4314-b1d4-008e281f74e7"); pub const CLSID_KSCAMERAPROFILE_VideoHDR8 = &CLSID_KSCAMERAPROFILE_VideoHDR8_Value; pub const KSCAMERA_PROFILE_MEDIAINFO = extern struct { Resolution: extern struct { X: u32, Y: u32, }, MaxFrameRate: extern struct { Numerator: u32, Denominator: u32, }, Flags: u64, Data0: u32, Data1: u32, Data2: u32, Data3: u32, }; pub const KSCAMERA_PROFILE_PININFO = extern struct { PinCategory: Guid, Anonymous: extern union { Anonymous: extern struct { PinIndex: u16, ProfileSensorType: u16, }, Reserved: u32, }, MediaInfoCount: u32, MediaInfos: ?*KSCAMERA_PROFILE_MEDIAINFO, }; pub const KSCAMERA_PROFILE_INFO = extern struct { ProfileId: Guid, Index: u32, PinCount: u32, Pins: ?*KSCAMERA_PROFILE_PININFO, }; pub const KSCAMERA_PROFILE_CONCURRENCYINFO = extern struct { ReferenceGuid: Guid, Reserved: u32, ProfileCount: u32, Profiles: ?*KSCAMERA_PROFILE_INFO, }; pub const KSDEVICE_PROFILE_INFO = extern struct { Type: u32, Size: u32, Anonymous: extern union { Camera: extern struct { Info: KSCAMERA_PROFILE_INFO, Reserved: u32, ConcurrencyCount: u32, Concurrency: ?*KSCAMERA_PROFILE_CONCURRENCYINFO, }, }, }; pub const WNF_KSCAMERA_STREAMSTATE_INFO = extern struct { ProcessId: u32, SessionId: u32, StreamState: u32, Reserved: u32, }; pub const KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_TYPE = enum(i32) { TY_NETWORKCAMERACONTROL_NTPINFO_TYPE_DISABLE = 0, TY_NETWORKCAMERACONTROL_NTPINFO_TYPE_HOSTNTP = 1, YT_NETWORKCAMERACONTROL_NTPINFO_TYPE_CUSTOM = 2, }; pub const KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_TYPE_DISABLE = KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_TYPE.TY_NETWORKCAMERACONTROL_NTPINFO_TYPE_DISABLE; pub const KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_TYPE_HOSTNTP = KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_TYPE.TY_NETWORKCAMERACONTROL_NTPINFO_TYPE_HOSTNTP; pub const KSPROPERYT_NETWORKCAMERACONTROL_NTPINFO_TYPE_CUSTOM = KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_TYPE.YT_NETWORKCAMERACONTROL_NTPINFO_TYPE_CUSTOM; pub const KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_HEADER = extern struct { Size: u32, Type: KSPROPERTY_NETWORKCAMERACONTROL_NTPINFO_TYPE, }; const CLSID_KSPROPERTYSETID_NetworkCameraControl_Value = @import("../../zig.zig").Guid.initString("0e780f09-5745-4e3a-bc9f-f226ea43a6ec"); pub const CLSID_KSPROPERTYSETID_NetworkCameraControl = &CLSID_KSPROPERTYSETID_NetworkCameraControl_Value; pub const KSPROPERTY_NETWORKCAMERACONTROL_PROPERTY = enum(i32) { NTP = 0, URI = 1, }; pub const KSPROPERTY_NETWORKCAMERACONTROL_NTP = KSPROPERTY_NETWORKCAMERACONTROL_PROPERTY.NTP; pub const KSPROPERTY_NETWORKCAMERACONTROL_URI = KSPROPERTY_NETWORKCAMERACONTROL_PROPERTY.URI; const CLSID_PROPSETID_EXT_DEVICE_Value = @import("../../zig.zig").Guid.initString("b5730a90-1a2c-11cf-8c23-00aa006b6814"); pub const CLSID_PROPSETID_EXT_DEVICE = &CLSID_PROPSETID_EXT_DEVICE_Value; pub const KSPROPERTY_EXTDEVICE = enum(i32) { ID = 0, VERSION = 1, POWER_STATE = 2, PORT = 3, CAPABILITIES = 4, }; pub const KSPROPERTY_EXTDEVICE_ID = KSPROPERTY_EXTDEVICE.ID; pub const KSPROPERTY_EXTDEVICE_VERSION = KSPROPERTY_EXTDEVICE.VERSION; pub const KSPROPERTY_EXTDEVICE_POWER_STATE = KSPROPERTY_EXTDEVICE.POWER_STATE; pub const KSPROPERTY_EXTDEVICE_PORT = KSPROPERTY_EXTDEVICE.PORT; pub const KSPROPERTY_EXTDEVICE_CAPABILITIES = KSPROPERTY_EXTDEVICE.CAPABILITIES; pub const DEVCAPS = extern struct { CanRecord: i32, CanRecordStrobe: i32, HasAudio: i32, HasVideo: i32, UsesFiles: i32, CanSave: i32, DeviceType: i32, TCRead: i32, TCWrite: i32, CTLRead: i32, IndexRead: i32, Preroll: i32, Postroll: i32, SyncAcc: i32, NormRate: i32, CanPreview: i32, CanMonitorSrc: i32, CanTest: i32, VideoIn: i32, AudioIn: i32, Calibrate: i32, SeekType: i32, SimulatedHardware: i32, }; pub const KSPROPERTY_EXTDEVICE_S = extern struct { Property: KSIDENTIFIER, u: extern union { Capabilities: DEVCAPS, DevPort: u32, PowerState: u32, pawchString: [260]u16, NodeUniqueID: [2]u32, }, }; const CLSID_PROPSETID_EXT_TRANSPORT_Value = @import("../../zig.zig").Guid.initString("a03cd5f0-3045-11cf-8c44-00aa006b6814"); pub const CLSID_PROPSETID_EXT_TRANSPORT = &CLSID_PROPSETID_EXT_TRANSPORT_Value; pub const KSPROPERTY_EXTXPORT = enum(i32) { EXTXPORT_CAPABILITIES = 0, EXTXPORT_INPUT_SIGNAL_MODE = 1, EXTXPORT_OUTPUT_SIGNAL_MODE = 2, EXTXPORT_LOAD_MEDIUM = 3, EXTXPORT_MEDIUM_INFO = 4, EXTXPORT_STATE = 5, EXTXPORT_STATE_NOTIFY = 6, EXTXPORT_TIMECODE_SEARCH = 7, EXTXPORT_ATN_SEARCH = 8, EXTXPORT_RTC_SEARCH = 9, RAW_AVC_CMD = 10, }; pub const KSPROPERTY_EXTXPORT_CAPABILITIES = KSPROPERTY_EXTXPORT.EXTXPORT_CAPABILITIES; pub const KSPROPERTY_EXTXPORT_INPUT_SIGNAL_MODE = KSPROPERTY_EXTXPORT.EXTXPORT_INPUT_SIGNAL_MODE; pub const KSPROPERTY_EXTXPORT_OUTPUT_SIGNAL_MODE = KSPROPERTY_EXTXPORT.EXTXPORT_OUTPUT_SIGNAL_MODE; pub const KSPROPERTY_EXTXPORT_LOAD_MEDIUM = KSPROPERTY_EXTXPORT.EXTXPORT_LOAD_MEDIUM; pub const KSPROPERTY_EXTXPORT_MEDIUM_INFO = KSPROPERTY_EXTXPORT.EXTXPORT_MEDIUM_INFO; pub const KSPROPERTY_EXTXPORT_STATE = KSPROPERTY_EXTXPORT.EXTXPORT_STATE; pub const KSPROPERTY_EXTXPORT_STATE_NOTIFY = KSPROPERTY_EXTXPORT.EXTXPORT_STATE_NOTIFY; pub const KSPROPERTY_EXTXPORT_TIMECODE_SEARCH = KSPROPERTY_EXTXPORT.EXTXPORT_TIMECODE_SEARCH; pub const KSPROPERTY_EXTXPORT_ATN_SEARCH = KSPROPERTY_EXTXPORT.EXTXPORT_ATN_SEARCH; pub const KSPROPERTY_EXTXPORT_RTC_SEARCH = KSPROPERTY_EXTXPORT.EXTXPORT_RTC_SEARCH; pub const KSPROPERTY_RAW_AVC_CMD = KSPROPERTY_EXTXPORT.RAW_AVC_CMD; pub const TRANSPORTSTATUS = extern struct { Mode: i32, LastError: i32, RecordInhibit: i32, ServoLock: i32, MediaPresent: i32, MediaLength: i32, MediaSize: i32, MediaTrackCount: i32, MediaTrackLength: i32, MediaTrackSide: i32, MediaType: i32, LinkMode: i32, NotifyOn: i32, }; pub const TRANSPORTBASICPARMS = extern struct { TimeFormat: i32, TimeReference: i32, Superimpose: i32, EndStopAction: i32, RecordFormat: i32, StepFrames: i32, SetpField: i32, Preroll: i32, RecPreroll: i32, Postroll: i32, EditDelay: i32, PlayTCDelay: i32, RecTCDelay: i32, EditField: i32, FrameServo: i32, ColorFrameServo: i32, ServoRef: i32, WarnGenlock: i32, SetTracking: i32, VolumeName: [40]i8, Ballistic: [20]i32, Speed: i32, CounterFormat: i32, TunerChannel: i32, TunerNumber: i32, TimerEvent: i32, TimerStartDay: i32, TimerStartTime: i32, TimerStopDay: i32, TimerStopTime: i32, }; pub const TRANSPORTVIDEOPARMS = extern struct { OutputMode: i32, Input: i32, }; pub const TRANSPORTAUDIOPARMS = extern struct { EnableOutput: i32, EnableRecord: i32, EnableSelsync: i32, Input: i32, MonitorSource: i32, }; pub const MEDIUM_INFO = extern struct { MediaPresent: BOOL, MediaType: u32, RecordInhibit: BOOL, }; pub const TRANSPORT_STATE = extern struct { Mode: u32, State: u32, }; pub const KSPROPERTY_EXTXPORT_S = extern struct { Property: KSIDENTIFIER, u: extern union { Capabilities: u32, SignalMode: u32, LoadMedium: u32, MediumInfo: MEDIUM_INFO, XPrtState: TRANSPORT_STATE, Timecode: extern struct { frame: u8, second: u8, minute: u8, hour: u8, }, dwTimecode: u32, dwAbsTrackNumber: u32, RawAVC: extern struct { PayloadSize: u32, Payload: [512]u8, }, }, }; pub const KSPROPERTY_EXTXPORT_NODE_S = extern struct { NodeProperty: KSP_NODE, u: extern union { Capabilities: u32, SignalMode: u32, LoadMedium: u32, MediumInfo: MEDIUM_INFO, XPrtState: TRANSPORT_STATE, Timecode: extern struct { frame: u8, second: u8, minute: u8, hour: u8, }, dwTimecode: u32, dwAbsTrackNumber: u32, RawAVC: extern struct { PayloadSize: u32, Payload: [512]u8, }, }, }; const CLSID_PROPSETID_TIMECODE_READER_Value = @import("../../zig.zig").Guid.initString("9b496ce1-811b-11cf-8c77-00aa006b6814"); pub const CLSID_PROPSETID_TIMECODE_READER = &CLSID_PROPSETID_TIMECODE_READER_Value; pub const KSPROPERTY_TIMECODE = enum(i32) { TIMECODE_READER = 0, ATN_READER = 1, RTC_READER = 2, }; pub const KSPROPERTY_TIMECODE_READER = KSPROPERTY_TIMECODE.TIMECODE_READER; pub const KSPROPERTY_ATN_READER = KSPROPERTY_TIMECODE.ATN_READER; pub const KSPROPERTY_RTC_READER = KSPROPERTY_TIMECODE.RTC_READER; pub const KSPROPERTY_TIMECODE_S = extern struct { Property: KSIDENTIFIER, TimecodeSamp: TIMECODE_SAMPLE, }; pub const KSPROPERTY_TIMECODE_NODE_S = extern struct { NodeProperty: KSP_NODE, TimecodeSamp: TIMECODE_SAMPLE, }; const CLSID_KSEVENTSETID_EXTDEV_Command_Value = @import("../../zig.zig").Guid.initString("109c7988-b3cb-11d2-b48e-006097b3391b"); pub const CLSID_KSEVENTSETID_EXTDEV_Command = &CLSID_KSEVENTSETID_EXTDEV_Command_Value; pub const KSEVENT_DEVCMD = enum(i32) { COMMAND_NOTIFY_INTERIM_READY = 0, COMMAND_CONTROL_INTERIM_READY = 1, COMMAND_BUSRESET = 2, TIMECODE_UPDATE = 3, OPERATION_MODE_UPDATE = 4, TRANSPORT_STATE_UPDATE = 5, NOTIFY_REMOVAL = 6, NOTIFY_MEDIUM_CHANGE = 7, }; pub const KSEVENT_EXTDEV_COMMAND_NOTIFY_INTERIM_READY = KSEVENT_DEVCMD.COMMAND_NOTIFY_INTERIM_READY; pub const KSEVENT_EXTDEV_COMMAND_CONTROL_INTERIM_READY = KSEVENT_DEVCMD.COMMAND_CONTROL_INTERIM_READY; pub const KSEVENT_EXTDEV_COMMAND_BUSRESET = KSEVENT_DEVCMD.COMMAND_BUSRESET; pub const KSEVENT_EXTDEV_TIMECODE_UPDATE = KSEVENT_DEVCMD.TIMECODE_UPDATE; pub const KSEVENT_EXTDEV_OPERATION_MODE_UPDATE = KSEVENT_DEVCMD.OPERATION_MODE_UPDATE; pub const KSEVENT_EXTDEV_TRANSPORT_STATE_UPDATE = KSEVENT_DEVCMD.TRANSPORT_STATE_UPDATE; pub const KSEVENT_EXTDEV_NOTIFY_REMOVAL = KSEVENT_DEVCMD.NOTIFY_REMOVAL; pub const KSEVENT_EXTDEV_NOTIFY_MEDIUM_CHANGE = KSEVENT_DEVCMD.NOTIFY_MEDIUM_CHANGE; const CLSID_PROPSETID_VIDCAP_CROSSBAR_Value = @import("../../zig.zig").Guid.initString("6a2e0640-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_CROSSBAR = &CLSID_PROPSETID_VIDCAP_CROSSBAR_Value; pub const KSPROPERTY_VIDCAP_CROSSBAR = enum(i32) { CAPS = 0, PININFO = 1, CAN_ROUTE = 2, ROUTE = 3, INPUT_ACTIVE = 4, }; pub const KSPROPERTY_CROSSBAR_CAPS = KSPROPERTY_VIDCAP_CROSSBAR.CAPS; pub const KSPROPERTY_CROSSBAR_PININFO = KSPROPERTY_VIDCAP_CROSSBAR.PININFO; pub const KSPROPERTY_CROSSBAR_CAN_ROUTE = KSPROPERTY_VIDCAP_CROSSBAR.CAN_ROUTE; pub const KSPROPERTY_CROSSBAR_ROUTE = KSPROPERTY_VIDCAP_CROSSBAR.ROUTE; pub const KSPROPERTY_CROSSBAR_INPUT_ACTIVE = KSPROPERTY_VIDCAP_CROSSBAR.INPUT_ACTIVE; pub const KSPROPERTY_CROSSBAR_CAPS_S = extern struct { Property: KSIDENTIFIER, NumberOfInputs: u32, NumberOfOutputs: u32, }; pub const KSPROPERTY_CROSSBAR_PININFO_S = extern struct { Property: KSIDENTIFIER, Direction: KSPIN_DATAFLOW, Index: u32, PinType: u32, RelatedPinIndex: u32, Medium: KSIDENTIFIER, }; pub const KSPROPERTY_CROSSBAR_ROUTE_S = extern struct { Property: KSIDENTIFIER, IndexInputPin: u32, IndexOutputPin: u32, CanRoute: u32, }; pub const KSPROPERTY_CROSSBAR_ACTIVE_S = extern struct { Property: KSIDENTIFIER, IndexInputPin: u32, Active: u32, }; const CLSID_EVENTSETID_CROSSBAR_Value = @import("../../zig.zig").Guid.initString("6a2e0641-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_EVENTSETID_CROSSBAR = &CLSID_EVENTSETID_CROSSBAR_Value; pub const KSEVENT_CROSSBAR = enum(i32) { D = 0, }; pub const KSEVENT_CROSSBAR_CHANGED = KSEVENT_CROSSBAR.D; pub const KS_PhysicalConnectorType = enum(i32) { Video_Tuner = 1, Video_Composite = 2, Video_SVideo = 3, Video_RGB = 4, Video_YRYBY = 5, Video_SerialDigital = 6, Video_ParallelDigital = 7, Video_SCSI = 8, Video_AUX = 9, Video_1394 = 10, Video_USB = 11, Video_VideoDecoder = 12, Video_VideoEncoder = 13, Video_SCART = 14, Audio_Tuner = 4096, Audio_Line = 4097, Audio_Mic = 4098, Audio_AESDigital = 4099, Audio_SPDIFDigital = 4100, Audio_SCSI = 4101, Audio_AUX = 4102, Audio_1394 = 4103, Audio_USB = 4104, Audio_AudioDecoder = 4105, }; pub const KS_PhysConn_Video_Tuner = KS_PhysicalConnectorType.Video_Tuner; pub const KS_PhysConn_Video_Composite = KS_PhysicalConnectorType.Video_Composite; pub const KS_PhysConn_Video_SVideo = KS_PhysicalConnectorType.Video_SVideo; pub const KS_PhysConn_Video_RGB = KS_PhysicalConnectorType.Video_RGB; pub const KS_PhysConn_Video_YRYBY = KS_PhysicalConnectorType.Video_YRYBY; pub const KS_PhysConn_Video_SerialDigital = KS_PhysicalConnectorType.Video_SerialDigital; pub const KS_PhysConn_Video_ParallelDigital = KS_PhysicalConnectorType.Video_ParallelDigital; pub const KS_PhysConn_Video_SCSI = KS_PhysicalConnectorType.Video_SCSI; pub const KS_PhysConn_Video_AUX = KS_PhysicalConnectorType.Video_AUX; pub const KS_PhysConn_Video_1394 = KS_PhysicalConnectorType.Video_1394; pub const KS_PhysConn_Video_USB = KS_PhysicalConnectorType.Video_USB; pub const KS_PhysConn_Video_VideoDecoder = KS_PhysicalConnectorType.Video_VideoDecoder; pub const KS_PhysConn_Video_VideoEncoder = KS_PhysicalConnectorType.Video_VideoEncoder; pub const KS_PhysConn_Video_SCART = KS_PhysicalConnectorType.Video_SCART; pub const KS_PhysConn_Audio_Tuner = KS_PhysicalConnectorType.Audio_Tuner; pub const KS_PhysConn_Audio_Line = KS_PhysicalConnectorType.Audio_Line; pub const KS_PhysConn_Audio_Mic = KS_PhysicalConnectorType.Audio_Mic; pub const KS_PhysConn_Audio_AESDigital = KS_PhysicalConnectorType.Audio_AESDigital; pub const KS_PhysConn_Audio_SPDIFDigital = KS_PhysicalConnectorType.Audio_SPDIFDigital; pub const KS_PhysConn_Audio_SCSI = KS_PhysicalConnectorType.Audio_SCSI; pub const KS_PhysConn_Audio_AUX = KS_PhysicalConnectorType.Audio_AUX; pub const KS_PhysConn_Audio_1394 = KS_PhysicalConnectorType.Audio_1394; pub const KS_PhysConn_Audio_USB = KS_PhysicalConnectorType.Audio_USB; pub const KS_PhysConn_Audio_AudioDecoder = KS_PhysicalConnectorType.Audio_AudioDecoder; const CLSID_PROPSETID_VIDCAP_TVAUDIO_Value = @import("../../zig.zig").Guid.initString("6a2e0650-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_TVAUDIO = &CLSID_PROPSETID_VIDCAP_TVAUDIO_Value; pub const KSPROPERTY_VIDCAP_TVAUDIO = enum(i32) { CAPS = 0, MODE = 1, CURRENTLY_AVAILABLE_MODES = 2, }; pub const KSPROPERTY_TVAUDIO_CAPS = KSPROPERTY_VIDCAP_TVAUDIO.CAPS; pub const KSPROPERTY_TVAUDIO_MODE = KSPROPERTY_VIDCAP_TVAUDIO.MODE; pub const KSPROPERTY_TVAUDIO_CURRENTLY_AVAILABLE_MODES = KSPROPERTY_VIDCAP_TVAUDIO.CURRENTLY_AVAILABLE_MODES; pub const KSPROPERTY_TVAUDIO_CAPS_S = extern struct { Property: KSIDENTIFIER, Capabilities: u32, InputMedium: KSIDENTIFIER, OutputMedium: KSIDENTIFIER, }; pub const KSPROPERTY_TVAUDIO_S = extern struct { Property: KSIDENTIFIER, Mode: u32, }; const CLSID_KSEVENTSETID_VIDCAP_TVAUDIO_Value = @import("../../zig.zig").Guid.initString("6a2e0651-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_KSEVENTSETID_VIDCAP_TVAUDIO = &CLSID_KSEVENTSETID_VIDCAP_TVAUDIO_Value; pub const KSEVENT_TVAUDIO = enum(i32) { D = 0, }; pub const KSEVENT_TVAUDIO_CHANGED = KSEVENT_TVAUDIO.D; const CLSID_PROPSETID_VIDCAP_VIDEOCOMPRESSION_Value = @import("../../zig.zig").Guid.initString("c6e13343-30ac-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_VIDEOCOMPRESSION = &CLSID_PROPSETID_VIDCAP_VIDEOCOMPRESSION_Value; pub const KSPROPERTY_VIDCAP_VIDEOCOMPRESSION = enum(i32) { GETINFO = 0, KEYFRAME_RATE = 1, PFRAMES_PER_KEYFRAME = 2, QUALITY = 3, OVERRIDE_KEYFRAME = 4, OVERRIDE_FRAME_SIZE = 5, WINDOWSIZE = 6, }; pub const KSPROPERTY_VIDEOCOMPRESSION_GETINFO = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION.GETINFO; pub const KSPROPERTY_VIDEOCOMPRESSION_KEYFRAME_RATE = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION.KEYFRAME_RATE; pub const KSPROPERTY_VIDEOCOMPRESSION_PFRAMES_PER_KEYFRAME = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION.PFRAMES_PER_KEYFRAME; pub const KSPROPERTY_VIDEOCOMPRESSION_QUALITY = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION.QUALITY; pub const KSPROPERTY_VIDEOCOMPRESSION_OVERRIDE_KEYFRAME = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION.OVERRIDE_KEYFRAME; pub const KSPROPERTY_VIDEOCOMPRESSION_OVERRIDE_FRAME_SIZE = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION.OVERRIDE_FRAME_SIZE; pub const KSPROPERTY_VIDEOCOMPRESSION_WINDOWSIZE = KSPROPERTY_VIDCAP_VIDEOCOMPRESSION.WINDOWSIZE; pub const KS_CompressionCaps = enum(i32) { Quality = 1, Crunch = 2, KeyFrame = 4, BFrame = 8, Window = 16, }; pub const KS_CompressionCaps_CanQuality = KS_CompressionCaps.Quality; pub const KS_CompressionCaps_CanCrunch = KS_CompressionCaps.Crunch; pub const KS_CompressionCaps_CanKeyFrame = KS_CompressionCaps.KeyFrame; pub const KS_CompressionCaps_CanBFrame = KS_CompressionCaps.BFrame; pub const KS_CompressionCaps_CanWindow = KS_CompressionCaps.Window; pub const KS_VideoStreamingHints = enum(i32) { FrameInterval = 256, KeyFrameRate = 512, PFrameRate = 1024, CompQuality = 2048, CompWindowSize = 4096, }; pub const KS_StreamingHint_FrameInterval = KS_VideoStreamingHints.FrameInterval; pub const KS_StreamingHint_KeyFrameRate = KS_VideoStreamingHints.KeyFrameRate; pub const KS_StreamingHint_PFrameRate = KS_VideoStreamingHints.PFrameRate; pub const KS_StreamingHint_CompQuality = KS_VideoStreamingHints.CompQuality; pub const KS_StreamingHint_CompWindowSize = KS_VideoStreamingHints.CompWindowSize; pub const KSPROPERTY_VIDEOCOMPRESSION_GETINFO_S = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, DefaultKeyFrameRate: i32, DefaultPFrameRate: i32, DefaultQuality: i32, NumberOfQualitySettings: i32, Capabilities: i32, }; pub const KSPROPERTY_VIDEOCOMPRESSION_S = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, Value: i32, }; pub const KSPROPERTY_VIDEOCOMPRESSION_S1 = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, Value: i32, Flags: u32, }; const CLSID_KSDATAFORMAT_SUBTYPE_OVERLAY_Value = @import("../../zig.zig").Guid.initString("e436eb7f-524f-11ce-9f53-0020af0ba770"); pub const CLSID_KSDATAFORMAT_SUBTYPE_OVERLAY = &CLSID_KSDATAFORMAT_SUBTYPE_OVERLAY_Value; const CLSID_KSPROPSETID_OverlayUpdate_Value = @import("../../zig.zig").Guid.initString("490ea5cf-7681-11d1-a21c-00a0c9223196"); pub const CLSID_KSPROPSETID_OverlayUpdate = &CLSID_KSPROPSETID_OverlayUpdate_Value; pub const KSPROPERTY_OVERLAYUPDATE = enum(i32) { INTERESTS = 0, CLIPLIST = 1, PALETTE = 2, COLORKEY = 4, VIDEOPOSITION = 8, DISPLAYCHANGE = 16, COLORREF = 268435456, }; pub const KSPROPERTY_OVERLAYUPDATE_INTERESTS = KSPROPERTY_OVERLAYUPDATE.INTERESTS; pub const KSPROPERTY_OVERLAYUPDATE_CLIPLIST = KSPROPERTY_OVERLAYUPDATE.CLIPLIST; pub const KSPROPERTY_OVERLAYUPDATE_PALETTE = KSPROPERTY_OVERLAYUPDATE.PALETTE; pub const KSPROPERTY_OVERLAYUPDATE_COLORKEY = KSPROPERTY_OVERLAYUPDATE.COLORKEY; pub const KSPROPERTY_OVERLAYUPDATE_VIDEOPOSITION = KSPROPERTY_OVERLAYUPDATE.VIDEOPOSITION; pub const KSPROPERTY_OVERLAYUPDATE_DISPLAYCHANGE = KSPROPERTY_OVERLAYUPDATE.DISPLAYCHANGE; pub const KSPROPERTY_OVERLAYUPDATE_COLORREF = KSPROPERTY_OVERLAYUPDATE.COLORREF; pub const KSDISPLAYCHANGE = extern struct { PelsWidth: u32, PelsHeight: u32, BitsPerPel: u32, DeviceID: [1]u16, }; const CLSID_PROPSETID_VIDCAP_VIDEOCONTROL_Value = @import("../../zig.zig").Guid.initString("6a2e0670-28e4-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_VIDEOCONTROL = &CLSID_PROPSETID_VIDCAP_VIDEOCONTROL_Value; pub const KSPROPERTY_VIDCAP_VIDEOCONTROL = enum(i32) { CAPS = 0, ACTUAL_FRAME_RATE = 1, FRAME_RATES = 2, MODE = 3, }; pub const KSPROPERTY_VIDEOCONTROL_CAPS = KSPROPERTY_VIDCAP_VIDEOCONTROL.CAPS; pub const KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE = KSPROPERTY_VIDCAP_VIDEOCONTROL.ACTUAL_FRAME_RATE; pub const KSPROPERTY_VIDEOCONTROL_FRAME_RATES = KSPROPERTY_VIDCAP_VIDEOCONTROL.FRAME_RATES; pub const KSPROPERTY_VIDEOCONTROL_MODE = KSPROPERTY_VIDCAP_VIDEOCONTROL.MODE; pub const KS_VideoControlFlags = enum(i32) { VideoControlFlag_FlipHorizontal = 1, VideoControlFlag_FlipVertical = 2, Obsolete_VideoControlFlag_ExternalTriggerEnable = 16, Obsolete_VideoControlFlag_Trigger = 32, VideoControlFlag_ExternalTriggerEnable = 4, VideoControlFlag_Trigger = 8, VideoControlFlag_IndependentImagePin = 64, VideoControlFlag_StillCapturePreviewFrame = 128, VideoControlFlag_StartPhotoSequenceCapture = 256, VideoControlFlag_StopPhotoSequenceCapture = 512, }; pub const KS_VideoControlFlag_FlipHorizontal = KS_VideoControlFlags.VideoControlFlag_FlipHorizontal; pub const KS_VideoControlFlag_FlipVertical = KS_VideoControlFlags.VideoControlFlag_FlipVertical; pub const KS_Obsolete_VideoControlFlag_ExternalTriggerEnable = KS_VideoControlFlags.Obsolete_VideoControlFlag_ExternalTriggerEnable; pub const KS_Obsolete_VideoControlFlag_Trigger = KS_VideoControlFlags.Obsolete_VideoControlFlag_Trigger; pub const KS_VideoControlFlag_ExternalTriggerEnable = KS_VideoControlFlags.VideoControlFlag_ExternalTriggerEnable; pub const KS_VideoControlFlag_Trigger = KS_VideoControlFlags.VideoControlFlag_Trigger; pub const KS_VideoControlFlag_IndependentImagePin = KS_VideoControlFlags.VideoControlFlag_IndependentImagePin; pub const KS_VideoControlFlag_StillCapturePreviewFrame = KS_VideoControlFlags.VideoControlFlag_StillCapturePreviewFrame; pub const KS_VideoControlFlag_StartPhotoSequenceCapture = KS_VideoControlFlags.VideoControlFlag_StartPhotoSequenceCapture; pub const KS_VideoControlFlag_StopPhotoSequenceCapture = KS_VideoControlFlags.VideoControlFlag_StopPhotoSequenceCapture; pub const KSPROPERTY_VIDEOCONTROL_CAPS_S = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, VideoControlCaps: u32, }; pub const KSPROPERTY_VIDEOCONTROL_MODE_S = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, Mode: i32, }; pub const KSPROPERTY_VIDEOCONTROL_ACTUAL_FRAME_RATE_S = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, RangeIndex: u32, Dimensions: SIZE, CurrentActualFrameRate: i64, CurrentMaxAvailableFrameRate: i64, }; pub const KSPROPERTY_VIDEOCONTROL_FRAME_RATES_S = extern struct { Property: KSIDENTIFIER, StreamIndex: u32, RangeIndex: u32, Dimensions: SIZE, }; const CLSID_PROPSETID_VIDCAP_DROPPEDFRAMES_Value = @import("../../zig.zig").Guid.initString("c6e13344-30ac-11d0-a18c-00a0c9118956"); pub const CLSID_PROPSETID_VIDCAP_DROPPEDFRAMES = &CLSID_PROPSETID_VIDCAP_DROPPEDFRAMES_Value; pub const KSPROPERTY_VIDCAP_DROPPEDFRAMES = enum(i32) { T = 0, }; pub const KSPROPERTY_DROPPEDFRAMES_CURRENT = KSPROPERTY_VIDCAP_DROPPEDFRAMES.T; pub const KSPROPERTY_DROPPEDFRAMES_CURRENT_S = extern struct { Property: KSIDENTIFIER, PictureNumber: i64, DropCount: i64, AverageFrameSize: u32, }; const CLSID_KSPROPSETID_VPConfig_Value = @import("../../zig.zig").Guid.initString("bc29a660-30e3-11d0-9e69-00c04fd7c15b"); pub const CLSID_KSPROPSETID_VPConfig = &CLSID_KSPROPSETID_VPConfig_Value; const CLSID_KSPROPSETID_VPVBIConfig_Value = @import("../../zig.zig").Guid.initString("ec529b00-1a1f-11d1-bad9-00609744111a"); pub const CLSID_KSPROPSETID_VPVBIConfig = &CLSID_KSPROPSETID_VPVBIConfig_Value; pub const KSPROPERTY_VPCONFIG = enum(i32) { NUMCONNECTINFO = 0, GETCONNECTINFO = 1, SETCONNECTINFO = 2, VPDATAINFO = 3, MAXPIXELRATE = 4, INFORMVPINPUT = 5, NUMVIDEOFORMAT = 6, GETVIDEOFORMAT = 7, SETVIDEOFORMAT = 8, INVERTPOLARITY = 9, DECIMATIONCAPABILITY = 10, SCALEFACTOR = 11, DDRAWHANDLE = 12, VIDEOPORTID = 13, DDRAWSURFACEHANDLE = 14, SURFACEPARAMS = 15, }; pub const KSPROPERTY_VPCONFIG_NUMCONNECTINFO = KSPROPERTY_VPCONFIG.NUMCONNECTINFO; pub const KSPROPERTY_VPCONFIG_GETCONNECTINFO = KSPROPERTY_VPCONFIG.GETCONNECTINFO; pub const KSPROPERTY_VPCONFIG_SETCONNECTINFO = KSPROPERTY_VPCONFIG.SETCONNECTINFO; pub const KSPROPERTY_VPCONFIG_VPDATAINFO = KSPROPERTY_VPCONFIG.VPDATAINFO; pub const KSPROPERTY_VPCONFIG_MAXPIXELRATE = KSPROPERTY_VPCONFIG.MAXPIXELRATE; pub const KSPROPERTY_VPCONFIG_INFORMVPINPUT = KSPROPERTY_VPCONFIG.INFORMVPINPUT; pub const KSPROPERTY_VPCONFIG_NUMVIDEOFORMAT = KSPROPERTY_VPCONFIG.NUMVIDEOFORMAT; pub const KSPROPERTY_VPCONFIG_GETVIDEOFORMAT = KSPROPERTY_VPCONFIG.GETVIDEOFORMAT; pub const KSPROPERTY_VPCONFIG_SETVIDEOFORMAT = KSPROPERTY_VPCONFIG.SETVIDEOFORMAT; pub const KSPROPERTY_VPCONFIG_INVERTPOLARITY = KSPROPERTY_VPCONFIG.INVERTPOLARITY; pub const KSPROPERTY_VPCONFIG_DECIMATIONCAPABILITY = KSPROPERTY_VPCONFIG.DECIMATIONCAPABILITY; pub const KSPROPERTY_VPCONFIG_SCALEFACTOR = KSPROPERTY_VPCONFIG.SCALEFACTOR; pub const KSPROPERTY_VPCONFIG_DDRAWHANDLE = KSPROPERTY_VPCONFIG.DDRAWHANDLE; pub const KSPROPERTY_VPCONFIG_VIDEOPORTID = KSPROPERTY_VPCONFIG.VIDEOPORTID; pub const KSPROPERTY_VPCONFIG_DDRAWSURFACEHANDLE = KSPROPERTY_VPCONFIG.DDRAWSURFACEHANDLE; pub const KSPROPERTY_VPCONFIG_SURFACEPARAMS = KSPROPERTY_VPCONFIG.SURFACEPARAMS; const CLSID_CLSID_KsIBasicAudioInterfaceHandler_Value = @import("../../zig.zig").Guid.initString("b9f8ac3e-0f71-11d2-b72c-00c04fb6bd3d"); pub const CLSID_CLSID_KsIBasicAudioInterfaceHandler = &CLSID_CLSID_KsIBasicAudioInterfaceHandler_Value; pub const KS_AMPixAspectRatio = enum(i32) { NTSC4x3 = 0, NTSC16x9 = 1, PAL4x3 = 2, PAL16x9 = 3, }; pub const KS_PixAspectRatio_NTSC4x3 = KS_AMPixAspectRatio.NTSC4x3; pub const KS_PixAspectRatio_NTSC16x9 = KS_AMPixAspectRatio.NTSC16x9; pub const KS_PixAspectRatio_PAL4x3 = KS_AMPixAspectRatio.PAL4x3; pub const KS_PixAspectRatio_PAL16x9 = KS_AMPixAspectRatio.PAL16x9; pub const KS_AMVP_SELECTFORMATBY = enum(i32) { DO_NOT_CARE = 0, BEST_BANDWIDTH = 1, INPUT_SAME_AS_OUTPUT = 2, }; pub const KS_AMVP_DO_NOT_CARE = KS_AMVP_SELECTFORMATBY.DO_NOT_CARE; pub const KS_AMVP_BEST_BANDWIDTH = KS_AMVP_SELECTFORMATBY.BEST_BANDWIDTH; pub const KS_AMVP_INPUT_SAME_AS_OUTPUT = KS_AMVP_SELECTFORMATBY.INPUT_SAME_AS_OUTPUT; pub const KS_AMVP_MODE = enum(i32) { WEAVE = 0, BOBINTERLEAVED = 1, BOBNONINTERLEAVED = 2, SKIPEVEN = 3, SKIPODD = 4, }; pub const KS_AMVP_MODE_WEAVE = KS_AMVP_MODE.WEAVE; pub const KS_AMVP_MODE_BOBINTERLEAVED = KS_AMVP_MODE.BOBINTERLEAVED; pub const KS_AMVP_MODE_BOBNONINTERLEAVED = KS_AMVP_MODE.BOBNONINTERLEAVED; pub const KS_AMVP_MODE_SKIPEVEN = KS_AMVP_MODE.SKIPEVEN; pub const KS_AMVP_MODE_SKIPODD = KS_AMVP_MODE.SKIPODD; pub const KS_AMVPDIMINFO = extern struct { dwFieldWidth: u32, dwFieldHeight: u32, dwVBIWidth: u32, dwVBIHeight: u32, rcValidRegion: RECT, }; pub const KS_AMVPDATAINFO = extern struct { dwSize: u32, dwMicrosecondsPerField: u32, amvpDimInfo: KS_AMVPDIMINFO, dwPictAspectRatioX: u32, dwPictAspectRatioY: u32, bEnableDoubleClock: BOOL, bEnableVACT: BOOL, bDataIsInterlaced: BOOL, lHalfLinesOdd: i32, bFieldPolarityInverted: BOOL, dwNumLinesInVREF: u32, lHalfLinesEven: i32, dwReserved1: u32, }; pub const KS_AMVPSIZE = extern struct { dwWidth: u32, dwHeight: u32, }; pub const KSVPMAXPIXELRATE = extern struct { Size: KS_AMVPSIZE, MaxPixelsPerSecond: u32, Reserved: u32, }; pub const KSVPSIZE_PROP = extern struct { Property: KSIDENTIFIER, Size: KS_AMVPSIZE, }; pub const KSVPSURFACEPARAMS = extern struct { dwPitch: u32, dwXOrigin: u32, dwYOrigin: u32, }; const CLSID_KSEVENTSETID_VPNotify_Value = @import("../../zig.zig").Guid.initString("20c5598e-d3c8-11d0-8dfc-00c04fd7c08b"); pub const CLSID_KSEVENTSETID_VPNotify = &CLSID_KSEVENTSETID_VPNotify_Value; pub const KSEVENT_VPNOTIFY = enum(i32) { E = 0, }; pub const KSEVENT_VPNOTIFY_FORMATCHANGE = KSEVENT_VPNOTIFY.E; const CLSID_KSEVENTSETID_VIDCAPTOSTI_Value = @import("../../zig.zig").Guid.initString("db47de20-f628-11d1-ba41-00a0c90d2b05"); pub const CLSID_KSEVENTSETID_VIDCAPTOSTI = &CLSID_KSEVENTSETID_VIDCAPTOSTI_Value; pub const KSEVENT_VIDCAPTOSTI = enum(i32) { TOSTI_EXT_TRIGGER = 0, _AUTO_UPDATE = 1, _SEARCH = 2, }; pub const KSEVENT_VIDCAPTOSTI_EXT_TRIGGER = KSEVENT_VIDCAPTOSTI.TOSTI_EXT_TRIGGER; pub const KSEVENT_VIDCAP_AUTO_UPDATE = KSEVENT_VIDCAPTOSTI._AUTO_UPDATE; pub const KSEVENT_VIDCAP_SEARCH = KSEVENT_VIDCAPTOSTI._SEARCH; pub const KSPROPERTY_EXTENSION_UNIT = enum(i32) { INFO = 0, CONTROL = 1, PASS_THROUGH = 65535, }; pub const KSPROPERTY_EXTENSION_UNIT_INFO = KSPROPERTY_EXTENSION_UNIT.INFO; pub const KSPROPERTY_EXTENSION_UNIT_CONTROL = KSPROPERTY_EXTENSION_UNIT.CONTROL; pub const KSPROPERTY_EXTENSION_UNIT_PASS_THROUGH = KSPROPERTY_EXTENSION_UNIT.PASS_THROUGH; const CLSID_KSEVENTSETID_VPVBINotify_Value = @import("../../zig.zig").Guid.initString("ec529b01-1a1f-11d1-bad9-00609744111a"); pub const CLSID_KSEVENTSETID_VPVBINotify = &CLSID_KSEVENTSETID_VPVBINotify_Value; pub const KSEVENT_VPVBINOTIFY = enum(i32) { E = 0, }; pub const KSEVENT_VPVBINOTIFY_FORMATCHANGE = KSEVENT_VPVBINOTIFY.E; const CLSID_KSDATAFORMAT_TYPE_AUXLine21Data_Value = @import("../../zig.zig").Guid.initString("670aea80-3a82-11d0-b79b-00aa003767a7"); pub const CLSID_KSDATAFORMAT_TYPE_AUXLine21Data = &CLSID_KSDATAFORMAT_TYPE_AUXLine21Data_Value; const CLSID_KSDATAFORMAT_SUBTYPE_Line21_BytePair_Value = @import("../../zig.zig").Guid.initString("6e8d4a22-310c-11d0-b79a-00aa003767a7"); pub const CLSID_KSDATAFORMAT_SUBTYPE_Line21_BytePair = &CLSID_KSDATAFORMAT_SUBTYPE_Line21_BytePair_Value; const CLSID_KSDATAFORMAT_SUBTYPE_Line21_GOPPacket_Value = @import("../../zig.zig").Guid.initString("6e8d4a23-310c-11d0-b79a-00aa003767a7"); pub const CLSID_KSDATAFORMAT_SUBTYPE_Line21_GOPPacket = &CLSID_KSDATAFORMAT_SUBTYPE_Line21_GOPPacket_Value; pub const KSGOP_USERDATA = extern struct { sc: u32, reserved1: u32, cFields: u8, l21Data: [3]CHAR, }; const CLSID_KSDATAFORMAT_TYPE_DVD_ENCRYPTED_PACK_Value = @import("../../zig.zig").Guid.initString("ed0b916a-044d-11d1-aa78-00c04fc31d60"); pub const CLSID_KSDATAFORMAT_TYPE_DVD_ENCRYPTED_PACK = &CLSID_KSDATAFORMAT_TYPE_DVD_ENCRYPTED_PACK_Value; const CLSID_KSPROPSETID_TSRateChange_Value = @import("../../zig.zig").Guid.initString("a503c5c0-1d1d-11d1-ad80-444553540000"); pub const CLSID_KSPROPSETID_TSRateChange = &CLSID_KSPROPSETID_TSRateChange_Value; pub const KS_AM_PROPERTY_TS_RATE_CHANGE = enum(i32) { SimpleRateChange = 1, ExactRateChange = 2, MaxFullDataRate = 3, Step = 4, }; pub const KS_AM_RATE_SimpleRateChange = KS_AM_PROPERTY_TS_RATE_CHANGE.SimpleRateChange; pub const KS_AM_RATE_ExactRateChange = KS_AM_PROPERTY_TS_RATE_CHANGE.ExactRateChange; pub const KS_AM_RATE_MaxFullDataRate = KS_AM_PROPERTY_TS_RATE_CHANGE.MaxFullDataRate; pub const KS_AM_RATE_Step = KS_AM_PROPERTY_TS_RATE_CHANGE.Step; pub const KS_AM_SimpleRateChange = extern struct { StartTime: i64, Rate: i32, }; pub const KS_AM_ExactRateChange = extern struct { OutputZeroTime: i64, Rate: i32, }; const CLSID_KSCATEGORY_ENCODER_Value = @import("../../zig.zig").Guid.initString("19689bf6-c384-48fd-ad51-90e58c79f70b"); pub const CLSID_KSCATEGORY_ENCODER = &CLSID_KSCATEGORY_ENCODER_Value; const CLSID_KSCATEGORY_MULTIPLEXER_Value = @import("../../zig.zig").Guid.initString("7a5de1d3-01a1-452c-b481-4fa2b96271e8"); pub const CLSID_KSCATEGORY_MULTIPLEXER = &CLSID_KSCATEGORY_MULTIPLEXER_Value; const CLSID_ENCAPIPARAM_BITRATE_Value = @import("../../zig.zig").Guid.initString("49cc4c43-ca83-4ad4-a9af-f3696af666df"); pub const CLSID_ENCAPIPARAM_BITRATE = &CLSID_ENCAPIPARAM_BITRATE_Value; const CLSID_ENCAPIPARAM_PEAK_BITRATE_Value = @import("../../zig.zig").Guid.initString("703f16a9-3d48-44a1-b077-018dff915d19"); pub const CLSID_ENCAPIPARAM_PEAK_BITRATE = &CLSID_ENCAPIPARAM_PEAK_BITRATE_Value; const CLSID_ENCAPIPARAM_BITRATE_MODE_Value = @import("../../zig.zig").Guid.initString("ee5fb25c-c713-40d1-9d58-c0d7241e250f"); pub const CLSID_ENCAPIPARAM_BITRATE_MODE = &CLSID_ENCAPIPARAM_BITRATE_MODE_Value; const CLSID_CODECAPI_CHANGELISTS_Value = @import("../../zig.zig").Guid.initString("62b12acf-f6b0-47d9-9456-96f22c4e0b9d"); pub const CLSID_CODECAPI_CHANGELISTS = &CLSID_CODECAPI_CHANGELISTS_Value; const CLSID_CODECAPI_VIDEO_ENCODER_Value = @import("../../zig.zig").Guid.initString("7112e8e1-3d03-47ef-8e60-03f1cf537301"); pub const CLSID_CODECAPI_VIDEO_ENCODER = &CLSID_CODECAPI_VIDEO_ENCODER_Value; const CLSID_CODECAPI_AUDIO_ENCODER_Value = @import("../../zig.zig").Guid.initString("b9d19a3e-f897-429c-bc46-8138b7272b2d"); pub const CLSID_CODECAPI_AUDIO_ENCODER = &CLSID_CODECAPI_AUDIO_ENCODER_Value; const CLSID_CODECAPI_SETALLDEFAULTS_Value = @import("../../zig.zig").Guid.initString("6c5e6a7c-acf8-4f55-a999-1a628109051b"); pub const CLSID_CODECAPI_SETALLDEFAULTS = &CLSID_CODECAPI_SETALLDEFAULTS_Value; const CLSID_CODECAPI_ALLSETTINGS_Value = @import("../../zig.zig").Guid.initString("6a577e92-83e1-4113-adc2-4fcec32f83a1"); pub const CLSID_CODECAPI_ALLSETTINGS = &CLSID_CODECAPI_ALLSETTINGS_Value; const CLSID_CODECAPI_SUPPORTSEVENTS_Value = @import("../../zig.zig").Guid.initString("0581af97-7693-4dbd-9dca-3f9ebd6585a1"); pub const CLSID_CODECAPI_SUPPORTSEVENTS = &CLSID_CODECAPI_SUPPORTSEVENTS_Value; const CLSID_CODECAPI_CURRENTCHANGELIST_Value = @import("../../zig.zig").Guid.initString("1cb14e83-7d72-4657-83fd-47a2c5b9d13d"); pub const CLSID_CODECAPI_CURRENTCHANGELIST = &CLSID_CODECAPI_CURRENTCHANGELIST_Value; const CLSID_KSPROPSETID_Jack_Value = @import("../../zig.zig").Guid.initString("4509f757-2d46-4637-8e62-ce7db944f57b"); pub const CLSID_KSPROPSETID_Jack = &CLSID_KSPROPSETID_Jack_Value; pub const KSPROPERTY_JACK = enum(i32) { DESCRIPTION = 1, DESCRIPTION2 = 2, SINK_INFO = 3, CONTAINERID = 4, }; pub const KSPROPERTY_JACK_DESCRIPTION = KSPROPERTY_JACK.DESCRIPTION; pub const KSPROPERTY_JACK_DESCRIPTION2 = KSPROPERTY_JACK.DESCRIPTION2; pub const KSPROPERTY_JACK_SINK_INFO = KSPROPERTY_JACK.SINK_INFO; pub const KSPROPERTY_JACK_CONTAINERID = KSPROPERTY_JACK.CONTAINERID; pub const EPcxConnectionType = enum(i32) { Unknown = 0, @"3Point5mm" = 1, Quarter = 2, AtapiInternal = 3, RCA = 4, Optical = 5, OtherDigital = 6, OtherAnalog = 7, MultichannelAnalogDIN = 8, XlrProfessional = 9, RJ11Modem = 10, Combination = 11, }; pub const eConnTypeUnknown = EPcxConnectionType.Unknown; pub const eConnType3Point5mm = EPcxConnectionType.@"3Point5mm"; pub const eConnTypeQuarter = EPcxConnectionType.Quarter; pub const eConnTypeAtapiInternal = EPcxConnectionType.AtapiInternal; pub const eConnTypeRCA = EPcxConnectionType.RCA; pub const eConnTypeOptical = EPcxConnectionType.Optical; pub const eConnTypeOtherDigital = EPcxConnectionType.OtherDigital; pub const eConnTypeOtherAnalog = EPcxConnectionType.OtherAnalog; pub const eConnTypeMultichannelAnalogDIN = EPcxConnectionType.MultichannelAnalogDIN; pub const eConnTypeXlrProfessional = EPcxConnectionType.XlrProfessional; pub const eConnTypeRJ11Modem = EPcxConnectionType.RJ11Modem; pub const eConnTypeCombination = EPcxConnectionType.Combination; pub const EPcxGeoLocation = enum(i32) { eGeoLocRear = 1, eGeoLocFront = 2, eGeoLocLeft = 3, eGeoLocRight = 4, eGeoLocTop = 5, eGeoLocBottom = 6, eGeoLocRearPanel = 7, eGeoLocRiser = 8, eGeoLocInsideMobileLid = 9, eGeoLocDrivebay = 10, eGeoLocHDMI = 11, eGeoLocOutsideMobileLid = 12, eGeoLocATAPI = 13, eGeoLocNotApplicable = 14, eGeoLocReserved6 = 15, EPcxGeoLocation_enum_count = 16, }; pub const eGeoLocRear = EPcxGeoLocation.eGeoLocRear; pub const eGeoLocFront = EPcxGeoLocation.eGeoLocFront; pub const eGeoLocLeft = EPcxGeoLocation.eGeoLocLeft; pub const eGeoLocRight = EPcxGeoLocation.eGeoLocRight; pub const eGeoLocTop = EPcxGeoLocation.eGeoLocTop; pub const eGeoLocBottom = EPcxGeoLocation.eGeoLocBottom; pub const eGeoLocRearPanel = EPcxGeoLocation.eGeoLocRearPanel; pub const eGeoLocRiser = EPcxGeoLocation.eGeoLocRiser; pub const eGeoLocInsideMobileLid = EPcxGeoLocation.eGeoLocInsideMobileLid; pub const eGeoLocDrivebay = EPcxGeoLocation.eGeoLocDrivebay; pub const eGeoLocHDMI = EPcxGeoLocation.eGeoLocHDMI; pub const eGeoLocOutsideMobileLid = EPcxGeoLocation.eGeoLocOutsideMobileLid; pub const eGeoLocATAPI = EPcxGeoLocation.eGeoLocATAPI; pub const eGeoLocNotApplicable = EPcxGeoLocation.eGeoLocNotApplicable; pub const eGeoLocReserved6 = EPcxGeoLocation.eGeoLocReserved6; pub const EPcxGeoLocation_enum_count = EPcxGeoLocation.EPcxGeoLocation_enum_count; pub const EPcxGenLocation = enum(i32) { eGenLocPrimaryBox = 0, eGenLocInternal = 1, eGenLocSeparate = 2, eGenLocOther = 3, EPcxGenLocation_enum_count = 4, }; pub const eGenLocPrimaryBox = EPcxGenLocation.eGenLocPrimaryBox; pub const eGenLocInternal = EPcxGenLocation.eGenLocInternal; pub const eGenLocSeparate = EPcxGenLocation.eGenLocSeparate; pub const eGenLocOther = EPcxGenLocation.eGenLocOther; pub const EPcxGenLocation_enum_count = EPcxGenLocation.EPcxGenLocation_enum_count; pub const EPxcPortConnection = enum(i32) { Jack = 0, IntegratedDevice = 1, BothIntegratedAndJack = 2, Unknown = 3, }; pub const ePortConnJack = EPxcPortConnection.Jack; pub const ePortConnIntegratedDevice = EPxcPortConnection.IntegratedDevice; pub const ePortConnBothIntegratedAndJack = EPxcPortConnection.BothIntegratedAndJack; pub const ePortConnUnknown = EPxcPortConnection.Unknown; pub const KSJACK_DESCRIPTION = extern struct { ChannelMapping: u32, Color: u32, ConnectionType: EPcxConnectionType, GeoLocation: EPcxGeoLocation, GenLocation: EPcxGenLocation, PortConnection: EPxcPortConnection, IsConnected: BOOL, }; pub const KSJACK_SINK_CONNECTIONTYPE = enum(i32) { HDMI = 0, DISPLAYPORT = 1, }; pub const KSJACK_SINK_CONNECTIONTYPE_HDMI = KSJACK_SINK_CONNECTIONTYPE.HDMI; pub const KSJACK_SINK_CONNECTIONTYPE_DISPLAYPORT = KSJACK_SINK_CONNECTIONTYPE.DISPLAYPORT; pub const KSJACK_SINK_INFORMATION = extern struct { ConnType: KSJACK_SINK_CONNECTIONTYPE, ManufacturerId: u16, ProductId: u16, AudioLatency: u16, HDCPCapable: BOOL, AICapable: BOOL, SinkDescriptionLength: u8, SinkDescription: [32]u16, PortId: LUID, }; pub const KSJACK_DESCRIPTION2 = extern struct { DeviceStateInfo: u32, JackCapabilities: u32, }; const CLSID_KSPROPSETID_AudioPosture_Value = @import("../../zig.zig").Guid.initString("db14e8da-0267-4aab-8759-bac88e46b653"); pub const CLSID_KSPROPSETID_AudioPosture = &CLSID_KSPROPSETID_AudioPosture_Value; pub const KSPROPERTY_AUDIOPOSTURE = enum(i32) { N = 1, }; pub const KSPROPERTY_AUDIOPOSTURE_DESCRIPTION = KSPROPERTY_AUDIOPOSTURE.N; pub const AUDIOPOSTURE_PANEL_ORIENTATION = enum(i32) { NOTROTATED = 0, ROTATED90DEGREESCOUNTERCLOCKWISE = 1, ROTATED180DEGREESCOUNTERCLOCKWISE = 2, ROTATED270DEGREESCOUNTERCLOCKWISE = 3, FACEUP = 4, FACEDOWN = 5, COUNT = 6, }; pub const AUDIOPOSTURE_PANEL_ORIENTATION_NOTROTATED = AUDIOPOSTURE_PANEL_ORIENTATION.NOTROTATED; pub const AUDIOPOSTURE_PANEL_ORIENTATION_ROTATED90DEGREESCOUNTERCLOCKWISE = AUDIOPOSTURE_PANEL_ORIENTATION.ROTATED90DEGREESCOUNTERCLOCKWISE; pub const AUDIOPOSTURE_PANEL_ORIENTATION_ROTATED180DEGREESCOUNTERCLOCKWISE = AUDIOPOSTURE_PANEL_ORIENTATION.ROTATED180DEGREESCOUNTERCLOCKWISE; pub const AUDIOPOSTURE_PANEL_ORIENTATION_ROTATED270DEGREESCOUNTERCLOCKWISE = AUDIOPOSTURE_PANEL_ORIENTATION.ROTATED270DEGREESCOUNTERCLOCKWISE; pub const AUDIOPOSTURE_PANEL_ORIENTATION_FACEUP = AUDIOPOSTURE_PANEL_ORIENTATION.FACEUP; pub const AUDIOPOSTURE_PANEL_ORIENTATION_FACEDOWN = AUDIOPOSTURE_PANEL_ORIENTATION.FACEDOWN; pub const AUDIOPOSTURE_PANEL_ORIENTATION_COUNT = AUDIOPOSTURE_PANEL_ORIENTATION.COUNT; pub const AUDIOPOSTURE_PANEL_POWER = enum(i32) { FF = 0, N = 1, }; pub const AUDIOPOSTURE_PANEL_POWER_OFF = AUDIOPOSTURE_PANEL_POWER.FF; pub const AUDIOPOSTURE_PANEL_POWER_ON = AUDIOPOSTURE_PANEL_POWER.N; pub const KSAUDIOPOSTURE_PANEL_STATE = extern struct { Power: AUDIOPOSTURE_PANEL_POWER, Orientation: AUDIOPOSTURE_PANEL_ORIENTATION, }; pub const AUDIOPOSTURE_MEMBER_FLAGS = enum(i32) { HINGEANGLE = 1, PANELSTATE = 2, }; pub const AUDIOPOSTURE_MEMBER_FLAGS_HINGEANGLE = AUDIOPOSTURE_MEMBER_FLAGS.HINGEANGLE; pub const AUDIOPOSTURE_MEMBER_FLAGS_PANELSTATE = AUDIOPOSTURE_MEMBER_FLAGS.PANELSTATE; pub const KSAUDIOPOSTURE_DESCRIPTION = extern struct { CbSize: u32, MembersListCount: u32, }; const CLSID_KSPROPSETID_AudioBufferDuration_Value = @import("../../zig.zig").Guid.initString("4e73c07f-23cc-4955-a7ea-3da502496290"); pub const CLSID_KSPROPSETID_AudioBufferDuration = &CLSID_KSPROPSETID_AudioBufferDuration_Value; const CLSID_KSPROPSETID_AudioEngine_Value = @import("../../zig.zig").Guid.initString("3a2f82dc-886f-4baa-9eb4-082b9025c536"); pub const CLSID_KSPROPSETID_AudioEngine = &CLSID_KSPROPSETID_AudioEngine_Value; pub const KSPROPERTY_AUDIOENGINE = enum(i32) { LFXENABLE = 0, GFXENABLE = 1, MIXFORMAT = 2, DEVICEFORMAT = 4, SUPPORTEDDEVICEFORMATS = 5, DESCRIPTOR = 6, BUFFER_SIZE_RANGE = 7, LOOPBACK_PROTECTION = 8, VOLUMELEVEL = 9, }; pub const KSPROPERTY_AUDIOENGINE_LFXENABLE = KSPROPERTY_AUDIOENGINE.LFXENABLE; pub const KSPROPERTY_AUDIOENGINE_GFXENABLE = KSPROPERTY_AUDIOENGINE.GFXENABLE; pub const KSPROPERTY_AUDIOENGINE_MIXFORMAT = KSPROPERTY_AUDIOENGINE.MIXFORMAT; pub const KSPROPERTY_AUDIOENGINE_DEVICEFORMAT = KSPROPERTY_AUDIOENGINE.DEVICEFORMAT; pub const KSPROPERTY_AUDIOENGINE_SUPPORTEDDEVICEFORMATS = KSPROPERTY_AUDIOENGINE.SUPPORTEDDEVICEFORMATS; pub const KSPROPERTY_AUDIOENGINE_DESCRIPTOR = KSPROPERTY_AUDIOENGINE.DESCRIPTOR; pub const KSPROPERTY_AUDIOENGINE_BUFFER_SIZE_RANGE = KSPROPERTY_AUDIOENGINE.BUFFER_SIZE_RANGE; pub const KSPROPERTY_AUDIOENGINE_LOOPBACK_PROTECTION = KSPROPERTY_AUDIOENGINE.LOOPBACK_PROTECTION; pub const KSPROPERTY_AUDIOENGINE_VOLUMELEVEL = KSPROPERTY_AUDIOENGINE.VOLUMELEVEL; pub const KSAUDIOENGINE_DESCRIPTOR = extern struct { nHostPinId: u32, nOffloadPinId: u32, nLoopbackPinId: u32, }; pub const KSAUDIOENGINE_BUFFER_SIZE_RANGE = extern struct { MinBufferBytes: u32, MaxBufferBytes: u32, }; pub const AUDIO_CURVE_TYPE = enum(i32) { NONE = 0, WINDOWS_FADE = 1, }; pub const AUDIO_CURVE_TYPE_NONE = AUDIO_CURVE_TYPE.NONE; pub const AUDIO_CURVE_TYPE_WINDOWS_FADE = AUDIO_CURVE_TYPE.WINDOWS_FADE; pub const KSAUDIOENGINE_VOLUMELEVEL = extern struct { TargetVolume: i32, CurveType: AUDIO_CURVE_TYPE, CurveDuration: u64, }; const CLSID_KSPROPSETID_AudioSignalProcessing_Value = @import("../../zig.zig").Guid.initString("4f67b528-30c9-40de-b2fb-859ddd1f3470"); pub const CLSID_KSPROPSETID_AudioSignalProcessing = &CLSID_KSPROPSETID_AudioSignalProcessing_Value; pub const KSPROPERTY_AUDIOSIGNALPROCESSING = enum(i32) { S = 0, }; pub const KSPROPERTY_AUDIOSIGNALPROCESSING_MODES = KSPROPERTY_AUDIOSIGNALPROCESSING.S; const CLSID_KSATTRIBUTEID_AUDIOSIGNALPROCESSING_MODE_Value = @import("../../zig.zig").Guid.initString("e1f89eb5-5f46-419b-967b-ff6770b98401"); pub const CLSID_KSATTRIBUTEID_AUDIOSIGNALPROCESSING_MODE = &CLSID_KSATTRIBUTEID_AUDIOSIGNALPROCESSING_MODE_Value; pub const KSATTRIBUTE_AUDIOSIGNALPROCESSING_MODE = extern struct { AttributeHeader: KSATTRIBUTE, SignalProcessingMode: Guid, }; const CLSID_AUDIO_SIGNALPROCESSINGMODE_DEFAULT_Value = @import("../../zig.zig").Guid.initString("c18e2f7e-933d-4965-b7d1-1eef228d2af3"); pub const CLSID_AUDIO_SIGNALPROCESSINGMODE_DEFAULT = &CLSID_AUDIO_SIGNALPROCESSINGMODE_DEFAULT_Value; const CLSID_AUDIO_SIGNALPROCESSINGMODE_RAW_Value = @import("../../zig.zig").Guid.initString("9e90ea20-b493-4fd1-a1a8-7e1361a956cf"); pub const CLSID_AUDIO_SIGNALPROCESSINGMODE_RAW = &CLSID_AUDIO_SIGNALPROCESSINGMODE_RAW_Value; const CLSID_BLUETOOTHLE_MIDI_SERVICE_UUID_Value = @import("../../zig.zig").Guid.initString("03b80e5a-ede8-4b33-a751-6ce34ec4c700"); pub const CLSID_BLUETOOTHLE_MIDI_SERVICE_UUID = &CLSID_BLUETOOTHLE_MIDI_SERVICE_UUID_Value; const CLSID_BLUETOOTH_MIDI_DATAIO_CHARACTERISTIC_Value = @import("../../zig.zig").Guid.initString("7772e5db-3868-4112-a1a9-f2669d106bf3"); pub const CLSID_BLUETOOTH_MIDI_DATAIO_CHARACTERISTIC = &CLSID_BLUETOOTH_MIDI_DATAIO_CHARACTERISTIC_Value; const CLSID_APO_CLASS_UUID_Value = @import("../../zig.zig").Guid.initString("5989fce8-9cd0-467d-8a6a-5419e31529d4"); pub const CLSID_APO_CLASS_UUID = &CLSID_APO_CLASS_UUID_Value; const CLSID_AUDIOENDPOINT_CLASS_UUID_Value = @import("../../zig.zig").Guid.initString("c166523c-fe0c-4a94-a586-f1a80cfbbf3e"); pub const CLSID_AUDIOENDPOINT_CLASS_UUID = &CLSID_AUDIOENDPOINT_CLASS_UUID_Value; const CLSID_AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS_Value = @import("../../zig.zig").Guid.initString("98951333-b9cd-48b1-a0a3-ff40682d73f7"); pub const CLSID_AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS = &CLSID_AUDIO_SIGNALPROCESSINGMODE_COMMUNICATIONS_Value; const CLSID_AUDIO_SIGNALPROCESSINGMODE_SPEECH_Value = @import("../../zig.zig").Guid.initString("fc1cfc9b-b9d6-4cfa-b5e0-4bb2166878b2"); pub const CLSID_AUDIO_SIGNALPROCESSINGMODE_SPEECH = &CLSID_AUDIO_SIGNALPROCESSINGMODE_SPEECH_Value; const CLSID_AUDIO_SIGNALPROCESSINGMODE_NOTIFICATION_Value = @import("../../zig.zig").Guid.initString("9cf2a70b-f377-403b-bd6b-360863e0355c"); pub const CLSID_AUDIO_SIGNALPROCESSINGMODE_NOTIFICATION = &CLSID_AUDIO_SIGNALPROCESSINGMODE_NOTIFICATION_Value; const CLSID_AUDIO_SIGNALPROCESSINGMODE_MEDIA_Value = @import("../../zig.zig").Guid.initString("4780004e-7133-41d8-8c74-660dadd2c0ee"); pub const CLSID_AUDIO_SIGNALPROCESSINGMODE_MEDIA = &CLSID_AUDIO_SIGNALPROCESSINGMODE_MEDIA_Value; const CLSID_AUDIO_SIGNALPROCESSINGMODE_MOVIE_Value = @import("../../zig.zig").Guid.initString("b26feb0d-ec94-477c-9494-d1ab8e753f6e"); pub const CLSID_AUDIO_SIGNALPROCESSINGMODE_MOVIE = &CLSID_AUDIO_SIGNALPROCESSINGMODE_MOVIE_Value; const CLSID_AUDIO_EFFECT_TYPE_ACOUSTIC_ECHO_CANCELLATION_Value = @import("../../zig.zig").Guid.initString("6f64adbe-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_ACOUSTIC_ECHO_CANCELLATION = &CLSID_AUDIO_EFFECT_TYPE_ACOUSTIC_ECHO_CANCELLATION_Value; const CLSID_AUDIO_EFFECT_TYPE_NOISE_SUPPRESSION_Value = @import("../../zig.zig").Guid.initString("6f64adbf-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_NOISE_SUPPRESSION = &CLSID_AUDIO_EFFECT_TYPE_NOISE_SUPPRESSION_Value; const CLSID_AUDIO_EFFECT_TYPE_AUTOMATIC_GAIN_CONTROL_Value = @import("../../zig.zig").Guid.initString("6f64adc0-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_AUTOMATIC_GAIN_CONTROL = &CLSID_AUDIO_EFFECT_TYPE_AUTOMATIC_GAIN_CONTROL_Value; const CLSID_AUDIO_EFFECT_TYPE_BEAMFORMING_Value = @import("../../zig.zig").Guid.initString("6f64adc1-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_BEAMFORMING = &CLSID_AUDIO_EFFECT_TYPE_BEAMFORMING_Value; const CLSID_AUDIO_EFFECT_TYPE_CONSTANT_TONE_REMOVAL_Value = @import("../../zig.zig").Guid.initString("6f64adc2-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_CONSTANT_TONE_REMOVAL = &CLSID_AUDIO_EFFECT_TYPE_CONSTANT_TONE_REMOVAL_Value; const CLSID_AUDIO_EFFECT_TYPE_EQUALIZER_Value = @import("../../zig.zig").Guid.initString("6f64adc3-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_EQUALIZER = &CLSID_AUDIO_EFFECT_TYPE_EQUALIZER_Value; const CLSID_AUDIO_EFFECT_TYPE_LOUDNESS_EQUALIZER_Value = @import("../../zig.zig").Guid.initString("6f64adc4-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_LOUDNESS_EQUALIZER = &CLSID_AUDIO_EFFECT_TYPE_LOUDNESS_EQUALIZER_Value; const CLSID_AUDIO_EFFECT_TYPE_BASS_BOOST_Value = @import("../../zig.zig").Guid.initString("6f64adc5-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_BASS_BOOST = &CLSID_AUDIO_EFFECT_TYPE_BASS_BOOST_Value; const CLSID_AUDIO_EFFECT_TYPE_VIRTUAL_SURROUND_Value = @import("../../zig.zig").Guid.initString("6f64adc6-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_VIRTUAL_SURROUND = &CLSID_AUDIO_EFFECT_TYPE_VIRTUAL_SURROUND_Value; const CLSID_AUDIO_EFFECT_TYPE_VIRTUAL_HEADPHONES_Value = @import("../../zig.zig").Guid.initString("6f64adc7-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_VIRTUAL_HEADPHONES = &CLSID_AUDIO_EFFECT_TYPE_VIRTUAL_HEADPHONES_Value; const CLSID_AUDIO_EFFECT_TYPE_SPEAKER_FILL_Value = @import("../../zig.zig").Guid.initString("6f64adc8-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_SPEAKER_FILL = &CLSID_AUDIO_EFFECT_TYPE_SPEAKER_FILL_Value; const CLSID_AUDIO_EFFECT_TYPE_ROOM_CORRECTION_Value = @import("../../zig.zig").Guid.initString("6f64adc9-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_ROOM_CORRECTION = &CLSID_AUDIO_EFFECT_TYPE_ROOM_CORRECTION_Value; const CLSID_AUDIO_EFFECT_TYPE_BASS_MANAGEMENT_Value = @import("../../zig.zig").Guid.initString("6f64adca-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_BASS_MANAGEMENT = &CLSID_AUDIO_EFFECT_TYPE_BASS_MANAGEMENT_Value; const CLSID_AUDIO_EFFECT_TYPE_ENVIRONMENTAL_EFFECTS_Value = @import("../../zig.zig").Guid.initString("6f64adcb-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_ENVIRONMENTAL_EFFECTS = &CLSID_AUDIO_EFFECT_TYPE_ENVIRONMENTAL_EFFECTS_Value; const CLSID_AUDIO_EFFECT_TYPE_SPEAKER_PROTECTION_Value = @import("../../zig.zig").Guid.initString("6f64adcc-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_SPEAKER_PROTECTION = &CLSID_AUDIO_EFFECT_TYPE_SPEAKER_PROTECTION_Value; const CLSID_AUDIO_EFFECT_TYPE_SPEAKER_COMPENSATION_Value = @import("../../zig.zig").Guid.initString("6f64adcd-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_SPEAKER_COMPENSATION = &CLSID_AUDIO_EFFECT_TYPE_SPEAKER_COMPENSATION_Value; const CLSID_AUDIO_EFFECT_TYPE_DYNAMIC_RANGE_COMPRESSION_Value = @import("../../zig.zig").Guid.initString("6f64adce-8211-11e2-8c70-2c27d7f001fa"); pub const CLSID_AUDIO_EFFECT_TYPE_DYNAMIC_RANGE_COMPRESSION = &CLSID_AUDIO_EFFECT_TYPE_DYNAMIC_RANGE_COMPRESSION_Value; const CLSID_KSPROPSETID_AudioModule_Value = @import("../../zig.zig").Guid.initString("c034fdb0-ff75-47c8-aa3c-ee46716b50c6"); pub const CLSID_KSPROPSETID_AudioModule = &CLSID_KSPROPSETID_AudioModule_Value; pub const KSPROPERTY_AUDIOMODULE = enum(i32) { DESCRIPTORS = 1, COMMAND = 2, NOTIFICATION_DEVICE_ID = 3, }; pub const KSPROPERTY_AUDIOMODULE_DESCRIPTORS = KSPROPERTY_AUDIOMODULE.DESCRIPTORS; pub const KSPROPERTY_AUDIOMODULE_COMMAND = KSPROPERTY_AUDIOMODULE.COMMAND; pub const KSPROPERTY_AUDIOMODULE_NOTIFICATION_DEVICE_ID = KSPROPERTY_AUDIOMODULE.NOTIFICATION_DEVICE_ID; pub const KSAUDIOMODULE_DESCRIPTOR = extern struct { ClassId: Guid, InstanceId: u32, VersionMajor: u32, VersionMinor: u32, Name: [128]u16, }; pub const KSAUDIOMODULE_PROPERTY = extern struct { Property: KSIDENTIFIER, ClassId: Guid, InstanceId: u32, }; const CLSID_KSNOTIFICATIONID_AudioModule_Value = @import("../../zig.zig").Guid.initString("9c2220f0-d9a6-4d5c-a036-573857fd50d2"); pub const CLSID_KSNOTIFICATIONID_AudioModule = &CLSID_KSNOTIFICATIONID_AudioModule_Value; pub const KSAUDIOMODULE_NOTIFICATION = extern struct { Anonymous: extern union { ProviderId: extern struct { DeviceId: Guid, ClassId: Guid, InstanceId: u32, Reserved: u32, }, Alignment: i64, }, }; pub const _AUDCLNT_BUFFERFLAGS = enum(i32) { DATA_DISCONTINUITY = 1, SILENT = 2, TIMESTAMP_ERROR = 4, }; pub const AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = _AUDCLNT_BUFFERFLAGS.DATA_DISCONTINUITY; pub const AUDCLNT_BUFFERFLAGS_SILENT = _AUDCLNT_BUFFERFLAGS.SILENT; pub const AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = _AUDCLNT_BUFFERFLAGS.TIMESTAMP_ERROR; pub const AUDCLNT_STREAMOPTIONS = enum(u32) { NONE = 0, RAW = 1, MATCH_FORMAT = 2, AMBISONICS = 4, _, pub fn initFlags(o: struct { NONE: u1 = 0, RAW: u1 = 0, MATCH_FORMAT: u1 = 0, AMBISONICS: u1 = 0, }) AUDCLNT_STREAMOPTIONS { return @intToEnum(AUDCLNT_STREAMOPTIONS, (if (o.NONE == 1) @enumToInt(AUDCLNT_STREAMOPTIONS.NONE) else 0) | (if (o.RAW == 1) @enumToInt(AUDCLNT_STREAMOPTIONS.RAW) else 0) | (if (o.MATCH_FORMAT == 1) @enumToInt(AUDCLNT_STREAMOPTIONS.MATCH_FORMAT) else 0) | (if (o.AMBISONICS == 1) @enumToInt(AUDCLNT_STREAMOPTIONS.AMBISONICS) else 0) ); } }; pub const AUDCLNT_STREAMOPTIONS_NONE = AUDCLNT_STREAMOPTIONS.NONE; pub const AUDCLNT_STREAMOPTIONS_RAW = AUDCLNT_STREAMOPTIONS.RAW; pub const AUDCLNT_STREAMOPTIONS_MATCH_FORMAT = AUDCLNT_STREAMOPTIONS.MATCH_FORMAT; pub const AUDCLNT_STREAMOPTIONS_AMBISONICS = AUDCLNT_STREAMOPTIONS.AMBISONICS; pub const AudioClientProperties = extern struct { cbSize: u32, bIsOffload: BOOL, eCategory: AUDIO_STREAM_CATEGORY, Options: AUDCLNT_STREAMOPTIONS, }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioClient_Value = @import("../../zig.zig").Guid.initString("1cb9ad4c-dbfa-4c32-b178-c2f568a703b2"); pub const IID_IAudioClient = &IID_IAudioClient_Value; pub const IAudioClient = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Initialize: fn( self: *const IAudioClient, ShareMode: AUDCLNT_SHAREMODE, StreamFlags: u32, hnsBufferDuration: i64, hnsPeriodicity: i64, pFormat: ?*const WAVEFORMATEX, AudioSessionGuid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBufferSize: fn( self: *const IAudioClient, pNumBufferFrames: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStreamLatency: fn( self: *const IAudioClient, phnsLatency: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrentPadding: fn( self: *const IAudioClient, pNumPaddingFrames: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsFormatSupported: fn( self: *const IAudioClient, ShareMode: AUDCLNT_SHAREMODE, pFormat: ?*const WAVEFORMATEX, ppClosestMatch: ?*?*WAVEFORMATEX, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMixFormat: fn( self: *const IAudioClient, ppDeviceFormat: ?*?*WAVEFORMATEX, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDevicePeriod: fn( self: *const IAudioClient, phnsDefaultDevicePeriod: ?*i64, phnsMinimumDevicePeriod: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Start: fn( self: *const IAudioClient, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stop: fn( self: *const IAudioClient, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IAudioClient, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventHandle: fn( self: *const IAudioClient, eventHandle: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetService: fn( self: *const IAudioClient, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_Initialize(self: *const T, ShareMode: AUDCLNT_SHAREMODE, StreamFlags: u32, hnsBufferDuration: i64, hnsPeriodicity: i64, pFormat: ?*const WAVEFORMATEX, AudioSessionGuid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).Initialize(@ptrCast(*const IAudioClient, self), ShareMode, StreamFlags, hnsBufferDuration, hnsPeriodicity, pFormat, AudioSessionGuid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_GetBufferSize(self: *const T, pNumBufferFrames: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).GetBufferSize(@ptrCast(*const IAudioClient, self), pNumBufferFrames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_GetStreamLatency(self: *const T, phnsLatency: ?*i64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).GetStreamLatency(@ptrCast(*const IAudioClient, self), phnsLatency); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_GetCurrentPadding(self: *const T, pNumPaddingFrames: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).GetCurrentPadding(@ptrCast(*const IAudioClient, self), pNumPaddingFrames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_IsFormatSupported(self: *const T, ShareMode: AUDCLNT_SHAREMODE, pFormat: ?*const WAVEFORMATEX, ppClosestMatch: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).IsFormatSupported(@ptrCast(*const IAudioClient, self), ShareMode, pFormat, ppClosestMatch); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_GetMixFormat(self: *const T, ppDeviceFormat: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).GetMixFormat(@ptrCast(*const IAudioClient, self), ppDeviceFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_GetDevicePeriod(self: *const T, phnsDefaultDevicePeriod: ?*i64, phnsMinimumDevicePeriod: ?*i64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).GetDevicePeriod(@ptrCast(*const IAudioClient, self), phnsDefaultDevicePeriod, phnsMinimumDevicePeriod); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_Start(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).Start(@ptrCast(*const IAudioClient, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_Stop(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).Stop(@ptrCast(*const IAudioClient, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).Reset(@ptrCast(*const IAudioClient, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_SetEventHandle(self: *const T, eventHandle: ?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).SetEventHandle(@ptrCast(*const IAudioClient, self), eventHandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient_GetService(self: *const T, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient.VTable, self.vtable).GetService(@ptrCast(*const IAudioClient, self), riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IAudioClient2_Value = @import("../../zig.zig").Guid.initString("726778cd-f60a-4eda-82de-e47610cd78aa"); pub const IID_IAudioClient2 = &IID_IAudioClient2_Value; pub const IAudioClient2 = extern struct { pub const VTable = extern struct { base: IAudioClient.VTable, IsOffloadCapable: fn( self: *const IAudioClient2, Category: AUDIO_STREAM_CATEGORY, pbOffloadCapable: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetClientProperties: fn( self: *const IAudioClient2, pProperties: ?*const AudioClientProperties, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBufferSizeLimits: fn( self: *const IAudioClient2, pFormat: ?*const WAVEFORMATEX, bEventDriven: BOOL, phnsMinBufferDuration: ?*i64, phnsMaxBufferDuration: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAudioClient.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient2_IsOffloadCapable(self: *const T, Category: AUDIO_STREAM_CATEGORY, pbOffloadCapable: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient2.VTable, self.vtable).IsOffloadCapable(@ptrCast(*const IAudioClient2, self), Category, pbOffloadCapable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient2_SetClientProperties(self: *const T, pProperties: ?*const AudioClientProperties) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient2.VTable, self.vtable).SetClientProperties(@ptrCast(*const IAudioClient2, self), pProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient2_GetBufferSizeLimits(self: *const T, pFormat: ?*const WAVEFORMATEX, bEventDriven: BOOL, phnsMinBufferDuration: ?*i64, phnsMaxBufferDuration: ?*i64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient2.VTable, self.vtable).GetBufferSizeLimits(@ptrCast(*const IAudioClient2, self), pFormat, bEventDriven, phnsMinBufferDuration, phnsMaxBufferDuration); } };} pub usingnamespace MethodMixin(@This()); }; pub const AudioClient3ActivationParams = extern struct { tracingContextId: Guid, }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IAudioClient3_Value = @import("../../zig.zig").Guid.initString("7ed4ee07-8e67-4cd4-8c1a-2b7a5987ad42"); pub const IID_IAudioClient3 = &IID_IAudioClient3_Value; pub const IAudioClient3 = extern struct { pub const VTable = extern struct { base: IAudioClient2.VTable, GetSharedModeEnginePeriod: fn( self: *const IAudioClient3, pFormat: ?*const WAVEFORMATEX, pDefaultPeriodInFrames: ?*u32, pFundamentalPeriodInFrames: ?*u32, pMinPeriodInFrames: ?*u32, pMaxPeriodInFrames: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCurrentSharedModeEnginePeriod: fn( self: *const IAudioClient3, ppFormat: ?*?*WAVEFORMATEX, pCurrentPeriodInFrames: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitializeSharedAudioStream: fn( self: *const IAudioClient3, StreamFlags: u32, PeriodInFrames: u32, pFormat: ?*const WAVEFORMATEX, AudioSessionGuid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAudioClient2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient3_GetSharedModeEnginePeriod(self: *const T, pFormat: ?*const WAVEFORMATEX, pDefaultPeriodInFrames: ?*u32, pFundamentalPeriodInFrames: ?*u32, pMinPeriodInFrames: ?*u32, pMaxPeriodInFrames: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient3.VTable, self.vtable).GetSharedModeEnginePeriod(@ptrCast(*const IAudioClient3, self), pFormat, pDefaultPeriodInFrames, pFundamentalPeriodInFrames, pMinPeriodInFrames, pMaxPeriodInFrames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient3_GetCurrentSharedModeEnginePeriod(self: *const T, ppFormat: ?*?*WAVEFORMATEX, pCurrentPeriodInFrames: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient3.VTable, self.vtable).GetCurrentSharedModeEnginePeriod(@ptrCast(*const IAudioClient3, self), ppFormat, pCurrentPeriodInFrames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClient3_InitializeSharedAudioStream(self: *const T, StreamFlags: u32, PeriodInFrames: u32, pFormat: ?*const WAVEFORMATEX, AudioSessionGuid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClient3.VTable, self.vtable).InitializeSharedAudioStream(@ptrCast(*const IAudioClient3, self), StreamFlags, PeriodInFrames, pFormat, AudioSessionGuid); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioRenderClient_Value = @import("../../zig.zig").Guid.initString("f294acfc-3146-4483-a7bf-addca7c260e2"); pub const IID_IAudioRenderClient = &IID_IAudioRenderClient_Value; pub const IAudioRenderClient = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetBuffer: fn( self: *const IAudioRenderClient, NumFramesRequested: u32, ppData: ?*?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseBuffer: fn( self: *const IAudioRenderClient, NumFramesWritten: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioRenderClient_GetBuffer(self: *const T, NumFramesRequested: u32, ppData: ?*?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioRenderClient.VTable, self.vtable).GetBuffer(@ptrCast(*const IAudioRenderClient, self), NumFramesRequested, ppData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioRenderClient_ReleaseBuffer(self: *const T, NumFramesWritten: u32, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioRenderClient.VTable, self.vtable).ReleaseBuffer(@ptrCast(*const IAudioRenderClient, self), NumFramesWritten, dwFlags); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioCaptureClient_Value = @import("../../zig.zig").Guid.initString("c8adbd64-e71e-48a0-a4de-185c395cd317"); pub const IID_IAudioCaptureClient = &IID_IAudioCaptureClient_Value; pub const IAudioCaptureClient = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetBuffer: fn( self: *const IAudioCaptureClient, ppData: ?*?*u8, pNumFramesToRead: ?*u32, pdwFlags: ?*u32, pu64DevicePosition: ?*u64, pu64QPCPosition: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseBuffer: fn( self: *const IAudioCaptureClient, NumFramesRead: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNextPacketSize: fn( self: *const IAudioCaptureClient, pNumFramesInNextPacket: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioCaptureClient_GetBuffer(self: *const T, ppData: ?*?*u8, pNumFramesToRead: ?*u32, pdwFlags: ?*u32, pu64DevicePosition: ?*u64, pu64QPCPosition: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioCaptureClient.VTable, self.vtable).GetBuffer(@ptrCast(*const IAudioCaptureClient, self), ppData, pNumFramesToRead, pdwFlags, pu64DevicePosition, pu64QPCPosition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioCaptureClient_ReleaseBuffer(self: *const T, NumFramesRead: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioCaptureClient.VTable, self.vtable).ReleaseBuffer(@ptrCast(*const IAudioCaptureClient, self), NumFramesRead); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioCaptureClient_GetNextPacketSize(self: *const T, pNumFramesInNextPacket: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioCaptureClient.VTable, self.vtable).GetNextPacketSize(@ptrCast(*const IAudioCaptureClient, self), pNumFramesInNextPacket); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioClock_Value = @import("../../zig.zig").Guid.initString("cd63314f-3fba-4a1b-812c-ef96358728e7"); pub const IID_IAudioClock = &IID_IAudioClock_Value; pub const IAudioClock = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetFrequency: fn( self: *const IAudioClock, pu64Frequency: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPosition: fn( self: *const IAudioClock, pu64Position: ?*u64, pu64QPCPosition: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCharacteristics: fn( self: *const IAudioClock, pdwCharacteristics: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClock_GetFrequency(self: *const T, pu64Frequency: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClock.VTable, self.vtable).GetFrequency(@ptrCast(*const IAudioClock, self), pu64Frequency); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClock_GetPosition(self: *const T, pu64Position: ?*u64, pu64QPCPosition: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClock.VTable, self.vtable).GetPosition(@ptrCast(*const IAudioClock, self), pu64Position, pu64QPCPosition); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClock_GetCharacteristics(self: *const T, pdwCharacteristics: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClock.VTable, self.vtable).GetCharacteristics(@ptrCast(*const IAudioClock, self), pdwCharacteristics); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioClock2_Value = @import("../../zig.zig").Guid.initString("6f49ff73-6727-49ac-a008-d98cf5e70048"); pub const IID_IAudioClock2 = &IID_IAudioClock2_Value; pub const IAudioClock2 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDevicePosition: fn( self: *const IAudioClock2, DevicePosition: ?*u64, QPCPosition: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClock2_GetDevicePosition(self: *const T, DevicePosition: ?*u64, QPCPosition: ?*u64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClock2.VTable, self.vtable).GetDevicePosition(@ptrCast(*const IAudioClock2, self), DevicePosition, QPCPosition); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioClockAdjustment_Value = @import("../../zig.zig").Guid.initString("f6e4c0a0-46d9-4fb8-be21-57a3ef2b626c"); pub const IID_IAudioClockAdjustment = &IID_IAudioClockAdjustment_Value; pub const IAudioClockAdjustment = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetSampleRate: fn( self: *const IAudioClockAdjustment, flSampleRate: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioClockAdjustment_SetSampleRate(self: *const T, flSampleRate: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioClockAdjustment.VTable, self.vtable).SetSampleRate(@ptrCast(*const IAudioClockAdjustment, self), flSampleRate); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ISimpleAudioVolume_Value = @import("../../zig.zig").Guid.initString("87ce5498-68d6-44e5-9215-6da47ef883d8"); pub const IID_ISimpleAudioVolume = &IID_ISimpleAudioVolume_Value; pub const ISimpleAudioVolume = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetMasterVolume: fn( self: *const ISimpleAudioVolume, fLevel: f32, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMasterVolume: fn( self: *const ISimpleAudioVolume, pfLevel: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMute: fn( self: *const ISimpleAudioVolume, bMute: BOOL, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMute: fn( self: *const ISimpleAudioVolume, pbMute: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISimpleAudioVolume_SetMasterVolume(self: *const T, fLevel: f32, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleAudioVolume.VTable, self.vtable).SetMasterVolume(@ptrCast(*const ISimpleAudioVolume, self), fLevel, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISimpleAudioVolume_GetMasterVolume(self: *const T, pfLevel: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleAudioVolume.VTable, self.vtable).GetMasterVolume(@ptrCast(*const ISimpleAudioVolume, self), pfLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISimpleAudioVolume_SetMute(self: *const T, bMute: BOOL, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleAudioVolume.VTable, self.vtable).SetMute(@ptrCast(*const ISimpleAudioVolume, self), bMute, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISimpleAudioVolume_GetMute(self: *const T, pbMute: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleAudioVolume.VTable, self.vtable).GetMute(@ptrCast(*const ISimpleAudioVolume, self), pbMute); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioStreamVolume_Value = @import("../../zig.zig").Guid.initString("93014887-242d-4068-8a15-cf5e93b90fe3"); pub const IID_IAudioStreamVolume = &IID_IAudioStreamVolume_Value; pub const IAudioStreamVolume = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetChannelCount: fn( self: *const IAudioStreamVolume, pdwCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetChannelVolume: fn( self: *const IAudioStreamVolume, dwIndex: u32, fLevel: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelVolume: fn( self: *const IAudioStreamVolume, dwIndex: u32, pfLevel: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAllVolumes: fn( self: *const IAudioStreamVolume, dwCount: u32, pfVolumes: [*]const f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllVolumes: fn( self: *const IAudioStreamVolume, dwCount: u32, pfVolumes: [*]f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioStreamVolume_GetChannelCount(self: *const T, pdwCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioStreamVolume.VTable, self.vtable).GetChannelCount(@ptrCast(*const IAudioStreamVolume, self), pdwCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioStreamVolume_SetChannelVolume(self: *const T, dwIndex: u32, fLevel: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioStreamVolume.VTable, self.vtable).SetChannelVolume(@ptrCast(*const IAudioStreamVolume, self), dwIndex, fLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioStreamVolume_GetChannelVolume(self: *const T, dwIndex: u32, pfLevel: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioStreamVolume.VTable, self.vtable).GetChannelVolume(@ptrCast(*const IAudioStreamVolume, self), dwIndex, pfLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioStreamVolume_SetAllVolumes(self: *const T, dwCount: u32, pfVolumes: [*]const f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioStreamVolume.VTable, self.vtable).SetAllVolumes(@ptrCast(*const IAudioStreamVolume, self), dwCount, pfVolumes); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioStreamVolume_GetAllVolumes(self: *const T, dwCount: u32, pfVolumes: [*]f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioStreamVolume.VTable, self.vtable).GetAllVolumes(@ptrCast(*const IAudioStreamVolume, self), dwCount, pfVolumes); } };} pub usingnamespace MethodMixin(@This()); }; pub const AMBISONICS_TYPE = enum(i32) { D = 0, }; pub const AMBISONICS_TYPE_FULL3D = AMBISONICS_TYPE.D; pub const AMBISONICS_CHANNEL_ORDERING = enum(i32) { N = 0, }; pub const AMBISONICS_CHANNEL_ORDERING_ACN = AMBISONICS_CHANNEL_ORDERING.N; pub const AMBISONICS_NORMALIZATION = enum(i32) { SN3D = 0, N3D = 1, }; pub const AMBISONICS_NORMALIZATION_SN3D = AMBISONICS_NORMALIZATION.SN3D; pub const AMBISONICS_NORMALIZATION_N3D = AMBISONICS_NORMALIZATION.N3D; pub const AMBISONICS_PARAMS = extern struct { u32Size: u32, u32Version: u32, u32Type: AMBISONICS_TYPE, u32ChannelOrdering: AMBISONICS_CHANNEL_ORDERING, u32Normalization: AMBISONICS_NORMALIZATION, u32Order: u32, u32NumChannels: u32, pu32ChannelMap: ?*u32, }; const IID_IAudioAmbisonicsControl_Value = @import("../../zig.zig").Guid.initString("28724c91-df35-4856-9f76-d6a26413f3df"); pub const IID_IAudioAmbisonicsControl = &IID_IAudioAmbisonicsControl_Value; pub const IAudioAmbisonicsControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetData: fn( self: *const IAudioAmbisonicsControl, pAmbisonicsParams: [*]const AMBISONICS_PARAMS, cbAmbisonicsParams: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHeadTracking: fn( self: *const IAudioAmbisonicsControl, bEnableHeadTracking: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHeadTracking: fn( self: *const IAudioAmbisonicsControl, pbEnableHeadTracking: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRotation: fn( self: *const IAudioAmbisonicsControl, X: f32, Y: f32, Z: f32, W: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioAmbisonicsControl_SetData(self: *const T, pAmbisonicsParams: [*]const AMBISONICS_PARAMS, cbAmbisonicsParams: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioAmbisonicsControl.VTable, self.vtable).SetData(@ptrCast(*const IAudioAmbisonicsControl, self), pAmbisonicsParams, cbAmbisonicsParams); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioAmbisonicsControl_SetHeadTracking(self: *const T, bEnableHeadTracking: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioAmbisonicsControl.VTable, self.vtable).SetHeadTracking(@ptrCast(*const IAudioAmbisonicsControl, self), bEnableHeadTracking); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioAmbisonicsControl_GetHeadTracking(self: *const T, pbEnableHeadTracking: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioAmbisonicsControl.VTable, self.vtable).GetHeadTracking(@ptrCast(*const IAudioAmbisonicsControl, self), pbEnableHeadTracking); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioAmbisonicsControl_SetRotation(self: *const T, X: f32, Y: f32, Z: f32, W: f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioAmbisonicsControl.VTable, self.vtable).SetRotation(@ptrCast(*const IAudioAmbisonicsControl, self), X, Y, Z, W); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IChannelAudioVolume_Value = @import("../../zig.zig").Guid.initString("1c158861-b533-4b30-b1cf-e853e51c59b8"); pub const IID_IChannelAudioVolume = &IID_IChannelAudioVolume_Value; pub const IChannelAudioVolume = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetChannelCount: fn( self: *const IChannelAudioVolume, pdwCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetChannelVolume: fn( self: *const IChannelAudioVolume, dwIndex: u32, fLevel: f32, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelVolume: fn( self: *const IChannelAudioVolume, dwIndex: u32, pfLevel: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAllVolumes: fn( self: *const IChannelAudioVolume, dwCount: u32, pfVolumes: [*]const f32, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAllVolumes: fn( self: *const IChannelAudioVolume, dwCount: u32, pfVolumes: [*]f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelAudioVolume_GetChannelCount(self: *const T, pdwCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IChannelAudioVolume.VTable, self.vtable).GetChannelCount(@ptrCast(*const IChannelAudioVolume, self), pdwCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelAudioVolume_SetChannelVolume(self: *const T, dwIndex: u32, fLevel: f32, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IChannelAudioVolume.VTable, self.vtable).SetChannelVolume(@ptrCast(*const IChannelAudioVolume, self), dwIndex, fLevel, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelAudioVolume_GetChannelVolume(self: *const T, dwIndex: u32, pfLevel: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IChannelAudioVolume.VTable, self.vtable).GetChannelVolume(@ptrCast(*const IChannelAudioVolume, self), dwIndex, pfLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelAudioVolume_SetAllVolumes(self: *const T, dwCount: u32, pfVolumes: [*]const f32, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IChannelAudioVolume.VTable, self.vtable).SetAllVolumes(@ptrCast(*const IChannelAudioVolume, self), dwCount, pfVolumes, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IChannelAudioVolume_GetAllVolumes(self: *const T, dwCount: u32, pfVolumes: [*]f32) callconv(.Inline) HRESULT { return @ptrCast(*const IChannelAudioVolume.VTable, self.vtable).GetAllVolumes(@ptrCast(*const IChannelAudioVolume, self), dwCount, pfVolumes); } };} pub usingnamespace MethodMixin(@This()); }; pub const AudioObjectType = enum(u32) { None = 0, Dynamic = 1, FrontLeft = 2, FrontRight = 4, FrontCenter = 8, LowFrequency = 16, SideLeft = 32, SideRight = 64, BackLeft = 128, BackRight = 256, TopFrontLeft = 512, TopFrontRight = 1024, TopBackLeft = 2048, TopBackRight = 4096, BottomFrontLeft = 8192, BottomFrontRight = 16384, BottomBackLeft = 32768, BottomBackRight = 65536, BackCenter = 131072, _, pub fn initFlags(o: struct { None: u1 = 0, Dynamic: u1 = 0, FrontLeft: u1 = 0, FrontRight: u1 = 0, FrontCenter: u1 = 0, LowFrequency: u1 = 0, SideLeft: u1 = 0, SideRight: u1 = 0, BackLeft: u1 = 0, BackRight: u1 = 0, TopFrontLeft: u1 = 0, TopFrontRight: u1 = 0, TopBackLeft: u1 = 0, TopBackRight: u1 = 0, BottomFrontLeft: u1 = 0, BottomFrontRight: u1 = 0, BottomBackLeft: u1 = 0, BottomBackRight: u1 = 0, BackCenter: u1 = 0, }) AudioObjectType { return @intToEnum(AudioObjectType, (if (o.None == 1) @enumToInt(AudioObjectType.None) else 0) | (if (o.Dynamic == 1) @enumToInt(AudioObjectType.Dynamic) else 0) | (if (o.FrontLeft == 1) @enumToInt(AudioObjectType.FrontLeft) else 0) | (if (o.FrontRight == 1) @enumToInt(AudioObjectType.FrontRight) else 0) | (if (o.FrontCenter == 1) @enumToInt(AudioObjectType.FrontCenter) else 0) | (if (o.LowFrequency == 1) @enumToInt(AudioObjectType.LowFrequency) else 0) | (if (o.SideLeft == 1) @enumToInt(AudioObjectType.SideLeft) else 0) | (if (o.SideRight == 1) @enumToInt(AudioObjectType.SideRight) else 0) | (if (o.BackLeft == 1) @enumToInt(AudioObjectType.BackLeft) else 0) | (if (o.BackRight == 1) @enumToInt(AudioObjectType.BackRight) else 0) | (if (o.TopFrontLeft == 1) @enumToInt(AudioObjectType.TopFrontLeft) else 0) | (if (o.TopFrontRight == 1) @enumToInt(AudioObjectType.TopFrontRight) else 0) | (if (o.TopBackLeft == 1) @enumToInt(AudioObjectType.TopBackLeft) else 0) | (if (o.TopBackRight == 1) @enumToInt(AudioObjectType.TopBackRight) else 0) | (if (o.BottomFrontLeft == 1) @enumToInt(AudioObjectType.BottomFrontLeft) else 0) | (if (o.BottomFrontRight == 1) @enumToInt(AudioObjectType.BottomFrontRight) else 0) | (if (o.BottomBackLeft == 1) @enumToInt(AudioObjectType.BottomBackLeft) else 0) | (if (o.BottomBackRight == 1) @enumToInt(AudioObjectType.BottomBackRight) else 0) | (if (o.BackCenter == 1) @enumToInt(AudioObjectType.BackCenter) else 0) ); } }; pub const AudioObjectType_None = AudioObjectType.None; pub const AudioObjectType_Dynamic = AudioObjectType.Dynamic; pub const AudioObjectType_FrontLeft = AudioObjectType.FrontLeft; pub const AudioObjectType_FrontRight = AudioObjectType.FrontRight; pub const AudioObjectType_FrontCenter = AudioObjectType.FrontCenter; pub const AudioObjectType_LowFrequency = AudioObjectType.LowFrequency; pub const AudioObjectType_SideLeft = AudioObjectType.SideLeft; pub const AudioObjectType_SideRight = AudioObjectType.SideRight; pub const AudioObjectType_BackLeft = AudioObjectType.BackLeft; pub const AudioObjectType_BackRight = AudioObjectType.BackRight; pub const AudioObjectType_TopFrontLeft = AudioObjectType.TopFrontLeft; pub const AudioObjectType_TopFrontRight = AudioObjectType.TopFrontRight; pub const AudioObjectType_TopBackLeft = AudioObjectType.TopBackLeft; pub const AudioObjectType_TopBackRight = AudioObjectType.TopBackRight; pub const AudioObjectType_BottomFrontLeft = AudioObjectType.BottomFrontLeft; pub const AudioObjectType_BottomFrontRight = AudioObjectType.BottomFrontRight; pub const AudioObjectType_BottomBackLeft = AudioObjectType.BottomBackLeft; pub const AudioObjectType_BottomBackRight = AudioObjectType.BottomBackRight; pub const AudioObjectType_BackCenter = AudioObjectType.BackCenter; pub const SpatialAudioObjectRenderStreamActivationParams = packed struct { ObjectFormat: ?*const WAVEFORMATEX, StaticObjectTypeMask: AudioObjectType, MinDynamicObjectCount: u32, MaxDynamicObjectCount: u32, Category: AUDIO_STREAM_CATEGORY, EventHandle: ?HANDLE, NotifyObject: ?*ISpatialAudioObjectRenderStreamNotify, }; const IID_IAudioFormatEnumerator_Value = @import("../../zig.zig").Guid.initString("dcdaa858-895a-4a22-a5eb-67bda506096d"); pub const IID_IAudioFormatEnumerator = &IID_IAudioFormatEnumerator_Value; pub const IAudioFormatEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IAudioFormatEnumerator, count: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFormat: fn( self: *const IAudioFormatEnumerator, index: u32, format: ?*?*WAVEFORMATEX, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioFormatEnumerator_GetCount(self: *const T, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioFormatEnumerator.VTable, self.vtable).GetCount(@ptrCast(*const IAudioFormatEnumerator, self), count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioFormatEnumerator_GetFormat(self: *const T, index: u32, format: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioFormatEnumerator.VTable, self.vtable).GetFormat(@ptrCast(*const IAudioFormatEnumerator, self), index, format); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectBase_Value = @import("../../zig.zig").Guid.initString("cce0b8f2-8d4d-4efb-a8cf-3d6ecf1c30e0"); pub const IID_ISpatialAudioObjectBase = &IID_ISpatialAudioObjectBase_Value; pub const ISpatialAudioObjectBase = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetBuffer: fn( self: *const ISpatialAudioObjectBase, buffer: ?*?*u8, bufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEndOfStream: fn( self: *const ISpatialAudioObjectBase, frameCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsActive: fn( self: *const ISpatialAudioObjectBase, isActive: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAudioObjectType: fn( self: *const ISpatialAudioObjectBase, audioObjectType: ?*AudioObjectType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectBase_GetBuffer(self: *const T, buffer: ?*?*u8, bufferLength: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectBase.VTable, self.vtable).GetBuffer(@ptrCast(*const ISpatialAudioObjectBase, self), buffer, bufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectBase_SetEndOfStream(self: *const T, frameCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectBase.VTable, self.vtable).SetEndOfStream(@ptrCast(*const ISpatialAudioObjectBase, self), frameCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectBase_IsActive(self: *const T, isActive: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectBase.VTable, self.vtable).IsActive(@ptrCast(*const ISpatialAudioObjectBase, self), isActive); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectBase_GetAudioObjectType(self: *const T, audioObjectType: ?*AudioObjectType) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectBase.VTable, self.vtable).GetAudioObjectType(@ptrCast(*const ISpatialAudioObjectBase, self), audioObjectType); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObject_Value = @import("../../zig.zig").Guid.initString("dde28967-521b-46e5-8f00-bd6f2bc8ab1d"); pub const IID_ISpatialAudioObject = &IID_ISpatialAudioObject_Value; pub const ISpatialAudioObject = extern struct { pub const VTable = extern struct { base: ISpatialAudioObjectBase.VTable, SetPosition: fn( self: *const ISpatialAudioObject, x: f32, y: f32, z: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVolume: fn( self: *const ISpatialAudioObject, volume: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpatialAudioObjectBase.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObject_SetPosition(self: *const T, x: f32, y: f32, z: f32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObject.VTable, self.vtable).SetPosition(@ptrCast(*const ISpatialAudioObject, self), x, y, z); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObject_SetVolume(self: *const T, volume: f32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObject.VTable, self.vtable).SetVolume(@ptrCast(*const ISpatialAudioObject, self), volume); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectRenderStreamBase_Value = @import("../../zig.zig").Guid.initString("feaaf403-c1d8-450d-aa05-e0ccee7502a8"); pub const IID_ISpatialAudioObjectRenderStreamBase = &IID_ISpatialAudioObjectRenderStreamBase_Value; pub const ISpatialAudioObjectRenderStreamBase = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAvailableDynamicObjectCount: fn( self: *const ISpatialAudioObjectRenderStreamBase, value: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetService: fn( self: *const ISpatialAudioObjectRenderStreamBase, riid: ?*const Guid, service: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Start: fn( self: *const ISpatialAudioObjectRenderStreamBase, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stop: fn( self: *const ISpatialAudioObjectRenderStreamBase, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const ISpatialAudioObjectRenderStreamBase, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BeginUpdatingAudioObjects: fn( self: *const ISpatialAudioObjectRenderStreamBase, availableDynamicObjectCount: ?*u32, frameCountPerBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EndUpdatingAudioObjects: fn( self: *const ISpatialAudioObjectRenderStreamBase, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamBase_GetAvailableDynamicObjectCount(self: *const T, value: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamBase.VTable, self.vtable).GetAvailableDynamicObjectCount(@ptrCast(*const ISpatialAudioObjectRenderStreamBase, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamBase_GetService(self: *const T, riid: ?*const Guid, service: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamBase.VTable, self.vtable).GetService(@ptrCast(*const ISpatialAudioObjectRenderStreamBase, self), riid, service); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamBase_Start(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamBase.VTable, self.vtable).Start(@ptrCast(*const ISpatialAudioObjectRenderStreamBase, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamBase_Stop(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamBase.VTable, self.vtable).Stop(@ptrCast(*const ISpatialAudioObjectRenderStreamBase, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamBase_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamBase.VTable, self.vtable).Reset(@ptrCast(*const ISpatialAudioObjectRenderStreamBase, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamBase_BeginUpdatingAudioObjects(self: *const T, availableDynamicObjectCount: ?*u32, frameCountPerBuffer: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamBase.VTable, self.vtable).BeginUpdatingAudioObjects(@ptrCast(*const ISpatialAudioObjectRenderStreamBase, self), availableDynamicObjectCount, frameCountPerBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamBase_EndUpdatingAudioObjects(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamBase.VTable, self.vtable).EndUpdatingAudioObjects(@ptrCast(*const ISpatialAudioObjectRenderStreamBase, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectRenderStream_Value = @import("../../zig.zig").Guid.initString("bab5f473-b423-477b-85f5-b5a332a04153"); pub const IID_ISpatialAudioObjectRenderStream = &IID_ISpatialAudioObjectRenderStream_Value; pub const ISpatialAudioObjectRenderStream = extern struct { pub const VTable = extern struct { base: ISpatialAudioObjectRenderStreamBase.VTable, ActivateSpatialAudioObject: fn( self: *const ISpatialAudioObjectRenderStream, type: AudioObjectType, audioObject: ?*?*ISpatialAudioObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpatialAudioObjectRenderStreamBase.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStream_ActivateSpatialAudioObject(self: *const T, type_: AudioObjectType, audioObject: ?*?*ISpatialAudioObject) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStream.VTable, self.vtable).ActivateSpatialAudioObject(@ptrCast(*const ISpatialAudioObjectRenderStream, self), type_, audioObject); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectRenderStreamNotify_Value = @import("../../zig.zig").Guid.initString("dddf83e6-68d7-4c70-883f-a1836afb4a50"); pub const IID_ISpatialAudioObjectRenderStreamNotify = &IID_ISpatialAudioObjectRenderStreamNotify_Value; pub const ISpatialAudioObjectRenderStreamNotify = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnAvailableDynamicObjectCountChange: fn( self: *const ISpatialAudioObjectRenderStreamNotify, sender: ?*ISpatialAudioObjectRenderStreamBase, hnsComplianceDeadlineTime: i64, availableDynamicObjectCountChange: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamNotify_OnAvailableDynamicObjectCountChange(self: *const T, sender: ?*ISpatialAudioObjectRenderStreamBase, hnsComplianceDeadlineTime: i64, availableDynamicObjectCountChange: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamNotify.VTable, self.vtable).OnAvailableDynamicObjectCountChange(@ptrCast(*const ISpatialAudioObjectRenderStreamNotify, self), sender, hnsComplianceDeadlineTime, availableDynamicObjectCountChange); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioClient_Value = @import("../../zig.zig").Guid.initString("bbf8e066-aaaa-49be-9a4d-fd2a858ea27f"); pub const IID_ISpatialAudioClient = &IID_ISpatialAudioClient_Value; pub const ISpatialAudioClient = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetStaticObjectPosition: fn( self: *const ISpatialAudioClient, type: AudioObjectType, x: ?*f32, y: ?*f32, z: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNativeStaticObjectTypeMask: fn( self: *const ISpatialAudioClient, mask: ?*AudioObjectType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMaxDynamicObjectCount: fn( self: *const ISpatialAudioClient, value: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSupportedAudioObjectFormatEnumerator: fn( self: *const ISpatialAudioClient, enumerator: ?*?*IAudioFormatEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMaxFrameCount: fn( self: *const ISpatialAudioClient, objectFormat: ?*const WAVEFORMATEX, frameCountPerBuffer: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsAudioObjectFormatSupported: fn( self: *const ISpatialAudioClient, objectFormat: ?*const WAVEFORMATEX, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsSpatialAudioStreamAvailable: fn( self: *const ISpatialAudioClient, streamUuid: ?*const Guid, auxiliaryInfo: ?*const PROPVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ActivateSpatialAudioStream: fn( self: *const ISpatialAudioClient, activationParams: ?*const PROPVARIANT, riid: ?*const Guid, stream: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_GetStaticObjectPosition(self: *const T, type_: AudioObjectType, x: ?*f32, y: ?*f32, z: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).GetStaticObjectPosition(@ptrCast(*const ISpatialAudioClient, self), type_, x, y, z); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_GetNativeStaticObjectTypeMask(self: *const T, mask: ?*AudioObjectType) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).GetNativeStaticObjectTypeMask(@ptrCast(*const ISpatialAudioClient, self), mask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_GetMaxDynamicObjectCount(self: *const T, value: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).GetMaxDynamicObjectCount(@ptrCast(*const ISpatialAudioClient, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_GetSupportedAudioObjectFormatEnumerator(self: *const T, enumerator: ?*?*IAudioFormatEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).GetSupportedAudioObjectFormatEnumerator(@ptrCast(*const ISpatialAudioClient, self), enumerator); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_GetMaxFrameCount(self: *const T, objectFormat: ?*const WAVEFORMATEX, frameCountPerBuffer: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).GetMaxFrameCount(@ptrCast(*const ISpatialAudioClient, self), objectFormat, frameCountPerBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_IsAudioObjectFormatSupported(self: *const T, objectFormat: ?*const WAVEFORMATEX) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).IsAudioObjectFormatSupported(@ptrCast(*const ISpatialAudioClient, self), objectFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_IsSpatialAudioStreamAvailable(self: *const T, streamUuid: ?*const Guid, auxiliaryInfo: ?*const PROPVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).IsSpatialAudioStreamAvailable(@ptrCast(*const ISpatialAudioClient, self), streamUuid, auxiliaryInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioClient_ActivateSpatialAudioStream(self: *const T, activationParams: ?*const PROPVARIANT, riid: ?*const Guid, stream: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioClient.VTable, self.vtable).ActivateSpatialAudioStream(@ptrCast(*const ISpatialAudioClient, self), activationParams, riid, stream); } };} pub usingnamespace MethodMixin(@This()); }; pub const SpatialAudioClientActivationParams = extern struct { tracingContextId: Guid, appId: Guid, majorVersion: i32, minorVersion1: i32, minorVersion2: i32, minorVersion3: i32, }; pub const SpatialAudioHrtfDirectivityType = enum(i32) { OmniDirectional = 0, Cardioid = 1, Cone = 2, }; pub const SpatialAudioHrtfDirectivity_OmniDirectional = SpatialAudioHrtfDirectivityType.OmniDirectional; pub const SpatialAudioHrtfDirectivity_Cardioid = SpatialAudioHrtfDirectivityType.Cardioid; pub const SpatialAudioHrtfDirectivity_Cone = SpatialAudioHrtfDirectivityType.Cone; pub const SpatialAudioHrtfEnvironmentType = enum(i32) { Small = 0, Medium = 1, Large = 2, Outdoors = 3, Average = 4, }; pub const SpatialAudioHrtfEnvironment_Small = SpatialAudioHrtfEnvironmentType.Small; pub const SpatialAudioHrtfEnvironment_Medium = SpatialAudioHrtfEnvironmentType.Medium; pub const SpatialAudioHrtfEnvironment_Large = SpatialAudioHrtfEnvironmentType.Large; pub const SpatialAudioHrtfEnvironment_Outdoors = SpatialAudioHrtfEnvironmentType.Outdoors; pub const SpatialAudioHrtfEnvironment_Average = SpatialAudioHrtfEnvironmentType.Average; pub const SpatialAudioHrtfDistanceDecayType = enum(i32) { NaturalDecay = 0, CustomDecay = 1, }; pub const SpatialAudioHrtfDistanceDecay_NaturalDecay = SpatialAudioHrtfDistanceDecayType.NaturalDecay; pub const SpatialAudioHrtfDistanceDecay_CustomDecay = SpatialAudioHrtfDistanceDecayType.CustomDecay; pub const SpatialAudioHrtfDirectivity = packed struct { Type: SpatialAudioHrtfDirectivityType, Scaling: f32, }; pub const SpatialAudioHrtfDirectivityCardioid = packed struct { directivity: SpatialAudioHrtfDirectivity, Order: f32, }; pub const SpatialAudioHrtfDirectivityCone = packed struct { directivity: SpatialAudioHrtfDirectivity, InnerAngle: f32, OuterAngle: f32, }; pub const SpatialAudioHrtfDirectivityUnion = extern union { Cone: SpatialAudioHrtfDirectivityCone, Cardiod: SpatialAudioHrtfDirectivityCardioid, Omni: SpatialAudioHrtfDirectivity, }; pub const SpatialAudioHrtfDistanceDecay = packed struct { Type: SpatialAudioHrtfDistanceDecayType, MaxGain: f32, MinGain: f32, UnityGainDistance: f32, CutoffDistance: f32, }; pub const SpatialAudioHrtfActivationParams = packed struct { ObjectFormat: ?*const WAVEFORMATEX, StaticObjectTypeMask: AudioObjectType, MinDynamicObjectCount: u32, MaxDynamicObjectCount: u32, Category: AUDIO_STREAM_CATEGORY, EventHandle: ?HANDLE, NotifyObject: ?*ISpatialAudioObjectRenderStreamNotify, DistanceDecay: ?*SpatialAudioHrtfDistanceDecay, Directivity: ?*SpatialAudioHrtfDirectivityUnion, Environment: ?*SpatialAudioHrtfEnvironmentType, Orientation: ?*f32, }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectForHrtf_Value = @import("../../zig.zig").Guid.initString("d7436ade-1978-4e14-aba0-555bd8eb83b4"); pub const IID_ISpatialAudioObjectForHrtf = &IID_ISpatialAudioObjectForHrtf_Value; pub const ISpatialAudioObjectForHrtf = extern struct { pub const VTable = extern struct { base: ISpatialAudioObjectBase.VTable, SetPosition: fn( self: *const ISpatialAudioObjectForHrtf, x: f32, y: f32, z: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGain: fn( self: *const ISpatialAudioObjectForHrtf, gain: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetOrientation: fn( self: *const ISpatialAudioObjectForHrtf, orientation: ?*const ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEnvironment: fn( self: *const ISpatialAudioObjectForHrtf, environment: SpatialAudioHrtfEnvironmentType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDistanceDecay: fn( self: *const ISpatialAudioObjectForHrtf, distanceDecay: ?*SpatialAudioHrtfDistanceDecay, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDirectivity: fn( self: *const ISpatialAudioObjectForHrtf, directivity: ?*SpatialAudioHrtfDirectivityUnion, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpatialAudioObjectBase.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForHrtf_SetPosition(self: *const T, x: f32, y: f32, z: f32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForHrtf.VTable, self.vtable).SetPosition(@ptrCast(*const ISpatialAudioObjectForHrtf, self), x, y, z); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForHrtf_SetGain(self: *const T, gain: f32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForHrtf.VTable, self.vtable).SetGain(@ptrCast(*const ISpatialAudioObjectForHrtf, self), gain); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForHrtf_SetOrientation(self: *const T, orientation: ?*const ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForHrtf.VTable, self.vtable).SetOrientation(@ptrCast(*const ISpatialAudioObjectForHrtf, self), orientation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForHrtf_SetEnvironment(self: *const T, environment: SpatialAudioHrtfEnvironmentType) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForHrtf.VTable, self.vtable).SetEnvironment(@ptrCast(*const ISpatialAudioObjectForHrtf, self), environment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForHrtf_SetDistanceDecay(self: *const T, distanceDecay: ?*SpatialAudioHrtfDistanceDecay) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForHrtf.VTable, self.vtable).SetDistanceDecay(@ptrCast(*const ISpatialAudioObjectForHrtf, self), distanceDecay); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForHrtf_SetDirectivity(self: *const T, directivity: ?*SpatialAudioHrtfDirectivityUnion) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForHrtf.VTable, self.vtable).SetDirectivity(@ptrCast(*const ISpatialAudioObjectForHrtf, self), directivity); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectRenderStreamForHrtf_Value = @import("../../zig.zig").Guid.initString("e08deef9-5363-406e-9fdc-080ee247bbe0"); pub const IID_ISpatialAudioObjectRenderStreamForHrtf = &IID_ISpatialAudioObjectRenderStreamForHrtf_Value; pub const ISpatialAudioObjectRenderStreamForHrtf = extern struct { pub const VTable = extern struct { base: ISpatialAudioObjectRenderStreamBase.VTable, ActivateSpatialAudioObjectForHrtf: fn( self: *const ISpatialAudioObjectRenderStreamForHrtf, type: AudioObjectType, audioObject: ?*?*ISpatialAudioObjectForHrtf, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpatialAudioObjectRenderStreamBase.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamForHrtf_ActivateSpatialAudioObjectForHrtf(self: *const T, type_: AudioObjectType, audioObject: ?*?*ISpatialAudioObjectForHrtf) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamForHrtf.VTable, self.vtable).ActivateSpatialAudioObjectForHrtf(@ptrCast(*const ISpatialAudioObjectRenderStreamForHrtf, self), type_, audioObject); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioEndpointFormatControl_Value = @import("../../zig.zig").Guid.initString("784cfd40-9f89-456e-a1a6-873b006a664e"); pub const IID_IAudioEndpointFormatControl = &IID_IAudioEndpointFormatControl_Value; pub const IAudioEndpointFormatControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ResetToDefault: fn( self: *const IAudioEndpointFormatControl, ResetFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointFormatControl_ResetToDefault(self: *const T, ResetFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointFormatControl.VTable, self.vtable).ResetToDefault(@ptrCast(*const IAudioEndpointFormatControl, self), ResetFlags); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_MMDeviceEnumerator_Value = @import("../../zig.zig").Guid.initString("bcde0395-e52f-467c-8e3d-c4579291692e"); pub const CLSID_MMDeviceEnumerator = &CLSID_MMDeviceEnumerator_Value; pub const DIRECTX_AUDIO_ACTIVATION_PARAMS = extern struct { cbDirectXAudioActivationParams: u32, guidAudioSession: Guid, dwAudioStreamFlags: u32, }; pub const EDataFlow = enum(i32) { eRender = 0, eCapture = 1, eAll = 2, EDataFlow_enum_count = 3, }; pub const eRender = EDataFlow.eRender; pub const eCapture = EDataFlow.eCapture; pub const eAll = EDataFlow.eAll; pub const EDataFlow_enum_count = EDataFlow.EDataFlow_enum_count; pub const ERole = enum(i32) { eConsole = 0, eMultimedia = 1, eCommunications = 2, ERole_enum_count = 3, }; pub const eConsole = ERole.eConsole; pub const eMultimedia = ERole.eMultimedia; pub const eCommunications = ERole.eCommunications; pub const ERole_enum_count = ERole.ERole_enum_count; pub const EndpointFormFactor = enum(i32) { RemoteNetworkDevice = 0, Speakers = 1, LineLevel = 2, Headphones = 3, Microphone = 4, Headset = 5, Handset = 6, UnknownDigitalPassthrough = 7, SPDIF = 8, DigitalAudioDisplayDevice = 9, UnknownFormFactor = 10, EndpointFormFactor_enum_count = 11, }; pub const RemoteNetworkDevice = EndpointFormFactor.RemoteNetworkDevice; pub const Speakers = EndpointFormFactor.Speakers; pub const LineLevel = EndpointFormFactor.LineLevel; pub const Headphones = EndpointFormFactor.Headphones; pub const Microphone = EndpointFormFactor.Microphone; pub const Headset = EndpointFormFactor.Headset; pub const Handset = EndpointFormFactor.Handset; pub const UnknownDigitalPassthrough = EndpointFormFactor.UnknownDigitalPassthrough; pub const SPDIF = EndpointFormFactor.SPDIF; pub const DigitalAudioDisplayDevice = EndpointFormFactor.DigitalAudioDisplayDevice; pub const UnknownFormFactor = EndpointFormFactor.UnknownFormFactor; pub const EndpointFormFactor_enum_count = EndpointFormFactor.EndpointFormFactor_enum_count; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IMMNotificationClient_Value = @import("../../zig.zig").Guid.initString("7991eec9-7e89-4d85-8390-6c703cec60c0"); pub const IID_IMMNotificationClient = &IID_IMMNotificationClient_Value; pub const IMMNotificationClient = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnDeviceStateChanged: fn( self: *const IMMNotificationClient, pwstrDeviceId: ?[*:0]const u16, dwNewState: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDeviceAdded: fn( self: *const IMMNotificationClient, pwstrDeviceId: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDeviceRemoved: fn( self: *const IMMNotificationClient, pwstrDeviceId: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDefaultDeviceChanged: fn( self: *const IMMNotificationClient, flow: EDataFlow, role: ERole, pwstrDefaultDeviceId: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnPropertyValueChanged: fn( self: *const IMMNotificationClient, pwstrDeviceId: ?[*:0]const u16, key: PROPERTYKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMNotificationClient_OnDeviceStateChanged(self: *const T, pwstrDeviceId: ?[*:0]const u16, dwNewState: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMMNotificationClient.VTable, self.vtable).OnDeviceStateChanged(@ptrCast(*const IMMNotificationClient, self), pwstrDeviceId, dwNewState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMNotificationClient_OnDeviceAdded(self: *const T, pwstrDeviceId: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IMMNotificationClient.VTable, self.vtable).OnDeviceAdded(@ptrCast(*const IMMNotificationClient, self), pwstrDeviceId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMNotificationClient_OnDeviceRemoved(self: *const T, pwstrDeviceId: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IMMNotificationClient.VTable, self.vtable).OnDeviceRemoved(@ptrCast(*const IMMNotificationClient, self), pwstrDeviceId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMNotificationClient_OnDefaultDeviceChanged(self: *const T, flow: EDataFlow, role: ERole, pwstrDefaultDeviceId: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IMMNotificationClient.VTable, self.vtable).OnDefaultDeviceChanged(@ptrCast(*const IMMNotificationClient, self), flow, role, pwstrDefaultDeviceId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMNotificationClient_OnPropertyValueChanged(self: *const T, pwstrDeviceId: ?[*:0]const u16, key: PROPERTYKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IMMNotificationClient.VTable, self.vtable).OnPropertyValueChanged(@ptrCast(*const IMMNotificationClient, self), pwstrDeviceId, key); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IMMDevice_Value = @import("../../zig.zig").Guid.initString("d666063f-1587-4e43-81f1-b948e807363f"); pub const IID_IMMDevice = &IID_IMMDevice_Value; pub const IMMDevice = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Activate: fn( self: *const IMMDevice, iid: ?*const Guid, dwClsCtx: u32, pActivationParams: ?*PROPVARIANT, ppInterface: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenPropertyStore: fn( self: *const IMMDevice, stgmAccess: u32, ppProperties: ?*?*IPropertyStore, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetId: fn( self: *const IMMDevice, ppstrId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetState: fn( self: *const IMMDevice, pdwState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDevice_Activate(self: *const T, iid: ?*const Guid, dwClsCtx: u32, pActivationParams: ?*PROPVARIANT, ppInterface: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDevice.VTable, self.vtable).Activate(@ptrCast(*const IMMDevice, self), iid, dwClsCtx, pActivationParams, ppInterface); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDevice_OpenPropertyStore(self: *const T, stgmAccess: u32, ppProperties: ?*?*IPropertyStore) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDevice.VTable, self.vtable).OpenPropertyStore(@ptrCast(*const IMMDevice, self), stgmAccess, ppProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDevice_GetId(self: *const T, ppstrId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDevice.VTable, self.vtable).GetId(@ptrCast(*const IMMDevice, self), ppstrId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDevice_GetState(self: *const T, pdwState: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDevice.VTable, self.vtable).GetState(@ptrCast(*const IMMDevice, self), pdwState); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IMMDeviceCollection_Value = @import("../../zig.zig").Guid.initString("0bd7a1be-7a1a-44db-8397-cc5392387b5e"); pub const IID_IMMDeviceCollection = &IID_IMMDeviceCollection_Value; pub const IMMDeviceCollection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IMMDeviceCollection, pcDevices: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Item: fn( self: *const IMMDeviceCollection, nDevice: u32, ppDevice: ?*?*IMMDevice, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceCollection_GetCount(self: *const T, pcDevices: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceCollection.VTable, self.vtable).GetCount(@ptrCast(*const IMMDeviceCollection, self), pcDevices); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceCollection_Item(self: *const T, nDevice: u32, ppDevice: ?*?*IMMDevice) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceCollection.VTable, self.vtable).Item(@ptrCast(*const IMMDeviceCollection, self), nDevice, ppDevice); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IMMEndpoint_Value = @import("../../zig.zig").Guid.initString("1be09788-6894-4089-8586-9a2a6c265ac5"); pub const IID_IMMEndpoint = &IID_IMMEndpoint_Value; pub const IMMEndpoint = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDataFlow: fn( self: *const IMMEndpoint, pDataFlow: ?*EDataFlow, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMEndpoint_GetDataFlow(self: *const T, pDataFlow: ?*EDataFlow) callconv(.Inline) HRESULT { return @ptrCast(*const IMMEndpoint.VTable, self.vtable).GetDataFlow(@ptrCast(*const IMMEndpoint, self), pDataFlow); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IMMDeviceEnumerator_Value = @import("../../zig.zig").Guid.initString("a95664d2-9614-4f35-a746-de8db63617e6"); pub const IID_IMMDeviceEnumerator = &IID_IMMDeviceEnumerator_Value; pub const IMMDeviceEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumAudioEndpoints: fn( self: *const IMMDeviceEnumerator, dataFlow: EDataFlow, dwStateMask: u32, ppDevices: ?*?*IMMDeviceCollection, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDefaultAudioEndpoint: fn( self: *const IMMDeviceEnumerator, dataFlow: EDataFlow, role: ERole, ppEndpoint: ?*?*IMMDevice, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDevice: fn( self: *const IMMDeviceEnumerator, pwstrId: ?[*:0]const u16, ppDevice: ?*?*IMMDevice, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterEndpointNotificationCallback: fn( self: *const IMMDeviceEnumerator, pClient: ?*IMMNotificationClient, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterEndpointNotificationCallback: fn( self: *const IMMDeviceEnumerator, pClient: ?*IMMNotificationClient, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceEnumerator_EnumAudioEndpoints(self: *const T, dataFlow: EDataFlow, dwStateMask: u32, ppDevices: ?*?*IMMDeviceCollection) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceEnumerator.VTable, self.vtable).EnumAudioEndpoints(@ptrCast(*const IMMDeviceEnumerator, self), dataFlow, dwStateMask, ppDevices); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceEnumerator_GetDefaultAudioEndpoint(self: *const T, dataFlow: EDataFlow, role: ERole, ppEndpoint: ?*?*IMMDevice) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceEnumerator.VTable, self.vtable).GetDefaultAudioEndpoint(@ptrCast(*const IMMDeviceEnumerator, self), dataFlow, role, ppEndpoint); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceEnumerator_GetDevice(self: *const T, pwstrId: ?[*:0]const u16, ppDevice: ?*?*IMMDevice) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceEnumerator.VTable, self.vtable).GetDevice(@ptrCast(*const IMMDeviceEnumerator, self), pwstrId, ppDevice); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceEnumerator_RegisterEndpointNotificationCallback(self: *const T, pClient: ?*IMMNotificationClient) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceEnumerator.VTable, self.vtable).RegisterEndpointNotificationCallback(@ptrCast(*const IMMDeviceEnumerator, self), pClient); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(self: *const T, pClient: ?*IMMNotificationClient) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceEnumerator.VTable, self.vtable).UnregisterEndpointNotificationCallback(@ptrCast(*const IMMDeviceEnumerator, self), pClient); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IMMDeviceActivator_Value = @import("../../zig.zig").Guid.initString("3b0d0ea4-d0a9-4b0e-935b-09516746fac0"); pub const IID_IMMDeviceActivator = &IID_IMMDeviceActivator_Value; pub const IMMDeviceActivator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Activate: fn( self: *const IMMDeviceActivator, iid: ?*const Guid, pDevice: ?*IMMDevice, pActivationParams: ?*PROPVARIANT, ppInterface: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IMMDeviceActivator_Activate(self: *const T, iid: ?*const Guid, pDevice: ?*IMMDevice, pActivationParams: ?*PROPVARIANT, ppInterface: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IMMDeviceActivator.VTable, self.vtable).Activate(@ptrCast(*const IMMDeviceActivator, self), iid, pDevice, pActivationParams, ppInterface); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IActivateAudioInterfaceCompletionHandler_Value = @import("../../zig.zig").Guid.initString("41d949ab-9862-444a-80f6-c261334da5eb"); pub const IID_IActivateAudioInterfaceCompletionHandler = &IID_IActivateAudioInterfaceCompletionHandler_Value; pub const IActivateAudioInterfaceCompletionHandler = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ActivateCompleted: fn( self: *const IActivateAudioInterfaceCompletionHandler, activateOperation: ?*IActivateAudioInterfaceAsyncOperation, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActivateAudioInterfaceCompletionHandler_ActivateCompleted(self: *const T, activateOperation: ?*IActivateAudioInterfaceAsyncOperation) callconv(.Inline) HRESULT { return @ptrCast(*const IActivateAudioInterfaceCompletionHandler.VTable, self.vtable).ActivateCompleted(@ptrCast(*const IActivateAudioInterfaceCompletionHandler, self), activateOperation); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IActivateAudioInterfaceAsyncOperation_Value = @import("../../zig.zig").Guid.initString("72a22d78-cde4-431d-b8cc-843a71199b6d"); pub const IID_IActivateAudioInterfaceAsyncOperation = &IID_IActivateAudioInterfaceAsyncOperation_Value; pub const IActivateAudioInterfaceAsyncOperation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetActivateResult: fn( self: *const IActivateAudioInterfaceAsyncOperation, activateResult: ?*HRESULT, activatedInterface: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IActivateAudioInterfaceAsyncOperation_GetActivateResult(self: *const T, activateResult: ?*HRESULT, activatedInterface: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IActivateAudioInterfaceAsyncOperation.VTable, self.vtable).GetActivateResult(@ptrCast(*const IActivateAudioInterfaceAsyncOperation, self), activateResult, activatedInterface); } };} pub usingnamespace MethodMixin(@This()); }; pub const AudioExtensionParams = extern struct { AddPageParam: LPARAM, pEndpoint: ?*IMMDevice, pPnpInterface: ?*IMMDevice, pPnpDevnode: ?*IMMDevice, }; pub const EndpointConnectorType = enum(i32) { HostProcessConnector = 0, OffloadConnector = 1, LoopbackConnector = 2, KeywordDetectorConnector = 3, ConnectorCount = 4, }; pub const eHostProcessConnector = EndpointConnectorType.HostProcessConnector; pub const eOffloadConnector = EndpointConnectorType.OffloadConnector; pub const eLoopbackConnector = EndpointConnectorType.LoopbackConnector; pub const eKeywordDetectorConnector = EndpointConnectorType.KeywordDetectorConnector; pub const eConnectorCount = EndpointConnectorType.ConnectorCount; pub const AUDIO_ENDPOINT_SHARED_CREATE_PARAMS = extern struct { u32Size: u32, u32TSSessionId: u32, targetEndpointConnectorType: EndpointConnectorType, wfxDeviceFormat: WAVEFORMATEX, }; const IID_IAudioEndpointOffloadStreamVolume_Value = @import("../../zig.zig").Guid.initString("64f1dd49-71ca-4281-8672-3a9eddd1d0b6"); pub const IID_IAudioEndpointOffloadStreamVolume = &IID_IAudioEndpointOffloadStreamVolume_Value; pub const IAudioEndpointOffloadStreamVolume = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetVolumeChannelCount: fn( self: *const IAudioEndpointOffloadStreamVolume, pu32ChannelCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetChannelVolumes: fn( self: *const IAudioEndpointOffloadStreamVolume, u32ChannelCount: u32, pf32Volumes: ?*f32, u32CurveType: AUDIO_CURVE_TYPE, pCurveDuration: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelVolumes: fn( self: *const IAudioEndpointOffloadStreamVolume, u32ChannelCount: u32, pf32Volumes: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointOffloadStreamVolume_GetVolumeChannelCount(self: *const T, pu32ChannelCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointOffloadStreamVolume.VTable, self.vtable).GetVolumeChannelCount(@ptrCast(*const IAudioEndpointOffloadStreamVolume, self), pu32ChannelCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointOffloadStreamVolume_SetChannelVolumes(self: *const T, u32ChannelCount: u32, pf32Volumes: ?*f32, u32CurveType: AUDIO_CURVE_TYPE, pCurveDuration: ?*i64) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointOffloadStreamVolume.VTable, self.vtable).SetChannelVolumes(@ptrCast(*const IAudioEndpointOffloadStreamVolume, self), u32ChannelCount, pf32Volumes, u32CurveType, pCurveDuration); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointOffloadStreamVolume_GetChannelVolumes(self: *const T, u32ChannelCount: u32, pf32Volumes: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointOffloadStreamVolume.VTable, self.vtable).GetChannelVolumes(@ptrCast(*const IAudioEndpointOffloadStreamVolume, self), u32ChannelCount, pf32Volumes); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IAudioEndpointOffloadStreamMute_Value = @import("../../zig.zig").Guid.initString("dfe21355-5ec2-40e0-8d6b-710ac3c00249"); pub const IID_IAudioEndpointOffloadStreamMute = &IID_IAudioEndpointOffloadStreamMute_Value; pub const IAudioEndpointOffloadStreamMute = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetMute: fn( self: *const IAudioEndpointOffloadStreamMute, bMuted: u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMute: fn( self: *const IAudioEndpointOffloadStreamMute, pbMuted: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointOffloadStreamMute_SetMute(self: *const T, bMuted: u8) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointOffloadStreamMute.VTable, self.vtable).SetMute(@ptrCast(*const IAudioEndpointOffloadStreamMute, self), bMuted); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointOffloadStreamMute_GetMute(self: *const T, pbMuted: ?*u8) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointOffloadStreamMute.VTable, self.vtable).GetMute(@ptrCast(*const IAudioEndpointOffloadStreamMute, self), pbMuted); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IAudioEndpointOffloadStreamMeter_Value = @import("../../zig.zig").Guid.initString("e1546dce-9dd1-418b-9ab2-348ced161c86"); pub const IID_IAudioEndpointOffloadStreamMeter = &IID_IAudioEndpointOffloadStreamMeter_Value; pub const IAudioEndpointOffloadStreamMeter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetMeterChannelCount: fn( self: *const IAudioEndpointOffloadStreamMeter, pu32ChannelCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMeteringData: fn( self: *const IAudioEndpointOffloadStreamMeter, u32ChannelCount: u32, pf32PeakValues: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointOffloadStreamMeter_GetMeterChannelCount(self: *const T, pu32ChannelCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointOffloadStreamMeter.VTable, self.vtable).GetMeterChannelCount(@ptrCast(*const IAudioEndpointOffloadStreamMeter, self), pu32ChannelCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointOffloadStreamMeter_GetMeteringData(self: *const T, u32ChannelCount: u32, pf32PeakValues: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointOffloadStreamMeter.VTable, self.vtable).GetMeteringData(@ptrCast(*const IAudioEndpointOffloadStreamMeter, self), u32ChannelCount, pf32PeakValues); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.1' const IID_IAudioEndpointLastBufferControl_Value = @import("../../zig.zig").Guid.initString("f8520dd3-8f9d-4437-9861-62f584c33dd6"); pub const IID_IAudioEndpointLastBufferControl = &IID_IAudioEndpointLastBufferControl_Value; pub const IAudioEndpointLastBufferControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsLastBufferControlSupported: fn( self: *const IAudioEndpointLastBufferControl, ) callconv(@import("std").os.windows.WINAPI) BOOL, ReleaseOutputDataPointerForLastBuffer: fn( self: *const IAudioEndpointLastBufferControl, pConnectionProperty: ?*const APO_CONNECTION_PROPERTY, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointLastBufferControl_IsLastBufferControlSupported(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const IAudioEndpointLastBufferControl.VTable, self.vtable).IsLastBufferControlSupported(@ptrCast(*const IAudioEndpointLastBufferControl, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointLastBufferControl_ReleaseOutputDataPointerForLastBuffer(self: *const T, pConnectionProperty: ?*const APO_CONNECTION_PROPERTY) callconv(.Inline) void { return @ptrCast(*const IAudioEndpointLastBufferControl.VTable, self.vtable).ReleaseOutputDataPointerForLastBuffer(@ptrCast(*const IAudioEndpointLastBufferControl, self), pConnectionProperty); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IAudioLfxControl_Value = @import("../../zig.zig").Guid.initString("076a6922-d802-4f83-baf6-409d9ca11bfe"); pub const IID_IAudioLfxControl = &IID_IAudioLfxControl_Value; pub const IAudioLfxControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetLocalEffectsState: fn( self: *const IAudioLfxControl, bEnabled: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLocalEffectsState: fn( self: *const IAudioLfxControl, pbEnabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioLfxControl_SetLocalEffectsState(self: *const T, bEnabled: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioLfxControl.VTable, self.vtable).SetLocalEffectsState(@ptrCast(*const IAudioLfxControl, self), bEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioLfxControl_GetLocalEffectsState(self: *const T, pbEnabled: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioLfxControl.VTable, self.vtable).GetLocalEffectsState(@ptrCast(*const IAudioLfxControl, self), pbEnabled); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows8.0' const IID_IHardwareAudioEngineBase_Value = @import("../../zig.zig").Guid.initString("eddce3e4-f3c1-453a-b461-223563cbd886"); pub const IID_IHardwareAudioEngineBase = &IID_IHardwareAudioEngineBase_Value; pub const IHardwareAudioEngineBase = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAvailableOffloadConnectorCount: fn( self: *const IHardwareAudioEngineBase, _pwstrDeviceId: ?PWSTR, _uConnectorId: u32, _pAvailableConnectorInstanceCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEngineFormat: fn( self: *const IHardwareAudioEngineBase, pDevice: ?*IMMDevice, _bRequestDeviceFormat: BOOL, _ppwfxFormat: ?*?*WAVEFORMATEX, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEngineDeviceFormat: fn( self: *const IHardwareAudioEngineBase, pDevice: ?*IMMDevice, _pwfxFormat: ?*WAVEFORMATEX, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGfxState: fn( self: *const IHardwareAudioEngineBase, pDevice: ?*IMMDevice, _bEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGfxState: fn( self: *const IHardwareAudioEngineBase, pDevice: ?*IMMDevice, _pbEnable: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHardwareAudioEngineBase_GetAvailableOffloadConnectorCount(self: *const T, _pwstrDeviceId: ?PWSTR, _uConnectorId: u32, _pAvailableConnectorInstanceCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IHardwareAudioEngineBase.VTable, self.vtable).GetAvailableOffloadConnectorCount(@ptrCast(*const IHardwareAudioEngineBase, self), _pwstrDeviceId, _uConnectorId, _pAvailableConnectorInstanceCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHardwareAudioEngineBase_GetEngineFormat(self: *const T, pDevice: ?*IMMDevice, _bRequestDeviceFormat: BOOL, _ppwfxFormat: ?*?*WAVEFORMATEX) callconv(.Inline) HRESULT { return @ptrCast(*const IHardwareAudioEngineBase.VTable, self.vtable).GetEngineFormat(@ptrCast(*const IHardwareAudioEngineBase, self), pDevice, _bRequestDeviceFormat, _ppwfxFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHardwareAudioEngineBase_SetEngineDeviceFormat(self: *const T, pDevice: ?*IMMDevice, _pwfxFormat: ?*WAVEFORMATEX) callconv(.Inline) HRESULT { return @ptrCast(*const IHardwareAudioEngineBase.VTable, self.vtable).SetEngineDeviceFormat(@ptrCast(*const IHardwareAudioEngineBase, self), pDevice, _pwfxFormat); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHardwareAudioEngineBase_SetGfxState(self: *const T, pDevice: ?*IMMDevice, _bEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IHardwareAudioEngineBase.VTable, self.vtable).SetGfxState(@ptrCast(*const IHardwareAudioEngineBase, self), pDevice, _bEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IHardwareAudioEngineBase_GetGfxState(self: *const T, pDevice: ?*IMMDevice, _pbEnable: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IHardwareAudioEngineBase.VTable, self.vtable).GetGfxState(@ptrCast(*const IHardwareAudioEngineBase, self), pDevice, _pbEnable); } };} pub usingnamespace MethodMixin(@This()); }; const CLSID_DEVINTERFACE_AUDIOENDPOINTPLUGIN_Value = @import("../../zig.zig").Guid.initString("9f2f7b66-65ac-4fa6-8ae4-123c78b89313"); pub const CLSID_DEVINTERFACE_AUDIOENDPOINTPLUGIN = &CLSID_DEVINTERFACE_AUDIOENDPOINTPLUGIN_Value; const CLSID_DeviceTopology_Value = @import("../../zig.zig").Guid.initString("1df639d0-5ec1-47aa-9379-828dc1aa8c59"); pub const CLSID_DeviceTopology = &CLSID_DeviceTopology_Value; pub const DataFlow = enum(i32) { In = 0, Out = 1, }; pub const In = DataFlow.In; pub const Out = DataFlow.Out; pub const PartType = enum(i32) { Connector = 0, Subunit = 1, }; pub const Connector = PartType.Connector; pub const Subunit = PartType.Subunit; pub const ConnectorType = enum(i32) { Unknown_Connector = 0, Physical_Internal = 1, Physical_External = 2, Software_IO = 3, Software_Fixed = 4, Network = 5, }; // NOTE: not creating aliases because this enum is 'Scoped' // TODO: this type is limited to platform 'windows6.0.6000' const IID_IPerChannelDbLevel_Value = @import("../../zig.zig").Guid.initString("c2f8e001-f205-4bc9-99bc-c13b1e048ccb"); pub const IID_IPerChannelDbLevel = &IID_IPerChannelDbLevel_Value; pub const IPerChannelDbLevel = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetChannelCount: fn( self: *const IPerChannelDbLevel, pcChannels: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLevelRange: fn( self: *const IPerChannelDbLevel, nChannel: u32, pfMinLevelDB: ?*f32, pfMaxLevelDB: ?*f32, pfStepping: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLevel: fn( self: *const IPerChannelDbLevel, nChannel: u32, pfLevelDB: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLevel: fn( self: *const IPerChannelDbLevel, nChannel: u32, fLevelDB: f32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLevelUniform: fn( self: *const IPerChannelDbLevel, fLevelDB: f32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLevelAllChannels: fn( self: *const IPerChannelDbLevel, aLevelsDB: [*]f32, cChannels: u32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerChannelDbLevel_GetChannelCount(self: *const T, pcChannels: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPerChannelDbLevel.VTable, self.vtable).GetChannelCount(@ptrCast(*const IPerChannelDbLevel, self), pcChannels); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerChannelDbLevel_GetLevelRange(self: *const T, nChannel: u32, pfMinLevelDB: ?*f32, pfMaxLevelDB: ?*f32, pfStepping: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IPerChannelDbLevel.VTable, self.vtable).GetLevelRange(@ptrCast(*const IPerChannelDbLevel, self), nChannel, pfMinLevelDB, pfMaxLevelDB, pfStepping); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerChannelDbLevel_GetLevel(self: *const T, nChannel: u32, pfLevelDB: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IPerChannelDbLevel.VTable, self.vtable).GetLevel(@ptrCast(*const IPerChannelDbLevel, self), nChannel, pfLevelDB); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerChannelDbLevel_SetLevel(self: *const T, nChannel: u32, fLevelDB: f32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPerChannelDbLevel.VTable, self.vtable).SetLevel(@ptrCast(*const IPerChannelDbLevel, self), nChannel, fLevelDB, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerChannelDbLevel_SetLevelUniform(self: *const T, fLevelDB: f32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPerChannelDbLevel.VTable, self.vtable).SetLevelUniform(@ptrCast(*const IPerChannelDbLevel, self), fLevelDB, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerChannelDbLevel_SetLevelAllChannels(self: *const T, aLevelsDB: [*]f32, cChannels: u32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPerChannelDbLevel.VTable, self.vtable).SetLevelAllChannels(@ptrCast(*const IPerChannelDbLevel, self), aLevelsDB, cChannels, pguidEventContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioVolumeLevel_Value = @import("../../zig.zig").Guid.initString("7fb7b48f-531d-44a2-bcb3-5ad5a134b3dc"); pub const IID_IAudioVolumeLevel = &IID_IAudioVolumeLevel_Value; pub const IAudioVolumeLevel = extern struct { pub const VTable = extern struct { base: IPerChannelDbLevel.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPerChannelDbLevel.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioChannelConfig_Value = @import("../../zig.zig").Guid.initString("bb11c46f-ec28-493c-b88a-5db88062ce98"); pub const IID_IAudioChannelConfig = &IID_IAudioChannelConfig_Value; pub const IAudioChannelConfig = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetChannelConfig: fn( self: *const IAudioChannelConfig, dwConfig: u32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelConfig: fn( self: *const IAudioChannelConfig, pdwConfig: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioChannelConfig_SetChannelConfig(self: *const T, dwConfig: u32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioChannelConfig.VTable, self.vtable).SetChannelConfig(@ptrCast(*const IAudioChannelConfig, self), dwConfig, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioChannelConfig_GetChannelConfig(self: *const T, pdwConfig: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioChannelConfig.VTable, self.vtable).GetChannelConfig(@ptrCast(*const IAudioChannelConfig, self), pdwConfig); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioLoudness_Value = @import("../../zig.zig").Guid.initString("7d8b1437-dd53-4350-9c1b-1ee2890bd938"); pub const IID_IAudioLoudness = &IID_IAudioLoudness_Value; pub const IAudioLoudness = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetEnabled: fn( self: *const IAudioLoudness, pbEnabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEnabled: fn( self: *const IAudioLoudness, bEnable: BOOL, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioLoudness_GetEnabled(self: *const T, pbEnabled: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioLoudness.VTable, self.vtable).GetEnabled(@ptrCast(*const IAudioLoudness, self), pbEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioLoudness_SetEnabled(self: *const T, bEnable: BOOL, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioLoudness.VTable, self.vtable).SetEnabled(@ptrCast(*const IAudioLoudness, self), bEnable, pguidEventContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioInputSelector_Value = @import("../../zig.zig").Guid.initString("4f03dc02-5e6e-4653-8f72-a030c123d598"); pub const IID_IAudioInputSelector = &IID_IAudioInputSelector_Value; pub const IAudioInputSelector = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSelection: fn( self: *const IAudioInputSelector, pnIdSelected: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSelection: fn( self: *const IAudioInputSelector, nIdSelect: u32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioInputSelector_GetSelection(self: *const T, pnIdSelected: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioInputSelector.VTable, self.vtable).GetSelection(@ptrCast(*const IAudioInputSelector, self), pnIdSelected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioInputSelector_SetSelection(self: *const T, nIdSelect: u32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioInputSelector.VTable, self.vtable).SetSelection(@ptrCast(*const IAudioInputSelector, self), nIdSelect, pguidEventContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioOutputSelector_Value = @import("../../zig.zig").Guid.initString("bb515f69-94a7-429e-8b9c-271b3f11a3ab"); pub const IID_IAudioOutputSelector = &IID_IAudioOutputSelector_Value; pub const IAudioOutputSelector = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetSelection: fn( self: *const IAudioOutputSelector, pnIdSelected: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSelection: fn( self: *const IAudioOutputSelector, nIdSelect: u32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioOutputSelector_GetSelection(self: *const T, pnIdSelected: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioOutputSelector.VTable, self.vtable).GetSelection(@ptrCast(*const IAudioOutputSelector, self), pnIdSelected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioOutputSelector_SetSelection(self: *const T, nIdSelect: u32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioOutputSelector.VTable, self.vtable).SetSelection(@ptrCast(*const IAudioOutputSelector, self), nIdSelect, pguidEventContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioMute_Value = @import("../../zig.zig").Guid.initString("df45aeea-b74a-4b6b-afad-2366b6aa012e"); pub const IID_IAudioMute = &IID_IAudioMute_Value; pub const IAudioMute = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetMute: fn( self: *const IAudioMute, bMuted: BOOL, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMute: fn( self: *const IAudioMute, pbMuted: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioMute_SetMute(self: *const T, bMuted: BOOL, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioMute.VTable, self.vtable).SetMute(@ptrCast(*const IAudioMute, self), bMuted, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioMute_GetMute(self: *const T, pbMuted: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioMute.VTable, self.vtable).GetMute(@ptrCast(*const IAudioMute, self), pbMuted); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioBass_Value = @import("../../zig.zig").Guid.initString("a2b1a1d9-4db3-425d-a2b2-bd335cb3e2e5"); pub const IID_IAudioBass = &IID_IAudioBass_Value; pub const IAudioBass = extern struct { pub const VTable = extern struct { base: IPerChannelDbLevel.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPerChannelDbLevel.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioMidrange_Value = @import("../../zig.zig").Guid.initString("5e54b6d7-b44b-40d9-9a9e-e691d9ce6edf"); pub const IID_IAudioMidrange = &IID_IAudioMidrange_Value; pub const IAudioMidrange = extern struct { pub const VTable = extern struct { base: IPerChannelDbLevel.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPerChannelDbLevel.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioTreble_Value = @import("../../zig.zig").Guid.initString("0a717812-694e-4907-b74b-bafa5cfdca7b"); pub const IID_IAudioTreble = &IID_IAudioTreble_Value; pub const IAudioTreble = extern struct { pub const VTable = extern struct { base: IPerChannelDbLevel.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPerChannelDbLevel.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioAutoGainControl_Value = @import("../../zig.zig").Guid.initString("85401fd4-6de4-4b9d-9869-2d6753a82f3c"); pub const IID_IAudioAutoGainControl = &IID_IAudioAutoGainControl_Value; pub const IAudioAutoGainControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetEnabled: fn( self: *const IAudioAutoGainControl, pbEnabled: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEnabled: fn( self: *const IAudioAutoGainControl, bEnable: BOOL, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioAutoGainControl_GetEnabled(self: *const T, pbEnabled: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioAutoGainControl.VTable, self.vtable).GetEnabled(@ptrCast(*const IAudioAutoGainControl, self), pbEnabled); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioAutoGainControl_SetEnabled(self: *const T, bEnable: BOOL, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioAutoGainControl.VTable, self.vtable).SetEnabled(@ptrCast(*const IAudioAutoGainControl, self), bEnable, pguidEventContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioPeakMeter_Value = @import("../../zig.zig").Guid.initString("dd79923c-0599-45e0-b8b6-c8df7db6e796"); pub const IID_IAudioPeakMeter = &IID_IAudioPeakMeter_Value; pub const IAudioPeakMeter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetChannelCount: fn( self: *const IAudioPeakMeter, pcChannels: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLevel: fn( self: *const IAudioPeakMeter, nChannel: u32, pfLevel: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioPeakMeter_GetChannelCount(self: *const T, pcChannels: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioPeakMeter.VTable, self.vtable).GetChannelCount(@ptrCast(*const IAudioPeakMeter, self), pcChannels); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioPeakMeter_GetLevel(self: *const T, nChannel: u32, pfLevel: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioPeakMeter.VTable, self.vtable).GetLevel(@ptrCast(*const IAudioPeakMeter, self), nChannel, pfLevel); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IDeviceSpecificProperty_Value = @import("../../zig.zig").Guid.initString("3b22bcbf-2586-4af0-8583-205d391b807c"); pub const IID_IDeviceSpecificProperty = &IID_IDeviceSpecificProperty_Value; pub const IDeviceSpecificProperty = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetType: fn( self: *const IDeviceSpecificProperty, pVType: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetValue: fn( self: *const IDeviceSpecificProperty, pvValue: ?*c_void, pcbValue: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetValue: fn( self: *const IDeviceSpecificProperty, pvValue: ?*c_void, cbValue: u32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Get4BRange: fn( self: *const IDeviceSpecificProperty, plMin: ?*i32, plMax: ?*i32, plStepping: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceSpecificProperty_GetType(self: *const T, pVType: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceSpecificProperty.VTable, self.vtable).GetType(@ptrCast(*const IDeviceSpecificProperty, self), pVType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceSpecificProperty_GetValue(self: *const T, pvValue: ?*c_void, pcbValue: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceSpecificProperty.VTable, self.vtable).GetValue(@ptrCast(*const IDeviceSpecificProperty, self), pvValue, pcbValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceSpecificProperty_SetValue(self: *const T, pvValue: ?*c_void, cbValue: u32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceSpecificProperty.VTable, self.vtable).SetValue(@ptrCast(*const IDeviceSpecificProperty, self), pvValue, cbValue, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceSpecificProperty_Get4BRange(self: *const T, plMin: ?*i32, plMax: ?*i32, plStepping: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceSpecificProperty.VTable, self.vtable).Get4BRange(@ptrCast(*const IDeviceSpecificProperty, self), plMin, plMax, plStepping); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IKsFormatSupport_Value = @import("../../zig.zig").Guid.initString("3cb4a69d-bb6f-4d2b-95b7-452d2c155db5"); pub const IID_IKsFormatSupport = &IID_IKsFormatSupport_Value; pub const IKsFormatSupport = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsFormatSupported: fn( self: *const IKsFormatSupport, pKsFormat: ?*KSDATAFORMAT, cbFormat: u32, pbSupported: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDevicePreferredFormat: fn( self: *const IKsFormatSupport, ppKsFormat: ?*?*KSDATAFORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsFormatSupport_IsFormatSupported(self: *const T, pKsFormat: ?*KSDATAFORMAT, cbFormat: u32, pbSupported: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IKsFormatSupport.VTable, self.vtable).IsFormatSupported(@ptrCast(*const IKsFormatSupport, self), pKsFormat, cbFormat, pbSupported); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsFormatSupport_GetDevicePreferredFormat(self: *const T, ppKsFormat: ?*?*KSDATAFORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IKsFormatSupport.VTable, self.vtable).GetDevicePreferredFormat(@ptrCast(*const IKsFormatSupport, self), ppKsFormat); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IKsJackDescription_Value = @import("../../zig.zig").Guid.initString("4509f757-2d46-4637-8e62-ce7db944f57b"); pub const IID_IKsJackDescription = &IID_IKsJackDescription_Value; pub const IKsJackDescription = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetJackCount: fn( self: *const IKsJackDescription, pcJacks: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetJackDescription: fn( self: *const IKsJackDescription, nJack: u32, pDescription: ?*KSJACK_DESCRIPTION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsJackDescription_GetJackCount(self: *const T, pcJacks: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IKsJackDescription.VTable, self.vtable).GetJackCount(@ptrCast(*const IKsJackDescription, self), pcJacks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsJackDescription_GetJackDescription(self: *const T, nJack: u32, pDescription: ?*KSJACK_DESCRIPTION) callconv(.Inline) HRESULT { return @ptrCast(*const IKsJackDescription.VTable, self.vtable).GetJackDescription(@ptrCast(*const IKsJackDescription, self), nJack, pDescription); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IKsJackDescription2_Value = @import("../../zig.zig").Guid.initString("478f3a9b-e0c9-4827-9228-6f5505ffe76a"); pub const IID_IKsJackDescription2 = &IID_IKsJackDescription2_Value; pub const IKsJackDescription2 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetJackCount: fn( self: *const IKsJackDescription2, pcJacks: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetJackDescription2: fn( self: *const IKsJackDescription2, nJack: u32, pDescription2: ?*KSJACK_DESCRIPTION2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsJackDescription2_GetJackCount(self: *const T, pcJacks: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IKsJackDescription2.VTable, self.vtable).GetJackCount(@ptrCast(*const IKsJackDescription2, self), pcJacks); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsJackDescription2_GetJackDescription2(self: *const T, nJack: u32, pDescription2: ?*KSJACK_DESCRIPTION2) callconv(.Inline) HRESULT { return @ptrCast(*const IKsJackDescription2.VTable, self.vtable).GetJackDescription2(@ptrCast(*const IKsJackDescription2, self), nJack, pDescription2); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IKsJackSinkInformation_Value = @import("../../zig.zig").Guid.initString("d9bd72ed-290f-4581-9ff3-61027a8fe532"); pub const IID_IKsJackSinkInformation = &IID_IKsJackSinkInformation_Value; pub const IKsJackSinkInformation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetJackSinkInformation: fn( self: *const IKsJackSinkInformation, pJackSinkInformation: ?*KSJACK_SINK_INFORMATION, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsJackSinkInformation_GetJackSinkInformation(self: *const T, pJackSinkInformation: ?*KSJACK_SINK_INFORMATION) callconv(.Inline) HRESULT { return @ptrCast(*const IKsJackSinkInformation.VTable, self.vtable).GetJackSinkInformation(@ptrCast(*const IKsJackSinkInformation, self), pJackSinkInformation); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IKsJackContainerId_Value = @import("../../zig.zig").Guid.initString("c99af463-d629-4ec4-8c00-e54d68154248"); pub const IID_IKsJackContainerId = &IID_IKsJackContainerId_Value; pub const IKsJackContainerId = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetJackContainerId: fn( self: *const IKsJackContainerId, pJackContainerId: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IKsJackContainerId_GetJackContainerId(self: *const T, pJackContainerId: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IKsJackContainerId.VTable, self.vtable).GetJackContainerId(@ptrCast(*const IKsJackContainerId, self), pJackContainerId); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IPartsList_Value = @import("../../zig.zig").Guid.initString("6daa848c-5eb0-45cc-aea5-998a2cda1ffb"); pub const IID_IPartsList = &IID_IPartsList_Value; pub const IPartsList = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IPartsList, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPart: fn( self: *const IPartsList, nIndex: u32, ppPart: ?*?*IPart, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPartsList_GetCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPartsList.VTable, self.vtable).GetCount(@ptrCast(*const IPartsList, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPartsList_GetPart(self: *const T, nIndex: u32, ppPart: ?*?*IPart) callconv(.Inline) HRESULT { return @ptrCast(*const IPartsList.VTable, self.vtable).GetPart(@ptrCast(*const IPartsList, self), nIndex, ppPart); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IPart_Value = @import("../../zig.zig").Guid.initString("ae2de0e4-5bca-4f2d-aa46-5d13f8fdb3a9"); pub const IID_IPart = &IID_IPart_Value; pub const IPart = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetName: fn( self: *const IPart, ppwstrName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLocalId: fn( self: *const IPart, pnId: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGlobalId: fn( self: *const IPart, ppwstrGlobalId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPartType: fn( self: *const IPart, pPartType: ?*PartType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSubType: fn( self: *const IPart, pSubType: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetControlInterfaceCount: fn( self: *const IPart, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetControlInterface: fn( self: *const IPart, nIndex: u32, ppInterfaceDesc: ?*?*IControlInterface, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumPartsIncoming: fn( self: *const IPart, ppParts: ?*?*IPartsList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumPartsOutgoing: fn( self: *const IPart, ppParts: ?*?*IPartsList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTopologyObject: fn( self: *const IPart, ppTopology: ?*?*IDeviceTopology, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Activate: fn( self: *const IPart, dwClsContext: u32, refiid: ?*const Guid, ppvObject: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterControlChangeCallback: fn( self: *const IPart, riid: ?*const Guid, pNotify: ?*IControlChangeNotify, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterControlChangeCallback: fn( self: *const IPart, pNotify: ?*IControlChangeNotify, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetName(self: *const T, ppwstrName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetName(@ptrCast(*const IPart, self), ppwstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetLocalId(self: *const T, pnId: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetLocalId(@ptrCast(*const IPart, self), pnId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetGlobalId(self: *const T, ppwstrGlobalId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetGlobalId(@ptrCast(*const IPart, self), ppwstrGlobalId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetPartType(self: *const T, pPartType: ?*PartType) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetPartType(@ptrCast(*const IPart, self), pPartType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetSubType(self: *const T, pSubType: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetSubType(@ptrCast(*const IPart, self), pSubType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetControlInterfaceCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetControlInterfaceCount(@ptrCast(*const IPart, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetControlInterface(self: *const T, nIndex: u32, ppInterfaceDesc: ?*?*IControlInterface) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetControlInterface(@ptrCast(*const IPart, self), nIndex, ppInterfaceDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_EnumPartsIncoming(self: *const T, ppParts: ?*?*IPartsList) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).EnumPartsIncoming(@ptrCast(*const IPart, self), ppParts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_EnumPartsOutgoing(self: *const T, ppParts: ?*?*IPartsList) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).EnumPartsOutgoing(@ptrCast(*const IPart, self), ppParts); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_GetTopologyObject(self: *const T, ppTopology: ?*?*IDeviceTopology) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).GetTopologyObject(@ptrCast(*const IPart, self), ppTopology); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_Activate(self: *const T, dwClsContext: u32, refiid: ?*const Guid, ppvObject: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).Activate(@ptrCast(*const IPart, self), dwClsContext, refiid, ppvObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_RegisterControlChangeCallback(self: *const T, riid: ?*const Guid, pNotify: ?*IControlChangeNotify) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).RegisterControlChangeCallback(@ptrCast(*const IPart, self), riid, pNotify); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPart_UnregisterControlChangeCallback(self: *const T, pNotify: ?*IControlChangeNotify) callconv(.Inline) HRESULT { return @ptrCast(*const IPart.VTable, self.vtable).UnregisterControlChangeCallback(@ptrCast(*const IPart, self), pNotify); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IConnector_Value = @import("../../zig.zig").Guid.initString("9c2c4058-23f5-41de-877a-df3af236a09e"); pub const IID_IConnector = &IID_IConnector_Value; pub const IConnector = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetType: fn( self: *const IConnector, pType: ?*ConnectorType, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDataFlow: fn( self: *const IConnector, pFlow: ?*DataFlow, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConnectTo: fn( self: *const IConnector, pConnectTo: ?*IConnector, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Disconnect: fn( self: *const IConnector, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsConnected: fn( self: *const IConnector, pbConnected: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnectedTo: fn( self: *const IConnector, ppConTo: ?*?*IConnector, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnectorIdConnectedTo: fn( self: *const IConnector, ppwstrConnectorId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceIdConnectedTo: fn( self: *const IConnector, ppwstrDeviceId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_GetType(self: *const T, pType: ?*ConnectorType) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).GetType(@ptrCast(*const IConnector, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_GetDataFlow(self: *const T, pFlow: ?*DataFlow) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).GetDataFlow(@ptrCast(*const IConnector, self), pFlow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_ConnectTo(self: *const T, pConnectTo: ?*IConnector) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).ConnectTo(@ptrCast(*const IConnector, self), pConnectTo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_Disconnect(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).Disconnect(@ptrCast(*const IConnector, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_IsConnected(self: *const T, pbConnected: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).IsConnected(@ptrCast(*const IConnector, self), pbConnected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_GetConnectedTo(self: *const T, ppConTo: ?*?*IConnector) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).GetConnectedTo(@ptrCast(*const IConnector, self), ppConTo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_GetConnectorIdConnectedTo(self: *const T, ppwstrConnectorId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).GetConnectorIdConnectedTo(@ptrCast(*const IConnector, self), ppwstrConnectorId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IConnector_GetDeviceIdConnectedTo(self: *const T, ppwstrDeviceId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IConnector.VTable, self.vtable).GetDeviceIdConnectedTo(@ptrCast(*const IConnector, self), ppwstrDeviceId); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_ISubunit_Value = @import("../../zig.zig").Guid.initString("82149a85-dba6-4487-86bb-ea8f7fefcc71"); pub const IID_ISubunit = &IID_ISubunit_Value; pub const ISubunit = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IControlInterface_Value = @import("../../zig.zig").Guid.initString("45d37c3f-5140-444a-ae24-400789f3cbf3"); pub const IID_IControlInterface = &IID_IControlInterface_Value; pub const IControlInterface = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetName: fn( self: *const IControlInterface, ppwstrName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIID: fn( self: *const IControlInterface, pIID: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IControlInterface_GetName(self: *const T, ppwstrName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IControlInterface.VTable, self.vtable).GetName(@ptrCast(*const IControlInterface, self), ppwstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IControlInterface_GetIID(self: *const T, pIID: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IControlInterface.VTable, self.vtable).GetIID(@ptrCast(*const IControlInterface, self), pIID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IControlChangeNotify_Value = @import("../../zig.zig").Guid.initString("a09513ed-c709-4d21-bd7b-5f34c47f3947"); pub const IID_IControlChangeNotify = &IID_IControlChangeNotify_Value; pub const IControlChangeNotify = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnNotify: fn( self: *const IControlChangeNotify, dwSenderProcessId: u32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IControlChangeNotify_OnNotify(self: *const T, dwSenderProcessId: u32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IControlChangeNotify.VTable, self.vtable).OnNotify(@ptrCast(*const IControlChangeNotify, self), dwSenderProcessId, pguidEventContext); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IDeviceTopology_Value = @import("../../zig.zig").Guid.initString("2a07407e-6497-4a18-9787-32f79bd0d98f"); pub const IID_IDeviceTopology = &IID_IDeviceTopology_Value; pub const IDeviceTopology = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetConnectorCount: fn( self: *const IDeviceTopology, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConnector: fn( self: *const IDeviceTopology, nIndex: u32, ppConnector: ?*?*IConnector, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSubunitCount: fn( self: *const IDeviceTopology, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSubunit: fn( self: *const IDeviceTopology, nIndex: u32, ppSubunit: ?*?*ISubunit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPartById: fn( self: *const IDeviceTopology, nId: u32, ppPart: ?*?*IPart, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceId: fn( self: *const IDeviceTopology, ppwstrDeviceId: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSignalPath: fn( self: *const IDeviceTopology, pIPartFrom: ?*IPart, pIPartTo: ?*IPart, bRejectMixedPaths: BOOL, ppParts: ?*?*IPartsList, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceTopology_GetConnectorCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceTopology.VTable, self.vtable).GetConnectorCount(@ptrCast(*const IDeviceTopology, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceTopology_GetConnector(self: *const T, nIndex: u32, ppConnector: ?*?*IConnector) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceTopology.VTable, self.vtable).GetConnector(@ptrCast(*const IDeviceTopology, self), nIndex, ppConnector); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceTopology_GetSubunitCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceTopology.VTable, self.vtable).GetSubunitCount(@ptrCast(*const IDeviceTopology, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceTopology_GetSubunit(self: *const T, nIndex: u32, ppSubunit: ?*?*ISubunit) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceTopology.VTable, self.vtable).GetSubunit(@ptrCast(*const IDeviceTopology, self), nIndex, ppSubunit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceTopology_GetPartById(self: *const T, nId: u32, ppPart: ?*?*IPart) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceTopology.VTable, self.vtable).GetPartById(@ptrCast(*const IDeviceTopology, self), nId, ppPart); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceTopology_GetDeviceId(self: *const T, ppwstrDeviceId: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceTopology.VTable, self.vtable).GetDeviceId(@ptrCast(*const IDeviceTopology, self), ppwstrDeviceId); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDeviceTopology_GetSignalPath(self: *const T, pIPartFrom: ?*IPart, pIPartTo: ?*IPart, bRejectMixedPaths: BOOL, ppParts: ?*?*IPartsList) callconv(.Inline) HRESULT { return @ptrCast(*const IDeviceTopology.VTable, self.vtable).GetSignalPath(@ptrCast(*const IDeviceTopology, self), pIPartFrom, pIPartTo, bRejectMixedPaths, ppParts); } };} pub usingnamespace MethodMixin(@This()); }; pub const AUDIO_VOLUME_NOTIFICATION_DATA = extern struct { guidEventContext: Guid, bMuted: BOOL, fMasterVolume: f32, nChannels: u32, afChannelVolumes: [1]f32, }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioEndpointVolumeCallback_Value = @import("../../zig.zig").Guid.initString("657804fa-d6ad-4496-8a60-352752af4f89"); pub const IID_IAudioEndpointVolumeCallback = &IID_IAudioEndpointVolumeCallback_Value; pub const IAudioEndpointVolumeCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnNotify: fn( self: *const IAudioEndpointVolumeCallback, pNotify: ?*AUDIO_VOLUME_NOTIFICATION_DATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolumeCallback_OnNotify(self: *const T, pNotify: ?*AUDIO_VOLUME_NOTIFICATION_DATA) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolumeCallback.VTable, self.vtable).OnNotify(@ptrCast(*const IAudioEndpointVolumeCallback, self), pNotify); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioEndpointVolume_Value = @import("../../zig.zig").Guid.initString("5cdf2c82-841e-4546-9722-0cf74078229a"); pub const IID_IAudioEndpointVolume = &IID_IAudioEndpointVolume_Value; pub const IAudioEndpointVolume = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RegisterControlChangeNotify: fn( self: *const IAudioEndpointVolume, pNotify: ?*IAudioEndpointVolumeCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterControlChangeNotify: fn( self: *const IAudioEndpointVolume, pNotify: ?*IAudioEndpointVolumeCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelCount: fn( self: *const IAudioEndpointVolume, pnChannelCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMasterVolumeLevel: fn( self: *const IAudioEndpointVolume, fLevelDB: f32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMasterVolumeLevelScalar: fn( self: *const IAudioEndpointVolume, fLevel: f32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMasterVolumeLevel: fn( self: *const IAudioEndpointVolume, pfLevelDB: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMasterVolumeLevelScalar: fn( self: *const IAudioEndpointVolume, pfLevel: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetChannelVolumeLevel: fn( self: *const IAudioEndpointVolume, nChannel: u32, fLevelDB: f32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetChannelVolumeLevelScalar: fn( self: *const IAudioEndpointVolume, nChannel: u32, fLevel: f32, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelVolumeLevel: fn( self: *const IAudioEndpointVolume, nChannel: u32, pfLevelDB: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelVolumeLevelScalar: fn( self: *const IAudioEndpointVolume, nChannel: u32, pfLevel: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMute: fn( self: *const IAudioEndpointVolume, bMute: BOOL, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMute: fn( self: *const IAudioEndpointVolume, pbMute: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVolumeStepInfo: fn( self: *const IAudioEndpointVolume, pnStep: ?*u32, pnStepCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, VolumeStepUp: fn( self: *const IAudioEndpointVolume, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, VolumeStepDown: fn( self: *const IAudioEndpointVolume, pguidEventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryHardwareSupport: fn( self: *const IAudioEndpointVolume, pdwHardwareSupportMask: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVolumeRange: fn( self: *const IAudioEndpointVolume, pflVolumeMindB: ?*f32, pflVolumeMaxdB: ?*f32, pflVolumeIncrementdB: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_RegisterControlChangeNotify(self: *const T, pNotify: ?*IAudioEndpointVolumeCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).RegisterControlChangeNotify(@ptrCast(*const IAudioEndpointVolume, self), pNotify); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_UnregisterControlChangeNotify(self: *const T, pNotify: ?*IAudioEndpointVolumeCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).UnregisterControlChangeNotify(@ptrCast(*const IAudioEndpointVolume, self), pNotify); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetChannelCount(self: *const T, pnChannelCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetChannelCount(@ptrCast(*const IAudioEndpointVolume, self), pnChannelCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_SetMasterVolumeLevel(self: *const T, fLevelDB: f32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).SetMasterVolumeLevel(@ptrCast(*const IAudioEndpointVolume, self), fLevelDB, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_SetMasterVolumeLevelScalar(self: *const T, fLevel: f32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).SetMasterVolumeLevelScalar(@ptrCast(*const IAudioEndpointVolume, self), fLevel, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetMasterVolumeLevel(self: *const T, pfLevelDB: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetMasterVolumeLevel(@ptrCast(*const IAudioEndpointVolume, self), pfLevelDB); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetMasterVolumeLevelScalar(self: *const T, pfLevel: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetMasterVolumeLevelScalar(@ptrCast(*const IAudioEndpointVolume, self), pfLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_SetChannelVolumeLevel(self: *const T, nChannel: u32, fLevelDB: f32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).SetChannelVolumeLevel(@ptrCast(*const IAudioEndpointVolume, self), nChannel, fLevelDB, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_SetChannelVolumeLevelScalar(self: *const T, nChannel: u32, fLevel: f32, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).SetChannelVolumeLevelScalar(@ptrCast(*const IAudioEndpointVolume, self), nChannel, fLevel, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetChannelVolumeLevel(self: *const T, nChannel: u32, pfLevelDB: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetChannelVolumeLevel(@ptrCast(*const IAudioEndpointVolume, self), nChannel, pfLevelDB); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetChannelVolumeLevelScalar(self: *const T, nChannel: u32, pfLevel: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetChannelVolumeLevelScalar(@ptrCast(*const IAudioEndpointVolume, self), nChannel, pfLevel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_SetMute(self: *const T, bMute: BOOL, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).SetMute(@ptrCast(*const IAudioEndpointVolume, self), bMute, pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetMute(self: *const T, pbMute: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetMute(@ptrCast(*const IAudioEndpointVolume, self), pbMute); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetVolumeStepInfo(self: *const T, pnStep: ?*u32, pnStepCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetVolumeStepInfo(@ptrCast(*const IAudioEndpointVolume, self), pnStep, pnStepCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_VolumeStepUp(self: *const T, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).VolumeStepUp(@ptrCast(*const IAudioEndpointVolume, self), pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_VolumeStepDown(self: *const T, pguidEventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).VolumeStepDown(@ptrCast(*const IAudioEndpointVolume, self), pguidEventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_QueryHardwareSupport(self: *const T, pdwHardwareSupportMask: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).QueryHardwareSupport(@ptrCast(*const IAudioEndpointVolume, self), pdwHardwareSupportMask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolume_GetVolumeRange(self: *const T, pflVolumeMindB: ?*f32, pflVolumeMaxdB: ?*f32, pflVolumeIncrementdB: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolume.VTable, self.vtable).GetVolumeRange(@ptrCast(*const IAudioEndpointVolume, self), pflVolumeMindB, pflVolumeMaxdB, pflVolumeIncrementdB); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioEndpointVolumeEx_Value = @import("../../zig.zig").Guid.initString("66e11784-f695-4f28-a505-a7080081a78f"); pub const IID_IAudioEndpointVolumeEx = &IID_IAudioEndpointVolumeEx_Value; pub const IAudioEndpointVolumeEx = extern struct { pub const VTable = extern struct { base: IAudioEndpointVolume.VTable, GetVolumeRangeChannel: fn( self: *const IAudioEndpointVolumeEx, iChannel: u32, pflVolumeMindB: ?*f32, pflVolumeMaxdB: ?*f32, pflVolumeIncrementdB: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAudioEndpointVolume.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioEndpointVolumeEx_GetVolumeRangeChannel(self: *const T, iChannel: u32, pflVolumeMindB: ?*f32, pflVolumeMaxdB: ?*f32, pflVolumeIncrementdB: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioEndpointVolumeEx.VTable, self.vtable).GetVolumeRangeChannel(@ptrCast(*const IAudioEndpointVolumeEx, self), iChannel, pflVolumeMindB, pflVolumeMaxdB, pflVolumeIncrementdB); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioMeterInformation_Value = @import("../../zig.zig").Guid.initString("c02216f6-8c67-4b5b-9d00-d008e73e0064"); pub const IID_IAudioMeterInformation = &IID_IAudioMeterInformation_Value; pub const IAudioMeterInformation = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPeakValue: fn( self: *const IAudioMeterInformation, pfPeak: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMeteringChannelCount: fn( self: *const IAudioMeterInformation, pnChannelCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetChannelsPeakValues: fn( self: *const IAudioMeterInformation, u32ChannelCount: u32, afPeakValues: [*]f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryHardwareSupport: fn( self: *const IAudioMeterInformation, pdwHardwareSupportMask: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioMeterInformation_GetPeakValue(self: *const T, pfPeak: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioMeterInformation.VTable, self.vtable).GetPeakValue(@ptrCast(*const IAudioMeterInformation, self), pfPeak); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioMeterInformation_GetMeteringChannelCount(self: *const T, pnChannelCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioMeterInformation.VTable, self.vtable).GetMeteringChannelCount(@ptrCast(*const IAudioMeterInformation, self), pnChannelCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioMeterInformation_GetChannelsPeakValues(self: *const T, u32ChannelCount: u32, afPeakValues: [*]f32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioMeterInformation.VTable, self.vtable).GetChannelsPeakValues(@ptrCast(*const IAudioMeterInformation, self), u32ChannelCount, afPeakValues); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioMeterInformation_QueryHardwareSupport(self: *const T, pdwHardwareSupportMask: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioMeterInformation.VTable, self.vtable).QueryHardwareSupport(@ptrCast(*const IAudioMeterInformation, self), pdwHardwareSupportMask); } };} pub usingnamespace MethodMixin(@This()); }; pub const AudioSessionDisconnectReason = enum(i32) { DeviceRemoval = 0, ServerShutdown = 1, FormatChanged = 2, SessionLogoff = 3, SessionDisconnected = 4, ExclusiveModeOverride = 5, }; pub const DisconnectReasonDeviceRemoval = AudioSessionDisconnectReason.DeviceRemoval; pub const DisconnectReasonServerShutdown = AudioSessionDisconnectReason.ServerShutdown; pub const DisconnectReasonFormatChanged = AudioSessionDisconnectReason.FormatChanged; pub const DisconnectReasonSessionLogoff = AudioSessionDisconnectReason.SessionLogoff; pub const DisconnectReasonSessionDisconnected = AudioSessionDisconnectReason.SessionDisconnected; pub const DisconnectReasonExclusiveModeOverride = AudioSessionDisconnectReason.ExclusiveModeOverride; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioSessionEvents_Value = @import("../../zig.zig").Guid.initString("24918acc-64b3-37c1-8ca9-74a66e9957a8"); pub const IID_IAudioSessionEvents = &IID_IAudioSessionEvents_Value; pub const IAudioSessionEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnDisplayNameChanged: fn( self: *const IAudioSessionEvents, NewDisplayName: ?[*:0]const u16, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnIconPathChanged: fn( self: *const IAudioSessionEvents, NewIconPath: ?[*:0]const u16, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSimpleVolumeChanged: fn( self: *const IAudioSessionEvents, NewVolume: f32, NewMute: BOOL, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnChannelVolumeChanged: fn( self: *const IAudioSessionEvents, ChannelCount: u32, NewChannelVolumeArray: [*]f32, ChangedChannel: u32, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnGroupingParamChanged: fn( self: *const IAudioSessionEvents, NewGroupingParam: ?*const Guid, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnStateChanged: fn( self: *const IAudioSessionEvents, NewState: AudioSessionState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnSessionDisconnected: fn( self: *const IAudioSessionEvents, DisconnectReason: AudioSessionDisconnectReason, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEvents_OnDisplayNameChanged(self: *const T, NewDisplayName: ?[*:0]const u16, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEvents.VTable, self.vtable).OnDisplayNameChanged(@ptrCast(*const IAudioSessionEvents, self), NewDisplayName, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEvents_OnIconPathChanged(self: *const T, NewIconPath: ?[*:0]const u16, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEvents.VTable, self.vtable).OnIconPathChanged(@ptrCast(*const IAudioSessionEvents, self), NewIconPath, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEvents_OnSimpleVolumeChanged(self: *const T, NewVolume: f32, NewMute: BOOL, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEvents.VTable, self.vtable).OnSimpleVolumeChanged(@ptrCast(*const IAudioSessionEvents, self), NewVolume, NewMute, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEvents_OnChannelVolumeChanged(self: *const T, ChannelCount: u32, NewChannelVolumeArray: [*]f32, ChangedChannel: u32, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEvents.VTable, self.vtable).OnChannelVolumeChanged(@ptrCast(*const IAudioSessionEvents, self), ChannelCount, NewChannelVolumeArray, ChangedChannel, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEvents_OnGroupingParamChanged(self: *const T, NewGroupingParam: ?*const Guid, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEvents.VTable, self.vtable).OnGroupingParamChanged(@ptrCast(*const IAudioSessionEvents, self), NewGroupingParam, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEvents_OnStateChanged(self: *const T, NewState: AudioSessionState) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEvents.VTable, self.vtable).OnStateChanged(@ptrCast(*const IAudioSessionEvents, self), NewState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEvents_OnSessionDisconnected(self: *const T, DisconnectReason: AudioSessionDisconnectReason) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEvents.VTable, self.vtable).OnSessionDisconnected(@ptrCast(*const IAudioSessionEvents, self), DisconnectReason); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioSessionControl_Value = @import("../../zig.zig").Guid.initString("f4b1a599-7266-4319-a8ca-e70acb11e8cd"); pub const IID_IAudioSessionControl = &IID_IAudioSessionControl_Value; pub const IAudioSessionControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetState: fn( self: *const IAudioSessionControl, pRetVal: ?*AudioSessionState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDisplayName: fn( self: *const IAudioSessionControl, pRetVal: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDisplayName: fn( self: *const IAudioSessionControl, Value: ?[*:0]const u16, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIconPath: fn( self: *const IAudioSessionControl, pRetVal: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIconPath: fn( self: *const IAudioSessionControl, Value: ?[*:0]const u16, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGroupingParam: fn( self: *const IAudioSessionControl, pRetVal: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGroupingParam: fn( self: *const IAudioSessionControl, Override: ?*const Guid, EventContext: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterAudioSessionNotification: fn( self: *const IAudioSessionControl, NewNotifications: ?*IAudioSessionEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterAudioSessionNotification: fn( self: *const IAudioSessionControl, NewNotifications: ?*IAudioSessionEvents, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_GetState(self: *const T, pRetVal: ?*AudioSessionState) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).GetState(@ptrCast(*const IAudioSessionControl, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_GetDisplayName(self: *const T, pRetVal: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).GetDisplayName(@ptrCast(*const IAudioSessionControl, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_SetDisplayName(self: *const T, Value: ?[*:0]const u16, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).SetDisplayName(@ptrCast(*const IAudioSessionControl, self), Value, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_GetIconPath(self: *const T, pRetVal: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).GetIconPath(@ptrCast(*const IAudioSessionControl, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_SetIconPath(self: *const T, Value: ?[*:0]const u16, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).SetIconPath(@ptrCast(*const IAudioSessionControl, self), Value, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_GetGroupingParam(self: *const T, pRetVal: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).GetGroupingParam(@ptrCast(*const IAudioSessionControl, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_SetGroupingParam(self: *const T, Override: ?*const Guid, EventContext: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).SetGroupingParam(@ptrCast(*const IAudioSessionControl, self), Override, EventContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_RegisterAudioSessionNotification(self: *const T, NewNotifications: ?*IAudioSessionEvents) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).RegisterAudioSessionNotification(@ptrCast(*const IAudioSessionControl, self), NewNotifications); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl_UnregisterAudioSessionNotification(self: *const T, NewNotifications: ?*IAudioSessionEvents) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl.VTable, self.vtable).UnregisterAudioSessionNotification(@ptrCast(*const IAudioSessionControl, self), NewNotifications); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioSessionControl2_Value = @import("../../zig.zig").Guid.initString("bfb7ff88-7239-4fc9-8fa2-07c950be9c6d"); pub const IID_IAudioSessionControl2 = &IID_IAudioSessionControl2_Value; pub const IAudioSessionControl2 = extern struct { pub const VTable = extern struct { base: IAudioSessionControl.VTable, GetSessionIdentifier: fn( self: *const IAudioSessionControl2, pRetVal: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSessionInstanceIdentifier: fn( self: *const IAudioSessionControl2, pRetVal: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProcessId: fn( self: *const IAudioSessionControl2, pRetVal: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsSystemSoundsSession: fn( self: *const IAudioSessionControl2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDuckingPreference: fn( self: *const IAudioSessionControl2, optOut: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAudioSessionControl.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl2_GetSessionIdentifier(self: *const T, pRetVal: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl2.VTable, self.vtable).GetSessionIdentifier(@ptrCast(*const IAudioSessionControl2, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl2_GetSessionInstanceIdentifier(self: *const T, pRetVal: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl2.VTable, self.vtable).GetSessionInstanceIdentifier(@ptrCast(*const IAudioSessionControl2, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl2_GetProcessId(self: *const T, pRetVal: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl2.VTable, self.vtable).GetProcessId(@ptrCast(*const IAudioSessionControl2, self), pRetVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl2_IsSystemSoundsSession(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl2.VTable, self.vtable).IsSystemSoundsSession(@ptrCast(*const IAudioSessionControl2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionControl2_SetDuckingPreference(self: *const T, optOut: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionControl2.VTable, self.vtable).SetDuckingPreference(@ptrCast(*const IAudioSessionControl2, self), optOut); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IAudioSessionManager_Value = @import("../../zig.zig").Guid.initString("bfa971f1-4d5e-40bb-935e-967039bfbee4"); pub const IID_IAudioSessionManager = &IID_IAudioSessionManager_Value; pub const IAudioSessionManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetAudioSessionControl: fn( self: *const IAudioSessionManager, AudioSessionGuid: ?*const Guid, StreamFlags: u32, SessionControl: ?*?*IAudioSessionControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSimpleAudioVolume: fn( self: *const IAudioSessionManager, AudioSessionGuid: ?*const Guid, StreamFlags: u32, AudioVolume: ?*?*ISimpleAudioVolume, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionManager_GetAudioSessionControl(self: *const T, AudioSessionGuid: ?*const Guid, StreamFlags: u32, SessionControl: ?*?*IAudioSessionControl) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionManager.VTable, self.vtable).GetAudioSessionControl(@ptrCast(*const IAudioSessionManager, self), AudioSessionGuid, StreamFlags, SessionControl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionManager_GetSimpleAudioVolume(self: *const T, AudioSessionGuid: ?*const Guid, StreamFlags: u32, AudioVolume: ?*?*ISimpleAudioVolume) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionManager.VTable, self.vtable).GetSimpleAudioVolume(@ptrCast(*const IAudioSessionManager, self), AudioSessionGuid, StreamFlags, AudioVolume); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioVolumeDuckNotification_Value = @import("../../zig.zig").Guid.initString("c3b284d4-6d39-4359-b3cf-b56ddb3bb39c"); pub const IID_IAudioVolumeDuckNotification = &IID_IAudioVolumeDuckNotification_Value; pub const IAudioVolumeDuckNotification = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnVolumeDuckNotification: fn( self: *const IAudioVolumeDuckNotification, sessionID: ?[*:0]const u16, countCommunicationSessions: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnVolumeUnduckNotification: fn( self: *const IAudioVolumeDuckNotification, sessionID: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioVolumeDuckNotification_OnVolumeDuckNotification(self: *const T, sessionID: ?[*:0]const u16, countCommunicationSessions: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioVolumeDuckNotification.VTable, self.vtable).OnVolumeDuckNotification(@ptrCast(*const IAudioVolumeDuckNotification, self), sessionID, countCommunicationSessions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioVolumeDuckNotification_OnVolumeUnduckNotification(self: *const T, sessionID: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioVolumeDuckNotification.VTable, self.vtable).OnVolumeUnduckNotification(@ptrCast(*const IAudioVolumeDuckNotification, self), sessionID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioSessionNotification_Value = @import("../../zig.zig").Guid.initString("641dd20b-4d41-49cc-aba3-174b9477bb08"); pub const IID_IAudioSessionNotification = &IID_IAudioSessionNotification_Value; pub const IAudioSessionNotification = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnSessionCreated: fn( self: *const IAudioSessionNotification, NewSession: ?*IAudioSessionControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionNotification_OnSessionCreated(self: *const T, NewSession: ?*IAudioSessionControl) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionNotification.VTable, self.vtable).OnSessionCreated(@ptrCast(*const IAudioSessionNotification, self), NewSession); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioSessionEnumerator_Value = @import("../../zig.zig").Guid.initString("e2f5bb11-0570-40ca-acdd-3aa01277dee8"); pub const IID_IAudioSessionEnumerator = &IID_IAudioSessionEnumerator_Value; pub const IAudioSessionEnumerator = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCount: fn( self: *const IAudioSessionEnumerator, SessionCount: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSession: fn( self: *const IAudioSessionEnumerator, SessionCount: i32, Session: ?*?*IAudioSessionControl, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEnumerator_GetCount(self: *const T, SessionCount: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEnumerator.VTable, self.vtable).GetCount(@ptrCast(*const IAudioSessionEnumerator, self), SessionCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionEnumerator_GetSession(self: *const T, SessionCount: i32, Session: ?*?*IAudioSessionControl) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionEnumerator.VTable, self.vtable).GetSession(@ptrCast(*const IAudioSessionEnumerator, self), SessionCount, Session); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.1' const IID_IAudioSessionManager2_Value = @import("../../zig.zig").Guid.initString("77aa99a0-1bd6-484f-8bc7-2c654c9a9b6f"); pub const IID_IAudioSessionManager2 = &IID_IAudioSessionManager2_Value; pub const IAudioSessionManager2 = extern struct { pub const VTable = extern struct { base: IAudioSessionManager.VTable, GetSessionEnumerator: fn( self: *const IAudioSessionManager2, SessionEnum: ?*?*IAudioSessionEnumerator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterSessionNotification: fn( self: *const IAudioSessionManager2, SessionNotification: ?*IAudioSessionNotification, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterSessionNotification: fn( self: *const IAudioSessionManager2, SessionNotification: ?*IAudioSessionNotification, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterDuckNotification: fn( self: *const IAudioSessionManager2, sessionID: ?[*:0]const u16, duckNotification: ?*IAudioVolumeDuckNotification, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnregisterDuckNotification: fn( self: *const IAudioSessionManager2, duckNotification: ?*IAudioVolumeDuckNotification, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAudioSessionManager.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionManager2_GetSessionEnumerator(self: *const T, SessionEnum: ?*?*IAudioSessionEnumerator) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionManager2.VTable, self.vtable).GetSessionEnumerator(@ptrCast(*const IAudioSessionManager2, self), SessionEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionManager2_RegisterSessionNotification(self: *const T, SessionNotification: ?*IAudioSessionNotification) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionManager2.VTable, self.vtable).RegisterSessionNotification(@ptrCast(*const IAudioSessionManager2, self), SessionNotification); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionManager2_UnregisterSessionNotification(self: *const T, SessionNotification: ?*IAudioSessionNotification) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionManager2.VTable, self.vtable).UnregisterSessionNotification(@ptrCast(*const IAudioSessionManager2, self), SessionNotification); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionManager2_RegisterDuckNotification(self: *const T, sessionID: ?[*:0]const u16, duckNotification: ?*IAudioVolumeDuckNotification) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionManager2.VTable, self.vtable).RegisterDuckNotification(@ptrCast(*const IAudioSessionManager2, self), sessionID, duckNotification); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAudioSessionManager2_UnregisterDuckNotification(self: *const T, duckNotification: ?*IAudioVolumeDuckNotification) callconv(.Inline) HRESULT { return @ptrCast(*const IAudioSessionManager2.VTable, self.vtable).UnregisterDuckNotification(@ptrCast(*const IAudioSessionManager2, self), duckNotification); } };} pub usingnamespace MethodMixin(@This()); }; pub const SpatialAudioMetadataWriterOverflowMode = enum(i32) { Fail = 0, MergeWithNew = 1, MergeWithLast = 2, }; pub const SpatialAudioMetadataWriterOverflow_Fail = SpatialAudioMetadataWriterOverflowMode.Fail; pub const SpatialAudioMetadataWriterOverflow_MergeWithNew = SpatialAudioMetadataWriterOverflowMode.MergeWithNew; pub const SpatialAudioMetadataWriterOverflow_MergeWithLast = SpatialAudioMetadataWriterOverflowMode.MergeWithLast; pub const SpatialAudioMetadataCopyMode = enum(i32) { Overwrite = 0, Append = 1, AppendMergeWithLast = 2, AppendMergeWithFirst = 3, }; pub const SpatialAudioMetadataCopy_Overwrite = SpatialAudioMetadataCopyMode.Overwrite; pub const SpatialAudioMetadataCopy_Append = SpatialAudioMetadataCopyMode.Append; pub const SpatialAudioMetadataCopy_AppendMergeWithLast = SpatialAudioMetadataCopyMode.AppendMergeWithLast; pub const SpatialAudioMetadataCopy_AppendMergeWithFirst = SpatialAudioMetadataCopyMode.AppendMergeWithFirst; pub const SpatialAudioMetadataItemsInfo = packed struct { FrameCount: u16, ItemCount: u16, MaxItemCount: u16, MaxValueBufferLength: u32, }; pub const SpatialAudioObjectRenderStreamForMetadataActivationParams = packed struct { ObjectFormat: ?*const WAVEFORMATEX, StaticObjectTypeMask: AudioObjectType, MinDynamicObjectCount: u32, MaxDynamicObjectCount: u32, Category: AUDIO_STREAM_CATEGORY, EventHandle: ?HANDLE, MetadataFormatId: Guid, MaxMetadataItemCount: u16, MetadataActivationParams: ?*const PROPVARIANT, NotifyObject: ?*ISpatialAudioObjectRenderStreamNotify, }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioMetadataItems_Value = @import("../../zig.zig").Guid.initString("bcd7c78f-3098-4f22-b547-a2f25a381269"); pub const IID_ISpatialAudioMetadataItems = &IID_ISpatialAudioMetadataItems_Value; pub const ISpatialAudioMetadataItems = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetFrameCount: fn( self: *const ISpatialAudioMetadataItems, frameCount: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetItemCount: fn( self: *const ISpatialAudioMetadataItems, itemCount: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMaxItemCount: fn( self: *const ISpatialAudioMetadataItems, maxItemCount: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMaxValueBufferLength: fn( self: *const ISpatialAudioMetadataItems, maxValueBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInfo: fn( self: *const ISpatialAudioMetadataItems, info: ?*SpatialAudioMetadataItemsInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItems_GetFrameCount(self: *const T, frameCount: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItems.VTable, self.vtable).GetFrameCount(@ptrCast(*const ISpatialAudioMetadataItems, self), frameCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItems_GetItemCount(self: *const T, itemCount: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItems.VTable, self.vtable).GetItemCount(@ptrCast(*const ISpatialAudioMetadataItems, self), itemCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItems_GetMaxItemCount(self: *const T, maxItemCount: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItems.VTable, self.vtable).GetMaxItemCount(@ptrCast(*const ISpatialAudioMetadataItems, self), maxItemCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItems_GetMaxValueBufferLength(self: *const T, maxValueBufferLength: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItems.VTable, self.vtable).GetMaxValueBufferLength(@ptrCast(*const ISpatialAudioMetadataItems, self), maxValueBufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItems_GetInfo(self: *const T, info: ?*SpatialAudioMetadataItemsInfo) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItems.VTable, self.vtable).GetInfo(@ptrCast(*const ISpatialAudioMetadataItems, self), info); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioMetadataWriter_Value = @import("../../zig.zig").Guid.initString("1b17ca01-2955-444d-a430-537dc589a844"); pub const IID_ISpatialAudioMetadataWriter = &IID_ISpatialAudioMetadataWriter_Value; pub const ISpatialAudioMetadataWriter = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const ISpatialAudioMetadataWriter, metadataItems: ?*ISpatialAudioMetadataItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteNextItem: fn( self: *const ISpatialAudioMetadataWriter, frameOffset: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteNextItemCommand: fn( self: *const ISpatialAudioMetadataWriter, commandID: u8, // TODO: what to do with BytesParamIndex 2? valueBuffer: ?*const c_void, valueBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const ISpatialAudioMetadataWriter, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataWriter_Open(self: *const T, metadataItems: ?*ISpatialAudioMetadataItems) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataWriter.VTable, self.vtable).Open(@ptrCast(*const ISpatialAudioMetadataWriter, self), metadataItems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataWriter_WriteNextItem(self: *const T, frameOffset: u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataWriter.VTable, self.vtable).WriteNextItem(@ptrCast(*const ISpatialAudioMetadataWriter, self), frameOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataWriter_WriteNextItemCommand(self: *const T, commandID: u8, valueBuffer: ?*const c_void, valueBufferLength: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataWriter.VTable, self.vtable).WriteNextItemCommand(@ptrCast(*const ISpatialAudioMetadataWriter, self), commandID, valueBuffer, valueBufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataWriter_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataWriter.VTable, self.vtable).Close(@ptrCast(*const ISpatialAudioMetadataWriter, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioMetadataReader_Value = @import("../../zig.zig").Guid.initString("b78e86a2-31d9-4c32-94d2-7df40fc7ebec"); pub const IID_ISpatialAudioMetadataReader = &IID_ISpatialAudioMetadataReader_Value; pub const ISpatialAudioMetadataReader = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const ISpatialAudioMetadataReader, metadataItems: ?*ISpatialAudioMetadataItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReadNextItem: fn( self: *const ISpatialAudioMetadataReader, commandCount: ?*u8, frameOffset: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReadNextItemCommand: fn( self: *const ISpatialAudioMetadataReader, commandID: ?*u8, // TODO: what to do with BytesParamIndex 2? valueBuffer: ?*c_void, maxValueBufferLength: u32, valueBufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const ISpatialAudioMetadataReader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataReader_Open(self: *const T, metadataItems: ?*ISpatialAudioMetadataItems) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataReader.VTable, self.vtable).Open(@ptrCast(*const ISpatialAudioMetadataReader, self), metadataItems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataReader_ReadNextItem(self: *const T, commandCount: ?*u8, frameOffset: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataReader.VTable, self.vtable).ReadNextItem(@ptrCast(*const ISpatialAudioMetadataReader, self), commandCount, frameOffset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataReader_ReadNextItemCommand(self: *const T, commandID: ?*u8, valueBuffer: ?*c_void, maxValueBufferLength: u32, valueBufferLength: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataReader.VTable, self.vtable).ReadNextItemCommand(@ptrCast(*const ISpatialAudioMetadataReader, self), commandID, valueBuffer, maxValueBufferLength, valueBufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataReader_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataReader.VTable, self.vtable).Close(@ptrCast(*const ISpatialAudioMetadataReader, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioMetadataCopier_Value = @import("../../zig.zig").Guid.initString("d224b233-e251-4fd0-9ca2-d5ecf9a68404"); pub const IID_ISpatialAudioMetadataCopier = &IID_ISpatialAudioMetadataCopier_Value; pub const ISpatialAudioMetadataCopier = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const ISpatialAudioMetadataCopier, metadataItems: ?*ISpatialAudioMetadataItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CopyMetadataForFrames: fn( self: *const ISpatialAudioMetadataCopier, copyFrameCount: u16, copyMode: SpatialAudioMetadataCopyMode, dstMetadataItems: ?*ISpatialAudioMetadataItems, itemsCopied: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const ISpatialAudioMetadataCopier, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataCopier_Open(self: *const T, metadataItems: ?*ISpatialAudioMetadataItems) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataCopier.VTable, self.vtable).Open(@ptrCast(*const ISpatialAudioMetadataCopier, self), metadataItems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataCopier_CopyMetadataForFrames(self: *const T, copyFrameCount: u16, copyMode: SpatialAudioMetadataCopyMode, dstMetadataItems: ?*ISpatialAudioMetadataItems, itemsCopied: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataCopier.VTable, self.vtable).CopyMetadataForFrames(@ptrCast(*const ISpatialAudioMetadataCopier, self), copyFrameCount, copyMode, dstMetadataItems, itemsCopied); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataCopier_Close(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataCopier.VTable, self.vtable).Close(@ptrCast(*const ISpatialAudioMetadataCopier, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioMetadataItemsBuffer_Value = @import("../../zig.zig").Guid.initString("42640a16-e1bd-42d9-9ff6-031ab71a2dba"); pub const IID_ISpatialAudioMetadataItemsBuffer = &IID_ISpatialAudioMetadataItemsBuffer_Value; pub const ISpatialAudioMetadataItemsBuffer = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AttachToBuffer: fn( self: *const ISpatialAudioMetadataItemsBuffer, // TODO: what to do with BytesParamIndex 1? buffer: ?*u8, bufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AttachToPopulatedBuffer: fn( self: *const ISpatialAudioMetadataItemsBuffer, // TODO: what to do with BytesParamIndex 1? buffer: ?*u8, bufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DetachBuffer: fn( self: *const ISpatialAudioMetadataItemsBuffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItemsBuffer_AttachToBuffer(self: *const T, buffer: ?*u8, bufferLength: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItemsBuffer.VTable, self.vtable).AttachToBuffer(@ptrCast(*const ISpatialAudioMetadataItemsBuffer, self), buffer, bufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItemsBuffer_AttachToPopulatedBuffer(self: *const T, buffer: ?*u8, bufferLength: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItemsBuffer.VTable, self.vtable).AttachToPopulatedBuffer(@ptrCast(*const ISpatialAudioMetadataItemsBuffer, self), buffer, bufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataItemsBuffer_DetachBuffer(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataItemsBuffer.VTable, self.vtable).DetachBuffer(@ptrCast(*const ISpatialAudioMetadataItemsBuffer, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioMetadataClient_Value = @import("../../zig.zig").Guid.initString("777d4a3b-f6ff-4a26-85dc-68d7cdeda1d4"); pub const IID_ISpatialAudioMetadataClient = &IID_ISpatialAudioMetadataClient_Value; pub const ISpatialAudioMetadataClient = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ActivateSpatialAudioMetadataItems: fn( self: *const ISpatialAudioMetadataClient, maxItemCount: u16, frameCount: u16, metadataItemsBuffer: ?*?*ISpatialAudioMetadataItemsBuffer, metadataItems: ?*?*ISpatialAudioMetadataItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSpatialAudioMetadataItemsBufferLength: fn( self: *const ISpatialAudioMetadataClient, maxItemCount: u16, bufferLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ActivateSpatialAudioMetadataWriter: fn( self: *const ISpatialAudioMetadataClient, overflowMode: SpatialAudioMetadataWriterOverflowMode, metadataWriter: ?*?*ISpatialAudioMetadataWriter, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ActivateSpatialAudioMetadataCopier: fn( self: *const ISpatialAudioMetadataClient, metadataCopier: ?*?*ISpatialAudioMetadataCopier, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ActivateSpatialAudioMetadataReader: fn( self: *const ISpatialAudioMetadataClient, metadataReader: ?*?*ISpatialAudioMetadataReader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataClient_ActivateSpatialAudioMetadataItems(self: *const T, maxItemCount: u16, frameCount: u16, metadataItemsBuffer: ?*?*ISpatialAudioMetadataItemsBuffer, metadataItems: ?*?*ISpatialAudioMetadataItems) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataClient.VTable, self.vtable).ActivateSpatialAudioMetadataItems(@ptrCast(*const ISpatialAudioMetadataClient, self), maxItemCount, frameCount, metadataItemsBuffer, metadataItems); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataClient_GetSpatialAudioMetadataItemsBufferLength(self: *const T, maxItemCount: u16, bufferLength: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataClient.VTable, self.vtable).GetSpatialAudioMetadataItemsBufferLength(@ptrCast(*const ISpatialAudioMetadataClient, self), maxItemCount, bufferLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataClient_ActivateSpatialAudioMetadataWriter(self: *const T, overflowMode: SpatialAudioMetadataWriterOverflowMode, metadataWriter: ?*?*ISpatialAudioMetadataWriter) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataClient.VTable, self.vtable).ActivateSpatialAudioMetadataWriter(@ptrCast(*const ISpatialAudioMetadataClient, self), overflowMode, metadataWriter); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataClient_ActivateSpatialAudioMetadataCopier(self: *const T, metadataCopier: ?*?*ISpatialAudioMetadataCopier) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataClient.VTable, self.vtable).ActivateSpatialAudioMetadataCopier(@ptrCast(*const ISpatialAudioMetadataClient, self), metadataCopier); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioMetadataClient_ActivateSpatialAudioMetadataReader(self: *const T, metadataReader: ?*?*ISpatialAudioMetadataReader) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioMetadataClient.VTable, self.vtable).ActivateSpatialAudioMetadataReader(@ptrCast(*const ISpatialAudioMetadataClient, self), metadataReader); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectForMetadataCommands_Value = @import("../../zig.zig").Guid.initString("0df2c94b-f5f9-472d-af6b-c46e0ac9cd05"); pub const IID_ISpatialAudioObjectForMetadataCommands = &IID_ISpatialAudioObjectForMetadataCommands_Value; pub const ISpatialAudioObjectForMetadataCommands = extern struct { pub const VTable = extern struct { base: ISpatialAudioObjectBase.VTable, WriteNextMetadataCommand: fn( self: *const ISpatialAudioObjectForMetadataCommands, commandID: u8, // TODO: what to do with BytesParamIndex 2? valueBuffer: ?*c_void, valueBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpatialAudioObjectBase.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForMetadataCommands_WriteNextMetadataCommand(self: *const T, commandID: u8, valueBuffer: ?*c_void, valueBufferLength: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForMetadataCommands.VTable, self.vtable).WriteNextMetadataCommand(@ptrCast(*const ISpatialAudioObjectForMetadataCommands, self), commandID, valueBuffer, valueBufferLength); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectForMetadataItems_Value = @import("../../zig.zig").Guid.initString("ddea49ff-3bc0-4377-8aad-9fbcfd808566"); pub const IID_ISpatialAudioObjectForMetadataItems = &IID_ISpatialAudioObjectForMetadataItems_Value; pub const ISpatialAudioObjectForMetadataItems = extern struct { pub const VTable = extern struct { base: ISpatialAudioObjectBase.VTable, GetSpatialAudioMetadataItems: fn( self: *const ISpatialAudioObjectForMetadataItems, metadataItems: ?*?*ISpatialAudioMetadataItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpatialAudioObjectBase.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectForMetadataItems_GetSpatialAudioMetadataItems(self: *const T, metadataItems: ?*?*ISpatialAudioMetadataItems) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectForMetadataItems.VTable, self.vtable).GetSpatialAudioMetadataItems(@ptrCast(*const ISpatialAudioObjectForMetadataItems, self), metadataItems); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.15063' const IID_ISpatialAudioObjectRenderStreamForMetadata_Value = @import("../../zig.zig").Guid.initString("bbc9c907-48d5-4a2e-a0c7-f7f0d67c1fb1"); pub const IID_ISpatialAudioObjectRenderStreamForMetadata = &IID_ISpatialAudioObjectRenderStreamForMetadata_Value; pub const ISpatialAudioObjectRenderStreamForMetadata = extern struct { pub const VTable = extern struct { base: ISpatialAudioObjectRenderStreamBase.VTable, ActivateSpatialAudioObjectForMetadataCommands: fn( self: *const ISpatialAudioObjectRenderStreamForMetadata, type: AudioObjectType, audioObject: ?*?*ISpatialAudioObjectForMetadataCommands, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ActivateSpatialAudioObjectForMetadataItems: fn( self: *const ISpatialAudioObjectRenderStreamForMetadata, type: AudioObjectType, audioObject: ?*?*ISpatialAudioObjectForMetadataItems, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISpatialAudioObjectRenderStreamBase.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamForMetadata_ActivateSpatialAudioObjectForMetadataCommands(self: *const T, type_: AudioObjectType, audioObject: ?*?*ISpatialAudioObjectForMetadataCommands) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamForMetadata.VTable, self.vtable).ActivateSpatialAudioObjectForMetadataCommands(@ptrCast(*const ISpatialAudioObjectRenderStreamForMetadata, self), type_, audioObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISpatialAudioObjectRenderStreamForMetadata_ActivateSpatialAudioObjectForMetadataItems(self: *const T, type_: AudioObjectType, audioObject: ?*?*ISpatialAudioObjectForMetadataItems) callconv(.Inline) HRESULT { return @ptrCast(*const ISpatialAudioObjectRenderStreamForMetadata.VTable, self.vtable).ActivateSpatialAudioObjectForMetadataItems(@ptrCast(*const ISpatialAudioObjectRenderStreamForMetadata, self), type_, audioObject); } };} pub usingnamespace MethodMixin(@This()); }; pub const KSSTREAM_HEADER = switch(@import("../../zig.zig").arch) { .X64, .Arm64 => extern struct { Size: u32, TypeSpecificFlags: u32, PresentationTime: KSTIME, Duration: i64, FrameExtent: u32, DataUsed: u32, Data: ?*c_void, OptionsFlags: u32, Reserved: u32, }, .X86 => extern struct { Size: u32, TypeSpecificFlags: u32, PresentationTime: KSTIME, Duration: i64, FrameExtent: u32, DataUsed: u32, Data: ?*c_void, OptionsFlags: u32, }, }; pub const KSNODEPROPERTY_AUDIO_3D_LISTENER = switch(@import("../../zig.zig").arch) { .X64, .Arm64 => extern struct { NodeProperty: KSNODEPROPERTY, ListenerId: ?*c_void, }, .X86 => extern struct { NodeProperty: KSNODEPROPERTY, ListenerId: ?*c_void, Reserved: u32, }, }; pub const KSNODEPROPERTY_AUDIO_PROPERTY = switch(@import("../../zig.zig").arch) { .X64, .Arm64 => extern struct { NodeProperty: KSNODEPROPERTY, AppContext: ?*c_void, Length: u32, }, .X86 => extern struct { NodeProperty: KSNODEPROPERTY, AppContext: ?*c_void, Length: u32, Reserved: u32, }, }; //-------------------------------------------------------------------------------- // Section: Functions (28) //-------------------------------------------------------------------------------- pub extern "WINMM" fn mciSendCommandA( mciId: u32, uMsg: u32, dwParam1: usize, dwParam2: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSendCommandW( mciId: u32, uMsg: u32, dwParam1: usize, dwParam2: usize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSendStringA( lpstrCommand: ?[*:0]const u8, lpstrReturnString: ?[*:0]u8, uReturnLength: u32, hwndCallback: ?HWND, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSendStringW( lpstrCommand: ?[*:0]const u16, lpstrReturnString: ?[*:0]u16, uReturnLength: u32, hwndCallback: ?HWND, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDA( pszDevice: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDW( pszDevice: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDFromElementIDA( dwElementID: u32, lpstrType: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetDeviceIDFromElementIDW( dwElementID: u32, lpstrType: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciGetErrorStringA( mcierr: u32, pszText: [*:0]u8, cchText: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciGetErrorStringW( mcierr: u32, pszText: [*:0]u16, cchText: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciSetYieldProc( mciId: u32, fpYieldProc: ?YIELDPROC, dwYieldData: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciGetCreatorTask( mciId: u32, ) callconv(@import("std").os.windows.WINAPI) ?HTASK; pub extern "WINMM" fn mciGetYieldProc( mciId: u32, pdwYieldData: ?*u32, ) callconv(@import("std").os.windows.WINAPI) ?YIELDPROC; pub extern "WINMM" fn mciGetDriverData( wDeviceID: u32, ) callconv(@import("std").os.windows.WINAPI) usize; pub extern "WINMM" fn mciLoadCommandResource( hInstance: ?HANDLE, lpResName: ?[*:0]const u16, wType: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciSetDriverData( wDeviceID: u32, dwData: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciDriverYield( wDeviceID: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "WINMM" fn mciDriverNotify( hwndCallback: ?HANDLE, wDeviceID: u32, uStatus: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "WINMM" fn mciFreeCommandResource( wTable: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "ksuser" fn KsCreateAllocator( ConnectionHandle: ?HANDLE, AllocatorFraming: ?*KSALLOCATOR_FRAMING, AllocatorHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "ksuser" fn KsCreateClock( ConnectionHandle: ?HANDLE, ClockCreate: ?*KSCLOCK_CREATE, ClockHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "ksuser" fn KsCreatePin( FilterHandle: ?HANDLE, Connect: ?*KSPIN_CONNECT, DesiredAccess: u32, ConnectionHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "ksuser" fn KsCreateTopologyNode( ParentHandle: ?HANDLE, NodeCreate: ?*KSNODE_CREATE, DesiredAccess: u32, NodeHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "ksuser" fn KsCreateAllocator2( ConnectionHandle: ?HANDLE, AllocatorFraming: ?*KSALLOCATOR_FRAMING, AllocatorHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ksuser" fn KsCreateClock2( ConnectionHandle: ?HANDLE, ClockCreate: ?*KSCLOCK_CREATE, ClockHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ksuser" fn KsCreatePin2( FilterHandle: ?HANDLE, Connect: ?*KSPIN_CONNECT, DesiredAccess: u32, ConnectionHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "ksuser" fn KsCreateTopologyNode2( ParentHandle: ?HANDLE, NodeCreate: ?*KSNODE_CREATE, DesiredAccess: u32, NodeHandle: ?*?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows8.0' pub extern "MMDevAPI" fn ActivateAudioInterfaceAsync( deviceInterfacePath: ?[*:0]const u16, riid: ?*const Guid, activationParams: ?*PROPVARIANT, completionHandler: ?*IActivateAudioInterfaceCompletionHandler, activationOperation: ?*?*IActivateAudioInterfaceAsyncOperation, ) callconv(@import("std").os.windows.WINAPI) HRESULT; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (18) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../../zig.zig").unicode_mode) { .ansi => struct { pub const MCI_OPEN_PARMS = thismodule.MCI_OPEN_PARMSA; pub const MCI_INFO_PARMS = thismodule.MCI_INFO_PARMSA; pub const MCI_SYSINFO_PARMS = thismodule.MCI_SYSINFO_PARMSA; pub const MCI_SAVE_PARMS = thismodule.MCI_SAVE_PARMSA; pub const MCI_LOAD_PARMS = thismodule.MCI_LOAD_PARMSA; pub const MCI_VD_ESCAPE_PARMS = thismodule.MCI_VD_ESCAPE_PARMSA; pub const MCI_WAVE_OPEN_PARMS = thismodule.MCI_WAVE_OPEN_PARMSA; pub const MCI_ANIM_OPEN_PARMS = thismodule.MCI_ANIM_OPEN_PARMSA; pub const MCI_ANIM_WINDOW_PARMS = thismodule.MCI_ANIM_WINDOW_PARMSA; pub const MCI_OVLY_OPEN_PARMS = thismodule.MCI_OVLY_OPEN_PARMSA; pub const MCI_OVLY_WINDOW_PARMS = thismodule.MCI_OVLY_WINDOW_PARMSA; pub const MCI_OVLY_SAVE_PARMS = thismodule.MCI_OVLY_SAVE_PARMSA; pub const MCI_OVLY_LOAD_PARMS = thismodule.MCI_OVLY_LOAD_PARMSA; pub const mciSendCommand = thismodule.mciSendCommandA; pub const mciSendString = thismodule.mciSendStringA; pub const mciGetDeviceID = thismodule.mciGetDeviceIDA; pub const mciGetDeviceIDFromElementID = thismodule.mciGetDeviceIDFromElementIDA; pub const mciGetErrorString = thismodule.mciGetErrorStringA; }, .wide => struct { pub const MCI_OPEN_PARMS = thismodule.MCI_OPEN_PARMSW; pub const MCI_INFO_PARMS = thismodule.MCI_INFO_PARMSW; pub const MCI_SYSINFO_PARMS = thismodule.MCI_SYSINFO_PARMSW; pub const MCI_SAVE_PARMS = thismodule.MCI_SAVE_PARMSW; pub const MCI_LOAD_PARMS = thismodule.MCI_LOAD_PARMSW; pub const MCI_VD_ESCAPE_PARMS = thismodule.MCI_VD_ESCAPE_PARMSW; pub const MCI_WAVE_OPEN_PARMS = thismodule.MCI_WAVE_OPEN_PARMSW; pub const MCI_ANIM_OPEN_PARMS = thismodule.MCI_ANIM_OPEN_PARMSW; pub const MCI_ANIM_WINDOW_PARMS = thismodule.MCI_ANIM_WINDOW_PARMSW; pub const MCI_OVLY_OPEN_PARMS = thismodule.MCI_OVLY_OPEN_PARMSW; pub const MCI_OVLY_WINDOW_PARMS = thismodule.MCI_OVLY_WINDOW_PARMSW; pub const MCI_OVLY_SAVE_PARMS = thismodule.MCI_OVLY_SAVE_PARMSW; pub const MCI_OVLY_LOAD_PARMS = thismodule.MCI_OVLY_LOAD_PARMSW; pub const mciSendCommand = thismodule.mciSendCommandW; pub const mciSendString = thismodule.mciSendStringW; pub const mciGetDeviceID = thismodule.mciGetDeviceIDW; pub const mciGetDeviceIDFromElementID = thismodule.mciGetDeviceIDFromElementIDW; pub const mciGetErrorString = thismodule.mciGetErrorStringW; }, .unspecified => if (@import("builtin").is_test) struct { pub const MCI_OPEN_PARMS = *opaque{}; pub const MCI_INFO_PARMS = *opaque{}; pub const MCI_SYSINFO_PARMS = *opaque{}; pub const MCI_SAVE_PARMS = *opaque{}; pub const MCI_LOAD_PARMS = *opaque{}; pub const MCI_VD_ESCAPE_PARMS = *opaque{}; pub const MCI_WAVE_OPEN_PARMS = *opaque{}; pub const MCI_ANIM_OPEN_PARMS = *opaque{}; pub const MCI_ANIM_WINDOW_PARMS = *opaque{}; pub const MCI_OVLY_OPEN_PARMS = *opaque{}; pub const MCI_OVLY_WINDOW_PARMS = *opaque{}; pub const MCI_OVLY_SAVE_PARMS = *opaque{}; pub const MCI_OVLY_LOAD_PARMS = *opaque{}; pub const mciSendCommand = *opaque{}; pub const mciSendString = *opaque{}; pub const mciGetDeviceID = *opaque{}; pub const mciGetDeviceIDFromElementID = *opaque{}; pub const mciGetErrorString = *opaque{}; } else struct { pub const MCI_OPEN_PARMS = @compileError("'MCI_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_INFO_PARMS = @compileError("'MCI_INFO_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_SYSINFO_PARMS = @compileError("'MCI_SYSINFO_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_SAVE_PARMS = @compileError("'MCI_SAVE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_LOAD_PARMS = @compileError("'MCI_LOAD_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_VD_ESCAPE_PARMS = @compileError("'MCI_VD_ESCAPE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_WAVE_OPEN_PARMS = @compileError("'MCI_WAVE_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_ANIM_OPEN_PARMS = @compileError("'MCI_ANIM_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_ANIM_WINDOW_PARMS = @compileError("'MCI_ANIM_WINDOW_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_OPEN_PARMS = @compileError("'MCI_OVLY_OPEN_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_WINDOW_PARMS = @compileError("'MCI_OVLY_WINDOW_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_SAVE_PARMS = @compileError("'MCI_OVLY_SAVE_PARMS' requires that UNICODE be set to true or false in the root module"); pub const MCI_OVLY_LOAD_PARMS = @compileError("'MCI_OVLY_LOAD_PARMS' requires that UNICODE be set to true or false in the root module"); pub const mciSendCommand = @compileError("'mciSendCommand' requires that UNICODE be set to true or false in the root module"); pub const mciSendString = @compileError("'mciSendString' requires that UNICODE be set to true or false in the root module"); pub const mciGetDeviceID = @compileError("'mciGetDeviceID' requires that UNICODE be set to true or false in the root module"); pub const mciGetDeviceIDFromElementID = @compileError("'mciGetDeviceIDFromElementID' requires that UNICODE be set to true or false in the root module"); pub const mciGetErrorString = @compileError("'mciGetErrorString' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (24) //-------------------------------------------------------------------------------- const Guid = @import("../../zig.zig").Guid; const APO_CONNECTION_PROPERTY = @import("../../system/remote_desktop.zig").APO_CONNECTION_PROPERTY; const BOOL = @import("../../foundation.zig").BOOL; const CHAR = @import("../../system/system_services.zig").CHAR; const HANDLE = @import("../../foundation.zig").HANDLE; const HDC = @import("../../graphics/gdi.zig").HDC; const HRESULT = @import("../../foundation.zig").HRESULT; const HWND = @import("../../foundation.zig").HWND; const IPropertyStore = @import("../../system/properties_system.zig").IPropertyStore; const IUnknown = @import("../../system/com.zig").IUnknown; const KSTOPOLOGY_CONNECTION = @import("../../graphics/direct_show.zig").KSTOPOLOGY_CONNECTION; const LARGE_INTEGER = @import("../../system/system_services.zig").LARGE_INTEGER; const LPARAM = @import("../../foundation.zig").LPARAM; const LUID = @import("../../system/system_services.zig").LUID; const PROPERTYKEY = @import("../../system/properties_system.zig").PROPERTYKEY; const PROPVARIANT = @import("../../storage/structured_storage.zig").PROPVARIANT; const PSTR = @import("../../foundation.zig").PSTR; const PWSTR = @import("../../foundation.zig").PWSTR; const RECT = @import("../../foundation.zig").RECT; const SIZE = @import("../../foundation.zig").SIZE; const TIMECODE_SAMPLE = @import("../../graphics/direct_show.zig").TIMECODE_SAMPLE; const ULARGE_INTEGER = @import("../../system/system_services.zig").ULARGE_INTEGER; const WAVEFORMATEX = @import("../../media/multimedia.zig").WAVEFORMATEX; const WAVEFORMATEXTENSIBLE = @import("../../media/multimedia.zig").WAVEFORMATEXTENSIBLE; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "YIELDPROC")) { _ = YIELDPROC; } @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
deps/zigwin32/win32/media/audio/core_audio.zig
const DEFAULT_MESSAGE = "200 OK"; pub fn concatCodeWithMessage(code: u10) []const u8 { return switch (code) { 100 => "100 Continue", 101 => "101 Switching Protocols", 102 => "102 Processin", 200 => "200 OK", 201 => "201 Created", 202 => "202 Accepted", 203 => "203 Non-Authoritative Information", 204 => "204 No Content", 205 => "205 Reset Content", 206 => "206 Partial Content", 207 => "207 Multi-Status", 208 => "208 Already Reported", 226 => "226 IM Use", 300 => "300 Multiple Choices", 301 => "301 Moved Permanently", 302 => "302 Found", 303 => "303 See Other", 304 => "304 Not Modified", 305 => "305 Use Proxy", 306 => "306 Switch Proxy", 307 => "307 Temporary Redirect", 308 => "308 Permanent Redirec", 400 => "400 Bad Request", 401 => "401 Unauthorized", 402 => "402 Payment Required", 403 => "403 Forbidden", 404 => "404 Not Found", 405 => "405 Method Not Allowed", 406 => "406 Not Acceptable", 407 => "407 Proxy Authentication Required", 408 => "408 Request Timeout", 409 => "409 Conflict", 410 => "410 Gone", 411 => "411 Length Required", 412 => "412 Precondition Failed", 413 => "413 Request Entity Too Large", 414 => "414 Request-URI Too Long", 415 => "415 Unsupported Media Type", 416 => "416 Requested Range Not Satisfiable", 417 => "417 Expectation Failed", 418 => "418 I’m a teapot", 420 => "420 Enhance Your Calm", 422 => "422 Unprocessable Entity", 423 => "423 Locked", 424 => "424 Method Failure", 425 => "425 Unordered Collection", 426 => "426 Upgrade Required", 428 => "428 Precondition Required", 429 => "429 Too Many Requests", 431 => "431 Request Header Fields Too Large", 444 => "444 No Response", 449 => "449 Retry With", 450 => "450 Blocked by Windows Parental Controls", 451 => "451 Unavailable For Legal Reasons", 499 => "499 Client Closed Request", 500 => "500 Internal Server Error", 501 => "501 Not Implemented", 502 => "502 Bad Gateway", 503 => "503 Service Unavailable", 504 => "504 Gateway Timeout", 505 => "505 HTTP Version Not Supported", 506 => "506 Variant Also Negotiates", 507 => "507 Insufficient Storage", 508 => "508 Loop Detected", 509 => "509 Bandwidth Limit Exceeded", 510 => "510 Not Extended", 511 => "511 Network Authentication Required", 598 => "598 Network read timeout error", 599 => "599 Network connect timeout error", else => DEFAULT_MESSAGE, }; } pub fn totalLen(comptime T: type, arr: [][]const T) usize { var len: usize = 0; for (arr) |slice| { len += slice.len; } return len; }
util.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const gui = @import("gui"); const nvg = @import("nanovg"); const Document = @import("Document.zig"); const Rect = @import("gui/geometry.zig").Rect; const Point = @import("gui/geometry.zig").Point; const PreviewWidget = @This(); widget: gui.Widget, allocator: Allocator, document: *Document, translation: Point(f32) = Point(f32).make(0, 0), drag_offset: ?Point(f32) = null, background_image: nvg.Image, const Self = @This(); pub fn init(allocator: Allocator, rect: Rect(f32), document: *Document, vg: nvg) !*Self { var self = try allocator.create(Self); self.* = Self{ .widget = gui.Widget.init(allocator, rect), .allocator = allocator, .document = document, .background_image = vg.createImageRGBA(2, 2, .{ .repeat_x = true, .repeat_y = true, .nearest = true }, &.{ 0x66, 0x66, 0x66, 0xFF, 0x99, 0x99, 0x99, 0xFF, 0x99, 0x99, 0x99, 0xFF, 0x66, 0x66, 0x66, 0xFF, }), }; self.widget.onMouseMoveFn = onMouseMove; self.widget.onMouseDownFn = onMouseDown; self.widget.onMouseUpFn = onMouseUp; self.widget.drawFn = draw; return self; } pub fn deinit(self: *Self, vg: nvg) void { vg.deleteImage(self.background_image); self.widget.deinit(); self.allocator.destroy(self); } fn onMouseMove(widget: *gui.Widget, event: *const gui.MouseEvent) void { var self = @fieldParentPtr(Self, "widget", widget); if (self.drag_offset) |drag_offset| { self.translation = Point(f32).make(event.x, event.y).subtracted(drag_offset); } } fn onMouseDown(widget: *gui.Widget, event: *const gui.MouseEvent) void { var self = @fieldParentPtr(Self, "widget", widget); self.drag_offset = Point(f32).make(event.x, event.y).subtracted(self.translation); } fn onMouseUp(widget: *gui.Widget, event: *const gui.MouseEvent) void { _ = event; // unused var self = @fieldParentPtr(Self, "widget", widget); self.drag_offset = null; } pub fn draw(widget: *gui.Widget, vg: nvg) void { var self = @fieldParentPtr(Self, "widget", widget); const rect = widget.relative_rect; vg.save(); defer vg.restore(); vg.translate(rect.x, rect.y); gui.drawPanel(vg, 0, 0, rect.w, rect.h, 1, false, false); vg.beginPath(); vg.rect(5.5, 5.5, rect.w - 11, rect.h - 11); vg.strokeColor(nvg.rgb(66, 66, 66)); vg.stroke(); const client_w = rect.w - 12; const client_h = rect.h - 12; vg.scissor(6, 6, client_w, client_h); vg.translate(6, 6); const client_rect = Rect(f32).make(0, 0, client_w, client_h); self.drawBackground(client_rect, vg); const d_x = client_w - @intToFloat(f32, self.document.getWidth()); const d_y = client_h - @intToFloat(f32, self.document.getHeight()); self.translation.x = std.math.clamp(self.translation.x, std.math.min(0, d_x), std.math.max(0, d_x)); self.translation.y = std.math.clamp(self.translation.y, std.math.min(0, d_y), std.math.max(0, d_y)); vg.translate(self.translation.x, self.translation.y); self.document.draw(vg); if (self.document.selection) |selection| { self.drawSelection(selection, client_rect.translated(self.translation.scaled(-1)), vg); } } fn drawBackground(self: Self, rect: Rect(f32), vg: nvg) void { vg.beginPath(); vg.rect(rect.x, rect.y, rect.w, rect.h); vg.fillPaint(vg.imagePattern(0, 0, 8, 8, 0, self.background_image, 1)); vg.fill(); } fn drawSelection(self: Self, selection: Document.Selection, rect: Rect(f32), vg: nvg) void { const document_rect = Rect(f32).make(0, 0, @intToFloat(f32, self.document.getWidth()), @intToFloat(f32, self.document.getHeight())); const selection_rect = Rect(f32).make( @intToFloat(f32, selection.rect.x), @intToFloat(f32, selection.rect.y), @intToFloat(f32, selection.rect.w), @intToFloat(f32, selection.rect.h), ); const intersection = rect.intersection(document_rect.intersection(selection_rect)); vg.scissor(intersection.x, intersection.y, intersection.w, intersection.h); if (self.document.blend_mode == .replace) { self.drawBackground(selection_rect, vg); } self.document.drawSelection(vg); }
src/PreviewWidget.zig
pub const DML_TENSOR_DIMENSION_COUNT_MAX = @as(u32, 5); pub const DML_TEMPORARY_BUFFER_ALIGNMENT = @as(u32, 256); pub const DML_PERSISTENT_BUFFER_ALIGNMENT = @as(u32, 256); pub const DML_MINIMUM_BUFFER_TENSOR_ALIGNMENT = @as(u32, 16); //-------------------------------------------------------------------------------- // Section: Types (137) //-------------------------------------------------------------------------------- pub const DML_TENSOR_DATA_TYPE = enum(i32) { UNKNOWN = 0, FLOAT32 = 1, FLOAT16 = 2, UINT32 = 3, UINT16 = 4, UINT8 = 5, INT32 = 6, INT16 = 7, INT8 = 8, }; pub const DML_TENSOR_DATA_TYPE_UNKNOWN = DML_TENSOR_DATA_TYPE.UNKNOWN; pub const DML_TENSOR_DATA_TYPE_FLOAT32 = DML_TENSOR_DATA_TYPE.FLOAT32; pub const DML_TENSOR_DATA_TYPE_FLOAT16 = DML_TENSOR_DATA_TYPE.FLOAT16; pub const DML_TENSOR_DATA_TYPE_UINT32 = DML_TENSOR_DATA_TYPE.UINT32; pub const DML_TENSOR_DATA_TYPE_UINT16 = DML_TENSOR_DATA_TYPE.UINT16; pub const DML_TENSOR_DATA_TYPE_UINT8 = DML_TENSOR_DATA_TYPE.UINT8; pub const DML_TENSOR_DATA_TYPE_INT32 = DML_TENSOR_DATA_TYPE.INT32; pub const DML_TENSOR_DATA_TYPE_INT16 = DML_TENSOR_DATA_TYPE.INT16; pub const DML_TENSOR_DATA_TYPE_INT8 = DML_TENSOR_DATA_TYPE.INT8; pub const DML_TENSOR_TYPE = enum(i32) { INVALID = 0, BUFFER = 1, }; pub const DML_TENSOR_TYPE_INVALID = DML_TENSOR_TYPE.INVALID; pub const DML_TENSOR_TYPE_BUFFER = DML_TENSOR_TYPE.BUFFER; pub const DML_TENSOR_FLAGS = enum(u32) { NONE = 0, OWNED_BY_DML = 1, _, pub fn initFlags(o: struct { NONE: u1 = 0, OWNED_BY_DML: u1 = 0, }) DML_TENSOR_FLAGS { return @intToEnum(DML_TENSOR_FLAGS, (if (o.NONE == 1) @enumToInt(DML_TENSOR_FLAGS.NONE) else 0) | (if (o.OWNED_BY_DML == 1) @enumToInt(DML_TENSOR_FLAGS.OWNED_BY_DML) else 0) ); } }; pub const DML_TENSOR_FLAG_NONE = DML_TENSOR_FLAGS.NONE; pub const DML_TENSOR_FLAG_OWNED_BY_DML = DML_TENSOR_FLAGS.OWNED_BY_DML; pub const DML_BUFFER_TENSOR_DESC = extern struct { DataType: DML_TENSOR_DATA_TYPE, Flags: DML_TENSOR_FLAGS, DimensionCount: u32, Sizes: ?*const u32, Strides: ?*const u32, TotalTensorSizeInBytes: u64, GuaranteedBaseOffsetAlignment: u32, }; pub const DML_TENSOR_DESC = extern struct { Type: DML_TENSOR_TYPE, Desc: ?*const c_void, }; pub const DML_OPERATOR_TYPE = enum(i32) { INVALID = 0, ELEMENT_WISE_IDENTITY = 1, ELEMENT_WISE_ABS = 2, ELEMENT_WISE_ACOS = 3, ELEMENT_WISE_ADD = 4, ELEMENT_WISE_ASIN = 5, ELEMENT_WISE_ATAN = 6, ELEMENT_WISE_CEIL = 7, ELEMENT_WISE_CLIP = 8, ELEMENT_WISE_COS = 9, ELEMENT_WISE_DIVIDE = 10, ELEMENT_WISE_EXP = 11, ELEMENT_WISE_FLOOR = 12, ELEMENT_WISE_LOG = 13, ELEMENT_WISE_LOGICAL_AND = 14, ELEMENT_WISE_LOGICAL_EQUALS = 15, ELEMENT_WISE_LOGICAL_GREATER_THAN = 16, ELEMENT_WISE_LOGICAL_LESS_THAN = 17, ELEMENT_WISE_LOGICAL_NOT = 18, ELEMENT_WISE_LOGICAL_OR = 19, ELEMENT_WISE_LOGICAL_XOR = 20, ELEMENT_WISE_MAX = 21, ELEMENT_WISE_MEAN = 22, ELEMENT_WISE_MIN = 23, ELEMENT_WISE_MULTIPLY = 24, ELEMENT_WISE_POW = 25, ELEMENT_WISE_CONSTANT_POW = 26, ELEMENT_WISE_RECIP = 27, ELEMENT_WISE_SIN = 28, ELEMENT_WISE_SQRT = 29, ELEMENT_WISE_SUBTRACT = 30, ELEMENT_WISE_TAN = 31, ELEMENT_WISE_THRESHOLD = 32, ELEMENT_WISE_QUANTIZE_LINEAR = 33, ELEMENT_WISE_DEQUANTIZE_LINEAR = 34, ACTIVATION_ELU = 35, ACTIVATION_HARDMAX = 36, ACTIVATION_HARD_SIGMOID = 37, ACTIVATION_IDENTITY = 38, ACTIVATION_LEAKY_RELU = 39, ACTIVATION_LINEAR = 40, ACTIVATION_LOG_SOFTMAX = 41, ACTIVATION_PARAMETERIZED_RELU = 42, ACTIVATION_PARAMETRIC_SOFTPLUS = 43, ACTIVATION_RELU = 44, ACTIVATION_SCALED_ELU = 45, ACTIVATION_SCALED_TANH = 46, ACTIVATION_SIGMOID = 47, ACTIVATION_SOFTMAX = 48, ACTIVATION_SOFTPLUS = 49, ACTIVATION_SOFTSIGN = 50, ACTIVATION_TANH = 51, ACTIVATION_THRESHOLDED_RELU = 52, CONVOLUTION = 53, GEMM = 54, REDUCE = 55, AVERAGE_POOLING = 56, LP_POOLING = 57, MAX_POOLING = 58, ROI_POOLING = 59, SLICE = 60, CAST = 61, SPLIT = 62, JOIN = 63, PADDING = 64, VALUE_SCALE_2D = 65, UPSAMPLE_2D = 66, GATHER = 67, SPACE_TO_DEPTH = 68, DEPTH_TO_SPACE = 69, TILE = 70, TOP_K = 71, BATCH_NORMALIZATION = 72, MEAN_VARIANCE_NORMALIZATION = 73, LOCAL_RESPONSE_NORMALIZATION = 74, LP_NORMALIZATION = 75, RNN = 76, LSTM = 77, GRU = 78, ELEMENT_WISE_SIGN = 79, ELEMENT_WISE_IS_NAN = 80, ELEMENT_WISE_ERF = 81, ELEMENT_WISE_SINH = 82, ELEMENT_WISE_COSH = 83, ELEMENT_WISE_TANH = 84, ELEMENT_WISE_ASINH = 85, ELEMENT_WISE_ACOSH = 86, ELEMENT_WISE_ATANH = 87, ELEMENT_WISE_IF = 88, ELEMENT_WISE_ADD1 = 89, ACTIVATION_SHRINK = 90, MAX_POOLING1 = 91, MAX_UNPOOLING = 92, DIAGONAL_MATRIX = 93, SCATTER = 94, ONE_HOT = 95, RESAMPLE = 96, }; pub const DML_OPERATOR_INVALID = DML_OPERATOR_TYPE.INVALID; pub const DML_OPERATOR_ELEMENT_WISE_IDENTITY = DML_OPERATOR_TYPE.ELEMENT_WISE_IDENTITY; pub const DML_OPERATOR_ELEMENT_WISE_ABS = DML_OPERATOR_TYPE.ELEMENT_WISE_ABS; pub const DML_OPERATOR_ELEMENT_WISE_ACOS = DML_OPERATOR_TYPE.ELEMENT_WISE_ACOS; pub const DML_OPERATOR_ELEMENT_WISE_ADD = DML_OPERATOR_TYPE.ELEMENT_WISE_ADD; pub const DML_OPERATOR_ELEMENT_WISE_ASIN = DML_OPERATOR_TYPE.ELEMENT_WISE_ASIN; pub const DML_OPERATOR_ELEMENT_WISE_ATAN = DML_OPERATOR_TYPE.ELEMENT_WISE_ATAN; pub const DML_OPERATOR_ELEMENT_WISE_CEIL = DML_OPERATOR_TYPE.ELEMENT_WISE_CEIL; pub const DML_OPERATOR_ELEMENT_WISE_CLIP = DML_OPERATOR_TYPE.ELEMENT_WISE_CLIP; pub const DML_OPERATOR_ELEMENT_WISE_COS = DML_OPERATOR_TYPE.ELEMENT_WISE_COS; pub const DML_OPERATOR_ELEMENT_WISE_DIVIDE = DML_OPERATOR_TYPE.ELEMENT_WISE_DIVIDE; pub const DML_OPERATOR_ELEMENT_WISE_EXP = DML_OPERATOR_TYPE.ELEMENT_WISE_EXP; pub const DML_OPERATOR_ELEMENT_WISE_FLOOR = DML_OPERATOR_TYPE.ELEMENT_WISE_FLOOR; pub const DML_OPERATOR_ELEMENT_WISE_LOG = DML_OPERATOR_TYPE.ELEMENT_WISE_LOG; pub const DML_OPERATOR_ELEMENT_WISE_LOGICAL_AND = DML_OPERATOR_TYPE.ELEMENT_WISE_LOGICAL_AND; pub const DML_OPERATOR_ELEMENT_WISE_LOGICAL_EQUALS = DML_OPERATOR_TYPE.ELEMENT_WISE_LOGICAL_EQUALS; pub const DML_OPERATOR_ELEMENT_WISE_LOGICAL_GREATER_THAN = DML_OPERATOR_TYPE.ELEMENT_WISE_LOGICAL_GREATER_THAN; pub const DML_OPERATOR_ELEMENT_WISE_LOGICAL_LESS_THAN = DML_OPERATOR_TYPE.ELEMENT_WISE_LOGICAL_LESS_THAN; pub const DML_OPERATOR_ELEMENT_WISE_LOGICAL_NOT = DML_OPERATOR_TYPE.ELEMENT_WISE_LOGICAL_NOT; pub const DML_OPERATOR_ELEMENT_WISE_LOGICAL_OR = DML_OPERATOR_TYPE.ELEMENT_WISE_LOGICAL_OR; pub const DML_OPERATOR_ELEMENT_WISE_LOGICAL_XOR = DML_OPERATOR_TYPE.ELEMENT_WISE_LOGICAL_XOR; pub const DML_OPERATOR_ELEMENT_WISE_MAX = DML_OPERATOR_TYPE.ELEMENT_WISE_MAX; pub const DML_OPERATOR_ELEMENT_WISE_MEAN = DML_OPERATOR_TYPE.ELEMENT_WISE_MEAN; pub const DML_OPERATOR_ELEMENT_WISE_MIN = DML_OPERATOR_TYPE.ELEMENT_WISE_MIN; pub const DML_OPERATOR_ELEMENT_WISE_MULTIPLY = DML_OPERATOR_TYPE.ELEMENT_WISE_MULTIPLY; pub const DML_OPERATOR_ELEMENT_WISE_POW = DML_OPERATOR_TYPE.ELEMENT_WISE_POW; pub const DML_OPERATOR_ELEMENT_WISE_CONSTANT_POW = DML_OPERATOR_TYPE.ELEMENT_WISE_CONSTANT_POW; pub const DML_OPERATOR_ELEMENT_WISE_RECIP = DML_OPERATOR_TYPE.ELEMENT_WISE_RECIP; pub const DML_OPERATOR_ELEMENT_WISE_SIN = DML_OPERATOR_TYPE.ELEMENT_WISE_SIN; pub const DML_OPERATOR_ELEMENT_WISE_SQRT = DML_OPERATOR_TYPE.ELEMENT_WISE_SQRT; pub const DML_OPERATOR_ELEMENT_WISE_SUBTRACT = DML_OPERATOR_TYPE.ELEMENT_WISE_SUBTRACT; pub const DML_OPERATOR_ELEMENT_WISE_TAN = DML_OPERATOR_TYPE.ELEMENT_WISE_TAN; pub const DML_OPERATOR_ELEMENT_WISE_THRESHOLD = DML_OPERATOR_TYPE.ELEMENT_WISE_THRESHOLD; pub const DML_OPERATOR_ELEMENT_WISE_QUANTIZE_LINEAR = DML_OPERATOR_TYPE.ELEMENT_WISE_QUANTIZE_LINEAR; pub const DML_OPERATOR_ELEMENT_WISE_DEQUANTIZE_LINEAR = DML_OPERATOR_TYPE.ELEMENT_WISE_DEQUANTIZE_LINEAR; pub const DML_OPERATOR_ACTIVATION_ELU = DML_OPERATOR_TYPE.ACTIVATION_ELU; pub const DML_OPERATOR_ACTIVATION_HARDMAX = DML_OPERATOR_TYPE.ACTIVATION_HARDMAX; pub const DML_OPERATOR_ACTIVATION_HARD_SIGMOID = DML_OPERATOR_TYPE.ACTIVATION_HARD_SIGMOID; pub const DML_OPERATOR_ACTIVATION_IDENTITY = DML_OPERATOR_TYPE.ACTIVATION_IDENTITY; pub const DML_OPERATOR_ACTIVATION_LEAKY_RELU = DML_OPERATOR_TYPE.ACTIVATION_LEAKY_RELU; pub const DML_OPERATOR_ACTIVATION_LINEAR = DML_OPERATOR_TYPE.ACTIVATION_LINEAR; pub const DML_OPERATOR_ACTIVATION_LOG_SOFTMAX = DML_OPERATOR_TYPE.ACTIVATION_LOG_SOFTMAX; pub const DML_OPERATOR_ACTIVATION_PARAMETERIZED_RELU = DML_OPERATOR_TYPE.ACTIVATION_PARAMETERIZED_RELU; pub const DML_OPERATOR_ACTIVATION_PARAMETRIC_SOFTPLUS = DML_OPERATOR_TYPE.ACTIVATION_PARAMETRIC_SOFTPLUS; pub const DML_OPERATOR_ACTIVATION_RELU = DML_OPERATOR_TYPE.ACTIVATION_RELU; pub const DML_OPERATOR_ACTIVATION_SCALED_ELU = DML_OPERATOR_TYPE.ACTIVATION_SCALED_ELU; pub const DML_OPERATOR_ACTIVATION_SCALED_TANH = DML_OPERATOR_TYPE.ACTIVATION_SCALED_TANH; pub const DML_OPERATOR_ACTIVATION_SIGMOID = DML_OPERATOR_TYPE.ACTIVATION_SIGMOID; pub const DML_OPERATOR_ACTIVATION_SOFTMAX = DML_OPERATOR_TYPE.ACTIVATION_SOFTMAX; pub const DML_OPERATOR_ACTIVATION_SOFTPLUS = DML_OPERATOR_TYPE.ACTIVATION_SOFTPLUS; pub const DML_OPERATOR_ACTIVATION_SOFTSIGN = DML_OPERATOR_TYPE.ACTIVATION_SOFTSIGN; pub const DML_OPERATOR_ACTIVATION_TANH = DML_OPERATOR_TYPE.ACTIVATION_TANH; pub const DML_OPERATOR_ACTIVATION_THRESHOLDED_RELU = DML_OPERATOR_TYPE.ACTIVATION_THRESHOLDED_RELU; pub const DML_OPERATOR_CONVOLUTION = DML_OPERATOR_TYPE.CONVOLUTION; pub const DML_OPERATOR_GEMM = DML_OPERATOR_TYPE.GEMM; pub const DML_OPERATOR_REDUCE = DML_OPERATOR_TYPE.REDUCE; pub const DML_OPERATOR_AVERAGE_POOLING = DML_OPERATOR_TYPE.AVERAGE_POOLING; pub const DML_OPERATOR_LP_POOLING = DML_OPERATOR_TYPE.LP_POOLING; pub const DML_OPERATOR_MAX_POOLING = DML_OPERATOR_TYPE.MAX_POOLING; pub const DML_OPERATOR_ROI_POOLING = DML_OPERATOR_TYPE.ROI_POOLING; pub const DML_OPERATOR_SLICE = DML_OPERATOR_TYPE.SLICE; pub const DML_OPERATOR_CAST = DML_OPERATOR_TYPE.CAST; pub const DML_OPERATOR_SPLIT = DML_OPERATOR_TYPE.SPLIT; pub const DML_OPERATOR_JOIN = DML_OPERATOR_TYPE.JOIN; pub const DML_OPERATOR_PADDING = DML_OPERATOR_TYPE.PADDING; pub const DML_OPERATOR_VALUE_SCALE_2D = DML_OPERATOR_TYPE.VALUE_SCALE_2D; pub const DML_OPERATOR_UPSAMPLE_2D = DML_OPERATOR_TYPE.UPSAMPLE_2D; pub const DML_OPERATOR_GATHER = DML_OPERATOR_TYPE.GATHER; pub const DML_OPERATOR_SPACE_TO_DEPTH = DML_OPERATOR_TYPE.SPACE_TO_DEPTH; pub const DML_OPERATOR_DEPTH_TO_SPACE = DML_OPERATOR_TYPE.DEPTH_TO_SPACE; pub const DML_OPERATOR_TILE = DML_OPERATOR_TYPE.TILE; pub const DML_OPERATOR_TOP_K = DML_OPERATOR_TYPE.TOP_K; pub const DML_OPERATOR_BATCH_NORMALIZATION = DML_OPERATOR_TYPE.BATCH_NORMALIZATION; pub const DML_OPERATOR_MEAN_VARIANCE_NORMALIZATION = DML_OPERATOR_TYPE.MEAN_VARIANCE_NORMALIZATION; pub const DML_OPERATOR_LOCAL_RESPONSE_NORMALIZATION = DML_OPERATOR_TYPE.LOCAL_RESPONSE_NORMALIZATION; pub const DML_OPERATOR_LP_NORMALIZATION = DML_OPERATOR_TYPE.LP_NORMALIZATION; pub const DML_OPERATOR_RNN = DML_OPERATOR_TYPE.RNN; pub const DML_OPERATOR_LSTM = DML_OPERATOR_TYPE.LSTM; pub const DML_OPERATOR_GRU = DML_OPERATOR_TYPE.GRU; pub const DML_OPERATOR_ELEMENT_WISE_SIGN = DML_OPERATOR_TYPE.ELEMENT_WISE_SIGN; pub const DML_OPERATOR_ELEMENT_WISE_IS_NAN = DML_OPERATOR_TYPE.ELEMENT_WISE_IS_NAN; pub const DML_OPERATOR_ELEMENT_WISE_ERF = DML_OPERATOR_TYPE.ELEMENT_WISE_ERF; pub const DML_OPERATOR_ELEMENT_WISE_SINH = DML_OPERATOR_TYPE.ELEMENT_WISE_SINH; pub const DML_OPERATOR_ELEMENT_WISE_COSH = DML_OPERATOR_TYPE.ELEMENT_WISE_COSH; pub const DML_OPERATOR_ELEMENT_WISE_TANH = DML_OPERATOR_TYPE.ELEMENT_WISE_TANH; pub const DML_OPERATOR_ELEMENT_WISE_ASINH = DML_OPERATOR_TYPE.ELEMENT_WISE_ASINH; pub const DML_OPERATOR_ELEMENT_WISE_ACOSH = DML_OPERATOR_TYPE.ELEMENT_WISE_ACOSH; pub const DML_OPERATOR_ELEMENT_WISE_ATANH = DML_OPERATOR_TYPE.ELEMENT_WISE_ATANH; pub const DML_OPERATOR_ELEMENT_WISE_IF = DML_OPERATOR_TYPE.ELEMENT_WISE_IF; pub const DML_OPERATOR_ELEMENT_WISE_ADD1 = DML_OPERATOR_TYPE.ELEMENT_WISE_ADD1; pub const DML_OPERATOR_ACTIVATION_SHRINK = DML_OPERATOR_TYPE.ACTIVATION_SHRINK; pub const DML_OPERATOR_MAX_POOLING1 = DML_OPERATOR_TYPE.MAX_POOLING1; pub const DML_OPERATOR_MAX_UNPOOLING = DML_OPERATOR_TYPE.MAX_UNPOOLING; pub const DML_OPERATOR_DIAGONAL_MATRIX = DML_OPERATOR_TYPE.DIAGONAL_MATRIX; pub const DML_OPERATOR_SCATTER = DML_OPERATOR_TYPE.SCATTER; pub const DML_OPERATOR_ONE_HOT = DML_OPERATOR_TYPE.ONE_HOT; pub const DML_OPERATOR_RESAMPLE = DML_OPERATOR_TYPE.RESAMPLE; pub const DML_REDUCE_FUNCTION = enum(i32) { ARGMAX = 0, ARGMIN = 1, AVERAGE = 2, L1 = 3, L2 = 4, LOG_SUM = 5, LOG_SUM_EXP = 6, MAX = 7, MIN = 8, MULTIPLY = 9, SUM = 10, SUM_SQUARE = 11, }; pub const DML_REDUCE_FUNCTION_ARGMAX = DML_REDUCE_FUNCTION.ARGMAX; pub const DML_REDUCE_FUNCTION_ARGMIN = DML_REDUCE_FUNCTION.ARGMIN; pub const DML_REDUCE_FUNCTION_AVERAGE = DML_REDUCE_FUNCTION.AVERAGE; pub const DML_REDUCE_FUNCTION_L1 = DML_REDUCE_FUNCTION.L1; pub const DML_REDUCE_FUNCTION_L2 = DML_REDUCE_FUNCTION.L2; pub const DML_REDUCE_FUNCTION_LOG_SUM = DML_REDUCE_FUNCTION.LOG_SUM; pub const DML_REDUCE_FUNCTION_LOG_SUM_EXP = DML_REDUCE_FUNCTION.LOG_SUM_EXP; pub const DML_REDUCE_FUNCTION_MAX = DML_REDUCE_FUNCTION.MAX; pub const DML_REDUCE_FUNCTION_MIN = DML_REDUCE_FUNCTION.MIN; pub const DML_REDUCE_FUNCTION_MULTIPLY = DML_REDUCE_FUNCTION.MULTIPLY; pub const DML_REDUCE_FUNCTION_SUM = DML_REDUCE_FUNCTION.SUM; pub const DML_REDUCE_FUNCTION_SUM_SQUARE = DML_REDUCE_FUNCTION.SUM_SQUARE; pub const DML_MATRIX_TRANSFORM = enum(i32) { NONE = 0, TRANSPOSE = 1, }; pub const DML_MATRIX_TRANSFORM_NONE = DML_MATRIX_TRANSFORM.NONE; pub const DML_MATRIX_TRANSFORM_TRANSPOSE = DML_MATRIX_TRANSFORM.TRANSPOSE; pub const DML_CONVOLUTION_MODE = enum(i32) { ONVOLUTION = 0, ROSS_CORRELATION = 1, }; pub const DML_CONVOLUTION_MODE_CONVOLUTION = DML_CONVOLUTION_MODE.ONVOLUTION; pub const DML_CONVOLUTION_MODE_CROSS_CORRELATION = DML_CONVOLUTION_MODE.ROSS_CORRELATION; pub const DML_CONVOLUTION_DIRECTION = enum(i32) { FORWARD = 0, BACKWARD = 1, }; pub const DML_CONVOLUTION_DIRECTION_FORWARD = DML_CONVOLUTION_DIRECTION.FORWARD; pub const DML_CONVOLUTION_DIRECTION_BACKWARD = DML_CONVOLUTION_DIRECTION.BACKWARD; pub const DML_PADDING_MODE = enum(i32) { CONSTANT = 0, EDGE = 1, REFLECTION = 2, }; pub const DML_PADDING_MODE_CONSTANT = DML_PADDING_MODE.CONSTANT; pub const DML_PADDING_MODE_EDGE = DML_PADDING_MODE.EDGE; pub const DML_PADDING_MODE_REFLECTION = DML_PADDING_MODE.REFLECTION; pub const DML_INTERPOLATION_MODE = enum(i32) { NEAREST_NEIGHBOR = 0, LINEAR = 1, }; pub const DML_INTERPOLATION_MODE_NEAREST_NEIGHBOR = DML_INTERPOLATION_MODE.NEAREST_NEIGHBOR; pub const DML_INTERPOLATION_MODE_LINEAR = DML_INTERPOLATION_MODE.LINEAR; pub const DML_SCALE_BIAS = extern struct { Scale: f32, Bias: f32, }; pub const DML_SIZE_2D = extern struct { Width: u32, Height: u32, }; pub const DML_RECURRENT_NETWORK_DIRECTION = enum(i32) { FORWARD = 0, BACKWARD = 1, BIDIRECTIONAL = 2, }; pub const DML_RECURRENT_NETWORK_DIRECTION_FORWARD = DML_RECURRENT_NETWORK_DIRECTION.FORWARD; pub const DML_RECURRENT_NETWORK_DIRECTION_BACKWARD = DML_RECURRENT_NETWORK_DIRECTION.BACKWARD; pub const DML_RECURRENT_NETWORK_DIRECTION_BIDIRECTIONAL = DML_RECURRENT_NETWORK_DIRECTION.BIDIRECTIONAL; pub const DML_OPERATOR_DESC = extern struct { Type: DML_OPERATOR_TYPE, Desc: ?*const c_void, }; pub const DML_ELEMENT_WISE_IDENTITY_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_ABS_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_ACOS_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_ADD_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_ADD1_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, FusedActivation: ?*const DML_OPERATOR_DESC, }; pub const DML_ELEMENT_WISE_ASIN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_ATAN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_CEIL_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_CLIP_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, Min: f32, Max: f32, }; pub const DML_ELEMENT_WISE_COS_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_DIVIDE_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_EXP_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_FLOOR_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_LOG_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_LOGICAL_AND_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_LOGICAL_EQUALS_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_LOGICAL_GREATER_THAN_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_LOGICAL_LESS_THAN_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_LOGICAL_NOT_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_LOGICAL_OR_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_LOGICAL_XOR_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_MAX_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_MEAN_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_MIN_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_MULTIPLY_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_POW_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, ExponentTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_CONSTANT_POW_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, Exponent: f32, }; pub const DML_ELEMENT_WISE_RECIP_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_SIN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_SQRT_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_SUBTRACT_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_TAN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_THRESHOLD_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, Min: f32, }; pub const DML_ELEMENT_WISE_QUANTIZE_LINEAR_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, ScaleTensor: ?*const DML_TENSOR_DESC, ZeroPointTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_DEQUANTIZE_LINEAR_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, ScaleTensor: ?*const DML_TENSOR_DESC, ZeroPointTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_ELU_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, }; pub const DML_ACTIVATION_HARDMAX_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_HARD_SIGMOID_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, Beta: f32, }; pub const DML_ACTIVATION_IDENTITY_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_LEAKY_RELU_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, }; pub const DML_ACTIVATION_LINEAR_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, Beta: f32, }; pub const DML_ACTIVATION_LOG_SOFTMAX_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_PARAMETERIZED_RELU_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, SlopeTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_PARAMETRIC_SOFTPLUS_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, Beta: f32, }; pub const DML_ACTIVATION_RELU_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_SCALED_ELU_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, Gamma: f32, }; pub const DML_ACTIVATION_SCALED_TANH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, Beta: f32, }; pub const DML_ACTIVATION_SIGMOID_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_SOFTMAX_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_SOFTPLUS_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Steepness: f32, }; pub const DML_ACTIVATION_SOFTSIGN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_TANH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_THRESHOLDED_RELU_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Alpha: f32, }; pub const DML_CONVOLUTION_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, FilterTensor: ?*const DML_TENSOR_DESC, BiasTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Mode: DML_CONVOLUTION_MODE, Direction: DML_CONVOLUTION_DIRECTION, DimensionCount: u32, Strides: ?*const u32, Dilations: ?*const u32, StartPadding: ?*const u32, EndPadding: ?*const u32, OutputPadding: ?*const u32, GroupCount: u32, FusedActivation: ?*const DML_OPERATOR_DESC, }; pub const DML_GEMM_OPERATOR_DESC = extern struct { ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, CTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, TransA: DML_MATRIX_TRANSFORM, TransB: DML_MATRIX_TRANSFORM, Alpha: f32, Beta: f32, FusedActivation: ?*const DML_OPERATOR_DESC, }; pub const DML_REDUCE_OPERATOR_DESC = extern struct { Function: DML_REDUCE_FUNCTION, InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, AxisCount: u32, Axes: ?*const u32, }; pub const DML_AVERAGE_POOLING_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, DimensionCount: u32, Strides: ?*const u32, WindowSize: ?*const u32, StartPadding: ?*const u32, EndPadding: ?*const u32, IncludePadding: BOOL, }; pub const DML_LP_POOLING_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, DimensionCount: u32, Strides: ?*const u32, WindowSize: ?*const u32, StartPadding: ?*const u32, EndPadding: ?*const u32, P: u32, }; pub const DML_MAX_POOLING_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, DimensionCount: u32, Strides: ?*const u32, WindowSize: ?*const u32, StartPadding: ?*const u32, EndPadding: ?*const u32, }; pub const DML_MAX_POOLING1_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, OutputIndicesTensor: ?*const DML_TENSOR_DESC, DimensionCount: u32, Strides: ?*const u32, WindowSize: ?*const u32, StartPadding: ?*const u32, EndPadding: ?*const u32, }; pub const DML_ROI_POOLING_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, ROITensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, SpatialScale: f32, PooledSize: DML_SIZE_2D, }; pub const DML_SLICE_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, DimensionCount: u32, Offsets: ?*const u32, Sizes: ?*const u32, Strides: ?*const u32, }; pub const DML_CAST_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_SPLIT_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputCount: u32, OutputTensors: ?*const DML_TENSOR_DESC, Axis: u32, }; pub const DML_JOIN_OPERATOR_DESC = extern struct { InputCount: u32, InputTensors: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Axis: u32, }; pub const DML_PADDING_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, PaddingMode: DML_PADDING_MODE, PaddingValue: f32, DimensionCount: u32, StartPadding: ?*const u32, EndPadding: ?*const u32, }; pub const DML_VALUE_SCALE_2D_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Scale: f32, ChannelCount: u32, Bias: ?*const f32, }; pub const DML_UPSAMPLE_2D_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleSize: DML_SIZE_2D, InterpolationMode: DML_INTERPOLATION_MODE, }; pub const DML_GATHER_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, IndicesTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Axis: u32, IndexDimensions: u32, }; pub const DML_SPACE_TO_DEPTH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, BlockSize: u32, }; pub const DML_DEPTH_TO_SPACE_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, BlockSize: u32, }; pub const DML_TILE_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, RepeatsCount: u32, Repeats: ?*const u32, }; pub const DML_TOP_K_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputValueTensor: ?*const DML_TENSOR_DESC, OutputIndexTensor: ?*const DML_TENSOR_DESC, Axis: u32, K: u32, }; pub const DML_BATCH_NORMALIZATION_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, MeanTensor: ?*const DML_TENSOR_DESC, VarianceTensor: ?*const DML_TENSOR_DESC, ScaleTensor: ?*const DML_TENSOR_DESC, BiasTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Spatial: BOOL, Epsilon: f32, FusedActivation: ?*const DML_OPERATOR_DESC, }; pub const DML_MEAN_VARIANCE_NORMALIZATION_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, ScaleTensor: ?*const DML_TENSOR_DESC, BiasTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, CrossChannel: BOOL, NormalizeVariance: BOOL, Epsilon: f32, FusedActivation: ?*const DML_OPERATOR_DESC, }; pub const DML_LOCAL_RESPONSE_NORMALIZATION_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, CrossChannel: BOOL, LocalSize: u32, Alpha: f32, Beta: f32, Bias: f32, }; pub const DML_LP_NORMALIZATION_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Axis: u32, Epsilon: f32, P: u32, }; pub const DML_RNN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, WeightTensor: ?*const DML_TENSOR_DESC, RecurrenceTensor: ?*const DML_TENSOR_DESC, BiasTensor: ?*const DML_TENSOR_DESC, HiddenInitTensor: ?*const DML_TENSOR_DESC, SequenceLengthsTensor: ?*const DML_TENSOR_DESC, OutputSequenceTensor: ?*const DML_TENSOR_DESC, OutputSingleTensor: ?*const DML_TENSOR_DESC, ActivationDescCount: u32, ActivationDescs: ?*const DML_OPERATOR_DESC, Direction: DML_RECURRENT_NETWORK_DIRECTION, }; pub const DML_LSTM_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, WeightTensor: ?*const DML_TENSOR_DESC, RecurrenceTensor: ?*const DML_TENSOR_DESC, BiasTensor: ?*const DML_TENSOR_DESC, HiddenInitTensor: ?*const DML_TENSOR_DESC, CellMemInitTensor: ?*const DML_TENSOR_DESC, SequenceLengthsTensor: ?*const DML_TENSOR_DESC, PeepholeTensor: ?*const DML_TENSOR_DESC, OutputSequenceTensor: ?*const DML_TENSOR_DESC, OutputSingleTensor: ?*const DML_TENSOR_DESC, OutputCellSingleTensor: ?*const DML_TENSOR_DESC, ActivationDescCount: u32, ActivationDescs: ?*const DML_OPERATOR_DESC, Direction: DML_RECURRENT_NETWORK_DIRECTION, ClipThreshold: f32, UseClipThreshold: BOOL, CoupleInputForget: BOOL, }; pub const DML_GRU_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, WeightTensor: ?*const DML_TENSOR_DESC, RecurrenceTensor: ?*const DML_TENSOR_DESC, BiasTensor: ?*const DML_TENSOR_DESC, HiddenInitTensor: ?*const DML_TENSOR_DESC, SequenceLengthsTensor: ?*const DML_TENSOR_DESC, OutputSequenceTensor: ?*const DML_TENSOR_DESC, OutputSingleTensor: ?*const DML_TENSOR_DESC, ActivationDescCount: u32, ActivationDescs: ?*const DML_OPERATOR_DESC, Direction: DML_RECURRENT_NETWORK_DIRECTION, LinearBeforeReset: BOOL, }; pub const DML_ELEMENT_WISE_SIGN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_IS_NAN_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ELEMENT_WISE_ERF_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_SINH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_COSH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_TANH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_ASINH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_ACOSH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_ATANH_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, ScaleBias: ?*const DML_SCALE_BIAS, }; pub const DML_ELEMENT_WISE_IF_OPERATOR_DESC = extern struct { ConditionTensor: ?*const DML_TENSOR_DESC, ATensor: ?*const DML_TENSOR_DESC, BTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_ACTIVATION_SHRINK_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Bias: f32, Threshold: f32, }; pub const DML_MAX_UNPOOLING_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, IndicesTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, }; pub const DML_DIAGONAL_MATRIX_OPERATOR_DESC = extern struct { OutputTensor: ?*const DML_TENSOR_DESC, Offset: i32, Value: f32, }; pub const DML_SCATTER_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, IndicesTensor: ?*const DML_TENSOR_DESC, UpdatesTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Axis: u32, }; pub const DML_ONE_HOT_OPERATOR_DESC = extern struct { IndicesTensor: ?*const DML_TENSOR_DESC, ValuesTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, Axis: u32, }; pub const DML_RESAMPLE_OPERATOR_DESC = extern struct { InputTensor: ?*const DML_TENSOR_DESC, OutputTensor: ?*const DML_TENSOR_DESC, InterpolationMode: DML_INTERPOLATION_MODE, ScaleCount: u32, Scales: ?*const f32, }; pub const DML_FEATURE_LEVEL = enum(i32) { @"1_0" = 4096, @"2_0" = 8192, }; pub const DML_FEATURE_LEVEL_1_0 = DML_FEATURE_LEVEL.@"1_0"; pub const DML_FEATURE_LEVEL_2_0 = DML_FEATURE_LEVEL.@"2_0"; pub const DML_FEATURE = enum(i32) { TENSOR_DATA_TYPE_SUPPORT = 0, FEATURE_LEVELS = 1, }; pub const DML_FEATURE_TENSOR_DATA_TYPE_SUPPORT = DML_FEATURE.TENSOR_DATA_TYPE_SUPPORT; pub const DML_FEATURE_FEATURE_LEVELS = DML_FEATURE.FEATURE_LEVELS; pub const DML_FEATURE_QUERY_TENSOR_DATA_TYPE_SUPPORT = extern struct { DataType: DML_TENSOR_DATA_TYPE, }; pub const DML_FEATURE_DATA_TENSOR_DATA_TYPE_SUPPORT = extern struct { IsSupported: BOOL, }; pub const DML_FEATURE_QUERY_FEATURE_LEVELS = extern struct { RequestedFeatureLevelCount: u32, RequestedFeatureLevels: ?*const DML_FEATURE_LEVEL, }; pub const DML_FEATURE_DATA_FEATURE_LEVELS = extern struct { MaxSupportedFeatureLevel: DML_FEATURE_LEVEL, }; pub const DML_BINDING_TABLE_DESC = extern struct { Dispatchable: ?*IDMLDispatchable, CPUDescriptorHandle: D3D12_CPU_DESCRIPTOR_HANDLE, GPUDescriptorHandle: D3D12_GPU_DESCRIPTOR_HANDLE, SizeInDescriptors: u32, }; pub const DML_EXECUTION_FLAGS = enum(u32) { NONE = 0, ALLOW_HALF_PRECISION_COMPUTATION = 1, DISABLE_META_COMMANDS = 2, DESCRIPTORS_VOLATILE = 4, _, pub fn initFlags(o: struct { NONE: u1 = 0, ALLOW_HALF_PRECISION_COMPUTATION: u1 = 0, DISABLE_META_COMMANDS: u1 = 0, DESCRIPTORS_VOLATILE: u1 = 0, }) DML_EXECUTION_FLAGS { return @intToEnum(DML_EXECUTION_FLAGS, (if (o.NONE == 1) @enumToInt(DML_EXECUTION_FLAGS.NONE) else 0) | (if (o.ALLOW_HALF_PRECISION_COMPUTATION == 1) @enumToInt(DML_EXECUTION_FLAGS.ALLOW_HALF_PRECISION_COMPUTATION) else 0) | (if (o.DISABLE_META_COMMANDS == 1) @enumToInt(DML_EXECUTION_FLAGS.DISABLE_META_COMMANDS) else 0) | (if (o.DESCRIPTORS_VOLATILE == 1) @enumToInt(DML_EXECUTION_FLAGS.DESCRIPTORS_VOLATILE) else 0) ); } }; pub const DML_EXECUTION_FLAG_NONE = DML_EXECUTION_FLAGS.NONE; pub const DML_EXECUTION_FLAG_ALLOW_HALF_PRECISION_COMPUTATION = DML_EXECUTION_FLAGS.ALLOW_HALF_PRECISION_COMPUTATION; pub const DML_EXECUTION_FLAG_DISABLE_META_COMMANDS = DML_EXECUTION_FLAGS.DISABLE_META_COMMANDS; pub const DML_EXECUTION_FLAG_DESCRIPTORS_VOLATILE = DML_EXECUTION_FLAGS.DESCRIPTORS_VOLATILE; pub const DML_CREATE_DEVICE_FLAGS = enum(u32) { NONE = 0, DEBUG = 1, _, pub fn initFlags(o: struct { NONE: u1 = 0, DEBUG: u1 = 0, }) DML_CREATE_DEVICE_FLAGS { return @intToEnum(DML_CREATE_DEVICE_FLAGS, (if (o.NONE == 1) @enumToInt(DML_CREATE_DEVICE_FLAGS.NONE) else 0) | (if (o.DEBUG == 1) @enumToInt(DML_CREATE_DEVICE_FLAGS.DEBUG) else 0) ); } }; pub const DML_CREATE_DEVICE_FLAG_NONE = DML_CREATE_DEVICE_FLAGS.NONE; pub const DML_CREATE_DEVICE_FLAG_DEBUG = DML_CREATE_DEVICE_FLAGS.DEBUG; const IID_IDMLObject_Value = @import("../../zig.zig").Guid.initString("c8263aac-9e0c-4a2d-9b8e-007521a3317c"); pub const IID_IDMLObject = &IID_IDMLObject_Value; pub const IDMLObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPrivateData: fn( self: *const IDMLObject, guid: ?*const Guid, dataSize: ?*u32, // TODO: what to do with BytesParamIndex 1? data: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPrivateData: fn( self: *const IDMLObject, guid: ?*const Guid, dataSize: u32, // TODO: what to do with BytesParamIndex 1? data: ?*const c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPrivateDataInterface: fn( self: *const IDMLObject, guid: ?*const Guid, data: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetName: fn( self: *const IDMLObject, name: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLObject_GetPrivateData(self: *const T, guid: ?*const Guid, dataSize: ?*u32, data: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLObject.VTable, self.vtable).GetPrivateData(@ptrCast(*const IDMLObject, self), guid, dataSize, data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLObject_SetPrivateData(self: *const T, guid: ?*const Guid, dataSize: u32, data: ?*const c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLObject.VTable, self.vtable).SetPrivateData(@ptrCast(*const IDMLObject, self), guid, dataSize, data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLObject_SetPrivateDataInterface(self: *const T, guid: ?*const Guid, data: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLObject.VTable, self.vtable).SetPrivateDataInterface(@ptrCast(*const IDMLObject, self), guid, data); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLObject_SetName(self: *const T, name: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLObject.VTable, self.vtable).SetName(@ptrCast(*const IDMLObject, self), name); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLDevice_Value = @import("../../zig.zig").Guid.initString("6dbd6437-96fd-423f-a98c-ae5e7c2a573f"); pub const IID_IDMLDevice = &IID_IDMLDevice_Value; pub const IDMLDevice = extern struct { pub const VTable = extern struct { base: IDMLObject.VTable, CheckFeatureSupport: fn( self: *const IDMLDevice, feature: DML_FEATURE, featureQueryDataSize: u32, // TODO: what to do with BytesParamIndex 1? featureQueryData: ?*const c_void, featureSupportDataSize: u32, // TODO: what to do with BytesParamIndex 3? featureSupportData: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateOperator: fn( self: *const IDMLDevice, desc: ?*const DML_OPERATOR_DESC, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CompileOperator: fn( self: *const IDMLDevice, op: ?*IDMLOperator, flags: DML_EXECUTION_FLAGS, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateOperatorInitializer: fn( self: *const IDMLDevice, operatorCount: u32, operators: ?[*]?*IDMLCompiledOperator, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateCommandRecorder: fn( self: *const IDMLDevice, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBindingTable: fn( self: *const IDMLDevice, desc: ?*const DML_BINDING_TABLE_DESC, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Evict: fn( self: *const IDMLDevice, count: u32, ppObjects: [*]?*IDMLPageable, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MakeResident: fn( self: *const IDMLDevice, count: u32, ppObjects: [*]?*IDMLPageable, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceRemovedReason: fn( self: *const IDMLDevice, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParentDevice: fn( self: *const IDMLDevice, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLObject.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_CheckFeatureSupport(self: *const T, feature: DML_FEATURE, featureQueryDataSize: u32, featureQueryData: ?*const c_void, featureSupportDataSize: u32, featureSupportData: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).CheckFeatureSupport(@ptrCast(*const IDMLDevice, self), feature, featureQueryDataSize, featureQueryData, featureSupportDataSize, featureSupportData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_CreateOperator(self: *const T, desc: ?*const DML_OPERATOR_DESC, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).CreateOperator(@ptrCast(*const IDMLDevice, self), desc, riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_CompileOperator(self: *const T, op: ?*IDMLOperator, flags: DML_EXECUTION_FLAGS, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).CompileOperator(@ptrCast(*const IDMLDevice, self), op, flags, riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_CreateOperatorInitializer(self: *const T, operatorCount: u32, operators: ?[*]?*IDMLCompiledOperator, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).CreateOperatorInitializer(@ptrCast(*const IDMLDevice, self), operatorCount, operators, riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_CreateCommandRecorder(self: *const T, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).CreateCommandRecorder(@ptrCast(*const IDMLDevice, self), riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_CreateBindingTable(self: *const T, desc: ?*const DML_BINDING_TABLE_DESC, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).CreateBindingTable(@ptrCast(*const IDMLDevice, self), desc, riid, ppv); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_Evict(self: *const T, count: u32, ppObjects: [*]?*IDMLPageable) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).Evict(@ptrCast(*const IDMLDevice, self), count, ppObjects); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_MakeResident(self: *const T, count: u32, ppObjects: [*]?*IDMLPageable) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).MakeResident(@ptrCast(*const IDMLDevice, self), count, ppObjects); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_GetDeviceRemovedReason(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).GetDeviceRemovedReason(@ptrCast(*const IDMLDevice, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDevice_GetParentDevice(self: *const T, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDevice.VTable, self.vtable).GetParentDevice(@ptrCast(*const IDMLDevice, self), riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLDeviceChild_Value = @import("../../zig.zig").Guid.initString("27e83142-8165-49e3-974e-2fd66e4cb69d"); pub const IID_IDMLDeviceChild = &IID_IDMLDeviceChild_Value; pub const IDMLDeviceChild = extern struct { pub const VTable = extern struct { base: IDMLObject.VTable, GetDevice: fn( self: *const IDMLDeviceChild, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLObject.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDeviceChild_GetDevice(self: *const T, riid: ?*const Guid, ppv: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLDeviceChild.VTable, self.vtable).GetDevice(@ptrCast(*const IDMLDeviceChild, self), riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLPageable_Value = @import("../../zig.zig").Guid.initString("b1ab0825-4542-4a4b-8617-6dde6e8f6201"); pub const IID_IDMLPageable = &IID_IDMLPageable_Value; pub const IDMLPageable = extern struct { pub const VTable = extern struct { base: IDMLDeviceChild.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLDeviceChild.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLOperator_Value = @import("../../zig.zig").Guid.initString("26caae7a-3081-4633-9581-226fbe57695d"); pub const IID_IDMLOperator = &IID_IDMLOperator_Value; pub const IDMLOperator = extern struct { pub const VTable = extern struct { base: IDMLDeviceChild.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLDeviceChild.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; pub const DML_BINDING_PROPERTIES = extern struct { RequiredDescriptorCount: u32, TemporaryResourceSize: u64, PersistentResourceSize: u64, }; const IID_IDMLDispatchable_Value = @import("../../zig.zig").Guid.initString("dcb821a8-1039-441e-9f1c-b1759c2f3cec"); pub const IID_IDMLDispatchable = &IID_IDMLDispatchable_Value; pub const IDMLDispatchable = extern struct { pub const VTable = extern struct { base: IDMLPageable.VTable, GetBindingProperties: fn( self: *const IDMLDispatchable, ) callconv(@import("std").os.windows.WINAPI) DML_BINDING_PROPERTIES, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLPageable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDispatchable_GetBindingProperties(self: *const T) callconv(.Inline) DML_BINDING_PROPERTIES { return @ptrCast(*const IDMLDispatchable.VTable, self.vtable).GetBindingProperties(@ptrCast(*const IDMLDispatchable, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLCompiledOperator_Value = @import("../../zig.zig").Guid.initString("6b15e56a-bf5c-4902-92d8-da3a650afea4"); pub const IID_IDMLCompiledOperator = &IID_IDMLCompiledOperator_Value; pub const IDMLCompiledOperator = extern struct { pub const VTable = extern struct { base: IDMLDispatchable.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLDispatchable.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLOperatorInitializer_Value = @import("../../zig.zig").Guid.initString("427c1113-435c-469c-8676-4d5dd072f813"); pub const IID_IDMLOperatorInitializer = &IID_IDMLOperatorInitializer_Value; pub const IDMLOperatorInitializer = extern struct { pub const VTable = extern struct { base: IDMLDispatchable.VTable, Reset: fn( self: *const IDMLOperatorInitializer, operatorCount: u32, operators: ?[*]?*IDMLCompiledOperator, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLDispatchable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLOperatorInitializer_Reset(self: *const T, operatorCount: u32, operators: ?[*]?*IDMLCompiledOperator) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLOperatorInitializer.VTable, self.vtable).Reset(@ptrCast(*const IDMLOperatorInitializer, self), operatorCount, operators); } };} pub usingnamespace MethodMixin(@This()); }; pub const DML_BINDING_TYPE = enum(i32) { NONE = 0, BUFFER = 1, BUFFER_ARRAY = 2, }; pub const DML_BINDING_TYPE_NONE = DML_BINDING_TYPE.NONE; pub const DML_BINDING_TYPE_BUFFER = DML_BINDING_TYPE.BUFFER; pub const DML_BINDING_TYPE_BUFFER_ARRAY = DML_BINDING_TYPE.BUFFER_ARRAY; pub const DML_BINDING_DESC = extern struct { Type: DML_BINDING_TYPE, Desc: ?*const c_void, }; pub const DML_BUFFER_BINDING = extern struct { Buffer: ?*ID3D12Resource, Offset: u64, SizeInBytes: u64, }; pub const DML_BUFFER_ARRAY_BINDING = extern struct { BindingCount: u32, Bindings: ?*const DML_BUFFER_BINDING, }; const IID_IDMLBindingTable_Value = @import("../../zig.zig").Guid.initString("29c687dc-de74-4e3b-ab00-1168f2fc3cfc"); pub const IID_IDMLBindingTable = &IID_IDMLBindingTable_Value; pub const IDMLBindingTable = extern struct { pub const VTable = extern struct { base: IDMLDeviceChild.VTable, BindInputs: fn( self: *const IDMLBindingTable, bindingCount: u32, bindings: ?[*]const DML_BINDING_DESC, ) callconv(@import("std").os.windows.WINAPI) void, BindOutputs: fn( self: *const IDMLBindingTable, bindingCount: u32, bindings: ?[*]const DML_BINDING_DESC, ) callconv(@import("std").os.windows.WINAPI) void, BindTemporaryResource: fn( self: *const IDMLBindingTable, binding: ?*const DML_BINDING_DESC, ) callconv(@import("std").os.windows.WINAPI) void, BindPersistentResource: fn( self: *const IDMLBindingTable, binding: ?*const DML_BINDING_DESC, ) callconv(@import("std").os.windows.WINAPI) void, Reset: fn( self: *const IDMLBindingTable, desc: ?*const DML_BINDING_TABLE_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLDeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLBindingTable_BindInputs(self: *const T, bindingCount: u32, bindings: ?[*]const DML_BINDING_DESC) callconv(.Inline) void { return @ptrCast(*const IDMLBindingTable.VTable, self.vtable).BindInputs(@ptrCast(*const IDMLBindingTable, self), bindingCount, bindings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLBindingTable_BindOutputs(self: *const T, bindingCount: u32, bindings: ?[*]const DML_BINDING_DESC) callconv(.Inline) void { return @ptrCast(*const IDMLBindingTable.VTable, self.vtable).BindOutputs(@ptrCast(*const IDMLBindingTable, self), bindingCount, bindings); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLBindingTable_BindTemporaryResource(self: *const T, binding: ?*const DML_BINDING_DESC) callconv(.Inline) void { return @ptrCast(*const IDMLBindingTable.VTable, self.vtable).BindTemporaryResource(@ptrCast(*const IDMLBindingTable, self), binding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLBindingTable_BindPersistentResource(self: *const T, binding: ?*const DML_BINDING_DESC) callconv(.Inline) void { return @ptrCast(*const IDMLBindingTable.VTable, self.vtable).BindPersistentResource(@ptrCast(*const IDMLBindingTable, self), binding); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLBindingTable_Reset(self: *const T, desc: ?*const DML_BINDING_TABLE_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const IDMLBindingTable.VTable, self.vtable).Reset(@ptrCast(*const IDMLBindingTable, self), desc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLCommandRecorder_Value = @import("../../zig.zig").Guid.initString("e6857a76-2e3e-4fdd-bff4-5d2ba10fb453"); pub const IID_IDMLCommandRecorder = &IID_IDMLCommandRecorder_Value; pub const IDMLCommandRecorder = extern struct { pub const VTable = extern struct { base: IDMLDeviceChild.VTable, RecordDispatch: fn( self: *const IDMLCommandRecorder, commandList: ?*ID3D12CommandList, dispatchable: ?*IDMLDispatchable, bindings: ?*IDMLBindingTable, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDMLDeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLCommandRecorder_RecordDispatch(self: *const T, commandList: ?*ID3D12CommandList, dispatchable: ?*IDMLDispatchable, bindings: ?*IDMLBindingTable) callconv(.Inline) void { return @ptrCast(*const IDMLCommandRecorder.VTable, self.vtable).RecordDispatch(@ptrCast(*const IDMLCommandRecorder, self), commandList, dispatchable, bindings); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDMLDebugDevice_Value = @import("../../zig.zig").Guid.initString("7d6f3ac9-394a-4ac3-92a7-390cc57a8217"); pub const IID_IDMLDebugDevice = &IID_IDMLDebugDevice_Value; pub const IDMLDebugDevice = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetMuteDebugOutput: fn( self: *const IDMLDebugDevice, mute: BOOL, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDMLDebugDevice_SetMuteDebugOutput(self: *const T, mute: BOOL) callconv(.Inline) void { return @ptrCast(*const IDMLDebugDevice.VTable, self.vtable).SetMuteDebugOutput(@ptrCast(*const IDMLDebugDevice, self), mute); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (2) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows10.0.10240' pub extern "DirectML" fn DMLCreateDevice( d3d12Device: ?*ID3D12Device, flags: DML_CREATE_DEVICE_FLAGS, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "DirectML" fn DMLCreateDevice1( d3d12Device: ?*ID3D12Device, flags: DML_CREATE_DEVICE_FLAGS, minimumFeatureLevel: DML_FEATURE_LEVEL, riid: ?*const Guid, ppv: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (0) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../../zig.zig").unicode_mode) { .ansi => struct { }, .wide => struct { }, .unspecified => if (@import("builtin").is_test) struct { } else struct { }, }; //-------------------------------------------------------------------------------- // Section: Imports (10) //-------------------------------------------------------------------------------- const Guid = @import("../../zig.zig").Guid; const BOOL = @import("../../foundation.zig").BOOL; const D3D12_CPU_DESCRIPTOR_HANDLE = @import("../../graphics/direct3d12.zig").D3D12_CPU_DESCRIPTOR_HANDLE; const D3D12_GPU_DESCRIPTOR_HANDLE = @import("../../graphics/direct3d12.zig").D3D12_GPU_DESCRIPTOR_HANDLE; const HRESULT = @import("../../foundation.zig").HRESULT; const ID3D12CommandList = @import("../../graphics/direct3d12.zig").ID3D12CommandList; const ID3D12Device = @import("../../graphics/direct3d12.zig").ID3D12Device; const ID3D12Resource = @import("../../graphics/direct3d12.zig").ID3D12Resource; const IUnknown = @import("../../system/com.zig").IUnknown; const PWSTR = @import("../../foundation.zig").PWSTR; test { @setEvalBranchQuota( @import("std").meta.declarations(@This()).len * 3 ); // reference all the pub declarations if (!@import("builtin").is_test) return; inline for (@import("std").meta.declarations(@This())) |decl| { if (decl.is_pub) { _ = decl; } } }
deps/zigwin32/win32/ai/machine_learning/direct_ml.zig
const std = @import("std"); pub fn Channel(comptime T: type) type { return struct { lock: std.Thread.Mutex = .{}, buffer: []T, head: usize = 0, tail: usize = 0, getters: ?*Waiter = null, putters: ?*Waiter = null, const Task = std.event.Loop.NextTickNode; const loop_instance = std.event.Loop.instance orelse { @compileError("Only supported in evented mode"); }; const Self = @This(); const Waiter = struct { next: ?*Waiter, tail: *Waiter, item: T, task: Task, }; pub fn init(buffer: []T) Self { return Self{ .buffer = buffer }; } pub fn put(self: *Self, item: T) void { self.lock.lock(); if (pop(&self.getters)) |waiter| { self.lock.unlock(); waiter.item = item; loop_instance.onNextTick(&waiter.task); return; } if (self.tail -% self.head < self.buffer.len) { if (@sizeOf(T) > 0) self.buffer[self.tail % self.buffer.len] = item; self.tail +%= 1; self.lock.unlock(); return; } _ = wait(&self.putters, &self.lock, item); } // Tries to put but, if full, it returns an error // instead of suspending. pub fn tryPut(self: *Self, item: T) !void { self.lock.lock(); defer self.lock.unlock(); if (pop(&self.getters)) |waiter| { waiter.item = item; loop_instance.onNextTick(&waiter.task); return; } if (self.tail -% self.head < self.buffer.len) { if (@sizeOf(T) > 0) self.buffer[self.tail % self.buffer.len] = item; self.tail +%= 1; return; } return error.FullChannel; } pub fn get(self: *Self) T { if (self.tryGet()) |item| return item; return wait(&self.getters, &self.lock, undefined); } pub fn getOrNull(self: *Self) ?T { if (self.tryGet()) |item| return item; self.lock.unlock(); return null; } fn tryGet(self: *Self) ?T { self.lock.lock(); if (self.tail -% self.head > 0) { var item: T = undefined; if (@sizeOf(T) > 0) item = self.buffer[self.head % self.buffer.len]; self.head +%= 1; self.lock.unlock(); return item; } if (pop(&self.putters)) |waiter| { self.lock.unlock(); const item = waiter.item; loop_instance.onNextTick(&waiter.task); return item; } return null; } fn wait(queue: *?*Waiter, held: *std.Thread.Mutex, item: T) T { var waiter: Waiter = undefined; push(queue, &waiter); waiter.item = item; suspend { waiter.task = Task{ .data = @frame() }; held.unlock(); } return waiter.item; } fn push(queue: *?*Waiter, waiter: *Waiter) void { waiter.next = null; if (queue.*) |head| { head.tail.next = waiter; head.tail = waiter; } else { waiter.tail = waiter; queue.* = waiter; } } fn pop(queue: *?*Waiter) ?*Waiter { const waiter = queue.* orelse return null; queue.* = waiter.next; if (queue.*) |new_head| new_head.tail = waiter.tail; return waiter; } }; }
src/utils/channel.zig
const std = @import("std"); const cli = @import("cli.zig"); const utils = @import("utils.zig"); const max_template_len = 12000; pub const Theme = struct { theme_name_full: []u8, theme_name_safe: []u8, color_bg_main: []u8, color_bg_alt1: []u8, color_bg_alt2: []u8, color_fg: []u8, color_linenr: []u8, color_select: []u8, color_type: []u8, color_accent: []u8, color_string: []u8, color_number: []u8, color_boolean: []u8, color_comment: []u8, color_variable: []u8, color_function: []u8, }; const a = std.heap.page_allocator; var tmp_gen = std.BufMap.init(a); // Each embedded template file allows colorstorm to loop through and replace template // variables with color values to produce a full template. pub const templates = std.ComptimeStringMap([]const u8, .{ .{ @tagName(cli.Gen.vim), @embedFile("../templates/template.vim") }, .{ @tagName(cli.Gen.atom), @embedFile("../templates/colors.less") }, .{ @tagName(cli.Gen.vscode), @embedFile("../templates/template.json") }, .{ @tagName(cli.Gen.iterm2), @embedFile("../templates/template.itermcolors") }, .{ @tagName(cli.Gen.sublime), @embedFile("../templates/template.tmTheme") }, }); // The base output path to use for each theme const out_path = std.ComptimeStringMap([]const u8, .{ .{ @tagName(cli.Gen.vim), "vim/colors" }, .{ @tagName(cli.Gen.atom), "atom/themes" }, .{ @tagName(cli.Gen.vscode), "vscode/themes" }, .{ @tagName(cli.Gen.iterm2), "iterm2" }, .{ @tagName(cli.Gen.sublime), "sublime" }, }); // The output "extension" to use. In the case of atom, the "extension" is just colors.less, // since that is what the editor expects when loading a new theme. const out_ext = std.ComptimeStringMap([]const u8, .{ .{ @tagName(cli.Gen.vim), ".vim" }, .{ @tagName(cli.Gen.atom), "colors.less" }, .{ @tagName(cli.Gen.vscode), ".json" }, .{ @tagName(cli.Gen.iterm2), ".itermcolors" }, .{ @tagName(cli.Gen.sublime), ".tmTheme" }, }); const template_end = std.ComptimeStringMap(u8, .{ .{ @tagName(cli.Gen.vim), '"' }, .{ @tagName(cli.Gen.atom), ';' }, .{ @tagName(cli.Gen.vscode), '}' }, .{ @tagName(cli.Gen.iterm2), '>' }, .{ @tagName(cli.Gen.sublime), '>' }, }); /// Parses a json array from the input file into a list of themes. Each /// theme must contain the fields defined in the Theme struct above. pub fn parse_themes(f: std.fs.File) ![]Theme { @setEvalBranchQuota(5000); var list = std.ArrayList(u8).init(a); defer list.deinit(); const writer = list.writer(); var reader = f.reader(); var buffer: [500]u8 = undefined; while (try reader.readUntilDelimiterOrEof(buffer[0..], '\n')) |line| { try writer.writeAll(line); } var stream = std.json.TokenStream.init(list.items); const themes = try std.json.parse( []Theme, &stream, .{ .allocator = a }, ); return themes; } fn replace(name: []const u8, val: []const u8, gen_type: []const u8) !void { var output_array: [max_template_len]u8 = undefined; var output: []u8 = &output_array; // First attempt to replace hex colors with RGB percentages (iTerm2) // This is done first since RGB percentage variable names are the same // as regular variable names, just prefixed with "R|G|B". if (std.mem.startsWith(u8, val, "#")) { var c_percents = utils.hex_to_percent(val); var iter = std.mem.split(u8, c_percents, " "); for ("RGB") |c| { var c_val = iter.next().?; var c_var = try std.fmt.allocPrint( a, "{u}{s}", .{ c, name }, ); _ = std.mem.replace(u8, tmp_gen.get(gen_type).?, c_var, c_val, output[0..]); try tmp_gen.put(gen_type, output); } } var buf_len = tmp_gen.get(gen_type).?.len; if (val.len > name.len) { buf_len = buf_len + (val.len - name.len); } _ = std.mem.replace(u8, tmp_gen.get(gen_type).?, name, val, output[0..]); try tmp_gen.put(gen_type, output[0..buf_len]); } /// Generate a set of themes for a specified editor/terminal emulator/etc. The location of the themes /// depends on the output directory set by the user (or "colorstorm-out" if not provided) as well as /// the `out_path` mapping defined above. Theme output location is intended to help alleviate issues /// with structuring editor/emulator specific submodules that rely on specific structures to work /// properly (primarly atom, see below). fn generate(gen_type: []const u8, themes: []Theme, outdir: []const u8) !void { const stdout = std.io.getStdOut().writer(); try stdout.print("-- {s}\n", .{gen_type}); for (themes) |theme| { //_ = std.mem.replace(u8, templates.get(gen_type).?, " ", " ", output[0..]); try tmp_gen.put(gen_type, templates.get(gen_type).?); inline for (std.meta.fields(@TypeOf(theme))) |f| { try replace(f.name, @field(theme, f.name), gen_type); } // Format both path and file name/extension, depending on the editor var fmt_out_path = try std.fmt.allocPrint( a, "{s}/{s}", .{ outdir, out_path.get(gen_type).? }, ); var fmt_out_file = try std.fmt.allocPrint( a, "{s}/{s}{s}", .{ fmt_out_path, theme.theme_name_safe, out_ext.get(gen_type).? }, ); if (std.mem.eql(u8, @tagName(cli.Gen.atom), gen_type)) { // Atom uses a more unconventional structure for defining multiple // syntax themes, which requires different handling: // "atom/themes/{theme_name}-syntax/colors.less" fmt_out_path = try std.fmt.allocPrint( a, "{s}/{s}-syntax", .{ fmt_out_path, theme.theme_name_safe }, ); fmt_out_file = try std.fmt.allocPrint( a, "{s}/{s}", .{ fmt_out_path, out_ext.get(gen_type).? }, ); } defer a.free(fmt_out_path); defer a.free(fmt_out_file); // Ensure full output path exists before writing finished theme try std.fs.cwd().makePath(fmt_out_path); var theme_output = tmp_gen.get(gen_type).?; var theme_len = theme_output.len; while (theme_output[theme_len - 1] != template_end.get(gen_type).?) { theme_len -= 1; } try stdout.print(" {s}\n", .{fmt_out_file}); try std.fs.cwd().writeFile(fmt_out_file, tmp_gen.get(gen_type).?[0..theme_len]); } } /// Creates themes based on the provided input file. Can be used to create themes for a /// specific editor, or all supported editors/platforms if none is specified. pub fn create_themes(input: std.fs.File, outdir: []const u8, gen_type: []const u8) !void { var themes: []Theme = try parse_themes(input); if (std.mem.eql(u8, @tagName(cli.Gen.all), gen_type)) { // Loop through all supported platforms and create themes for each inline for (std.meta.fields(cli.Gen)) |f| { if (!std.mem.eql(u8, @tagName(cli.Gen.all), f.name)) { try generate(f.name, themes, outdir); } } } else { try generate(gen_type, themes, outdir); } }
src/templator.zig
const builtin = @import("builtin"); const std = @import("std"); const expect = std.testing.expect; const mem = std.mem; const Tag = std.meta.Tag; const Number = enum { Zero, One, Two, Three, Four }; fn shouldEqual(n: Number, expected: u3) !void { try expect(@enumToInt(n) == expected); } test "enum to int" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try shouldEqual(Number.Zero, 0); try shouldEqual(Number.One, 1); try shouldEqual(Number.Two, 2); try shouldEqual(Number.Three, 3); try shouldEqual(Number.Four, 4); } fn testIntToEnumEval(x: i32) !void { try expect(@intToEnum(IntToEnumNumber, x) == IntToEnumNumber.Three); } const IntToEnumNumber = enum { Zero, One, Two, Three, Four }; test "int to enum" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try testIntToEnumEval(3); } const ValueCount1 = enum { I0, }; const ValueCount2 = enum { I0, I1, }; const ValueCount256 = enum { I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, I17, I18, I19, I20, I21, I22, I23, I24, I25, I26, I27, I28, I29, I30, I31, I32, I33, I34, I35, I36, I37, I38, I39, I40, I41, I42, I43, I44, I45, I46, I47, I48, I49, I50, I51, I52, I53, I54, I55, I56, I57, I58, I59, I60, I61, I62, I63, I64, I65, I66, I67, I68, I69, I70, I71, I72, I73, I74, I75, I76, I77, I78, I79, I80, I81, I82, I83, I84, I85, I86, I87, I88, I89, I90, I91, I92, I93, I94, I95, I96, I97, I98, I99, I100, I101, I102, I103, I104, I105, I106, I107, I108, I109, I110, I111, I112, I113, I114, I115, I116, I117, I118, I119, I120, I121, I122, I123, I124, I125, I126, I127, I128, I129, I130, I131, I132, I133, I134, I135, I136, I137, I138, I139, I140, I141, I142, I143, I144, I145, I146, I147, I148, I149, I150, I151, I152, I153, I154, I155, I156, I157, I158, I159, I160, I161, I162, I163, I164, I165, I166, I167, I168, I169, I170, I171, I172, I173, I174, I175, I176, I177, I178, I179, I180, I181, I182, I183, I184, I185, I186, I187, I188, I189, I190, I191, I192, I193, I194, I195, I196, I197, I198, I199, I200, I201, I202, I203, I204, I205, I206, I207, I208, I209, I210, I211, I212, I213, I214, I215, I216, I217, I218, I219, I220, I221, I222, I223, I224, I225, I226, I227, I228, I229, I230, I231, I232, I233, I234, I235, I236, I237, I238, I239, I240, I241, I242, I243, I244, I245, I246, I247, I248, I249, I250, I251, I252, I253, I254, I255, }; const ValueCount257 = enum { I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, I17, I18, I19, I20, I21, I22, I23, I24, I25, I26, I27, I28, I29, I30, I31, I32, I33, I34, I35, I36, I37, I38, I39, I40, I41, I42, I43, I44, I45, I46, I47, I48, I49, I50, I51, I52, I53, I54, I55, I56, I57, I58, I59, I60, I61, I62, I63, I64, I65, I66, I67, I68, I69, I70, I71, I72, I73, I74, I75, I76, I77, I78, I79, I80, I81, I82, I83, I84, I85, I86, I87, I88, I89, I90, I91, I92, I93, I94, I95, I96, I97, I98, I99, I100, I101, I102, I103, I104, I105, I106, I107, I108, I109, I110, I111, I112, I113, I114, I115, I116, I117, I118, I119, I120, I121, I122, I123, I124, I125, I126, I127, I128, I129, I130, I131, I132, I133, I134, I135, I136, I137, I138, I139, I140, I141, I142, I143, I144, I145, I146, I147, I148, I149, I150, I151, I152, I153, I154, I155, I156, I157, I158, I159, I160, I161, I162, I163, I164, I165, I166, I167, I168, I169, I170, I171, I172, I173, I174, I175, I176, I177, I178, I179, I180, I181, I182, I183, I184, I185, I186, I187, I188, I189, I190, I191, I192, I193, I194, I195, I196, I197, I198, I199, I200, I201, I202, I203, I204, I205, I206, I207, I208, I209, I210, I211, I212, I213, I214, I215, I216, I217, I218, I219, I220, I221, I222, I223, I224, I225, I226, I227, I228, I229, I230, I231, I232, I233, I234, I235, I236, I237, I238, I239, I240, I241, I242, I243, I244, I245, I246, I247, I248, I249, I250, I251, I252, I253, I254, I255, I256, }; test "enum sizes" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; comptime { try expect(@sizeOf(ValueCount1) == 0); try expect(@sizeOf(ValueCount2) == 1); try expect(@sizeOf(ValueCount256) == 1); try expect(@sizeOf(ValueCount257) == 2); } } test "enum literal equality" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const x = .hi; const y = .ok; const z = .hi; try expect(x != y); try expect(x == z); } test "enum literal cast to enum" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const Color = enum { Auto, Off, On }; var color1: Color = .Auto; var color2 = Color.Auto; try expect(color1 == color2); } test "peer type resolution with enum literal" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const Items = enum { one, two }; try expect(Items.two == .two); try expect(.two == Items.two); } const MultipleChoice = enum(u32) { A = 20, B = 40, C = 60, D = 1000, }; fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { try expect(@enumToInt(x) == 60); try expect(1234 == switch (x) { MultipleChoice.A => 1, MultipleChoice.B => 2, MultipleChoice.C => @as(u32, 1234), MultipleChoice.D => 4, }); } test "enum with specified tag values" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try testEnumWithSpecifiedTagValues(MultipleChoice.C); comptime try testEnumWithSpecifiedTagValues(MultipleChoice.C); } test "non-exhaustive enum" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { const E = enum(u8) { a, b, _ }; fn doTheTest(y: u8) !void { var e: E = .b; try expect(switch (e) { .a => false, .b => true, _ => false, }); e = @intToEnum(E, 12); try expect(switch (e) { .a => false, .b => false, _ => true, }); try expect(switch (e) { .a => false, .b => false, else => true, }); e = .b; try expect(switch (e) { .a => false, else => true, }); try expect(@typeInfo(E).Enum.fields.len == 2); e = @intToEnum(E, 12); try expect(@enumToInt(e) == 12); e = @intToEnum(E, y); try expect(@enumToInt(e) == 52); try expect(@typeInfo(E).Enum.is_exhaustive == false); } }; try S.doTheTest(52); comptime try S.doTheTest(52); } test "empty non-exhaustive enum" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { const E = enum(u8) { _ }; fn doTheTest(y: u8) !void { var e = @intToEnum(E, y); try expect(switch (e) { _ => true, }); try expect(@enumToInt(e) == y); try expect(@typeInfo(E).Enum.fields.len == 0); try expect(@typeInfo(E).Enum.is_exhaustive == false); } }; try S.doTheTest(42); comptime try S.doTheTest(42); } test "single field non-exhaustive enum" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { const E = enum(u8) { a, _ }; fn doTheTest(y: u8) !void { var e: E = .a; try expect(switch (e) { .a => true, _ => false, }); e = @intToEnum(E, 12); try expect(switch (e) { .a => false, _ => true, }); try expect(switch (e) { .a => false, else => true, }); e = .a; try expect(switch (e) { .a => true, else => false, }); try expect(@enumToInt(@intToEnum(E, y)) == y); try expect(@typeInfo(E).Enum.fields.len == 1); try expect(@typeInfo(E).Enum.is_exhaustive == false); } }; try S.doTheTest(23); comptime try S.doTheTest(23); } const EnumWithTagValues = enum(u4) { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, }; test "enum with tag values don't require parens" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try expect(@enumToInt(EnumWithTagValues.C) == 0b0100); } const MultipleChoice2 = enum(u32) { Unspecified1, A = 20, Unspecified2, B = 40, Unspecified3, C = 60, Unspecified4, D = 1000, Unspecified5, }; test "cast integer literal to enum" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try expect(@intToEnum(MultipleChoice2, 0) == MultipleChoice2.Unspecified1); try expect(@intToEnum(MultipleChoice2, 40) == MultipleChoice2.B); } test "enum with specified and unspecified tag values" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); comptime try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); } fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { try expect(@enumToInt(x) == 1000); try expect(1234 == switch (x) { MultipleChoice2.A => 1, MultipleChoice2.B => 2, MultipleChoice2.C => 3, MultipleChoice2.D => @as(u32, 1234), MultipleChoice2.Unspecified1 => 5, MultipleChoice2.Unspecified2 => 6, MultipleChoice2.Unspecified3 => 7, MultipleChoice2.Unspecified4 => 8, MultipleChoice2.Unspecified5 => 9, }); } const Small2 = enum(u2) { One, Two }; const Small = enum(u2) { One, Two, Three, Four }; test "set enum tag type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; { var x = Small.One; x = Small.Two; comptime try expect(Tag(Small) == u2); } { var x = Small2.One; x = Small2.Two; comptime try expect(Tag(Small2) == u2); } } test "casting enum to its tag type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try testCastEnumTag(Small2.Two); comptime try testCastEnumTag(Small2.Two); } fn testCastEnumTag(value: Small2) !void { try expect(@enumToInt(value) == 1); } test "enum with 1 field but explicit tag type should still have the tag type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const Enum = enum(u8) { B = 2, }; comptime try expect(@sizeOf(Enum) == @sizeOf(u8)); } test "signed integer as enum tag" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const SignedEnum = enum(i2) { A0 = -1, A1 = 0, A2 = 1, }; try expect(@enumToInt(SignedEnum.A0) == -1); try expect(@enumToInt(SignedEnum.A1) == 0); try expect(@enumToInt(SignedEnum.A2) == 1); } test "enum with one member and custom tag type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const E = enum(u2) { One, }; try expect(@enumToInt(E.One) == 0); const E2 = enum(u2) { One = 2, }; try expect(@enumToInt(E2.One) == 2); } test "enum with one member and u1 tag type @enumToInt" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const Enum = enum(u1) { Test, }; try expect(@enumToInt(Enum.Test) == 0); } test "enum with comptime_int tag type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const Enum = enum(comptime_int) { One = 3, Two = 2, Three = 1, }; comptime try expect(Tag(Enum) == comptime_int); } test "enum with one member default to u0 tag type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const E0 = enum { X }; comptime try expect(Tag(E0) == u0); } const EnumWithOneMember = enum { Eof }; fn doALoopThing(id: EnumWithOneMember) void { while (true) { if (id == EnumWithOneMember.Eof) { break; } @compileError("above if condition should be comptime"); } } test "comparison operator on enum with one member is comptime known" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; doALoopThing(EnumWithOneMember.Eof); } const State = enum { Start }; test "switch on enum with one member is comptime known" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var state = State.Start; switch (state) { State.Start => return, } @compileError("analysis should not reach here"); } test "method call on an enum" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { const E = enum { one, two, fn method(self: *E) bool { return self.* == .two; } fn generic_method(self: *E, foo: anytype) bool { return self.* == .two and foo == bool; } }; fn doTheTest() !void { var e = E.two; try expect(e.method()); try expect(e.generic_method(bool)); } }; try S.doTheTest(); comptime try S.doTheTest(); } test "enum value allocation" { const LargeEnum = enum(u32) { A0 = 0x80000000, A1, A2, }; try expect(@enumToInt(LargeEnum.A0) == 0x80000000); try expect(@enumToInt(LargeEnum.A1) == 0x80000001); try expect(@enumToInt(LargeEnum.A2) == 0x80000002); } test "enum literal casting to tagged union" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const Arch = union(enum) { x86_64, arm: Arm32, const Arm32 = enum { v8_5a, v8_4a, }; }; var t = true; var x: Arch = .x86_64; var y = if (t) x else .x86_64; switch (y) { .x86_64 => {}, else => @panic("fail"), } } const Bar = enum { A, B, C, D }; test "enum literal casting to error union with payload enum" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var bar: error{B}!Bar = undefined; bar = .B; // should never cast to the error set try expect((try bar) == Bar.B); } test "exporting enum type and value" { if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO const S = struct { const E = enum(c_int) { one, two }; comptime { @export(E, .{ .name = "E" }); } const e: E = .two; comptime { @export(e, .{ .name = "e" }); } }; try expect(S.e == .two); } test "constant enum initialization with differing sizes" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO try test3_1(test3_foo); try test3_2(test3_bar); } const Test3Foo = union(enum) { One: void, Two: f32, Three: Test3Point, }; const Test3Point = struct { x: i32, y: i32, }; const test3_foo = Test3Foo{ .Three = Test3Point{ .x = 3, .y = 4, }, }; const test3_bar = Test3Foo{ .Two = 13 }; fn test3_1(f: Test3Foo) !void { switch (f) { Test3Foo.Three => |pt| { try expect(pt.x == 3); try expect(pt.y == 4); }, else => unreachable, } } fn test3_2(f: Test3Foo) !void { switch (f) { Test3Foo.Two => |x| { try expect(x == 13); }, else => unreachable, } } test "@tagName" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); comptime try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); } fn testEnumTagNameBare(n: anytype) []const u8 { return @tagName(n); } const BareNumber = enum { One, Two, Three }; test "@tagName non-exhaustive enum" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); comptime try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); } const NonExhaustive = enum(u8) { A, B, _ }; test "@tagName is null-terminated" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { fn doTheTest(n: BareNumber) !void { try expect(@tagName(n)[3] == 0); } }; try S.doTheTest(.Two); try comptime S.doTheTest(.Two); } test "tag name with assigned enum values" { if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const LocalFoo = enum(u8) { A = 1, B = 0, }; var b = LocalFoo.B; try expect(mem.eql(u8, @tagName(b), "B")); } test "@tagName on enum literals" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); comptime try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); } test "enum literal casting to optional" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var bar: ?Bar = undefined; bar = .B; try expect(bar.? == Bar.B); } const A = enum(u3) { One, Two, Three, Four, One2, Two2, Three2, Four2 }; const B = enum(u3) { One3, Two3, Three3, Four3, One23, Two23, Three23, Four23 }; const C = enum(u2) { One4, Two4, Three4, Four4 }; const BitFieldOfEnums = packed struct { a: A, b: B, c: C, }; const bit_field_1 = BitFieldOfEnums{ .a = A.Two, .b = B.Three3, .c = C.Four4, }; test "bit field access with enum fields" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var data = bit_field_1; try expect(getA(&data) == A.Two); try expect(getB(&data) == B.Three3); try expect(getC(&data) == C.Four4); comptime try expect(@sizeOf(BitFieldOfEnums) == 1); data.b = B.Four3; try expect(data.b == B.Four3); data.a = A.Three; try expect(data.a == A.Three); try expect(data.b == B.Four3); } fn getA(data: *const BitFieldOfEnums) A { return data.a; } fn getB(data: *const BitFieldOfEnums) B { return data.b; } fn getC(data: *const BitFieldOfEnums) C { return data.c; } test "enum literal in array literal" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const Items = enum { one, two }; const array = [_]Items{ .one, .two }; try expect(array[0] == .one); try expect(array[1] == .two); }
test/behavior/enum.zig
const std = @import("../std.zig"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; const ast = std.zig.ast; const Node = ast.Node; const Tree = ast.Tree; const AstError = ast.Error; const TokenIndex = ast.TokenIndex; const Token = std.zig.Token; const TokenIterator = Tree.TokenList.Iterator; pub const Error = error{ParseError} || Allocator.Error; /// Result should be freed with tree.deinit() when there are /// no more references to any of the tokens or nodes. pub fn parse(allocator: *Allocator, source: []const u8) Allocator.Error!*Tree { const tree = blk: { // This block looks unnecessary, but is a "foot-shield" to prevent the SegmentedLists // from being initialized with a pointer to this `arena`, which is created on // the stack. Following code should instead refer to `&tree.arena_allocator`, a // pointer to data which lives safely on the heap and will outlive `parse`. See: // https://github.com/ziglang/zig/commit/cb4fb14b6e66bd213575f69eec9598be8394fae6 var arena = std.heap.ArenaAllocator.init(allocator); errdefer arena.deinit(); const tree = try arena.allocator.create(ast.Tree); tree.* = ast.Tree{ .source = source, .root_node = undefined, .arena_allocator = arena, .tokens = undefined, .errors = undefined, }; break :blk tree; }; errdefer tree.deinit(); const arena = &tree.arena_allocator.allocator; tree.tokens = ast.Tree.TokenList.init(arena); tree.errors = ast.Tree.ErrorList.init(arena); var tokenizer = std.zig.Tokenizer.init(source); while (true) { const tree_token = try tree.tokens.addOne(); tree_token.* = tokenizer.next(); if (tree_token.id == .Eof) break; } var it = tree.tokens.iterator(0); while (it.peek().?.id == .LineComment) _ = it.next(); tree.root_node = parseRoot(arena, &it, tree) catch |err| blk: { switch (err) { error.ParseError => { assert(tree.errors.len != 0); break :blk undefined; }, error.OutOfMemory => { return error.OutOfMemory; }, } }; return tree; } /// Root <- skip ContainerMembers eof fn parseRoot(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!*Node.Root { const node = try arena.create(Node.Root); node.* = Node.Root{ .decls = try parseContainerMembers(arena, it, tree), .eof_token = eatToken(it, .Eof) orelse { try tree.errors.push(AstError{ .ExpectedContainerMembers = .{ .token = it.index }, }); return error.ParseError; }, }; return node; } /// ContainerMembers /// <- TestDecl ContainerMembers /// / TopLevelComptime ContainerMembers /// / KEYWORD_pub? TopLevelDecl ContainerMembers /// / KEYWORD_pub? ContainerField COMMA ContainerMembers /// / KEYWORD_pub? ContainerField /// / fn parseContainerMembers(arena: *Allocator, it: *TokenIterator, tree: *Tree) !Node.Root.DeclList { var list = Node.Root.DeclList.init(arena); while (true) { if (try parseContainerDocComments(arena, it, tree)) |node| { try list.push(node); continue; } const doc_comments = try parseDocComment(arena, it, tree); if (try parseTestDecl(arena, it, tree)) |node| { node.cast(Node.TestDecl).?.doc_comments = doc_comments; try list.push(node); continue; } if (try parseTopLevelComptime(arena, it, tree)) |node| { node.cast(Node.Comptime).?.doc_comments = doc_comments; try list.push(node); continue; } const visib_token = eatToken(it, .Keyword_pub); if (try parseTopLevelDecl(arena, it, tree)) |node| { switch (node.id) { .FnProto => { node.cast(Node.FnProto).?.doc_comments = doc_comments; node.cast(Node.FnProto).?.visib_token = visib_token; }, .VarDecl => { node.cast(Node.VarDecl).?.doc_comments = doc_comments; node.cast(Node.VarDecl).?.visib_token = visib_token; }, .Use => { node.cast(Node.Use).?.doc_comments = doc_comments; node.cast(Node.Use).?.visib_token = visib_token; }, else => unreachable, } try list.push(node); if (try parseAppendedDocComment(arena, it, tree, node.lastToken())) |appended_comment| { switch (node.id) { .FnProto => {}, .VarDecl => node.cast(Node.VarDecl).?.doc_comments = appended_comment, .Use => node.cast(Node.Use).?.doc_comments = appended_comment, else => unreachable, } } continue; } if (visib_token != null) { try tree.errors.push(AstError{ .ExpectedPubItem = AstError.ExpectedPubItem{ .token = it.index }, }); return error.ParseError; } if (try parseContainerField(arena, it, tree)) |node| { const field = node.cast(Node.ContainerField).?; field.doc_comments = doc_comments; try list.push(node); const comma = eatToken(it, .Comma) orelse break; if (try parseAppendedDocComment(arena, it, tree, comma)) |appended_comment| field.doc_comments = appended_comment; continue; } // Dangling doc comment if (doc_comments != null) { try tree.errors.push(AstError{ .UnattachedDocComment = AstError.UnattachedDocComment{ .token = doc_comments.?.firstToken() }, }); } break; } return list; } /// Eat a multiline container doc comment fn parseContainerDocComments(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { var lines = Node.DocComment.LineList.init(arena); while (eatToken(it, .ContainerDocComment)) |line| { try lines.push(line); } if (lines.len == 0) return null; const node = try arena.create(Node.DocComment); node.* = Node.DocComment{ .lines = lines, }; return &node.base; } /// TestDecl <- KEYWORD_test STRINGLITERALSINGLE Block fn parseTestDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const test_token = eatToken(it, .Keyword_test) orelse return null; const name_node = try expectNode(arena, it, tree, parseStringLiteralSingle, AstError{ .ExpectedStringLiteral = AstError.ExpectedStringLiteral{ .token = it.index }, }); const block_node = try expectNode(arena, it, tree, parseBlock, AstError{ .ExpectedLBrace = AstError.ExpectedLBrace{ .token = it.index }, }); const test_node = try arena.create(Node.TestDecl); test_node.* = Node.TestDecl{ .doc_comments = null, .test_token = test_token, .name = name_node, .body_node = block_node, }; return &test_node.base; } /// TopLevelComptime <- KEYWORD_comptime BlockExpr fn parseTopLevelComptime(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const tok = eatToken(it, .Keyword_comptime) orelse return null; const lbrace = eatToken(it, .LBrace) orelse { putBackToken(it, tok); return null; }; putBackToken(it, lbrace); const block_node = try expectNode(arena, it, tree, parseBlockExpr, AstError{ .ExpectedLabelOrLBrace = AstError.ExpectedLabelOrLBrace{ .token = it.index }, }); const comptime_node = try arena.create(Node.Comptime); comptime_node.* = Node.Comptime{ .doc_comments = null, .comptime_token = tok, .expr = block_node, }; return &comptime_node.base; } /// TopLevelDecl /// <- (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE? / (KEYWORD_inline / KEYWORD_noinline))? FnProto (SEMICOLON / Block) /// / (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE?)? KEYWORD_threadlocal? VarDecl /// / KEYWORD_usingnamespace Expr SEMICOLON fn parseTopLevelDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { var lib_name: ?*Node = null; const extern_export_inline_token = blk: { if (eatToken(it, .Keyword_export)) |token| break :blk token; if (eatToken(it, .Keyword_extern)) |token| { lib_name = try parseStringLiteralSingle(arena, it, tree); break :blk token; } if (eatToken(it, .Keyword_inline)) |token| break :blk token; if (eatToken(it, .Keyword_noinline)) |token| break :blk token; break :blk null; }; if (try parseFnProto(arena, it, tree)) |node| { const fn_node = node.cast(Node.FnProto).?; fn_node.*.extern_export_inline_token = extern_export_inline_token; fn_node.*.lib_name = lib_name; if (eatToken(it, .Semicolon)) |_| return node; if (try parseBlock(arena, it, tree)) |body_node| { fn_node.body_node = body_node; return node; } try tree.errors.push(AstError{ .ExpectedSemiOrLBrace = AstError.ExpectedSemiOrLBrace{ .token = it.index }, }); return null; } if (extern_export_inline_token) |token| { if (tree.tokens.at(token).id == .Keyword_inline or tree.tokens.at(token).id == .Keyword_noinline) { putBackToken(it, token); return null; } } const thread_local_token = eatToken(it, .Keyword_threadlocal); if (try parseVarDecl(arena, it, tree)) |node| { var var_decl = node.cast(Node.VarDecl).?; var_decl.*.thread_local_token = thread_local_token; var_decl.*.comptime_token = null; var_decl.*.extern_export_token = extern_export_inline_token; var_decl.*.lib_name = lib_name; return node; } if (thread_local_token != null) { try tree.errors.push(AstError{ .ExpectedVarDecl = AstError.ExpectedVarDecl{ .token = it.index }, }); return error.ParseError; } if (extern_export_inline_token) |token| { if (lib_name) |string_literal_node| putBackToken(it, string_literal_node.cast(Node.StringLiteral).?.token); putBackToken(it, token); return null; } const use_node = (try parseUse(arena, it, tree)) orelse return null; const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const semicolon_token = try expectToken(it, tree, .Semicolon); const use_node_raw = use_node.cast(Node.Use).?; use_node_raw.*.expr = expr_node; use_node_raw.*.semicolon_token = semicolon_token; return use_node; } /// FnProto <- FnCC? KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? EXCLAMATIONMARK? (KEYWORD_var / TypeExpr) fn parseFnProto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const cc = parseFnCC(arena, it, tree); const fn_token = eatToken(it, .Keyword_fn) orelse { if (cc) |fnCC| { if (fnCC == .Extern) { putBackToken(it, fnCC.Extern); // 'extern' is also used in ContainerDecl } else { try tree.errors.push(AstError{ .ExpectedToken = .{ .token = it.index, .expected_id = .Keyword_fn }, }); return error.ParseError; } } return null; }; const name_token = eatToken(it, .Identifier); const lparen = try expectToken(it, tree, .LParen); const params = try parseParamDeclList(arena, it, tree); const rparen = try expectToken(it, tree, .RParen); const align_expr = try parseByteAlign(arena, it, tree); const section_expr = try parseLinkSection(arena, it, tree); const callconv_expr = try parseCallconv(arena, it, tree); const exclamation_token = eatToken(it, .Bang); const return_type_expr = (try parseVarType(arena, it, tree)) orelse try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedReturnType = AstError.ExpectedReturnType{ .token = it.index }, }); const return_type = if (exclamation_token != null) Node.FnProto.ReturnType{ .InferErrorSet = return_type_expr, } else Node.FnProto.ReturnType{ .Explicit = return_type_expr, }; const var_args_token = if (params.len > 0) params.at(params.len - 1).*.cast(Node.ParamDecl).?.var_args_token else null; const fn_proto_node = try arena.create(Node.FnProto); fn_proto_node.* = Node.FnProto{ .doc_comments = null, .visib_token = null, .fn_token = fn_token, .name_token = name_token, .params = params, .return_type = return_type, .var_args_token = var_args_token, .extern_export_inline_token = null, .cc_token = null, .body_node = null, .lib_name = null, .align_expr = align_expr, .section_expr = section_expr, .callconv_expr = callconv_expr, }; if (cc) |kind| { switch (kind) { .CC => |token| fn_proto_node.cc_token = token, .Extern => |token| fn_proto_node.extern_export_inline_token = token, } } return &fn_proto_node.base; } /// VarDecl <- (KEYWORD_const / KEYWORD_var) IDENTIFIER (COLON TypeExpr)? ByteAlign? LinkSection? (EQUAL Expr)? SEMICOLON fn parseVarDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const mut_token = eatToken(it, .Keyword_const) orelse eatToken(it, .Keyword_var) orelse return null; const name_token = try expectToken(it, tree, .Identifier); const type_node = if (eatToken(it, .Colon) != null) try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }) else null; const align_node = try parseByteAlign(arena, it, tree); const section_node = try parseLinkSection(arena, it, tree); const eq_token = eatToken(it, .Equal); const init_node = if (eq_token != null) blk: { break :blk try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); } else null; const semicolon_token = try expectToken(it, tree, .Semicolon); const node = try arena.create(Node.VarDecl); node.* = Node.VarDecl{ .doc_comments = null, .visib_token = null, .thread_local_token = null, .name_token = name_token, .eq_token = eq_token, .mut_token = mut_token, .comptime_token = null, .extern_export_token = null, .lib_name = null, .type_node = type_node, .align_node = align_node, .section_node = section_node, .init_node = init_node, .semicolon_token = semicolon_token, }; return &node.base; } /// ContainerField <- KEYWORD_comptime? IDENTIFIER (COLON TypeExpr ByteAlign?)? (EQUAL Expr)? fn parseContainerField(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const comptime_token = eatToken(it, .Keyword_comptime); const name_token = eatToken(it, .Identifier) orelse { if (comptime_token) |t| putBackToken(it, t); return null; }; var align_expr: ?*Node = null; var type_expr: ?*Node = null; if (eatToken(it, .Colon)) |_| { if (eatToken(it, .Keyword_var)) |var_tok| { const node = try arena.create(ast.Node.VarType); node.* = .{ .token = var_tok }; type_expr = &node.base; } else { type_expr = try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }); align_expr = try parseByteAlign(arena, it, tree); } } const value_expr = if (eatToken(it, .Equal)) |_| try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }) else null; const node = try arena.create(Node.ContainerField); node.* = Node.ContainerField{ .doc_comments = null, .comptime_token = comptime_token, .name_token = name_token, .type_expr = type_expr, .value_expr = value_expr, .align_expr = align_expr, }; return &node.base; } /// Statement /// <- KEYWORD_comptime? VarDecl /// / KEYWORD_comptime BlockExprStatement /// / KEYWORD_noasync BlockExprStatement /// / KEYWORD_suspend (SEMICOLON / BlockExprStatement) /// / KEYWORD_defer BlockExprStatement /// / KEYWORD_errdefer BlockExprStatement /// / IfStatement /// / LabeledStatement /// / SwitchExpr /// / AssignExpr SEMICOLON fn parseStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*Node { const comptime_token = eatToken(it, .Keyword_comptime); const var_decl_node = try parseVarDecl(arena, it, tree); if (var_decl_node) |node| { const var_decl = node.cast(Node.VarDecl).?; var_decl.comptime_token = comptime_token; return node; } if (comptime_token) |token| { const block_expr = try expectNode(arena, it, tree, parseBlockExprStatement, AstError{ .ExpectedBlockOrAssignment = AstError.ExpectedBlockOrAssignment{ .token = it.index }, }); const node = try arena.create(Node.Comptime); node.* = Node.Comptime{ .doc_comments = null, .comptime_token = token, .expr = block_expr, }; return &node.base; } if (eatToken(it, .Keyword_noasync)) |noasync_token| { const block_expr = try expectNode(arena, it, tree, parseBlockExprStatement, .{ .ExpectedBlockOrAssignment = .{ .token = it.index }, }); const node = try arena.create(Node.Noasync); node.* = .{ .noasync_token = noasync_token, .expr = block_expr, }; return &node.base; } if (eatToken(it, .Keyword_suspend)) |suspend_token| { const semicolon = eatToken(it, .Semicolon); const body_node = if (semicolon == null) blk: { break :blk try expectNode(arena, it, tree, parseBlockExprStatement, AstError{ .ExpectedBlockOrExpression = AstError.ExpectedBlockOrExpression{ .token = it.index }, }); } else null; const node = try arena.create(Node.Suspend); node.* = Node.Suspend{ .suspend_token = suspend_token, .body = body_node, }; return &node.base; } const defer_token = eatToken(it, .Keyword_defer) orelse eatToken(it, .Keyword_errdefer); if (defer_token) |token| { const expr_node = try expectNode(arena, it, tree, parseBlockExprStatement, AstError{ .ExpectedBlockOrExpression = AstError.ExpectedBlockOrExpression{ .token = it.index }, }); const node = try arena.create(Node.Defer); node.* = Node.Defer{ .defer_token = token, .expr = expr_node, }; return &node.base; } if (try parseIfStatement(arena, it, tree)) |node| return node; if (try parseLabeledStatement(arena, it, tree)) |node| return node; if (try parseSwitchExpr(arena, it, tree)) |node| return node; if (try parseAssignExpr(arena, it, tree)) |node| { _ = try expectToken(it, tree, .Semicolon); return node; } return null; } /// IfStatement /// <- IfPrefix BlockExpr ( KEYWORD_else Payload? Statement )? /// / IfPrefix AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement ) fn parseIfStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const if_node = (try parseIfPrefix(arena, it, tree)) orelse return null; const if_prefix = if_node.cast(Node.If).?; const block_expr = (try parseBlockExpr(arena, it, tree)); const assign_expr = if (block_expr == null) blk: { break :blk (try parseAssignExpr(arena, it, tree)) orelse null; } else null; if (block_expr == null and assign_expr == null) { try tree.errors.push(AstError{ .ExpectedBlockOrAssignment = AstError.ExpectedBlockOrAssignment{ .token = it.index }, }); return error.ParseError; } const semicolon = if (assign_expr != null) eatToken(it, .Semicolon) else null; const else_node = if (semicolon == null) blk: { const else_token = eatToken(it, .Keyword_else) orelse break :blk null; const payload = try parsePayload(arena, it, tree); const else_body = try expectNode(arena, it, tree, parseStatement, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); const node = try arena.create(Node.Else); node.* = Node.Else{ .else_token = else_token, .payload = payload, .body = else_body, }; break :blk node; } else null; if (block_expr) |body| { if_prefix.body = body; if_prefix.@"else" = else_node; return if_node; } if (assign_expr) |body| { if_prefix.body = body; if (semicolon != null) return if_node; if (else_node != null) { if_prefix.@"else" = else_node; return if_node; } try tree.errors.push(AstError{ .ExpectedSemiOrElse = AstError.ExpectedSemiOrElse{ .token = it.index }, }); return error.ParseError; } unreachable; } /// LabeledStatement <- BlockLabel? (Block / LoopStatement) fn parseLabeledStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { var colon: TokenIndex = undefined; const label_token = parseBlockLabel(arena, it, tree, &colon); if (try parseBlock(arena, it, tree)) |node| { node.cast(Node.Block).?.label = label_token; return node; } if (try parseLoopStatement(arena, it, tree)) |node| { if (node.cast(Node.For)) |for_node| { for_node.label = label_token; } else if (node.cast(Node.While)) |while_node| { while_node.label = label_token; } else unreachable; return node; } if (label_token != null) { try tree.errors.push(AstError{ .ExpectedLabelable = AstError.ExpectedLabelable{ .token = it.index }, }); return error.ParseError; } return null; } /// LoopStatement <- KEYWORD_inline? (ForStatement / WhileStatement) fn parseLoopStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const inline_token = eatToken(it, .Keyword_inline); if (try parseForStatement(arena, it, tree)) |node| { node.cast(Node.For).?.inline_token = inline_token; return node; } if (try parseWhileStatement(arena, it, tree)) |node| { node.cast(Node.While).?.inline_token = inline_token; return node; } return null; } /// ForStatement /// <- ForPrefix BlockExpr ( KEYWORD_else Statement )? /// / ForPrefix AssignExpr ( SEMICOLON / KEYWORD_else Statement ) fn parseForStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseForPrefix(arena, it, tree)) orelse return null; const for_prefix = node.cast(Node.For).?; if (try parseBlockExpr(arena, it, tree)) |block_expr_node| { for_prefix.body = block_expr_node; if (eatToken(it, .Keyword_else)) |else_token| { const statement_node = try expectNode(arena, it, tree, parseStatement, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = null, .body = statement_node, }; for_prefix.@"else" = else_node; return node; } return node; } if (try parseAssignExpr(arena, it, tree)) |assign_expr| { for_prefix.body = assign_expr; if (eatToken(it, .Semicolon) != null) return node; if (eatToken(it, .Keyword_else)) |else_token| { const statement_node = try expectNode(arena, it, tree, parseStatement, AstError{ .ExpectedStatement = AstError.ExpectedStatement{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = null, .body = statement_node, }; for_prefix.@"else" = else_node; return node; } try tree.errors.push(AstError{ .ExpectedSemiOrElse = AstError.ExpectedSemiOrElse{ .token = it.index }, }); return null; } return null; } /// WhileStatement /// <- WhilePrefix BlockExpr ( KEYWORD_else Payload? Statement )? /// / WhilePrefix AssignExpr ( SEMICOLON / KEYWORD_else Payload? Statement ) fn parseWhileStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseWhilePrefix(arena, it, tree)) orelse return null; const while_prefix = node.cast(Node.While).?; if (try parseBlockExpr(arena, it, tree)) |block_expr_node| { while_prefix.body = block_expr_node; if (eatToken(it, .Keyword_else)) |else_token| { const payload = try parsePayload(arena, it, tree); const statement_node = try expectNode(arena, it, tree, parseStatement, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = payload, .body = statement_node, }; while_prefix.@"else" = else_node; return node; } return node; } if (try parseAssignExpr(arena, it, tree)) |assign_expr_node| { while_prefix.body = assign_expr_node; if (eatToken(it, .Semicolon) != null) return node; if (eatToken(it, .Keyword_else)) |else_token| { const payload = try parsePayload(arena, it, tree); const statement_node = try expectNode(arena, it, tree, parseStatement, AstError{ .ExpectedStatement = AstError.ExpectedStatement{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = payload, .body = statement_node, }; while_prefix.@"else" = else_node; return node; } try tree.errors.push(AstError{ .ExpectedSemiOrElse = AstError.ExpectedSemiOrElse{ .token = it.index }, }); return null; } return null; } /// BlockExprStatement /// <- BlockExpr /// / AssignExpr SEMICOLON fn parseBlockExprStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { if (try parseBlockExpr(arena, it, tree)) |node| return node; if (try parseAssignExpr(arena, it, tree)) |node| { _ = try expectToken(it, tree, .Semicolon); return node; } return null; } /// BlockExpr <- BlockLabel? Block fn parseBlockExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*Node { var colon: TokenIndex = undefined; const label_token = parseBlockLabel(arena, it, tree, &colon); const block_node = (try parseBlock(arena, it, tree)) orelse { if (label_token) |label| { putBackToken(it, label + 1); // ":" putBackToken(it, label); // IDENTIFIER } return null; }; block_node.cast(Node.Block).?.label = label_token; return block_node; } /// AssignExpr <- Expr (AssignOp Expr)? fn parseAssignExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr(arena, it, tree, parseAssignOp, parseExpr, .Once); } /// Expr <- KEYWORD_try* BoolOrExpr fn parseExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*Node { return parsePrefixOpExpr(arena, it, tree, parseTry, parseBoolOrExpr); } /// BoolOrExpr <- BoolAndExpr (KEYWORD_or BoolAndExpr)* fn parseBoolOrExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr( arena, it, tree, SimpleBinOpParseFn(.Keyword_or, Node.InfixOp.Op.BoolOr), parseBoolAndExpr, .Infinitely, ); } /// BoolAndExpr <- CompareExpr (KEYWORD_and CompareExpr)* fn parseBoolAndExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr( arena, it, tree, SimpleBinOpParseFn(.Keyword_and, .BoolAnd), parseCompareExpr, .Infinitely, ); } /// CompareExpr <- BitwiseExpr (CompareOp BitwiseExpr)? fn parseCompareExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr(arena, it, tree, parseCompareOp, parseBitwiseExpr, .Once); } /// BitwiseExpr <- BitShiftExpr (BitwiseOp BitShiftExpr)* fn parseBitwiseExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr(arena, it, tree, parseBitwiseOp, parseBitShiftExpr, .Infinitely); } /// BitShiftExpr <- AdditionExpr (BitShiftOp AdditionExpr)* fn parseBitShiftExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr(arena, it, tree, parseBitShiftOp, parseAdditionExpr, .Infinitely); } /// AdditionExpr <- MultiplyExpr (AdditionOp MultiplyExpr)* fn parseAdditionExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr(arena, it, tree, parseAdditionOp, parseMultiplyExpr, .Infinitely); } /// MultiplyExpr <- PrefixExpr (MultiplyOp PrefixExpr)* fn parseMultiplyExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseBinOpExpr(arena, it, tree, parseMultiplyOp, parsePrefixExpr, .Infinitely); } /// PrefixExpr <- PrefixOp* PrimaryExpr fn parsePrefixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parsePrefixOpExpr(arena, it, tree, parsePrefixOp, parsePrimaryExpr); } /// PrimaryExpr /// <- AsmExpr /// / IfExpr /// / KEYWORD_break BreakLabel? Expr? /// / KEYWORD_comptime Expr /// / KEYWORD_noasync Expr /// / KEYWORD_continue BreakLabel? /// / KEYWORD_resume Expr /// / KEYWORD_return Expr? /// / BlockLabel? LoopExpr /// / Block /// / CurlySuffixExpr fn parsePrimaryExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { if (try parseAsmExpr(arena, it, tree)) |node| return node; if (try parseIfExpr(arena, it, tree)) |node| return node; if (eatToken(it, .Keyword_break)) |token| { const label = try parseBreakLabel(arena, it, tree); const expr_node = try parseExpr(arena, it, tree); const node = try arena.create(Node.ControlFlowExpression); node.* = .{ .ltoken = token, .kind = Node.ControlFlowExpression.Kind{ .Break = label }, .rhs = expr_node, }; return &node.base; } if (eatToken(it, .Keyword_comptime)) |token| { const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const node = try arena.create(Node.Comptime); node.* = .{ .doc_comments = null, .comptime_token = token, .expr = expr_node, }; return &node.base; } if (eatToken(it, .Keyword_noasync)) |token| { const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const node = try arena.create(Node.Noasync); node.* = .{ .noasync_token = token, .expr = expr_node, }; return &node.base; } if (eatToken(it, .Keyword_continue)) |token| { const label = try parseBreakLabel(arena, it, tree); const node = try arena.create(Node.ControlFlowExpression); node.* = .{ .ltoken = token, .kind = Node.ControlFlowExpression.Kind{ .Continue = label }, .rhs = null, }; return &node.base; } if (eatToken(it, .Keyword_resume)) |token| { const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const node = try arena.create(Node.PrefixOp); node.* = .{ .op_token = token, .op = Node.PrefixOp.Op.Resume, .rhs = expr_node, }; return &node.base; } if (eatToken(it, .Keyword_return)) |token| { const expr_node = try parseExpr(arena, it, tree); const node = try arena.create(Node.ControlFlowExpression); node.* = .{ .ltoken = token, .kind = Node.ControlFlowExpression.Kind.Return, .rhs = expr_node, }; return &node.base; } var colon: TokenIndex = undefined; const label = parseBlockLabel(arena, it, tree, &colon); if (try parseLoopExpr(arena, it, tree)) |node| { if (node.cast(Node.For)) |for_node| { for_node.label = label; } else if (node.cast(Node.While)) |while_node| { while_node.label = label; } else unreachable; return node; } if (label) |token| { putBackToken(it, token + 1); // ":" putBackToken(it, token); // IDENTIFIER } if (try parseBlock(arena, it, tree)) |node| return node; if (try parseCurlySuffixExpr(arena, it, tree)) |node| return node; return null; } /// IfExpr <- IfPrefix Expr (KEYWORD_else Payload? Expr)? fn parseIfExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseIf(arena, it, tree, parseExpr); } /// Block <- LBRACE Statement* RBRACE fn parseBlock(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const lbrace = eatToken(it, .LBrace) orelse return null; var statements = Node.Block.StatementList.init(arena); while (true) { const statement = (try parseStatement(arena, it, tree)) orelse break; try statements.push(statement); } const rbrace = try expectToken(it, tree, .RBrace); const block_node = try arena.create(Node.Block); block_node.* = Node.Block{ .label = null, .lbrace = lbrace, .statements = statements, .rbrace = rbrace, }; return &block_node.base; } /// LoopExpr <- KEYWORD_inline? (ForExpr / WhileExpr) fn parseLoopExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const inline_token = eatToken(it, .Keyword_inline); if (try parseForExpr(arena, it, tree)) |node| { node.cast(Node.For).?.inline_token = inline_token; return node; } if (try parseWhileExpr(arena, it, tree)) |node| { node.cast(Node.While).?.inline_token = inline_token; return node; } if (inline_token == null) return null; // If we've seen "inline", there should have been a "for" or "while" try tree.errors.push(AstError{ .ExpectedInlinable = AstError.ExpectedInlinable{ .token = it.index }, }); return error.ParseError; } /// ForExpr <- ForPrefix Expr (KEYWORD_else Expr)? fn parseForExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseForPrefix(arena, it, tree)) orelse return null; const for_prefix = node.cast(Node.For).?; const body_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); for_prefix.body = body_node; if (eatToken(it, .Keyword_else)) |else_token| { const body = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = null, .body = body, }; for_prefix.@"else" = else_node; } return node; } /// WhileExpr <- WhilePrefix Expr (KEYWORD_else Payload? Expr)? fn parseWhileExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseWhilePrefix(arena, it, tree)) orelse return null; const while_prefix = node.cast(Node.While).?; const body_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); while_prefix.body = body_node; if (eatToken(it, .Keyword_else)) |else_token| { const payload = try parsePayload(arena, it, tree); const body = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = payload, .body = body, }; while_prefix.@"else" = else_node; } return node; } /// CurlySuffixExpr <- TypeExpr InitList? fn parseCurlySuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const type_expr = (try parseTypeExpr(arena, it, tree)) orelse return null; const suffix_op = (try parseInitList(arena, it, tree)) orelse return type_expr; suffix_op.lhs.node = type_expr; return &suffix_op.base; } /// InitList /// <- LBRACE FieldInit (COMMA FieldInit)* COMMA? RBRACE /// / LBRACE Expr (COMMA Expr)* COMMA? RBRACE /// / LBRACE RBRACE fn parseInitList(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node.SuffixOp { const lbrace = eatToken(it, .LBrace) orelse return null; var init_list = Node.SuffixOp.Op.InitList.init(arena); const op = blk: { if (try parseFieldInit(arena, it, tree)) |field_init| { try init_list.push(field_init); while (eatToken(it, .Comma)) |_| { const next = (try parseFieldInit(arena, it, tree)) orelse break; try init_list.push(next); } break :blk Node.SuffixOp.Op{ .StructInitializer = init_list }; } if (try parseExpr(arena, it, tree)) |expr| { try init_list.push(expr); while (eatToken(it, .Comma)) |_| { const next = (try parseExpr(arena, it, tree)) orelse break; try init_list.push(next); } break :blk Node.SuffixOp.Op{ .ArrayInitializer = init_list }; } break :blk Node.SuffixOp.Op{ .StructInitializer = init_list }; }; const node = try arena.create(Node.SuffixOp); node.* = Node.SuffixOp{ .lhs = .{ .node = undefined }, // set by caller .op = op, .rtoken = try expectToken(it, tree, .RBrace), }; return node; } /// TypeExpr <- PrefixTypeOp* ErrorUnionExpr fn parseTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*Node { return parsePrefixOpExpr(arena, it, tree, parsePrefixTypeOp, parseErrorUnionExpr); } /// ErrorUnionExpr <- SuffixExpr (EXCLAMATIONMARK TypeExpr)? fn parseErrorUnionExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const suffix_expr = (try parseSuffixExpr(arena, it, tree)) orelse return null; if (try SimpleBinOpParseFn(.Bang, Node.InfixOp.Op.ErrorUnion)(arena, it, tree)) |node| { const error_union = node.cast(Node.InfixOp).?; const type_expr = try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }); error_union.lhs = suffix_expr; error_union.rhs = type_expr; return node; } return suffix_expr; } /// SuffixExpr /// <- KEYWORD_async PrimaryTypeExpr SuffixOp* FnCallArguments /// / PrimaryTypeExpr (SuffixOp / FnCallArguments)* fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const maybe_async = eatToken(it, .Keyword_async); if (maybe_async) |async_token| { const token_fn = eatToken(it, .Keyword_fn); if (token_fn != null) { // HACK: If we see the keyword `fn`, then we assume that // we are parsing an async fn proto, and not a call. // We therefore put back all tokens consumed by the async // prefix... putBackToken(it, token_fn.?); putBackToken(it, async_token); return parsePrimaryTypeExpr(arena, it, tree); } // TODO: Implement hack for parsing `async fn ...` in ast_parse_suffix_expr var res = try expectNode(arena, it, tree, parsePrimaryTypeExpr, AstError{ .ExpectedPrimaryTypeExpr = AstError.ExpectedPrimaryTypeExpr{ .token = it.index }, }); while (try parseSuffixOp(arena, it, tree)) |node| { switch (node.id) { .SuffixOp => node.cast(Node.SuffixOp).?.lhs = .{ .node = res }, .InfixOp => node.cast(Node.InfixOp).?.lhs = res, else => unreachable, } res = node; } const params = (try parseFnCallArguments(arena, it, tree)) orelse { try tree.errors.push(AstError{ .ExpectedParamList = AstError.ExpectedParamList{ .token = it.index }, }); return null; }; const node = try arena.create(Node.SuffixOp); node.* = Node.SuffixOp{ .lhs = .{ .node = res }, .op = Node.SuffixOp.Op{ .Call = Node.SuffixOp.Op.Call{ .params = params.list, .async_token = async_token, }, }, .rtoken = params.rparen, }; return &node.base; } if (try parsePrimaryTypeExpr(arena, it, tree)) |expr| { var res = expr; while (true) { if (try parseSuffixOp(arena, it, tree)) |node| { switch (node.id) { .SuffixOp => node.cast(Node.SuffixOp).?.lhs = .{ .node = res }, .InfixOp => node.cast(Node.InfixOp).?.lhs = res, else => unreachable, } res = node; continue; } if (try parseFnCallArguments(arena, it, tree)) |params| { const call = try arena.create(Node.SuffixOp); call.* = Node.SuffixOp{ .lhs = .{ .node = res }, .op = Node.SuffixOp.Op{ .Call = Node.SuffixOp.Op.Call{ .params = params.list, .async_token = null, }, }, .rtoken = params.rparen, }; res = &call.base; continue; } break; } return res; } return null; } /// PrimaryTypeExpr /// <- BUILTINIDENTIFIER FnCallArguments /// / CHAR_LITERAL /// / ContainerDecl /// / DOT IDENTIFIER /// / ErrorSetDecl /// / FLOAT /// / FnProto /// / GroupedExpr /// / LabeledTypeExpr /// / IDENTIFIER /// / IfTypeExpr /// / INTEGER /// / KEYWORD_comptime TypeExpr /// / KEYWORD_noasync TypeExpr /// / KEYWORD_error DOT IDENTIFIER /// / KEYWORD_false /// / KEYWORD_null /// / KEYWORD_anyframe /// / KEYWORD_true /// / KEYWORD_undefined /// / KEYWORD_unreachable /// / STRINGLITERAL /// / SwitchExpr fn parsePrimaryTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { if (try parseBuiltinCall(arena, it, tree)) |node| return node; if (eatToken(it, .CharLiteral)) |token| { const node = try arena.create(Node.CharLiteral); node.* = Node.CharLiteral{ .token = token, }; return &node.base; } if (try parseContainerDecl(arena, it, tree)) |node| return node; if (try parseAnonLiteral(arena, it, tree)) |node| return node; if (try parseErrorSetDecl(arena, it, tree)) |node| return node; if (try parseFloatLiteral(arena, it, tree)) |node| return node; if (try parseFnProto(arena, it, tree)) |node| return node; if (try parseGroupedExpr(arena, it, tree)) |node| return node; if (try parseLabeledTypeExpr(arena, it, tree)) |node| return node; if (try parseIdentifier(arena, it, tree)) |node| return node; if (try parseIfTypeExpr(arena, it, tree)) |node| return node; if (try parseIntegerLiteral(arena, it, tree)) |node| return node; if (eatToken(it, .Keyword_comptime)) |token| { const expr = (try parseTypeExpr(arena, it, tree)) orelse return null; const node = try arena.create(Node.Comptime); node.* = .{ .doc_comments = null, .comptime_token = token, .expr = expr, }; return &node.base; } if (eatToken(it, .Keyword_noasync)) |token| { const expr = (try parseTypeExpr(arena, it, tree)) orelse return null; const node = try arena.create(Node.Noasync); node.* = .{ .noasync_token = token, .expr = expr, }; return &node.base; } if (eatToken(it, .Keyword_error)) |token| { const period = try expectToken(it, tree, .Period); const identifier = try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); const global_error_set = try createLiteral(arena, Node.ErrorType, token); const node = try arena.create(Node.InfixOp); node.* = .{ .op_token = period, .lhs = global_error_set, .op = Node.InfixOp.Op.Period, .rhs = identifier, }; return &node.base; } if (eatToken(it, .Keyword_false)) |token| return createLiteral(arena, Node.BoolLiteral, token); if (eatToken(it, .Keyword_null)) |token| return createLiteral(arena, Node.NullLiteral, token); if (eatToken(it, .Keyword_anyframe)) |token| { const node = try arena.create(Node.AnyFrameType); node.* = .{ .anyframe_token = token, .result = null, }; return &node.base; } if (eatToken(it, .Keyword_true)) |token| return createLiteral(arena, Node.BoolLiteral, token); if (eatToken(it, .Keyword_undefined)) |token| return createLiteral(arena, Node.UndefinedLiteral, token); if (eatToken(it, .Keyword_unreachable)) |token| return createLiteral(arena, Node.Unreachable, token); if (try parseStringLiteral(arena, it, tree)) |node| return node; if (try parseSwitchExpr(arena, it, tree)) |node| return node; return null; } /// ContainerDecl <- (KEYWORD_extern / KEYWORD_packed)? ContainerDeclAuto fn parseContainerDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const layout_token = eatToken(it, .Keyword_extern) orelse eatToken(it, .Keyword_packed); const node = (try parseContainerDeclAuto(arena, it, tree)) orelse { if (layout_token) |token| putBackToken(it, token); return null; }; node.cast(Node.ContainerDecl).?.*.layout_token = layout_token; return node; } /// ErrorSetDecl <- KEYWORD_error LBRACE IdentifierList RBRACE fn parseErrorSetDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const error_token = eatToken(it, .Keyword_error) orelse return null; if (eatToken(it, .LBrace) == null) { // Might parse as `KEYWORD_error DOT IDENTIFIER` later in PrimaryTypeExpr, so don't error putBackToken(it, error_token); return null; } const decls = try parseErrorTagList(arena, it, tree); const rbrace = try expectToken(it, tree, .RBrace); const node = try arena.create(Node.ErrorSetDecl); node.* = Node.ErrorSetDecl{ .error_token = error_token, .decls = decls, .rbrace_token = rbrace, }; return &node.base; } /// GroupedExpr <- LPAREN Expr RPAREN fn parseGroupedExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const lparen = eatToken(it, .LParen) orelse return null; const expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const rparen = try expectToken(it, tree, .RParen); const node = try arena.create(Node.GroupedExpression); node.* = Node.GroupedExpression{ .lparen = lparen, .expr = expr, .rparen = rparen, }; return &node.base; } /// IfTypeExpr <- IfPrefix TypeExpr (KEYWORD_else Payload? TypeExpr)? fn parseIfTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { return parseIf(arena, it, tree, parseTypeExpr); } /// LabeledTypeExpr /// <- BlockLabel Block /// / BlockLabel? LoopTypeExpr fn parseLabeledTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { var colon: TokenIndex = undefined; const label = parseBlockLabel(arena, it, tree, &colon); if (label) |token| { if (try parseBlock(arena, it, tree)) |node| { node.cast(Node.Block).?.label = token; return node; } } if (try parseLoopTypeExpr(arena, it, tree)) |node| { switch (node.id) { .For => node.cast(Node.For).?.label = label, .While => node.cast(Node.While).?.label = label, else => unreachable, } return node; } if (label) |token| { putBackToken(it, colon); putBackToken(it, token); } return null; } /// LoopTypeExpr <- KEYWORD_inline? (ForTypeExpr / WhileTypeExpr) fn parseLoopTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const inline_token = eatToken(it, .Keyword_inline); if (try parseForTypeExpr(arena, it, tree)) |node| { node.cast(Node.For).?.inline_token = inline_token; return node; } if (try parseWhileTypeExpr(arena, it, tree)) |node| { node.cast(Node.While).?.inline_token = inline_token; return node; } if (inline_token == null) return null; // If we've seen "inline", there should have been a "for" or "while" try tree.errors.push(AstError{ .ExpectedInlinable = AstError.ExpectedInlinable{ .token = it.index }, }); return error.ParseError; } /// ForTypeExpr <- ForPrefix TypeExpr (KEYWORD_else TypeExpr)? fn parseForTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseForPrefix(arena, it, tree)) orelse return null; const for_prefix = node.cast(Node.For).?; const type_expr = try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }); for_prefix.body = type_expr; if (eatToken(it, .Keyword_else)) |else_token| { const else_expr = try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = null, .body = else_expr, }; for_prefix.@"else" = else_node; } return node; } /// WhileTypeExpr <- WhilePrefix TypeExpr (KEYWORD_else Payload? TypeExpr)? fn parseWhileTypeExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseWhilePrefix(arena, it, tree)) orelse return null; const while_prefix = node.cast(Node.While).?; const type_expr = try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }); while_prefix.body = type_expr; if (eatToken(it, .Keyword_else)) |else_token| { const payload = try parsePayload(arena, it, tree); const else_expr = try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = null, .body = else_expr, }; while_prefix.@"else" = else_node; } return node; } /// SwitchExpr <- KEYWORD_switch LPAREN Expr RPAREN LBRACE SwitchProngList RBRACE fn parseSwitchExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const switch_token = eatToken(it, .Keyword_switch) orelse return null; _ = try expectToken(it, tree, .LParen); const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); _ = try expectToken(it, tree, .LBrace); const cases = try parseSwitchProngList(arena, it, tree); const rbrace = try expectToken(it, tree, .RBrace); const node = try arena.create(Node.Switch); node.* = Node.Switch{ .switch_token = switch_token, .expr = expr_node, .cases = cases, .rbrace = rbrace, }; return &node.base; } /// AsmExpr <- KEYWORD_asm KEYWORD_volatile? LPAREN Expr AsmOutput? RPAREN fn parseAsmExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const asm_token = eatToken(it, .Keyword_asm) orelse return null; const volatile_token = eatToken(it, .Keyword_volatile); _ = try expectToken(it, tree, .LParen); const template = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const node = try arena.create(Node.Asm); node.* = Node.Asm{ .asm_token = asm_token, .volatile_token = volatile_token, .template = template, .outputs = Node.Asm.OutputList.init(arena), .inputs = Node.Asm.InputList.init(arena), .clobbers = Node.Asm.ClobberList.init(arena), .rparen = undefined, }; try parseAsmOutput(arena, it, tree, node); node.rparen = try expectToken(it, tree, .RParen); return &node.base; } /// DOT IDENTIFIER fn parseAnonLiteral(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const dot = eatToken(it, .Period) orelse return null; // anon enum literal if (eatToken(it, .Identifier)) |name| { const node = try arena.create(Node.EnumLiteral); node.* = Node.EnumLiteral{ .dot = dot, .name = name, }; return &node.base; } // anon container literal if (try parseInitList(arena, it, tree)) |node| { node.lhs = .{ .dot = dot }; return &node.base; } putBackToken(it, dot); return null; } /// AsmOutput <- COLON AsmOutputList AsmInput? fn parseAsmOutput(arena: *Allocator, it: *TokenIterator, tree: *Tree, asm_node: *Node.Asm) !void { if (eatToken(it, .Colon) == null) return; asm_node.outputs = try parseAsmOutputList(arena, it, tree); try parseAsmInput(arena, it, tree, asm_node); } /// AsmOutputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERAL LPAREN (MINUSRARROW TypeExpr / IDENTIFIER) RPAREN fn parseAsmOutputItem(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node.AsmOutput { const lbracket = eatToken(it, .LBracket) orelse return null; const name = try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); _ = try expectToken(it, tree, .RBracket); const constraint = try expectNode(arena, it, tree, parseStringLiteral, AstError{ .ExpectedStringLiteral = AstError.ExpectedStringLiteral{ .token = it.index }, }); _ = try expectToken(it, tree, .LParen); const kind = blk: { if (eatToken(it, .Arrow) != null) { const return_ident = try expectNode(arena, it, tree, parseTypeExpr, AstError{ .ExpectedTypeExpr = AstError.ExpectedTypeExpr{ .token = it.index }, }); break :blk Node.AsmOutput.Kind{ .Return = return_ident }; } const variable = try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); break :blk Node.AsmOutput.Kind{ .Variable = variable.cast(Node.Identifier).? }; }; const rparen = try expectToken(it, tree, .RParen); const node = try arena.create(Node.AsmOutput); node.* = Node.AsmOutput{ .lbracket = lbracket, .symbolic_name = name, .constraint = constraint, .kind = kind, .rparen = rparen, }; return node; } /// AsmInput <- COLON AsmInputList AsmClobbers? fn parseAsmInput(arena: *Allocator, it: *TokenIterator, tree: *Tree, asm_node: *Node.Asm) !void { if (eatToken(it, .Colon) == null) return; asm_node.inputs = try parseAsmInputList(arena, it, tree); try parseAsmClobbers(arena, it, tree, asm_node); } /// AsmInputItem <- LBRACKET IDENTIFIER RBRACKET STRINGLITERAL LPAREN Expr RPAREN fn parseAsmInputItem(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node.AsmInput { const lbracket = eatToken(it, .LBracket) orelse return null; const name = try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); _ = try expectToken(it, tree, .RBracket); const constraint = try expectNode(arena, it, tree, parseStringLiteral, AstError{ .ExpectedStringLiteral = AstError.ExpectedStringLiteral{ .token = it.index }, }); _ = try expectToken(it, tree, .LParen); const expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const rparen = try expectToken(it, tree, .RParen); const node = try arena.create(Node.AsmInput); node.* = Node.AsmInput{ .lbracket = lbracket, .symbolic_name = name, .constraint = constraint, .expr = expr, .rparen = rparen, }; return node; } /// AsmClobbers <- COLON StringList /// StringList <- (STRINGLITERAL COMMA)* STRINGLITERAL? fn parseAsmClobbers(arena: *Allocator, it: *TokenIterator, tree: *Tree, asm_node: *Node.Asm) !void { if (eatToken(it, .Colon) == null) return; asm_node.clobbers = try ListParseFn( Node.Asm.ClobberList, parseStringLiteral, )(arena, it, tree); } /// BreakLabel <- COLON IDENTIFIER fn parseBreakLabel(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { _ = eatToken(it, .Colon) orelse return null; return try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); } /// BlockLabel <- IDENTIFIER COLON fn parseBlockLabel(arena: *Allocator, it: *TokenIterator, tree: *Tree, colon_token: *TokenIndex) ?TokenIndex { const identifier = eatToken(it, .Identifier) orelse return null; if (eatToken(it, .Colon)) |colon| { colon_token.* = colon; return identifier; } putBackToken(it, identifier); return null; } /// FieldInit <- DOT IDENTIFIER EQUAL Expr fn parseFieldInit(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const period_token = eatToken(it, .Period) orelse return null; const name_token = eatToken(it, .Identifier) orelse { // Because of anon literals `.{` is also valid. putBackToken(it, period_token); return null; }; const eq_token = eatToken(it, .Equal) orelse { // `.Name` may also be an enum literal, which is a later rule. putBackToken(it, name_token); putBackToken(it, period_token); return null; }; const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const node = try arena.create(Node.FieldInitializer); node.* = Node.FieldInitializer{ .period_token = period_token, .name_token = name_token, .expr = expr_node, }; return &node.base; } /// WhileContinueExpr <- COLON LPAREN AssignExpr RPAREN fn parseWhileContinueExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { _ = eatToken(it, .Colon) orelse return null; _ = try expectToken(it, tree, .LParen); const node = try expectNode(arena, it, tree, parseAssignExpr, AstError{ .ExpectedExprOrAssignment = AstError.ExpectedExprOrAssignment{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); return node; } /// LinkSection <- KEYWORD_linksection LPAREN Expr RPAREN fn parseLinkSection(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { _ = eatToken(it, .Keyword_linksection) orelse return null; _ = try expectToken(it, tree, .LParen); const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); return expr_node; } /// CallConv <- KEYWORD_callconv LPAREN Expr RPAREN fn parseCallconv(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { _ = eatToken(it, .Keyword_callconv) orelse return null; _ = try expectToken(it, tree, .LParen); const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); return expr_node; } /// FnCC /// <- KEYWORD_nakedcc /// / KEYWORD_stdcallcc /// / KEYWORD_extern /// / KEYWORD_async fn parseFnCC(arena: *Allocator, it: *TokenIterator, tree: *Tree) ?FnCC { if (eatToken(it, .Keyword_nakedcc)) |token| return FnCC{ .CC = token }; if (eatToken(it, .Keyword_stdcallcc)) |token| return FnCC{ .CC = token }; if (eatToken(it, .Keyword_extern)) |token| return FnCC{ .Extern = token }; if (eatToken(it, .Keyword_async)) |token| return FnCC{ .CC = token }; return null; } const FnCC = union(enum) { CC: TokenIndex, Extern: TokenIndex, }; /// ParamDecl <- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType fn parseParamDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const doc_comments = try parseDocComment(arena, it, tree); const noalias_token = eatToken(it, .Keyword_noalias); const comptime_token = if (noalias_token == null) eatToken(it, .Keyword_comptime) else null; const name_token = blk: { const identifier = eatToken(it, .Identifier) orelse break :blk null; if (eatToken(it, .Colon) != null) break :blk identifier; putBackToken(it, identifier); // ParamType may also be an identifier break :blk null; }; const param_type = (try parseParamType(arena, it, tree)) orelse { // Only return cleanly if no keyword, identifier, or doc comment was found if (noalias_token == null and comptime_token == null and name_token == null and doc_comments == null) return null; try tree.errors.push(AstError{ .ExpectedParamType = AstError.ExpectedParamType{ .token = it.index }, }); return error.ParseError; }; const param_decl = try arena.create(Node.ParamDecl); param_decl.* = Node.ParamDecl{ .doc_comments = doc_comments, .comptime_token = comptime_token, .noalias_token = noalias_token, .name_token = name_token, // TODO: These should be squished into a ParamType enum .type_node = undefined, .var_args_token = null, }; switch (param_type) { .VarType => |node| param_decl.type_node = node, .TypeExpr => |node| param_decl.type_node = node, .VarArgs => |token| param_decl.var_args_token = token, } return &param_decl.base; } /// ParamType /// <- KEYWORD_var /// / DOT3 /// / TypeExpr fn parseParamType(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?ParamType { if (try parseVarType(arena, it, tree)) |node| return ParamType{ .VarType = node }; if (eatToken(it, .Ellipsis3)) |token| return ParamType{ .VarArgs = token }; if (try parseTypeExpr(arena, it, tree)) |node| return ParamType{ .TypeExpr = node }; return null; } // TODO: Move to ast.Node.ParamDecl.ParamType const ParamType = union(enum) { VarType: *Node, VarArgs: TokenIndex, TypeExpr: *Node, }; /// IfPrefix <- KEYWORD_if LPAREN Expr RPAREN PtrPayload? fn parseIfPrefix(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const if_token = eatToken(it, .Keyword_if) orelse return null; _ = try expectToken(it, tree, .LParen); const condition = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); const payload = try parsePtrPayload(arena, it, tree); const node = try arena.create(Node.If); node.* = Node.If{ .if_token = if_token, .condition = condition, .payload = payload, .body = undefined, // set by caller .@"else" = null, }; return &node.base; } /// WhilePrefix <- KEYWORD_while LPAREN Expr RPAREN PtrPayload? WhileContinueExpr? fn parseWhilePrefix(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const while_token = eatToken(it, .Keyword_while) orelse return null; _ = try expectToken(it, tree, .LParen); const condition = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); const payload = try parsePtrPayload(arena, it, tree); const continue_expr = try parseWhileContinueExpr(arena, it, tree); const node = try arena.create(Node.While); node.* = Node.While{ .label = null, .inline_token = null, .while_token = while_token, .condition = condition, .payload = payload, .continue_expr = continue_expr, .body = undefined, // set by caller .@"else" = null, }; return &node.base; } /// ForPrefix <- KEYWORD_for LPAREN Expr RPAREN PtrIndexPayload fn parseForPrefix(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const for_token = eatToken(it, .Keyword_for) orelse return null; _ = try expectToken(it, tree, .LParen); const array_expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); const payload = try expectNode(arena, it, tree, parsePtrIndexPayload, AstError{ .ExpectedPayload = AstError.ExpectedPayload{ .token = it.index }, }); const node = try arena.create(Node.For); node.* = Node.For{ .label = null, .inline_token = null, .for_token = for_token, .array_expr = array_expr, .payload = payload, .body = undefined, // set by caller .@"else" = null, }; return &node.base; } /// Payload <- PIPE IDENTIFIER PIPE fn parsePayload(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const lpipe = eatToken(it, .Pipe) orelse return null; const identifier = try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); const rpipe = try expectToken(it, tree, .Pipe); const node = try arena.create(Node.Payload); node.* = Node.Payload{ .lpipe = lpipe, .error_symbol = identifier, .rpipe = rpipe, }; return &node.base; } /// PtrPayload <- PIPE ASTERISK? IDENTIFIER PIPE fn parsePtrPayload(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const lpipe = eatToken(it, .Pipe) orelse return null; const asterisk = eatToken(it, .Asterisk); const identifier = try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); const rpipe = try expectToken(it, tree, .Pipe); const node = try arena.create(Node.PointerPayload); node.* = Node.PointerPayload{ .lpipe = lpipe, .ptr_token = asterisk, .value_symbol = identifier, .rpipe = rpipe, }; return &node.base; } /// PtrIndexPayload <- PIPE ASTERISK? IDENTIFIER (COMMA IDENTIFIER)? PIPE fn parsePtrIndexPayload(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const lpipe = eatToken(it, .Pipe) orelse return null; const asterisk = eatToken(it, .Asterisk); const identifier = try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); const index = if (eatToken(it, .Comma) == null) null else try expectNode(arena, it, tree, parseIdentifier, AstError{ .ExpectedIdentifier = AstError.ExpectedIdentifier{ .token = it.index }, }); const rpipe = try expectToken(it, tree, .Pipe); const node = try arena.create(Node.PointerIndexPayload); node.* = Node.PointerIndexPayload{ .lpipe = lpipe, .ptr_token = asterisk, .value_symbol = identifier, .index_symbol = index, .rpipe = rpipe, }; return &node.base; } /// SwitchProng <- SwitchCase EQUALRARROW PtrPayload? AssignExpr fn parseSwitchProng(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseSwitchCase(arena, it, tree)) orelse return null; const arrow = try expectToken(it, tree, .EqualAngleBracketRight); const payload = try parsePtrPayload(arena, it, tree); const expr = try expectNode(arena, it, tree, parseAssignExpr, AstError{ .ExpectedExprOrAssignment = AstError.ExpectedExprOrAssignment{ .token = it.index }, }); const switch_case = node.cast(Node.SwitchCase).?; switch_case.arrow_token = arrow; switch_case.payload = payload; switch_case.expr = expr; return node; } /// SwitchCase /// <- SwitchItem (COMMA SwitchItem)* COMMA? /// / KEYWORD_else fn parseSwitchCase(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { var list = Node.SwitchCase.ItemList.init(arena); if (try parseSwitchItem(arena, it, tree)) |first_item| { try list.push(first_item); while (eatToken(it, .Comma) != null) { const next_item = (try parseSwitchItem(arena, it, tree)) orelse break; try list.push(next_item); } } else if (eatToken(it, .Keyword_else)) |else_token| { const else_node = try arena.create(Node.SwitchElse); else_node.* = Node.SwitchElse{ .token = else_token, }; try list.push(&else_node.base); } else return null; const node = try arena.create(Node.SwitchCase); node.* = Node.SwitchCase{ .items = list, .arrow_token = undefined, // set by caller .payload = null, .expr = undefined, // set by caller }; return &node.base; } /// SwitchItem <- Expr (DOT3 Expr)? fn parseSwitchItem(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const expr = (try parseExpr(arena, it, tree)) orelse return null; if (eatToken(it, .Ellipsis3)) |token| { const range_end = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); const node = try arena.create(Node.InfixOp); node.* = Node.InfixOp{ .op_token = token, .lhs = expr, .op = Node.InfixOp.Op{ .Range = {} }, .rhs = range_end, }; return &node.base; } return expr; } /// AssignOp /// <- ASTERISKEQUAL /// / SLASHEQUAL /// / PERCENTEQUAL /// / PLUSEQUAL /// / MINUSEQUAL /// / LARROW2EQUAL /// / RARROW2EQUAL /// / AMPERSANDEQUAL /// / CARETEQUAL /// / PIPEEQUAL /// / ASTERISKPERCENTEQUAL /// / PLUSPERCENTEQUAL /// / MINUSPERCENTEQUAL /// / EQUAL fn parseAssignOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const Op = Node.InfixOp.Op; const token = nextToken(it); const op = switch (token.ptr.id) { .AsteriskEqual => Op{ .AssignMul = {} }, .SlashEqual => Op{ .AssignDiv = {} }, .PercentEqual => Op{ .AssignMod = {} }, .PlusEqual => Op{ .AssignAdd = {} }, .MinusEqual => Op{ .AssignSub = {} }, .AngleBracketAngleBracketLeftEqual => Op{ .AssignBitShiftLeft = {} }, .AngleBracketAngleBracketRightEqual => Op{ .AssignBitShiftRight = {} }, .AmpersandEqual => Op{ .AssignBitAnd = {} }, .CaretEqual => Op{ .AssignBitXor = {} }, .PipeEqual => Op{ .AssignBitOr = {} }, .AsteriskPercentEqual => Op{ .AssignMulWrap = {} }, .PlusPercentEqual => Op{ .AssignAddWrap = {} }, .MinusPercentEqual => Op{ .AssignSubWrap = {} }, .Equal => Op{ .Assign = {} }, else => { putBackToken(it, token.index); return null; }, }; const node = try arena.create(Node.InfixOp); node.* = Node.InfixOp{ .op_token = token.index, .lhs = undefined, // set by caller .op = op, .rhs = undefined, // set by caller }; return &node.base; } /// CompareOp /// <- EQUALEQUAL /// / EXCLAMATIONMARKEQUAL /// / LARROW /// / RARROW /// / LARROWEQUAL /// / RARROWEQUAL fn parseCompareOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const ops = Node.InfixOp.Op; const token = nextToken(it); const op = switch (token.ptr.id) { .EqualEqual => ops{ .EqualEqual = {} }, .BangEqual => ops{ .BangEqual = {} }, .AngleBracketLeft => ops{ .LessThan = {} }, .AngleBracketRight => ops{ .GreaterThan = {} }, .AngleBracketLeftEqual => ops{ .LessOrEqual = {} }, .AngleBracketRightEqual => ops{ .GreaterOrEqual = {} }, else => { putBackToken(it, token.index); return null; }, }; return try createInfixOp(arena, token.index, op); } /// BitwiseOp /// <- AMPERSAND /// / CARET /// / PIPE /// / KEYWORD_orelse /// / KEYWORD_catch Payload? fn parseBitwiseOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const ops = Node.InfixOp.Op; const token = nextToken(it); const op = switch (token.ptr.id) { .Ampersand => ops{ .BitAnd = {} }, .Caret => ops{ .BitXor = {} }, .Pipe => ops{ .BitOr = {} }, .Keyword_orelse => ops{ .UnwrapOptional = {} }, .Keyword_catch => ops{ .Catch = try parsePayload(arena, it, tree) }, else => { putBackToken(it, token.index); return null; }, }; return try createInfixOp(arena, token.index, op); } /// BitShiftOp /// <- LARROW2 /// / RARROW2 fn parseBitShiftOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const ops = Node.InfixOp.Op; const token = nextToken(it); const op = switch (token.ptr.id) { .AngleBracketAngleBracketLeft => ops{ .BitShiftLeft = {} }, .AngleBracketAngleBracketRight => ops{ .BitShiftRight = {} }, else => { putBackToken(it, token.index); return null; }, }; return try createInfixOp(arena, token.index, op); } /// AdditionOp /// <- PLUS /// / MINUS /// / PLUS2 /// / PLUSPERCENT /// / MINUSPERCENT fn parseAdditionOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const ops = Node.InfixOp.Op; const token = nextToken(it); const op = switch (token.ptr.id) { .Plus => ops{ .Add = {} }, .Minus => ops{ .Sub = {} }, .PlusPlus => ops{ .ArrayCat = {} }, .PlusPercent => ops{ .AddWrap = {} }, .MinusPercent => ops{ .SubWrap = {} }, else => { putBackToken(it, token.index); return null; }, }; return try createInfixOp(arena, token.index, op); } /// MultiplyOp /// <- PIPE2 /// / ASTERISK /// / SLASH /// / PERCENT /// / ASTERISK2 /// / ASTERISKPERCENT fn parseMultiplyOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const ops = Node.InfixOp.Op; const token = nextToken(it); const op = switch (token.ptr.id) { .PipePipe => ops{ .BoolOr = {} }, .Asterisk => ops{ .Mul = {} }, .Slash => ops{ .Div = {} }, .Percent => ops{ .Mod = {} }, .AsteriskAsterisk => ops{ .ArrayMult = {} }, .AsteriskPercent => ops{ .MulWrap = {} }, else => { putBackToken(it, token.index); return null; }, }; return try createInfixOp(arena, token.index, op); } /// PrefixOp /// <- EXCLAMATIONMARK /// / MINUS /// / TILDE /// / MINUSPERCENT /// / AMPERSAND /// / KEYWORD_try /// / KEYWORD_await fn parsePrefixOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const ops = Node.PrefixOp.Op; const token = nextToken(it); const op = switch (token.ptr.id) { .Bang => ops{ .BoolNot = {} }, .Minus => ops{ .Negation = {} }, .Tilde => ops{ .BitNot = {} }, .MinusPercent => ops{ .NegationWrap = {} }, .Ampersand => ops{ .AddressOf = {} }, .Keyword_try => ops{ .Try = {} }, .Keyword_await => ops{ .Await = .{} }, else => { putBackToken(it, token.index); return null; }, }; const node = try arena.create(Node.PrefixOp); node.* = Node.PrefixOp{ .op_token = token.index, .op = op, .rhs = undefined, // set by caller }; return &node.base; } // TODO: ArrayTypeStart is either an array or a slice, but const/allowzero only work on // pointers. Consider updating this rule: // ... // / ArrayTypeStart // / SliceTypeStart (ByteAlign / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)* // / PtrTypeStart ... /// PrefixTypeOp /// <- QUESTIONMARK /// / KEYWORD_anyframe MINUSRARROW /// / ArrayTypeStart (ByteAlign / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)* /// / PtrTypeStart (KEYWORD_align LPAREN Expr (COLON INTEGER COLON INTEGER)? RPAREN / KEYWORD_const / KEYWORD_volatile / KEYWORD_allowzero)* fn parsePrefixTypeOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { if (eatToken(it, .QuestionMark)) |token| { const node = try arena.create(Node.PrefixOp); node.* = Node.PrefixOp{ .op_token = token, .op = Node.PrefixOp.Op.OptionalType, .rhs = undefined, // set by caller }; return &node.base; } // TODO: Returning a AnyFrameType instead of PrefixOp makes casting and setting .rhs or // .return_type more difficult for the caller (see parsePrefixOpExpr helper). // Consider making the AnyFrameType a member of PrefixOp and add a // PrefixOp.AnyFrameType variant? if (eatToken(it, .Keyword_anyframe)) |token| { const arrow = eatToken(it, .Arrow) orelse { putBackToken(it, token); return null; }; const node = try arena.create(Node.AnyFrameType); node.* = Node.AnyFrameType{ .anyframe_token = token, .result = Node.AnyFrameType.Result{ .arrow_token = arrow, .return_type = undefined, // set by caller }, }; return &node.base; } if (try parsePtrTypeStart(arena, it, tree)) |node| { // If the token encountered was **, there will be two nodes instead of one. // The attributes should be applied to the rightmost operator. const prefix_op = node.cast(Node.PrefixOp).?; var ptr_info = if (tree.tokens.at(prefix_op.op_token).id == .AsteriskAsterisk) &prefix_op.rhs.cast(Node.PrefixOp).?.op.PtrType else &prefix_op.op.PtrType; while (true) { if (eatToken(it, .Keyword_align)) |align_token| { const lparen = try expectToken(it, tree, .LParen); const expr_node = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); // Optional bit range const bit_range = if (eatToken(it, .Colon)) |_| bit_range_value: { const range_start = try expectNode(arena, it, tree, parseIntegerLiteral, AstError{ .ExpectedIntegerLiteral = AstError.ExpectedIntegerLiteral{ .token = it.index }, }); _ = try expectToken(it, tree, .Colon); const range_end = try expectNode(arena, it, tree, parseIntegerLiteral, AstError{ .ExpectedIntegerLiteral = AstError.ExpectedIntegerLiteral{ .token = it.index }, }); break :bit_range_value Node.PrefixOp.PtrInfo.Align.BitRange{ .start = range_start, .end = range_end, }; } else null; _ = try expectToken(it, tree, .RParen); ptr_info.align_info = Node.PrefixOp.PtrInfo.Align{ .node = expr_node, .bit_range = bit_range, }; continue; } if (eatToken(it, .Keyword_const)) |const_token| { ptr_info.const_token = const_token; continue; } if (eatToken(it, .Keyword_volatile)) |volatile_token| { ptr_info.volatile_token = volatile_token; continue; } if (eatToken(it, .Keyword_allowzero)) |allowzero_token| { ptr_info.allowzero_token = allowzero_token; continue; } break; } return node; } if (try parseArrayTypeStart(arena, it, tree)) |node| { switch (node.cast(Node.PrefixOp).?.op) { .ArrayType => {}, .SliceType => |*slice_type| { // Collect pointer qualifiers in any order, but disallow duplicates while (true) { if (try parseByteAlign(arena, it, tree)) |align_expr| { if (slice_type.align_info != null) { try tree.errors.push(AstError{ .ExtraAlignQualifier = AstError.ExtraAlignQualifier{ .token = it.index }, }); return error.ParseError; } slice_type.align_info = Node.PrefixOp.PtrInfo.Align{ .node = align_expr, .bit_range = null, }; continue; } if (eatToken(it, .Keyword_const)) |const_token| { if (slice_type.const_token != null) { try tree.errors.push(AstError{ .ExtraConstQualifier = AstError.ExtraConstQualifier{ .token = it.index }, }); return error.ParseError; } slice_type.const_token = const_token; continue; } if (eatToken(it, .Keyword_volatile)) |volatile_token| { if (slice_type.volatile_token != null) { try tree.errors.push(AstError{ .ExtraVolatileQualifier = AstError.ExtraVolatileQualifier{ .token = it.index }, }); return error.ParseError; } slice_type.volatile_token = volatile_token; continue; } if (eatToken(it, .Keyword_allowzero)) |allowzero_token| { if (slice_type.allowzero_token != null) { try tree.errors.push(AstError{ .ExtraAllowZeroQualifier = AstError.ExtraAllowZeroQualifier{ .token = it.index }, }); return error.ParseError; } slice_type.allowzero_token = allowzero_token; continue; } break; } }, else => unreachable, } return node; } return null; } /// SuffixOp /// <- LBRACKET Expr (DOT2 (Expr (COLON Expr)?)?)? RBRACKET /// / DOT IDENTIFIER /// / DOTASTERISK /// / DOTQUESTIONMARK fn parseSuffixOp(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const Op = Node.SuffixOp.Op; const OpAndToken = struct { op: Node.SuffixOp.Op, token: TokenIndex, }; const op_and_token = blk: { if (eatToken(it, .LBracket)) |_| { const index_expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); if (eatToken(it, .Ellipsis2) != null) { const end_expr = try parseExpr(arena, it, tree); const sentinel: ?*ast.Node = if (eatToken(it, .Colon) != null) try parseExpr(arena, it, tree) else null; break :blk OpAndToken{ .op = Op{ .Slice = Op.Slice{ .start = index_expr, .end = end_expr, .sentinel = sentinel, }, }, .token = try expectToken(it, tree, .RBracket), }; } break :blk OpAndToken{ .op = Op{ .ArrayAccess = index_expr }, .token = try expectToken(it, tree, .RBracket), }; } if (eatToken(it, .PeriodAsterisk)) |period_asterisk| { break :blk OpAndToken{ .op = Op{ .Deref = {} }, .token = period_asterisk }; } if (eatToken(it, .Period)) |period| { if (try parseIdentifier(arena, it, tree)) |identifier| { // TODO: It's a bit weird to return an InfixOp from the SuffixOp parser. // Should there be an ast.Node.SuffixOp.FieldAccess variant? Or should // this grammar rule be altered? const node = try arena.create(Node.InfixOp); node.* = Node.InfixOp{ .op_token = period, .lhs = undefined, // set by caller .op = Node.InfixOp.Op.Period, .rhs = identifier, }; return &node.base; } if (eatToken(it, .QuestionMark)) |question_mark| { break :blk OpAndToken{ .op = Op{ .UnwrapOptional = {} }, .token = question_mark }; } try tree.errors.push(AstError{ .ExpectedSuffixOp = AstError.ExpectedSuffixOp{ .token = it.index }, }); return null; } return null; }; const node = try arena.create(Node.SuffixOp); node.* = Node.SuffixOp{ .lhs = undefined, // set by caller .op = op_and_token.op, .rtoken = op_and_token.token, }; return &node.base; } /// FnCallArguments <- LPAREN ExprList RPAREN /// ExprList <- (Expr COMMA)* Expr? fn parseFnCallArguments(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?AnnotatedParamList { if (eatToken(it, .LParen) == null) return null; const list = try ListParseFn(Node.FnProto.ParamList, parseExpr)(arena, it, tree); const rparen = try expectToken(it, tree, .RParen); return AnnotatedParamList{ .list = list, .rparen = rparen }; } const AnnotatedParamList = struct { list: Node.FnProto.ParamList, // NOTE: may also be any other type SegmentedList(*Node, 2) rparen: TokenIndex, }; /// ArrayTypeStart <- LBRACKET Expr? RBRACKET fn parseArrayTypeStart(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const lbracket = eatToken(it, .LBracket) orelse return null; const expr = try parseExpr(arena, it, tree); const sentinel = if (eatToken(it, .Colon)) |_| try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = .{ .token = it.index }, }) else null; const rbracket = try expectToken(it, tree, .RBracket); const op = if (expr) |len_expr| Node.PrefixOp.Op{ .ArrayType = .{ .len_expr = len_expr, .sentinel = sentinel, }, } else Node.PrefixOp.Op{ .SliceType = Node.PrefixOp.PtrInfo{ .allowzero_token = null, .align_info = null, .const_token = null, .volatile_token = null, .sentinel = sentinel, }, }; const node = try arena.create(Node.PrefixOp); node.* = Node.PrefixOp{ .op_token = lbracket, .op = op, .rhs = undefined, // set by caller }; return &node.base; } /// PtrTypeStart /// <- ASTERISK /// / ASTERISK2 /// / PTRUNKNOWN /// / PTRC fn parsePtrTypeStart(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { if (eatToken(it, .Asterisk)) |asterisk| { const sentinel = if (eatToken(it, .Colon)) |_| try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = .{ .token = it.index }, }) else null; const node = try arena.create(Node.PrefixOp); node.* = .{ .op_token = asterisk, .op = .{ .PtrType = .{ .sentinel = sentinel } }, .rhs = undefined, // set by caller }; return &node.base; } if (eatToken(it, .AsteriskAsterisk)) |double_asterisk| { const node = try arena.create(Node.PrefixOp); node.* = Node.PrefixOp{ .op_token = double_asterisk, .op = Node.PrefixOp.Op{ .PtrType = .{} }, .rhs = undefined, // set by caller }; // Special case for **, which is its own token const child = try arena.create(Node.PrefixOp); child.* = Node.PrefixOp{ .op_token = double_asterisk, .op = Node.PrefixOp.Op{ .PtrType = .{} }, .rhs = undefined, // set by caller }; node.rhs = &child.base; return &node.base; } if (eatToken(it, .LBracket)) |lbracket| { const asterisk = eatToken(it, .Asterisk) orelse { putBackToken(it, lbracket); return null; }; if (eatToken(it, .Identifier)) |ident| { if (!std.mem.eql(u8, tree.tokenSlice(ident), "c")) { putBackToken(it, ident); } else { _ = try expectToken(it, tree, .RBracket); const node = try arena.create(Node.PrefixOp); node.* = .{ .op_token = lbracket, .op = .{ .PtrType = .{} }, .rhs = undefined, // set by caller }; return &node.base; } } const sentinel = if (eatToken(it, .Colon)) |_| try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = .{ .token = it.index }, }) else null; _ = try expectToken(it, tree, .RBracket); const node = try arena.create(Node.PrefixOp); node.* = .{ .op_token = lbracket, .op = .{ .PtrType = .{ .sentinel = sentinel } }, .rhs = undefined, // set by caller }; return &node.base; } return null; } /// ContainerDeclAuto <- ContainerDeclType LBRACE ContainerMembers RBRACE fn parseContainerDeclAuto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const node = (try parseContainerDeclType(arena, it, tree)) orelse return null; const lbrace = try expectToken(it, tree, .LBrace); const members = try parseContainerMembers(arena, it, tree); const rbrace = try expectToken(it, tree, .RBrace); const decl_type = node.cast(Node.ContainerDecl).?; decl_type.fields_and_decls = members; decl_type.lbrace_token = lbrace; decl_type.rbrace_token = rbrace; return node; } /// ContainerDeclType /// <- KEYWORD_struct /// / KEYWORD_enum (LPAREN Expr RPAREN)? /// / KEYWORD_union (LPAREN (KEYWORD_enum (LPAREN Expr RPAREN)? / Expr) RPAREN)? fn parseContainerDeclType(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const kind_token = nextToken(it); const init_arg_expr = switch (kind_token.ptr.id) { .Keyword_struct => Node.ContainerDecl.InitArg{ .None = {} }, .Keyword_enum => blk: { if (eatToken(it, .LParen) != null) { const expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); break :blk Node.ContainerDecl.InitArg{ .Type = expr }; } break :blk Node.ContainerDecl.InitArg{ .None = {} }; }, .Keyword_union => blk: { if (eatToken(it, .LParen) != null) { if (eatToken(it, .Keyword_enum) != null) { if (eatToken(it, .LParen) != null) { const expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); _ = try expectToken(it, tree, .RParen); break :blk Node.ContainerDecl.InitArg{ .Enum = expr }; } _ = try expectToken(it, tree, .RParen); break :blk Node.ContainerDecl.InitArg{ .Enum = null }; } const expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); break :blk Node.ContainerDecl.InitArg{ .Type = expr }; } break :blk Node.ContainerDecl.InitArg{ .None = {} }; }, else => { putBackToken(it, kind_token.index); return null; }, }; const node = try arena.create(Node.ContainerDecl); node.* = Node.ContainerDecl{ .layout_token = null, .kind_token = kind_token.index, .init_arg_expr = init_arg_expr, .fields_and_decls = undefined, // set by caller .lbrace_token = undefined, // set by caller .rbrace_token = undefined, // set by caller }; return &node.base; } /// ByteAlign <- KEYWORD_align LPAREN Expr RPAREN fn parseByteAlign(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { _ = eatToken(it, .Keyword_align) orelse return null; _ = try expectToken(it, tree, .LParen); const expr = try expectNode(arena, it, tree, parseExpr, AstError{ .ExpectedExpr = AstError.ExpectedExpr{ .token = it.index }, }); _ = try expectToken(it, tree, .RParen); return expr; } /// IdentifierList <- (IDENTIFIER COMMA)* IDENTIFIER? /// Only ErrorSetDecl parses an IdentifierList fn parseErrorTagList(arena: *Allocator, it: *TokenIterator, tree: *Tree) !Node.ErrorSetDecl.DeclList { return try ListParseFn(Node.ErrorSetDecl.DeclList, parseErrorTag)(arena, it, tree); } /// SwitchProngList <- (SwitchProng COMMA)* SwitchProng? fn parseSwitchProngList(arena: *Allocator, it: *TokenIterator, tree: *Tree) !Node.Switch.CaseList { return try ListParseFn(Node.Switch.CaseList, parseSwitchProng)(arena, it, tree); } /// AsmOutputList <- (AsmOutputItem COMMA)* AsmOutputItem? fn parseAsmOutputList(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!Node.Asm.OutputList { return try ListParseFn(Node.Asm.OutputList, parseAsmOutputItem)(arena, it, tree); } /// AsmInputList <- (AsmInputItem COMMA)* AsmInputItem? fn parseAsmInputList(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!Node.Asm.InputList { return try ListParseFn(Node.Asm.InputList, parseAsmInputItem)(arena, it, tree); } /// ParamDeclList <- (ParamDecl COMMA)* ParamDecl? fn parseParamDeclList(arena: *Allocator, it: *TokenIterator, tree: *Tree) !Node.FnProto.ParamList { return try ListParseFn(Node.FnProto.ParamList, parseParamDecl)(arena, it, tree); } fn ParseFn(comptime T: type) type { return fn (*Allocator, *TokenIterator, *Tree) Error!T; } const NodeParseFn = fn (*Allocator, *TokenIterator, *Tree) Error!?*Node; fn ListParseFn(comptime L: type, comptime nodeParseFn: var) ParseFn(L) { return struct { pub fn parse(arena: *Allocator, it: *TokenIterator, tree: *Tree) !L { var list = L.init(arena); while (try nodeParseFn(arena, it, tree)) |node| { try list.push(node); if (eatToken(it, .Comma) == null) break; } return list; } }.parse; } fn SimpleBinOpParseFn(comptime token: Token.Id, comptime op: Node.InfixOp.Op) NodeParseFn { return struct { pub fn parse(arena: *Allocator, it: *TokenIterator, tree: *Tree) Error!?*Node { const op_token = eatToken(it, token) orelse return null; const node = try arena.create(Node.InfixOp); node.* = Node.InfixOp{ .op_token = op_token, .lhs = undefined, // set by caller .op = op, .rhs = undefined, // set by caller }; return &node.base; } }.parse; } // Helper parsers not included in the grammar fn parseBuiltinCall(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const token = eatToken(it, .Builtin) orelse return null; const params = (try parseFnCallArguments(arena, it, tree)) orelse { try tree.errors.push(AstError{ .ExpectedParamList = AstError.ExpectedParamList{ .token = it.index }, }); return error.ParseError; }; const node = try arena.create(Node.BuiltinCall); node.* = Node.BuiltinCall{ .builtin_token = token, .params = params.list, .rparen_token = params.rparen, }; return &node.base; } fn parseErrorTag(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const doc_comments = try parseDocComment(arena, it, tree); // no need to rewind on failure const token = eatToken(it, .Identifier) orelse return null; const node = try arena.create(Node.ErrorTag); node.* = Node.ErrorTag{ .doc_comments = doc_comments, .name_token = token, }; return &node.base; } fn parseIdentifier(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const token = eatToken(it, .Identifier) orelse return null; const node = try arena.create(Node.Identifier); node.* = Node.Identifier{ .token = token, }; return &node.base; } fn parseVarType(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const token = eatToken(it, .Keyword_var) orelse return null; const node = try arena.create(Node.VarType); node.* = Node.VarType{ .token = token, }; return &node.base; } fn createLiteral(arena: *Allocator, comptime T: type, token: TokenIndex) !*Node { const result = try arena.create(T); result.* = T{ .base = Node{ .id = Node.typeToId(T) }, .token = token, }; return &result.base; } fn parseStringLiteralSingle(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { if (eatToken(it, .StringLiteral)) |token| { const node = try arena.create(Node.StringLiteral); node.* = Node.StringLiteral{ .token = token, }; return &node.base; } return null; } // string literal or multiline string literal fn parseStringLiteral(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { if (try parseStringLiteralSingle(arena, it, tree)) |node| return node; if (eatToken(it, .MultilineStringLiteralLine)) |first_line| { const node = try arena.create(Node.MultilineStringLiteral); node.* = Node.MultilineStringLiteral{ .lines = Node.MultilineStringLiteral.LineList.init(arena), }; try node.lines.push(first_line); while (eatToken(it, .MultilineStringLiteralLine)) |line| try node.lines.push(line); return &node.base; } return null; } fn parseIntegerLiteral(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const token = eatToken(it, .IntegerLiteral) orelse return null; const node = try arena.create(Node.IntegerLiteral); node.* = Node.IntegerLiteral{ .token = token, }; return &node.base; } fn parseFloatLiteral(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const token = eatToken(it, .FloatLiteral) orelse return null; const node = try arena.create(Node.FloatLiteral); node.* = Node.FloatLiteral{ .token = token, }; return &node.base; } fn parseTry(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const token = eatToken(it, .Keyword_try) orelse return null; const node = try arena.create(Node.PrefixOp); node.* = Node.PrefixOp{ .op_token = token, .op = Node.PrefixOp.Op.Try, .rhs = undefined, // set by caller }; return &node.base; } fn parseUse(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { const token = eatToken(it, .Keyword_usingnamespace) orelse return null; const node = try arena.create(Node.Use); node.* = Node.Use{ .doc_comments = null, .visib_token = null, .use_token = token, .expr = undefined, // set by caller .semicolon_token = undefined, // set by caller }; return &node.base; } /// IfPrefix Body (KEYWORD_else Payload? Body)? fn parseIf(arena: *Allocator, it: *TokenIterator, tree: *Tree, bodyParseFn: NodeParseFn) !?*Node { const node = (try parseIfPrefix(arena, it, tree)) orelse return null; const if_prefix = node.cast(Node.If).?; if_prefix.body = try expectNode(arena, it, tree, bodyParseFn, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); const else_token = eatToken(it, .Keyword_else) orelse return node; const payload = try parsePayload(arena, it, tree); const else_expr = try expectNode(arena, it, tree, bodyParseFn, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); const else_node = try arena.create(Node.Else); else_node.* = Node.Else{ .else_token = else_token, .payload = payload, .body = else_expr, }; if_prefix.@"else" = else_node; return node; } /// Eat a multiline doc comment fn parseDocComment(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node.DocComment { var lines = Node.DocComment.LineList.init(arena); while (eatToken(it, .DocComment)) |line| { try lines.push(line); } if (lines.len == 0) return null; const node = try arena.create(Node.DocComment); node.* = Node.DocComment{ .lines = lines, }; return node; } /// Eat a single-line doc comment on the same line as another node fn parseAppendedDocComment(arena: *Allocator, it: *TokenIterator, tree: *Tree, after_token: TokenIndex) !?*Node.DocComment { const comment_token = eatToken(it, .DocComment) orelse return null; if (tree.tokensOnSameLine(after_token, comment_token)) { const node = try arena.create(Node.DocComment); node.* = Node.DocComment{ .lines = Node.DocComment.LineList.init(arena), }; try node.lines.push(comment_token); return node; } putBackToken(it, comment_token); return null; } /// Op* Child fn parsePrefixOpExpr( arena: *Allocator, it: *TokenIterator, tree: *Tree, opParseFn: NodeParseFn, childParseFn: NodeParseFn, ) Error!?*Node { if (try opParseFn(arena, it, tree)) |first_op| { var rightmost_op = first_op; while (true) { switch (rightmost_op.id) { .PrefixOp => { var prefix_op = rightmost_op.cast(Node.PrefixOp).?; // If the token encountered was **, there will be two nodes if (tree.tokens.at(prefix_op.op_token).id == .AsteriskAsterisk) { rightmost_op = prefix_op.rhs; prefix_op = rightmost_op.cast(Node.PrefixOp).?; } if (try opParseFn(arena, it, tree)) |rhs| { prefix_op.rhs = rhs; rightmost_op = rhs; } else break; }, .AnyFrameType => { const prom = rightmost_op.cast(Node.AnyFrameType).?; if (try opParseFn(arena, it, tree)) |rhs| { prom.result.?.return_type = rhs; rightmost_op = rhs; } else break; }, else => unreachable, } } // If any prefix op existed, a child node on the RHS is required switch (rightmost_op.id) { .PrefixOp => { const prefix_op = rightmost_op.cast(Node.PrefixOp).?; prefix_op.rhs = try expectNode(arena, it, tree, childParseFn, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); }, .AnyFrameType => { const prom = rightmost_op.cast(Node.AnyFrameType).?; prom.result.?.return_type = try expectNode(arena, it, tree, childParseFn, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); }, else => unreachable, } return first_op; } // Otherwise, the child node is optional return try childParseFn(arena, it, tree); } /// Child (Op Child)* /// Child (Op Child)? fn parseBinOpExpr( arena: *Allocator, it: *TokenIterator, tree: *Tree, opParseFn: NodeParseFn, childParseFn: NodeParseFn, chain: enum { Once, Infinitely, }, ) Error!?*Node { var res = (try childParseFn(arena, it, tree)) orelse return null; while (try opParseFn(arena, it, tree)) |node| { const right = try expectNode(arena, it, tree, childParseFn, AstError{ .InvalidToken = AstError.InvalidToken{ .token = it.index }, }); const left = res; res = node; const op = node.cast(Node.InfixOp).?; op.*.lhs = left; op.*.rhs = right; switch (chain) { .Once => break, .Infinitely => continue, } } return res; } fn createInfixOp(arena: *Allocator, index: TokenIndex, op: Node.InfixOp.Op) !*Node { const node = try arena.create(Node.InfixOp); node.* = Node.InfixOp{ .op_token = index, .lhs = undefined, // set by caller .op = op, .rhs = undefined, // set by caller }; return &node.base; } fn eatToken(it: *TokenIterator, id: Token.Id) ?TokenIndex { return if (eatAnnotatedToken(it, id)) |token| token.index else null; } fn eatAnnotatedToken(it: *TokenIterator, id: Token.Id) ?AnnotatedToken { return if (it.peek().?.id == id) nextToken(it) else null; } fn expectToken(it: *TokenIterator, tree: *Tree, id: Token.Id) Error!TokenIndex { const token = nextToken(it); if (token.ptr.id != id) { try tree.errors.push(AstError{ .ExpectedToken = AstError.ExpectedToken{ .token = token.index, .expected_id = id }, }); return error.ParseError; } return token.index; } fn nextToken(it: *TokenIterator) AnnotatedToken { const result = AnnotatedToken{ .index = it.index, .ptr = it.next().?, }; assert(result.ptr.id != .LineComment); while (true) { const next_tok = it.peek() orelse return result; if (next_tok.id != .LineComment) return result; _ = it.next(); } } fn putBackToken(it: *TokenIterator, putting_back: TokenIndex) void { while (true) { const prev_tok = it.prev() orelse return; if (prev_tok.id == .LineComment) continue; assert(it.list.at(putting_back) == prev_tok); return; } } const AnnotatedToken = struct { index: TokenIndex, ptr: *Token, }; fn expectNode( arena: *Allocator, it: *TokenIterator, tree: *Tree, parseFn: NodeParseFn, err: AstError, // if parsing fails ) Error!*Node { return (try parseFn(arena, it, tree)) orelse { try tree.errors.push(err); return error.ParseError; }; } test "std.zig.parser" { _ = @import("parser_test.zig"); }
lib/std/zig/parse.zig
const builtin = @import("builtin"); const expect = std.testing.expect; const std = @import("../std.zig"); const math = std.math; /// Returns the greatest integer value less than or equal to x. /// /// Special Cases: /// - floor(+-0) = +-0 /// - floor(+-inf) = +-inf /// - floor(nan) = nan pub fn floor(x: var) @TypeOf(x) { const T = @TypeOf(x); return switch (T) { f16 => floor16(x), f32 => floor32(x), f64 => floor64(x), f128 => floor128(x), else => @compileError("floor not implemented for " ++ @typeName(T)), }; } fn floor16(x: f16) f16 { var u = @bitCast(u16, x); const e = @intCast(i16, (u >> 10) & 31) - 15; var m: u16 = undefined; // TODO: Shouldn't need this explicit check. if (x == 0.0) { return x; } if (e >= 10) { return x; } if (e >= 0) { m = @as(u16, 1023) >> @intCast(u4, e); if (u & m == 0) { return x; } math.forceEval(x + 0x1.0p120); if (u >> 15 != 0) { u += m; } return @bitCast(f16, u & ~m); } else { math.forceEval(x + 0x1.0p120); if (u >> 15 == 0) { return 0.0; } else { return -1.0; } } } fn floor32(x: f32) f32 { var u = @bitCast(u32, x); const e = @intCast(i32, (u >> 23) & 0xFF) - 0x7F; var m: u32 = undefined; // TODO: Shouldn't need this explicit check. if (x == 0.0) { return x; } if (e >= 23) { return x; } if (e >= 0) { m = @as(u32, 0x007FFFFF) >> @intCast(u5, e); if (u & m == 0) { return x; } math.forceEval(x + 0x1.0p120); if (u >> 31 != 0) { u += m; } return @bitCast(f32, u & ~m); } else { math.forceEval(x + 0x1.0p120); if (u >> 31 == 0) { return 0.0; } else { return -1.0; } } } fn floor64(x: f64) f64 { const u = @bitCast(u64, x); const e = (u >> 52) & 0x7FF; var y: f64 = undefined; if (e >= 0x3FF + 52 or x == 0) { return x; } if (u >> 63 != 0) { y = x - math.f64_toint + math.f64_toint - x; } else { y = x + math.f64_toint - math.f64_toint - x; } if (e <= 0x3FF - 1) { math.forceEval(y); if (u >> 63 != 0) { return -1.0; } else { return 0.0; } } else if (y > 0) { return x + y - 1; } else { return x + y; } } fn floor128(x: f128) f128 { const u = @bitCast(u128, x); const e = (u >> 112) & 0x7FFF; var y: f128 = undefined; if (e >= 0x3FFF + 112 or x == 0) return x; if (u >> 127 != 0) { y = x - math.f128_toint + math.f128_toint - x; } else { y = x + math.f128_toint - math.f128_toint - x; } if (e <= 0x3FFF - 1) { math.forceEval(y); if (u >> 127 != 0) { return -1.0; } else { return 0.0; } } else if (y > 0) { return x + y - 1; } else { return x + y; } } test "math.floor" { expect(floor(@as(f16, 1.3)) == floor16(1.3)); expect(floor(@as(f32, 1.3)) == floor32(1.3)); expect(floor(@as(f64, 1.3)) == floor64(1.3)); expect(floor(@as(f128, 1.3)) == floor128(1.3)); } test "math.floor16" { expect(floor16(1.3) == 1.0); expect(floor16(-1.3) == -2.0); expect(floor16(0.2) == 0.0); } test "math.floor32" { expect(floor32(1.3) == 1.0); expect(floor32(-1.3) == -2.0); expect(floor32(0.2) == 0.0); } test "math.floor64" { expect(floor64(1.3) == 1.0); expect(floor64(-1.3) == -2.0); expect(floor64(0.2) == 0.0); } test "math.floor128" { expect(floor128(1.3) == 1.0); expect(floor128(-1.3) == -2.0); expect(floor128(0.2) == 0.0); } test "math.floor16.special" { expect(floor16(0.0) == 0.0); expect(floor16(-0.0) == -0.0); expect(math.isPositiveInf(floor16(math.inf(f16)))); expect(math.isNegativeInf(floor16(-math.inf(f16)))); expect(math.isNan(floor16(math.nan(f16)))); } test "math.floor32.special" { expect(floor32(0.0) == 0.0); expect(floor32(-0.0) == -0.0); expect(math.isPositiveInf(floor32(math.inf(f32)))); expect(math.isNegativeInf(floor32(-math.inf(f32)))); expect(math.isNan(floor32(math.nan(f32)))); } test "math.floor64.special" { expect(floor64(0.0) == 0.0); expect(floor64(-0.0) == -0.0); expect(math.isPositiveInf(floor64(math.inf(f64)))); expect(math.isNegativeInf(floor64(-math.inf(f64)))); expect(math.isNan(floor64(math.nan(f64)))); } test "math.floor128.special" { expect(floor128(0.0) == 0.0); expect(floor128(-0.0) == -0.0); expect(math.isPositiveInf(floor128(math.inf(f128)))); expect(math.isNegativeInf(floor128(-math.inf(f128)))); expect(math.isNan(floor128(math.nan(f128)))); }
lib/std/math/floor.zig
const std = @import("std"); fn getRelativePath() []const u8 { comptime var src: std.builtin.SourceLocation = @src(); return std.fs.path.dirname(src.file).? ++ std.fs.path.sep_str; } pub const stbPkg = std.build.Pkg{ .name = "stb_image", .path = std.build.FileSource{ .path = getRelativePath() ++ "src/pkg/stb_image.zig" }, }; pub const glPkg = std.build.Pkg{ .name = "gl", .path = std.build.FileSource{ .path = getRelativePath() ++ "src/pkg/gl.zig" }, }; pub const imguiPkg = std.build.Pkg{ .name = "imgui", .path = std.build.FileSource{ .path = getRelativePath() ++ "src/pkg/imgui.zig" } }; pub const glfwPkg = std.build.Pkg{ .name = "glfw", .path = std.build.FileSource{ .path = getRelativePath() ++ "src/pkg/glfw.zig" } }; pub const ztPkg = std.build.Pkg{ .name = "zt", .path = std.build.FileSource{ .path = getRelativePath() ++ "src/zt.zig" }, .dependencies = &[_]std.build.Pkg{ glfwPkg, glPkg, imguiPkg, stbPkg, } }; // Build here only exists to build the example. to use ZT you'll want to import this file and use the link function in // your build.zig pub fn build(b: *std.build.Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const exe = b.addExecutable("example", "example/src/main.zig"); link(exe); exe.setTarget(target); exe.setBuildMode(mode); exe.install(); addBinaryContent("example/assets") catch unreachable; // Run cmd const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); } pub fn link(exe: *std.build.LibExeObjStep) void { // Link step exe.linkLibrary(imguiLibrary(exe)); exe.linkLibrary(glfwLibrary(exe)); exe.linkLibrary(glLibrary(exe)); exe.linkLibrary(stbLibrary(exe)); exe.addPackage(glfwPkg); exe.addPackage(glPkg); exe.addPackage(stbPkg); exe.addPackage(imguiPkg); exe.addPackage(ztPkg); } // STB pub fn stbLibrary(exe: *std.build.LibExeObjStep) *std.build.LibExeObjStep { comptime var path = getRelativePath(); var b = exe.builder; var stb = b.addStaticLibrary("stb", null); stb.linkLibC(); var flagContainer = std.ArrayList([]const u8).init(std.heap.page_allocator); if (b.is_release) flagContainer.append("-Os") catch unreachable; stb.addCSourceFile(path ++ "src/dep/stb/stb_image_wrapper.c", flagContainer.items); return stb; } // OpenGL pub fn glLibrary(exe: *std.build.LibExeObjStep) *std.build.LibExeObjStep { comptime var path = getRelativePath(); var b = exe.builder; var target = exe.target; var gl = b.addStaticLibrary("gl", null); gl.linkLibC(); // Generate flags. var flagContainer = std.ArrayList([]const u8).init(std.heap.page_allocator); if (b.is_release) flagContainer.append("-Os") catch unreachable; // Link libraries. if (target.isWindows()) { gl.linkSystemLibrary("opengl32"); } if (target.isLinux()) { gl.linkSystemLibrary("gl"); } if(target.isDarwin()) { // !! Mac TODO // Here we need to add the include the system libs needed for mac opengl // Maybe also } // Include dirs. gl.addIncludeDir(path ++ "src/dep/gl/glad/include"); // Add c. gl.addCSourceFile(path ++ "src/dep/gl/glad/src/glad.c", flagContainer.items); return gl; } // ImGui pub fn imguiLibrary(exe: *std.build.LibExeObjStep) *std.build.LibExeObjStep { comptime var path = getRelativePath(); var b = exe.builder; var target = exe.target; var imgui = b.addStaticLibrary("imgui", null); imgui.linkLibC(); imgui.linkSystemLibrary("c++"); // Generate flags. var flagContainer = std.ArrayList([]const u8).init(std.heap.page_allocator); if (b.is_release) flagContainer.append("-Os") catch unreachable; flagContainer.append("-Wno-return-type-c-linkage") catch unreachable; flagContainer.append("-fno-sanitize=undefined") catch unreachable; // Link libraries. if (target.isWindows()) { imgui.linkSystemLibrary("winmm"); imgui.linkSystemLibrary("user32"); imgui.linkSystemLibrary("imm32"); imgui.linkSystemLibrary("gdi32"); } if(target.isDarwin()) { // !! Mac TODO // Here we need to add the include the system libs needed for mac imgui } // Include dirs. imgui.addIncludeDir(path ++ "src/dep/cimgui/imgui"); imgui.addIncludeDir(path ++ "src/dep/cimgui"); // Add C imgui.addCSourceFiles(&.{ path ++ "src/dep/cimgui/imgui/imgui.cpp", path ++ "src/dep/cimgui/imgui/imgui_demo.cpp", path ++ "src/dep/cimgui/imgui/imgui_draw.cpp", path ++ "src/dep/cimgui/imgui/imgui_tables.cpp", path ++ "src/dep/cimgui/imgui/imgui_widgets.cpp", path ++ "src/dep/cimgui/cimgui.cpp" }, flagContainer.items); return imgui; } // GLFW pub fn glfwLibrary(exe: *std.build.LibExeObjStep) *std.build.LibExeObjStep { comptime var path = getRelativePath(); var b = exe.builder; var target = exe.target; var glfw = b.addStaticLibrary("glfw", null); glfw.linkLibC(); var flagContainer: std.ArrayList([]const u8) = std.ArrayList([]const u8).init(std.heap.page_allocator); if (b.is_release) flagContainer.append("-Os") catch unreachable; // Include dirs. glfw.addIncludeDir(path ++ "src/dep/glfw/deps"); glfw.addIncludeDir(path ++ "src/dep/glfw/include"); // For windows targets, link/add c. if (target.isWindows()) { if (b.is_release) { exe.subsystem = .Windows; // Hide the Console on release. exe.want_lto = false; // TODO: When _tls_index is no longer lost on lto, undo this. } flagContainer.append("-D_GLFW_WIN32") catch unreachable; glfw.linkSystemLibrary("gdi32"); glfw.addCSourceFiles(&.{ path ++ "src/dep/glfw/src/win32_init.c", path ++ "src/dep/glfw/src/win32_joystick.c", path ++ "src/dep/glfw/src/win32_monitor.c", path ++ "src/dep/glfw/src/win32_time.c", path ++ "src/dep/glfw/src/win32_thread.c", path ++ "src/dep/glfw/src/win32_window.c", path ++ "src/dep/glfw/src/wgl_context.c", path ++ "src/dep/glfw/src/egl_context.c", path ++ "src/dep/glfw/src/osmesa_context.c", }, flagContainer.items); } // For linux targets, link/add c. if (target.isLinux()) { glfw.subsystem = .Posix; // Linux is a little too itchy to sanitize some glfw code that works but can hit UB flagContainer.append("-fno-sanitize=undefined") catch unreachable; flagContainer.append("-D_GLFW_X11") catch unreachable; glfw.addSystemIncludeDir("/usr/include/"); glfw.linkSystemLibrary("rt"); glfw.linkSystemLibrary("m"); glfw.linkSystemLibrary("x11"); glfw.addCSourceFiles(&.{ path ++ "src/dep/glfw/src/x11_init.c", path ++ "src/dep/glfw/src/x11_monitor.c", path ++ "src/dep/glfw/src/x11_window.c", path ++ "src/dep/glfw/src/xkb_unicode.c", path ++ "src/dep/glfw/src/posix_time.c", path ++ "src/dep/glfw/src/posix_thread.c", path ++ "src/dep/glfw/src/glx_context.c", path ++ "src/dep/glfw/src/egl_context.c", path ++ "src/dep/glfw/src/osmesa_context.c", path ++ "src/dep/glfw/src/linux_joystick.c", }, flagContainer.items); } if (target.isDarwin()) { // !! Mac TODO // Here we need to add the include dirs and c files that glfw // depends on for specifically the mac platform. } // Shared C. glfw.addCSourceFiles(&.{ path ++ "src/dep/glfw/src/context.c", path ++ "src/dep/glfw/src/init.c", path ++ "src/dep/glfw/src/input.c", path ++ "src/dep/glfw/src/monitor.c", path ++ "src/dep/glfw/src/vulkan.c", path ++ "src/dep/glfw/src/window.c", }, flagContainer.items); return glfw; } pub const AddContentErrors = error{ PermissionError, WriteError, FileError, FolderError, RecursionError }; const fs = std.fs; /// Pass in a relative path to a folder, and its content is added to the zig-cache/bin output. /// TODO: Lookup where zig defines the output folder to make it more bulletproof. pub fn addBinaryContent(comptime baseContentPath: []const u8) AddContentErrors!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const zigBin: []const u8 = std.fs.path.join(gpa.allocator(), &[_][]const u8{ "zig-out", "bin" }) catch return error.FolderError; defer gpa.allocator().free(zigBin); fs.cwd().makePath(zigBin) catch return error.FolderError; var sourceFolder: fs.Dir = fs.cwd().openDir(baseContentPath, .{ .iterate = true }) catch return error.FolderError; defer sourceFolder.close(); var iterator: fs.Dir.Iterator = sourceFolder.iterate(); while (iterator.next() catch return error.FolderError) |target| { var x: fs.Dir.Entry = target; if (x.kind == .Directory) { const source: []const u8 = std.fs.path.join(gpa.allocator(), &[_][]const u8{ baseContentPath, x.name }) catch return error.RecursionError; const targetFolder: []const u8 = std.fs.path.join(gpa.allocator(), &[_][]const u8{ zigBin, x.name }) catch return error.RecursionError; defer gpa.allocator().free(source); defer gpa.allocator().free(targetFolder); try innerAddContent(gpa.allocator(), source, targetFolder); } if (x.kind == .File) { try copy(baseContentPath, zigBin, x.name); } } } fn innerAddContent(allocator: std.mem.Allocator, folder: []const u8, dest: []const u8) AddContentErrors!void { var sourceFolder: fs.Dir = fs.cwd().openDir(folder, .{ .iterate = true }) catch return error.FolderError; defer sourceFolder.close(); var iterator: fs.Dir.Iterator = sourceFolder.iterate(); while (iterator.next() catch return error.FolderError) |target| { var x: fs.Dir.Entry = target; if (x.kind == .Directory) { const source: []const u8 = std.fs.path.join(allocator, &[_][]const u8{ folder, x.name }) catch return error.RecursionError; const targetFolder: []const u8 = std.fs.path.join(allocator, &[_][]const u8{ dest, x.name }) catch return error.RecursionError; defer allocator.free(source); defer allocator.free(targetFolder); try innerAddContent(allocator, source, targetFolder); } if (x.kind == .File) { try copy(folder, dest, x.name); } } } fn copy(from: []const u8, to: []const u8, filename: []const u8) AddContentErrors!void { fs.cwd().makePath(to) catch return error.FolderError; var source = fs.cwd().openDir(from, .{}) catch return error.FileError; var dest = fs.cwd().openDir(to, .{}) catch return error.FileError; var sfile = source.openFile(filename, .{}) catch return error.FileError; defer sfile.close(); var dfile = dest.openFile(filename, .{}) catch { source.copyFile(filename, dest, filename, .{}) catch return error.PermissionError; std.debug.print("COPY: {s}/{s} to {s}/{s}\n", .{ from, filename, to, filename }); return; }; var sstat = sfile.stat() catch return error.FileError; var dstat = dfile.stat() catch return error.FileError; if (sstat.mtime > dstat.mtime) { dfile.close(); dest.deleteFile(filename) catch return error.PermissionError; source.copyFile(filename, dest, filename, .{}) catch return error.PermissionError; std.debug.print("OVERWRITE: {s}\\{s} to {s}\\{s}\n", .{ from, filename, to, filename }); } else { defer dfile.close(); std.debug.print("SKIP: {s}\\{s}\n", .{ from, filename }); } }
build.zig
const std = @import("std.zig"); const assert = std.debug.assert; const testing = std.testing; const mem = std.mem; pub const standard_alphabet_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; pub const standard_pad_char = '='; pub const standard_encoder = Base64Encoder.init(standard_alphabet_chars, standard_pad_char); pub const Base64Encoder = struct { alphabet_chars: []const u8, pad_char: u8, /// a bunch of assertions, then simply pass the data right through. pub fn init(alphabet_chars: []const u8, pad_char: u8) Base64Encoder { assert(alphabet_chars.len == 64); var char_in_alphabet = [_]bool{false} ** 256; for (alphabet_chars) |c| { assert(!char_in_alphabet[c]); assert(c != pad_char); char_in_alphabet[c] = true; } return Base64Encoder{ .alphabet_chars = alphabet_chars, .pad_char = pad_char, }; } /// ceil(source_len * 4/3) pub fn calcSize(source_len: usize) usize { return @divTrunc(source_len + 2, 3) * 4; } /// dest.len must be what you get from ::calcSize. pub fn encode(encoder: *const Base64Encoder, dest: []u8, source: []const u8) []const u8 { assert(dest.len >= Base64Encoder.calcSize(source.len)); var i: usize = 0; var out_index: usize = 0; while (i + 2 < source.len) : (i += 3) { dest[out_index] = encoder.alphabet_chars[(source[i] >> 2) & 0x3f]; out_index += 1; dest[out_index] = encoder.alphabet_chars[((source[i] & 0x3) << 4) | ((source[i + 1] & 0xf0) >> 4)]; out_index += 1; dest[out_index] = encoder.alphabet_chars[((source[i + 1] & 0xf) << 2) | ((source[i + 2] & 0xc0) >> 6)]; out_index += 1; dest[out_index] = encoder.alphabet_chars[source[i + 2] & 0x3f]; out_index += 1; } if (i < source.len) { dest[out_index] = encoder.alphabet_chars[(source[i] >> 2) & 0x3f]; out_index += 1; if (i + 1 == source.len) { dest[out_index] = encoder.alphabet_chars[(source[i] & 0x3) << 4]; out_index += 1; dest[out_index] = encoder.pad_char; out_index += 1; } else { dest[out_index] = encoder.alphabet_chars[((source[i] & 0x3) << 4) | ((source[i + 1] & 0xf0) >> 4)]; out_index += 1; dest[out_index] = encoder.alphabet_chars[(source[i + 1] & 0xf) << 2]; out_index += 1; } dest[out_index] = encoder.pad_char; out_index += 1; } return dest[0..out_index]; } }; pub const standard_decoder = Base64Decoder.init(standard_alphabet_chars, standard_pad_char); pub const Base64Decoder = struct { /// e.g. 'A' => 0. /// undefined for any value not in the 64 alphabet chars. char_to_index: [256]u8, /// true only for the 64 chars in the alphabet, not the pad char. char_in_alphabet: [256]bool, pad_char: u8, pub fn init(alphabet_chars: []const u8, pad_char: u8) Base64Decoder { assert(alphabet_chars.len == 64); var result = Base64Decoder{ .char_to_index = undefined, .char_in_alphabet = [_]bool{false} ** 256, .pad_char = pad_char, }; for (alphabet_chars) |c, i| { assert(!result.char_in_alphabet[c]); assert(c != pad_char); result.char_to_index[c] = @intCast(u8, i); result.char_in_alphabet[c] = true; } return result; } /// If the encoded buffer is detected to be invalid, returns error.InvalidPadding. pub fn calcSize(decoder: *const Base64Decoder, source: []const u8) !usize { if (source.len % 4 != 0) return error.InvalidPadding; return calcDecodedSizeExactUnsafe(source, decoder.pad_char); } /// dest.len must be what you get from ::calcSize. /// invalid characters result in error.InvalidCharacter. /// invalid padding results in error.InvalidPadding. pub fn decode(decoder: *const Base64Decoder, dest: []u8, source: []const u8) !void { assert(dest.len == (decoder.calcSize(source) catch unreachable)); assert(source.len % 4 == 0); var src_cursor: usize = 0; var dest_cursor: usize = 0; while (src_cursor < source.len) : (src_cursor += 4) { if (!decoder.char_in_alphabet[source[src_cursor + 0]]) return error.InvalidCharacter; if (!decoder.char_in_alphabet[source[src_cursor + 1]]) return error.InvalidCharacter; if (src_cursor < source.len - 4 or source[src_cursor + 3] != decoder.pad_char) { // common case if (!decoder.char_in_alphabet[source[src_cursor + 2]]) return error.InvalidCharacter; if (!decoder.char_in_alphabet[source[src_cursor + 3]]) return error.InvalidCharacter; dest[dest_cursor + 0] = decoder.char_to_index[source[src_cursor + 0]] << 2 | decoder.char_to_index[source[src_cursor + 1]] >> 4; dest[dest_cursor + 1] = decoder.char_to_index[source[src_cursor + 1]] << 4 | decoder.char_to_index[source[src_cursor + 2]] >> 2; dest[dest_cursor + 2] = decoder.char_to_index[source[src_cursor + 2]] << 6 | decoder.char_to_index[source[src_cursor + 3]]; dest_cursor += 3; } else if (source[src_cursor + 2] != decoder.pad_char) { // one pad char if (!decoder.char_in_alphabet[source[src_cursor + 2]]) return error.InvalidCharacter; dest[dest_cursor + 0] = decoder.char_to_index[source[src_cursor + 0]] << 2 | decoder.char_to_index[source[src_cursor + 1]] >> 4; dest[dest_cursor + 1] = decoder.char_to_index[source[src_cursor + 1]] << 4 | decoder.char_to_index[source[src_cursor + 2]] >> 2; if (decoder.char_to_index[source[src_cursor + 2]] << 6 != 0) return error.InvalidPadding; dest_cursor += 2; } else { // two pad chars dest[dest_cursor + 0] = decoder.char_to_index[source[src_cursor + 0]] << 2 | decoder.char_to_index[source[src_cursor + 1]] >> 4; if (decoder.char_to_index[source[src_cursor + 1]] << 4 != 0) return error.InvalidPadding; dest_cursor += 1; } } assert(src_cursor == source.len); assert(dest_cursor == dest.len); } }; pub const Base64DecoderWithIgnore = struct { decoder: Base64Decoder, char_is_ignored: [256]bool, pub fn init(alphabet_chars: []const u8, pad_char: u8, ignore_chars: []const u8) Base64DecoderWithIgnore { var result = Base64DecoderWithIgnore{ .decoder = Base64Decoder.init(alphabet_chars, pad_char), .char_is_ignored = [_]bool{false} ** 256, }; for (ignore_chars) |c| { assert(!result.decoder.char_in_alphabet[c]); assert(!result.char_is_ignored[c]); assert(result.decoder.pad_char != c); result.char_is_ignored[c] = true; } return result; } /// If no characters end up being ignored or padding, this will be the exact decoded size. pub fn calcSizeUpperBound(encoded_len: usize) usize { return @divTrunc(encoded_len, 4) * 3; } /// Invalid characters that are not ignored result in error.InvalidCharacter. /// Invalid padding results in error.InvalidPadding. /// Decoding more data than can fit in dest results in error.OutputTooSmall. See also ::calcSizeUpperBound. /// Returns the number of bytes written to dest. pub fn decode(decoder_with_ignore: *const Base64DecoderWithIgnore, dest: []u8, source: []const u8) !usize { const decoder = &decoder_with_ignore.decoder; var src_cursor: usize = 0; var dest_cursor: usize = 0; while (true) { // get the next 4 chars, if available var next_4_chars: [4]u8 = undefined; var available_chars: usize = 0; var pad_char_count: usize = 0; while (available_chars < 4 and src_cursor < source.len) { var c = source[src_cursor]; src_cursor += 1; if (decoder.char_in_alphabet[c]) { // normal char next_4_chars[available_chars] = c; available_chars += 1; } else if (decoder_with_ignore.char_is_ignored[c]) { // we're told to skip this one continue; } else if (c == decoder.pad_char) { // the padding has begun. count the pad chars. pad_char_count += 1; while (src_cursor < source.len) { c = source[src_cursor]; src_cursor += 1; if (c == decoder.pad_char) { pad_char_count += 1; if (pad_char_count > 2) return error.InvalidCharacter; } else if (decoder_with_ignore.char_is_ignored[c]) { // we can even ignore chars during the padding continue; } else return error.InvalidCharacter; } break; } else return error.InvalidCharacter; } switch (available_chars) { 4 => { // common case if (dest_cursor + 3 > dest.len) return error.OutputTooSmall; assert(pad_char_count == 0); dest[dest_cursor + 0] = decoder.char_to_index[next_4_chars[0]] << 2 | decoder.char_to_index[next_4_chars[1]] >> 4; dest[dest_cursor + 1] = decoder.char_to_index[next_4_chars[1]] << 4 | decoder.char_to_index[next_4_chars[2]] >> 2; dest[dest_cursor + 2] = decoder.char_to_index[next_4_chars[2]] << 6 | decoder.char_to_index[next_4_chars[3]]; dest_cursor += 3; continue; }, 3 => { if (dest_cursor + 2 > dest.len) return error.OutputTooSmall; if (pad_char_count != 1) return error.InvalidPadding; dest[dest_cursor + 0] = decoder.char_to_index[next_4_chars[0]] << 2 | decoder.char_to_index[next_4_chars[1]] >> 4; dest[dest_cursor + 1] = decoder.char_to_index[next_4_chars[1]] << 4 | decoder.char_to_index[next_4_chars[2]] >> 2; if (decoder.char_to_index[next_4_chars[2]] << 6 != 0) return error.InvalidPadding; dest_cursor += 2; break; }, 2 => { if (dest_cursor + 1 > dest.len) return error.OutputTooSmall; if (pad_char_count != 2) return error.InvalidPadding; dest[dest_cursor + 0] = decoder.char_to_index[next_4_chars[0]] << 2 | decoder.char_to_index[next_4_chars[1]] >> 4; if (decoder.char_to_index[next_4_chars[1]] << 4 != 0) return error.InvalidPadding; dest_cursor += 1; break; }, 1 => { return error.InvalidPadding; }, 0 => { if (pad_char_count != 0) return error.InvalidPadding; break; }, else => unreachable, } } assert(src_cursor == source.len); return dest_cursor; } }; pub const standard_decoder_unsafe = Base64DecoderUnsafe.init(standard_alphabet_chars, standard_pad_char); pub const Base64DecoderUnsafe = struct { /// e.g. 'A' => 0. /// undefined for any value not in the 64 alphabet chars. char_to_index: [256]u8, pad_char: u8, pub fn init(alphabet_chars: []const u8, pad_char: u8) Base64DecoderUnsafe { assert(alphabet_chars.len == 64); var result = Base64DecoderUnsafe{ .char_to_index = undefined, .pad_char = pad_char, }; for (alphabet_chars) |c, i| { assert(c != pad_char); result.char_to_index[c] = @intCast(u8, i); } return result; } /// The source buffer must be valid. pub fn calcSize(decoder: *const Base64DecoderUnsafe, source: []const u8) usize { return calcDecodedSizeExactUnsafe(source, decoder.pad_char); } /// dest.len must be what you get from ::calcDecodedSizeExactUnsafe. /// invalid characters or padding will result in undefined values. pub fn decode(decoder: *const Base64DecoderUnsafe, dest: []u8, source: []const u8) void { assert(dest.len == decoder.calcSize(source)); var src_index: usize = 0; var dest_index: usize = 0; var in_buf_len: usize = source.len; while (in_buf_len > 0 and source[in_buf_len - 1] == decoder.pad_char) { in_buf_len -= 1; } while (in_buf_len > 4) { dest[dest_index] = decoder.char_to_index[source[src_index + 0]] << 2 | decoder.char_to_index[source[src_index + 1]] >> 4; dest_index += 1; dest[dest_index] = decoder.char_to_index[source[src_index + 1]] << 4 | decoder.char_to_index[source[src_index + 2]] >> 2; dest_index += 1; dest[dest_index] = decoder.char_to_index[source[src_index + 2]] << 6 | decoder.char_to_index[source[src_index + 3]]; dest_index += 1; src_index += 4; in_buf_len -= 4; } if (in_buf_len > 1) { dest[dest_index] = decoder.char_to_index[source[src_index + 0]] << 2 | decoder.char_to_index[source[src_index + 1]] >> 4; dest_index += 1; } if (in_buf_len > 2) { dest[dest_index] = decoder.char_to_index[source[src_index + 1]] << 4 | decoder.char_to_index[source[src_index + 2]] >> 2; dest_index += 1; } if (in_buf_len > 3) { dest[dest_index] = decoder.char_to_index[source[src_index + 2]] << 6 | decoder.char_to_index[source[src_index + 3]]; dest_index += 1; } } }; fn calcDecodedSizeExactUnsafe(source: []const u8, pad_char: u8) usize { if (source.len == 0) return 0; var result = @divExact(source.len, 4) * 3; if (source[source.len - 1] == pad_char) { result -= 1; if (source[source.len - 2] == pad_char) { result -= 1; } } return result; } test "base64" { @setEvalBranchQuota(8000); testBase64() catch unreachable; comptime (testBase64() catch unreachable); } fn testBase64() !void { try testAllApis("", ""); try testAllApis("f", "Zg=="); try testAllApis("fo", "Zm8="); try testAllApis("foo", "Zm9v"); try testAllApis("foob", "Zm9vYg=="); try testAllApis("fooba", "Zm9vYmE="); try testAllApis("foobar", "Zm9vYmFy"); try testDecodeIgnoreSpace("", " "); try testDecodeIgnoreSpace("f", "Z g= ="); try testDecodeIgnoreSpace("fo", " Zm8="); try testDecodeIgnoreSpace("foo", "Zm9v "); try testDecodeIgnoreSpace("foob", "Zm9vYg = = "); try testDecodeIgnoreSpace("fooba", "Zm9v YmE="); try testDecodeIgnoreSpace("foobar", " Z m 9 v Y m F y "); // test getting some api errors try testError("A", error.InvalidPadding); try testError("AA", error.InvalidPadding); try testError("AAA", error.InvalidPadding); try testError("A..A", error.InvalidCharacter); try testError("AA=A", error.InvalidCharacter); try testError("AA/=", error.InvalidPadding); try testError("A/==", error.InvalidPadding); try testError("A===", error.InvalidCharacter); try testError("====", error.InvalidCharacter); try testOutputTooSmallError("AA=="); try testOutputTooSmallError("AAA="); try testOutputTooSmallError("AAAA"); try testOutputTooSmallError("AAAAAA=="); } fn testAllApis(expected_decoded: []const u8, expected_encoded: []const u8) !void { // Base64Encoder { var buffer: [0x100]u8 = undefined; const encoded = standard_encoder.encode(&buffer, expected_decoded); testing.expectEqualSlices(u8, expected_encoded, encoded); } // Base64Decoder { var buffer: [0x100]u8 = undefined; var decoded = buffer[0..try standard_decoder.calcSize(expected_encoded)]; try standard_decoder.decode(decoded, expected_encoded); testing.expectEqualSlices(u8, expected_decoded, decoded); } // Base64DecoderWithIgnore { const standard_decoder_ignore_nothing = Base64DecoderWithIgnore.init(standard_alphabet_chars, standard_pad_char, ""); var buffer: [0x100]u8 = undefined; var decoded = buffer[0..Base64DecoderWithIgnore.calcSizeUpperBound(expected_encoded.len)]; var written = try standard_decoder_ignore_nothing.decode(decoded, expected_encoded); testing.expect(written <= decoded.len); testing.expectEqualSlices(u8, expected_decoded, decoded[0..written]); } // Base64DecoderUnsafe { var buffer: [0x100]u8 = undefined; var decoded = buffer[0..standard_decoder_unsafe.calcSize(expected_encoded)]; standard_decoder_unsafe.decode(decoded, expected_encoded); testing.expectEqualSlices(u8, expected_decoded, decoded); } } fn testDecodeIgnoreSpace(expected_decoded: []const u8, encoded: []const u8) !void { const standard_decoder_ignore_space = Base64DecoderWithIgnore.init(standard_alphabet_chars, standard_pad_char, " "); var buffer: [0x100]u8 = undefined; var decoded = buffer[0..Base64DecoderWithIgnore.calcSizeUpperBound(encoded.len)]; var written = try standard_decoder_ignore_space.decode(decoded, encoded); testing.expectEqualSlices(u8, expected_decoded, decoded[0..written]); } fn testError(encoded: []const u8, expected_err: anyerror) !void { const standard_decoder_ignore_space = Base64DecoderWithIgnore.init(standard_alphabet_chars, standard_pad_char, " "); var buffer: [0x100]u8 = undefined; if (standard_decoder.calcSize(encoded)) |decoded_size| { var decoded = buffer[0..decoded_size]; if (standard_decoder.decode(decoded, encoded)) |_| { return error.ExpectedError; } else |err| if (err != expected_err) return err; } else |err| if (err != expected_err) return err; if (standard_decoder_ignore_space.decode(buffer[0..], encoded)) |_| { return error.ExpectedError; } else |err| if (err != expected_err) return err; } fn testOutputTooSmallError(encoded: []const u8) !void { const standard_decoder_ignore_space = Base64DecoderWithIgnore.init(standard_alphabet_chars, standard_pad_char, " "); var buffer: [0x100]u8 = undefined; var decoded = buffer[0 .. calcDecodedSizeExactUnsafe(encoded, standard_pad_char) - 1]; if (standard_decoder_ignore_space.decode(decoded, encoded)) |_| { return error.ExpectedError; } else |err| if (err != error.OutputTooSmall) return err; }
lib/std/base64.zig
const std = @import("std"); const crypto = std.crypto; const fmt = std.fmt; const io = std.io; const math = std.math; const mem = std.mem; const meta = std.meta; const pwhash = crypto.pwhash; const phc_format = @import("phc_encoding.zig"); const HmacSha256 = crypto.auth.hmac.sha2.HmacSha256; const KdfError = pwhash.KdfError; const HasherError = pwhash.HasherError; const EncodingError = phc_format.Error; const Error = pwhash.Error; const max_size = math.maxInt(usize); const max_int = max_size >> 1; const default_salt_len = 32; const default_hash_len = 32; const max_salt_len = 64; const max_hash_len = 64; fn blockCopy(dst: []align(16) u32, src: []align(16) const u32, n: usize) void { mem.copy(u32, dst, src[0 .. n * 16]); } fn blockXor(dst: []align(16) u32, src: []align(16) const u32, n: usize) void { for (src[0 .. n * 16]) |v, i| { dst[i] ^= v; } } const QuarterRound = struct { a: usize, b: usize, c: usize, d: u6 }; fn Rp(a: usize, b: usize, c: usize, d: u6) QuarterRound { return QuarterRound{ .a = a, .b = b, .c = c, .d = d }; } fn salsa8core(b: *align(16) [16]u32) void { const arx_steps = comptime [_]QuarterRound{ Rp(4, 0, 12, 7), Rp(8, 4, 0, 9), Rp(12, 8, 4, 13), Rp(0, 12, 8, 18), Rp(9, 5, 1, 7), Rp(13, 9, 5, 9), Rp(1, 13, 9, 13), Rp(5, 1, 13, 18), Rp(14, 10, 6, 7), Rp(2, 14, 10, 9), Rp(6, 2, 14, 13), Rp(10, 6, 2, 18), Rp(3, 15, 11, 7), Rp(7, 3, 15, 9), Rp(11, 7, 3, 13), Rp(15, 11, 7, 18), Rp(1, 0, 3, 7), Rp(2, 1, 0, 9), Rp(3, 2, 1, 13), Rp(0, 3, 2, 18), Rp(6, 5, 4, 7), Rp(7, 6, 5, 9), Rp(4, 7, 6, 13), Rp(5, 4, 7, 18), Rp(11, 10, 9, 7), Rp(8, 11, 10, 9), Rp(9, 8, 11, 13), Rp(10, 9, 8, 18), Rp(12, 15, 14, 7), Rp(13, 12, 15, 9), Rp(14, 13, 12, 13), Rp(15, 14, 13, 18), }; var x = b.*; var j: usize = 0; while (j < 8) : (j += 2) { inline for (arx_steps) |r| { x[r.a] ^= math.rotl(u32, x[r.b] +% x[r.c], r.d); } } j = 0; while (j < 16) : (j += 1) { b[j] +%= x[j]; } } fn salsaXor(tmp: *align(16) [16]u32, in: []align(16) const u32, out: []align(16) u32) void { blockXor(tmp, in, 1); salsa8core(tmp); blockCopy(out, tmp, 1); } fn blockMix(tmp: *align(16) [16]u32, in: []align(16) const u32, out: []align(16) u32, r: u30) void { blockCopy(tmp, in[(2 * r - 1) * 16 ..], 1); var i: usize = 0; while (i < 2 * r) : (i += 2) { salsaXor(tmp, in[i * 16 ..], out[i * 8 ..]); salsaXor(tmp, in[i * 16 + 16 ..], out[i * 8 + r * 16 ..]); } } fn integerify(b: []align(16) const u32, r: u30) u64 { const j = (2 * r - 1) * 16; return @as(u64, b[j]) | @as(u64, b[j + 1]) << 32; } fn smix(b: []align(16) u8, r: u30, n: usize, v: []align(16) u32, xy: []align(16) u32) void { var x = xy[0 .. 32 * r]; var y = xy[32 * r ..]; for (x) |*v1, j| { v1.* = mem.readIntSliceLittle(u32, b[4 * j ..]); } var tmp: [16]u32 align(16) = undefined; var i: usize = 0; while (i < n) : (i += 2) { blockCopy(v[i * (32 * r) ..], x, 2 * r); blockMix(&tmp, x, y, r); blockCopy(v[(i + 1) * (32 * r) ..], y, 2 * r); blockMix(&tmp, y, x, r); } i = 0; while (i < n) : (i += 2) { var j = @intCast(usize, integerify(x, r) & (n - 1)); blockXor(x, v[j * (32 * r) ..], 2 * r); blockMix(&tmp, x, y, r); j = @intCast(usize, integerify(y, r) & (n - 1)); blockXor(y, v[j * (32 * r) ..], 2 * r); blockMix(&tmp, y, x, r); } for (x) |v1, j| { mem.writeIntLittle(u32, b[4 * j ..][0..4], v1); } } /// Scrypt parameters pub const Params = struct { const Self = @This(); /// The CPU/Memory cost parameter [ln] is log2(N). ln: u6, /// The [r]esource usage parameter specifies the block size. r: u30, /// The [p]arallelization parameter. /// A large value of [p] can be used to increase the computational cost of scrypt without /// increasing the memory usage. p: u30, /// Baseline parameters for interactive logins pub const interactive = Self.fromLimits(524288, 16777216); /// Baseline parameters for offline usage pub const sensitive = Self.fromLimits(33554432, 1073741824); /// Create parameters from ops and mem limits, where mem_limit given in bytes pub fn fromLimits(ops_limit: u64, mem_limit: usize) Self { const ops = math.max(32768, ops_limit); const r: u30 = 8; if (ops < mem_limit / 32) { const max_n = ops / (r * 4); return Self{ .r = r, .p = 1, .ln = @intCast(u6, math.log2(max_n)) }; } else { const max_n = mem_limit / (@intCast(usize, r) * 128); const ln = @intCast(u6, math.log2(max_n)); const max_rp = math.min(0x3fffffff, (ops / 4) / (@as(u64, 1) << ln)); return Self{ .r = r, .p = @intCast(u30, max_rp / @as(u64, r)), .ln = ln }; } } }; /// Apply scrypt to generate a key from a password. /// /// scrypt is defined in RFC 7914. /// /// allocator: mem.Allocator. /// /// derived_key: Slice of appropriate size for generated key. Generally 16 or 32 bytes in length. /// May be uninitialized. All bytes will be overwritten. /// Maximum size is `derived_key.len / 32 == 0xffff_ffff`. /// /// password: Arbitrary sequence of bytes of any length. /// /// salt: Arbitrary sequence of bytes of any length. /// /// params: Params. pub fn kdf( allocator: mem.Allocator, derived_key: []u8, password: []const u8, salt: []const u8, params: Params, ) KdfError!void { if (derived_key.len == 0) return KdfError.WeakParameters; if (derived_key.len / 32 > 0xffff_ffff) return KdfError.OutputTooLong; if (params.ln == 0 or params.r == 0 or params.p == 0) return KdfError.WeakParameters; const n64 = @as(u64, 1) << params.ln; if (n64 > max_size) return KdfError.WeakParameters; const n = @intCast(usize, n64); if (@as(u64, params.r) * @as(u64, params.p) >= 1 << 30 or params.r > max_int / 128 / @as(u64, params.p) or params.r > max_int / 256 or n > max_int / 128 / @as(u64, params.r)) return KdfError.WeakParameters; var xy = try allocator.alignedAlloc(u32, 16, 64 * params.r); defer allocator.free(xy); var v = try allocator.alignedAlloc(u32, 16, 32 * n * params.r); defer allocator.free(v); var dk = try allocator.alignedAlloc(u8, 16, params.p * 128 * params.r); defer allocator.free(dk); try pwhash.pbkdf2(dk, password, salt, 1, HmacSha256); var i: u32 = 0; while (i < params.p) : (i += 1) { smix(dk[i * 128 * params.r ..], params.r, n, v, xy); } try pwhash.pbkdf2(derived_key, password, dk, 1, HmacSha256); } const crypt_format = struct { /// String prefix for scrypt pub const prefix = "$7$"; /// Standard type for a set of scrypt parameters, with the salt and hash. pub fn HashResult(comptime crypt_max_hash_len: usize) type { return struct { ln: u6, r: u30, p: u30, salt: []const u8, hash: BinValue(crypt_max_hash_len), }; } const Codec = CustomB64Codec("./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".*); /// A wrapped binary value whose maximum size is `max_len`. /// /// This type must be used whenever a binary value is encoded in a PHC-formatted string. /// This includes `salt`, `hash`, and any other binary parameters such as keys. /// /// Once initialized, the actual value can be read with the `constSlice()` function. pub fn BinValue(comptime max_len: usize) type { return struct { const Self = @This(); const capacity = max_len; const max_encoded_length = Codec.encodedLen(max_len); buf: [max_len]u8 = undefined, len: usize = 0, /// Wrap an existing byte slice pub fn fromSlice(slice: []const u8) EncodingError!Self { if (slice.len > capacity) return EncodingError.NoSpaceLeft; var bin_value: Self = undefined; mem.copy(u8, &bin_value.buf, slice); bin_value.len = slice.len; return bin_value; } /// Return the slice containing the actual value. pub fn constSlice(self: Self) []const u8 { return self.buf[0..self.len]; } fn fromB64(self: *Self, str: []const u8) !void { const len = Codec.decodedLen(str.len); if (len > self.buf.len) return EncodingError.NoSpaceLeft; try Codec.decode(self.buf[0..len], str); self.len = len; } fn toB64(self: Self, buf: []u8) ![]const u8 { const value = self.constSlice(); const len = Codec.encodedLen(value.len); if (len > buf.len) return EncodingError.NoSpaceLeft; var encoded = buf[0..len]; Codec.encode(encoded, value); return encoded; } }; } /// Expand binary data into a salt for the modular crypt format. pub fn saltFromBin(comptime len: usize, salt: [len]u8) [Codec.encodedLen(len)]u8 { var buf: [Codec.encodedLen(len)]u8 = undefined; Codec.encode(&buf, &salt); return buf; } /// Deserialize a string into a structure `T` (matching `HashResult`). pub fn deserialize(comptime T: type, str: []const u8) EncodingError!T { var out: T = undefined; if (str.len < 16) return EncodingError.InvalidEncoding; if (!mem.eql(u8, prefix, str[0..3])) return EncodingError.InvalidEncoding; out.ln = try Codec.intDecode(u6, str[3..4]); out.r = try Codec.intDecode(u30, str[4..9]); out.p = try Codec.intDecode(u30, str[9..14]); var it = mem.split(u8, str[14..], "$"); const salt = it.next() orelse return EncodingError.InvalidEncoding; if (@hasField(T, "salt")) out.salt = salt; const hash_str = it.next() orelse return EncodingError.InvalidEncoding; if (@hasField(T, "hash")) try out.hash.fromB64(hash_str); return out; } /// Serialize parameters into a string in modular crypt format. pub fn serialize(params: anytype, str: []u8) EncodingError![]const u8 { var buf = io.fixedBufferStream(str); try serializeTo(params, buf.writer()); return buf.getWritten(); } /// Compute the number of bytes required to serialize `params` pub fn calcSize(params: anytype) usize { var buf = io.countingWriter(io.null_writer); serializeTo(params, buf.writer()) catch unreachable; return @intCast(usize, buf.bytes_written); } fn serializeTo(params: anytype, out: anytype) !void { var header: [14]u8 = undefined; mem.copy(u8, header[0..3], prefix); Codec.intEncode(header[3..4], params.ln); Codec.intEncode(header[4..9], params.r); Codec.intEncode(header[9..14], params.p); try out.writeAll(&header); try out.writeAll(params.salt); try out.writeAll("$"); var buf: [@TypeOf(params.hash).max_encoded_length]u8 = undefined; const hash_str = try params.hash.toB64(&buf); try out.writeAll(hash_str); } /// Custom codec that maps 6 bits into 8 like regular Base64, but uses its own alphabet, /// encodes bits in little-endian, and can also encode integers. fn CustomB64Codec(comptime map: [64]u8) type { return struct { const map64 = map; fn encodedLen(len: usize) usize { return (len * 4 + 2) / 3; } fn decodedLen(len: usize) usize { return len / 4 * 3 + (len % 4) * 3 / 4; } fn intEncode(dst: []u8, src: anytype) void { var n = src; for (dst) |*x| { x.* = map64[@truncate(u6, n)]; n = math.shr(@TypeOf(src), n, 6); } } fn intDecode(comptime T: type, src: *const [(meta.bitCount(T) + 5) / 6]u8) !T { var v: T = 0; for (src) |x, i| { const vi = mem.indexOfScalar(u8, &map64, x) orelse return EncodingError.InvalidEncoding; v |= @intCast(T, vi) << @intCast(math.Log2Int(T), i * 6); } return v; } fn decode(dst: []u8, src: []const u8) !void { std.debug.assert(dst.len == decodedLen(src.len)); var i: usize = 0; while (i < src.len / 4) : (i += 1) { mem.writeIntSliceLittle(u24, dst[i * 3 ..], try intDecode(u24, src[i * 4 ..][0..4])); } const leftover = src[i * 4 ..]; var v: u24 = 0; for (leftover) |_, j| { v |= @as(u24, try intDecode(u6, leftover[j..][0..1])) << @intCast(u5, j * 6); } for (dst[i * 3 ..]) |*x, j| { x.* = @truncate(u8, v >> @intCast(u5, j * 8)); } } fn encode(dst: []u8, src: []const u8) void { std.debug.assert(dst.len == encodedLen(src.len)); var i: usize = 0; while (i < src.len / 3) : (i += 1) { intEncode(dst[i * 4 ..][0..4], mem.readIntSliceLittle(u24, src[i * 3 ..])); } const leftover = src[i * 3 ..]; var v: u24 = 0; for (leftover) |x, j| { v |= @as(u24, x) << @intCast(u5, j * 8); } intEncode(dst[i * 4 ..], v); } }; } }; /// Hash and verify passwords using the PHC format. const PhcFormatHasher = struct { const alg_id = "scrypt"; const BinValue = phc_format.BinValue; const HashResult = struct { alg_id: []const u8, ln: u6, r: u30, p: u30, salt: BinValue(max_salt_len), hash: BinValue(max_hash_len), }; /// Return a non-deterministic hash of the password encoded as a PHC-format string pub fn create( allocator: mem.Allocator, password: []const u8, params: Params, buf: []u8, ) HasherError![]const u8 { var salt: [default_salt_len]u8 = undefined; crypto.random.bytes(&salt); var hash: [default_hash_len]u8 = undefined; try kdf(allocator, &hash, password, &salt, params); return phc_format.serialize(HashResult{ .alg_id = alg_id, .ln = params.ln, .r = params.r, .p = params.p, .salt = try BinValue(max_salt_len).fromSlice(&salt), .hash = try BinValue(max_hash_len).fromSlice(&hash), }, buf); } /// Verify a password against a PHC-format encoded string pub fn verify( allocator: mem.Allocator, str: []const u8, password: []const u8, ) HasherError!void { const hash_result = try phc_format.deserialize(HashResult, str); if (!mem.eql(u8, hash_result.alg_id, alg_id)) return HasherError.PasswordVerificationFailed; const params = Params{ .ln = hash_result.ln, .r = hash_result.r, .p = hash_result.p }; const expected_hash = hash_result.hash.constSlice(); var hash_buf: [max_hash_len]u8 = undefined; if (expected_hash.len > hash_buf.len) return HasherError.InvalidEncoding; var hash = hash_buf[0..expected_hash.len]; try kdf(allocator, hash, password, hash_result.salt.constSlice(), params); if (!mem.eql(u8, hash, expected_hash)) return HasherError.PasswordVerificationFailed; } }; /// Hash and verify passwords using the modular crypt format. const CryptFormatHasher = struct { const BinValue = crypt_format.BinValue; const HashResult = crypt_format.HashResult(max_hash_len); /// Length of a string returned by the create() function pub const pwhash_str_length: usize = 101; /// Return a non-deterministic hash of the password encoded into the modular crypt format pub fn create( allocator: mem.Allocator, password: []const u8, params: Params, buf: []u8, ) HasherError![]const u8 { var salt_bin: [default_salt_len]u8 = undefined; crypto.random.bytes(&salt_bin); const salt = crypt_format.saltFromBin(salt_bin.len, salt_bin); var hash: [default_hash_len]u8 = undefined; try kdf(allocator, &hash, password, &salt, params); return crypt_format.serialize(HashResult{ .ln = params.ln, .r = params.r, .p = params.p, .salt = &salt, .hash = try BinValue(max_hash_len).fromSlice(&hash), }, buf); } /// Verify a password against a string in modular crypt format pub fn verify( allocator: mem.Allocator, str: []const u8, password: []const u8, ) HasherError!void { const hash_result = try crypt_format.deserialize(HashResult, str); const params = Params{ .ln = hash_result.ln, .r = hash_result.r, .p = hash_result.p }; const expected_hash = hash_result.hash.constSlice(); var hash_buf: [max_hash_len]u8 = undefined; if (expected_hash.len > hash_buf.len) return HasherError.InvalidEncoding; var hash = hash_buf[0..expected_hash.len]; try kdf(allocator, hash, password, hash_result.salt, params); if (!mem.eql(u8, hash, expected_hash)) return HasherError.PasswordVerificationFailed; } }; /// Options for hashing a password. /// /// Allocator is required for scrypt. pub const HashOptions = struct { allocator: ?mem.Allocator, params: Params, encoding: pwhash.Encoding, }; /// Compute a hash of a password using the scrypt key derivation function. /// The function returns a string that includes all the parameters required for verification. pub fn strHash( password: []const u8, options: HashOptions, out: []u8, ) Error![]const u8 { const allocator = options.allocator orelse return Error.AllocatorRequired; switch (options.encoding) { .phc => return PhcFormatHasher.create(allocator, password, options.params, out), .crypt => return CryptFormatHasher.create(allocator, password, options.params, out), } } /// Options for hash verification. /// /// Allocator is required for scrypt. pub const VerifyOptions = struct { allocator: ?mem.Allocator, }; /// Verify that a previously computed hash is valid for a given password. pub fn strVerify( str: []const u8, password: []const u8, options: VerifyOptions, ) Error!void { const allocator = options.allocator orelse return Error.AllocatorRequired; if (mem.startsWith(u8, str, crypt_format.prefix)) { return CryptFormatHasher.verify(allocator, str, password); } else { return PhcFormatHasher.verify(allocator, str, password); } } // These tests take way too long to run, so I have disabled them. const run_long_tests = false; test "kdf" { if (!run_long_tests) return error.SkipZigTest; const password = "<PASSWORD>"; const salt = "<PASSWORD>"; var dk: [32]u8 = undefined; try kdf(std.testing.allocator, &dk, password, salt, .{ .ln = 15, .r = 8, .p = 1 }); const hex = "1e0f97c3f6609024022fbe698da29c2fe53ef1087a8e396dc6d5d2a041e886de"; var bytes: [hex.len / 2]u8 = undefined; _ = try fmt.hexToBytes(&bytes, hex); try std.testing.expectEqualSlices(u8, &bytes, &dk); } test "kdf rfc 1" { if (!run_long_tests) return error.SkipZigTest; const password = ""; const salt = ""; var dk: [64]u8 = undefined; try kdf(std.testing.allocator, &dk, password, salt, .{ .ln = 4, .r = 1, .p = 1 }); const hex = "77d6576238657b203b19ca42c18a0497f16b4844e3074ae8dfdffa3fede21442fcd0069ded0948f8326a753a0fc81f17e8d3e0fb2e0d3628cf35e20c38d18906"; var bytes: [hex.len / 2]u8 = undefined; _ = try fmt.hexToBytes(&bytes, hex); try std.testing.expectEqualSlices(u8, &bytes, &dk); } test "kdf rfc 2" { if (!run_long_tests) return error.SkipZigTest; const password = "password"; const salt = "<PASSWORD>"; var dk: [64]u8 = undefined; try kdf(std.testing.allocator, &dk, password, salt, .{ .ln = 10, .r = 8, .p = 16 }); const hex = "fdbabe1c9d3472007856e7190d01e9fe7c6ad7cbc8237830e77376634b3731622eaf30d92e22a3886ff109279d9830dac727afb94a83ee6d8360cbdfa2cc0640"; var bytes: [hex.len / 2]u8 = undefined; _ = try fmt.hexToBytes(&bytes, hex); try std.testing.expectEqualSlices(u8, &bytes, &dk); } test "kdf rfc 3" { if (!run_long_tests) return error.SkipZigTest; const password = "<PASSWORD>"; const salt = "<PASSWORD>"; var dk: [64]u8 = undefined; try kdf(std.testing.allocator, &dk, password, salt, .{ .ln = 14, .r = 8, .p = 1 }); const hex = "7023bdcb3afd7348461c06cd81fd38ebfda8fbba904f8e3ea9b543f6545da1f2d5432955613f0fcf62d49705242a9af9e61e85dc0d651e40dfcf017b45575887"; var bytes: [hex.len / 2]u8 = undefined; _ = try fmt.hexToBytes(&bytes, hex); try std.testing.expectEqualSlices(u8, &bytes, &dk); } test "kdf rfc 4" { if (!run_long_tests) return error.SkipZigTest; const password = "<PASSWORD>"; const salt = "<PASSWORD>"; var dk: [64]u8 = undefined; try kdf(std.testing.allocator, &dk, password, salt, .{ .ln = 20, .r = 8, .p = 1 }); const hex = "2101cb9b6a511aaeaddbbe09cf70f881ec568d574a2ffd4dabe5ee9820adaa478e56fd8f4ba5d09ffa1c6d927c40f4c337304049e8a952fbcbf45c6fa77a41a4"; var bytes: [hex.len / 2]u8 = undefined; _ = try fmt.hexToBytes(&bytes, hex); try std.testing.expectEqualSlices(u8, &bytes, &dk); } test "password hashing (crypt format)" { if (!run_long_tests) return error.SkipZigTest; const alloc = std.testing.allocator; const str = "$7$A6....1....TrXs5Zk6s8sWHpQgWDIXTR8kUU3s6Jc3s.DtdS8M2i4$a4ik5hGDN7foMuHOW.cp.CtX01UyCeO0.JAG.AHPpx5"; const password = "<PASSWORD>(`"; try CryptFormatHasher.verify(alloc, str, password); const params = Params.interactive; var buf: [CryptFormatHasher.pwhash_str_length]u8 = undefined; const str2 = try CryptFormatHasher.create(alloc, password, params, &buf); try CryptFormatHasher.verify(alloc, str2, password); } test "strHash and strVerify" { if (!run_long_tests) return error.SkipZigTest; const alloc = std.testing.allocator; const password = "<PASSWORD>"; const params = Params.interactive; const verify_options = VerifyOptions{ .allocator = alloc }; var buf: [128]u8 = undefined; { const str = try strHash( password, .{ .allocator = alloc, .params = params, .encoding = .crypt }, &buf, ); try strVerify(str, password, verify_options); } { const str = try strHash( password, .{ .allocator = alloc, .params = params, .encoding = .phc }, &buf, ); try strVerify(str, password, verify_options); } } test "unix-scrypt" { if (!run_long_tests) return error.SkipZigTest; const alloc = std.testing.allocator; // https://gitlab.com/jas/scrypt-unix-crypt/blob/master/unix-scrypt.txt { const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D"; const password = "<PASSWORD>"; try strVerify(str, password, .{ .allocator = alloc }); } // one of the libsodium test vectors { const str = "$7$B6....1....75gBMAGwfFWZqBdyF3WdTQnWdUsuTiWjG1fF9c1jiSD$tc8RoB3.Em3/zNgMLWo2u00oGIoTyJv4fl3Fl8Tix72"; const password = "^T5H$JYt<PASSWORD>%K*j:W]!1s?vg!:jGi]Ax?..l7[p0v:1jHTpla9;]bUN;?bWyCbtqg nrDFal+Jxl3,2`#^tFSu%v_+7iYse8-cCkNf!tD=KrW)"; try strVerify(str, password, .{ .allocator = alloc }); } } test "crypt format" { const str = "$7$C6..../....SodiumChloride$kBGj9fHznVYFQMEn/qDCfrDevf9YDtcDdKvEqHJLV8D"; const params = try crypt_format.deserialize(crypt_format.HashResult(32), str); var buf: [str.len]u8 = undefined; const s1 = try crypt_format.serialize(params, &buf); try std.testing.expectEqualStrings(s1, str); } test "kdf fast" { const TestVector = struct { password: []const u8, salt: []const u8, params: Params, want: []const u8, }; const test_vectors = [_]TestVector{ .{ .password = "p", .salt = "s", .params = .{ .ln = 1, .r = 1, .p = 1 }, .want = &([_]u8{ 0x48, 0xb0, 0xd2, 0xa8, 0xa3, 0x27, 0x26, 0x11, 0x98, 0x4c, 0x50, 0xeb, 0xd6, 0x30, 0xaf, 0x52, }), }, }; inline for (test_vectors) |v| { var dk: [v.want.len]u8 = undefined; try kdf(std.testing.allocator, &dk, v.password, v.salt, v.params); try std.testing.expectEqualSlices(u8, &dk, v.want); } }
lib/std/crypto/scrypt.zig
const std = @import("std"); const console = @import("utils/console.zig"); const string = @import("utils/string.zig"); const attacks = @import("bitboards/attacks.zig"); const masks = @import("bitboards/masks.zig"); const MoveList = @import("types/MoveList.zig"); const Square = @import("types/enums.zig").Square; const Board = @import("types/Board.zig"); const Piece = @import("types/Piece.zig"); const Move = @import("types/Move.zig"); const perft = @import("perft.zig"); const SearchParamters = struct { movetime: u32, }; const SearchGlobals = struct { start_time: u32, end_time: u32, lock: std.Mutex, stop: bool, }; fn uciIntroduction() void { console.println("id name WyldZig", .{}); console.println("id author <NAME>", .{}); } pub fn uci() void { uciIntroduction(); var board: Board = Board.parse("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"); var input_buffer: [2048]u8 = undefined; while (true) { const line = console.readln(input_buffer[0..]); if (string.equals(line, "quit")) { break; } else if (string.startsWith(line, "position")) { if (line.len < 10) { console.println("Invalid position command!", .{}); continue; } const remaining = line[9..]; if (string.equals(remaining, "startpos")) { board = Board.parse("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"); } else if (string.startsWith(remaining, "fen")) { if (remaining.len < 5) { console.println("Invalid position command!", .{}); continue; } board = Board.parse(remaining[4..]); } else { console.println("Invalid position command!", .{}); } } else if (string.equals(line, "d")) { board.print(); } else if (string.startsWith(line, "perft")) { if (line.len < 7) { console.println("Invalid perft command!", .{}); continue; } const remaining = line[6..]; const depth = std.fmt.parseInt(usize, remaining, 10) catch unreachable; const start_time = std.time.milliTimestamp(); const leafCount = perft.perft(&board, depth, true); const end_time = std.time.milliTimestamp(); console.println("info depth {} time {} nodes: {}", .{ depth, end_time - start_time, leafCount }); } else if (string.startsWith(line, "move")) { if (line.len < 6) { console.println("Invalid move command!", .{}); continue; } const remaining = line[5..]; const parsed_move = Move.parse(remaining); if (parsed_move) |move| { board.makeMove(move); } else { console.println("Invalid move: {}", .{remaining}); } } else { console.println("Unsupported command: {}", .{line}); } } }
src/uci.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const Row = []bool; const open = '.'; const tree = '#'; const Slope = struct { right: u16, down: u16 = 1 }; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = &gpa.allocator; defer _ = gpa.deinit(); const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); if (args.len != 2) { std.log.err("Please provide an input file path.", .{}); return; } const input_file = try std.fs.cwd().openFile(args[1], .{}); defer input_file.close(); const input_reader = input_file.reader(); var forest = std.ArrayList(Row).init(allocator); defer { for (forest.items) |item| { allocator.destroy(item.ptr); } forest.deinit(); } var buf: [64]u8 = undefined; var row_width: u16 = 0; while (try input_reader.readUntilDelimiterOrEof(buf[0..], '\n')) |line| { if (row_width == 0) { row_width = @intCast(@TypeOf(row_width), line.len); } const row: Row = try allocator.alloc(bool, row_width); var pos: u16 = 0; while (pos < row_width) { if (line[pos] == open) { row[pos] = false; } else { row[pos] = true; } pos += 1; } try forest.append(row); } std.log.info("The solution for part 1 is {}.", .{part1(forest)}); const slopes = [_]Slope{ .{ .right = 1 }, .{ .right = 3 }, .{ .right = 5 }, .{ .right = 7 }, .{ .right = 1, .down = 2 }, }; var solution2: u32 = 1; for (slopes) |slope| { solution2 *= part2(forest, slope); } std.log.info("The solution for part 2 is {}.", .{solution2}); } fn part1(forest: std.ArrayList(Row)) u32 { return part2(forest, Slope{ .right = 3}); } fn part2(forest: std.ArrayList(Row), slope: Slope) u32 { var row_width = forest.items[0].len; var column_index: u16 = 0; var row_index: u16 = 0; var hits: u32 = 0; for (forest.items) |row| { if (@mod(row_index, slope.down) != 0) { row_index += 1; continue; } if (row[column_index] == true) { hits += 1; } column_index = @mod(column_index + slope.right, @intCast(@TypeOf(column_index), row_width)); row_index += 1; } return hits; }
src/day03.zig
const std = @import("std"); const fs = std.fs; const Image = @import("../image.zig").Image; const upaya = @import("../upaya_cli.zig"); const math = upaya.math; const stb = @import("stb"); pub const TexturePacker = struct { pub const Atlas = struct { names: [][]const u8, rects: []math.RectI, w: u16, h: u16, image: upaya.Image = undefined, pub fn init(frames: []stb.stbrp_rect, files: [][]const u8, size: Size) Atlas { std.debug.assert(frames.len == files.len); var res_atlas = Atlas{ .names = upaya.mem.allocator.alloc([]const u8, files.len) catch unreachable, .rects = upaya.mem.allocator.alloc(math.RectI, frames.len) catch unreachable, .w = size.width, .h = size.height, }; // convert to upaya rects for (frames) |frame, i| { res_atlas.rects[i] = .{ .x = frame.x, .y = frame.y, .w = frame.w, .h = frame.h }; } for (files) |file, i| { res_atlas.names[i] = std.mem.dupe(upaya.mem.allocator, u8, fs.path.basename(file)) catch unreachable; } // generate the atlas var image = upaya.Image.init(size.width, size.height); image.fillRect(.{ .w = size.width, .h = size.height }, upaya.math.Color.transparent); for (files) |file, i| { var sub_image = upaya.Image.initFromFile(file); defer sub_image.deinit(); image.blit(sub_image, frames[i].x, frames[i].y); } res_atlas.image = image; return res_atlas; } pub fn deinit(self: Atlas) void { for (self.names) |name| { upaya.mem.allocator.free(name); } upaya.mem.allocator.free(self.names); upaya.mem.allocator.free(self.rects); self.image.deinit(); } /// saves the atlas image and a json file with the atlas details. filename should be only the name with no extension. pub fn save(self: Atlas, folder: []const u8, filename: []const u8) void { const img_filename = std.mem.concat(upaya.mem.allocator, u8, &[_][]const u8{ filename, ".png" }) catch unreachable; const atlas_filename = std.mem.concat(upaya.mem.allocator, u8, &[_][]const u8{ filename, ".json" }) catch unreachable; var out_file = fs.path.join(upaya.mem.tmp_allocator, &[_][]const u8{ folder, img_filename }) catch unreachable; self.image.save(out_file); out_file = fs.path.join(upaya.mem.tmp_allocator, &[_][]const u8{ folder, atlas_filename }) catch unreachable; var handle = std.fs.cwd().createFile(out_file, .{}) catch unreachable; defer handle.close(); const out_stream = handle.writer(); const options = std.json.StringifyOptions{ .whitespace = .{} }; std.json.stringify(.{ .names = self.names, .rects = self.rects }, options, out_stream) catch unreachable; } }; pub const Size = struct { width: u16, height: u16, }; pub fn pack(folder: []const u8) !Atlas { const pngs = upaya.fs.getAllFilesOfType(upaya.mem.allocator, folder, ".png", true); const frames = getFramesForPngs(pngs); if (runRectPacker(frames)) |atlas_size| { return Atlas.init(frames, pngs, atlas_size); } else { return error.NotEnoughRoom; } } fn getFramesForPngs(pngs: [][]const u8) []stb.stbrp_rect { var frames = std.ArrayList(stb.stbrp_rect).init(upaya.mem.allocator); for (pngs) |png, i| { var w: c_int = undefined; var h: c_int = undefined; const tex_size = upaya.Image.getTextureSize(png, &w, &h); frames.append(.{ .id = @intCast(c_int, i), .w = @intCast(u16, w), .h = @intCast(u16, h), }) catch unreachable; } return frames.toOwnedSlice(); } fn runRectPacker(frames: []stb.stbrp_rect) ?Size { var ctx: stb.stbrp_context = undefined; const rects_size = @sizeOf(stb.stbrp_rect) * frames.len; const node_count = 4096 * 2; var nodes: [node_count]stb.stbrp_node = undefined; const texture_sizes = [_][2]c_int{ [_]c_int{ 256, 256 }, [_]c_int{ 512, 256 }, [_]c_int{ 256, 512 }, [_]c_int{ 512, 512 }, [_]c_int{ 1024, 512 }, [_]c_int{ 512, 1024 }, [_]c_int{ 1024, 1024 }, [_]c_int{ 2048, 1024 }, [_]c_int{ 1024, 2048 }, [_]c_int{ 2048, 2048 }, [_]c_int{ 4096, 2048 }, [_]c_int{ 2048, 4096 }, [_]c_int{ 4096, 4096 }, [_]c_int{ 8192, 4096 }, [_]c_int{ 4096, 8192 }, }; for (texture_sizes) |tex_size| { stb.stbrp_init_target(&ctx, tex_size[0], tex_size[1], &nodes, node_count); stb.stbrp_setup_heuristic(&ctx, stb.STBRP_HEURISTIC_Skyline_default); if (stb.stbrp_pack_rects(&ctx, frames.ptr, @intCast(c_int, frames.len)) == 1) { return Size{ .width = @intCast(u16, tex_size[0]), .height = @intCast(u16, tex_size[1]) }; } } return null; } };
src/utils/texture_packer.zig
const std = @import("std"); const input = @embedFile("data/input07"); usingnamespace @import("util.zig"); pub fn main() !void { var allocator_state = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer allocator_state.deinit(); const allocator = &allocator_state.allocator; const entries = try parse(allocator, input); print("[Part1] Count: {}", .{countShinyGold(entries)}); print("[Part2] Count: {}", .{getNumberOfBagsInsideShinyGold(entries)}); } const Bag = struct { color: []const u8, count: usize, }; const Entries = std.StringHashMap([]const Bag); fn parse(allocator: *std.mem.Allocator, inputStr: []const u8) !Entries { var entries = Entries.init(allocator); var reader = lines(inputStr); while (reader.next()) |line| { const colorEnd = std.mem.indexOf(u8, line, " bag") orelse return error.InvalidFormat; const color = line[0..colorEnd]; var contents = line[colorEnd+" bags contain ".len..]; var containedBags: []const Bag = &[_]Bag{}; if (contents[0] != 'n') { var bags = std.ArrayList(Bag).init(allocator); while (true) { var bag: Bag = undefined; const countEnd = std.mem.indexOf(u8, contents, " ") orelse return error.InvalidFormat; bag.count = try std.fmt.parseUnsigned(usize, contents[0..countEnd], 10); const separator = if (bag.count == 1) " bag" else " bags"; const containedColorEnd = std.mem.indexOfPos(u8, contents, countEnd + 1, separator) orelse return error.InvalidFormat; bag.color = contents[countEnd + 1..containedColorEnd]; try bags.append(bag); if (contents[containedColorEnd + separator.len] == '.') { break; } else { contents = contents[containedColorEnd + separator.len + 2..]; } } containedBags = bags.toOwnedSlice(); } try entries.putNoClobber(color, containedBags); } return entries; } fn countShinyGold(entries: Entries) usize { var num: usize = 0; var it = entries.iterator(); while (it.next()) |entry| { num += @boolToInt(canContainBag(entries, entry.key, "shiny gold")); } return num; } fn canContainBag(entries: Entries, containerColor: []const u8, comptime requiredColor: []const u8) bool { var containedBags = entries.get(containerColor).?; for (containedBags) |bag| { if (std.mem.eql(u8, bag.color, requiredColor) or canContainBag(entries, bag.color, requiredColor)) { return true; } } return false; } fn getNumberOfBagsInsideShinyGold(entries: Entries) usize { return getNumberOfBagsInside(entries, "shiny gold"); } fn getNumberOfBagsInside(entries: Entries, color: []const u8) usize { var sum: usize = 0; var containedBags = entries.get(color).?; for (containedBags) |bag| { sum += bag.count + bag.count * getNumberOfBagsInside(entries, bag.color); } return sum; } const expectEqual = std.testing.expectEqual; test "countShinyGold" { var allocator_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer allocator_state.deinit(); const allocator = &allocator_state.allocator; expectEqual(@as(usize, 4), countShinyGold(try parse(allocator, \\light red bags contain 1 bright white bag, 2 muted yellow bags. \\dark orange bags contain 3 bright white bags, 4 muted yellow bags. \\bright white bags contain 1 shiny gold bag. \\muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. \\shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. \\dark olive bags contain 3 faded blue bags, 4 dotted black bags. \\vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. \\faded blue bags contain no other bags. \\dotted black bags contain no other bags. ))); } test "getNumberOfBagsInsideShinyGold" { var allocator_state = std.heap.ArenaAllocator.init(std.testing.allocator); defer allocator_state.deinit(); const allocator = &allocator_state.allocator; expectEqual(@as(usize, 32), getNumberOfBagsInsideShinyGold(try parse(allocator, \\light red bags contain 1 bright white bag, 2 muted yellow bags. \\dark orange bags contain 3 bright white bags, 4 muted yellow bags. \\bright white bags contain 1 shiny gold bag. \\muted yellow bags contain 2 shiny gold bags, 9 faded blue bags. \\shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags. \\dark olive bags contain 3 faded blue bags, 4 dotted black bags. \\vibrant plum bags contain 5 faded blue bags, 6 dotted black bags. \\faded blue bags contain no other bags. \\dotted black bags contain no other bags. ))); expectEqual(@as(usize, 126), getNumberOfBagsInsideShinyGold(try parse(allocator, \\shiny gold bags contain 2 dark red bags. \\dark red bags contain 2 dark orange bags. \\dark orange bags contain 2 dark yellow bags. \\dark yellow bags contain 2 dark green bags. \\dark green bags contain 2 dark blue bags. \\dark blue bags contain 2 dark violet bags. \\dark violet bags contain no other bags. ))); }
src/day07.zig
const base = @import("../../base.zig"); //Recorded in Clavis Calendaria: Or, A Compendious Analysis of the Calendar //by <NAME> //https://books.google.ca/books?id=pKjhAAAAMAAJ&pg=PA38&redir_esc=y#v=onepage&q&f=false var french_revolutionary_month_list_en_GB_joke = [_:null]?[*:0]u8{ "Wheezy", "Sneezy", "Freezy", "Slippy", "Drippy", "Nippy", "Showery", "Flowery", "Bowery", "Hoppy", "Croppy", "Poppy", }; //Suggested in The French Revolution, A History //By <NAME> //https://books.google.ca/books?id=81sQAAAAYAAJ&pg=PP7&source=gbs_selected_pages&cad=2#v=onepage&q=Vintagearious&f=false var french_revolutionary_month_list_en_GB_carlyle = [_:null]?[*:0]u8{ "Vintagearious", "Fogarious", "Frostarious", "Snowous", "Rainous", "Windous", "Buddal", "Floweral", "Meadowal", "Reapidor", "Heatidor", "Fruitidor", }; var french_revolutionary_weekday_list_en_GB = [_:null]?[*:0]u8{ "First Day", "Second Day", "Third Day", "Fourth Day", "Fifth Day", "Sixth Day", "Seventh Day", "Eighth Day", "Ninth Day", "Tenth Day", }; var french_revolutionary_era_list_en_GB = [_:null]?[*:0]u8{ "Before Liberty", "of Liberty", }; var french_revolutionary_intercalary_list_en_GB = [_:null]?[*:0]u8{ "Festival of Virtue", "Festival of Genius", "Festival of Labour", "Festival of Opinion", "Festival of Rewards", "Festival of the Revolution", }; const NAME = "French Revolutionary"; var name_var: [NAME.len:0]u8 = NAME.*; pub const names_en_GB_french_revolutionary = base.NameList{ .month_list = @ptrCast([*:null]?[*:0]u8, &french_revolutionary_month_list_en_GB_carlyle), .weekday_list = @ptrCast([*:null]?[*:0]u8, &french_revolutionary_weekday_list_en_GB), .era_list = @ptrCast([*:null]?[*:0]u8, &french_revolutionary_era_list_en_GB), .intercalary_list = @ptrCast([*:null]?[*:0]u8, &french_revolutionary_intercalary_list_en_GB), .alt_intercalary_list = null, .calendar_name = @ptrCast([*:0]u8, &name_var), }; pub const names_en_GB_french_revolutionary_joke = base.NameList{ .month_list = @ptrCast([*:null]?[*:0]u8, &french_revolutionary_month_list_en_GB_joke), .weekday_list = names_en_GB_french_revolutionary.weekday_list, .era_list = names_en_GB_french_revolutionary.era_list, .intercalary_list = names_en_GB_french_revolutionary.intercalary_list, .alt_intercalary_list = names_en_GB_french_revolutionary.alt_intercalary_list, .calendar_name = names_en_GB_french_revolutionary.calendar_name, };
src/names/en_GB/french_revolutionary.zig
const std = @import("std"); const c = @cImport({ @cInclude("nanovg.h"); @cInclude("glad/glad.h"); @cDefine("NANOVG_GL2", "1"); @cInclude("nanovg_gl.h"); }); pub const Pi: f32 = 3.14159265358979323846264338327; // pub const Color = struct { // ABI incompatible :( // r: f32, // g: f32, // b: f32, // a: f32, // fn c(self: Color) c.NVGcolor { // return @bitCast(c.NVGcolor, self); // } // }; pub const Color = c.NVGcolor; pub const Paint = c.NVGpaint; pub const Winding = enum(u2) { ccw = 1, // Winding for solid shapes cw = 2, // Winding for holes }; pub const Solidity = enum(u1) { solid = 1, // CCW hole = 2, // CW }; pub const LineCap = enum(u2) { butt, round, square, }; pub const LineJoin = enum(u2) { miter, round, bevel, }; pub const TextAlign = struct { pub const HorizontalAlign = enum(u8) { left = 1 << 0, center = 1 << 1, right = 1 << 2, _, }; pub const VerticalAlign = enum(u8) { top = 1 << 3, middle = 1 << 4, bottom = 1 << 5, baseline = 1 << 6, // Default, align text vertically to baseline. _, }; horizontal: HorizontalAlign = .left, vertical: VerticalAlign = .baseline, pub fn toInt(text_align: TextAlign) u8 { return @enumToInt(text_align.horizontal) | @enumToInt(text_align.vertical); } }; pub const GlyphPosition = c.NVGglyphPosition; pub const Image = struct { handle: i32, }; pub const ImageFlags = packed struct { generate_mipmaps: bool = false, // Generate mipmaps during creation of the image. repeat_x: bool = false, // Repeat image in X direction. repeat_y: bool = false, // Repeat image in Y direction. flip_y: bool = false, // Flips (inverses) image in Y direction when rendered. premultiplied: bool = false, // Image data has premultiplied alpha. nearest: bool = false, // Image interpolation is Nearest instead Linear }; var ctx: ?*c.NVGcontext = undefined; pub fn init() void { ctx = c.nvgCreateGL2(0); } pub fn quit() void { c.nvgDeleteGL2(ctx); } // Begin drawing a new frame // Calls to nanovg drawing API should be wrapped in nvgBeginFrame() & nvgEndFrame() // nvgBeginFrame() defines the size of the window to render to in relation currently // set viewport (i.e. glViewport on GL backends). Device pixel ration allows to // control the rendering on Hi-DPI devices. // For example, GLFW returns two dimension for an opened window: window size and // frame buffer size. In that case you would set windowWidth/Height to the window size // devicePixelRatio to: frameBufferWidth / windowWidth. pub fn beginFrame(window_width: f32, window_height: f32, device_pixel_ratio: f32) void { c.nvgBeginFrame(ctx, window_width, window_height, device_pixel_ratio); } // Cancels drawing the current frame. pub fn cancelFrame() void { c.nvgCancelFrame(ctx); } // Ends drawing flushing remaining render state. pub fn endFrame() void { c.nvgEndFrame(ctx); } // // Color utils // // Colors in NanoVG are stored as unsigned ints in ABGR format. // Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0f). pub fn rgb(r: u8, g: u8, b: u8) Color { return rgbf( @intToFloat(f32, r) / 255.0, @intToFloat(f32, g) / 255.0, @intToFloat(f32, b) / 255.0, ); } // Returns a color value from red, green, blue values. Alpha will be set to 1.0f. pub fn rgbf(r: f32, g: f32, b: f32) Color { return rgbaf(r, g, b, 1); } // Returns a color value from red, green, blue and alpha values. pub fn rgba(r: u8, g: u8, b: u8, a: u8) Color { return rgbaf( @intToFloat(f32, r) / 255.0, @intToFloat(f32, g) / 255.0, @intToFloat(f32, b) / 255.0, @intToFloat(f32, a) / 255.0, ); } // Returns a color value from red, green, blue and alpha values. pub fn rgbaf(r: f32, g: f32, b: f32, a: f32) Color { return c.nvgRGBAf(r, g, b, a); //return .{ .unnamed_0 = .{ .rgba = [_]f32{ r, g, b, a }}, .zigpad = undefined }; // return .{ .r = r, .g = g, .b = b, .a = a }; } // // Linearly interpolates from color c0 to c1, and returns resulting color value. // NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u); // // Sets transparency of a color value. // NVGcolor nvgTransRGBA(NVGcolor c0, unsigned char a); // // Sets transparency of a color value. // NVGcolor nvgTransRGBAf(NVGcolor c0, float a); // // Returns color value specified by hue, saturation and lightness. // // HSL values are all in range [0..1], alpha will be set to 255. // NVGcolor nvgHSL(float h, float s, float l); // // Returns color value specified by hue, saturation and lightness and alpha. // // HSL values are all in range [0..1], alpha in range [0..255] // NVGcolor nvgHSLA(float h, float s, float l, unsigned char a); // // State Handling // // NanoVG contains state which represents how paths will be rendered. // The state contains transform, fill and stroke styles, text and font styles, // and scissor clipping. // Pushes and saves the current render state into a state stack. // A matching nvgRestore() must be used to restore the state. pub fn save() void { c.nvgSave(ctx); } // Pops and restores current render state. pub fn restore() void { c.nvgRestore(ctx); } // Resets current render state to default values. Does not affect the render state stack. pub fn reset() void { c.nvgReset(ctx); } // // Render styles // // Fill and stroke render style can be either a solid color or a paint which is a gradient or a pattern. // Solid color is simply defined as a color value, different kinds of paints can be created // using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern(). // // Current render style can be saved and restored using nvgSave() and nvgRestore(). // // Sets whether to draw antialias for nvgStroke() and nvgFill(). It's enabled by default. // void nvgShapeAntiAlias(NVGcontext* ctx, int enabled); // // Sets current stroke style to a solid color. pub fn strokeColor(color: Color) void { c.nvgStrokeColor(ctx, color); } // Sets current stroke style to a paint, which can be a one of the gradients or a pattern. pub fn strokePaint(paint: Paint) void { c.nvgStrokePaint(ctx, paint); } // // Sets current fill style to a solid color. pub fn fillColor(color: Color) void { c.nvgFillColor(ctx, color); } // Sets current fill style to a paint, which can be a one of the gradients or a pattern. pub fn fillPaint(paint: Paint) void { c.nvgFillPaint(ctx, paint); } // // Sets the miter limit of the stroke style. // // Miter limit controls when a sharp corner is beveled. // void nvgMiterLimit(NVGcontext* ctx, float limit); // // Sets the stroke width of the stroke style. pub fn strokeWidth(size: f32) void { c.nvgStrokeWidth(ctx, size); } // Sets how the end of the line (cap) is drawn, // Can be one of: NVG_BUTT (default), NVG_ROUND, NVG_SQUARE. pub fn lineCap(cap: LineCap) void { const c_cap: c_int = switch (cap) { .butt => c.NVG_BUTT, .round => c.NVG_ROUND, .square => c.NVG_SQUARE, }; c.nvgLineCap(ctx, c_cap); } // Sets how sharp path corners are drawn. // Can be one of NVG_MITER (default), NVG_ROUND, NVG_BEVEL. pub fn lineJoin(join: LineJoin) void { const c_join: c_int = switch (join) { .miter => c.NVG_MITER, .round => c.NVG_ROUND, .bevel => c.NVG_BEVEL, }; c.nvgLineJoin(ctx, c_join); } // Sets the transparency applied to all rendered shapes. // Already transparent paths will get proportionally more transparent as well. pub fn globalAlpha(alpha: f32) void { c.nvgGlobalAlpha(ctx, alpha); } // // Transforms // // The paths, gradients, patterns and scissor region are transformed by an transformation // matrix at the time when they are passed to the API. // The current transformation matrix is a affine matrix: // [sx kx tx] // [ky sy ty] // [ 0 0 1] // Where: sx,sy define scaling, kx,ky skewing, and tx,ty translation. // The last row is assumed to be 0,0,1 and is not stored. // // Apart from nvgResetTransform(), each transformation function first creates // specific transformation matrix and pre-multiplies the current transformation by it. // // Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore(). // Resets current transform to a identity matrix. pub fn resetTransform() void { c.nvgResetTransform(ctx); } // Premultiplies current coordinate system by specified matrix. // The parameters are interpreted as matrix as follows: // [a c e] // [b d f] // [0 0 1] // void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f); // Translates current coordinate system. pub fn translate(x: f32, y: f32) void { c.nvgTranslate(ctx, x, y); } // Rotates current coordinate system. Angle is specified in radians. // void nvgRotate(NVGcontext* ctx, float angle); // Skews the current coordinate system along X axis. Angle is specified in radians. // void nvgSkewX(NVGcontext* ctx, float angle); // Skews the current coordinate system along Y axis. Angle is specified in radians. // void nvgSkewY(NVGcontext* ctx, float angle); // Scales the current coordinate system. pub fn scale(x: f32, y: f32) void { c.nvgScale(ctx, x, y); } // Stores the top part (a-f) of the current transformation matrix in to the specified buffer. // [a c e] // [b d f] // [0 0 1] // There should be space for 6 floats in the return buffer for the values a-f. // void nvgCurrentTransform(NVGcontext* ctx, float* xform); // The following functions can be used to make calculations on 2x3 transformation matrices. // A 2x3 matrix is represented as float[6]. // Sets the transform to identity matrix. // void nvgTransformIdentity(float* dst); // Sets the transform to translation matrix matrix. // void nvgTransformTranslate(float* dst, float tx, float ty); // Sets the transform to scale matrix. // void nvgTransformScale(float* dst, float sx, float sy); // Sets the transform to rotate matrix. Angle is specified in radians. // void nvgTransformRotate(float* dst, float a); // Sets the transform to skew-x matrix. Angle is specified in radians. // void nvgTransformSkewX(float* dst, float a); // Sets the transform to skew-y matrix. Angle is specified in radians. // void nvgTransformSkewY(float* dst, float a); // Sets the transform to the result of multiplication of two transforms, of A = A*B. // void nvgTransformMultiply(float* dst, const float* src); // Sets the transform to the result of multiplication of two transforms, of A = B*A. // void nvgTransformPremultiply(float* dst, const float* src); // Sets the destination to inverse of specified transform. // Returns 1 if the inverse could be calculated, else 0. // int nvgTransformInverse(float* dst, const float* src); // Transform a point by given transform. // void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy); // Converts degrees to radians and vice versa. // float nvgDegToRad(float deg); // float nvgRadToDeg(float rad); // // Images // // NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering. // In addition you can upload your own image. The image loading is provided by stb_image. // The parameter imageFlags is combination of flags defined in NVGimageFlags. // Creates image by loading it from the disk from specified file name. // Returns handle to the image. pub fn createImage(filename: [:0]const u8, flags: ImageFlags) Image { return Image{ .handle = c.nvgCreateImage(ctx, filename.ptr, @bitCast(u6, flags)) }; } // // Creates image by loading it from the specified chunk of memory. // // Returns handle to the image. // int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata); // Creates image from specified image data. // Returns handle to the image. pub fn createImageRgba(w: u32, h: u32, flags: ImageFlags, data: []const u8) Image { return Image{ .handle = c.nvgCreateImageRGBA(ctx, @intCast(c_int, w), @intCast(c_int, h), @bitCast(u6, flags), data.ptr) }; } // Updates image data specified by image handle. pub fn updateImage(image: Image, data: []const u8) void { c.nvgUpdateImage(ctx, image.handle, data.ptr); } // Updates a region of the image data specified by image handle. Data needs to match the size of the texture data. pub fn updateImageRegion(image: Image, data: []const u8, x: u32, y: u32, w: u32, h: u32) void { c.nvgUpdateImageRegion(ctx, image.handle, data.ptr, @intCast(c_int, x), @intCast(c_int, y), @intCast(c_int, w), @intCast(c_int, h)); } // // Returns the dimensions of a created image. // void nvgImageSize(NVGcontext* ctx, int image, int* w, int* h); // Deletes created image. pub fn deleteImage(image: Image) void { c.nvgDeleteImage(ctx, image.handle); } // // Paints // // NanoVG supports four types of paints: linear gradient, box gradient, radial gradient and image pattern. // These can be used as paints for strokes and fills. // Creates and returns a linear gradient. Parameters (sx,sy)-(ex,ey) specify the start and end coordinates // of the linear gradient, icol specifies the start color and ocol the end color. // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint(). pub fn linearGradient(sx: f32, sy: f32, ex: f32, ey: f32, icol: Color, ocol: Color) Paint { return c.nvgLinearGradient(ctx, sx, sy, ex, ey, icol, ocol); } // Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering // drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle, // (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry // the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient. // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint(). pub fn boxGradient(x: f32, y: f32, w: f32, h: f32, r: f32, f: f32, icol: Color, ocol: Color) Paint { return c.nvgBoxGradient(ctx, x, y, w, h, r, f, icol, ocol); } // // Creates and returns a radial gradient. Parameters (cx,cy) specify the center, inr and outr specify // // the inner and outer radius of the gradient, icol specifies the start color and ocol the end color. // // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint(). // NVGpaint nvgRadialGradient(NVGcontext* ctx, float cx, float cy, float inr, float outr, // NVGcolor icol, NVGcolor ocol); // Creates and returns an image patter. Parameters (ox,oy) specify the left-top location of the image pattern, // (ex,ey) the size of one image, angle rotation around the top-left corner, image is handle to the image to render. // The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint(). pub fn imagePattern(ox: f32, oy: f32, ex: f32, ey: f32, angle: f32, image: Image, alpha: f32) Paint { return c.nvgImagePattern(ctx, ox, oy, ex, ey, angle, image.handle, alpha); } // // Scissoring // // Scissoring allows you to clip the rendering into a rectangle. This is useful for various // user interface cases like rendering a text edit or a timeline. // Sets the current scissor rectangle. // The scissor rectangle is transformed by the current transform. pub fn scissor(x: f32, y: f32, w: f32, h: f32) void { c.nvgScissor(ctx, x, y, w, h); } // // Intersects current scissor rectangle with the specified rectangle. // // The scissor rectangle is transformed by the current transform. // // Note: in case the rotation of previous scissor rect differs from // // the current one, the intersection will be done between the specified // // rectangle and the previous scissor rectangle transformed in the current // // transform space. The resulting shape is always rectangle. // void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h); // Reset and disables scissoring. pub fn resetScissor() void { c.nvgResetScissor(ctx); } // // Paths // // Drawing a new shape starts with nvgBeginPath(), it clears all the currently defined paths. // Then you define one or more paths and sub-paths which describe the shape. The are functions // to draw common shapes like rectangles and circles, and lower level step-by-step functions, // which allow to define a path curve by curve. // // NanoVG uses even-odd fill rule to draw the shapes. Solid shapes should have counter clockwise // winding and holes should have counter clockwise order. To specify winding of a path you can // call nvgPathWinding(). This is useful especially for the common shapes, which are drawn CCW. // // Finally you can fill the path using current fill style by calling nvgFill(), and stroke it // with current stroke style by calling nvgStroke(). // // The curve segments and sub-paths are transformed by the current transform. // Clears the current path and sub-paths. pub fn beginPath() void { c.nvgBeginPath(ctx); } // Starts new sub-path with specified point as first point. pub fn moveTo(x: f32, y: f32) void { c.nvgMoveTo(ctx, x, y); } // Adds line segment from the last point in the path to the specified point. pub fn lineTo(x: f32, y: f32) void { c.nvgLineTo(ctx, x, y); } // Adds cubic bezier segment from last point in the path via two control points to the specified point. pub fn bezierTo(c1x: f32, c1y: f32, c2x: f32, c2y: f32, x: f32, y: f32) void { c.nvgBezierTo(ctx, c1x, c1y, c2x, c2y, x, y); } // Adds quadratic bezier segment from last point in the path via a control point to the specified point. pub fn quadTo(cx: f32, cy: f32, x: f32, y: f32) void { c.nvgQuadTo(ctx, cx, cy, x, y); } // Adds an arc segment at the corner defined by the last path point, and two specified points. pub fn arcTo(x1: f32, y1: f32, x2: f32, y2: f32, r: f32) void { c.nvgArcTo(ctx, x1, y1, x2, y2, r); } // Closes current sub-path with a line segment. pub fn closePath() void { c.nvgClosePath(ctx); } // Sets the current sub-path winding, see NVGwinding and NVGsolidity. pub fn pathWinding(dir: Winding) void { c.nvgPathWinding(ctx, @enumToInt(dir)); } // Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r, // and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW). // Angles are specified in radians. pub fn arc(cx: f32, cy: f32, r: f32, a0: f32, a1: f32, dir: Winding) void { c.nvgArc(ctx, cx, cy, r, a0, a1, @enumToInt(dir)); } // Creates new rectangle shaped sub-path. pub fn rect(x: f32, y: f32, w: f32, h: f32) void { c.nvgRect(ctx, x, y, w, h); } // Creates new rounded rectangle shaped sub-path. pub fn roundedRect(x: f32, y: f32, w: f32, h: f32, r: f32) void { c.nvgRoundedRect(ctx, x, y, w, h, r); } // // Creates new rounded rectangle shaped sub-path with varying radii for each corner. // void nvgRoundedRectVarying(NVGcontext* ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft); // Creates new ellipse shaped sub-path. pub fn ellipse(cx: f32, cy: f32, rx: f32, ry: f32) void { c.nvgEllipse(ctx, cx, cy, rx, ry); } // Creates new circle shaped sub-path. pub fn circle(cx: f32, cy: f32, r: f32) void { c.nvgCircle(ctx, cx, cy, r); } // Fills the current path with current fill style. pub fn fill() void { c.nvgFill(ctx); } // Fills the current path with current stroke style. pub fn stroke() void { c.nvgStroke(ctx); } // // Text // // NanoVG allows you to load .ttf files and use the font to render text. // // The appearance of the text can be defined by setting the current text style // and by specifying the fill color. Common text and font settings such as // font size, letter spacing and text align are supported. Font blur allows you // to create simple text effects such as drop shadows. // // At render time the font face can be set based on the font handles or name. // // Font measure functions return values in local space, the calculations are // carried in the same resolution as the final rendering. This is done because // the text glyph positions are snapped to the nearest pixels sharp rendering. // // The local space means that values are not rotated or scale as per the current // transformation. For example if you set font size to 12, which would mean that // line height is 16, then regardless of the current scaling and rotation, the // returned line height is always 16. Some measures may vary because of the scaling // since aforementioned pixel snapping. // // While this may sound a little odd, the setup allows you to always render the // same way regardless of scaling. I.e. following works regardless of scaling: // // const char* txt = "Text me up."; // nvgTextBounds(vg, x,y, txt, NULL, bounds); // nvgBeginPath(vg); // nvgRoundedRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]); // nvgFill(vg); // // Note: currently only solid color fill is supported for text. // Creates font by loading it from the disk from specified file name. // Returns handle to the font. pub fn createFont(name: [:0]const u8, filename: [:0]const u8) i32 { return c.nvgCreateFont(ctx, name, filename); } // // fontIndex specifies which font face to load from a .ttf/.ttc file. // int nvgCreateFontAtIndex(NVGcontext* ctx, const char* name, const char* filename, const int fontIndex); // // Creates font by loading it from the specified memory chunk. // // Returns handle to the font. // int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData); // // fontIndex specifies which font face to load from a .ttf/.ttc file. // int nvgCreateFontMemAtIndex(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData, const int fontIndex); // // Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found. // int nvgFindFont(NVGcontext* ctx, const char* name); // Adds a fallback font by handle. pub fn addFallbackFontId(base_font: i32, fallback_font: i32) i32 { return c.nvgAddFallbackFontId(ctx, base_font, fallback_font); } // // Adds a fallback font by name. // int nvgAddFallbackFont(NVGcontext* ctx, const char* baseFont, const char* fallbackFont); // // Resets fallback fonts by handle. // void nvgResetFallbackFontsId(NVGcontext* ctx, int baseFont); // // Resets fallback fonts by name. // void nvgResetFallbackFonts(NVGcontext* ctx, const char* baseFont); // Sets the font size of current text style. pub fn fontSize(size: f32) void { c.nvgFontSize(ctx, size); } // Sets the blur of current text style. pub fn fontBlur(blur: f32) void { c.nvgFontBlur(ctx, blur); } // // Sets the letter spacing of current text style. // void nvgTextLetterSpacing(NVGcontext* ctx, float spacing); // // Sets the proportional line height of current text style. The line height is specified as multiple of font size. // void nvgTextLineHeight(NVGcontext* ctx, float lineHeight); // Sets the text align of current text style, see NVGalign for options. pub fn textAlign(text_align: TextAlign) void { c.nvgTextAlign(ctx, text_align.toInt()); } // Sets the font face based on specified id of current text style. pub fn fontFaceId(font: i32) void { c.nvgFontFaceId(ctx, font); } // Sets the font face based on specified name of current text style. pub fn fontFace(font: [:0]const u8) void { c.nvgFontFace(ctx, font); } // Draws text string at specified location. If end is specified only the sub-string up to the end is drawn. pub fn text(x: f32, y: f32, string: []const u8) f32 { if (string.len == 0) return x; return c.nvgText(ctx, x, y, std.meta.assumeSentinel(string, 0), string.ptr + string.len); } // // Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn. // // White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. // // Words longer than the max width are slit at nearest character (i.e. no hyphenation). // void nvgTextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end); // // Measures the specified text string. Parameter bounds should be a pointer to float[4], // // if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] // // Returns the horizontal advance of the measured text (i.e. where the next character should drawn). // // Measured values are returned in local coordinate space. // float nvgTextBounds(NVGcontext* ctx, float x, float y, const char* string, const char* end, float* bounds); // // Measures the specified multi-text string. Parameter bounds should be a pointer to float[4], // // if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax] // // Measured values are returned in local coordinate space. // void nvgTextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, const char* string, const char* end, float* bounds); // Calculates the glyph x positions of the specified text. If end is specified only the sub-string will be used. // Measured values are returned in local coordinate space. pub fn textGlyphPositions(x: f32, y: f32, string: []const u8, positions: []GlyphPosition) void { if (string.len == 0) return; _ = c.nvgTextGlyphPositions(ctx, x, y, std.meta.assumeSentinel(string, 0), string.ptr + string.len, positions.ptr, @intCast(c_int, positions.len)); } // Returns the vertical metrics based on the current text style. // Measured values are returned in local coordinate space. pub fn textMetrics(ascender: ?*f32, descender: ?*f32, line_height: ?*f32) void { c.nvgTextMetrics(ctx, ascender, descender, line_height); } // // Breaks the specified text into lines. If end is specified only the sub-string will be used. // // White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered. // // Words longer than the max width are slit at nearest character (i.e. no hyphenation). // int nvgTextBreakLines(NVGcontext* ctx, const char* string, const char* end, float breakRowWidth, NVGtextRow* rows, int maxRows);
deps/nanovg/src/nanovg.zig
const std = @import("std"); const c = @import("internal/c.zig"); const internal = @import("internal/internal.zig"); const log = std.log.scoped(.git); const git = @import("git.zig"); pub const Config = opaque { pub fn deinit(self: *Config) void { log.debug("Config.deinit called", .{}); c.git_config_free(@ptrCast(*c.git_config, self)); log.debug("config freed successfully", .{}); } pub fn new() !*Config { log.debug("Config.new called", .{}); var config: *Config = undefined; try internal.wrapCall("git_config_new", .{ @ptrCast(*?*c.git_config, &config), }); log.debug("created new config", .{}); return config; } pub fn getEntry(self: *const Config, name: [:0]const u8) !*ConfigEntry { log.debug("Config.getEntry called, name={s}", .{name}); var entry: *ConfigEntry = undefined; try internal.wrapCall("git_config_get_entry", .{ @ptrCast(*?*c.git_config_entry, &entry), @ptrCast(*const c.git_config, self), name.ptr, }); log.debug("got entry: {*}", .{entry}); return entry; } pub fn getInt(self: *const Config, name: [:0]const u8) !i32 { log.debug("Config.getInt called, name={s}", .{name}); var value: i32 = undefined; try internal.wrapCall("git_config_get_int32", .{ &value, @ptrCast(*const c.git_config, self), name.ptr }); log.debug("got int value: {}", .{value}); return value; } pub fn setInt(self: *Config, name: [:0]const u8, value: i32) !void { log.debug("Config.setInt called, name={s}, value={}", .{ name, value }); try internal.wrapCall("git_config_set_int32", .{ @ptrCast(*c.git_config, self), name.ptr, value }); log.debug("successfully set int value", .{}); } pub fn getInt64(self: *const Config, name: [:0]const u8) !i64 { log.debug("Config.getInt64 called, name={s}", .{name}); var value: i64 = undefined; try internal.wrapCall("git_config_get_int64", .{ &value, @ptrCast(*const c.git_config, self), name.ptr }); log.debug("got int value: {}", .{value}); return value; } pub fn setInt64(self: *Config, name: [:0]const u8, value: i64) !void { log.debug("Config.setInt64 called, name={s}, value={}", .{ name, value }); try internal.wrapCall("git_config_set_int64", .{ @ptrCast(*c.git_config, self), name.ptr, value }); log.debug("successfully set int value", .{}); } pub fn getBool(self: *const Config, name: [:0]const u8) !bool { log.debug("Config.getBool called, name={s}", .{name}); var value: c_int = undefined; try internal.wrapCall("git_config_get_bool", .{ &value, @ptrCast(*const c.git_config, self), name.ptr }); const ret = value != 0; log.debug("got bool value: {}", .{ret}); return ret; } pub fn setBool(self: *Config, name: [:0]const u8, value: bool) !void { log.debug("Config.setBool called, name={s}, value={}", .{ name, value }); try internal.wrapCall("git_config_set_bool", .{ @ptrCast(*c.git_config, self), name.ptr, @boolToInt(value) }); log.debug("successfully set bool value", .{}); } pub fn getPath(self: *const Config, name: [:0]const u8) !git.Buf { log.debug("Config.getPath called, name={s}", .{name}); var buf: git.Buf = .{}; try internal.wrapCall("git_config_get_path", .{ @ptrCast(*c.git_buf, &buf), @ptrCast(*const c.git_config, self), name.ptr, }); log.debug("got path value: {s}", .{buf.toSlice()}); return buf; } pub fn getString(self: *const Config, name: [:0]const u8) ![:0]const u8 { log.debug("Config.getString called, name={s}", .{name}); var str: [*c]const u8 = undefined; try internal.wrapCall("git_config_get_string", .{ &str, @ptrCast(*const c.git_config, self), name.ptr }); const slice = std.mem.sliceTo(str, 0); log.debug("got string value: {s}", .{slice}); return slice; } pub fn setString(self: *Config, name: [:0]const u8, value: [:0]const u8) !void { log.debug("Config.setString called, name={s}, value={s}", .{ name, value }); try internal.wrapCall("git_config_set_string", .{ @ptrCast(*c.git_config, self), name.ptr, value.ptr }); log.debug("successfully set string value", .{}); } pub fn setMultivar(self: *Config, name: [:0]const u8, regex: [:0]const u8, value: [:0]const u8) !void { log.debug("Config.setMultivar called, name={s},regex={s}, value={s}", .{ name, regex, value }); try internal.wrapCall("git_config_set_multivar", .{ @ptrCast(*c.git_config, self), name.ptr, regex.ptr, value.ptr }); log.debug("successfully set multivar value", .{}); } pub fn getStringBuf(self: *const Config, name: [:0]const u8) !git.Buf { log.debug("Config.getStringBuf called, name={s}", .{name}); var buf: git.Buf = .{}; try internal.wrapCall("git_config_get_string_buf", .{ @ptrCast(*c.git_buf, &buf), @ptrCast(*const c.git_config, self), name.ptr, }); log.debug("got string value: {s}", .{buf.toSlice()}); return buf; } pub fn foreachMultivar( self: *const Config, name: [:0]const u8, regex: ?[:0]const u8, user_data: anytype, comptime callback_fn: fn (entry: *const ConfigEntry, user_data_ptr: @TypeOf(user_data)) c_int, ) !c_int { const UserDataType = @TypeOf(user_data); const cb = struct { pub fn cb( entry: [*c]const c.git_config_entry, payload: ?*anyopaque, ) callconv(.C) c_int { return callback_fn( @ptrCast(*const ConfigEntry, entry), @ptrCast(UserDataType, payload), ); } }.cb; log.debug("Config.foreachMultivar called, name={s}, regex={s}", .{ name, regex }); const regex_c = if (regex) |str| str.ptr else null; const ret = try internal.wrapCallWithReturn("git_config_get_multivar_foreach", .{ @ptrCast(*const c.git_config, self), name.ptr, regex_c, cb, user_data, }); log.debug("callback returned: {}", .{ret}); return ret; } pub fn foreachConfig( self: *const Config, user_data: anytype, comptime callback_fn: fn (entry: *const ConfigEntry, user_data_ptr: @TypeOf(user_data)) c_int, ) !c_int { const UserDataType = @TypeOf(user_data); const cb = struct { pub fn cb( entry: [*c]const c.git_config_entry, payload: ?*anyopaque, ) callconv(.C) c_int { return callback_fn( @ptrCast(*const ConfigEntry, entry), @ptrCast(UserDataType, payload), ); } }.cb; log.debug("Config.foreachConfig called", .{}); const ret = try internal.wrapCallWithReturn("git_config_foreach", .{ @ptrCast(*const c.git_config, self), cb, user_data, }); log.debug("callback returned: {}", .{ret}); return ret; } pub fn foreachConfigMatch( self: *const Config, regex: [:0]const u8, user_data: anytype, comptime callback_fn: fn (entry: *const ConfigEntry, user_data_ptr: @TypeOf(user_data)) c_int, ) !c_int { const UserDataType = @TypeOf(user_data); const cb = struct { pub fn cb( entry: [*c]const c.git_config_entry, payload: ?*anyopaque, ) callconv(.C) c_int { return callback_fn( @ptrCast(*const ConfigEntry, entry), @ptrCast(UserDataType, payload), ); } }.cb; log.debug("Config.foreachConfigMatch called, regex={s}", .{regex}); const ret = try internal.wrapCallWithReturn("git_config_foreach_match", .{ @ptrCast(*const c.git_config, self), regex.ptr, cb, user_data, }); log.debug("callback returned: {}", .{ret}); return ret; } pub fn deleteEntry(self: *Config, name: [:0]const u8) !void { log.debug("Config.deleteEntry called, name={s}", .{name}); try internal.wrapCall("git_config_delete_entry", .{ @ptrCast(*c.git_config, self), name.ptr }); log.debug("successfully deleted entry", .{}); } pub fn deleteMultivar(self: *Config, name: [:0]const u8, regex: [:0]const u8) !void { log.debug("Config.deleteMultivar called, name={s}, regex={s}", .{ name, regex }); try internal.wrapCall("git_config_delete_multivar", .{ @ptrCast(*c.git_config, self), name.ptr, regex.ptr }); log.debug("successfully deleted multivar", .{}); } pub fn addFileOnDisk(self: *Config, path: [:0]const u8, level: Level, repo: *const git.Repository, force: bool) !void { log.debug("Config.addFileOnDisk called, path={s}, level={}, repo={*}, force={}", .{ path, level, repo, force }); try internal.wrapCall("git_config_add_file_ondisk", .{ @ptrCast(*c.git_config, self), path.ptr, @enumToInt(level), @ptrCast(*const c.git_repository, self), @boolToInt(force), }); log.debug("", .{}); } pub fn openOnDisk(path: [:0]const u8) !*Config { log.debug("Config.openOnDisk called, path={s}", .{path}); var config: *Config = undefined; try internal.wrapCall("git_config_open_ondisk", .{ @ptrCast(*?*c.git_config, &config), path.ptr, }); log.debug("opened config from file", .{}); return config; } pub fn openLevel(self: *const Config, level: Level) !*Config { log.debug("Config.openLevel called, level={}", .{level}); var config: *Config = undefined; try internal.wrapCall("git_config_open_level", .{ @ptrCast(*?*c.git_config, &config), @ptrCast(*const c.git_config, self), @enumToInt(level), }); log.debug("opened config for level", .{}); return config; } pub fn openGlobal(self: *git.Config) !*Config { log.debug("Config.openGlobal called", .{}); var config: *Config = undefined; try internal.wrapCall("git_config_open_global", .{ @ptrCast(*?*c.git_config, &config), @ptrCast(*c.git_config, self), }); log.debug("opened global config", .{}); return config; } pub fn snapshot(self: *git.Config) !*Config { log.debug("Config.snapshot called", .{}); var config: *Config = undefined; try internal.wrapCall("git_config_snapshot", .{ @ptrCast(*?*c.git_config, &config), @ptrCast(*c.git_config, self), }); log.debug("created snapshot of config", .{}); return config; } pub fn openDefault() !*Config { log.debug("Config.openDefault called", .{}); var config: *Config = undefined; try internal.wrapCall("git_config_open_default", .{ @ptrCast(*?*c.git_config, &config), }); log.debug("opened default config", .{}); return config; } pub fn findGlobal() ?git.Buf { log.debug("Config.findGlobal called", .{}); var buf: git.Buf = .{}; if (c.git_config_find_global(@ptrCast(*c.git_buf, &buf)) == 0) return null; log.debug("global config path: {s}", .{buf.toSlice()}); return buf; } pub fn findXdg() ?git.Buf { log.debug("Config.findXdg called", .{}); var buf: git.Buf = .{}; if (c.git_config_find_xdg(@ptrCast(*c.git_buf, &buf)) == 0) return null; log.debug("xdg config path: {s}", .{buf.toSlice()}); return buf; } pub fn findSystem() ?git.Buf { log.debug("Config.findSystem called", .{}); var buf: git.Buf = .{}; if (c.git_config_find_system(@ptrCast(*c.git_buf, &buf)) == 0) return null; log.debug("system config path: {s}", .{buf.toSlice()}); return buf; } pub fn findProgramdata() ?git.Buf { log.debug("Config.findProgramdata called", .{}); var buf: git.Buf = .{}; if (c.git_config_find_programdata(@ptrCast(*c.git_buf, &buf)) == 0) return null; log.debug("programdata config path: {s}", .{buf.toSlice()}); return buf; } pub fn lock(self: *Config) !*git.Transaction { log.debug("Config.lock called", .{}); var transaction: *git.Transaction = undefined; try internal.wrapCall("git_config_lock", .{ @ptrCast(*?*c.git_transaction, &transaction), @ptrCast(*c.git_config, self), }); log.debug("successfully locked config", .{}); return transaction; } pub fn iterateMultivar(self: *const Config, name: [:0]const u8, regex: ?[:0]const u8) !*ConfigIterator { log.debug("Config.iterateMultivar called, name={s}, regex={s}", .{ name, regex }); var iterator: *ConfigIterator = undefined; const regex_c = if (regex) |str| str.ptr else null; try internal.wrapCall("git_config_multivar_iterator_new", .{ @ptrCast(*?*c.git_config_iterator, &iterator), @ptrCast(*const c.git_config, self), name.ptr, regex_c, }); log.debug("multivar config iterator created successfully", .{}); return iterator; } pub fn iterate(self: *const Config) !*ConfigIterator { log.debug("Config.iterate called", .{}); var iterator: *ConfigIterator = undefined; try internal.wrapCall("git_config_iterator_new", .{ @ptrCast(*?*c.git_config_iterator, &iterator), @ptrCast(*const c.git_config, self), }); log.debug("config iterator created successfully", .{}); return iterator; } pub fn iterateGlob(self: *const Config, regex: [:0]const u8) !*ConfigIterator { log.debug("Config.iterateGlob called", .{}); var iterator: *ConfigIterator = undefined; try internal.wrapCall("git_config_iterator_glob_new", .{ @ptrCast(*?*c.git_config_iterator, &iterator), @ptrCast(*const c.git_config, self), regex.ptr, }); log.debug("config iterator created successfully", .{}); return iterator; } pub const ConfigIterator = opaque { pub fn next(self: *ConfigIterator) !?*ConfigEntry { log.debug("ConfigIterator.next called", .{}); var entry: *ConfigEntry = undefined; internal.wrapCall("git_config_next", .{ @ptrCast(*?*c.git_config_entry, &entry), @ptrCast(*c.git_config_iterator, self), }) catch |err| switch (err) { git.GitError.IterOver => { log.debug("end of iteration reached", .{}); return null; }, else => return err, }; log.debug("successfully fetched config entry: {}", .{entry}); return entry; } pub fn deinit(self: *ConfigIterator) void { log.debug("ConfigIterator.deinit called", .{}); c.git_config_iterator_free(@ptrCast(*c.git_config_iterator, self)); log.debug("config iterator freed successfully", .{}); } comptime { std.testing.refAllDecls(@This()); } }; pub fn getMapped(self: *const Config, name: [:0]const u8, maps: []const ConfigMap) !c_int { log.debug("Config.getMapped called, name={s}", .{name}); var value: c_int = undefined; try internal.wrapCall("git_config_get_mapped", .{ &value, @ptrCast(*const c.git_config, self), name.ptr, @ptrCast([*c]const c.git_configmap, maps.ptr), maps.len, }); log.debug("mapped to: {}", .{value}); return value; } pub fn parseBool(value: [:0]const u8) !bool { var res: c_int = undefined; try internal.wrapCall("git_config_parse_bool", .{ &res, value.ptr }); return res != 0; } pub fn parseInt(value: [:0]const u8) !i32 { var res: i32 = undefined; try internal.wrapCall("git_config_parse_int32", .{ &res, value.ptr }); return res; } pub fn parseInt64(value: [:0]const u8) !i64 { var res: i64 = undefined; try internal.wrapCall("git_config_parse_int64", .{ &res, value.ptr }); return res; } pub fn parsePath(value: [:0]const u8) !git.Buf { var buf: git.Buf = .{}; try internal.wrapCall("git_config_parse_path", .{ @ptrCast(*c.git_buf, &buf), value.ptr }); return buf; } pub const ConfigMap = extern struct { map_type: MapType, str_match: [*:0]const u8, map_value: c_int, pub const MapType = enum(c_int) { FALSE = 0, TRUE = 1, INT32 = 2, STRING = 3, }; pub fn lookupMapValue(maps: []const ConfigMap, value: [:0]const u8) !c_int { log.debug("ConfigMap.lookupMapValue called, value={s}", .{value}); var result: c_int = undefined; try internal.wrapCall("git_config_lookup_map_value", .{ &result, @ptrCast([*c]const c.git_configmap, maps.ptr), maps.len, value.ptr, }); log.debug("mapped to: {}", .{result}); return result; } test { try std.testing.expectEqual(@sizeOf(c.git_configmap), @sizeOf(ConfigMap)); try std.testing.expectEqual(@bitSizeOf(c.git_configmap), @bitSizeOf(ConfigMap)); } comptime { std.testing.refAllDecls(@This()); } }; /// Priority level of a config file. pub const Level = enum(c_int) { /// System-wide on Windows, for compatibility with portable git PROGRAMDATA = 1, /// System-wide configuration file; /etc/gitconfig on Linux systems SYSTEM = 2, /// XDG compatible configuration file; typically ~/.config/git/config XDG = 3, /// User-specific configuration file (also called Global configuration file); typically ~/.gitconfig GLOBAL = 4, /// Repository specific configuration file; $WORK_DIR/.git/config on non-bare repos LOCAL = 5, /// Application specific configuration file; freely defined by applications APP = 6, /// Represents the highest level available config file (i.e. the most specific config file available that actually is /// loaded) HIGHEST = -1, }; pub const ConfigEntry = extern struct { /// Name of the entry (normalised) name: [*:0]const u8, /// String value of the entry value: [*:0]const u8, /// Depth of includes where this variable was found include_depth: u32, /// Which config file this was found in level: Level, /// Free function for this entry free_fn: ?fn ([*c]ConfigEntry) callconv(.C) void, /// Opaque value for the free function. Do not read or write payload: *anyopaque, pub fn deinit(self: *ConfigEntry) void { log.debug("ConfigEntry.deinit called", .{}); c.git_config_entry_free(@ptrCast(*c.git_config_entry, self)); log.debug("config entry freed successfully", .{}); } test { try std.testing.expectEqual(@sizeOf(c.git_config_entry), @sizeOf(ConfigEntry)); try std.testing.expectEqual(@bitSizeOf(c.git_config_entry), @bitSizeOf(ConfigEntry)); } comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); } }; pub const ConfigBackend = opaque { pub fn foreachConfigBackendMatch( self: *const ConfigBackend, regex: [:0]const u8, user_data: anytype, comptime callback_fn: fn (entry: *const Config.ConfigEntry, user_data_ptr: @TypeOf(user_data)) c_int, ) !c_int { const UserDataType = @TypeOf(user_data); const cb = struct { pub fn cb( entry: [*c]const c.git_config_entry, payload: ?*anyopaque, ) callconv(.C) c_int { return callback_fn( @ptrCast(*const Config.ConfigEntry, entry), @ptrCast(UserDataType, payload), ); } }.cb; log.debug("Config.foreachConfigBackendMatch called, regex={s}", .{regex}); const ret = try internal.wrapCallWithReturn("git_config_backend_foreach_match", .{ @ptrCast(*const c.git_config_backend, self), regex.ptr, cb, user_data, }); log.debug("callback returned: {}", .{ret}); return ret; } comptime { std.testing.refAllDecls(@This()); } }; comptime { std.testing.refAllDecls(@This()); }
src/config.zig
const std = @import("std"); const assert = std.debug.assert; const tools = @import("tools"); const Vec2 = tools.Vec2; pub fn run(input_text: []const u8, allocator: std.mem.Allocator) ![2][]const u8 { var arena = std.heap.ArenaAllocator.init(allocator); defer arena.deinit(); const Range = struct { min: u32, max: u32 }; const FieldRange = struct { name: []const u8, r1: Range, r2: Range }; const Ticket = []const u32; const param: struct { fields: []const FieldRange, my_ticket: Ticket, all_tickets: []Ticket, } = blk: { var field_descs = std.ArrayList(FieldRange).init(arena.allocator()); var tickets = std.ArrayList(Ticket).init(arena.allocator()); var it = std.mem.tokenize(u8, input_text, "\n\r"); while (it.next()) |line| { if (tools.match_pattern("{}: {}-{} or {}-{}", line)) |fields| { //zone: 47-249 or 265-972 const name = fields[0].lit; const m0 = @intCast(u32, fields[1].imm); const m1 = @intCast(u32, fields[2].imm); const m2 = @intCast(u32, fields[3].imm); const m3 = @intCast(u32, fields[4].imm); try field_descs.append(FieldRange{ .name = name, .r1 = Range{ .min = m0, .max = m1 }, .r2 = Range{ .min = m2, .max = m3 }, }); } else if (tools.match_pattern("your ticket:", line)) |_| { continue; } else if (tools.match_pattern("nearby tickets:", line)) |_| { continue; } else { // 73,167,113,61,89,59,191,103,67,83,163,109,101,71,97,151,107,79,157,53 const numbers = try arena.allocator().alloc(u32, 32); var nb: u32 = 0; var it2 = std.mem.tokenize(u8, line, ","); while (it2.next()) |num| { numbers[nb] = std.fmt.parseInt(u32, num, 10) catch unreachable; nb += 1; } try tickets.append(numbers[0..nb]); } } // std.debug.print("{}\n", .{input}); break :blk .{ .fields = field_descs.items, .my_ticket = tickets.items[0], .all_tickets = tickets.items, }; }; const ans1 = ans: { var valid = [_]bool{false} ** 1000; for (param.fields) |f| { var i: u32 = f.r1.min; while (i < f.r1.max) : (i += 1) { valid[i] = true; } var j: u32 = f.r2.min; while (j < f.r2.max) : (j += 1) { valid[j] = true; } } var sum: u32 = 0; for (param.all_tickets) |t| { for (t) |it| { if (!valid[it]) sum += it; } } break :ans sum; }; const ans2 = ans: { var valid = [_]bool{false} ** 1000; for (param.fields) |f| { var i: u32 = f.r1.min; while (i < f.r1.max) : (i += 1) { valid[i] = true; } var j: u32 = f.r2.min; while (j < f.r2.max) : (j += 1) { valid[j] = true; } } var possible_fields = [_]bool{true} ** 1000; const nb_fields = param.fields.len; for (param.all_tickets) |t| { const is_valid_ticket = for (t) |it| { if (!valid[it]) break false; } else true; if (!is_valid_ticket) continue; assert(t.len == nb_fields); for (t) |val, j| { for (param.fields) |f, i| { if ((val >= f.r1.min and val <= f.r1.max) or (val >= f.r2.min and val <= f.r2.max)) { // vlaue valid for field } else { possible_fields[j * nb_fields + i] = false; } } } } var nb_fields_determined: u32 = 0; var field_indexes: [100]usize = undefined; while (nb_fields_determined < nb_fields) { for (param.fields) |_, i| { //std.debug.print("field n°{}: ", .{i}); var index: ?usize = null; var unique = true; for (possible_fields[i * nb_fields .. (i + 1) * nb_fields]) |b, j| { if (b) { if (index != null) unique = false; // std.debug.print("X", .{}); index = j; } else { // std.debug.print("_", .{}); } } if (index == null) { // fait précédement // std.debug.print("\n", .{}); } else if (unique) { const idx = index.?; field_indexes[i] = idx; nb_fields_determined += 1; // std.debug.print(" -> {}\n", .{param.fields[idx].name}); var j: usize = 0; while (j < nb_fields) : (j += 1) { possible_fields[j * nb_fields + idx] = false; } } else { // std.debug.print(" -> ???\n", .{}); } } } var sum: u64 = 1; for (param.my_ticket) |v, i| { const name = param.fields[field_indexes[i]].name; //std.debug.print("{}: {}\n", .{ name, v }); if (std.mem.startsWith(u8, name, "departure")) { sum *= v; } } break :ans sum; }; return [_][]const u8{ try std.fmt.allocPrint(allocator, "{}", .{ans1}), try std.fmt.allocPrint(allocator, "{}", .{ans2}), }; } pub const main = tools.defaultMain("2020/input_day16.txt", run);
2020/day16.zig
const c = @import("../c_global.zig").c_imp; const std = @import("std"); // dross-zig const TextureGl = @import("backend/texture_opengl.zig").TextureGl; const Color = @import("../core/color.zig").Color; const renderer = @import("renderer.zig"); const selected_api = @import("renderer.zig").api; const Vector2 = @import("../core/vector2.zig").Vector2; // ----------------------------------------- // - Texture - // ----------------------------------------- /// Possible errors that may occur when dealing with Textures. pub const TextureErrors = error{ FailedToLoad, }; pub const TextureId = union { id_gl: c_uint, }; /// dross-zig's container for image data pub const Texture = struct { /// The internal texture /// Comments: INTERNAL use only! gl_texture: ?*TextureGl, /// The unique name of the texture internal_name: []const u8 = undefined, /// The ID for the texture, internal_id: TextureId, const Self = @This(); /// Allocates and sets up a Texture /// Comments: The caller will own the allocated data, but /// this should be done through the Resource Handler. via /// loadTexture() pub fn new(allocator: *std.mem.Allocator, name: []const u8, path: []const u8) !*Self { var self = try allocator.create(Texture); switch (selected_api) { renderer.BackendApi.OpenGl => { self.gl_texture = TextureGl.new(allocator, path) catch |err| { std.debug.print("{}\n", .{err}); @panic("[Texture]: ERROR when creating a texture!"); }; self.internal_id = .{ .id_gl = self.gl_texture.?.id(), }; self.internal_name = name; }, renderer.BackendApi.Dx12 => {}, renderer.BackendApi.Vulkan => {}, } return self; } /// Allocates and sets up a dataless Texture /// Comments: The caller will own the allocated data. pub fn newDataless(allocator: *std.mem.Allocator, desired_size: Vector2) !*Self { var self = try allocator.create(Texture); switch (selected_api) { renderer.BackendApi.OpenGl => { self.gl_texture = TextureGl.newDataless(allocator, desired_size) catch |err| { std.debug.print("[Texture]: {}\n", .{err}); @panic("[Texture]: ERROR occurred when creating a dataless texture!"); }; self.internal_id = .{ .id_gl = self.gl_texture.?.id(), }; }, renderer.BackendApi.Dx12 => {}, renderer.BackendApi.Vulkan => {}, } return self; } /// Allocates and sets up a Texture for font-rendering /// Comments: The caller will own the allocated data, but /// this should be done through the Resource Handler via /// loadFont(). pub fn newFont(allocator: *std.mem.Allocator, data: [*c]u8, width: u32, rows: u32) !*Self { var self = try allocator.create(Texture); switch (selected_api) { renderer.BackendApi.OpenGl => { self.gl_texture = TextureGl.newFont(allocator, data, width, rows) catch |err| { std.debug.print("[Texture]: {}\n", .{err}); @panic("[Texture]: ERROR occurred when creating a font texture!"); }; self.internal_id = .{ .id_gl = self.gl_texture.?.id(), }; }, renderer.BackendApi.Dx12 => {}, renderer.BackendApi.Vulkan => {}, } return self; } /// Cleans up and de-allocates the Texture /// Comments: Should only be called by the Resource Handler /// via unloadTexture()/unloadFont() pub fn free(allocator: *std.mem.Allocator, self: *Self) void { switch (selected_api) { renderer.BackendApi.OpenGl => { TextureGl.free(allocator, self.gl_texture.?); }, renderer.BackendApi.Dx12 => {}, renderer.BackendApi.Vulkan => {}, } allocator.destroy(self); } /// Binds the texture pub fn bind(self: *Self) void { switch (selected_api) { renderer.BackendApi.OpenGl => { self.gl_texture.?.bind(); }, renderer.BackendApi.Dx12 => {}, renderer.BackendApi.Vulkan => {}, } } /// Returns the Texture ID pub fn id(self: *Self) TextureId { return self.internal_id; } /// Returns the OpenGL generated texture ID pub fn idGl(self: *Self) c_uint { return self.gl_texture.?.id(); } /// Returns the size of the Texture pub fn size(self: *Self) ?Vector2 { switch (selected_api) { renderer.BackendApi.OpenGl => { const width: f32 = @intToFloat(f32, self.gl_texture.?.width()); const height: f32 = @intToFloat(f32, self.gl_texture.?.height()); return Vector2.new(width, height); }, renderer.BackendApi.Dx12 => { return null; }, renderer.BackendApi.Vulkan => { return null; }, } } };
src/renderer/texture.zig
const std = @import("std"); const builtin = @import("builtin"); const log = std.log; const mem = std.mem; pub usingnamespace std.c; pub usingnamespace mach_task; const mach_task = if (builtin.target.isDarwin()) struct { pub const MachError = error{ /// Not enough permissions held to perform the requested kernel /// call. PermissionDenied, /// Kernel returned an unhandled and unexpected error code. /// This is a catch-all for any yet unobserved kernel response /// to some Mach message. Unexpected, }; pub const MachTask = struct { port: std.c.mach_port_name_t, pub fn isValid(self: MachTask) bool { return self.port != 0; } pub const RegionInfo = struct { pub const Tag = enum { basic, extended, top, }; base_addr: u64, tag: Tag, info: union { basic: std.c.vm_region_basic_info_64, extended: std.c.vm_region_extended_info, top: std.c.vm_region_top_info, }, }; pub fn getRegionInfo( task: MachTask, address: u64, len: usize, tag: RegionInfo.Tag, ) MachError!RegionInfo { var info: RegionInfo = .{ .base_addr = address, .tag = tag, .info = undefined, }; switch (tag) { .basic => info.info = .{ .basic = undefined }, .extended => info.info = .{ .extended = undefined }, .top => info.info = .{ .top = undefined }, } var base_len: std.c.mach_vm_size_t = if (len == 1) 2 else len; var objname: std.c.mach_port_t = undefined; var count: std.c.mach_msg_type_number_t = switch (tag) { .basic => std.c.VM_REGION_BASIC_INFO_COUNT, .extended => std.c.VM_REGION_EXTENDED_INFO_COUNT, .top => std.c.VM_REGION_TOP_INFO_COUNT, }; switch (std.c.getKernError(std.c.mach_vm_region( task.port, &info.base_addr, &base_len, switch (tag) { .basic => std.c.VM_REGION_BASIC_INFO_64, .extended => std.c.VM_REGION_EXTENDED_INFO, .top => std.c.VM_REGION_TOP_INFO, }, switch (tag) { .basic => @ptrCast(std.c.vm_region_info_t, &info.info.basic), .extended => @ptrCast(std.c.vm_region_info_t, &info.info.extended), .top => @ptrCast(std.c.vm_region_info_t, &info.info.top), }, &count, &objname, ))) { .SUCCESS => return info, .FAILURE => return error.PermissionDenied, else => |err| { log.err("mach_vm_region kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } } pub const RegionSubmapInfo = struct { pub const Tag = enum { short, full, }; tag: Tag, base_addr: u64, info: union { short: std.c.vm_region_submap_short_info_64, full: std.c.vm_region_submap_info_64, }, }; pub fn getRegionSubmapInfo( task: MachTask, address: u64, len: usize, nesting_depth: u32, tag: RegionSubmapInfo.Tag, ) MachError!RegionSubmapInfo { var info: RegionSubmapInfo = .{ .base_addr = address, .tag = tag, .info = undefined, }; switch (tag) { .short => info.info = .{ .short = undefined }, .full => info.info = .{ .full = undefined }, } var nesting = nesting_depth; var base_len: std.c.mach_vm_size_t = if (len == 1) 2 else len; var count: std.c.mach_msg_type_number_t = switch (tag) { .short => std.c.VM_REGION_SUBMAP_SHORT_INFO_COUNT_64, .full => std.c.VM_REGION_SUBMAP_INFO_COUNT_64, }; switch (std.c.getKernError(std.c.mach_vm_region_recurse( task.port, &info.base_addr, &base_len, &nesting, switch (tag) { .short => @ptrCast(std.c.vm_region_recurse_info_t, &info.info.short), .full => @ptrCast(std.c.vm_region_recurse_info_t, &info.info.full), }, &count, ))) { .SUCCESS => return info, .FAILURE => return error.PermissionDenied, else => |err| { log.err("mach_vm_region kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } } pub fn getCurrProtection(task: MachTask, address: u64, len: usize) MachError!std.c.vm_prot_t { const info = try task.getRegionSubmapInfo(address, len, 0, .short); return info.info.short.protection; } pub fn setMaxProtection(task: MachTask, address: u64, len: usize, prot: std.c.vm_prot_t) MachError!void { return task.setProtectionImpl(address, len, true, prot); } pub fn setCurrProtection(task: MachTask, address: u64, len: usize, prot: std.c.vm_prot_t) MachError!void { return task.setProtectionImpl(address, len, false, prot); } fn setProtectionImpl(task: MachTask, address: u64, len: usize, set_max: bool, prot: std.c.vm_prot_t) MachError!void { switch (std.c.getKernError(std.c.mach_vm_protect(task.port, address, len, @boolToInt(set_max), prot))) { .SUCCESS => return, .FAILURE => return error.PermissionDenied, else => |err| { log.err("mach_vm_protect kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } } /// Will write to VM even if current protection attributes specifically prohibit /// us from doing so, by temporarily setting protection level to a level with VM_PROT_COPY /// variant, and resetting after a successful or unsuccessful write. pub fn writeMemProtected(task: MachTask, address: u64, buf: []const u8, arch: std.Target.Cpu.Arch) MachError!usize { const curr_prot = try task.getCurrProtection(address, buf.len); try task.setCurrProtection( address, buf.len, std.c.PROT.READ | std.c.PROT.WRITE | std.c.PROT.COPY, ); defer { task.setCurrProtection(address, buf.len, curr_prot) catch {}; } return task.writeMem(address, buf, arch); } pub fn writeMem(task: MachTask, address: u64, buf: []const u8, arch: std.Target.Cpu.Arch) MachError!usize { const count = buf.len; var total_written: usize = 0; var curr_addr = address; const page_size = try getPageSize(task); // TODO we probably can assume value here var out_buf = buf[0..]; while (total_written < count) { const curr_size = maxBytesLeftInPage(page_size, curr_addr, count - total_written); switch (std.c.getKernError(std.c.mach_vm_write( task.port, curr_addr, @ptrToInt(out_buf.ptr), @intCast(std.c.mach_msg_type_number_t, curr_size), ))) { .SUCCESS => {}, .FAILURE => return error.PermissionDenied, else => |err| { log.err("mach_vm_write kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } switch (arch) { .aarch64 => { var mattr_value: std.c.vm_machine_attribute_val_t = std.c.MATTR_VAL_CACHE_FLUSH; switch (std.c.getKernError(std.c.vm_machine_attribute( task.port, curr_addr, curr_size, std.c.MATTR_CACHE, &mattr_value, ))) { .SUCCESS => {}, .FAILURE => return error.PermissionDenied, else => |err| { log.err("vm_machine_attribute kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } }, .x86_64 => {}, else => unreachable, } out_buf = out_buf[curr_size..]; total_written += curr_size; curr_addr += curr_size; } return total_written; } pub fn readMem(task: MachTask, address: u64, buf: []u8) MachError!usize { const count = buf.len; var total_read: usize = 0; var curr_addr = address; const page_size = try getPageSize(task); // TODO we probably can assume value here var out_buf = buf[0..]; while (total_read < count) { const curr_size = maxBytesLeftInPage(page_size, curr_addr, count - total_read); var curr_bytes_read: std.c.mach_msg_type_number_t = 0; var vm_memory: std.c.vm_offset_t = undefined; switch (std.c.getKernError(std.c.mach_vm_read(task.port, curr_addr, curr_size, &vm_memory, &curr_bytes_read))) { .SUCCESS => {}, .FAILURE => return error.PermissionDenied, else => |err| { log.err("mach_vm_read kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } @memcpy(out_buf[0..].ptr, @intToPtr([*]const u8, vm_memory), curr_bytes_read); _ = std.c.vm_deallocate(std.c.mach_task_self(), vm_memory, curr_bytes_read); out_buf = out_buf[curr_bytes_read..]; curr_addr += curr_bytes_read; total_read += curr_bytes_read; } return total_read; } fn maxBytesLeftInPage(page_size: usize, address: u64, count: usize) usize { var left = count; if (page_size > 0) { const page_offset = address % page_size; const bytes_left_in_page = page_size - page_offset; if (count > bytes_left_in_page) { left = bytes_left_in_page; } } return left; } fn getPageSize(task: MachTask) MachError!usize { if (task.isValid()) { var info_count = std.c.TASK_VM_INFO_COUNT; var vm_info: std.c.task_vm_info_data_t = undefined; switch (std.c.getKernError(std.c.task_info( task.port, std.c.TASK_VM_INFO, @ptrCast(std.c.task_info_t, &vm_info), &info_count, ))) { .SUCCESS => return @intCast(usize, vm_info.page_size), else => {}, } } var page_size: std.c.vm_size_t = undefined; switch (std.c.getKernError(std.c._host_page_size(std.c.mach_host_self(), &page_size))) { .SUCCESS => return page_size, else => |err| { log.err("_host_page_size kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } } }; pub fn machTaskForPid(pid: std.os.pid_t) MachError!MachTask { var port: std.c.mach_port_name_t = undefined; switch (std.c.getKernError(std.c.task_for_pid(std.c.mach_task_self(), pid, &port))) { .SUCCESS => {}, .FAILURE => return error.PermissionDenied, else => |err| { log.err("task_for_pid kernel call failed with error code: {s}", .{@tagName(err)}); return error.Unexpected; }, } return MachTask{ .port = port }; } pub fn machTaskForSelf() MachTask { return .{ .port = std.c.mach_task_self() }; } } else struct {};
lib/std/os/darwin.zig
const std = @import("std"); const immu = @import("mmu.zig"); const Mmu = immu.Mmu; const A = immu.addresses; const c = @cImport({ @cInclude("SDL2/SDL.h"); }); pub const Window = struct { renderer: ?*c.SDL_Renderer, window: ?*c.SDL_Window, pixels: [144][160]u32, mmu: *Mmu, pub fn init(mmu: *Mmu) !Window { var w: Window = undefined; w.mmu = mmu; if (c.SDL_Init(c.SDL_INIT_VIDEO | c.SDL_INIT_AUDIO) != 0) { return error.FailedToInitSDL; } errdefer c.SDL_Quit(); if (c.SDL_CreateWindowAndRenderer(160 * 2, 144 * 2, c.SDL_WINDOW_SHOWN | c.SDL_WINDOW_ALLOW_HIGHDPI, &w.window, &w.renderer) != 0) { return error.FailedToInitWindowAndRenderer; } errdefer c.SDL_DestroyWindow(w.window); c.SDL_SetWindowResizable(w.window, c.SDL_bool.SDL_FALSE); c.SDL_SetWindowTitle(w.window, c"zig-gameboy"); _ = c.SDL_SetRenderDrawColor(w.renderer, 255, 255, 255, 255); _ = c.SDL_RenderClear(w.renderer); _ = c.SDL_RenderPresent(w.renderer); return w; } pub fn deinit(w: *Window) void { c.SDL_DestroyWindow(w.window); c.SDL_Quit(); } pub fn render(w: *Window) void { var y: usize = 0; while (y < 144) : (y += 1) { var x: usize = 0; while (x < 160) : (x += 1) { // TODO: Use surfaces instead and draw directly _ = c.SDL_SetRenderDrawColor( w.renderer, @truncate(u8, w.pixels[y][x] >> 24), @truncate(u8, w.pixels[y][x] >> 16), @truncate(u8, w.pixels[y][x] >> 8), 255, ); _ = c.SDL_RenderDrawPoint(w.renderer, @intCast(c_int, x), @intCast(c_int, y)); } } _ = c.SDL_RenderPresent(w.renderer); } pub fn handleEvents(w: *Window) !void { var ev: c.SDL_Event = undefined; while (c.SDL_PollEvent(&ev) != 0) { switch (ev.type) { c.SDL_QUIT => { return error.Quit; }, c.SDL_KEYDOWN => switch (ev.key.keysym.sym) { c.SDLK_RETURN => w.mmu.joyp_bit[0] |= 0x8, c.SDLK_SPACE => w.mmu.joyp_bit[0] |= 0x4, c.SDLK_x => w.mmu.joyp_bit[0] |= 0x2, c.SDLK_z => w.mmu.joyp_bit[0] |= 0x1, c.SDLK_DOWN => w.mmu.joyp_bit[1] |= 0x8, c.SDLK_UP => w.mmu.joyp_bit[1] |= 0x4, c.SDLK_LEFT => w.mmu.joyp_bit[1] |= 0x2, c.SDLK_RIGHT => w.mmu.joyp_bit[1] |= 0x1, else => {}, }, c.SDL_KEYUP => switch (ev.key.keysym.sym) { c.SDLK_RETURN => w.mmu.joyp_bit[0] &= 0xe, c.SDLK_SPACE => w.mmu.joyp_bit[0] &= 0xd, c.SDLK_x => w.mmu.joyp_bit[0] &= 0xb, c.SDLK_z => w.mmu.joyp_bit[0] &= 0x7, c.SDLK_DOWN => w.mmu.joyp_bit[1] &= 0xe, c.SDLK_UP => w.mmu.joyp_bit[1] &= 0xd, c.SDLK_LEFT => w.mmu.joyp_bit[1] &= 0xb, c.SDLK_RIGHT => w.mmu.joyp_bit[1] &= 0x7, else => {}, }, else => {}, } // Update active keys in joyp on any key change w.mmu.mem[A.JOYP] = w.mmu.joyp_bit[w.mmu.joyp_active]; } } };
src/window_sdl.zig