code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const mecha = @import("mecha"); const testing = std.testing; const mem = std.mem; const Allocator = mem.Allocator; pub const Semver = struct { major: u64, minor: u64, patch: u64, const semver = mecha.combine(.{ mecha.int(u64, .{ .base = 10 }), mecha.utf8.char('.'), mecha.int(u64, .{ .base = 10 }), mecha.utf8.char('.'), mecha.int(u64, .{ .base = 10 }), }); const parser = mecha.map(Semver, mecha.toStruct(Semver), semver); const single_parser = mecha.map( Semver, mecha.toStruct(Semver), mecha.combine(.{ semver, mecha.eos, }), ); pub fn parse(allocator: Allocator, str: []const u8) !Semver { return (try single_parser(allocator, str)).value; } pub fn format( self: Semver, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) @TypeOf(writer).Error!void { _ = fmt; _ = options; try writer.print("{}.{}.{}", .{ self.major, self.minor, self.patch, }); } pub fn cmp(self: Semver, other: Semver) std.math.Order { return if (self.major != other.major) std.math.order(self.major, other.major) else if (self.minor != other.minor) std.math.order(self.minor, other.minor) else std.math.order(self.patch, other.patch); } pub fn inside(self: Semver, range: Range) bool { return self.cmp(range.min).compare(.gte) and self.cmp(range.lessThan()).compare(.lt); } }; test "empty string" { try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "")); } test "bad strings" { try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "1")); try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "1.")); try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "1.2")); try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "1.2.")); try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "1.-2.3")); try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "^1.2.3-3.4.5")); } test "semver-suffix" { try testing.expectError(error.ParserFailed, Semver.parse(testing.allocator, "1.2.3-dev")); } test "regular semver" { const expected = Semver{ .major = 1, .minor = 2, .patch = 3 }; try testing.expectEqual(expected, try Semver.parse(testing.allocator, "1.2.3")); } test "semver formatting" { var buf: [80]u8 = undefined; var stream = std.io.fixedBufferStream(&buf); const semver = Semver{ .major = 4, .minor = 2, .patch = 1 }; try stream.writer().print("{}", .{semver}); try testing.expectEqualStrings("4.2.1", stream.getWritten()); } test "semver contains/inside range" { const range_pre = try Range.parse(testing.allocator, "^0.4.1"); const range_post = try Range.parse(testing.allocator, "^1.4.1"); try testing.expect(!range_pre.contains(try Semver.parse(testing.allocator, "0.2.0"))); try testing.expect(!range_pre.contains(try Semver.parse(testing.allocator, "0.4.0"))); try testing.expect(!range_pre.contains(try Semver.parse(testing.allocator, "0.5.0"))); try testing.expect(range_pre.contains(try Semver.parse(testing.allocator, "0.4.2"))); try testing.expect(range_pre.contains(try Semver.parse(testing.allocator, "0.4.128"))); try testing.expect(!range_post.contains(try Semver.parse(testing.allocator, "1.2.0"))); try testing.expect(!range_post.contains(try Semver.parse(testing.allocator, "1.4.0"))); try testing.expect(!range_post.contains(try Semver.parse(testing.allocator, "2.0.0"))); try testing.expect(range_post.contains(try Semver.parse(testing.allocator, "1.5.0"))); try testing.expect(range_post.contains(try Semver.parse(testing.allocator, "1.4.2"))); try testing.expect(range_post.contains(try Semver.parse(testing.allocator, "1.4.128"))); } pub const Range = struct { min: Semver, kind: Kind, pub const Kind = enum { approx, caret, exact, }; const parser = mecha.map( Range, toRange, mecha.combine(.{ mecha.opt( mecha.oneOf(.{ mecha.utf8.range('~', '~'), mecha.utf8.range('^', '^'), }), ), Semver.semver, }), ); fn toRange(tuple: anytype) Range { const kind: Kind = if (tuple[0]) |char| if (char == '~') Kind.approx else if (char == '^') Kind.caret else unreachable else Kind.exact; return Range{ .kind = kind, .min = Semver{ .major = tuple[1][0], .minor = tuple[1][1], .patch = tuple[1][2], }, }; } fn lessThan(self: Range) Semver { return switch (self.kind) { .exact => Semver{ .major = self.min.major, .minor = self.min.minor, .patch = self.min.patch + 1, }, .approx => Semver{ .major = self.min.major, .minor = self.min.minor + 1, .patch = 0, }, .caret => if (self.min.major == 0) Semver{ .major = self.min.major, .minor = self.min.minor + 1, .patch = 0, } else Semver{ .major = self.min.major + 1, .minor = 0, .patch = 0, }, }; } pub fn parse(allocator: Allocator, str: []const u8) !Range { return (try parser(allocator, str)).value; } pub fn format( self: Range, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype, ) @TypeOf(writer).Error!void { _ = fmt; _ = options; switch (self.kind) { .exact => try writer.print("{}", .{self.min}), .approx => try writer.print("~{}", .{self.min}), .caret => try writer.print("^{}", .{self.min}), } } pub fn contains(self: Range, semver: Semver) bool { return semver.inside(self); } }; test "empty string" { try testing.expectError(error.ParserFailed, Range.parse(testing.allocator, "")); } test "approximate" { const expected = Range{ .kind = .approx, .min = Semver{ .major = 1, .minor = 2, .patch = 3, }, }; try testing.expectEqual(expected, try Range.parse(testing.allocator, "~1.2.3")); } test "caret" { const expected = Range{ .kind = .caret, .min = Semver{ .major = 1, .minor = 2, .patch = 3, }, }; try testing.expectEqual(expected, try Range.parse(testing.allocator, "^1.2.3")); } test "exact range" { const expected = Range{ .kind = .exact, .min = Semver{ .major = 1, .minor = 2, .patch = 3, }, }; try testing.expectEqual(expected, try Range.parse(testing.allocator, "1.2.3")); } test "range formatting: exact" { var buf: [80]u8 = undefined; var stream = std.io.fixedBufferStream(&buf); const range = Range{ .kind = .exact, .min = Semver{ .major = 1, .minor = 2, .patch = 3, }, }; try stream.writer().print("{}", .{range}); try testing.expectEqualStrings("1.2.3", stream.getWritten()); } test "range formatting: approx" { var buf: [80]u8 = undefined; var stream = std.io.fixedBufferStream(&buf); const range = Range{ .kind = .approx, .min = Semver{ .major = 1, .minor = 2, .patch = 3, }, }; try stream.writer().print("{}", .{range}); try testing.expectEqualStrings("~1.2.3", stream.getWritten()); } test "range formatting: caret" { var buf: [80]u8 = undefined; var stream = std.io.fixedBufferStream(&buf); const range = Range{ .kind = .caret, .min = Semver{ .major = 1, .minor = 2, .patch = 3, }, }; try stream.writer().print("{}", .{range}); try testing.expectEqualStrings("^1.2.3", stream.getWritten()); }
src/main.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../inputs/day19.txt"); pub fn main() anyerror!void { var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa_impl.deinit(); const gpa = gpa_impl.allocator(); return main_with_allocator(gpa); } pub fn main_with_allocator(allocator: Allocator) anyerror!void { const scanners = try parse(allocator, data); defer { for (scanners.items) |*scanner| scanner.deinit(); scanners.deinit(); } try solve(allocator, scanners.items); print("Part 1: {d}\n", .{try part1(allocator, scanners.items)}); print("Part 2: {d}\n", .{part2(scanners.items)}); } const Pos = struct { const Self = @This(); x: isize, y: isize, z: isize, fn zero() Self { return Pos{ .x = 0, .y = 0, .z = 0 }; } fn eql(self: Self, other: Self) bool { return self.x == other.x and self.y == other.y and self.z == other.z; } fn sqr_distance(self: Self, other: Self) isize { const dx = self.x - other.x; const dy = self.y - other.y; const dz = self.z - other.z; return dx * dx + dy * dy + dz * dz; } fn manhattan_distance(self: Self, other: Self) usize { const dx = abs(self.x - other.x); const dy = abs(self.y - other.y); const dz = abs(self.z - other.z); return dx + dy + dz; } fn rotate_z(self: Self, index: u2) Self { switch (index) { // initial 0 => return self, // anti-clockwise 90 1 => return Self{ .x = -self.y, .y = self.x, .z = self.z, }, // 180 2 => return Self{ .x = -self.x, .y = -self.y, .z = self.z, }, // clockwise 90 3 => return Self{ .x = self.y, .y = -self.x, .z = self.z, }, } } fn facing(self: Self, index: u3) Self { std.debug.assert(index < 6); switch (index) { // z-up 0 => return self, // z-down 1 => return Self{ .x = -self.x, .y = self.y, .z = -self.z, }, // x-up 2 => return Self{ .x = -self.z, .y = self.y, .z = self.x, }, // x-down 3 => return Self{ .x = self.z, .y = self.y, .z = -self.x, }, // y-up 4 => return Self{ .x = self.x, .y = -self.z, .z = self.y, }, // y-down 5 => return Self{ .x = self.x, .y = self.z, .z = -self.y, }, else => unreachable, } } fn direction(self: Self, index: u5) Self { std.debug.assert(index < 24); const rotate_index = @intCast(u2, (index & 0b00011) >> 0); const facing_index = @intCast(u3, (index & 0b11100) >> 2); return self.facing(facing_index).rotate_z(rotate_index); } fn translate(self: Self, from: Pos, to: Pos) Self { return Self{ .x = self.x + (to.x - from.x), .y = self.y + (to.y - from.y), .z = self.z + (to.z - from.z), }; } }; const Scanner = struct { const Self = @This(); const SqrDistanceMap = std.AutoHashMap(isize, std.AutoHashMap(usize, void)); beacons: std.ArrayList(Pos), pos: ?Pos = null, direction: ?u5 = null, beacons_sqr_dist: ?SqrDistanceMap = null, fn deinit(self: *Self) void { self.beacons.deinit(); if (self.beacons_sqr_dist) |*map| { var it = map.valueIterator(); while (it.next()) |*v| v.*.deinit(); map.deinit(); } } fn init(allocator: Allocator) Self { return Scanner{ .beacons = std.ArrayList(Pos).init(allocator), }; } fn beacon_abs_pos(self: Self, idx: usize) Pos { return self.beacons.items[idx].direction(self.direction.?).translate(Pos.zero(), self.pos.?); } fn build_beacons_sqr_dist(self: *Self, allocator: Allocator) !void { var map = SqrDistanceMap.init(allocator); for (self.beacons.items) |from, from_idx| { if (from_idx == self.beacons.items.len - 1) continue; for (self.beacons.items[from_idx + 1 ..]) |to, i| { const to_idx = i + from_idx + 1; const sqr_dist = from.sqr_distance(to); if (map.getPtr(sqr_dist)) |p| { try p.put(from_idx, .{}); try p.put(to_idx, .{}); } else { var idx_map = std.AutoHashMap(usize, void).init(allocator); try idx_map.put(from_idx, .{}); try idx_map.put(to_idx, .{}); try map.put(sqr_dist, idx_map); } } } self.beacons_sqr_dist = map; } fn solve(self: *Self, allocator: Allocator, reference: Scanner) !bool { // Reference must have a known position std.debug.assert(reference.pos != null); std.debug.assert(reference.direction != null); std.debug.assert(reference.beacons_sqr_dist != null); std.debug.assert(self.beacons_sqr_dist != null); // Points whose distances match the reference var dist_match = std.AutoHashMap(usize, std.AutoHashMap(usize, void)).init(allocator); defer dist_match.deinit(); // Don't deinit values { var it = reference.beacons_sqr_dist.?.iterator(); while (it.next()) |ref| { const dist = ref.key_ptr.*; if (self.beacons_sqr_dist.?.get(dist)) |idx_map| { var self_idx_it = idx_map.keyIterator(); while (self_idx_it.next()) |idx| { try dist_match.put(idx.*, ref.value_ptr.*); } } } } if (dist_match.count() < 12) return false; var direction: u5 = 0; while (direction < 24) : (direction += 1) { // Attempt self.direction = direction; self.pos = Pos.zero(); var it = dist_match.iterator(); const anchor = it.next().?; var anchor_pos = self.beacon_abs_pos(anchor.key_ptr.*); var it_candidates = anchor.value_ptr.*.keyIterator(); while (it_candidates.next()) |candidate_idx| { var candidate = reference.beacon_abs_pos(candidate_idx.*); // Adjust self.pos to attach the anchor to the candidate self.pos = Pos.zero().translate(anchor_pos, candidate); std.debug.assert(self.beacon_abs_pos(anchor.key_ptr.*).eql(candidate)); var all_match = true; match_loop: while (it.next()) |match| { var pos = self.beacon_abs_pos(match.key_ptr.*); var it_match_ref = match.value_ptr.keyIterator(); while (it_match_ref.next()) |ref_idx| { var ref_pos = reference.beacon_abs_pos(ref_idx.*); if (pos.eql(ref_pos)) continue :match_loop; } all_match = false; break; } if (all_match) return true; } } return false; } }; fn parse(allocator: Allocator, input: []const u8) !std.ArrayList(Scanner) { var scanners = std.ArrayList(Scanner).init(allocator); errdefer scanners.deinit(); var scanner_lines_it = std.mem.split(u8, input, "\n\n"); while (scanner_lines_it.next()) |scanner_lines| { var scanner = Scanner.init(allocator); errdefer scanner.deinit(); var lines = std.mem.tokenize(u8, scanner_lines, "\n"); // Remove header _ = lines.next(); while (lines.next()) |beacon_str| { var it = std.mem.split(u8, beacon_str, ","); const x = try std.fmt.parseInt(isize, it.next().?, 10); const y = try std.fmt.parseInt(isize, it.next().?, 10); const z = try std.fmt.parseInt(isize, it.next().?, 10); try scanner.beacons.append(Pos{ .x = x, .y = y, .z = z, }); } try scanner.build_beacons_sqr_dist(allocator); try scanners.append(scanner); } return scanners; } fn solve(allocator: Allocator, scanners: []Scanner) !void { // Setup the reference scanners[0].pos = Pos.zero(); scanners[0].direction = 0; var solved = try std.ArrayList(usize).initCapacity(allocator, scanners.len); defer solved.deinit(); var todo = try std.ArrayList(usize).initCapacity(allocator, scanners.len); defer todo.deinit(); for (scanners) |_, i| { if (i == 0) { try solved.append(0); } else { try todo.append(i); } } while (todo.popOrNull()) |scanner_idx| { const scanner = &scanners[scanner_idx]; var done = false; for (solved.items) |reference_idx| { const reference = scanners[reference_idx]; if (try scanner.solve(allocator, reference)) { done = true; break; } } if (done) { try solved.append(scanner_idx); } else { try todo.insert(0, scanner_idx); } } } const Beacons = std.AutoHashMap(Pos, void); fn beacon_map(allocator: Allocator, scanners: []Scanner) !Beacons { var beacons = std.AutoHashMap(Pos, void).init(allocator); errdefer beacons.deinit(); for (scanners) |scanner| { for (scanner.beacons.items) |beacon| { const absolute_beacon = beacon.direction(scanner.direction.?).translate(Pos.zero(), scanner.pos.?); try beacons.put(absolute_beacon, .{}); } } return beacons; } fn part1(allocator: Allocator, scanners: []Scanner) !usize { var beacons = try beacon_map(allocator, scanners); defer beacons.deinit(); return beacons.count(); } fn part2(scanners: []Scanner) usize { var max_dist: usize = 0; for (scanners) |a, i| { if (i == scanners.len - 1) continue; for (scanners[i + 1 ..]) |b| { max_dist = std.math.max(max_dist, a.pos.?.manhattan_distance(b.pos.?)); } } return max_dist; } fn abs(a: isize) usize { if (a < 0) return @intCast(usize, -a); return @intCast(usize, a); } test "beacons" { const input = \\--- scanner 0 --- \\404,-588,-901 \\528,-643,409 \\-838,591,734 \\390,-675,-793 \\-537,-823,-458 \\-485,-357,347 \\-345,-311,381 \\-661,-816,-575 \\-876,649,763 \\-618,-824,-621 \\553,345,-567 \\474,580,667 \\-447,-329,318 \\-584,868,-557 \\544,-627,-890 \\564,392,-477 \\455,729,728 \\-892,524,684 \\-689,845,-530 \\423,-701,434 \\7,-33,-71 \\630,319,-379 \\443,580,662 \\-789,900,-551 \\459,-707,401 \\ \\--- scanner 1 --- \\686,422,578 \\605,423,415 \\515,917,-361 \\-336,658,858 \\95,138,22 \\-476,619,847 \\-340,-569,-846 \\567,-361,727 \\-460,603,-452 \\669,-402,600 \\729,430,532 \\-500,-761,534 \\-322,571,750 \\-466,-666,-811 \\-429,-592,574 \\-355,545,-477 \\703,-491,-529 \\-328,-685,520 \\413,935,-424 \\-391,539,-444 \\586,-435,557 \\-364,-763,-893 \\807,-499,-711 \\755,-354,-619 \\553,889,-390 \\ \\--- scanner 2 --- \\649,640,665 \\682,-795,504 \\-784,533,-524 \\-644,584,-595 \\-588,-843,648 \\-30,6,44 \\-674,560,763 \\500,723,-460 \\609,671,-379 \\-555,-800,653 \\-675,-892,-343 \\697,-426,-610 \\578,704,681 \\493,664,-388 \\-671,-858,530 \\-667,343,800 \\571,-461,-707 \\-138,-166,112 \\-889,563,-600 \\646,-828,498 \\640,759,510 \\-630,509,768 \\-681,-892,-333 \\673,-379,-804 \\-742,-814,-386 \\577,-820,562 \\ \\--- scanner 3 --- \\-589,542,597 \\605,-692,669 \\-500,565,-823 \\-660,373,557 \\-458,-679,-417 \\-488,449,543 \\-626,468,-788 \\338,-750,-386 \\528,-832,-391 \\562,-778,733 \\-938,-730,414 \\543,643,-506 \\-524,371,-870 \\407,773,750 \\-104,29,83 \\378,-903,-323 \\-778,-728,485 \\426,699,580 \\-438,-605,-362 \\-469,-447,-387 \\509,732,623 \\647,635,-688 \\-868,-804,481 \\614,-800,639 \\595,780,-596 \\ \\--- scanner 4 --- \\727,592,562 \\-293,-554,779 \\441,611,-461 \\-714,465,-776 \\-743,427,-804 \\-660,-479,-426 \\832,-632,460 \\927,-485,-438 \\408,393,-506 \\466,436,-512 \\110,16,151 \\-258,-428,682 \\-393,719,612 \\-211,-452,876 \\808,-476,-593 \\-575,615,604 \\-485,667,467 \\-680,325,-822 \\-627,-443,-432 \\872,-547,-609 \\833,512,582 \\807,604,487 \\839,-516,451 \\891,-625,532 \\-652,-548,-490 \\30,-46,-14 ; const allocator = std.testing.allocator; const scanners = try parse(allocator, input); defer { for (scanners.items) |*scanner| scanner.deinit(); scanners.deinit(); } try solve(allocator, scanners.items); try std.testing.expectEqual(@as(usize, 79), try part1(allocator, scanners.items)); try std.testing.expectEqual(@as(usize, 3621), part2(scanners.items)); }
src/day19.zig
const std = @import("std"); const process = @import("../process.zig"); const platform = @import("../platform.zig"); const util = @import("../util.zig"); const w3 = @import("../wasm3.zig"); const wasi = @import("wasm/wasi.zig"); const Process = process.Process; pub const Runtime = struct { pub const Args = struct { wasm_image: []u8, stack_size: usize = 64 * 1024, link_wasi: bool = true, }; proc: *Process, wasm3: w3.Runtime, module: w3.Module = undefined, wasi_impl: w3.NativeModule = undefined, debug_impl: w3.NativeModule = undefined, entry_point: w3.Function = undefined, pub fn init(proc: *Process, args: Runtime.Args) !Runtime { var ret = Runtime{ .proc = proc, .wasm3 = try w3.Runtime.init(args.stack_size) }; ret.wasi_impl = try w3.NativeModule.init(proc.allocator, "", wasi.Preview1, proc); errdefer ret.wasi_impl.deinit(); ret.debug_impl = try w3.NativeModule.init(proc.allocator, "", wasi.Debug, proc); errdefer ret.debug_impl.deinit(); ret.module = try ret.wasm3.parseAndLoadModule(args.wasm_image); try ret.linkStd(ret.module); ret.entry_point = try ret.wasm3.findFunction("_start"); return ret; } pub fn linkStd(self: *Runtime, module: w3.Module) !void { for (wasi.Preview1.namespaces) |namespace| { self.wasi_impl.link(namespace, module); } self.debug_impl.link("shinkou_debug", module); } pub fn start(self: *Runtime) void { _ = self.entry_point.callVoid(void) catch |err| { switch (err) { w3.Error.Exit => { return; }, else => { platform.earlyprintf("ERR: {}\r\n", .{@errorName(err)}); }, } }; } pub fn deinit(self: *Runtime) void { self.wasi_impl.deinit(); self.debug_impl.deinit(); self.proc.allocator.destroy(self); } };
kernel/runtime/wasm.zig
const std = @import("std"); const math = std.math; const Allocator = std.mem.Allocator; const FLIR = @This(); const print = std.debug.print; const CFO = @import("./CFO.zig"); const swap = std.mem.swap; const builtin = @import("builtin"); const s2 = builtin.zig_backend != .stage1; const ArrayList = std.ArrayList; const VMathOp = CFO.VMathOp; pub const Tag = enum(u8) { arg, load, store, constant, vmath, ret, loop_start, loop_end, }; const ref = u16; pub const Inst = struct { tag: Tag, opspec: u8 = 0, op1: ref = 0, op2: ref = 0, alloc: ?u4 = null, live: ?u16 = null, tmp: u16 = 0, }; narg: u16, theinst: Inst = undefined, inst: ArrayList(Inst), constants: ArrayList(f64), pos_loop_start: u16 = 0, pos_loop_end: u16 = 0, pub fn init(narg: u4, allocator: Allocator) !FLIR { var self: FLIR = .{ .narg = narg, .inst = try ArrayList(Inst).initCapacity(allocator, 16), .constants = try ArrayList(f64).initCapacity(allocator, 16), }; try self.initialize(); return self; } pub fn init_stage2(narg: u4, allocator: Allocator) !FLIR { _ = allocator; var self: FLIR = .{ .narg = narg, .inst = try ArrayList(Inst).initCapacity(allocator, 16), .constants = try ArrayList(f64).initCapacity(allocator, 16), .pos_loop_start = 0, .pos_loop_end = 0, .theinst = undefined, }; self.initialize() catch unreachable; return self; } fn initialize(self: *FLIR) !void { var iarg: u4 = 0; while (iarg < self.narg) : (iarg += 1) { // stage2: cannot initialize in place // try self.inst.append(.{ .tag = .arg, .op1 = iarg, .alloc = iarg }); const inst: Inst = .{ .tag = .arg, .op1 = iarg, .alloc = iarg }; _ = try self.put(inst); } } pub fn deinit(self: FLIR) void { self.inst.deinit(); self.constants.deinit(); } pub inline fn ninst(self: FLIR) u16 { return @intCast(u16, self.inst.items.len); } pub fn put(self: *FLIR, inst: Inst) !u16 { try self.inst.append(inst); return @intCast(u16, self.inst.items.len - 1); } pub fn loop_start(self: *FLIR) !void { _ = try self.put(Inst{ .tag = .loop_start }); } pub fn loop_end(self: *FLIR) !void { _ = try self.put(Inst{ .tag = .loop_end }); } pub fn live(self: *FLIR, arglive: bool) void { var pos: u16 = 0; while (pos < self.ninst()) : (pos += 1) { const inst = &self.inst.items[pos]; inst.live = null; const nop: u2 = switch (inst.tag) { .arg => 0, .vmath => 2, .ret => 1, .load => 0, // of course this will be more when we track GPRs.. .store => 1, // of course this will be more when we track GPRs.. .constant => 0, .loop_start => 0, .loop_end => 0, }; if (nop > 0) { self.set_live(inst.op1, pos); if (nop > 1) { self.set_live(inst.op2, pos); } } switch (inst.tag) { .loop_start => { self.pos_loop_start = pos; }, .loop_end => { self.pos_loop_end = pos; }, else => {}, } } // TODO: lol what is loop analysis if (arglive) { pos = 0; while (pos < self.pos_loop_start) : (pos += 1) { const inst = &self.inst.items[pos]; if (inst.live) |l| if (l > self.pos_loop_start and l < self.pos_loop_end) { inst.live = self.pos_loop_end; }; } } } inline fn set_live(self: FLIR, used: u16, user: u16) void { const inst = &self.inst.items[used]; inst.live = if (inst.live) |l| math.max(l, user) else user; } pub fn scanreg(self: FLIR, doit: bool) !u5 { var active: [16]?u16 = ([1]?u16{null}) ** 16; var pos: u16 = 0; var maxpressure: u5 = 0; while (pos < self.ninst()) : (pos += 1) { const inst = &self.inst.items[pos]; if (inst.live) |end| { const reg = inst.alloc orelse found: { for (active) |v, i| { if (v == null or v.? <= pos) { break :found @intCast(u4, i); } } else { return error.TooManyLiveRanges; } }; if (doit) inst.alloc = reg; active[reg] = end; var pressure: u5 = 0; for (active) |v| { if (!(v == null or v.? <= pos)) { pressure += 1; } } maxpressure = math.max(maxpressure, pressure); } else if (inst.tag == .ret) { // not used but it looks good\tm if (doit) inst.alloc = 0; } } return maxpressure; } // must have run self.live() ! // pressure can be calculated by self.scanreg(false) pub fn hoist_loopy(self: FLIR, pressure: u5) !void { var available: u5 = 16 - pressure; if (available == 0) return; var pos: u16 = 0; var newpos: u16 = 0; while (pos < self.pos_loop_start) : (pos += 1) { const inst = &self.inst.items[pos]; inst.tmp = newpos; newpos += 1; } if (self.inst.items[pos].tag != .loop_start) return error.FEEL; pos += 1; while (pos < self.pos_loop_end) : (pos += 1) { const inst = &self.inst.items[pos]; if (inst.tag == .constant) { inst.tmp = newpos; newpos += 1; available -= 1; if (available == 0) { break; } } } self.inst.items[self.pos_loop_start].tmp = newpos; newpos += 1; pos = self.pos_loop_start + 1; while (pos < self.pos_loop_end) : (pos += 1) { const inst = &self.inst.items[pos]; if (inst.tmp == 0) { inst.tmp = newpos; newpos += 1; } } if (pos != newpos) return error.youDunGoofed; while (pos < self.ninst()) : (pos += 1) { const inst = &self.inst.items[pos]; inst.tmp = pos; } self.debug_print(true); pos = 0; while (pos < self.ninst()) : (pos += 1) { const inst = &self.inst.items[pos]; const nop = n_op(inst.tag); if (nop > 0) { inst.op1 = self.inst.items[inst.op1].tmp; if (nop > 1) { inst.op2 = self.inst.items[inst.op2].tmp; } } } pos = 0; while (pos < self.ninst()) : (pos += 1) { const inst = &self.inst.items[pos]; while (inst.tmp != pos) { swap(Inst, inst, &self.inst.items[inst.tmp]); } } } fn n_op(tag: Tag) u2 { return switch (tag) { .arg => 1, .vmath => 2, .ret => 1, .load => 0, .constant => 0, .store => 1, .loop_start => 0, .loop_end => 0, }; } pub fn debug_print(self: FLIR, tmp: bool) void { var pos: u16 = 0; print("\n", .{}); while (pos < self.ninst()) : (pos += 1) { const inst = &self.inst.items[pos]; if (inst.alloc) |reg| { print(" xmm{} ", .{reg}); } else { print(" ---- ", .{}); } if (tmp) { print("{:3} ", .{inst.tmp}); } const marker: u8 = if (inst.live) |_| ' ' else '!'; print("%{}{c}= {s}", .{ pos, marker, @tagName(inst.tag) }); const nop = n_op(inst.tag); if (inst.tag == .vmath) { print(".{s}", .{@tagName(@intToEnum(VMathOp, inst.opspec))}); } else if (inst.tag == .load) { const i: []const u8 = if (inst.opspec > 0xF) "i+" else ""; print(" p{}[{s}{}]", .{ inst.opspec & 0xF, i, inst.op1 }); } else if (inst.tag == .store) { const i: []const u8 = if (inst.opspec > 0xF) "i+" else ""; print(" p{}[{s}{}] <-", .{ inst.opspec & 0xF, i, inst.op2 }); } else if (inst.tag == .constant) { print(" c[{}]", .{inst.op1}); } if (nop > 0) { print(" %{}", .{inst.op1}); if (self.inst.items[inst.op1].live == pos) { print("!", .{}); } if (nop > 1) { print(", %{}", .{inst.op2}); if (self.inst.items[inst.op2].live == pos) { print("!", .{}); } } } print("\n", .{}); } } pub fn codegen(self: FLIR, cfo: *CFO, simd: bool) !u32 { const target = cfo.get_target(); const idx = .rcx; var pos: usize = 0; var loop_pos: ?u32 = null; const stride: u8 = if (simd) 4 else 1; const fm: CFO.FMode = if (simd) .pd4 else .sd; while (pos < self.inst.items.len) : (pos += 1) { const inst = &self.inst.items[pos]; switch (inst.tag) { .loop_start => { try cfo.mov(.r10, .rcx); try cfo.arit(.xor, idx, idx); loop_pos = cfo.get_target(); }, .loop_end => { try cfo.aritri(.add, idx, stride); try cfo.arit(.cmp, idx, .r10); try cfo.jbck(.l, loop_pos orelse return error.UW0TM8); }, .arg => { if (inst.op1 != @as(u16, inst.alloc.?)) return error.InvalidArgRegister; if (inst.live != null and simd) return error.AAA_AAA_AAA; }, .vmath => { // TODO: kill dead instructions completely instead of leaving alloc blank const dst = inst.alloc orelse continue; const src1 = self.inst.items[inst.op1].alloc.?; const src2 = self.inst.items[inst.op2].alloc.?; try cfo.vmathf(@intToEnum(VMathOp, inst.opspec), fm, dst, src1, src2); }, .ret => { const src = self.inst.items[inst.op1].alloc.?; if (src != 0) { try cfo.vmovf(fm, 0, src); } break; }, .load => { const dst = inst.alloc.?; const reg: CFO.IPReg = switch (inst.opspec & 0xF) { 0 => .rdi, 1 => .rsi, 2 => .rdx, else => unreachable, }; const base = if (inst.opspec > 0xF) CFO.qi(reg, idx) else CFO.a(reg); const src = base.o(inst.op1); // TODO: use align! if (simd and base.index == null) { // try cfo.vbroadcast(.pd4, dst, src); } else { try cfo.vmovarm(fm, dst, src); } }, .constant => { const dst = inst.alloc.?; if (simd) { // try cfo.vbroadcast(.pd4, dst, CFO.a(.rax).o(8 * inst.op1)); } else { try cfo.vmovurm(.sd, dst, CFO.a(.rax).o(8 * inst.op1)); } }, .store => { const src = self.inst.items[inst.op1].alloc.?; const reg: CFO.IPReg = switch (inst.opspec & 0xF) { 0 => .rdi, 1 => .rsi, 2 => .rdx, else => unreachable, }; const base = if (inst.opspec > 0xF) CFO.qi(reg, .rcx) else CFO.a(reg); const dst = base.o(inst.op2); try cfo.vmovamr(fm, dst, src); }, } } return target; } pub fn add_constant(self: *FLIR, k: f64) !u16 { try self.constants.append(k); return @intCast(u16, self.constants.items.len - 1); } // TRICKY: we might want to share a single constant block across multiple kernels pub fn emit_constants(self: *FLIR, cfo: *CFO) !u32 { try cfo.set_align(8); const target = cfo.get_target(); for (self.constants.items) |c| { try cfo.wq(@bitCast(u64, c)); } return target; }
src/Old_FLIR.zig
const std = @import("std"); const fs = std.fs; const Allocator = std.mem.Allocator; pub const SpectralType = enum(u8) { O, B, A, F, G, K, M, }; pub const SkyCoord = packed struct { right_ascension: f32, declination: f32, }; pub const Constellation = struct { boundaries: []SkyCoord, asterism: []SkyCoord, is_zodiac: bool, pub fn deinit(self: *Constellation, allocator: *Allocator) void { allocator.free(self.boundaries); allocator.free(self.asterism); } pub fn parseSkyFile(allocator: *Allocator, data: []const u8) !Constellation { const ParseState = enum { stars, asterism, boundaries, }; var result: Constellation = undefined; var stars = std.StringHashMap(SkyCoord).init(allocator); defer stars.deinit(); var boundary_list = std.ArrayList(SkyCoord).init(allocator); errdefer boundary_list.deinit(); var asterism_list = std.ArrayList(SkyCoord).init(allocator); errdefer asterism_list.deinit(); var line_iter = std.mem.split(u8, data, "\r\n"); var parse_state: ParseState = .stars; while (line_iter.next()) |line| { if (std.mem.trim(u8, line, " ").len == 0) continue; if (std.mem.endsWith(u8, line, "zodiac")) { result.is_zodiac = true; continue; } if (std.mem.indexOf(u8, line, "@stars")) |_| { parse_state = .stars; continue; } if (std.mem.indexOf(u8, line, "@asterism")) |_| { parse_state = .asterism; continue; } if (std.mem.indexOf(u8, line, "@boundaries")) |_| { parse_state = .boundaries; continue; } if (!std.mem.startsWith(u8, line, "@")) { // std.debug.print("Line: {s}\n", .{line}); switch (parse_state) { .stars => { var parts = std.mem.split(u8, line, ","); const star_name = std.mem.trim(u8, parts.next().?, " "); const right_ascension = std.mem.trim(u8, parts.next().?, " "); const declination = std.mem.trim(u8, parts.next().?, " "); const star_coord = SkyCoord{ .right_ascension = try std.fmt.parseFloat(f32, right_ascension), .declination = try std.fmt.parseFloat(f32, declination) }; try stars.put(star_name, star_coord); }, .asterism => { var parts = std.mem.split(u8, line, ","); const star_a_name = std.mem.trim(u8, parts.next().?, " "); const star_b_name = std.mem.trim(u8, parts.next().?, " "); if (stars.get(star_a_name)) |star_a| { if (stars.get(star_b_name)) |star_b| { try asterism_list.append(star_a); try asterism_list.append(star_b); } } }, .boundaries => { var parts = std.mem.split(u8, line, ","); const right_ascension_long = std.mem.trim(u8, parts.next().?, " "); const declination = std.mem.trim(u8, parts.next().?, " "); var right_ascension_parts = std.mem.split(u8, right_ascension_long, " "); const ra_hours = try std.fmt.parseInt(u32, right_ascension_parts.next().?, 10); const ra_minutes = try std.fmt.parseInt(u32, right_ascension_parts.next().?, 10); const ra_seconds = try std.fmt.parseFloat(f32, right_ascension_parts.next().?); const right_ascension = @intToFloat(f32, ra_hours * 15) + ((@intToFloat(f32, ra_minutes) / 60) * 15) + ((ra_seconds / 3600) * 15); const boundary_coord = SkyCoord{ .right_ascension = right_ascension, .declination = try std.fmt.parseFloat(f32, std.mem.trim(u8, declination, " ")), }; try boundary_list.append(boundary_coord); }, } } } result.boundaries = boundary_list.toOwnedSlice(); result.asterism = asterism_list.toOwnedSlice(); return result; } }; pub const Star = packed struct { right_ascension: f32, declination: f32, brightness: f32, spec_type: SpectralType, fn parse(data: []const u8) !Star { var star: Star = undefined; var parts_iter = std.mem.split(u8, data, "|"); var part_index: u8 = 0; while (parts_iter.next()) |part| : (part_index += 1) { if (part_index > 14) break; switch (part_index) { 1 => star.right_ascension = try std.fmt.parseFloat(f32, part), 5 => star.declination = try std.fmt.parseFloat(f32, part), 13 => { const dimmest_visible: f32 = 18.6; const brightest_value: f32 = -4.6; const v_mag = std.fmt.parseFloat(f32, part) catch dimmest_visible; const mag_display_factor = (dimmest_visible - (v_mag - brightest_value)) / dimmest_visible; star.brightness = mag_display_factor; }, 14 => { if (part.len < 1) { star.spec_type = .A; continue; } star.spec_type = switch (std.ascii.toLower(part[0])) { 'o' => SpectralType.O, 'b' => SpectralType.B, 'a' => SpectralType.A, 'f' => SpectralType.F, 'g' => SpectralType.G, 'k' => SpectralType.K, 'm' => SpectralType.M, else => SpectralType.A, }; }, else => {}, } } return star; } }; pub fn main() anyerror!void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = &arena.allocator; var args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); if (args.len != 3) { std.log.err("Must provide an output file name for both outputs", .{}); return error.InvalidArgs; } const star_out_filename = args[1]; const const_out_filename = args[2]; var timer = std.time.Timer.start() catch unreachable; const start = timer.read(); var stars = try readSaoCatalog(allocator, "sao_catalog"); const end = timer.read(); std.debug.print("Parsing took {d:.4} ms\n", .{(end - start) / 1_000_000}); var shuffle_count: usize = 0; while (shuffle_count < 1000) : (shuffle_count += 1) { shuffleStars(stars); } try writeStarData(stars, star_out_filename); const constellations = try readConstellationFiles(allocator, "constellations/iau"); defer { for (constellations) |*c| c.deinit(allocator); allocator.free(constellations); } try writeConstellationData(constellations, const_out_filename); } fn readSaoCatalog(allocator: *Allocator, catalog_filename: []const u8) ![]Star { const cwd = fs.cwd(); const sao_catalog = try cwd.openFile(catalog_filename, .{}); defer sao_catalog.close(); var star_list = try std.ArrayList(Star).initCapacity(allocator, 75000); errdefer star_list.deinit(); var read_buffer: [std.mem.page_size]u8 = undefined; var read_start_index: usize = 0; var line_start_index: usize = 0; var line_end_index: usize = 0; read_loop: while (sao_catalog.readAll(read_buffer[read_start_index..])) |bytes_read| { if (bytes_read == 0) break; // Get all the lines currently read into the buffer while (line_start_index < read_buffer.len and line_end_index < read_buffer.len) { // Search for the end of the current line line_end_index = while (line_end_index < read_buffer.len) : (line_end_index += 1) { if (read_buffer[line_end_index] == '\n') break line_end_index; } else { // If it gets to the end of the buffer without reaching the end of the line, move the current in-progress // line to the beginning of the buffer, reset the indices to their new positions, and read more data into // the buffer std.mem.copy(u8, read_buffer[0..], read_buffer[line_start_index..]); line_end_index -= line_start_index; read_start_index = line_end_index; line_start_index = 0; continue :read_loop; }; const line = read_buffer[line_start_index..line_end_index]; if (std.mem.startsWith(u8, line, "SAO")) { if (Star.parse(line)) |star| { if (star.brightness >= 0.3) { star_list.appendAssumeCapacity(star); } } else |_| {} } line_start_index = line_end_index + 1; line_end_index = line_start_index; } line_start_index = 0; line_end_index = 0; read_start_index = 0; } else |err| return err; std.debug.print("Wrote {} stars\n", .{star_list.items.len}); return star_list.toOwnedSlice(); } fn writeStarData(stars: []Star, out_filename: []const u8) !void { const cwd = fs.cwd(); const output_file = try cwd.createFile(out_filename, .{}); defer output_file.close(); var output_buffered_writer = std.io.bufferedWriter(output_file.writer()); var output_writer = output_buffered_writer.writer(); for (stars) |star| { try output_writer.writeAll(std.mem.toBytes(star)[0..]); } try output_buffered_writer.flush(); } fn readConstellationFiles(allocator: *Allocator, constellation_dir_name: []const u8) ![]Constellation { var constellations = std.ArrayList(Constellation).init(allocator); errdefer constellations.deinit(); const cwd = fs.cwd(); var constellation_dir = try cwd.openDir(constellation_dir_name, .{ .iterate = true }); defer constellation_dir.close(); var constellation_dir_walker = try constellation_dir.walk(allocator); defer constellation_dir_walker.deinit(); var read_buffer: [4096]u8 = undefined; while (try constellation_dir_walker.next()) |entry| { if (entry.kind != .File) continue; if (!std.mem.endsWith(u8, entry.basename, ".sky")) continue; var sky_file = try entry.dir.openFile(entry.basename, .{}); defer sky_file.close(); const bytes_read = try sky_file.readAll(read_buffer[0..]); const constellation = try Constellation.parseSkyFile(allocator, read_buffer[0..bytes_read]); try constellations.append(constellation); } return constellations.toOwnedSlice(); } fn writeConstellationData(constellations: []Constellation, const_out_filename: []const u8) !void { const cwd = fs.cwd(); const constellation_out_file = try cwd.createFile(const_out_filename, .{}); defer constellation_out_file.close(); var const_out_buffered_writer = std.io.bufferedWriter(constellation_out_file.writer()); var const_out_writer = const_out_buffered_writer.writer(); var num_boundaries: u32 = 0; var num_asterisms: u32 = 0; for (constellations) |constellation| { num_boundaries += @intCast(u32, constellation.boundaries.len); num_asterisms += @intCast(u32, constellation.asterism.len); } try const_out_writer.writeAll(std.mem.toBytes(@intCast(u32, constellations.len))[0..]); try const_out_writer.writeAll(std.mem.toBytes(num_boundaries)[0..]); try const_out_writer.writeAll(std.mem.toBytes(num_asterisms)[0..]); for (constellations) |constellation| { try const_out_writer.writeAll(std.mem.toBytes(@intCast(u32, constellation.boundaries.len))[0..]); try const_out_writer.writeAll(std.mem.toBytes(@intCast(u32, constellation.asterism.len))[0..]); const is_zodiac: u8 = if (constellation.is_zodiac) 1 else 0; try const_out_writer.writeAll(std.mem.toBytes(is_zodiac)[0..]); } for (constellations) |constellation| { for (constellation.boundaries) |boundary_coord| { try const_out_writer.writeAll(std.mem.toBytes(boundary_coord)[0..]); } } for (constellations) |constellation| { for (constellation.asterism) |asterism_coord| { try const_out_writer.writeAll(std.mem.toBytes(asterism_coord)[0..]); } } try const_out_buffered_writer.flush(); } fn shuffleStars(stars: []Star) void { const timer = std.time.Timer.start() catch unreachable; var rand = std.rand.DefaultPrng.init(timer.read()); const fold_range_size = stars.len / 6; const fold_low_start = rand.random.intRangeAtMost(usize, 0, stars.len / 2); const fold_high_start = rand.random.intRangeAtMost(usize, stars.len / 2, stars.len - fold_range_size); var fold_index: usize = 0; while (fold_index <= fold_range_size) : (fold_index += 1) { const fold_low_index = fold_low_start + fold_index; const fold_high_index = fold_high_start + fold_index; std.mem.swap(Star, &stars[fold_low_index], &stars[fold_high_index]); } var low_index: usize = 0; var high_index: usize = stars.len - 1; while (low_index < high_index) : ({ low_index += 1; high_index -= 1; }) { const low_bias: isize = rand.random.intRangeLessThan(isize, -5, 5); const high_bias: isize = rand.random.intRangeLessThan(isize, -5, 5); const low_swap_index = if (@intCast(isize, low_index) + low_bias < 0) low_index else @intCast(usize, @intCast(isize, low_index) + low_bias); const high_swap_index = if (@intCast(isize, high_index) + high_bias >= stars.len) high_index else @intCast(usize, @intCast(isize, high_index) + high_bias); std.mem.swap(Star, &stars[low_swap_index], &stars[high_swap_index]); } }
prepare-data/src/main.zig
const std = @import("../std.zig"); const os = std.os; const testing = std.testing; const expect = std.testing.expect; const io = std.io; const fs = std.fs; const mem = std.mem; const elf = std.elf; const File = std.fs.File; const Thread = std.Thread; const a = std.debug.global_allocator; const builtin = @import("builtin"); const AtomicRmwOp = builtin.AtomicRmwOp; const AtomicOrder = builtin.AtomicOrder; test "makePath, put some files in it, deleteTree" { try fs.makePath(a, "os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c"); try io.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c" ++ fs.path.sep_str ++ "file.txt", "nonsense"); try io.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "file2.txt", "blah"); try fs.deleteTree("os_test_tmp"); if (fs.cwd().openDirTraverse("os_test_tmp")) |dir| { @panic("expected error"); } else |err| { expect(err == error.FileNotFound); } } test "access file" { try fs.makePath(a, "os_test_tmp"); if (File.access("os_test_tmp" ++ fs.path.sep_str ++ "file.txt")) |ok| { @panic("expected error"); } else |err| { expect(err == error.FileNotFound); } try io.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "file.txt", ""); try os.access("os_test_tmp" ++ fs.path.sep_str ++ "file.txt", os.F_OK); try fs.deleteTree("os_test_tmp"); } fn testThreadIdFn(thread_id: *Thread.Id) void { thread_id.* = Thread.getCurrentId(); } test "std.Thread.getCurrentId" { if (builtin.single_threaded) return error.SkipZigTest; var thread_current_id: Thread.Id = undefined; const thread = try Thread.spawn(&thread_current_id, testThreadIdFn); const thread_id = thread.handle(); thread.wait(); if (Thread.use_pthreads) { expect(thread_current_id == thread_id); } else if (builtin.os == .windows) { expect(Thread.getCurrentId() != thread_current_id); } else { // If the thread completes very quickly, then thread_id can be 0. See the // documentation comments for `std.Thread.handle`. expect(thread_id == 0 or thread_current_id == thread_id); } } test "spawn threads" { if (builtin.single_threaded) return error.SkipZigTest; var shared_ctx: i32 = 1; const thread1 = try Thread.spawn({}, start1); const thread2 = try Thread.spawn(&shared_ctx, start2); const thread3 = try Thread.spawn(&shared_ctx, start2); const thread4 = try Thread.spawn(&shared_ctx, start2); thread1.wait(); thread2.wait(); thread3.wait(); thread4.wait(); expect(shared_ctx == 4); } fn start1(ctx: void) u8 { return 0; } fn start2(ctx: *i32) u8 { _ = @atomicRmw(i32, ctx, AtomicRmwOp.Add, 1, AtomicOrder.SeqCst); return 0; } test "cpu count" { const cpu_count = try Thread.cpuCount(); expect(cpu_count >= 1); } test "AtomicFile" { var buffer: [1024]u8 = undefined; const allocator = &std.heap.FixedBufferAllocator.init(buffer[0..]).allocator; const test_out_file = "tmp_atomic_file_test_dest.txt"; const test_content = \\ hello! \\ this is a test file ; { var af = try fs.AtomicFile.init(test_out_file, File.default_mode); defer af.deinit(); try af.file.write(test_content); try af.finish(); } const content = try io.readFileAlloc(allocator, test_out_file); expect(mem.eql(u8, content, test_content)); try fs.cwd().deleteFile(test_out_file); } test "thread local storage" { if (builtin.single_threaded) return error.SkipZigTest; const thread1 = try Thread.spawn({}, testTls); const thread2 = try Thread.spawn({}, testTls); testTls({}); thread1.wait(); thread2.wait(); } threadlocal var x: i32 = 1234; fn testTls(context: void) void { if (x != 1234) @panic("bad start value"); x += 1; if (x != 1235) @panic("bad end value"); } test "getrandom" { var buf_a: [50]u8 = undefined; var buf_b: [50]u8 = undefined; try os.getrandom(&buf_a); try os.getrandom(&buf_b); // If this test fails the chance is significantly higher that there is a bug than // that two sets of 50 bytes were equal. expect(!mem.eql(u8, &buf_a, &buf_b)); } test "getcwd" { // at least call it so it gets compiled var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; _ = os.getcwd(&buf) catch undefined; } test "realpath" { var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; testing.expectError(error.FileNotFound, fs.realpath("definitely_bogus_does_not_exist1234", &buf)); } test "sigaltstack" { if (builtin.os == .windows or builtin.os == .wasi) return error.SkipZigTest; var st: os.stack_t = undefined; try os.sigaltstack(null, &st); // Setting a stack size less than MINSIGSTKSZ returns ENOMEM st.ss_flags = 0; st.ss_size = 1; testing.expectError(error.SizeTooSmall, os.sigaltstack(&st, null)); } // If the type is not available use void to avoid erroring out when `iter_fn` is // analyzed const dl_phdr_info = if (@hasDecl(os, "dl_phdr_info")) os.dl_phdr_info else c_void; fn iter_fn(info: *dl_phdr_info, size: usize, data: ?*usize) callconv(.C) i32 { if (builtin.os == .windows or builtin.os == .wasi or builtin.os == .macosx) return 0; var counter = data.?; // Count how many libraries are loaded counter.* += @as(usize, 1); // The image should contain at least a PT_LOAD segment if (info.dlpi_phnum < 1) return -1; // Quick & dirty validation of the phdr pointers, make sure we're not // pointing to some random gibberish var i: usize = 0; var found_load = false; while (i < info.dlpi_phnum) : (i += 1) { const phdr = info.dlpi_phdr[i]; if (phdr.p_type != elf.PT_LOAD) continue; // Find the ELF header const elf_header = @intToPtr(*elf.Ehdr, phdr.p_vaddr - phdr.p_offset); // Validate the magic if (!mem.eql(u8, elf_header.e_ident[0..4], "\x7fELF")) return -1; // Consistency check if (elf_header.e_phnum != info.dlpi_phnum) return -1; found_load = true; break; } if (!found_load) return -1; return 42; } test "dl_iterate_phdr" { if (builtin.os == .windows or builtin.os == .wasi or builtin.os == .macosx) return error.SkipZigTest; var counter: usize = 0; expect(os.dl_iterate_phdr(usize, iter_fn, &counter) != 0); expect(counter != 0); } test "gethostname" { if (builtin.os == .windows) return error.SkipZigTest; var buf: [os.HOST_NAME_MAX]u8 = undefined; const hostname = try os.gethostname(&buf); expect(hostname.len != 0); } test "pipe" { if (builtin.os == .windows) return error.SkipZigTest; var fds = try os.pipe(); try os.write(fds[1], "hello"); var buf: [16]u8 = undefined; expect((try os.read(fds[0], buf[0..])) == 5); testing.expectEqualSlices(u8, buf[0..5], "hello"); os.close(fds[1]); os.close(fds[0]); } test "argsAlloc" { var args = try std.process.argsAlloc(std.heap.page_allocator); std.process.argsFree(std.heap.page_allocator, args); } test "memfd_create" { // memfd_create is linux specific. if (builtin.os != .linux) return error.SkipZigTest; const fd = std.os.memfd_create("test", 0) catch |err| switch (err) { // Related: https://github.com/ziglang/zig/issues/4019 error.SystemOutdated => return error.SkipZigTest, else => |e| return e, }; defer std.os.close(fd); try std.os.write(fd, "test"); try std.os.lseek_SET(fd, 0); var buf: [10]u8 = undefined; const bytes_read = try std.os.read(fd, &buf); expect(bytes_read == 4); expect(mem.eql(u8, buf[0..4], "test")); }
lib/std/os/test.zig
const std = @import("std"); const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const builtin = @import("builtin"); test "compile time recursion" { expect(some_data.len == 21); } var some_data: [@intCast(usize, fibonacci(7))]u8 = undefined; fn fibonacci(x: i32) i32 { if (x <= 1) return 1; return fibonacci(x - 1) + fibonacci(x - 2); } fn unwrapAndAddOne(blah: ?i32) i32 { return blah.? + 1; } const should_be_1235 = unwrapAndAddOne(1234); test "static add one" { expect(should_be_1235 == 1235); } test "inlined loop" { comptime var i = 0; comptime var sum = 0; inline while (i <= 5) : (i += 1) sum += i; expect(sum == 15); } fn gimme1or2(comptime a: bool) i32 { const x: i32 = 1; const y: i32 = 2; comptime var z: i32 = if (a) x else y; return z; } test "inline variable gets result of const if" { expect(gimme1or2(true) == 1); expect(gimme1or2(false) == 2); } test "static function evaluation" { expect(statically_added_number == 3); } const statically_added_number = staticAdd(1, 2); fn staticAdd(a: i32, b: i32) i32 { return a + b; } test "const expr eval on single expr blocks" { expect(constExprEvalOnSingleExprBlocksFn(1, true) == 3); comptime expect(constExprEvalOnSingleExprBlocksFn(1, true) == 3); } fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) i32 { const literal = 3; const result = if (b) b: { break :b literal; } else b: { break :b x; }; return result; } test "statically initialized list" { expect(static_point_list[0].x == 1); expect(static_point_list[0].y == 2); expect(static_point_list[1].x == 3); expect(static_point_list[1].y == 4); } const Point = struct { x: i32, y: i32, }; const static_point_list = [_]Point{ makePoint(1, 2), makePoint(3, 4), }; fn makePoint(x: i32, y: i32) Point { return Point{ .x = x, .y = y, }; } test "static eval list init" { expect(static_vec3.data[2] == 1.0); expect(vec3(0.0, 0.0, 3.0).data[2] == 3.0); } const static_vec3 = vec3(0.0, 0.0, 1.0); pub const Vec3 = struct { data: [3]f32, }; pub fn vec3(x: f32, y: f32, z: f32) Vec3 { return Vec3{ .data = [_]f32{ x, y, z, }, }; } test "constant expressions" { var array: [array_size]u8 = undefined; expect(@sizeOf(@typeOf(array)) == 20); } const array_size: u8 = 20; test "constant struct with negation" { expect(vertices[0].x == -0.6); } const Vertex = struct { x: f32, y: f32, r: f32, g: f32, b: f32, }; const vertices = [_]Vertex{ Vertex{ .x = -0.6, .y = -0.4, .r = 1.0, .g = 0.0, .b = 0.0, }, Vertex{ .x = 0.6, .y = -0.4, .r = 0.0, .g = 1.0, .b = 0.0, }, Vertex{ .x = 0.0, .y = 0.6, .r = 0.0, .g = 0.0, .b = 1.0, }, }; test "statically initialized struct" { st_init_str_foo.x += 1; expect(st_init_str_foo.x == 14); } const StInitStrFoo = struct { x: i32, y: bool, }; var st_init_str_foo = StInitStrFoo{ .x = 13, .y = true, }; test "statically initalized array literal" { const y: [4]u8 = st_init_arr_lit_x; expect(y[3] == 4); } const st_init_arr_lit_x = [_]u8{ 1, 2, 3, 4, }; test "const slice" { comptime { const a = "1234567890"; expect(a.len == 10); const b = a[1..2]; expect(b.len == 1); expect(b[0] == '2'); } } test "try to trick eval with runtime if" { expect(testTryToTrickEvalWithRuntimeIf(true) == 10); } fn testTryToTrickEvalWithRuntimeIf(b: bool) usize { comptime var i: usize = 0; inline while (i < 10) : (i += 1) { const result = if (b) false else true; } comptime { return i; } } test "inlined loop has array literal with elided runtime scope on first iteration but not second iteration" { var runtime = [1]i32{3}; comptime var i: usize = 0; inline while (i < 2) : (i += 1) { const result = if (i == 0) [1]i32{2} else runtime; } comptime { expect(i == 2); } } fn max(comptime T: type, a: T, b: T) T { if (T == bool) { return a or b; } else if (a > b) { return a; } else { return b; } } fn letsTryToCompareBools(a: bool, b: bool) bool { return max(bool, a, b); } test "inlined block and runtime block phi" { expect(letsTryToCompareBools(true, true)); expect(letsTryToCompareBools(true, false)); expect(letsTryToCompareBools(false, true)); expect(!letsTryToCompareBools(false, false)); comptime { expect(letsTryToCompareBools(true, true)); expect(letsTryToCompareBools(true, false)); expect(letsTryToCompareBools(false, true)); expect(!letsTryToCompareBools(false, false)); } } const CmdFn = struct { name: []const u8, func: fn (i32) i32, }; const cmd_fns = [_]CmdFn{ CmdFn{ .name = "one", .func = one, }, CmdFn{ .name = "two", .func = two, }, CmdFn{ .name = "three", .func = three, }, }; fn one(value: i32) i32 { return value + 1; } fn two(value: i32) i32 { return value + 2; } fn three(value: i32) i32 { return value + 3; } fn performFn(comptime prefix_char: u8, start_value: i32) i32 { var result: i32 = start_value; comptime var i = 0; inline while (i < cmd_fns.len) : (i += 1) { if (cmd_fns[i].name[0] == prefix_char) { result = cmd_fns[i].func(result); } } return result; } test "comptime iterate over fn ptr list" { expect(performFn('t', 1) == 6); expect(performFn('o', 0) == 1); expect(performFn('w', 99) == 99); } test "eval @setRuntimeSafety at compile-time" { const result = comptime fnWithSetRuntimeSafety(); expect(result == 1234); } fn fnWithSetRuntimeSafety() i32 { @setRuntimeSafety(true); return 1234; } test "eval @setFloatMode at compile-time" { const result = comptime fnWithFloatMode(); expect(result == 1234.0); } fn fnWithFloatMode() f32 { @setFloatMode(builtin.FloatMode.Strict); return 1234.0; } const SimpleStruct = struct { field: i32, fn method(self: *const SimpleStruct) i32 { return self.field + 3; } }; var simple_struct = SimpleStruct{ .field = 1234 }; const bound_fn = simple_struct.method; test "call method on bound fn referring to var instance" { expect(bound_fn() == 1237); } test "ptr to local array argument at comptime" { comptime { var bytes: [10]u8 = undefined; modifySomeBytes(bytes[0..]); expect(bytes[0] == 'a'); expect(bytes[9] == 'b'); } } fn modifySomeBytes(bytes: []u8) void { bytes[0] = 'a'; bytes[9] = 'b'; } test "comparisons 0 <= uint and 0 > uint should be comptime" { testCompTimeUIntComparisons(1234); } fn testCompTimeUIntComparisons(x: u32) void { if (!(0 <= x)) { @compileError("this condition should be comptime known"); } if (0 > x) { @compileError("this condition should be comptime known"); } if (!(x >= 0)) { @compileError("this condition should be comptime known"); } if (x < 0) { @compileError("this condition should be comptime known"); } } test "const ptr to variable data changes at runtime" { expect(foo_ref.name[0] == 'a'); foo_ref.name = "b"; expect(foo_ref.name[0] == 'b'); } const Foo = struct { name: []const u8, }; var foo_contents = Foo{ .name = "a" }; const foo_ref = &foo_contents; test "create global array with for loop" { expect(global_array[5] == 5 * 5); expect(global_array[9] == 9 * 9); } const global_array = x: { var result: [10]usize = undefined; for (result) |*item, index| { item.* = index * index; } break :x result; }; test "compile-time downcast when the bits fit" { comptime { const spartan_count: u16 = 255; const byte = @intCast(u8, spartan_count); expect(byte == 255); } } const hi1 = "hi"; const hi2 = hi1; test "const global shares pointer with other same one" { assertEqualPtrs(&hi1[0], &hi2[0]); comptime expect(&hi1[0] == &hi2[0]); } fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) void { expect(ptr1 == ptr2); } test "@setEvalBranchQuota" { comptime { // 1001 for the loop and then 1 more for the expect fn call @setEvalBranchQuota(1002); var i = 0; var sum = 0; while (i < 1001) : (i += 1) { sum += i; } expect(sum == 500500); } } test "float literal at compile time not lossy" { expect(16777216.0 + 1.0 == 16777217.0); expect(9007199254740992.0 + 1.0 == 9007199254740993.0); } test "f32 at compile time is lossy" { expect(@as(f32, 1 << 24) + 1 == 1 << 24); } test "f64 at compile time is lossy" { expect(@as(f64, 1 << 53) + 1 == 1 << 53); } test "f128 at compile time is lossy" { expect(@as(f128, 10384593717069655257060992658440192.0) + 1 == 10384593717069655257060992658440192.0); } comptime { expect(@as(f128, 1 << 113) == 10384593717069655257060992658440192); } pub fn TypeWithCompTimeSlice(comptime field_name: []const u8) type { return struct { pub const Node = struct {}; }; } test "string literal used as comptime slice is memoized" { const a = "link"; const b = "link"; comptime expect(TypeWithCompTimeSlice(a).Node == TypeWithCompTimeSlice(b).Node); comptime expect(TypeWithCompTimeSlice("link").Node == TypeWithCompTimeSlice("link").Node); } test "comptime slice of undefined pointer of length 0" { const slice1 = @as([*]i32, undefined)[0..0]; expect(slice1.len == 0); const slice2 = @as([*]i32, undefined)[100..100]; expect(slice2.len == 0); } fn copyWithPartialInline(s: []u32, b: []u8) void { comptime var i: usize = 0; inline while (i < 4) : (i += 1) { s[i] = 0; s[i] |= @as(u32, b[i * 4 + 0]) << 24; s[i] |= @as(u32, b[i * 4 + 1]) << 16; s[i] |= @as(u32, b[i * 4 + 2]) << 8; s[i] |= @as(u32, b[i * 4 + 3]) << 0; } } test "binary math operator in partially inlined function" { var s: [4]u32 = undefined; var b: [16]u8 = undefined; for (b) |*r, i| r.* = @intCast(u8, i + 1); copyWithPartialInline(s[0..], b[0..]); expect(s[0] == 0x1020304); expect(s[1] == 0x5060708); expect(s[2] == 0x90a0b0c); expect(s[3] == 0xd0e0f10); } test "comptime function with the same args is memoized" { comptime { expect(MakeType(i32) == MakeType(i32)); expect(MakeType(i32) != MakeType(f64)); } } fn MakeType(comptime T: type) type { return struct { field: T, }; } test "comptime function with mutable pointer is not memoized" { comptime { var x: i32 = 1; const ptr = &x; increment(ptr); increment(ptr); expect(x == 3); } } fn increment(value: *i32) void { value.* += 1; } fn generateTable(comptime T: type) [1010]T { var res: [1010]T = undefined; var i: usize = 0; while (i < 1010) : (i += 1) { res[i] = @intCast(T, i); } return res; } fn doesAlotT(comptime T: type, value: usize) T { @setEvalBranchQuota(5000); const table = comptime blk: { break :blk generateTable(T); }; return table[value]; } test "@setEvalBranchQuota at same scope as generic function call" { expect(doesAlotT(u32, 2) == 2); } test "comptime slice of slice preserves comptime var" { comptime { var buff: [10]u8 = undefined; buff[0..][0..][0] = 1; expect(buff[0..][0..][0] == 1); } } test "comptime slice of pointer preserves comptime var" { comptime { var buff: [10]u8 = undefined; var a = buff[0..].ptr; a[0..1][0] = 1; expect(buff[0..][0..][0] == 1); } } const SingleFieldStruct = struct { x: i32, fn read_x(self: *const SingleFieldStruct) i32 { return self.x; } }; test "const ptr to comptime mutable data is not memoized" { comptime { var foo = SingleFieldStruct{ .x = 1 }; expect(foo.read_x() == 1); foo.x = 2; expect(foo.read_x() == 2); } } test "array concat of slices gives slice" { comptime { var a: []const u8 = "aoeu"; var b: []const u8 = "asdf"; const c = a ++ b; expect(std.mem.eql(u8, c, "aoeuasdf")); } } test "comptime shlWithOverflow" { const ct_shifted: u64 = comptime amt: { var amt = @as(u64, 0); _ = @shlWithOverflow(u64, ~@as(u64, 0), 16, &amt); break :amt amt; }; const rt_shifted: u64 = amt: { var amt = @as(u64, 0); _ = @shlWithOverflow(u64, ~@as(u64, 0), 16, &amt); break :amt amt; }; expect(ct_shifted == rt_shifted); } test "runtime 128 bit integer division" { var a: u128 = 152313999999999991610955792383; var b: u128 = 10000000000000000000; var c = a / b; expect(c == 15231399999); } pub const Info = struct { version: u8, }; pub const diamond_info = Info{ .version = 0 }; test "comptime modification of const struct field" { comptime { var res = diamond_info; res.version = 1; expect(diamond_info.version == 0); expect(res.version == 1); } } test "pointer to type" { comptime { var T: type = i32; expect(T == i32); var ptr = &T; expect(@typeOf(ptr) == *type); ptr.* = f32; expect(T == f32); expect(*T == *f32); } } test "slice of type" { comptime { var types_array = [_]type{ i32, f64, type }; for (types_array) |T, i| { switch (i) { 0 => expect(T == i32), 1 => expect(T == f64), 2 => expect(T == type), else => unreachable, } } for (types_array[0..]) |T, i| { switch (i) { 0 => expect(T == i32), 1 => expect(T == f64), 2 => expect(T == type), else => unreachable, } } } } const Wrapper = struct { T: type, }; fn wrap(comptime T: type) Wrapper { return Wrapper{ .T = T }; } test "function which returns struct with type field causes implicit comptime" { const ty = wrap(i32).T; expect(ty == i32); } test "call method with comptime pass-by-non-copying-value self parameter" { const S = struct { a: u8, fn b(comptime s: @This()) u8 { return s.a; } }; const s = S{ .a = 2 }; var b = s.b(); expect(b == 2); } test "@tagName of @typeId" { const str = @tagName(@typeId(u8)); expect(std.mem.eql(u8, str, "Int")); } test "setting backward branch quota just before a generic fn call" { @setEvalBranchQuota(1001); loopNTimes(1001); } fn loopNTimes(comptime n: usize) void { comptime var i = 0; inline while (i < n) : (i += 1) {} } test "variable inside inline loop that has different types on different iterations" { testVarInsideInlineLoop(true, @as(u32, 42)); } fn testVarInsideInlineLoop(args: ...) void { comptime var i = 0; inline while (i < args.len) : (i += 1) { const x = args[i]; if (i == 0) expect(x); if (i == 1) expect(x == 42); } } test "inline for with same type but different values" { var res: usize = 0; inline for ([_]type{ [2]u8, [1]u8, [2]u8 }) |T| { var a: T = undefined; res += a.len; } expect(res == 5); } test "refer to the type of a generic function" { const Func = fn (type) void; const f: Func = doNothingWithType; f(i32); } fn doNothingWithType(comptime T: type) void {} test "zero extend from u0 to u1" { var zero_u0: u0 = 0; var zero_u1: u1 = zero_u0; expect(zero_u1 == 0); } test "bit shift a u1" { var x: u1 = 1; var y = x << 0; expect(y == 1); } test "@bytesToslice on a packed struct" { const F = packed struct { a: u8, }; var b = [1]u8{9}; var f = @bytesToSlice(F, &b); expect(f[0].a == 9); } test "comptime pointer cast array and then slice" { const array = [_]u8{ 1, 2, 3, 4, 5, 6, 7, 8 }; const ptrA: [*]const u8 = @ptrCast([*]const u8, &array); const sliceA: []const u8 = ptrA[0..2]; const ptrB: [*]const u8 = &array; const sliceB: []const u8 = ptrB[0..2]; expect(sliceA[1] == 2); expect(sliceB[1] == 2); } test "slice bounds in comptime concatenation" { const bs = comptime blk: { const b = "........1........"; break :blk b[8..9]; }; const str = "" ++ bs; expect(str.len == 1); expect(std.mem.eql(u8, str, "1")); const str2 = bs ++ ""; expect(str2.len == 1); expect(std.mem.eql(u8, str2, "1")); } test "comptime bitwise operators" { comptime { expect(3 & 1 == 1); expect(3 & -1 == 3); expect(-3 & -1 == -3); expect(3 | -1 == -1); expect(-3 | -1 == -1); expect(3 ^ -1 == -4); expect(-3 ^ -1 == 2); expect(~@as(i8, -1) == 0); expect(~@as(i128, -1) == 0); expect(18446744073709551615 & 18446744073709551611 == 18446744073709551611); expect(-18446744073709551615 & -18446744073709551611 == -18446744073709551615); expect(~@as(u128, 0) == 0xffffffffffffffffffffffffffffffff); } } test "*align(1) u16 is the same as *align(1:0:2) u16" { comptime { expect(*align(1:0:2) u16 == *align(1) u16); expect(*align(:0:2) u16 == *u16); } } test "array concatenation forces comptime" { var a = oneItem(3) ++ oneItem(4); expect(std.mem.eql(i32, &a, &[_]i32{ 3, 4 })); } test "array multiplication forces comptime" { var a = oneItem(3) ** scalar(2); expect(std.mem.eql(i32, &a, &[_]i32{ 3, 3 })); } fn oneItem(x: i32) [1]i32 { return [_]i32{x}; } fn scalar(x: u32) u32 { return x; } test "no undeclared identifier error in unanalyzed branches" { if (false) { lol_this_doesnt_exist = nonsense; } } test "comptime assign int to optional int" { comptime { var x: ?i32 = null; x = 2; x.? *= 10; expectEqual(20, x.?); } }
test/stage1/behavior/eval.zig
const std = @import("std"); const raw = struct { extern fn zig_log_message(level: c_int, msg: [*:0]const u8) void; extern fn printk(msg: [*:0]const u8, data: u8) void; extern fn uptime_ticks() i64; }; // Get the uptime in ticks. pub fn uptime() i64 { return raw.uptime_ticks(); } // A single shared buffer for log messages. This will need to be // locked if we become multi-threaded. var buffer: [256]u8 = undefined; // Use: `pub const log = zephyr.log;` in the root of the project to enable // Zig logging to output to the console in Zephyr. // `pub const log_level: std.log.Level = .info;` to set the logging // level at compile time. pub fn log( comptime level: std.log.Level, comptime scope: @TypeOf(.EnumLiteral), comptime format: []const u8, args: anytype, ) void { _ = scope; // const prefix = "[" ++ level.asText() ++ "] "; const msg = std.fmt.bufPrintZ(&buffer, format, args) catch return; raw.zig_log_message(@enumToInt(level), msg); // std.fmt.format(Writer{ .context = &CharWriter{} }, prefix ++ format ++ "\n", args) catch return; } // A regular print function. pub fn println( comptime format: []const u8, args: anytype, ) void { std.fmt.format(Writer{ .context = &CharWriter{} }, format ++ "\n", args) catch return; } // A regular print function. pub fn print( comptime format: []const u8, args: anytype, ) void { std.fmt.format(Writer{ .context = &CharWriter{} }, format, args) catch return; } // Newlib's putchar is simple, but adds about 4k to the size of the // image, so we are probably better of more slowly outputting a // character at a time through printk. Even better would be to add // just a putchar equivalent to Zephyr. const Writer = std.io.Writer(*const CharWriter, WriteError, outwrite); const WriteError = error{WriteError}; const Context = void; // To make this work, we need to buffer a message until we're done, // then we can send it to the Zephyr logging subsystem. fn outwrite(_: *const CharWriter, bytes: []const u8) WriteError!usize { // zig_log_message(bytes); // printk("chunk: %d bytes\n", @intCast(u8, bytes.len)); for (bytes) |byte| { // _ = putchar(byte); raw.printk("%c", byte); } return bytes.len; } const CharWriter = struct {};
zephyr.zig
const std = @import("std"); const upaya = @import("upaya.zig"); /// reads the contents of a file. Returned value is owned by the caller and must be freed! pub fn read(allocator: *std.mem.Allocator, filename: []const u8) ![]u8 { const file = try std.fs.cwd().openFile(filename, .{}); defer file.close(); const file_size = try file.getEndPos(); var buffer = try upaya.mem.allocator.alloc(u8, file_size); const bytes_read = try file.read(buffer[0..buffer.len]); return buffer; } pub fn write(filename: []const u8, data: []u8) !void { const file = try std.fs.cwd().openFile(filename, .{ .write = true }); defer file.close(); const file_size = try file.getEndPos(); try file.writeAll(data); } /// gets a path to `filename` in the save games directory pub fn getSaveGamesFile(app: []const u8, filename: []const u8) ![]u8 { const dir = try std.fs.getAppDataDir(upaya.mem.tmp_allocator, app); try std.fs.cwd().makePath(dir); return try std.fs.path.join(upaya.mem.tmp_allocator, &[_][]const u8{ dir, filename }); } /// saves a serializable struct to disk pub fn savePrefs(app: []const u8, filename: []const u8, data: anytype) !void { const file = try getSaveGamesFile(app, filename); var handle = try std.fs.cwd().createFile(file, .{}); defer handle.close(); var serializer = std.io.serializer(.Little, .Byte, handle.writer()); try serializer.serialize(data); } pub fn readPrefs(comptime T: type, app: []const u8, filename: []const u8) !T { const file = try getSaveGamesFile(app, filename); var handle = try std.fs.cwd().openFile(file, .{}); defer handle.close(); var deserializer = std.io.deserializer(.Little, .Byte, handle.reader()); return deserializer.deserialize(T); } pub fn savePrefsJson(app: []const u8, filename: []const u8, data: anytype) !void { const file = try getSaveGamesFile(app, filename); var handle = try std.fs.cwd().createFile(file, .{}); defer handle.close(); try std.json.stringify(data, .{ .whitespace = .{} }, handle.writer()); } pub fn readPrefsJson(comptime T: type, app: []const u8, filename: []const u8) !T { const file = try getSaveGamesFile(app, filename); var bytes = try upaya.fs.read(upaya.mem.tmp_allocator, file); var tokens = std.json.TokenStream.init(bytes); const options = std.json.ParseOptions{ .allocator = upaya.mem.allocator }; return try std.json.parse(T, &tokens, options); } /// for prefs loaded with `readPrefsJson` that have allocated fields, this must be called to free them pub fn freePrefsJson(data: anytype) void { const options = std.json.ParseOptions{ .allocator = upaya.mem.allocator }; std.json.parseFree(@TypeOf(data), data, options); } test "test fs read" { upaya.mem.initTmpAllocator(); std.testing.expectError(error.FileNotFound, read(std.testing.allocator, "junk.png")); // var bytes = try read(std.testing.allocator, "src/assets/fa-solid-900.ttf"); // std.testing.allocator.free(bytes); }
src/fs.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/day13.txt"); const edata = \\6,10 \\0,14 \\9,10 \\0,3 \\10,4 \\4,11 \\6,0 \\6,12 \\4,1 \\0,13 \\10,12 \\3,4 \\3,0 \\8,4 \\1,10 \\2,14 \\8,10 \\9,0 \\ \\fold along y=7 \\fold along x=5 ; const Point = struct { x: usize, y: usize, }; const Fold = struct { axis: Axis, offset: usize, const Axis = enum { x, y, }; }; const Input = struct { points: []Point, folds: []Fold, }; fn foldPoints(points: []Point, fold: Fold) void { for (points) |*point| { switch (fold.axis) { .x => { if (point.x > fold.offset) { point.x = fold.offset - (point.x - fold.offset); } }, .y => { if (point.y > fold.offset) { point.y = fold.offset - (point.y - fold.offset); } }, } } } fn printPoints(points: []Point) void { for (points) |point| { print("{},{}\n", .{point.x, point.y}); } } fn pointBounds(points: []Point) Point { var max_x: usize = 0; var max_y: usize = 0; for (points) |point| { max_x = max(max_x, point.x); max_y = max(max_y, point.y); } return Point{.x=max_x, .y=max_y}; } fn displayPoints(points: []Point) void { const bounds = pointBounds(points); var y: usize = 0; while (y <= bounds.y) : (y += 1) { var x: usize = 0; while (x <= bounds.x) : (x+=1) { for (points) |point| { if (point.x == x and point.y == y) { print("#",.{}); break; } } else { print(" ", .{}); } } print("\n",.{}); } } fn pointLessThan(_: void, a: Point, b: Point) bool { if (a.x < b.x) return true; if (a.x > b.x) return false; if (a.y < b.y) return true; return false; } pub fn main() !void { var input: Input = blk: { var point_list = List(Point).init(gpa); var fold_list = List(Fold).init(gpa); var sections = split(u8, data, "\n\n"); const fst = sections.next().?; const snd = sections.next().?; var fst_iter = tokenize(u8, fst, "\n"); while (fst_iter.next()) |line| { var iter = split(u8, line, ","); const x = try parseInt(usize, iter.next().?, 10); const y = try parseInt(usize, iter.next().?, 10); try point_list.append(Point{.x=x, .y=y}); } var snd_iter = tokenize(u8, snd, "\n"); while (snd_iter.next()) |line| { var iter = tokenize(u8, line, "fold along="); const axis: Fold.Axis = switch(iter.next().?[0]) { 'x' => .x, 'y' => .y, else => unreachable, }; const offset: usize = try parseInt(usize, iter.next().?, 10); try fold_list.append(Fold{.axis = axis, .offset=offset}); } break :blk Input{.points = point_list.toOwnedSlice(), .folds = fold_list.toOwnedSlice()}; }; const part1 = blk: { foldPoints(input.points, input.folds[0]); sort(Point, input.points, {}, pointLessThan); var point_map = std.AutoArrayHashMap(Point, bool).init(gpa); defer point_map.deinit(); for (input.points) |point| { try point_map.put(point, true); } break :blk point_map.count(); }; print("{}\n", .{part1}); { for (input.folds[1..input.folds.len]) |fold| { foldPoints(input.points, fold); } sort(Point, input.points, {}, pointLessThan); var point_map = std.AutoArrayHashMap(Point, bool).init(gpa); defer point_map.deinit(); for (input.points) |point| { try point_map.put(point, true); } displayPoints(input.points); } } // 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/day13.zig
pub const CTL_E_ILLEGALFUNCTIONCALL = @as(i32, -2146828283); pub const CONNECT_E_FIRST = @as(i32, -2147220992); pub const SELFREG_E_FIRST = @as(i32, -2147220992); pub const PERPROP_E_FIRST = @as(i32, -2147220992); pub const OLECMDERR_E_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221248)); pub const OLECMDERR_E_DISABLED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221247)); pub const OLECMDERR_E_NOHELP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221246)); pub const OLECMDERR_E_CANCELED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221245)); pub const OLECMDERR_E_UNKNOWNGROUP = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147221244)); pub const CONNECT_E_NOCONNECTION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const CONNECT_E_ADVISELIMIT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220991)); pub const CONNECT_E_CANNOTCONNECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220990)); pub const CONNECT_E_OVERRIDDEN = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220989)); pub const SELFREG_E_TYPELIB = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const SELFREG_E_CLASS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220991)); pub const PERPROP_E_NOPAGEAVAILABLE = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220992)); pub const CLSID_CFontPropPage = Guid.initString("0be35200-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_CColorPropPage = Guid.initString("0be35201-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_CPicturePropPage = Guid.initString("0be35202-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_PersistPropset = Guid.initString("fb8f0821-0164-101b-84ed-08002b2ec713"); pub const CLSID_ConvertVBX = Guid.initString("fb8f0822-0164-101b-84ed-08002b2ec713"); pub const CLSID_StdFont = Guid.initString("0be35203-8f91-11ce-9de3-00aa004bb851"); pub const CLSID_StdPicture = Guid.initString("0be35204-8f91-11ce-9de3-00aa004bb851"); pub const GUID_HIMETRIC = Guid.initString("66504300-be0f-101a-8bbb-00aa00300cab"); pub const GUID_COLOR = Guid.initString("66504301-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XPOSPIXEL = Guid.initString("66504302-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YPOSPIXEL = Guid.initString("66504303-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XSIZEPIXEL = Guid.initString("66504304-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YSIZEPIXEL = Guid.initString("66504305-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XPOS = Guid.initString("66504306-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YPOS = Guid.initString("66504307-be0f-101a-8bbb-00aa00300cab"); pub const GUID_XSIZE = Guid.initString("66504308-be0f-101a-8bbb-00aa00300cab"); pub const GUID_YSIZE = Guid.initString("66504309-be0f-101a-8bbb-00aa00300cab"); pub const GUID_TRISTATE = Guid.initString("6650430a-be0f-101a-8bbb-00aa00300cab"); pub const GUID_OPTIONVALUEEXCLUSIVE = Guid.initString("6650430b-be0f-101a-8bbb-00aa00300cab"); pub const GUID_CHECKVALUEEXCLUSIVE = Guid.initString("6650430c-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTNAME = Guid.initString("6650430d-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTSIZE = Guid.initString("6650430e-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTBOLD = Guid.initString("6650430f-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTITALIC = Guid.initString("66504310-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTUNDERSCORE = Guid.initString("66504311-be0f-101a-8bbb-00aa00300cab"); pub const GUID_FONTSTRIKETHROUGH = Guid.initString("66504312-be0f-101a-8bbb-00aa00300cab"); pub const GUID_HANDLE = Guid.initString("66504313-be0f-101a-8bbb-00aa00300cab"); pub const PICTYPE_UNINITIALIZED = @as(i32, -1); pub const PICTYPE_NONE = @as(u32, 0); pub const PICTYPE_BITMAP = @as(u32, 1); pub const PICTYPE_METAFILE = @as(u32, 2); pub const PICTYPE_ICON = @as(u32, 3); pub const PICTYPE_ENHMETAFILE = @as(u32, 4); pub const CONNECT_E_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220977)); pub const CONNECT_S_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262656)); pub const CONNECT_S_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262671)); pub const SELFREG_E_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220977)); pub const SELFREG_S_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262656)); pub const SELFREG_S_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262671)); pub const PERPROP_E_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147220977)); pub const PERPROP_S_FIRST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262656)); pub const PERPROP_S_LAST = @import("../zig.zig").typedConst(HRESULT, @as(i32, 262671)); pub const OLEIVERB_PROPERTIES = @as(i32, -7); pub const VT_STREAMED_PROPSET = @as(u32, 73); pub const VT_STORED_PROPSET = @as(u32, 74); pub const VT_BLOB_PROPSET = @as(u32, 75); pub const VT_VERBOSE_ENUM = @as(u32, 76); pub const OCM__BASE = @as(u32, 8192); pub const LP_DEFAULT = @as(u32, 0); pub const LP_MONOCHROME = @as(u32, 1); pub const LP_VGACOLOR = @as(u32, 2); pub const LP_COLOR = @as(u32, 4); pub const DISPID_AUTOSIZE = @as(i32, -500); pub const DISPID_BACKCOLOR = @as(i32, -501); pub const DISPID_BACKSTYLE = @as(i32, -502); pub const DISPID_BORDERCOLOR = @as(i32, -503); pub const DISPID_BORDERSTYLE = @as(i32, -504); pub const DISPID_BORDERWIDTH = @as(i32, -505); pub const DISPID_DRAWMODE = @as(i32, -507); pub const DISPID_DRAWSTYLE = @as(i32, -508); pub const DISPID_DRAWWIDTH = @as(i32, -509); pub const DISPID_FILLCOLOR = @as(i32, -510); pub const DISPID_FILLSTYLE = @as(i32, -511); pub const DISPID_FONT = @as(i32, -512); pub const DISPID_FORECOLOR = @as(i32, -513); pub const DISPID_ENABLED = @as(i32, -514); pub const DISPID_HWND = @as(i32, -515); pub const DISPID_TABSTOP = @as(i32, -516); pub const DISPID_TEXT = @as(i32, -517); pub const DISPID_CAPTION = @as(i32, -518); pub const DISPID_BORDERVISIBLE = @as(i32, -519); pub const DISPID_APPEARANCE = @as(i32, -520); pub const DISPID_MOUSEPOINTER = @as(i32, -521); pub const DISPID_MOUSEICON = @as(i32, -522); pub const DISPID_PICTURE = @as(i32, -523); pub const DISPID_VALID = @as(i32, -524); pub const DISPID_READYSTATE = @as(i32, -525); pub const DISPID_LISTINDEX = @as(i32, -526); pub const DISPID_SELECTED = @as(i32, -527); pub const DISPID_LIST = @as(i32, -528); pub const DISPID_COLUMN = @as(i32, -529); pub const DISPID_LISTCOUNT = @as(i32, -531); pub const DISPID_MULTISELECT = @as(i32, -532); pub const DISPID_MAXLENGTH = @as(i32, -533); pub const DISPID_PASSWORDCHAR = @as(i32, -534); pub const DISPID_SCROLLBARS = @as(i32, -535); pub const DISPID_WORDWRAP = @as(i32, -536); pub const DISPID_MULTILINE = @as(i32, -537); pub const DISPID_NUMBEROFROWS = @as(i32, -538); pub const DISPID_NUMBEROFCOLUMNS = @as(i32, -539); pub const DISPID_DISPLAYSTYLE = @as(i32, -540); pub const DISPID_GROUPNAME = @as(i32, -541); pub const DISPID_IMEMODE = @as(i32, -542); pub const DISPID_ACCELERATOR = @as(i32, -543); pub const DISPID_ENTERKEYBEHAVIOR = @as(i32, -544); pub const DISPID_TABKEYBEHAVIOR = @as(i32, -545); pub const DISPID_SELTEXT = @as(i32, -546); pub const DISPID_SELSTART = @as(i32, -547); pub const DISPID_SELLENGTH = @as(i32, -548); pub const DISPID_REFRESH = @as(i32, -550); pub const DISPID_DOCLICK = @as(i32, -551); pub const DISPID_ABOUTBOX = @as(i32, -552); pub const DISPID_ADDITEM = @as(i32, -553); pub const DISPID_CLEAR = @as(i32, -554); pub const DISPID_REMOVEITEM = @as(i32, -555); pub const DISPID_CLICK = @as(i32, -600); pub const DISPID_DBLCLICK = @as(i32, -601); pub const DISPID_KEYDOWN = @as(i32, -602); pub const DISPID_KEYPRESS = @as(i32, -603); pub const DISPID_KEYUP = @as(i32, -604); pub const DISPID_MOUSEDOWN = @as(i32, -605); pub const DISPID_MOUSEMOVE = @as(i32, -606); pub const DISPID_MOUSEUP = @as(i32, -607); pub const DISPID_ERROREVENT = @as(i32, -608); pub const DISPID_READYSTATECHANGE = @as(i32, -609); pub const DISPID_CLICK_VALUE = @as(i32, -610); pub const DISPID_RIGHTTOLEFT = @as(i32, -611); pub const DISPID_TOPTOBOTTOM = @as(i32, -612); pub const DISPID_THIS = @as(i32, -613); pub const DISPID_AMBIENT_BACKCOLOR = @as(i32, -701); pub const DISPID_AMBIENT_DISPLAYNAME = @as(i32, -702); pub const DISPID_AMBIENT_FONT = @as(i32, -703); pub const DISPID_AMBIENT_FORECOLOR = @as(i32, -704); pub const DISPID_AMBIENT_LOCALEID = @as(i32, -705); pub const DISPID_AMBIENT_MESSAGEREFLECT = @as(i32, -706); pub const DISPID_AMBIENT_SCALEUNITS = @as(i32, -707); pub const DISPID_AMBIENT_TEXTALIGN = @as(i32, -708); pub const DISPID_AMBIENT_USERMODE = @as(i32, -709); pub const DISPID_AMBIENT_UIDEAD = @as(i32, -710); pub const DISPID_AMBIENT_SHOWGRABHANDLES = @as(i32, -711); pub const DISPID_AMBIENT_SHOWHATCHING = @as(i32, -712); pub const DISPID_AMBIENT_DISPLAYASDEFAULT = @as(i32, -713); pub const DISPID_AMBIENT_SUPPORTSMNEMONICS = @as(i32, -714); pub const DISPID_AMBIENT_AUTOCLIP = @as(i32, -715); pub const DISPID_AMBIENT_APPEARANCE = @as(i32, -716); pub const DISPID_AMBIENT_CODEPAGE = @as(i32, -725); pub const DISPID_AMBIENT_PALETTE = @as(i32, -726); pub const DISPID_AMBIENT_CHARSET = @as(i32, -727); pub const DISPID_AMBIENT_TRANSFERPRIORITY = @as(i32, -728); pub const DISPID_AMBIENT_RIGHTTOLEFT = @as(i32, -732); pub const DISPID_AMBIENT_TOPTOBOTTOM = @as(i32, -733); pub const DISPID_Name = @as(i32, -800); pub const DISPID_Delete = @as(i32, -801); pub const DISPID_Object = @as(i32, -802); pub const DISPID_Parent = @as(i32, -803); pub const DISPID_FONT_NAME = @as(u32, 0); pub const DISPID_FONT_SIZE = @as(u32, 2); pub const DISPID_FONT_BOLD = @as(u32, 3); pub const DISPID_FONT_ITALIC = @as(u32, 4); pub const DISPID_FONT_UNDER = @as(u32, 5); pub const DISPID_FONT_STRIKE = @as(u32, 6); pub const DISPID_FONT_WEIGHT = @as(u32, 7); pub const DISPID_FONT_CHARSET = @as(u32, 8); pub const DISPID_FONT_CHANGED = @as(u32, 9); pub const DISPID_PICT_HANDLE = @as(u32, 0); pub const DISPID_PICT_HPAL = @as(u32, 2); pub const DISPID_PICT_TYPE = @as(u32, 3); pub const DISPID_PICT_WIDTH = @as(u32, 4); pub const DISPID_PICT_HEIGHT = @as(u32, 5); pub const DISPID_PICT_RENDER = @as(u32, 6); pub const GC_WCH_SIBLING = @as(i32, 1); pub const TIFLAGS_EXTENDDISPATCHONLY = @as(u32, 1); pub const OLECMDERR_E_NOTSUPPORTED = @as(i32, -2147221248); pub const MSOCMDERR_E_FIRST = @as(i32, -2147221248); pub const MSOCMDERR_E_NOTSUPPORTED = @as(i32, -2147221248); pub const MSOCMDERR_E_DISABLED = @as(i32, -2147221247); pub const MSOCMDERR_E_NOHELP = @as(i32, -2147221246); pub const MSOCMDERR_E_CANCELED = @as(i32, -2147221245); pub const MSOCMDERR_E_UNKNOWNGROUP = @as(i32, -2147221244); pub const OLECMD_TASKDLGID_ONBEFOREUNLOAD = @as(u32, 1); pub const OLECMDARGINDEX_SHOWPAGEACTIONMENU_HWND = @as(u32, 0); pub const OLECMDARGINDEX_SHOWPAGEACTIONMENU_X = @as(u32, 1); pub const OLECMDARGINDEX_SHOWPAGEACTIONMENU_Y = @as(u32, 2); pub const OLECMDARGINDEX_ACTIVEXINSTALL_PUBLISHER = @as(u32, 0); pub const OLECMDARGINDEX_ACTIVEXINSTALL_DISPLAYNAME = @as(u32, 1); pub const OLECMDARGINDEX_ACTIVEXINSTALL_CLSID = @as(u32, 2); pub const OLECMDARGINDEX_ACTIVEXINSTALL_INSTALLSCOPE = @as(u32, 3); pub const OLECMDARGINDEX_ACTIVEXINSTALL_SOURCEURL = @as(u32, 4); pub const INSTALL_SCOPE_INVALID = @as(u32, 0); pub const INSTALL_SCOPE_MACHINE = @as(u32, 1); pub const INSTALL_SCOPE_USER = @as(u32, 2); pub const MK_ALT = @as(u32, 32); pub const DROPEFFECT_NONE = @as(u32, 0); pub const DROPEFFECT_COPY = @as(u32, 1); pub const DROPEFFECT_MOVE = @as(u32, 2); pub const DROPEFFECT_LINK = @as(u32, 4); pub const DROPEFFECT_SCROLL = @as(u32, 2147483648); pub const DD_DEFSCROLLINSET = @as(u32, 11); pub const DD_DEFSCROLLDELAY = @as(u32, 50); pub const DD_DEFSCROLLINTERVAL = @as(u32, 50); pub const DD_DEFDRAGDELAY = @as(u32, 200); pub const DD_DEFDRAGMINDIST = @as(u32, 2); pub const OT_LINK = @as(i32, 1); pub const OT_EMBEDDED = @as(i32, 2); pub const OT_STATIC = @as(i32, 3); pub const OLEVERB_PRIMARY = @as(u32, 0); pub const OF_SET = @as(u32, 1); pub const OF_GET = @as(u32, 2); pub const OF_HANDLER = @as(u32, 4); pub const WIN32 = @as(u32, 100); pub const OLEIVERB_PRIMARY = @as(i32, 0); pub const OLEIVERB_SHOW = @as(i32, -1); pub const OLEIVERB_OPEN = @as(i32, -2); pub const OLEIVERB_HIDE = @as(i32, -3); pub const OLEIVERB_UIACTIVATE = @as(i32, -4); pub const OLEIVERB_INPLACEACTIVATE = @as(i32, -5); pub const OLEIVERB_DISCARDUNDOSTATE = @as(i32, -6); pub const EMBDHLP_INPROC_HANDLER = @as(i32, 0); pub const EMBDHLP_INPROC_SERVER = @as(i32, 1); pub const EMBDHLP_CREATENOW = @as(i32, 0); pub const EMBDHLP_DELAYCREATE = @as(i32, 65536); pub const OLECREATE_LEAVERUNNING = @as(u32, 1); pub const IDC_OLEUIHELP = @as(u32, 99); pub const IDC_IO_CREATENEW = @as(u32, 2100); pub const IDC_IO_CREATEFROMFILE = @as(u32, 2101); pub const IDC_IO_LINKFILE = @as(u32, 2102); pub const IDC_IO_OBJECTTYPELIST = @as(u32, 2103); pub const IDC_IO_DISPLAYASICON = @as(u32, 2104); pub const IDC_IO_CHANGEICON = @as(u32, 2105); pub const IDC_IO_FILE = @as(u32, 2106); pub const IDC_IO_FILEDISPLAY = @as(u32, 2107); pub const IDC_IO_RESULTIMAGE = @as(u32, 2108); pub const IDC_IO_RESULTTEXT = @as(u32, 2109); pub const IDC_IO_ICONDISPLAY = @as(u32, 2110); pub const IDC_IO_OBJECTTYPETEXT = @as(u32, 2111); pub const IDC_IO_FILETEXT = @as(u32, 2112); pub const IDC_IO_FILETYPE = @as(u32, 2113); pub const IDC_IO_INSERTCONTROL = @as(u32, 2114); pub const IDC_IO_ADDCONTROL = @as(u32, 2115); pub const IDC_IO_CONTROLTYPELIST = @as(u32, 2116); pub const IDC_PS_PASTE = @as(u32, 500); pub const IDC_PS_PASTELINK = @as(u32, 501); pub const IDC_PS_SOURCETEXT = @as(u32, 502); pub const IDC_PS_PASTELIST = @as(u32, 503); pub const IDC_PS_PASTELINKLIST = @as(u32, 504); pub const IDC_PS_DISPLAYLIST = @as(u32, 505); pub const IDC_PS_DISPLAYASICON = @as(u32, 506); pub const IDC_PS_ICONDISPLAY = @as(u32, 507); pub const IDC_PS_CHANGEICON = @as(u32, 508); pub const IDC_PS_RESULTIMAGE = @as(u32, 509); pub const IDC_PS_RESULTTEXT = @as(u32, 510); pub const IDC_CI_GROUP = @as(u32, 120); pub const IDC_CI_CURRENT = @as(u32, 121); pub const IDC_CI_CURRENTICON = @as(u32, 122); pub const IDC_CI_DEFAULT = @as(u32, 123); pub const IDC_CI_DEFAULTICON = @as(u32, 124); pub const IDC_CI_FROMFILE = @as(u32, 125); pub const IDC_CI_FROMFILEEDIT = @as(u32, 126); pub const IDC_CI_ICONLIST = @as(u32, 127); pub const IDC_CI_LABEL = @as(u32, 128); pub const IDC_CI_LABELEDIT = @as(u32, 129); pub const IDC_CI_BROWSE = @as(u32, 130); pub const IDC_CI_ICONDISPLAY = @as(u32, 131); pub const IDC_CV_OBJECTTYPE = @as(u32, 150); pub const IDC_CV_DISPLAYASICON = @as(u32, 152); pub const IDC_CV_CHANGEICON = @as(u32, 153); pub const IDC_CV_ACTIVATELIST = @as(u32, 154); pub const IDC_CV_CONVERTTO = @as(u32, 155); pub const IDC_CV_ACTIVATEAS = @as(u32, 156); pub const IDC_CV_RESULTTEXT = @as(u32, 157); pub const IDC_CV_CONVERTLIST = @as(u32, 158); pub const IDC_CV_ICONDISPLAY = @as(u32, 165); pub const IDC_EL_CHANGESOURCE = @as(u32, 201); pub const IDC_EL_AUTOMATIC = @as(u32, 202); pub const IDC_EL_CANCELLINK = @as(u32, 209); pub const IDC_EL_UPDATENOW = @as(u32, 210); pub const IDC_EL_OPENSOURCE = @as(u32, 211); pub const IDC_EL_MANUAL = @as(u32, 212); pub const IDC_EL_LINKSOURCE = @as(u32, 216); pub const IDC_EL_LINKTYPE = @as(u32, 217); pub const IDC_EL_LINKSLISTBOX = @as(u32, 206); pub const IDC_EL_COL1 = @as(u32, 220); pub const IDC_EL_COL2 = @as(u32, 221); pub const IDC_EL_COL3 = @as(u32, 222); pub const IDC_BZ_RETRY = @as(u32, 600); pub const IDC_BZ_ICON = @as(u32, 601); pub const IDC_BZ_MESSAGE1 = @as(u32, 602); pub const IDC_BZ_SWITCHTO = @as(u32, 604); pub const IDC_UL_METER = @as(u32, 1029); pub const IDC_UL_STOP = @as(u32, 1030); pub const IDC_UL_PERCENT = @as(u32, 1031); pub const IDC_UL_PROGRESS = @as(u32, 1032); pub const IDC_PU_LINKS = @as(u32, 900); pub const IDC_PU_TEXT = @as(u32, 901); pub const IDC_PU_CONVERT = @as(u32, 902); pub const IDC_PU_ICON = @as(u32, 908); pub const IDC_GP_OBJECTNAME = @as(u32, 1009); pub const IDC_GP_OBJECTTYPE = @as(u32, 1010); pub const IDC_GP_OBJECTSIZE = @as(u32, 1011); pub const IDC_GP_CONVERT = @as(u32, 1013); pub const IDC_GP_OBJECTICON = @as(u32, 1014); pub const IDC_GP_OBJECTLOCATION = @as(u32, 1022); pub const IDC_VP_PERCENT = @as(u32, 1000); pub const IDC_VP_CHANGEICON = @as(u32, 1001); pub const IDC_VP_EDITABLE = @as(u32, 1002); pub const IDC_VP_ASICON = @as(u32, 1003); pub const IDC_VP_RELATIVE = @as(u32, 1005); pub const IDC_VP_SPIN = @as(u32, 1006); pub const IDC_VP_SCALETXT = @as(u32, 1034); pub const IDC_VP_ICONDISPLAY = @as(u32, 1021); pub const IDC_VP_RESULTIMAGE = @as(u32, 1033); pub const IDC_LP_OPENSOURCE = @as(u32, 1006); pub const IDC_LP_UPDATENOW = @as(u32, 1007); pub const IDC_LP_BREAKLINK = @as(u32, 1008); pub const IDC_LP_LINKSOURCE = @as(u32, 1012); pub const IDC_LP_CHANGESOURCE = @as(u32, 1015); pub const IDC_LP_AUTOMATIC = @as(u32, 1016); pub const IDC_LP_MANUAL = @as(u32, 1017); pub const IDC_LP_DATE = @as(u32, 1018); pub const IDC_LP_TIME = @as(u32, 1019); pub const IDD_INSERTOBJECT = @as(u32, 1000); pub const IDD_CHANGEICON = @as(u32, 1001); pub const IDD_CONVERT = @as(u32, 1002); pub const IDD_PASTESPECIAL = @as(u32, 1003); pub const IDD_EDITLINKS = @as(u32, 1004); pub const IDD_BUSY = @as(u32, 1006); pub const IDD_UPDATELINKS = @as(u32, 1007); pub const IDD_CHANGESOURCE = @as(u32, 1009); pub const IDD_INSERTFILEBROWSE = @as(u32, 1010); pub const IDD_CHANGEICONBROWSE = @as(u32, 1011); pub const IDD_CONVERTONLY = @as(u32, 1012); pub const IDD_CHANGESOURCE4 = @as(u32, 1013); pub const IDD_GNRLPROPS = @as(u32, 1100); pub const IDD_VIEWPROPS = @as(u32, 1101); pub const IDD_LINKPROPS = @as(u32, 1102); pub const IDD_CONVERT4 = @as(u32, 1103); pub const IDD_CONVERTONLY4 = @as(u32, 1104); pub const IDD_EDITLINKS4 = @as(u32, 1105); pub const IDD_GNRLPROPS4 = @as(u32, 1106); pub const IDD_LINKPROPS4 = @as(u32, 1107); pub const IDD_PASTESPECIAL4 = @as(u32, 1108); pub const IDD_CANNOTUPDATELINK = @as(u32, 1008); pub const IDD_LINKSOURCEUNAVAILABLE = @as(u32, 1020); pub const IDD_SERVERNOTFOUND = @as(u32, 1023); pub const IDD_OUTOFMEMORY = @as(u32, 1024); pub const IDD_SERVERNOTREGW = @as(u32, 1021); pub const IDD_LINKTYPECHANGEDW = @as(u32, 1022); pub const IDD_SERVERNOTREGA = @as(u32, 1025); pub const IDD_LINKTYPECHANGEDA = @as(u32, 1026); pub const IDD_SERVERNOTREG = @as(u32, 1021); pub const IDD_LINKTYPECHANGED = @as(u32, 1022); pub const ID_BROWSE_CHANGEICON = @as(u32, 1); pub const ID_BROWSE_INSERTFILE = @as(u32, 2); pub const ID_BROWSE_ADDCONTROL = @as(u32, 3); pub const ID_BROWSE_CHANGESOURCE = @as(u32, 4); pub const OLEUI_FALSE = @as(u32, 0); pub const OLEUI_SUCCESS = @as(u32, 1); pub const OLEUI_OK = @as(u32, 1); pub const OLEUI_CANCEL = @as(u32, 2); pub const OLEUI_ERR_STANDARDMIN = @as(u32, 100); pub const OLEUI_ERR_OLEMEMALLOC = @as(u32, 100); pub const OLEUI_ERR_STRUCTURENULL = @as(u32, 101); pub const OLEUI_ERR_STRUCTUREINVALID = @as(u32, 102); pub const OLEUI_ERR_CBSTRUCTINCORRECT = @as(u32, 103); pub const OLEUI_ERR_HWNDOWNERINVALID = @as(u32, 104); pub const OLEUI_ERR_LPSZCAPTIONINVALID = @as(u32, 105); pub const OLEUI_ERR_LPFNHOOKINVALID = @as(u32, 106); pub const OLEUI_ERR_HINSTANCEINVALID = @as(u32, 107); pub const OLEUI_ERR_LPSZTEMPLATEINVALID = @as(u32, 108); pub const OLEUI_ERR_HRESOURCEINVALID = @as(u32, 109); pub const OLEUI_ERR_FINDTEMPLATEFAILURE = @as(u32, 110); pub const OLEUI_ERR_LOADTEMPLATEFAILURE = @as(u32, 111); pub const OLEUI_ERR_DIALOGFAILURE = @as(u32, 112); pub const OLEUI_ERR_LOCALMEMALLOC = @as(u32, 113); pub const OLEUI_ERR_GLOBALMEMALLOC = @as(u32, 114); pub const OLEUI_ERR_LOADSTRING = @as(u32, 115); pub const OLEUI_ERR_STANDARDMAX = @as(u32, 116); pub const IOF_SHOWHELP = @as(i32, 1); pub const IOF_SELECTCREATENEW = @as(i32, 2); pub const IOF_SELECTCREATEFROMFILE = @as(i32, 4); pub const IOF_CHECKLINK = @as(i32, 8); pub const IOF_CHECKDISPLAYASICON = @as(i32, 16); pub const IOF_CREATENEWOBJECT = @as(i32, 32); pub const IOF_CREATEFILEOBJECT = @as(i32, 64); pub const IOF_CREATELINKOBJECT = @as(i32, 128); pub const IOF_DISABLELINK = @as(i32, 256); pub const IOF_VERIFYSERVERSEXIST = @as(i32, 512); pub const IOF_DISABLEDISPLAYASICON = @as(i32, 1024); pub const IOF_HIDECHANGEICON = @as(i32, 2048); pub const IOF_SHOWINSERTCONTROL = @as(i32, 4096); pub const IOF_SELECTCREATECONTROL = @as(i32, 8192); pub const OLEUI_IOERR_LPSZFILEINVALID = @as(u32, 116); pub const OLEUI_IOERR_LPSZLABELINVALID = @as(u32, 117); pub const OLEUI_IOERR_HICONINVALID = @as(u32, 118); pub const OLEUI_IOERR_LPFORMATETCINVALID = @as(u32, 119); pub const OLEUI_IOERR_PPVOBJINVALID = @as(u32, 120); pub const OLEUI_IOERR_LPIOLECLIENTSITEINVALID = @as(u32, 121); pub const OLEUI_IOERR_LPISTORAGEINVALID = @as(u32, 122); pub const OLEUI_IOERR_SCODEHASERROR = @as(u32, 123); pub const OLEUI_IOERR_LPCLSIDEXCLUDEINVALID = @as(u32, 124); pub const OLEUI_IOERR_CCHFILEINVALID = @as(u32, 125); pub const PS_MAXLINKTYPES = @as(u32, 8); pub const PSF_SHOWHELP = @as(i32, 1); pub const PSF_SELECTPASTE = @as(i32, 2); pub const PSF_SELECTPASTELINK = @as(i32, 4); pub const PSF_CHECKDISPLAYASICON = @as(i32, 8); pub const PSF_DISABLEDISPLAYASICON = @as(i32, 16); pub const PSF_HIDECHANGEICON = @as(i32, 32); pub const PSF_STAYONCLIPBOARDCHANGE = @as(i32, 64); pub const PSF_NOREFRESHDATAOBJECT = @as(i32, 128); pub const OLEUI_IOERR_SRCDATAOBJECTINVALID = @as(u32, 116); pub const OLEUI_IOERR_ARRPASTEENTRIESINVALID = @as(u32, 117); pub const OLEUI_IOERR_ARRLINKTYPESINVALID = @as(u32, 118); pub const OLEUI_PSERR_CLIPBOARDCHANGED = @as(u32, 119); pub const OLEUI_PSERR_GETCLIPBOARDFAILED = @as(u32, 120); pub const OLEUI_ELERR_LINKCNTRNULL = @as(u32, 116); pub const OLEUI_ELERR_LINKCNTRINVALID = @as(u32, 117); pub const ELF_SHOWHELP = @as(i32, 1); pub const ELF_DISABLEUPDATENOW = @as(i32, 2); pub const ELF_DISABLEOPENSOURCE = @as(i32, 4); pub const ELF_DISABLECHANGESOURCE = @as(i32, 8); pub const ELF_DISABLECANCELLINK = @as(i32, 16); pub const CIF_SHOWHELP = @as(i32, 1); pub const CIF_SELECTCURRENT = @as(i32, 2); pub const CIF_SELECTDEFAULT = @as(i32, 4); pub const CIF_SELECTFROMFILE = @as(i32, 8); pub const CIF_USEICONEXE = @as(i32, 16); pub const OLEUI_CIERR_MUSTHAVECLSID = @as(u32, 116); pub const OLEUI_CIERR_MUSTHAVECURRENTMETAFILE = @as(u32, 117); pub const OLEUI_CIERR_SZICONEXEINVALID = @as(u32, 118); pub const CF_SHOWHELPBUTTON = @as(i32, 1); pub const CF_SETCONVERTDEFAULT = @as(i32, 2); pub const CF_SETACTIVATEDEFAULT = @as(i32, 4); pub const CF_SELECTCONVERTTO = @as(i32, 8); pub const CF_SELECTACTIVATEAS = @as(i32, 16); pub const CF_DISABLEDISPLAYASICON = @as(i32, 32); pub const CF_DISABLEACTIVATEAS = @as(i32, 64); pub const CF_HIDECHANGEICON = @as(i32, 128); pub const CF_CONVERTONLY = @as(i32, 256); pub const OLEUI_CTERR_CLASSIDINVALID = @as(u32, 117); pub const OLEUI_CTERR_DVASPECTINVALID = @as(u32, 118); pub const OLEUI_CTERR_CBFORMATINVALID = @as(u32, 119); pub const OLEUI_CTERR_HMETAPICTINVALID = @as(u32, 120); pub const OLEUI_CTERR_STRINGINVALID = @as(u32, 121); pub const BZ_DISABLECANCELBUTTON = @as(i32, 1); pub const BZ_DISABLESWITCHTOBUTTON = @as(i32, 2); pub const BZ_DISABLERETRYBUTTON = @as(i32, 4); pub const BZ_NOTRESPONDINGDIALOG = @as(i32, 8); pub const OLEUI_BZERR_HTASKINVALID = @as(u32, 116); pub const OLEUI_BZ_SWITCHTOSELECTED = @as(u32, 117); pub const OLEUI_BZ_RETRYSELECTED = @as(u32, 118); pub const OLEUI_BZ_CALLUNBLOCKED = @as(u32, 119); pub const CSF_SHOWHELP = @as(i32, 1); pub const CSF_VALIDSOURCE = @as(i32, 2); pub const CSF_ONLYGETSOURCE = @as(i32, 4); pub const CSF_EXPLORER = @as(i32, 8); pub const OLEUI_CSERR_LINKCNTRNULL = @as(u32, 116); pub const OLEUI_CSERR_LINKCNTRINVALID = @as(u32, 117); pub const OLEUI_CSERR_FROMNOTNULL = @as(u32, 118); pub const OLEUI_CSERR_TONOTNULL = @as(u32, 119); pub const OLEUI_CSERR_SOURCENULL = @as(u32, 120); pub const OLEUI_CSERR_SOURCEINVALID = @as(u32, 121); pub const OLEUI_CSERR_SOURCEPARSERROR = @as(u32, 122); pub const OLEUI_CSERR_SOURCEPARSEERROR = @as(u32, 122); pub const VPF_SELECTRELATIVE = @as(i32, 1); pub const VPF_DISABLERELATIVE = @as(i32, 2); pub const VPF_DISABLESCALE = @as(i32, 4); pub const OPF_OBJECTISLINK = @as(i32, 1); pub const OPF_NOFILLDEFAULT = @as(i32, 2); pub const OPF_SHOWHELP = @as(i32, 4); pub const OPF_DISABLECONVERT = @as(i32, 8); pub const OLEUI_OPERR_SUBPROPNULL = @as(u32, 116); pub const OLEUI_OPERR_SUBPROPINVALID = @as(u32, 117); pub const OLEUI_OPERR_PROPSHEETNULL = @as(u32, 118); pub const OLEUI_OPERR_PROPSHEETINVALID = @as(u32, 119); pub const OLEUI_OPERR_SUPPROP = @as(u32, 120); pub const OLEUI_OPERR_PROPSINVALID = @as(u32, 121); pub const OLEUI_OPERR_PAGESINCORRECT = @as(u32, 122); pub const OLEUI_OPERR_INVALIDPAGES = @as(u32, 123); pub const OLEUI_OPERR_NOTSUPPORTED = @as(u32, 124); pub const OLEUI_OPERR_DLGPROCNOTNULL = @as(u32, 125); pub const OLEUI_OPERR_LPARAMNOTZERO = @as(u32, 126); pub const OLEUI_GPERR_STRINGINVALID = @as(u32, 127); pub const OLEUI_GPERR_CLASSIDINVALID = @as(u32, 128); pub const OLEUI_GPERR_LPCLSIDEXCLUDEINVALID = @as(u32, 129); pub const OLEUI_GPERR_CBFORMATINVALID = @as(u32, 130); pub const OLEUI_VPERR_METAPICTINVALID = @as(u32, 131); pub const OLEUI_VPERR_DVASPECTINVALID = @as(u32, 132); pub const OLEUI_LPERR_LINKCNTRNULL = @as(u32, 133); pub const OLEUI_LPERR_LINKCNTRINVALID = @as(u32, 134); pub const OLEUI_OPERR_PROPERTYSHEET = @as(u32, 135); pub const OLEUI_OPERR_OBJINFOINVALID = @as(u32, 136); pub const OLEUI_OPERR_LINKINFOINVALID = @as(u32, 137); pub const OLEUI_QUERY_GETCLASSID = @as(u32, 65280); pub const OLEUI_QUERY_LINKBROKEN = @as(u32, 65281); pub const FADF_AUTO = @as(u32, 1); pub const FADF_STATIC = @as(u32, 2); pub const FADF_EMBEDDED = @as(u32, 4); pub const FADF_FIXEDSIZE = @as(u32, 16); pub const FADF_RECORD = @as(u32, 32); pub const FADF_HAVEIID = @as(u32, 64); pub const FADF_HAVEVARTYPE = @as(u32, 128); pub const FADF_BSTR = @as(u32, 256); pub const FADF_UNKNOWN = @as(u32, 512); pub const FADF_DISPATCH = @as(u32, 1024); pub const FADF_VARIANT = @as(u32, 2048); pub const FADF_RESERVED = @as(u32, 61448); pub const PARAMFLAG_NONE = @as(u32, 0); pub const PARAMFLAG_FIN = @as(u32, 1); pub const PARAMFLAG_FOUT = @as(u32, 2); pub const PARAMFLAG_FLCID = @as(u32, 4); pub const PARAMFLAG_FRETVAL = @as(u32, 8); pub const PARAMFLAG_FOPT = @as(u32, 16); pub const PARAMFLAG_FHASDEFAULT = @as(u32, 32); pub const PARAMFLAG_FHASCUSTDATA = @as(u32, 64); pub const IDLFLAG_NONE = @as(u32, 0); pub const IDLFLAG_FIN = @as(u32, 1); pub const IDLFLAG_FOUT = @as(u32, 2); pub const IDLFLAG_FLCID = @as(u32, 4); pub const IDLFLAG_FRETVAL = @as(u32, 8); pub const IMPLTYPEFLAG_FDEFAULT = @as(u32, 1); pub const IMPLTYPEFLAG_FSOURCE = @as(u32, 2); pub const IMPLTYPEFLAG_FRESTRICTED = @as(u32, 4); pub const IMPLTYPEFLAG_FDEFAULTVTABLE = @as(u32, 8); pub const DISPID_UNKNOWN = @as(i32, -1); pub const DISPID_VALUE = @as(u32, 0); pub const DISPID_PROPERTYPUT = @as(i32, -3); pub const DISPID_NEWENUM = @as(i32, -4); pub const DISPID_EVALUATE = @as(i32, -5); pub const DISPID_CONSTRUCTOR = @as(i32, -6); pub const DISPID_DESTRUCTOR = @as(i32, -7); pub const DISPID_COLLECT = @as(i32, -8); pub const STDOLE_MAJORVERNUM = @as(u32, 1); pub const STDOLE_MINORVERNUM = @as(u32, 0); pub const STDOLE_LCID = @as(u32, 0); pub const STDOLE2_MAJORVERNUM = @as(u32, 2); pub const STDOLE2_MINORVERNUM = @as(u32, 0); pub const STDOLE2_LCID = @as(u32, 0); pub const VARIANT_NOVALUEPROP = @as(u32, 1); pub const VARIANT_ALPHABOOL = @as(u32, 2); pub const VARIANT_NOUSEROVERRIDE = @as(u32, 4); pub const VARIANT_CALENDAR_HIJRI = @as(u32, 8); pub const VARIANT_LOCALBOOL = @as(u32, 16); pub const VARIANT_CALENDAR_THAI = @as(u32, 32); pub const VARIANT_CALENDAR_GREGORIAN = @as(u32, 64); pub const VARIANT_USE_NLS = @as(u32, 128); pub const LOCALE_USE_NLS = @as(u32, 268435456); pub const VTDATEGRE_MAX = @as(u32, 2958465); pub const VTDATEGRE_MIN = @as(i32, -657434); pub const NUMPRS_LEADING_WHITE = @as(u32, 1); pub const NUMPRS_TRAILING_WHITE = @as(u32, 2); pub const NUMPRS_LEADING_PLUS = @as(u32, 4); pub const NUMPRS_TRAILING_PLUS = @as(u32, 8); pub const NUMPRS_LEADING_MINUS = @as(u32, 16); pub const NUMPRS_TRAILING_MINUS = @as(u32, 32); pub const NUMPRS_HEX_OCT = @as(u32, 64); pub const NUMPRS_PARENS = @as(u32, 128); pub const NUMPRS_DECIMAL = @as(u32, 256); pub const NUMPRS_THOUSANDS = @as(u32, 512); pub const NUMPRS_CURRENCY = @as(u32, 1024); pub const NUMPRS_EXPONENT = @as(u32, 2048); pub const NUMPRS_USE_ALL = @as(u32, 4096); pub const NUMPRS_STD = @as(u32, 8191); pub const NUMPRS_NEG = @as(u32, 65536); pub const NUMPRS_INEXACT = @as(u32, 131072); pub const VARCMP_LT = @as(u32, 0); pub const VARCMP_EQ = @as(u32, 1); pub const VARCMP_GT = @as(u32, 2); pub const VARCMP_NULL = @as(u32, 3); pub const MEMBERID_NIL = @as(i32, -1); pub const ID_DEFAULTINST = @as(i32, -2); pub const DISPATCH_METHOD = @as(u32, 1); pub const DISPATCH_PROPERTYGET = @as(u32, 2); pub const DISPATCH_PROPERTYPUT = @as(u32, 4); pub const DISPATCH_PROPERTYPUTREF = @as(u32, 8); pub const LOAD_TLB_AS_32BIT = @as(u32, 32); pub const LOAD_TLB_AS_64BIT = @as(u32, 64); pub const ACTIVEOBJECT_STRONG = @as(u32, 0); pub const ACTIVEOBJECT_WEAK = @as(u32, 1); pub const DISPATCH_CONSTRUCT = @as(u32, 16384); pub const DISPID_STARTENUM = @as(i32, -1); pub const SID_VariantConversion = Guid.initString("1f101481-bccd-11d0-9336-00a0c90dcaa9"); pub const SID_GetCaller = Guid.initString("4717cc40-bcb9-11d0-9336-00a0c90dcaa9"); pub const SID_ProvideRuntimeContext = Guid.initString("74a5040c-dd0c-48f0-ac85-194c3259180a"); //-------------------------------------------------------------------------------- // Section: Types (217) //-------------------------------------------------------------------------------- pub const UPDFCACHE_FLAGS = enum(u32) { ALL = 2147483647, ALLBUTNODATACACHE = 2147483646, NORMALCACHE = 8, IFBLANK = 16, ONLYIFBLANK = 2147483648, NODATACACHE = 1, ONSAVECACHE = 2, ONSTOPCACHE = 4, IFBLANKORONSAVECACHE = 18, _, pub fn initFlags(o: struct { ALL: u1 = 0, ALLBUTNODATACACHE: u1 = 0, NORMALCACHE: u1 = 0, IFBLANK: u1 = 0, ONLYIFBLANK: u1 = 0, NODATACACHE: u1 = 0, ONSAVECACHE: u1 = 0, ONSTOPCACHE: u1 = 0, IFBLANKORONSAVECACHE: u1 = 0, }) UPDFCACHE_FLAGS { return @intToEnum(UPDFCACHE_FLAGS, (if (o.ALL == 1) @enumToInt(UPDFCACHE_FLAGS.ALL) else 0) | (if (o.ALLBUTNODATACACHE == 1) @enumToInt(UPDFCACHE_FLAGS.ALLBUTNODATACACHE) else 0) | (if (o.NORMALCACHE == 1) @enumToInt(UPDFCACHE_FLAGS.NORMALCACHE) else 0) | (if (o.IFBLANK == 1) @enumToInt(UPDFCACHE_FLAGS.IFBLANK) else 0) | (if (o.ONLYIFBLANK == 1) @enumToInt(UPDFCACHE_FLAGS.ONLYIFBLANK) else 0) | (if (o.NODATACACHE == 1) @enumToInt(UPDFCACHE_FLAGS.NODATACACHE) else 0) | (if (o.ONSAVECACHE == 1) @enumToInt(UPDFCACHE_FLAGS.ONSAVECACHE) else 0) | (if (o.ONSTOPCACHE == 1) @enumToInt(UPDFCACHE_FLAGS.ONSTOPCACHE) else 0) | (if (o.IFBLANKORONSAVECACHE == 1) @enumToInt(UPDFCACHE_FLAGS.IFBLANKORONSAVECACHE) else 0) ); } }; pub const UPDFCACHE_ALL = UPDFCACHE_FLAGS.ALL; pub const UPDFCACHE_ALLBUTNODATACACHE = UPDFCACHE_FLAGS.ALLBUTNODATACACHE; pub const UPDFCACHE_NORMALCACHE = UPDFCACHE_FLAGS.NORMALCACHE; pub const UPDFCACHE_IFBLANK = UPDFCACHE_FLAGS.IFBLANK; pub const UPDFCACHE_ONLYIFBLANK = UPDFCACHE_FLAGS.ONLYIFBLANK; pub const UPDFCACHE_NODATACACHE = UPDFCACHE_FLAGS.NODATACACHE; pub const UPDFCACHE_ONSAVECACHE = UPDFCACHE_FLAGS.ONSAVECACHE; pub const UPDFCACHE_ONSTOPCACHE = UPDFCACHE_FLAGS.ONSTOPCACHE; pub const UPDFCACHE_IFBLANKORONSAVECACHE = UPDFCACHE_FLAGS.IFBLANKORONSAVECACHE; pub const ENUM_CONTROLS_WHICH_FLAGS = enum(u32) { W_WCH_SIBLING = 1, _WCH_CONTAINER = 2, _WCH_CONTAINED = 3, _WCH_ALL = 4, _WCH_FREVERSEDIR = 134217728, _WCH_FONLYAFTER = 268435456, _WCH_FONLYBEFORE = 536870912, _WCH_FSELECTED = 1073741824, }; pub const GCW_WCH_SIBLING = ENUM_CONTROLS_WHICH_FLAGS.W_WCH_SIBLING; pub const GC_WCH_CONTAINER = ENUM_CONTROLS_WHICH_FLAGS._WCH_CONTAINER; pub const GC_WCH_CONTAINED = ENUM_CONTROLS_WHICH_FLAGS._WCH_CONTAINED; pub const GC_WCH_ALL = ENUM_CONTROLS_WHICH_FLAGS._WCH_ALL; pub const GC_WCH_FREVERSEDIR = ENUM_CONTROLS_WHICH_FLAGS._WCH_FREVERSEDIR; pub const GC_WCH_FONLYAFTER = ENUM_CONTROLS_WHICH_FLAGS._WCH_FONLYAFTER; pub const GC_WCH_FONLYBEFORE = ENUM_CONTROLS_WHICH_FLAGS._WCH_FONLYBEFORE; pub const GC_WCH_FSELECTED = ENUM_CONTROLS_WHICH_FLAGS._WCH_FSELECTED; pub const MULTICLASSINFO_FLAGS = enum(u32) { TYPEINFO = 1, NUMRESERVEDDISPIDS = 2, IIDPRIMARY = 4, IIDSOURCE = 8, }; pub const MULTICLASSINFO_GETTYPEINFO = MULTICLASSINFO_FLAGS.TYPEINFO; pub const MULTICLASSINFO_GETNUMRESERVEDDISPIDS = MULTICLASSINFO_FLAGS.NUMRESERVEDDISPIDS; pub const MULTICLASSINFO_GETIIDPRIMARY = MULTICLASSINFO_FLAGS.IIDPRIMARY; pub const MULTICLASSINFO_GETIIDSOURCE = MULTICLASSINFO_FLAGS.IIDSOURCE; pub const VARENUM = enum(i32) { EMPTY = 0, NULL = 1, I2 = 2, I4 = 3, R4 = 4, R8 = 5, CY = 6, DATE = 7, BSTR = 8, DISPATCH = 9, ERROR = 10, BOOL = 11, VARIANT = 12, UNKNOWN = 13, DECIMAL = 14, I1 = 16, UI1 = 17, UI2 = 18, UI4 = 19, I8 = 20, UI8 = 21, INT = 22, UINT = 23, VOID = 24, HRESULT = 25, PTR = 26, SAFEARRAY = 27, CARRAY = 28, USERDEFINED = 29, LPSTR = 30, LPWSTR = 31, RECORD = 36, INT_PTR = 37, UINT_PTR = 38, FILETIME = 64, BLOB = 65, STREAM = 66, STORAGE = 67, STREAMED_OBJECT = 68, STORED_OBJECT = 69, BLOB_OBJECT = 70, CF = 71, CLSID = 72, VERSIONED_STREAM = 73, BSTR_BLOB = 4095, VECTOR = 4096, ARRAY = 8192, BYREF = 16384, RESERVED = 32768, ILLEGAL = 65535, // ILLEGALMASKED = 4095, this enum value conflicts with BSTR_BLOB // TYPEMASK = 4095, this enum value conflicts with BSTR_BLOB }; pub const VT_EMPTY = VARENUM.EMPTY; pub const VT_NULL = VARENUM.NULL; pub const VT_I2 = VARENUM.I2; pub const VT_I4 = VARENUM.I4; pub const VT_R4 = VARENUM.R4; pub const VT_R8 = VARENUM.R8; pub const VT_CY = VARENUM.CY; pub const VT_DATE = VARENUM.DATE; pub const VT_BSTR = VARENUM.BSTR; pub const VT_DISPATCH = VARENUM.DISPATCH; pub const VT_ERROR = VARENUM.ERROR; pub const VT_BOOL = VARENUM.BOOL; pub const VT_VARIANT = VARENUM.VARIANT; pub const VT_UNKNOWN = VARENUM.UNKNOWN; pub const VT_DECIMAL = VARENUM.DECIMAL; pub const VT_I1 = VARENUM.I1; pub const VT_UI1 = VARENUM.UI1; pub const VT_UI2 = VARENUM.UI2; pub const VT_UI4 = VARENUM.UI4; pub const VT_I8 = VARENUM.I8; pub const VT_UI8 = VARENUM.UI8; pub const VT_INT = VARENUM.INT; pub const VT_UINT = VARENUM.UINT; pub const VT_VOID = VARENUM.VOID; pub const VT_HRESULT = VARENUM.HRESULT; pub const VT_PTR = VARENUM.PTR; pub const VT_SAFEARRAY = VARENUM.SAFEARRAY; pub const VT_CARRAY = VARENUM.CARRAY; pub const VT_USERDEFINED = VARENUM.USERDEFINED; pub const VT_LPSTR = VARENUM.LPSTR; pub const VT_LPWSTR = VARENUM.LPWSTR; pub const VT_RECORD = VARENUM.RECORD; pub const VT_INT_PTR = VARENUM.INT_PTR; pub const VT_UINT_PTR = VARENUM.UINT_PTR; pub const VT_FILETIME = VARENUM.FILETIME; pub const VT_BLOB = VARENUM.BLOB; pub const VT_STREAM = VARENUM.STREAM; pub const VT_STORAGE = VARENUM.STORAGE; pub const VT_STREAMED_OBJECT = VARENUM.STREAMED_OBJECT; pub const VT_STORED_OBJECT = VARENUM.STORED_OBJECT; pub const VT_BLOB_OBJECT = VARENUM.BLOB_OBJECT; pub const VT_CF = VARENUM.CF; pub const VT_CLSID = VARENUM.CLSID; pub const VT_VERSIONED_STREAM = VARENUM.VERSIONED_STREAM; pub const VT_BSTR_BLOB = VARENUM.BSTR_BLOB; pub const VT_VECTOR = VARENUM.VECTOR; pub const VT_ARRAY = VARENUM.ARRAY; pub const VT_BYREF = VARENUM.BYREF; pub const VT_RESERVED = VARENUM.RESERVED; pub const VT_ILLEGAL = VARENUM.ILLEGAL; pub const VT_ILLEGALMASKED = VARENUM.BSTR_BLOB; pub const VT_TYPEMASK = VARENUM.BSTR_BLOB; pub const _wireSAFEARR_BSTR = extern struct { Size: u32, aBstr: ?*?*FLAGGED_WORD_BLOB, }; pub const _wireSAFEARR_UNKNOWN = extern struct { Size: u32, apUnknown: ?*?*IUnknown, }; pub const _wireSAFEARR_DISPATCH = extern struct { Size: u32, apDispatch: ?*?*IDispatch, }; pub const _wireSAFEARR_VARIANT = extern struct { Size: u32, aVariant: ?*?*_wireVARIANT, }; pub const _wireSAFEARR_BRECORD = extern struct { Size: u32, aRecord: ?*?*_wireBRECORD, }; pub const _wireSAFEARR_HAVEIID = extern struct { Size: u32, apUnknown: ?*?*IUnknown, iid: Guid, }; pub const SF_TYPE = enum(i32) { ERROR = 10, I1 = 16, I2 = 2, I4 = 3, I8 = 20, BSTR = 8, UNKNOWN = 13, DISPATCH = 9, VARIANT = 12, RECORD = 36, HAVEIID = 32781, }; pub const SF_ERROR = SF_TYPE.ERROR; pub const SF_I1 = SF_TYPE.I1; pub const SF_I2 = SF_TYPE.I2; pub const SF_I4 = SF_TYPE.I4; pub const SF_I8 = SF_TYPE.I8; pub const SF_BSTR = SF_TYPE.BSTR; pub const SF_UNKNOWN = SF_TYPE.UNKNOWN; pub const SF_DISPATCH = SF_TYPE.DISPATCH; pub const SF_VARIANT = SF_TYPE.VARIANT; pub const SF_RECORD = SF_TYPE.RECORD; pub const SF_HAVEIID = SF_TYPE.HAVEIID; pub const _wireSAFEARRAY_UNION = extern struct { sfType: u32, u: extern struct { BstrStr: _wireSAFEARR_BSTR, UnknownStr: _wireSAFEARR_UNKNOWN, DispatchStr: _wireSAFEARR_DISPATCH, VariantStr: _wireSAFEARR_VARIANT, RecordStr: _wireSAFEARR_BRECORD, HaveIidStr: _wireSAFEARR_HAVEIID, ByteStr: BYTE_SIZEDARR, WordStr: SHORT_SIZEDARR, LongStr: LONG_SIZEDARR, HyperStr: HYPER_SIZEDARR, }, }; pub const _wireSAFEARRAY = extern struct { cDims: u16, fFeatures: u16, cbElements: u32, cLocks: u32, uArrayStructs: _wireSAFEARRAY_UNION, rgsabound: [1]SAFEARRAYBOUND, }; pub const _wireBRECORD = extern struct { fFlags: u32, clSize: u32, pRecInfo: ?*IRecordInfo, pRecord: ?*u8, }; pub const _wireVARIANT = extern struct { clSize: u32, rpcReserved: u32, vt: u16, wReserved1: u16, wReserved2: u16, wReserved3: u16, Anonymous: extern union { llVal: i64, lVal: i32, bVal: u8, iVal: i16, fltVal: f32, dblVal: f64, boolVal: i16, scode: i32, cyVal: CY, date: f64, bstrVal: ?*FLAGGED_WORD_BLOB, punkVal: ?*IUnknown, pdispVal: ?*IDispatch, parray: ?*?*_wireSAFEARRAY, brecVal: ?*_wireBRECORD, pbVal: ?*u8, piVal: ?*i16, plVal: ?*i32, pllVal: ?*i64, pfltVal: ?*f32, pdblVal: ?*f64, pboolVal: ?*i16, pscode: ?*i32, pcyVal: ?*CY, pdate: ?*f64, pbstrVal: ?*?*FLAGGED_WORD_BLOB, ppunkVal: ?*?*IUnknown, ppdispVal: ?*?*IDispatch, pparray: ?*?*?*_wireSAFEARRAY, pvarVal: ?*?*_wireVARIANT, cVal: CHAR, uiVal: u16, ulVal: u32, ullVal: u64, intVal: i32, uintVal: u32, decVal: DECIMAL, pdecVal: ?*DECIMAL, pcVal: ?PSTR, puiVal: ?*u16, pulVal: ?*u32, pullVal: ?*u64, pintVal: ?*i32, puintVal: ?*u32, }, }; pub const ARRAYDESC = extern struct { tdescElem: TYPEDESC, cDims: u16, rgbounds: [1]SAFEARRAYBOUND, }; pub const PARAMDESCEX = extern struct { cBytes: u32, varDefaultValue: VARIANT, }; pub const PARAMDESC = extern struct { pparamdescex: ?*PARAMDESCEX, wParamFlags: u16, }; pub const TYPEFLAGS = enum(i32) { APPOBJECT = 1, CANCREATE = 2, LICENSED = 4, PREDECLID = 8, HIDDEN = 16, CONTROL = 32, DUAL = 64, NONEXTENSIBLE = 128, OLEAUTOMATION = 256, RESTRICTED = 512, AGGREGATABLE = 1024, REPLACEABLE = 2048, DISPATCHABLE = 4096, REVERSEBIND = 8192, PROXY = 16384, }; pub const TYPEFLAG_FAPPOBJECT = TYPEFLAGS.APPOBJECT; pub const TYPEFLAG_FCANCREATE = TYPEFLAGS.CANCREATE; pub const TYPEFLAG_FLICENSED = TYPEFLAGS.LICENSED; pub const TYPEFLAG_FPREDECLID = TYPEFLAGS.PREDECLID; pub const TYPEFLAG_FHIDDEN = TYPEFLAGS.HIDDEN; pub const TYPEFLAG_FCONTROL = TYPEFLAGS.CONTROL; pub const TYPEFLAG_FDUAL = TYPEFLAGS.DUAL; pub const TYPEFLAG_FNONEXTENSIBLE = TYPEFLAGS.NONEXTENSIBLE; pub const TYPEFLAG_FOLEAUTOMATION = TYPEFLAGS.OLEAUTOMATION; pub const TYPEFLAG_FRESTRICTED = TYPEFLAGS.RESTRICTED; pub const TYPEFLAG_FAGGREGATABLE = TYPEFLAGS.AGGREGATABLE; pub const TYPEFLAG_FREPLACEABLE = TYPEFLAGS.REPLACEABLE; pub const TYPEFLAG_FDISPATCHABLE = TYPEFLAGS.DISPATCHABLE; pub const TYPEFLAG_FREVERSEBIND = TYPEFLAGS.REVERSEBIND; pub const TYPEFLAG_FPROXY = TYPEFLAGS.PROXY; pub const FUNCFLAGS = enum(i32) { RESTRICTED = 1, SOURCE = 2, BINDABLE = 4, REQUESTEDIT = 8, DISPLAYBIND = 16, DEFAULTBIND = 32, HIDDEN = 64, USESGETLASTERROR = 128, DEFAULTCOLLELEM = 256, UIDEFAULT = 512, NONBROWSABLE = 1024, REPLACEABLE = 2048, IMMEDIATEBIND = 4096, }; pub const FUNCFLAG_FRESTRICTED = FUNCFLAGS.RESTRICTED; pub const FUNCFLAG_FSOURCE = FUNCFLAGS.SOURCE; pub const FUNCFLAG_FBINDABLE = FUNCFLAGS.BINDABLE; pub const FUNCFLAG_FREQUESTEDIT = FUNCFLAGS.REQUESTEDIT; pub const FUNCFLAG_FDISPLAYBIND = FUNCFLAGS.DISPLAYBIND; pub const FUNCFLAG_FDEFAULTBIND = FUNCFLAGS.DEFAULTBIND; pub const FUNCFLAG_FHIDDEN = FUNCFLAGS.HIDDEN; pub const FUNCFLAG_FUSESGETLASTERROR = FUNCFLAGS.USESGETLASTERROR; pub const FUNCFLAG_FDEFAULTCOLLELEM = FUNCFLAGS.DEFAULTCOLLELEM; pub const FUNCFLAG_FUIDEFAULT = FUNCFLAGS.UIDEFAULT; pub const FUNCFLAG_FNONBROWSABLE = FUNCFLAGS.NONBROWSABLE; pub const FUNCFLAG_FREPLACEABLE = FUNCFLAGS.REPLACEABLE; pub const FUNCFLAG_FIMMEDIATEBIND = FUNCFLAGS.IMMEDIATEBIND; pub const VARFLAGS = enum(i32) { READONLY = 1, SOURCE = 2, BINDABLE = 4, REQUESTEDIT = 8, DISPLAYBIND = 16, DEFAULTBIND = 32, HIDDEN = 64, RESTRICTED = 128, DEFAULTCOLLELEM = 256, UIDEFAULT = 512, NONBROWSABLE = 1024, REPLACEABLE = 2048, IMMEDIATEBIND = 4096, }; pub const VARFLAG_FREADONLY = VARFLAGS.READONLY; pub const VARFLAG_FSOURCE = VARFLAGS.SOURCE; pub const VARFLAG_FBINDABLE = VARFLAGS.BINDABLE; pub const VARFLAG_FREQUESTEDIT = VARFLAGS.REQUESTEDIT; pub const VARFLAG_FDISPLAYBIND = VARFLAGS.DISPLAYBIND; pub const VARFLAG_FDEFAULTBIND = VARFLAGS.DEFAULTBIND; pub const VARFLAG_FHIDDEN = VARFLAGS.HIDDEN; pub const VARFLAG_FRESTRICTED = VARFLAGS.RESTRICTED; pub const VARFLAG_FDEFAULTCOLLELEM = VARFLAGS.DEFAULTCOLLELEM; pub const VARFLAG_FUIDEFAULT = VARFLAGS.UIDEFAULT; pub const VARFLAG_FNONBROWSABLE = VARFLAGS.NONBROWSABLE; pub const VARFLAG_FREPLACEABLE = VARFLAGS.REPLACEABLE; pub const VARFLAG_FIMMEDIATEBIND = VARFLAGS.IMMEDIATEBIND; pub const CLEANLOCALSTORAGE = extern struct { pInterface: ?*IUnknown, pStorage: ?*anyopaque, flags: u32, }; const IID_ICreateTypeInfo_Value = Guid.initString("00020405-0000-0000-c000-000000000046"); pub const IID_ICreateTypeInfo = &IID_ICreateTypeInfo_Value; pub const ICreateTypeInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetGuid: fn( self: *const ICreateTypeInfo, guid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTypeFlags: fn( self: *const ICreateTypeInfo, uTypeFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDocString: fn( self: *const ICreateTypeInfo, pStrDoc: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpContext: fn( self: *const ICreateTypeInfo, dwHelpContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVersion: fn( self: *const ICreateTypeInfo, wMajorVerNum: u16, wMinorVerNum: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddRefTypeInfo: fn( self: *const ICreateTypeInfo, pTInfo: ?*ITypeInfo, phRefType: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddFuncDesc: fn( self: *const ICreateTypeInfo, index: u32, pFuncDesc: ?*FUNCDESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddImplType: fn( self: *const ICreateTypeInfo, index: u32, hRefType: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetImplTypeFlags: fn( self: *const ICreateTypeInfo, index: u32, implTypeFlags: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAlignment: fn( self: *const ICreateTypeInfo, cbAlignment: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSchema: fn( self: *const ICreateTypeInfo, pStrSchema: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddVarDesc: fn( self: *const ICreateTypeInfo, index: u32, pVarDesc: ?*VARDESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFuncAndParamNames: fn( self: *const ICreateTypeInfo, index: u32, rgszNames: [*]?PWSTR, cNames: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVarName: fn( self: *const ICreateTypeInfo, index: u32, szName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTypeDescAlias: fn( self: *const ICreateTypeInfo, pTDescAlias: ?*TYPEDESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DefineFuncAsDllEntry: fn( self: *const ICreateTypeInfo, index: u32, szDllName: ?PWSTR, szProcName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFuncDocString: fn( self: *const ICreateTypeInfo, index: u32, szDocString: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVarDocString: fn( self: *const ICreateTypeInfo, index: u32, szDocString: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFuncHelpContext: fn( self: *const ICreateTypeInfo, index: u32, dwHelpContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVarHelpContext: fn( self: *const ICreateTypeInfo, index: u32, dwHelpContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMops: fn( self: *const ICreateTypeInfo, index: u32, bstrMops: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTypeIdldesc: fn( self: *const ICreateTypeInfo, pIdlDesc: ?*IDLDESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LayOut: fn( self: *const ICreateTypeInfo, ) 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 ICreateTypeInfo_SetGuid(self: *const T, guid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetGuid(@ptrCast(*const ICreateTypeInfo, self), guid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetTypeFlags(self: *const T, uTypeFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetTypeFlags(@ptrCast(*const ICreateTypeInfo, self), uTypeFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetDocString(self: *const T, pStrDoc: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetDocString(@ptrCast(*const ICreateTypeInfo, self), pStrDoc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetHelpContext(self: *const T, dwHelpContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetHelpContext(@ptrCast(*const ICreateTypeInfo, self), dwHelpContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetVersion(self: *const T, wMajorVerNum: u16, wMinorVerNum: u16) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetVersion(@ptrCast(*const ICreateTypeInfo, self), wMajorVerNum, wMinorVerNum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_AddRefTypeInfo(self: *const T, pTInfo: ?*ITypeInfo, phRefType: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).AddRefTypeInfo(@ptrCast(*const ICreateTypeInfo, self), pTInfo, phRefType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_AddFuncDesc(self: *const T, index: u32, pFuncDesc: ?*FUNCDESC) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).AddFuncDesc(@ptrCast(*const ICreateTypeInfo, self), index, pFuncDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_AddImplType(self: *const T, index: u32, hRefType: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).AddImplType(@ptrCast(*const ICreateTypeInfo, self), index, hRefType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetImplTypeFlags(self: *const T, index: u32, implTypeFlags: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetImplTypeFlags(@ptrCast(*const ICreateTypeInfo, self), index, implTypeFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetAlignment(self: *const T, cbAlignment: u16) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetAlignment(@ptrCast(*const ICreateTypeInfo, self), cbAlignment); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetSchema(self: *const T, pStrSchema: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetSchema(@ptrCast(*const ICreateTypeInfo, self), pStrSchema); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_AddVarDesc(self: *const T, index: u32, pVarDesc: ?*VARDESC) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).AddVarDesc(@ptrCast(*const ICreateTypeInfo, self), index, pVarDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetFuncAndParamNames(self: *const T, index: u32, rgszNames: [*]?PWSTR, cNames: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetFuncAndParamNames(@ptrCast(*const ICreateTypeInfo, self), index, rgszNames, cNames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetVarName(self: *const T, index: u32, szName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetVarName(@ptrCast(*const ICreateTypeInfo, self), index, szName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetTypeDescAlias(self: *const T, pTDescAlias: ?*TYPEDESC) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetTypeDescAlias(@ptrCast(*const ICreateTypeInfo, self), pTDescAlias); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_DefineFuncAsDllEntry(self: *const T, index: u32, szDllName: ?PWSTR, szProcName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).DefineFuncAsDllEntry(@ptrCast(*const ICreateTypeInfo, self), index, szDllName, szProcName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetFuncDocString(self: *const T, index: u32, szDocString: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetFuncDocString(@ptrCast(*const ICreateTypeInfo, self), index, szDocString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetVarDocString(self: *const T, index: u32, szDocString: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetVarDocString(@ptrCast(*const ICreateTypeInfo, self), index, szDocString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetFuncHelpContext(self: *const T, index: u32, dwHelpContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetFuncHelpContext(@ptrCast(*const ICreateTypeInfo, self), index, dwHelpContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetVarHelpContext(self: *const T, index: u32, dwHelpContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetVarHelpContext(@ptrCast(*const ICreateTypeInfo, self), index, dwHelpContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetMops(self: *const T, index: u32, bstrMops: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetMops(@ptrCast(*const ICreateTypeInfo, self), index, bstrMops); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_SetTypeIdldesc(self: *const T, pIdlDesc: ?*IDLDESC) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).SetTypeIdldesc(@ptrCast(*const ICreateTypeInfo, self), pIdlDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo_LayOut(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo.VTable, self.vtable).LayOut(@ptrCast(*const ICreateTypeInfo, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ICreateTypeInfo2_Value = Guid.initString("0002040e-0000-0000-c000-000000000046"); pub const IID_ICreateTypeInfo2 = &IID_ICreateTypeInfo2_Value; pub const ICreateTypeInfo2 = extern struct { pub const VTable = extern struct { base: ICreateTypeInfo.VTable, DeleteFuncDesc: fn( self: *const ICreateTypeInfo2, index: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteFuncDescByMemId: fn( self: *const ICreateTypeInfo2, memid: i32, invKind: INVOKEKIND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteVarDesc: fn( self: *const ICreateTypeInfo2, index: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteVarDescByMemId: fn( self: *const ICreateTypeInfo2, memid: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteImplType: fn( self: *const ICreateTypeInfo2, index: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCustData: fn( self: *const ICreateTypeInfo2, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFuncCustData: fn( self: *const ICreateTypeInfo2, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetParamCustData: fn( self: *const ICreateTypeInfo2, indexFunc: u32, indexParam: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVarCustData: fn( self: *const ICreateTypeInfo2, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetImplTypeCustData: fn( self: *const ICreateTypeInfo2, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpStringContext: fn( self: *const ICreateTypeInfo2, dwHelpStringContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFuncHelpStringContext: fn( self: *const ICreateTypeInfo2, index: u32, dwHelpStringContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVarHelpStringContext: fn( self: *const ICreateTypeInfo2, index: u32, dwHelpStringContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Invalidate: fn( self: *const ICreateTypeInfo2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetName: fn( self: *const ICreateTypeInfo2, szName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ICreateTypeInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_DeleteFuncDesc(self: *const T, index: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).DeleteFuncDesc(@ptrCast(*const ICreateTypeInfo2, self), index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_DeleteFuncDescByMemId(self: *const T, memid: i32, invKind: INVOKEKIND) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).DeleteFuncDescByMemId(@ptrCast(*const ICreateTypeInfo2, self), memid, invKind); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_DeleteVarDesc(self: *const T, index: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).DeleteVarDesc(@ptrCast(*const ICreateTypeInfo2, self), index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_DeleteVarDescByMemId(self: *const T, memid: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).DeleteVarDescByMemId(@ptrCast(*const ICreateTypeInfo2, self), memid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_DeleteImplType(self: *const T, index: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).DeleteImplType(@ptrCast(*const ICreateTypeInfo2, self), index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetCustData(self: *const T, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetCustData(@ptrCast(*const ICreateTypeInfo2, self), guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetFuncCustData(self: *const T, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetFuncCustData(@ptrCast(*const ICreateTypeInfo2, self), index, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetParamCustData(self: *const T, indexFunc: u32, indexParam: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetParamCustData(@ptrCast(*const ICreateTypeInfo2, self), indexFunc, indexParam, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetVarCustData(self: *const T, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetVarCustData(@ptrCast(*const ICreateTypeInfo2, self), index, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetImplTypeCustData(self: *const T, index: u32, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetImplTypeCustData(@ptrCast(*const ICreateTypeInfo2, self), index, guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetHelpStringContext(self: *const T, dwHelpStringContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetHelpStringContext(@ptrCast(*const ICreateTypeInfo2, self), dwHelpStringContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetFuncHelpStringContext(self: *const T, index: u32, dwHelpStringContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetFuncHelpStringContext(@ptrCast(*const ICreateTypeInfo2, self), index, dwHelpStringContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetVarHelpStringContext(self: *const T, index: u32, dwHelpStringContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetVarHelpStringContext(@ptrCast(*const ICreateTypeInfo2, self), index, dwHelpStringContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_Invalidate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).Invalidate(@ptrCast(*const ICreateTypeInfo2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeInfo2_SetName(self: *const T, szName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeInfo2.VTable, self.vtable).SetName(@ptrCast(*const ICreateTypeInfo2, self), szName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ICreateTypeLib_Value = Guid.initString("00020406-0000-0000-c000-000000000046"); pub const IID_ICreateTypeLib = &IID_ICreateTypeLib_Value; pub const ICreateTypeLib = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateTypeInfo: fn( self: *const ICreateTypeLib, szName: ?PWSTR, tkind: TYPEKIND, ppCTInfo: ?*?*ICreateTypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetName: fn( self: *const ICreateTypeLib, szName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetVersion: fn( self: *const ICreateTypeLib, wMajorVerNum: u16, wMinorVerNum: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGuid: fn( self: *const ICreateTypeLib, guid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDocString: fn( self: *const ICreateTypeLib, szDoc: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpFileName: fn( self: *const ICreateTypeLib, szHelpFileName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpContext: fn( self: *const ICreateTypeLib, dwHelpContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLcid: fn( self: *const ICreateTypeLib, lcid: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLibFlags: fn( self: *const ICreateTypeLib, uLibFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveAllChanges: fn( self: *const ICreateTypeLib, ) 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 ICreateTypeLib_CreateTypeInfo(self: *const T, szName: ?PWSTR, tkind: TYPEKIND, ppCTInfo: ?*?*ICreateTypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).CreateTypeInfo(@ptrCast(*const ICreateTypeLib, self), szName, tkind, ppCTInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetName(self: *const T, szName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetName(@ptrCast(*const ICreateTypeLib, self), szName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetVersion(self: *const T, wMajorVerNum: u16, wMinorVerNum: u16) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetVersion(@ptrCast(*const ICreateTypeLib, self), wMajorVerNum, wMinorVerNum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetGuid(self: *const T, guid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetGuid(@ptrCast(*const ICreateTypeLib, self), guid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetDocString(self: *const T, szDoc: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetDocString(@ptrCast(*const ICreateTypeLib, self), szDoc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetHelpFileName(self: *const T, szHelpFileName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetHelpFileName(@ptrCast(*const ICreateTypeLib, self), szHelpFileName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetHelpContext(self: *const T, dwHelpContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetHelpContext(@ptrCast(*const ICreateTypeLib, self), dwHelpContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetLcid(self: *const T, lcid: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetLcid(@ptrCast(*const ICreateTypeLib, self), lcid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SetLibFlags(self: *const T, uLibFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SetLibFlags(@ptrCast(*const ICreateTypeLib, self), uLibFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib_SaveAllChanges(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib.VTable, self.vtable).SaveAllChanges(@ptrCast(*const ICreateTypeLib, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ICreateTypeLib2_Value = Guid.initString("0002040f-0000-0000-c000-000000000046"); pub const IID_ICreateTypeLib2 = &IID_ICreateTypeLib2_Value; pub const ICreateTypeLib2 = extern struct { pub const VTable = extern struct { base: ICreateTypeLib.VTable, DeleteTypeInfo: fn( self: *const ICreateTypeLib2, szName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCustData: fn( self: *const ICreateTypeLib2, guid: ?*const Guid, pVarVal: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpStringContext: fn( self: *const ICreateTypeLib2, dwHelpStringContext: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpStringDll: fn( self: *const ICreateTypeLib2, szFileName: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ICreateTypeLib.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib2_DeleteTypeInfo(self: *const T, szName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib2.VTable, self.vtable).DeleteTypeInfo(@ptrCast(*const ICreateTypeLib2, self), szName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib2_SetCustData(self: *const T, guid: ?*const Guid, pVarVal: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib2.VTable, self.vtable).SetCustData(@ptrCast(*const ICreateTypeLib2, self), guid, pVarVal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib2_SetHelpStringContext(self: *const T, dwHelpStringContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib2.VTable, self.vtable).SetHelpStringContext(@ptrCast(*const ICreateTypeLib2, self), dwHelpStringContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateTypeLib2_SetHelpStringDll(self: *const T, szFileName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateTypeLib2.VTable, self.vtable).SetHelpStringDll(@ptrCast(*const ICreateTypeLib2, self), szFileName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IEnumVARIANT_Value = Guid.initString("00020404-0000-0000-c000-000000000046"); pub const IID_IEnumVARIANT = &IID_IEnumVARIANT_Value; pub const IEnumVARIANT = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumVARIANT, celt: u32, rgVar: [*]VARIANT, pCeltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumVARIANT, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumVARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumVARIANT, ppEnum: ?*?*IEnumVARIANT, ) 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 IEnumVARIANT_Next(self: *const T, celt: u32, rgVar: [*]VARIANT, pCeltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumVARIANT.VTable, self.vtable).Next(@ptrCast(*const IEnumVARIANT, self), celt, rgVar, pCeltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumVARIANT_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumVARIANT.VTable, self.vtable).Skip(@ptrCast(*const IEnumVARIANT, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumVARIANT_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumVARIANT.VTable, self.vtable).Reset(@ptrCast(*const IEnumVARIANT, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumVARIANT_Clone(self: *const T, ppEnum: ?*?*IEnumVARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumVARIANT.VTable, self.vtable).Clone(@ptrCast(*const IEnumVARIANT, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; pub const LIBFLAGS = enum(i32) { RESTRICTED = 1, CONTROL = 2, HIDDEN = 4, HASDISKIMAGE = 8, }; pub const LIBFLAG_FRESTRICTED = LIBFLAGS.RESTRICTED; pub const LIBFLAG_FCONTROL = LIBFLAGS.CONTROL; pub const LIBFLAG_FHIDDEN = LIBFLAGS.HIDDEN; pub const LIBFLAG_FHASDISKIMAGE = LIBFLAGS.HASDISKIMAGE; pub const CHANGEKIND = enum(i32) { ADDMEMBER = 0, DELETEMEMBER = 1, SETNAMES = 2, SETDOCUMENTATION = 3, GENERAL = 4, INVALIDATE = 5, CHANGEFAILED = 6, MAX = 7, }; pub const CHANGEKIND_ADDMEMBER = CHANGEKIND.ADDMEMBER; pub const CHANGEKIND_DELETEMEMBER = CHANGEKIND.DELETEMEMBER; pub const CHANGEKIND_SETNAMES = CHANGEKIND.SETNAMES; pub const CHANGEKIND_SETDOCUMENTATION = CHANGEKIND.SETDOCUMENTATION; pub const CHANGEKIND_GENERAL = CHANGEKIND.GENERAL; pub const CHANGEKIND_INVALIDATE = CHANGEKIND.INVALIDATE; pub const CHANGEKIND_CHANGEFAILED = CHANGEKIND.CHANGEFAILED; pub const CHANGEKIND_MAX = CHANGEKIND.MAX; const IID_ITypeChangeEvents_Value = Guid.initString("00020410-0000-0000-c000-000000000046"); pub const IID_ITypeChangeEvents = &IID_ITypeChangeEvents_Value; pub const ITypeChangeEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RequestTypeChange: fn( self: *const ITypeChangeEvents, changeKind: CHANGEKIND, pTInfoBefore: ?*ITypeInfo, pStrName: ?PWSTR, pfCancel: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AfterTypeChange: fn( self: *const ITypeChangeEvents, changeKind: CHANGEKIND, pTInfoAfter: ?*ITypeInfo, pStrName: ?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 ITypeChangeEvents_RequestTypeChange(self: *const T, changeKind: CHANGEKIND, pTInfoBefore: ?*ITypeInfo, pStrName: ?PWSTR, pfCancel: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeChangeEvents.VTable, self.vtable).RequestTypeChange(@ptrCast(*const ITypeChangeEvents, self), changeKind, pTInfoBefore, pStrName, pfCancel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeChangeEvents_AfterTypeChange(self: *const T, changeKind: CHANGEKIND, pTInfoAfter: ?*ITypeInfo, pStrName: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeChangeEvents.VTable, self.vtable).AfterTypeChange(@ptrCast(*const ITypeChangeEvents, self), changeKind, pTInfoAfter, pStrName); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ICreateErrorInfo_Value = Guid.initString("22f03340-547d-101b-8e65-08002b2bd119"); pub const IID_ICreateErrorInfo = &IID_ICreateErrorInfo_Value; pub const ICreateErrorInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetGUID: fn( self: *const ICreateErrorInfo, rguid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSource: fn( self: *const ICreateErrorInfo, szSource: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDescription: fn( self: *const ICreateErrorInfo, szDescription: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpFile: fn( self: *const ICreateErrorInfo, szHelpFile: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHelpContext: fn( self: *const ICreateErrorInfo, dwHelpContext: 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 ICreateErrorInfo_SetGUID(self: *const T, rguid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateErrorInfo.VTable, self.vtable).SetGUID(@ptrCast(*const ICreateErrorInfo, self), rguid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateErrorInfo_SetSource(self: *const T, szSource: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateErrorInfo.VTable, self.vtable).SetSource(@ptrCast(*const ICreateErrorInfo, self), szSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateErrorInfo_SetDescription(self: *const T, szDescription: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateErrorInfo.VTable, self.vtable).SetDescription(@ptrCast(*const ICreateErrorInfo, self), szDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateErrorInfo_SetHelpFile(self: *const T, szHelpFile: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateErrorInfo.VTable, self.vtable).SetHelpFile(@ptrCast(*const ICreateErrorInfo, self), szHelpFile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICreateErrorInfo_SetHelpContext(self: *const T, dwHelpContext: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ICreateErrorInfo.VTable, self.vtable).SetHelpContext(@ptrCast(*const ICreateErrorInfo, self), dwHelpContext); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITypeFactory_Value = Guid.initString("0000002e-0000-0000-c000-000000000046"); pub const IID_ITypeFactory = &IID_ITypeFactory_Value; pub const ITypeFactory = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateFromTypeInfo: fn( self: *const ITypeFactory, pTypeInfo: ?*ITypeInfo, riid: ?*const Guid, ppv: ?*?*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 ITypeFactory_CreateFromTypeInfo(self: *const T, pTypeInfo: ?*ITypeInfo, riid: ?*const Guid, ppv: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeFactory.VTable, self.vtable).CreateFromTypeInfo(@ptrCast(*const ITypeFactory, self), pTypeInfo, riid, ppv); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ITypeMarshal_Value = Guid.initString("0000002d-0000-0000-c000-000000000046"); pub const IID_ITypeMarshal = &IID_ITypeMarshal_Value; pub const ITypeMarshal = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Size: fn( self: *const ITypeMarshal, pvType: ?*anyopaque, dwDestContext: u32, pvDestContext: ?*anyopaque, pSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Marshal: fn( self: *const ITypeMarshal, pvType: ?*anyopaque, dwDestContext: u32, pvDestContext: ?*anyopaque, cbBufferLength: u32, // TODO: what to do with BytesParamIndex 3? pBuffer: ?*u8, pcbWritten: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unmarshal: fn( self: *const ITypeMarshal, pvType: ?*anyopaque, dwFlags: u32, cbBufferLength: u32, pBuffer: [*:0]u8, pcbRead: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Free: fn( self: *const ITypeMarshal, pvType: ?*anyopaque, ) 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 ITypeMarshal_Size(self: *const T, pvType: ?*anyopaque, dwDestContext: u32, pvDestContext: ?*anyopaque, pSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeMarshal.VTable, self.vtable).Size(@ptrCast(*const ITypeMarshal, self), pvType, dwDestContext, pvDestContext, pSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeMarshal_Marshal(self: *const T, pvType: ?*anyopaque, dwDestContext: u32, pvDestContext: ?*anyopaque, cbBufferLength: u32, pBuffer: ?*u8, pcbWritten: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeMarshal.VTable, self.vtable).Marshal(@ptrCast(*const ITypeMarshal, self), pvType, dwDestContext, pvDestContext, cbBufferLength, pBuffer, pcbWritten); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeMarshal_Unmarshal(self: *const T, pvType: ?*anyopaque, dwFlags: u32, cbBufferLength: u32, pBuffer: [*:0]u8, pcbRead: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeMarshal.VTable, self.vtable).Unmarshal(@ptrCast(*const ITypeMarshal, self), pvType, dwFlags, cbBufferLength, pBuffer, pcbRead); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITypeMarshal_Free(self: *const T, pvType: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const ITypeMarshal.VTable, self.vtable).Free(@ptrCast(*const ITypeMarshal, self), pvType); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRecordInfo_Value = Guid.initString("0000002f-0000-0000-c000-000000000046"); pub const IID_IRecordInfo = &IID_IRecordInfo_Value; pub const IRecordInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, RecordInit: fn( self: *const IRecordInfo, pvNew: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RecordClear: fn( self: *const IRecordInfo, pvExisting: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RecordCopy: fn( self: *const IRecordInfo, pvExisting: ?*anyopaque, pvNew: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGuid: fn( self: *const IRecordInfo, pguid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetName: fn( self: *const IRecordInfo, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSize: fn( self: *const IRecordInfo, pcbSize: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeInfo: fn( self: *const IRecordInfo, ppTypeInfo: ?*?*ITypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetField: fn( self: *const IRecordInfo, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFieldNoCopy: fn( self: *const IRecordInfo, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT, ppvDataCArray: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PutField: fn( self: *const IRecordInfo, wFlags: u32, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PutFieldNoCopy: fn( self: *const IRecordInfo, wFlags: u32, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFieldNames: fn( self: *const IRecordInfo, pcNames: ?*u32, rgBstrNames: [*]?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsMatchingType: fn( self: *const IRecordInfo, pRecordInfo: ?*IRecordInfo, ) callconv(@import("std").os.windows.WINAPI) BOOL, RecordCreate: fn( self: *const IRecordInfo, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque, RecordCreateCopy: fn( self: *const IRecordInfo, pvSource: ?*anyopaque, ppvDest: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RecordDestroy: fn( self: *const IRecordInfo, pvRecord: ?*anyopaque, ) 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 IRecordInfo_RecordInit(self: *const T, pvNew: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).RecordInit(@ptrCast(*const IRecordInfo, self), pvNew); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_RecordClear(self: *const T, pvExisting: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).RecordClear(@ptrCast(*const IRecordInfo, self), pvExisting); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_RecordCopy(self: *const T, pvExisting: ?*anyopaque, pvNew: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).RecordCopy(@ptrCast(*const IRecordInfo, self), pvExisting, pvNew); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_GetGuid(self: *const T, pguid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).GetGuid(@ptrCast(*const IRecordInfo, self), pguid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_GetName(self: *const T, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).GetName(@ptrCast(*const IRecordInfo, self), pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_GetSize(self: *const T, pcbSize: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).GetSize(@ptrCast(*const IRecordInfo, self), pcbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_GetTypeInfo(self: *const T, ppTypeInfo: ?*?*ITypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).GetTypeInfo(@ptrCast(*const IRecordInfo, self), ppTypeInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_GetField(self: *const T, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).GetField(@ptrCast(*const IRecordInfo, self), pvData, szFieldName, pvarField); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_GetFieldNoCopy(self: *const T, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT, ppvDataCArray: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).GetFieldNoCopy(@ptrCast(*const IRecordInfo, self), pvData, szFieldName, pvarField, ppvDataCArray); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_PutField(self: *const T, wFlags: u32, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).PutField(@ptrCast(*const IRecordInfo, self), wFlags, pvData, szFieldName, pvarField); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_PutFieldNoCopy(self: *const T, wFlags: u32, pvData: ?*anyopaque, szFieldName: ?[*:0]const u16, pvarField: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).PutFieldNoCopy(@ptrCast(*const IRecordInfo, self), wFlags, pvData, szFieldName, pvarField); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_GetFieldNames(self: *const T, pcNames: ?*u32, rgBstrNames: [*]?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).GetFieldNames(@ptrCast(*const IRecordInfo, self), pcNames, rgBstrNames); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_IsMatchingType(self: *const T, pRecordInfo: ?*IRecordInfo) callconv(.Inline) BOOL { return @ptrCast(*const IRecordInfo.VTable, self.vtable).IsMatchingType(@ptrCast(*const IRecordInfo, self), pRecordInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_RecordCreate(self: *const T) callconv(.Inline) ?*anyopaque { return @ptrCast(*const IRecordInfo.VTable, self.vtable).RecordCreate(@ptrCast(*const IRecordInfo, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_RecordCreateCopy(self: *const T, pvSource: ?*anyopaque, ppvDest: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).RecordCreateCopy(@ptrCast(*const IRecordInfo, self), pvSource, ppvDest); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRecordInfo_RecordDestroy(self: *const T, pvRecord: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IRecordInfo.VTable, self.vtable).RecordDestroy(@ptrCast(*const IRecordInfo, self), pvRecord); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleAdviseHolder_Value = Guid.initString("00000111-0000-0000-c000-000000000046"); pub const IID_IOleAdviseHolder = &IID_IOleAdviseHolder_Value; pub const IOleAdviseHolder = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Advise: fn( self: *const IOleAdviseHolder, pAdvise: ?*IAdviseSink, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IOleAdviseHolder, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumAdvise: fn( self: *const IOleAdviseHolder, ppenumAdvise: ?*?*IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendOnRename: fn( self: *const IOleAdviseHolder, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendOnSave: fn( self: *const IOleAdviseHolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendOnClose: fn( self: *const IOleAdviseHolder, ) 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 IOleAdviseHolder_Advise(self: *const T, pAdvise: ?*IAdviseSink, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).Advise(@ptrCast(*const IOleAdviseHolder, self), pAdvise, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_Unadvise(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).Unadvise(@ptrCast(*const IOleAdviseHolder, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_EnumAdvise(self: *const T, ppenumAdvise: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).EnumAdvise(@ptrCast(*const IOleAdviseHolder, self), ppenumAdvise); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_SendOnRename(self: *const T, pmk: ?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).SendOnRename(@ptrCast(*const IOleAdviseHolder, self), pmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_SendOnSave(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).SendOnSave(@ptrCast(*const IOleAdviseHolder, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleAdviseHolder_SendOnClose(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleAdviseHolder.VTable, self.vtable).SendOnClose(@ptrCast(*const IOleAdviseHolder, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCache_Value = Guid.initString("0000011e-0000-0000-c000-000000000046"); pub const IID_IOleCache = &IID_IOleCache_Value; pub const IOleCache = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Cache: fn( self: *const IOleCache, pformatetc: ?*FORMATETC, advf: u32, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Uncache: fn( self: *const IOleCache, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumCache: fn( self: *const IOleCache, ppenumSTATDATA: ?*?*IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitCache: fn( self: *const IOleCache, pDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetData: fn( self: *const IOleCache, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM, fRelease: 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 IOleCache_Cache(self: *const T, pformatetc: ?*FORMATETC, advf: u32, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).Cache(@ptrCast(*const IOleCache, self), pformatetc, advf, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_Uncache(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).Uncache(@ptrCast(*const IOleCache, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_EnumCache(self: *const T, ppenumSTATDATA: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).EnumCache(@ptrCast(*const IOleCache, self), ppenumSTATDATA); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_InitCache(self: *const T, pDataObject: ?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).InitCache(@ptrCast(*const IOleCache, self), pDataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache_SetData(self: *const T, pformatetc: ?*FORMATETC, pmedium: ?*STGMEDIUM, fRelease: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache.VTable, self.vtable).SetData(@ptrCast(*const IOleCache, self), pformatetc, pmedium, fRelease); } };} pub usingnamespace MethodMixin(@This()); }; pub const DISCARDCACHE = enum(i32) { SAVEIFDIRTY = 0, NOSAVE = 1, }; pub const DISCARDCACHE_SAVEIFDIRTY = DISCARDCACHE.SAVEIFDIRTY; pub const DISCARDCACHE_NOSAVE = DISCARDCACHE.NOSAVE; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCache2_Value = Guid.initString("00000128-0000-0000-c000-000000000046"); pub const IID_IOleCache2 = &IID_IOleCache2_Value; pub const IOleCache2 = extern struct { pub const VTable = extern struct { base: IOleCache.VTable, UpdateCache: fn( self: *const IOleCache2, pDataObject: ?*IDataObject, grfUpdf: UPDFCACHE_FLAGS, pReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DiscardCache: fn( self: *const IOleCache2, dwDiscardOptions: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleCache.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache2_UpdateCache(self: *const T, pDataObject: ?*IDataObject, grfUpdf: UPDFCACHE_FLAGS, pReserved: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache2.VTable, self.vtable).UpdateCache(@ptrCast(*const IOleCache2, self), pDataObject, grfUpdf, pReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCache2_DiscardCache(self: *const T, dwDiscardOptions: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCache2.VTable, self.vtable).DiscardCache(@ptrCast(*const IOleCache2, self), dwDiscardOptions); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCacheControl_Value = Guid.initString("00000129-0000-0000-c000-000000000046"); pub const IID_IOleCacheControl = &IID_IOleCacheControl_Value; pub const IOleCacheControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnRun: fn( self: *const IOleCacheControl, pDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnStop: fn( self: *const IOleCacheControl, ) 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 IOleCacheControl_OnRun(self: *const T, pDataObject: ?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCacheControl.VTable, self.vtable).OnRun(@ptrCast(*const IOleCacheControl, self), pDataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCacheControl_OnStop(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCacheControl.VTable, self.vtable).OnStop(@ptrCast(*const IOleCacheControl, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IParseDisplayName_Value = Guid.initString("0000011a-0000-0000-c000-000000000046"); pub const IID_IParseDisplayName = &IID_IParseDisplayName_Value; pub const IParseDisplayName = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ParseDisplayName: fn( self: *const IParseDisplayName, pbc: ?*IBindCtx, pszDisplayName: ?PWSTR, pchEaten: ?*u32, ppmkOut: ?*?*IMoniker, ) 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 IParseDisplayName_ParseDisplayName(self: *const T, pbc: ?*IBindCtx, pszDisplayName: ?PWSTR, pchEaten: ?*u32, ppmkOut: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IParseDisplayName.VTable, self.vtable).ParseDisplayName(@ptrCast(*const IParseDisplayName, self), pbc, pszDisplayName, pchEaten, ppmkOut); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleContainer_Value = Guid.initString("0000011b-0000-0000-c000-000000000046"); pub const IID_IOleContainer = &IID_IOleContainer_Value; pub const IOleContainer = extern struct { pub const VTable = extern struct { base: IParseDisplayName.VTable, EnumObjects: fn( self: *const IOleContainer, grfFlags: u32, ppenum: ?*?*IEnumUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockContainer: fn( self: *const IOleContainer, fLock: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IParseDisplayName.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleContainer_EnumObjects(self: *const T, grfFlags: u32, ppenum: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IOleContainer.VTable, self.vtable).EnumObjects(@ptrCast(*const IOleContainer, self), grfFlags, ppenum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleContainer_LockContainer(self: *const T, fLock: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleContainer.VTable, self.vtable).LockContainer(@ptrCast(*const IOleContainer, self), fLock); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleClientSite_Value = Guid.initString("00000118-0000-0000-c000-000000000046"); pub const IID_IOleClientSite = &IID_IOleClientSite_Value; pub const IOleClientSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SaveObject: fn( self: *const IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMoniker: fn( self: *const IOleClientSite, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContainer: fn( self: *const IOleClientSite, ppContainer: ?*?*IOleContainer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ShowObject: fn( self: *const IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnShowWindow: fn( self: *const IOleClientSite, fShow: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestNewObjectLayout: fn( self: *const IOleClientSite, ) 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 IOleClientSite_SaveObject(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).SaveObject(@ptrCast(*const IOleClientSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_GetMoniker(self: *const T, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).GetMoniker(@ptrCast(*const IOleClientSite, self), dwAssign, dwWhichMoniker, ppmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_GetContainer(self: *const T, ppContainer: ?*?*IOleContainer) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).GetContainer(@ptrCast(*const IOleClientSite, self), ppContainer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_ShowObject(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).ShowObject(@ptrCast(*const IOleClientSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_OnShowWindow(self: *const T, fShow: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).OnShowWindow(@ptrCast(*const IOleClientSite, self), fShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleClientSite_RequestNewObjectLayout(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleClientSite.VTable, self.vtable).RequestNewObjectLayout(@ptrCast(*const IOleClientSite, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEGETMONIKER = enum(i32) { ONLYIFTHERE = 1, FORCEASSIGN = 2, UNASSIGN = 3, TEMPFORUSER = 4, }; pub const OLEGETMONIKER_ONLYIFTHERE = OLEGETMONIKER.ONLYIFTHERE; pub const OLEGETMONIKER_FORCEASSIGN = OLEGETMONIKER.FORCEASSIGN; pub const OLEGETMONIKER_UNASSIGN = OLEGETMONIKER.UNASSIGN; pub const OLEGETMONIKER_TEMPFORUSER = OLEGETMONIKER.TEMPFORUSER; pub const OLEWHICHMK = enum(i32) { CONTAINER = 1, OBJREL = 2, OBJFULL = 3, }; pub const OLEWHICHMK_CONTAINER = OLEWHICHMK.CONTAINER; pub const OLEWHICHMK_OBJREL = OLEWHICHMK.OBJREL; pub const OLEWHICHMK_OBJFULL = OLEWHICHMK.OBJFULL; pub const USERCLASSTYPE = enum(i32) { FULL = 1, SHORT = 2, APPNAME = 3, }; pub const USERCLASSTYPE_FULL = USERCLASSTYPE.FULL; pub const USERCLASSTYPE_SHORT = USERCLASSTYPE.SHORT; pub const USERCLASSTYPE_APPNAME = USERCLASSTYPE.APPNAME; pub const OLEMISC = enum(i32) { RECOMPOSEONRESIZE = 1, ONLYICONIC = 2, INSERTNOTREPLACE = 4, STATIC = 8, CANTLINKINSIDE = 16, CANLINKBYOLE1 = 32, ISLINKOBJECT = 64, INSIDEOUT = 128, ACTIVATEWHENVISIBLE = 256, RENDERINGISDEVICEINDEPENDENT = 512, INVISIBLEATRUNTIME = 1024, ALWAYSRUN = 2048, ACTSLIKEBUTTON = 4096, ACTSLIKELABEL = 8192, NOUIACTIVATE = 16384, ALIGNABLE = 32768, SIMPLEFRAME = 65536, SETCLIENTSITEFIRST = 131072, IMEMODE = 262144, IGNOREACTIVATEWHENVISIBLE = 524288, WANTSTOMENUMERGE = 1048576, SUPPORTSMULTILEVELUNDO = 2097152, }; // TODO: enum 'OLEMISC' has known issues with its value aliases pub const OLECLOSE = enum(i32) { SAVEIFDIRTY = 0, NOSAVE = 1, PROMPTSAVE = 2, }; pub const OLECLOSE_SAVEIFDIRTY = OLECLOSE.SAVEIFDIRTY; pub const OLECLOSE_NOSAVE = OLECLOSE.NOSAVE; pub const OLECLOSE_PROMPTSAVE = OLECLOSE.PROMPTSAVE; // TODO: this type is limited to platform 'windows5.0' const IID_IOleObject_Value = Guid.initString("00000112-0000-0000-c000-000000000046"); pub const IID_IOleObject = &IID_IOleObject_Value; pub const IOleObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetClientSite: fn( self: *const IOleObject, pClientSite: ?*IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetClientSite: fn( self: *const IOleObject, ppClientSite: ?*?*IOleClientSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHostNames: fn( self: *const IOleObject, szContainerApp: ?[*:0]const u16, szContainerObj: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IOleObject, dwSaveOption: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMoniker: fn( self: *const IOleObject, dwWhichMoniker: u32, pmk: ?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMoniker: fn( self: *const IOleObject, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InitFromData: fn( self: *const IOleObject, pDataObject: ?*IDataObject, fCreation: BOOL, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetClipboardData: fn( self: *const IOleObject, dwReserved: u32, ppDataObject: ?*?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DoVerb: fn( self: *const IOleObject, iVerb: i32, lpmsg: ?*MSG, pActiveSite: ?*IOleClientSite, lindex: i32, hwndParent: ?HWND, lprcPosRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumVerbs: fn( self: *const IOleObject, ppEnumOleVerb: ?*?*IEnumOLEVERB, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Update: fn( self: *const IOleObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsUpToDate: fn( self: *const IOleObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserClassID: fn( self: *const IOleObject, pClsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserType: fn( self: *const IOleObject, dwFormOfType: u32, pszUserType: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetExtent: fn( self: *const IOleObject, dwDrawAspect: u32, psizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExtent: fn( self: *const IOleObject, dwDrawAspect: u32, psizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Advise: fn( self: *const IOleObject, pAdvSink: ?*IAdviseSink, pdwConnection: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unadvise: fn( self: *const IOleObject, dwConnection: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumAdvise: fn( self: *const IOleObject, ppenumAdvise: ?*?*IEnumSTATDATA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMiscStatus: fn( self: *const IOleObject, dwAspect: u32, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetColorScheme: fn( self: *const IOleObject, pLogpal: ?*LOGPALETTE, ) 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 IOleObject_SetClientSite(self: *const T, pClientSite: ?*IOleClientSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetClientSite(@ptrCast(*const IOleObject, self), pClientSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetClientSite(self: *const T, ppClientSite: ?*?*IOleClientSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetClientSite(@ptrCast(*const IOleObject, self), ppClientSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetHostNames(self: *const T, szContainerApp: ?[*:0]const u16, szContainerObj: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetHostNames(@ptrCast(*const IOleObject, self), szContainerApp, szContainerObj); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Close(self: *const T, dwSaveOption: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Close(@ptrCast(*const IOleObject, self), dwSaveOption); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetMoniker(self: *const T, dwWhichMoniker: u32, pmk: ?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetMoniker(@ptrCast(*const IOleObject, self), dwWhichMoniker, pmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetMoniker(self: *const T, dwAssign: u32, dwWhichMoniker: u32, ppmk: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetMoniker(@ptrCast(*const IOleObject, self), dwAssign, dwWhichMoniker, ppmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_InitFromData(self: *const T, pDataObject: ?*IDataObject, fCreation: BOOL, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).InitFromData(@ptrCast(*const IOleObject, self), pDataObject, fCreation, dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetClipboardData(self: *const T, dwReserved: u32, ppDataObject: ?*?*IDataObject) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetClipboardData(@ptrCast(*const IOleObject, self), dwReserved, ppDataObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_DoVerb(self: *const T, iVerb: i32, lpmsg: ?*MSG, pActiveSite: ?*IOleClientSite, lindex: i32, hwndParent: ?HWND, lprcPosRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).DoVerb(@ptrCast(*const IOleObject, self), iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_EnumVerbs(self: *const T, ppEnumOleVerb: ?*?*IEnumOLEVERB) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).EnumVerbs(@ptrCast(*const IOleObject, self), ppEnumOleVerb); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Update(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Update(@ptrCast(*const IOleObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_IsUpToDate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).IsUpToDate(@ptrCast(*const IOleObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetUserClassID(self: *const T, pClsid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetUserClassID(@ptrCast(*const IOleObject, self), pClsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetUserType(self: *const T, dwFormOfType: u32, pszUserType: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetUserType(@ptrCast(*const IOleObject, self), dwFormOfType, pszUserType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetExtent(self: *const T, dwDrawAspect: u32, psizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetExtent(@ptrCast(*const IOleObject, self), dwDrawAspect, psizel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetExtent(self: *const T, dwDrawAspect: u32, psizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetExtent(@ptrCast(*const IOleObject, self), dwDrawAspect, psizel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Advise(self: *const T, pAdvSink: ?*IAdviseSink, pdwConnection: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Advise(@ptrCast(*const IOleObject, self), pAdvSink, pdwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_Unadvise(self: *const T, dwConnection: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).Unadvise(@ptrCast(*const IOleObject, self), dwConnection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_EnumAdvise(self: *const T, ppenumAdvise: ?*?*IEnumSTATDATA) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).EnumAdvise(@ptrCast(*const IOleObject, self), ppenumAdvise); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_GetMiscStatus(self: *const T, dwAspect: u32, pdwStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).GetMiscStatus(@ptrCast(*const IOleObject, self), dwAspect, pdwStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleObject_SetColorScheme(self: *const T, pLogpal: ?*LOGPALETTE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleObject.VTable, self.vtable).SetColorScheme(@ptrCast(*const IOleObject, self), pLogpal); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLERENDER = enum(i32) { NONE = 0, DRAW = 1, FORMAT = 2, ASIS = 3, }; pub const OLERENDER_NONE = OLERENDER.NONE; pub const OLERENDER_DRAW = OLERENDER.DRAW; pub const OLERENDER_FORMAT = OLERENDER.FORMAT; pub const OLERENDER_ASIS = OLERENDER.ASIS; pub const OBJECTDESCRIPTOR = extern struct { cbSize: u32, clsid: Guid, dwDrawAspect: u32, sizel: SIZE, pointl: POINTL, dwStatus: u32, dwFullUserTypeName: u32, dwSrcOfCopy: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleWindow_Value = Guid.initString("00000114-0000-0000-c000-000000000046"); pub const IID_IOleWindow = &IID_IOleWindow_Value; pub const IOleWindow = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetWindow: fn( self: *const IOleWindow, phwnd: ?*?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ContextSensitiveHelp: fn( self: *const IOleWindow, fEnterMode: 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 IOleWindow_GetWindow(self: *const T, phwnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IOleWindow.VTable, self.vtable).GetWindow(@ptrCast(*const IOleWindow, self), phwnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleWindow_ContextSensitiveHelp(self: *const T, fEnterMode: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleWindow.VTable, self.vtable).ContextSensitiveHelp(@ptrCast(*const IOleWindow, self), fEnterMode); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEUPDATE = enum(i32) { ALWAYS = 1, ONCALL = 3, }; pub const OLEUPDATE_ALWAYS = OLEUPDATE.ALWAYS; pub const OLEUPDATE_ONCALL = OLEUPDATE.ONCALL; pub const OLELINKBIND = enum(i32) { F = 1, }; pub const OLELINKBIND_EVENIFCLASSDIFF = OLELINKBIND.F; // TODO: this type is limited to platform 'windows5.0' const IID_IOleLink_Value = Guid.initString("0000011d-0000-0000-c000-000000000046"); pub const IID_IOleLink = &IID_IOleLink_Value; pub const IOleLink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetUpdateOptions: fn( self: *const IOleLink, dwUpdateOpt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUpdateOptions: fn( self: *const IOleLink, pdwUpdateOpt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSourceMoniker: fn( self: *const IOleLink, pmk: ?*IMoniker, rclsid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceMoniker: fn( self: *const IOleLink, ppmk: ?*?*IMoniker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetSourceDisplayName: fn( self: *const IOleLink, pszStatusText: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSourceDisplayName: fn( self: *const IOleLink, ppszDisplayName: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BindToSource: fn( self: *const IOleLink, bindflags: u32, pbc: ?*IBindCtx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BindIfRunning: fn( self: *const IOleLink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoundSource: fn( self: *const IOleLink, ppunk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UnbindSource: fn( self: *const IOleLink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Update: fn( self: *const IOleLink, pbc: ?*IBindCtx, ) 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 IOleLink_SetUpdateOptions(self: *const T, dwUpdateOpt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).SetUpdateOptions(@ptrCast(*const IOleLink, self), dwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetUpdateOptions(self: *const T, pdwUpdateOpt: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetUpdateOptions(@ptrCast(*const IOleLink, self), pdwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_SetSourceMoniker(self: *const T, pmk: ?*IMoniker, rclsid: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).SetSourceMoniker(@ptrCast(*const IOleLink, self), pmk, rclsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetSourceMoniker(self: *const T, ppmk: ?*?*IMoniker) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetSourceMoniker(@ptrCast(*const IOleLink, self), ppmk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_SetSourceDisplayName(self: *const T, pszStatusText: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).SetSourceDisplayName(@ptrCast(*const IOleLink, self), pszStatusText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetSourceDisplayName(self: *const T, ppszDisplayName: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetSourceDisplayName(@ptrCast(*const IOleLink, self), ppszDisplayName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_BindToSource(self: *const T, bindflags: u32, pbc: ?*IBindCtx) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).BindToSource(@ptrCast(*const IOleLink, self), bindflags, pbc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_BindIfRunning(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).BindIfRunning(@ptrCast(*const IOleLink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_GetBoundSource(self: *const T, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).GetBoundSource(@ptrCast(*const IOleLink, self), ppunk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_UnbindSource(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).UnbindSource(@ptrCast(*const IOleLink, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleLink_Update(self: *const T, pbc: ?*IBindCtx) callconv(.Inline) HRESULT { return @ptrCast(*const IOleLink.VTable, self.vtable).Update(@ptrCast(*const IOleLink, self), pbc); } };} pub usingnamespace MethodMixin(@This()); }; pub const BINDSPEED = enum(i32) { INDEFINITE = 1, MODERATE = 2, IMMEDIATE = 3, }; pub const BINDSPEED_INDEFINITE = BINDSPEED.INDEFINITE; pub const BINDSPEED_MODERATE = BINDSPEED.MODERATE; pub const BINDSPEED_IMMEDIATE = BINDSPEED.IMMEDIATE; pub const OLECONTF = enum(i32) { EMBEDDINGS = 1, LINKS = 2, OTHERS = 4, ONLYUSER = 8, ONLYIFRUNNING = 16, }; pub const OLECONTF_EMBEDDINGS = OLECONTF.EMBEDDINGS; pub const OLECONTF_LINKS = OLECONTF.LINKS; pub const OLECONTF_OTHERS = OLECONTF.OTHERS; pub const OLECONTF_ONLYUSER = OLECONTF.ONLYUSER; pub const OLECONTF_ONLYIFRUNNING = OLECONTF.ONLYIFRUNNING; // TODO: this type is limited to platform 'windows5.0' const IID_IOleItemContainer_Value = Guid.initString("0000011c-0000-0000-c000-000000000046"); pub const IID_IOleItemContainer = &IID_IOleItemContainer_Value; pub const IOleItemContainer = extern struct { pub const VTable = extern struct { base: IOleContainer.VTable, GetObject: fn( self: *const IOleItemContainer, pszItem: ?PWSTR, dwSpeedNeeded: u32, pbc: ?*IBindCtx, riid: ?*const Guid, ppvObject: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectStorage: fn( self: *const IOleItemContainer, pszItem: ?PWSTR, pbc: ?*IBindCtx, riid: ?*const Guid, ppvStorage: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsRunning: fn( self: *const IOleItemContainer, pszItem: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleContainer.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleItemContainer_GetObject(self: *const T, pszItem: ?PWSTR, dwSpeedNeeded: u32, pbc: ?*IBindCtx, riid: ?*const Guid, ppvObject: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IOleItemContainer.VTable, self.vtable).GetObject(@ptrCast(*const IOleItemContainer, self), pszItem, dwSpeedNeeded, pbc, riid, ppvObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleItemContainer_GetObjectStorage(self: *const T, pszItem: ?PWSTR, pbc: ?*IBindCtx, riid: ?*const Guid, ppvStorage: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IOleItemContainer.VTable, self.vtable).GetObjectStorage(@ptrCast(*const IOleItemContainer, self), pszItem, pbc, riid, ppvStorage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleItemContainer_IsRunning(self: *const T, pszItem: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleItemContainer.VTable, self.vtable).IsRunning(@ptrCast(*const IOleItemContainer, self), pszItem); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceUIWindow_Value = Guid.initString("00000115-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceUIWindow = &IID_IOleInPlaceUIWindow_Value; pub const IOleInPlaceUIWindow = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, GetBorder: fn( self: *const IOleInPlaceUIWindow, lprectBorder: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestBorderSpace: fn( self: *const IOleInPlaceUIWindow, pborderwidths: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBorderSpace: fn( self: *const IOleInPlaceUIWindow, pborderwidths: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetActiveObject: fn( self: *const IOleInPlaceUIWindow, pActiveObject: ?*IOleInPlaceActiveObject, pszObjName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_GetBorder(self: *const T, lprectBorder: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).GetBorder(@ptrCast(*const IOleInPlaceUIWindow, self), lprectBorder); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_RequestBorderSpace(self: *const T, pborderwidths: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).RequestBorderSpace(@ptrCast(*const IOleInPlaceUIWindow, self), pborderwidths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_SetBorderSpace(self: *const T, pborderwidths: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).SetBorderSpace(@ptrCast(*const IOleInPlaceUIWindow, self), pborderwidths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceUIWindow_SetActiveObject(self: *const T, pActiveObject: ?*IOleInPlaceActiveObject, pszObjName: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceUIWindow.VTable, self.vtable).SetActiveObject(@ptrCast(*const IOleInPlaceUIWindow, self), pActiveObject, pszObjName); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceActiveObject_Value = Guid.initString("00000117-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceActiveObject = &IID_IOleInPlaceActiveObject_Value; pub const IOleInPlaceActiveObject = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, TranslateAccelerator: fn( self: *const IOleInPlaceActiveObject, lpmsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnFrameWindowActivate: fn( self: *const IOleInPlaceActiveObject, fActivate: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDocWindowActivate: fn( self: *const IOleInPlaceActiveObject, fActivate: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ResizeBorder: fn( self: *const IOleInPlaceActiveObject, prcBorder: ?*RECT, pUIWindow: ?*IOleInPlaceUIWindow, fFrameWindow: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableModeless: fn( self: *const IOleInPlaceActiveObject, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_TranslateAccelerator(self: *const T, lpmsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IOleInPlaceActiveObject, self), lpmsg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_OnFrameWindowActivate(self: *const T, fActivate: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).OnFrameWindowActivate(@ptrCast(*const IOleInPlaceActiveObject, self), fActivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_OnDocWindowActivate(self: *const T, fActivate: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).OnDocWindowActivate(@ptrCast(*const IOleInPlaceActiveObject, self), fActivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_ResizeBorder(self: *const T, prcBorder: ?*RECT, pUIWindow: ?*IOleInPlaceUIWindow, fFrameWindow: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).ResizeBorder(@ptrCast(*const IOleInPlaceActiveObject, self), prcBorder, pUIWindow, fFrameWindow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceActiveObject_EnableModeless(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceActiveObject.VTable, self.vtable).EnableModeless(@ptrCast(*const IOleInPlaceActiveObject, self), fEnable); } };} pub usingnamespace MethodMixin(@This()); }; pub const OIFI = extern struct { cb: u32, fMDIApp: BOOL, hwndFrame: ?HWND, haccel: ?HACCEL, cAccelEntries: u32, }; pub const OleMenuGroupWidths = extern struct { width: [6]i32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceFrame_Value = Guid.initString("00000116-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceFrame = &IID_IOleInPlaceFrame_Value; pub const IOleInPlaceFrame = extern struct { pub const VTable = extern struct { base: IOleInPlaceUIWindow.VTable, InsertMenus: fn( self: *const IOleInPlaceFrame, hmenuShared: ?HMENU, lpMenuWidths: ?*OleMenuGroupWidths, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMenu: fn( self: *const IOleInPlaceFrame, hmenuShared: ?HMENU, holemenu: isize, hwndActiveObject: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveMenus: fn( self: *const IOleInPlaceFrame, hmenuShared: ?HMENU, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetStatusText: fn( self: *const IOleInPlaceFrame, pszStatusText: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnableModeless: fn( self: *const IOleInPlaceFrame, fEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IOleInPlaceFrame, lpmsg: ?*MSG, wID: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceUIWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_InsertMenus(self: *const T, hmenuShared: ?HMENU, lpMenuWidths: ?*OleMenuGroupWidths) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).InsertMenus(@ptrCast(*const IOleInPlaceFrame, self), hmenuShared, lpMenuWidths); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_SetMenu(self: *const T, hmenuShared: ?HMENU, holemenu: isize, hwndActiveObject: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).SetMenu(@ptrCast(*const IOleInPlaceFrame, self), hmenuShared, holemenu, hwndActiveObject); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_RemoveMenus(self: *const T, hmenuShared: ?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).RemoveMenus(@ptrCast(*const IOleInPlaceFrame, self), hmenuShared); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_SetStatusText(self: *const T, pszStatusText: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).SetStatusText(@ptrCast(*const IOleInPlaceFrame, self), pszStatusText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_EnableModeless(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).EnableModeless(@ptrCast(*const IOleInPlaceFrame, self), fEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceFrame_TranslateAccelerator(self: *const T, lpmsg: ?*MSG, wID: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceFrame.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IOleInPlaceFrame, self), lpmsg, wID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceObject_Value = Guid.initString("00000113-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceObject = &IID_IOleInPlaceObject_Value; pub const IOleInPlaceObject = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, InPlaceDeactivate: fn( self: *const IOleInPlaceObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UIDeactivate: fn( self: *const IOleInPlaceObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetObjectRects: fn( self: *const IOleInPlaceObject, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReactivateAndUndo: fn( self: *const IOleInPlaceObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_InPlaceDeactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).InPlaceDeactivate(@ptrCast(*const IOleInPlaceObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_UIDeactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).UIDeactivate(@ptrCast(*const IOleInPlaceObject, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_SetObjectRects(self: *const T, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).SetObjectRects(@ptrCast(*const IOleInPlaceObject, self), lprcPosRect, lprcClipRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObject_ReactivateAndUndo(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObject.VTable, self.vtable).ReactivateAndUndo(@ptrCast(*const IOleInPlaceObject, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceSite_Value = Guid.initString("00000119-0000-0000-c000-000000000046"); pub const IID_IOleInPlaceSite = &IID_IOleInPlaceSite_Value; pub const IOleInPlaceSite = extern struct { pub const VTable = extern struct { base: IOleWindow.VTable, CanInPlaceActivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInPlaceActivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnUIActivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetWindowContext: fn( self: *const IOleInPlaceSite, ppFrame: ?*?*IOleInPlaceFrame, ppDoc: ?*?*IOleInPlaceUIWindow, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT, lpFrameInfo: ?*OIFI, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Scroll: fn( self: *const IOleInPlaceSite, scrollExtant: SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnUIDeactivate: fn( self: *const IOleInPlaceSite, fUndoable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInPlaceDeactivate: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DiscardUndoState: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeactivateAndUndo: fn( self: *const IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnPosRectChange: fn( self: *const IOleInPlaceSite, lprcPosRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleWindow.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_CanInPlaceActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).CanInPlaceActivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnInPlaceActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnInPlaceActivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnUIActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnUIActivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_GetWindowContext(self: *const T, ppFrame: ?*?*IOleInPlaceFrame, ppDoc: ?*?*IOleInPlaceUIWindow, lprcPosRect: ?*RECT, lprcClipRect: ?*RECT, lpFrameInfo: ?*OIFI) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).GetWindowContext(@ptrCast(*const IOleInPlaceSite, self), ppFrame, ppDoc, lprcPosRect, lprcClipRect, lpFrameInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_Scroll(self: *const T, scrollExtant: SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).Scroll(@ptrCast(*const IOleInPlaceSite, self), scrollExtant); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnUIDeactivate(self: *const T, fUndoable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnUIDeactivate(@ptrCast(*const IOleInPlaceSite, self), fUndoable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnInPlaceDeactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnInPlaceDeactivate(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_DiscardUndoState(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).DiscardUndoState(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_DeactivateAndUndo(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).DeactivateAndUndo(@ptrCast(*const IOleInPlaceSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSite_OnPosRectChange(self: *const T, lprcPosRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSite.VTable, self.vtable).OnPosRectChange(@ptrCast(*const IOleInPlaceSite, self), lprcPosRect); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IContinue_Value = Guid.initString("0000012a-0000-0000-c000-000000000046"); pub const IID_IContinue = &IID_IContinue_Value; pub const IContinue = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, FContinue: fn( self: *const IContinue, ) 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 IContinue_FContinue(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IContinue.VTable, self.vtable).FContinue(@ptrCast(*const IContinue, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IViewObject_Value = Guid.initString("0000010d-0000-0000-c000-000000000046"); pub const IID_IViewObject = &IID_IViewObject_Value; pub const IViewObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Draw: fn( self: *const IViewObject, dwDrawAspect: u32, lindex: i32, pvAspect: ?*anyopaque, ptd: ?*DVTARGETDEVICE, hdcTargetDev: ?HDC, hdcDraw: ?HDC, lprcBounds: ?*RECTL, lprcWBounds: ?*RECTL, pfnContinue: isize, dwContinue: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetColorSet: fn( self: *const IViewObject, dwDrawAspect: u32, lindex: i32, pvAspect: ?*anyopaque, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, ppColorSet: ?*?*LOGPALETTE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Freeze: fn( self: *const IViewObject, dwDrawAspect: u32, lindex: i32, pvAspect: ?*anyopaque, pdwFreeze: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unfreeze: fn( self: *const IViewObject, dwFreeze: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetAdvise: fn( self: *const IViewObject, aspects: u32, advf: u32, pAdvSink: ?*IAdviseSink, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAdvise: fn( self: *const IViewObject, pAspects: ?*u32, pAdvf: ?*u32, ppAdvSink: ?*?*IAdviseSink, ) 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 IViewObject_Draw(self: *const T, dwDrawAspect: u32, lindex: i32, pvAspect: ?*anyopaque, ptd: ?*DVTARGETDEVICE, hdcTargetDev: ?HDC, hdcDraw: ?HDC, lprcBounds: ?*RECTL, lprcWBounds: ?*RECTL, pfnContinue: isize, dwContinue: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).Draw(@ptrCast(*const IViewObject, self), dwDrawAspect, lindex, pvAspect, ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_GetColorSet(self: *const T, dwDrawAspect: u32, lindex: i32, pvAspect: ?*anyopaque, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, ppColorSet: ?*?*LOGPALETTE) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).GetColorSet(@ptrCast(*const IViewObject, self), dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_Freeze(self: *const T, dwDrawAspect: u32, lindex: i32, pvAspect: ?*anyopaque, pdwFreeze: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).Freeze(@ptrCast(*const IViewObject, self), dwDrawAspect, lindex, pvAspect, pdwFreeze); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_Unfreeze(self: *const T, dwFreeze: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).Unfreeze(@ptrCast(*const IViewObject, self), dwFreeze); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_SetAdvise(self: *const T, aspects: u32, advf: u32, pAdvSink: ?*IAdviseSink) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).SetAdvise(@ptrCast(*const IViewObject, self), aspects, advf, pAdvSink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject_GetAdvise(self: *const T, pAspects: ?*u32, pAdvf: ?*u32, ppAdvSink: ?*?*IAdviseSink) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject.VTable, self.vtable).GetAdvise(@ptrCast(*const IViewObject, self), pAspects, pAdvf, ppAdvSink); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IViewObject2_Value = Guid.initString("00000127-0000-0000-c000-000000000046"); pub const IID_IViewObject2 = &IID_IViewObject2_Value; pub const IViewObject2 = extern struct { pub const VTable = extern struct { base: IViewObject.VTable, GetExtent: fn( self: *const IViewObject2, dwDrawAspect: u32, lindex: i32, ptd: ?*DVTARGETDEVICE, lpsizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IViewObject.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObject2_GetExtent(self: *const T, dwDrawAspect: u32, lindex: i32, ptd: ?*DVTARGETDEVICE, lpsizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObject2.VTable, self.vtable).GetExtent(@ptrCast(*const IViewObject2, self), dwDrawAspect, lindex, ptd, lpsizel); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IDropSource_Value = Guid.initString("00000121-0000-0000-c000-000000000046"); pub const IID_IDropSource = &IID_IDropSource_Value; pub const IDropSource = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryContinueDrag: fn( self: *const IDropSource, fEscapePressed: BOOL, grfKeyState: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GiveFeedback: fn( self: *const IDropSource, dwEffect: 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 IDropSource_QueryContinueDrag(self: *const T, fEscapePressed: BOOL, grfKeyState: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSource.VTable, self.vtable).QueryContinueDrag(@ptrCast(*const IDropSource, self), fEscapePressed, grfKeyState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropSource_GiveFeedback(self: *const T, dwEffect: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSource.VTable, self.vtable).GiveFeedback(@ptrCast(*const IDropSource, self), dwEffect); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IDropTarget_Value = Guid.initString("00000122-0000-0000-c000-000000000046"); pub const IID_IDropTarget = &IID_IDropTarget_Value; pub const IDropTarget = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, DragEnter: fn( self: *const IDropTarget, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DragOver: fn( self: *const IDropTarget, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DragLeave: fn( self: *const IDropTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Drop: fn( self: *const IDropTarget, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*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 IDropTarget_DragEnter(self: *const T, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).DragEnter(@ptrCast(*const IDropTarget, self), pDataObj, grfKeyState, pt, pdwEffect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropTarget_DragOver(self: *const T, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).DragOver(@ptrCast(*const IDropTarget, self), grfKeyState, pt, pdwEffect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropTarget_DragLeave(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).DragLeave(@ptrCast(*const IDropTarget, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropTarget_Drop(self: *const T, pDataObj: ?*IDataObject, grfKeyState: u32, pt: POINTL, pdwEffect: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDropTarget.VTable, self.vtable).Drop(@ptrCast(*const IDropTarget, self), pDataObj, grfKeyState, pt, pdwEffect); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows6.0.6000' const IID_IDropSourceNotify_Value = Guid.initString("0000012b-0000-0000-c000-000000000046"); pub const IID_IDropSourceNotify = &IID_IDropSourceNotify_Value; pub const IDropSourceNotify = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, DragEnterTarget: fn( self: *const IDropSourceNotify, hwndTarget: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DragLeaveTarget: fn( self: *const IDropSourceNotify, ) 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 IDropSourceNotify_DragEnterTarget(self: *const T, hwndTarget: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSourceNotify.VTable, self.vtable).DragEnterTarget(@ptrCast(*const IDropSourceNotify, self), hwndTarget); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDropSourceNotify_DragLeaveTarget(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDropSourceNotify.VTable, self.vtable).DragLeaveTarget(@ptrCast(*const IDropSourceNotify, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows10.0.10240' const IID_IEnterpriseDropTarget_Value = Guid.initString("390e3878-fd55-4e18-819d-4682081c0cfd"); pub const IID_IEnterpriseDropTarget = &IID_IEnterpriseDropTarget_Value; pub const IEnterpriseDropTarget = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetDropSourceEnterpriseId: fn( self: *const IEnterpriseDropTarget, identity: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEvaluatingEdpPolicy: fn( self: *const IEnterpriseDropTarget, value: ?*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 IEnterpriseDropTarget_SetDropSourceEnterpriseId(self: *const T, identity: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IEnterpriseDropTarget.VTable, self.vtable).SetDropSourceEnterpriseId(@ptrCast(*const IEnterpriseDropTarget, self), identity); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnterpriseDropTarget_IsEvaluatingEdpPolicy(self: *const T, value: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IEnterpriseDropTarget.VTable, self.vtable).IsEvaluatingEdpPolicy(@ptrCast(*const IEnterpriseDropTarget, self), value); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEVERB = extern struct { lVerb: i32, lpszVerbName: ?PWSTR, fuFlags: u32, grfAttribs: u32, }; pub const OLEVERBATTRIB = enum(i32) { NEVERDIRTIES = 1, ONCONTAINERMENU = 2, }; pub const OLEVERBATTRIB_NEVERDIRTIES = OLEVERBATTRIB.NEVERDIRTIES; pub const OLEVERBATTRIB_ONCONTAINERMENU = OLEVERBATTRIB.ONCONTAINERMENU; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumOLEVERB_Value = Guid.initString("00000104-0000-0000-c000-000000000046"); pub const IID_IEnumOLEVERB = &IID_IEnumOLEVERB_Value; pub const IEnumOLEVERB = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOLEVERB, celt: u32, rgelt: [*]OLEVERB, pceltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOLEVERB, celt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOLEVERB, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOLEVERB, ppenum: ?*?*IEnumOLEVERB, ) 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 IEnumOLEVERB_Next(self: *const T, celt: u32, rgelt: [*]OLEVERB, pceltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Next(@ptrCast(*const IEnumOLEVERB, self), celt, rgelt, pceltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOLEVERB_Skip(self: *const T, celt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Skip(@ptrCast(*const IEnumOLEVERB, self), celt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOLEVERB_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Reset(@ptrCast(*const IEnumOLEVERB, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOLEVERB_Clone(self: *const T, ppenum: ?*?*IEnumOLEVERB) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOLEVERB.VTable, self.vtable).Clone(@ptrCast(*const IEnumOLEVERB, self), ppenum); } };} pub usingnamespace MethodMixin(@This()); }; pub const NUMPARSE = extern struct { cDig: i32, dwInFlags: u32, dwOutFlags: u32, cchUsed: i32, nBaseShift: i32, nPwr10: i32, }; pub const UDATE = extern struct { st: SYSTEMTIME, wDayOfYear: u16, }; pub const REGKIND = enum(i32) { DEFAULT = 0, REGISTER = 1, NONE = 2, }; pub const REGKIND_DEFAULT = REGKIND.DEFAULT; pub const REGKIND_REGISTER = REGKIND.REGISTER; pub const REGKIND_NONE = REGKIND.NONE; pub const PARAMDATA = extern struct { szName: ?PWSTR, vt: u16, }; pub const METHODDATA = extern struct { szName: ?PWSTR, ppdata: ?*PARAMDATA, dispid: i32, iMeth: u32, cc: CALLCONV, cArgs: u32, wFlags: u16, vtReturn: u16, }; pub const INTERFACEDATA = extern struct { pmethdata: ?*METHODDATA, cMembers: u32, }; pub const UASFLAGS = enum(i32) { NORMAL = 0, BLOCKED = 1, NOPARENTENABLE = 2, MASK = 3, }; pub const UAS_NORMAL = UASFLAGS.NORMAL; pub const UAS_BLOCKED = UASFLAGS.BLOCKED; pub const UAS_NOPARENTENABLE = UASFLAGS.NOPARENTENABLE; pub const UAS_MASK = UASFLAGS.MASK; pub const READYSTATE = enum(i32) { UNINITIALIZED = 0, LOADING = 1, LOADED = 2, INTERACTIVE = 3, COMPLETE = 4, }; pub const READYSTATE_UNINITIALIZED = READYSTATE.UNINITIALIZED; pub const READYSTATE_LOADING = READYSTATE.LOADING; pub const READYSTATE_LOADED = READYSTATE.LOADED; pub const READYSTATE_INTERACTIVE = READYSTATE.INTERACTIVE; pub const READYSTATE_COMPLETE = READYSTATE.COMPLETE; pub const LICINFO = extern struct { cbLicInfo: i32, fRuntimeKeyAvail: BOOL, fLicVerified: BOOL, }; // TODO: this type is limited to platform 'windows5.0' const IID_IClassFactory2_Value = Guid.initString("b196b28f-bab4-101a-b69c-00aa00341d07"); pub const IID_IClassFactory2 = &IID_IClassFactory2_Value; pub const IClassFactory2 = extern struct { pub const VTable = extern struct { base: IClassFactory.VTable, GetLicInfo: fn( self: *const IClassFactory2, pLicInfo: ?*LICINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestLicKey: fn( self: *const IClassFactory2, dwReserved: u32, pBstrKey: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateInstanceLic: fn( self: *const IClassFactory2, pUnkOuter: ?*IUnknown, pUnkReserved: ?*IUnknown, riid: ?*const Guid, bstrKey: ?BSTR, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IClassFactory.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory2_GetLicInfo(self: *const T, pLicInfo: ?*LICINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory2.VTable, self.vtable).GetLicInfo(@ptrCast(*const IClassFactory2, self), pLicInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory2_RequestLicKey(self: *const T, dwReserved: u32, pBstrKey: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory2.VTable, self.vtable).RequestLicKey(@ptrCast(*const IClassFactory2, self), dwReserved, pBstrKey); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IClassFactory2_CreateInstanceLic(self: *const T, pUnkOuter: ?*IUnknown, pUnkReserved: ?*IUnknown, riid: ?*const Guid, bstrKey: ?BSTR, ppvObj: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IClassFactory2.VTable, self.vtable).CreateInstanceLic(@ptrCast(*const IClassFactory2, self), pUnkOuter, pUnkReserved, riid, bstrKey, ppvObj); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IProvideClassInfo_Value = Guid.initString("b196b283-bab4-101a-b69c-00aa00341d07"); pub const IID_IProvideClassInfo = &IID_IProvideClassInfo_Value; pub const IProvideClassInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetClassInfo: fn( self: *const IProvideClassInfo, ppTI: ?*?*ITypeInfo, ) 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 IProvideClassInfo_GetClassInfo(self: *const T, ppTI: ?*?*ITypeInfo) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideClassInfo.VTable, self.vtable).GetClassInfo(@ptrCast(*const IProvideClassInfo, self), ppTI); } };} pub usingnamespace MethodMixin(@This()); }; pub const GUIDKIND = enum(i32) { D = 1, }; pub const GUIDKIND_DEFAULT_SOURCE_DISP_IID = GUIDKIND.D; // TODO: this type is limited to platform 'windows5.0' const IID_IProvideClassInfo2_Value = Guid.initString("a6bc3ac0-dbaa-11ce-9de3-00aa004bb851"); pub const IID_IProvideClassInfo2 = &IID_IProvideClassInfo2_Value; pub const IProvideClassInfo2 = extern struct { pub const VTable = extern struct { base: IProvideClassInfo.VTable, GetGUID: fn( self: *const IProvideClassInfo2, dwGuidKind: u32, pGUID: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IProvideClassInfo.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideClassInfo2_GetGUID(self: *const T, dwGuidKind: u32, pGUID: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideClassInfo2.VTable, self.vtable).GetGUID(@ptrCast(*const IProvideClassInfo2, self), dwGuidKind, pGUID); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IProvideMultipleClassInfo_Value = Guid.initString("a7aba9c1-8983-11cf-8f20-00805f2cd064"); pub const IID_IProvideMultipleClassInfo = &IID_IProvideMultipleClassInfo_Value; pub const IProvideMultipleClassInfo = extern struct { pub const VTable = extern struct { base: IProvideClassInfo2.VTable, GetMultiTypeInfoCount: fn( self: *const IProvideMultipleClassInfo, pcti: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInfoOfIndex: fn( self: *const IProvideMultipleClassInfo, iti: u32, dwFlags: MULTICLASSINFO_FLAGS, pptiCoClass: ?*?*ITypeInfo, pdwTIFlags: ?*u32, pcdispidReserved: ?*u32, piidPrimary: ?*Guid, piidSource: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IProvideClassInfo2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideMultipleClassInfo_GetMultiTypeInfoCount(self: *const T, pcti: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideMultipleClassInfo.VTable, self.vtable).GetMultiTypeInfoCount(@ptrCast(*const IProvideMultipleClassInfo, self), pcti); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProvideMultipleClassInfo_GetInfoOfIndex(self: *const T, iti: u32, dwFlags: MULTICLASSINFO_FLAGS, pptiCoClass: ?*?*ITypeInfo, pdwTIFlags: ?*u32, pcdispidReserved: ?*u32, piidPrimary: ?*Guid, piidSource: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideMultipleClassInfo.VTable, self.vtable).GetInfoOfIndex(@ptrCast(*const IProvideMultipleClassInfo, self), iti, dwFlags, pptiCoClass, pdwTIFlags, pcdispidReserved, piidPrimary, piidSource); } };} pub usingnamespace MethodMixin(@This()); }; pub const CONTROLINFO = extern struct { cb: u32, hAccel: ?HACCEL, cAccel: u16, dwFlags: u32, }; pub const CTRLINFO = enum(i32) { RETURN = 1, ESCAPE = 2, }; pub const CTRLINFO_EATS_RETURN = CTRLINFO.RETURN; pub const CTRLINFO_EATS_ESCAPE = CTRLINFO.ESCAPE; // TODO: this type is limited to platform 'windows5.0' const IID_IOleControl_Value = Guid.initString("b196b288-bab4-101a-b69c-00aa00341d07"); pub const IID_IOleControl = &IID_IOleControl_Value; pub const IOleControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetControlInfo: fn( self: *const IOleControl, pCI: ?*CONTROLINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnMnemonic: fn( self: *const IOleControl, pMsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnAmbientPropertyChange: fn( self: *const IOleControl, dispID: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreezeEvents: fn( self: *const IOleControl, bFreeze: 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 IOleControl_GetControlInfo(self: *const T, pCI: ?*CONTROLINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).GetControlInfo(@ptrCast(*const IOleControl, self), pCI); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControl_OnMnemonic(self: *const T, pMsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).OnMnemonic(@ptrCast(*const IOleControl, self), pMsg); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControl_OnAmbientPropertyChange(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).OnAmbientPropertyChange(@ptrCast(*const IOleControl, self), dispID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControl_FreezeEvents(self: *const T, bFreeze: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControl.VTable, self.vtable).FreezeEvents(@ptrCast(*const IOleControl, self), bFreeze); } };} pub usingnamespace MethodMixin(@This()); }; pub const POINTF = extern struct { x: f32, y: f32, }; pub const XFORMCOORDS = enum(i32) { POSITION = 1, SIZE = 2, HIMETRICTOCONTAINER = 4, CONTAINERTOHIMETRIC = 8, EVENTCOMPAT = 16, }; pub const XFORMCOORDS_POSITION = XFORMCOORDS.POSITION; pub const XFORMCOORDS_SIZE = XFORMCOORDS.SIZE; pub const XFORMCOORDS_HIMETRICTOCONTAINER = XFORMCOORDS.HIMETRICTOCONTAINER; pub const XFORMCOORDS_CONTAINERTOHIMETRIC = XFORMCOORDS.CONTAINERTOHIMETRIC; pub const XFORMCOORDS_EVENTCOMPAT = XFORMCOORDS.EVENTCOMPAT; // TODO: this type is limited to platform 'windows5.0' const IID_IOleControlSite_Value = Guid.initString("b196b289-bab4-101a-b69c-00aa00341d07"); pub const IID_IOleControlSite = &IID_IOleControlSite_Value; pub const IOleControlSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnControlInfoChanged: fn( self: *const IOleControlSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LockInPlaceActive: fn( self: *const IOleControlSite, fLock: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExtendedControl: fn( self: *const IOleControlSite, ppDisp: ?*?*IDispatch, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TransformCoords: fn( self: *const IOleControlSite, pPtlHimetric: ?*POINTL, pPtfContainer: ?*POINTF, dwFlags: XFORMCOORDS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IOleControlSite, pMsg: ?*MSG, grfModifiers: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnFocus: fn( self: *const IOleControlSite, fGotFocus: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ShowPropertyFrame: fn( self: *const IOleControlSite, ) 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 IOleControlSite_OnControlInfoChanged(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).OnControlInfoChanged(@ptrCast(*const IOleControlSite, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_LockInPlaceActive(self: *const T, fLock: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).LockInPlaceActive(@ptrCast(*const IOleControlSite, self), fLock); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_GetExtendedControl(self: *const T, ppDisp: ?*?*IDispatch) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).GetExtendedControl(@ptrCast(*const IOleControlSite, self), ppDisp); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_TransformCoords(self: *const T, pPtlHimetric: ?*POINTL, pPtfContainer: ?*POINTF, dwFlags: XFORMCOORDS) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).TransformCoords(@ptrCast(*const IOleControlSite, self), pPtlHimetric, pPtfContainer, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_TranslateAccelerator(self: *const T, pMsg: ?*MSG, grfModifiers: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IOleControlSite, self), pMsg, grfModifiers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_OnFocus(self: *const T, fGotFocus: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).OnFocus(@ptrCast(*const IOleControlSite, self), fGotFocus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleControlSite_ShowPropertyFrame(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleControlSite.VTable, self.vtable).ShowPropertyFrame(@ptrCast(*const IOleControlSite, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROPPAGEINFO = extern struct { cb: u32, pszTitle: ?PWSTR, size: SIZE, pszDocString: ?PWSTR, pszHelpFile: ?PWSTR, dwHelpContext: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyPage_Value = Guid.initString("b196b28d-bab4-101a-b69c-00aa00341d07"); pub const IID_IPropertyPage = &IID_IPropertyPage_Value; pub const IPropertyPage = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetPageSite: fn( self: *const IPropertyPage, pPageSite: ?*IPropertyPageSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Activate: fn( self: *const IPropertyPage, hWndParent: ?HWND, pRect: ?*RECT, bModal: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Deactivate: fn( self: *const IPropertyPage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPageInfo: fn( self: *const IPropertyPage, pPageInfo: ?*PROPPAGEINFO, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetObjects: fn( self: *const IPropertyPage, cObjects: u32, ppUnk: [*]?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Show: fn( self: *const IPropertyPage, nCmdShow: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Move: fn( self: *const IPropertyPage, pRect: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsPageDirty: fn( self: *const IPropertyPage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Apply: fn( self: *const IPropertyPage, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Help: fn( self: *const IPropertyPage, pszHelpDir: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IPropertyPage, pMsg: ?*MSG, ) 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 IPropertyPage_SetPageSite(self: *const T, pPageSite: ?*IPropertyPageSite) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).SetPageSite(@ptrCast(*const IPropertyPage, self), pPageSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Activate(self: *const T, hWndParent: ?HWND, pRect: ?*RECT, bModal: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Activate(@ptrCast(*const IPropertyPage, self), hWndParent, pRect, bModal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Deactivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Deactivate(@ptrCast(*const IPropertyPage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_GetPageInfo(self: *const T, pPageInfo: ?*PROPPAGEINFO) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).GetPageInfo(@ptrCast(*const IPropertyPage, self), pPageInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_SetObjects(self: *const T, cObjects: u32, ppUnk: [*]?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).SetObjects(@ptrCast(*const IPropertyPage, self), cObjects, ppUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Show(self: *const T, nCmdShow: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Show(@ptrCast(*const IPropertyPage, self), nCmdShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Move(self: *const T, pRect: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Move(@ptrCast(*const IPropertyPage, self), pRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_IsPageDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).IsPageDirty(@ptrCast(*const IPropertyPage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Apply(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Apply(@ptrCast(*const IPropertyPage, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_Help(self: *const T, pszHelpDir: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).Help(@ptrCast(*const IPropertyPage, self), pszHelpDir); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage_TranslateAccelerator(self: *const T, pMsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IPropertyPage, self), pMsg); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyPage2_Value = Guid.initString("01e44665-24ac-101b-84ed-08002b2ec713"); pub const IID_IPropertyPage2 = &IID_IPropertyPage2_Value; pub const IPropertyPage2 = extern struct { pub const VTable = extern struct { base: IPropertyPage.VTable, EditProperty: fn( self: *const IPropertyPage2, dispID: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPropertyPage.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPage2_EditProperty(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPage2.VTable, self.vtable).EditProperty(@ptrCast(*const IPropertyPage2, self), dispID); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROPPAGESTATUS = enum(i32) { DIRTY = 1, VALIDATE = 2, CLEAN = 4, }; pub const PROPPAGESTATUS_DIRTY = PROPPAGESTATUS.DIRTY; pub const PROPPAGESTATUS_VALIDATE = PROPPAGESTATUS.VALIDATE; pub const PROPPAGESTATUS_CLEAN = PROPPAGESTATUS.CLEAN; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyPageSite_Value = Guid.initString("b196b28c-bab4-101a-b69c-00aa00341d07"); pub const IID_IPropertyPageSite = &IID_IPropertyPageSite_Value; pub const IPropertyPageSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnStatusChange: fn( self: *const IPropertyPageSite, dwFlags: PROPPAGESTATUS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLocaleID: fn( self: *const IPropertyPageSite, pLocaleID: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPageContainer: fn( self: *const IPropertyPageSite, ppUnk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TranslateAccelerator: fn( self: *const IPropertyPageSite, pMsg: ?*MSG, ) 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 IPropertyPageSite_OnStatusChange(self: *const T, dwFlags: PROPPAGESTATUS) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).OnStatusChange(@ptrCast(*const IPropertyPageSite, self), dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPageSite_GetLocaleID(self: *const T, pLocaleID: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).GetLocaleID(@ptrCast(*const IPropertyPageSite, self), pLocaleID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPageSite_GetPageContainer(self: *const T, ppUnk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).GetPageContainer(@ptrCast(*const IPropertyPageSite, self), ppUnk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyPageSite_TranslateAccelerator(self: *const T, pMsg: ?*MSG) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyPageSite.VTable, self.vtable).TranslateAccelerator(@ptrCast(*const IPropertyPageSite, self), pMsg); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPropertyNotifySink_Value = Guid.initString("9bfbbc02-eff1-101a-84ed-00aa00341d07"); pub const IID_IPropertyNotifySink = &IID_IPropertyNotifySink_Value; pub const IPropertyNotifySink = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnChanged: fn( self: *const IPropertyNotifySink, dispID: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnRequestEdit: fn( self: *const IPropertyNotifySink, dispID: 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 IPropertyNotifySink_OnChanged(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyNotifySink.VTable, self.vtable).OnChanged(@ptrCast(*const IPropertyNotifySink, self), dispID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPropertyNotifySink_OnRequestEdit(self: *const T, dispID: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPropertyNotifySink.VTable, self.vtable).OnRequestEdit(@ptrCast(*const IPropertyNotifySink, self), dispID); } };} pub usingnamespace MethodMixin(@This()); }; pub const CAUUID = extern struct { cElems: u32, pElems: ?*Guid, }; // TODO: this type is limited to platform 'windows5.0' const IID_ISpecifyPropertyPages_Value = Guid.initString("b196b28b-bab4-101a-b69c-00aa00341d07"); pub const IID_ISpecifyPropertyPages = &IID_ISpecifyPropertyPages_Value; pub const ISpecifyPropertyPages = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetPages: fn( self: *const ISpecifyPropertyPages, pPages: ?*CAUUID, ) 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 ISpecifyPropertyPages_GetPages(self: *const T, pPages: ?*CAUUID) callconv(.Inline) HRESULT { return @ptrCast(*const ISpecifyPropertyPages.VTable, self.vtable).GetPages(@ptrCast(*const ISpecifyPropertyPages, self), pPages); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPersistPropertyBag_Value = Guid.initString("37d84f60-42cb-11ce-8135-00aa004bb851"); pub const IID_IPersistPropertyBag = &IID_IPersistPropertyBag_Value; pub const IPersistPropertyBag = extern struct { pub const VTable = extern struct { base: IPersist.VTable, InitNew: fn( self: *const IPersistPropertyBag, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistPropertyBag, pPropBag: ?*IPropertyBag, pErrorLog: ?*IErrorLog, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistPropertyBag, pPropBag: ?*IPropertyBag, fClearDirty: BOOL, fSaveAllProperties: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag_InitNew(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag.VTable, self.vtable).InitNew(@ptrCast(*const IPersistPropertyBag, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag_Load(self: *const T, pPropBag: ?*IPropertyBag, pErrorLog: ?*IErrorLog) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag.VTable, self.vtable).Load(@ptrCast(*const IPersistPropertyBag, self), pPropBag, pErrorLog); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag_Save(self: *const T, pPropBag: ?*IPropertyBag, fClearDirty: BOOL, fSaveAllProperties: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag.VTable, self.vtable).Save(@ptrCast(*const IPersistPropertyBag, self), pPropBag, fClearDirty, fSaveAllProperties); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_ISimpleFrameSite_Value = Guid.initString("742b0e01-14e6-101b-914e-00aa00300cab"); pub const IID_ISimpleFrameSite = &IID_ISimpleFrameSite_Value; pub const ISimpleFrameSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, PreMessageFilter: fn( self: *const ISimpleFrameSite, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, pdwCookie: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PostMessageFilter: fn( self: *const ISimpleFrameSite, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, dwCookie: 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 ISimpleFrameSite_PreMessageFilter(self: *const T, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, pdwCookie: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleFrameSite.VTable, self.vtable).PreMessageFilter(@ptrCast(*const ISimpleFrameSite, self), hWnd, msg, wp, lp, plResult, pdwCookie); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISimpleFrameSite_PostMessageFilter(self: *const T, hWnd: ?HWND, msg: u32, wp: WPARAM, lp: LPARAM, plResult: ?*LRESULT, dwCookie: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISimpleFrameSite.VTable, self.vtable).PostMessageFilter(@ptrCast(*const ISimpleFrameSite, self), hWnd, msg, wp, lp, plResult, dwCookie); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IFont_Value = Guid.initString("bef6e002-a874-101a-8bba-00aa00300cab"); pub const IID_IFont = &IID_IFont_Value; pub const IFont = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Name: fn( self: *const IFont, 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 IFont, name: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Size: fn( self: *const IFont, pSize: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Size: fn( self: *const IFont, size: CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Bold: fn( self: *const IFont, pBold: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Bold: fn( self: *const IFont, bold: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Italic: fn( self: *const IFont, pItalic: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Italic: fn( self: *const IFont, italic: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Underline: fn( self: *const IFont, pUnderline: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Underline: fn( self: *const IFont, underline: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Strikethrough: fn( self: *const IFont, pStrikethrough: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Strikethrough: fn( self: *const IFont, strikethrough: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Weight: fn( self: *const IFont, pWeight: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Weight: fn( self: *const IFont, weight: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Charset: fn( self: *const IFont, pCharset: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_Charset: fn( self: *const IFont, charset: i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hFont: fn( self: *const IFont, phFont: ?*?HFONT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IFont, ppFont: ?*?*IFont, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsEqual: fn( self: *const IFont, pFontOther: ?*IFont, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRatio: fn( self: *const IFont, cyLogical: i32, cyHimetric: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryTextMetrics: fn( self: *const IFont, pTM: ?*TEXTMETRICW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddRefHfont: fn( self: *const IFont, hFont: ?HFONT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseHfont: fn( self: *const IFont, hFont: ?HFONT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetHdc: fn( self: *const IFont, hDC: ?HDC, ) 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 IFont_get_Name(self: *const T, pName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Name(@ptrCast(*const IFont, self), pName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Name(self: *const T, name: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Name(@ptrCast(*const IFont, self), name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Size(self: *const T, pSize: ?*CY) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Size(@ptrCast(*const IFont, self), pSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Size(self: *const T, size: CY) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Size(@ptrCast(*const IFont, self), size); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Bold(self: *const T, pBold: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Bold(@ptrCast(*const IFont, self), pBold); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Bold(self: *const T, bold: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Bold(@ptrCast(*const IFont, self), bold); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Italic(self: *const T, pItalic: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Italic(@ptrCast(*const IFont, self), pItalic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Italic(self: *const T, italic: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Italic(@ptrCast(*const IFont, self), italic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Underline(self: *const T, pUnderline: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Underline(@ptrCast(*const IFont, self), pUnderline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Underline(self: *const T, underline: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Underline(@ptrCast(*const IFont, self), underline); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Strikethrough(self: *const T, pStrikethrough: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Strikethrough(@ptrCast(*const IFont, self), pStrikethrough); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Strikethrough(self: *const T, strikethrough: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Strikethrough(@ptrCast(*const IFont, self), strikethrough); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Weight(self: *const T, pWeight: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Weight(@ptrCast(*const IFont, self), pWeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Weight(self: *const T, weight: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Weight(@ptrCast(*const IFont, self), weight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_Charset(self: *const T, pCharset: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_Charset(@ptrCast(*const IFont, self), pCharset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_put_Charset(self: *const T, charset: i16) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).put_Charset(@ptrCast(*const IFont, self), charset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_get_hFont(self: *const T, phFont: ?*?HFONT) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).get_hFont(@ptrCast(*const IFont, self), phFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_Clone(self: *const T, ppFont: ?*?*IFont) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).Clone(@ptrCast(*const IFont, self), ppFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_IsEqual(self: *const T, pFontOther: ?*IFont) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).IsEqual(@ptrCast(*const IFont, self), pFontOther); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_SetRatio(self: *const T, cyLogical: i32, cyHimetric: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).SetRatio(@ptrCast(*const IFont, self), cyLogical, cyHimetric); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_QueryTextMetrics(self: *const T, pTM: ?*TEXTMETRICW) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).QueryTextMetrics(@ptrCast(*const IFont, self), pTM); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_AddRefHfont(self: *const T, hFont: ?HFONT) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).AddRefHfont(@ptrCast(*const IFont, self), hFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_ReleaseHfont(self: *const T, hFont: ?HFONT) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).ReleaseHfont(@ptrCast(*const IFont, self), hFont); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IFont_SetHdc(self: *const T, hDC: ?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IFont.VTable, self.vtable).SetHdc(@ptrCast(*const IFont, self), hDC); } };} pub usingnamespace MethodMixin(@This()); }; pub const PictureAttributes = enum(i32) { SCALABLE = 1, TRANSPARENT = 2, }; pub const PICTURE_SCALABLE = PictureAttributes.SCALABLE; pub const PICTURE_TRANSPARENT = PictureAttributes.TRANSPARENT; // TODO: this type is limited to platform 'windows5.0' const IID_IPicture_Value = Guid.initString("7bf80980-bf32-101a-8bbb-00aa00300cab"); pub const IID_IPicture = &IID_IPicture_Value; pub const IPicture = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const IPicture, pHandle: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hPal: fn( self: *const IPicture, phPal: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const IPicture, pType: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Width: fn( self: *const IPicture, pWidth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Height: fn( self: *const IPicture, pHeight: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Render: fn( self: *const IPicture, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, set_hPal: fn( self: *const IPicture, hPal: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurDC: fn( self: *const IPicture, phDC: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SelectPicture: fn( self: *const IPicture, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_KeepOriginalFormat: fn( self: *const IPicture, pKeep: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_KeepOriginalFormat: fn( self: *const IPicture, keep: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PictureChanged: fn( self: *const IPicture, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveAsFile: fn( self: *const IPicture, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attributes: fn( self: *const IPicture, pDwAttr: ?*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 IPicture_get_Handle(self: *const T, pHandle: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Handle(@ptrCast(*const IPicture, self), pHandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_hPal(self: *const T, phPal: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_hPal(@ptrCast(*const IPicture, self), phPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Type(self: *const T, pType: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Type(@ptrCast(*const IPicture, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Width(self: *const T, pWidth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Width(@ptrCast(*const IPicture, self), pWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Height(self: *const T, pHeight: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Height(@ptrCast(*const IPicture, self), pHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_Render(self: *const T, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).Render(@ptrCast(*const IPicture, self), hDC, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, pRcWBounds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_set_hPal(self: *const T, hPal: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).set_hPal(@ptrCast(*const IPicture, self), hPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_CurDC(self: *const T, phDC: ?*?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_CurDC(@ptrCast(*const IPicture, self), phDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_SelectPicture(self: *const T, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).SelectPicture(@ptrCast(*const IPicture, self), hDCIn, phDCOut, phBmpOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_KeepOriginalFormat(self: *const T, pKeep: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_KeepOriginalFormat(@ptrCast(*const IPicture, self), pKeep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_put_KeepOriginalFormat(self: *const T, keep: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).put_KeepOriginalFormat(@ptrCast(*const IPicture, self), keep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_PictureChanged(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).PictureChanged(@ptrCast(*const IPicture, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_SaveAsFile(self: *const T, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).SaveAsFile(@ptrCast(*const IPicture, self), pStream, fSaveMemCopy, pCbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture_get_Attributes(self: *const T, pDwAttr: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture.VTable, self.vtable).get_Attributes(@ptrCast(*const IPicture, self), pDwAttr); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPicture2_Value = Guid.initString("f5185dd8-2012-4b0b-aad9-f052c6bd482b"); pub const IID_IPicture2 = &IID_IPicture2_Value; pub const IPicture2 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Handle: fn( self: *const IPicture2, pHandle: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_hPal: fn( self: *const IPicture2, phPal: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Type: fn( self: *const IPicture2, pType: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Width: fn( self: *const IPicture2, pWidth: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Height: fn( self: *const IPicture2, pHeight: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Render: fn( self: *const IPicture2, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, set_hPal: fn( self: *const IPicture2, hPal: usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_CurDC: fn( self: *const IPicture2, phDC: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SelectPicture: fn( self: *const IPicture2, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_KeepOriginalFormat: fn( self: *const IPicture2, pKeep: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? put_KeepOriginalFormat: fn( self: *const IPicture2, keep: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PictureChanged: fn( self: *const IPicture2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveAsFile: fn( self: *const IPicture2, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_Attributes: fn( self: *const IPicture2, pDwAttr: ?*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 IPicture2_get_Handle(self: *const T, pHandle: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Handle(@ptrCast(*const IPicture2, self), pHandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_hPal(self: *const T, phPal: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_hPal(@ptrCast(*const IPicture2, self), phPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Type(self: *const T, pType: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Type(@ptrCast(*const IPicture2, self), pType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Width(self: *const T, pWidth: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Width(@ptrCast(*const IPicture2, self), pWidth); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Height(self: *const T, pHeight: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Height(@ptrCast(*const IPicture2, self), pHeight); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_Render(self: *const T, hDC: ?HDC, x: i32, y: i32, cx: i32, cy: i32, xSrc: i32, ySrc: i32, cxSrc: i32, cySrc: i32, pRcWBounds: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).Render(@ptrCast(*const IPicture2, self), hDC, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, pRcWBounds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_set_hPal(self: *const T, hPal: usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).set_hPal(@ptrCast(*const IPicture2, self), hPal); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_CurDC(self: *const T, phDC: ?*?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_CurDC(@ptrCast(*const IPicture2, self), phDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_SelectPicture(self: *const T, hDCIn: ?HDC, phDCOut: ?*?HDC, phBmpOut: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).SelectPicture(@ptrCast(*const IPicture2, self), hDCIn, phDCOut, phBmpOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_KeepOriginalFormat(self: *const T, pKeep: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_KeepOriginalFormat(@ptrCast(*const IPicture2, self), pKeep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_put_KeepOriginalFormat(self: *const T, keep: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).put_KeepOriginalFormat(@ptrCast(*const IPicture2, self), keep); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_PictureChanged(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).PictureChanged(@ptrCast(*const IPicture2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_SaveAsFile(self: *const T, pStream: ?*IStream, fSaveMemCopy: BOOL, pCbSize: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).SaveAsFile(@ptrCast(*const IPicture2, self), pStream, fSaveMemCopy, pCbSize); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPicture2_get_Attributes(self: *const T, pDwAttr: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPicture2.VTable, self.vtable).get_Attributes(@ptrCast(*const IPicture2, self), pDwAttr); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IFontEventsDisp_Value = Guid.initString("4ef6100a-af88-11d0-9846-00c04fc29993"); pub const IID_IFontEventsDisp = &IID_IFontEventsDisp_Value; pub const IFontEventsDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IFontDisp_Value = Guid.initString("bef6e003-a874-101a-8bba-00aa00300cab"); pub const IID_IFontDisp = &IID_IFontDisp_Value; pub const IFontDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IPictureDisp_Value = Guid.initString("7bf80981-bf32-101a-8bbb-00aa00300cab"); pub const IID_IPictureDisp = &IID_IPictureDisp_Value; pub const IPictureDisp = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDispatch.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceObjectWindowless_Value = Guid.initString("1c2056cc-5ef4-101b-8bc8-00aa003e3b29"); pub const IID_IOleInPlaceObjectWindowless = &IID_IOleInPlaceObjectWindowless_Value; pub const IOleInPlaceObjectWindowless = extern struct { pub const VTable = extern struct { base: IOleInPlaceObject.VTable, OnWindowMessage: fn( self: *const IOleInPlaceObjectWindowless, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDropTarget: fn( self: *const IOleInPlaceObjectWindowless, ppDropTarget: ?*?*IDropTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceObject.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObjectWindowless_OnWindowMessage(self: *const T, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObjectWindowless.VTable, self.vtable).OnWindowMessage(@ptrCast(*const IOleInPlaceObjectWindowless, self), msg, wParam, lParam, plResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceObjectWindowless_GetDropTarget(self: *const T, ppDropTarget: ?*?*IDropTarget) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceObjectWindowless.VTable, self.vtable).GetDropTarget(@ptrCast(*const IOleInPlaceObjectWindowless, self), ppDropTarget); } };} pub usingnamespace MethodMixin(@This()); }; pub const ACTIVATEFLAGS = enum(i32) { S = 1, }; pub const ACTIVATE_WINDOWLESS = ACTIVATEFLAGS.S; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceSiteEx_Value = Guid.initString("9c2cad80-3424-11cf-b670-00aa004cd6d8"); pub const IID_IOleInPlaceSiteEx = &IID_IOleInPlaceSiteEx_Value; pub const IOleInPlaceSiteEx = extern struct { pub const VTable = extern struct { base: IOleInPlaceSite.VTable, OnInPlaceActivateEx: fn( self: *const IOleInPlaceSiteEx, pfNoRedraw: ?*BOOL, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInPlaceDeactivateEx: fn( self: *const IOleInPlaceSiteEx, fNoRedraw: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RequestUIActivate: fn( self: *const IOleInPlaceSiteEx, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceSite.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteEx_OnInPlaceActivateEx(self: *const T, pfNoRedraw: ?*BOOL, dwFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteEx.VTable, self.vtable).OnInPlaceActivateEx(@ptrCast(*const IOleInPlaceSiteEx, self), pfNoRedraw, dwFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteEx_OnInPlaceDeactivateEx(self: *const T, fNoRedraw: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteEx.VTable, self.vtable).OnInPlaceDeactivateEx(@ptrCast(*const IOleInPlaceSiteEx, self), fNoRedraw); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteEx_RequestUIActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteEx.VTable, self.vtable).RequestUIActivate(@ptrCast(*const IOleInPlaceSiteEx, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEDCFLAGS = enum(i32) { NODRAW = 1, PAINTBKGND = 2, OFFSCREEN = 4, }; pub const OLEDC_NODRAW = OLEDCFLAGS.NODRAW; pub const OLEDC_PAINTBKGND = OLEDCFLAGS.PAINTBKGND; pub const OLEDC_OFFSCREEN = OLEDCFLAGS.OFFSCREEN; // TODO: this type is limited to platform 'windows5.0' const IID_IOleInPlaceSiteWindowless_Value = Guid.initString("922eada0-3424-11cf-b670-00aa004cd6d8"); pub const IID_IOleInPlaceSiteWindowless = &IID_IOleInPlaceSiteWindowless_Value; pub const IOleInPlaceSiteWindowless = extern struct { pub const VTable = extern struct { base: IOleInPlaceSiteEx.VTable, CanWindowlessActivate: fn( self: *const IOleInPlaceSiteWindowless, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCapture: fn( self: *const IOleInPlaceSiteWindowless, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCapture: fn( self: *const IOleInPlaceSiteWindowless, fCapture: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFocus: fn( self: *const IOleInPlaceSiteWindowless, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFocus: fn( self: *const IOleInPlaceSiteWindowless, fFocus: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDC: fn( self: *const IOleInPlaceSiteWindowless, pRect: ?*RECT, grfFlags: u32, phDC: ?*?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseDC: fn( self: *const IOleInPlaceSiteWindowless, hDC: ?HDC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvalidateRect: fn( self: *const IOleInPlaceSiteWindowless, pRect: ?*RECT, fErase: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvalidateRgn: fn( self: *const IOleInPlaceSiteWindowless, hRGN: ?HRGN, fErase: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ScrollRect: fn( self: *const IOleInPlaceSiteWindowless, dx: i32, dy: i32, pRectScroll: ?*RECT, pRectClip: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AdjustRect: fn( self: *const IOleInPlaceSiteWindowless, prc: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnDefWindowMessage: fn( self: *const IOleInPlaceSiteWindowless, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleInPlaceSiteEx.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_CanWindowlessActivate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).CanWindowlessActivate(@ptrCast(*const IOleInPlaceSiteWindowless, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_GetCapture(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).GetCapture(@ptrCast(*const IOleInPlaceSiteWindowless, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_SetCapture(self: *const T, fCapture: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).SetCapture(@ptrCast(*const IOleInPlaceSiteWindowless, self), fCapture); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_GetFocus(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).GetFocus(@ptrCast(*const IOleInPlaceSiteWindowless, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_SetFocus(self: *const T, fFocus: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).SetFocus(@ptrCast(*const IOleInPlaceSiteWindowless, self), fFocus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_GetDC(self: *const T, pRect: ?*RECT, grfFlags: u32, phDC: ?*?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).GetDC(@ptrCast(*const IOleInPlaceSiteWindowless, self), pRect, grfFlags, phDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_ReleaseDC(self: *const T, hDC: ?HDC) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).ReleaseDC(@ptrCast(*const IOleInPlaceSiteWindowless, self), hDC); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_InvalidateRect(self: *const T, pRect: ?*RECT, fErase: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).InvalidateRect(@ptrCast(*const IOleInPlaceSiteWindowless, self), pRect, fErase); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_InvalidateRgn(self: *const T, hRGN: ?HRGN, fErase: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).InvalidateRgn(@ptrCast(*const IOleInPlaceSiteWindowless, self), hRGN, fErase); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_ScrollRect(self: *const T, dx: i32, dy: i32, pRectScroll: ?*RECT, pRectClip: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).ScrollRect(@ptrCast(*const IOleInPlaceSiteWindowless, self), dx, dy, pRectScroll, pRectClip); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_AdjustRect(self: *const T, prc: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).AdjustRect(@ptrCast(*const IOleInPlaceSiteWindowless, self), prc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleInPlaceSiteWindowless_OnDefWindowMessage(self: *const T, msg: u32, wParam: WPARAM, lParam: LPARAM, plResult: ?*LRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleInPlaceSiteWindowless.VTable, self.vtable).OnDefWindowMessage(@ptrCast(*const IOleInPlaceSiteWindowless, self), msg, wParam, lParam, plResult); } };} pub usingnamespace MethodMixin(@This()); }; pub const VIEWSTATUS = enum(i32) { OPAQUE = 1, SOLIDBKGND = 2, DVASPECTOPAQUE = 4, DVASPECTTRANSPARENT = 8, SURFACE = 16, @"3DSURFACE" = 32, }; pub const VIEWSTATUS_OPAQUE = VIEWSTATUS.OPAQUE; pub const VIEWSTATUS_SOLIDBKGND = VIEWSTATUS.SOLIDBKGND; pub const VIEWSTATUS_DVASPECTOPAQUE = VIEWSTATUS.DVASPECTOPAQUE; pub const VIEWSTATUS_DVASPECTTRANSPARENT = VIEWSTATUS.DVASPECTTRANSPARENT; pub const VIEWSTATUS_SURFACE = VIEWSTATUS.SURFACE; pub const VIEWSTATUS_3DSURFACE = VIEWSTATUS.@"3DSURFACE"; pub const HITRESULT = enum(i32) { OUTSIDE = 0, TRANSPARENT = 1, CLOSE = 2, HIT = 3, }; pub const HITRESULT_OUTSIDE = HITRESULT.OUTSIDE; pub const HITRESULT_TRANSPARENT = HITRESULT.TRANSPARENT; pub const HITRESULT_CLOSE = HITRESULT.CLOSE; pub const HITRESULT_HIT = HITRESULT.HIT; pub const DVASPECT2 = enum(i32) { OPAQUE = 16, TRANSPARENT = 32, }; pub const DVASPECT_OPAQUE = DVASPECT2.OPAQUE; pub const DVASPECT_TRANSPARENT = DVASPECT2.TRANSPARENT; pub const ExtentInfo = extern struct { cb: u32, dwExtentMode: u32, sizelProposed: SIZE, }; pub const ExtentMode = enum(i32) { CONTENT = 0, INTEGRAL = 1, }; pub const DVEXTENT_CONTENT = ExtentMode.CONTENT; pub const DVEXTENT_INTEGRAL = ExtentMode.INTEGRAL; pub const AspectInfoFlag = enum(i32) { E = 1, }; pub const DVASPECTINFOFLAG_CANOPTIMIZE = AspectInfoFlag.E; pub const AspectInfo = extern struct { cb: u32, dwFlags: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IViewObjectEx_Value = Guid.initString("3af24292-0c96-11ce-a0cf-00aa00600ab8"); pub const IID_IViewObjectEx = &IID_IViewObjectEx_Value; pub const IViewObjectEx = extern struct { pub const VTable = extern struct { base: IViewObject2.VTable, GetRect: fn( self: *const IViewObjectEx, dwAspect: u32, pRect: ?*RECTL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetViewStatus: fn( self: *const IViewObjectEx, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryHitPoint: fn( self: *const IViewObjectEx, dwAspect: u32, pRectBounds: ?*RECT, ptlLoc: POINT, lCloseHint: i32, pHitResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, QueryHitRect: fn( self: *const IViewObjectEx, dwAspect: u32, pRectBounds: ?*RECT, pRectLoc: ?*RECT, lCloseHint: i32, pHitResult: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNaturalExtent: fn( self: *const IViewObjectEx, dwAspect: DVASPECT, lindex: i32, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, pExtentInfo: ?*ExtentInfo, pSizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IViewObject2.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_GetRect(self: *const T, dwAspect: u32, pRect: ?*RECTL) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).GetRect(@ptrCast(*const IViewObjectEx, self), dwAspect, pRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_GetViewStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).GetViewStatus(@ptrCast(*const IViewObjectEx, self), pdwStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_QueryHitPoint(self: *const T, dwAspect: u32, pRectBounds: ?*RECT, ptlLoc: POINT, lCloseHint: i32, pHitResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).QueryHitPoint(@ptrCast(*const IViewObjectEx, self), dwAspect, pRectBounds, ptlLoc, lCloseHint, pHitResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_QueryHitRect(self: *const T, dwAspect: u32, pRectBounds: ?*RECT, pRectLoc: ?*RECT, lCloseHint: i32, pHitResult: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).QueryHitRect(@ptrCast(*const IViewObjectEx, self), dwAspect, pRectBounds, pRectLoc, lCloseHint, pHitResult); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IViewObjectEx_GetNaturalExtent(self: *const T, dwAspect: DVASPECT, lindex: i32, ptd: ?*DVTARGETDEVICE, hicTargetDev: ?HDC, pExtentInfo: ?*ExtentInfo, pSizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IViewObjectEx.VTable, self.vtable).GetNaturalExtent(@ptrCast(*const IViewObjectEx, self), dwAspect, lindex, ptd, hicTargetDev, pExtentInfo, pSizel); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleUndoUnit_Value = Guid.initString("894ad3b0-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IOleUndoUnit = &IID_IOleUndoUnit_Value; pub const IOleUndoUnit = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Do: fn( self: *const IOleUndoUnit, pUndoManager: ?*IOleUndoManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescription: fn( self: *const IOleUndoUnit, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUnitType: fn( self: *const IOleUndoUnit, pClsid: ?*Guid, plID: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnNextAdd: fn( self: *const IOleUndoUnit, ) 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 IOleUndoUnit_Do(self: *const T, pUndoManager: ?*IOleUndoManager) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).Do(@ptrCast(*const IOleUndoUnit, self), pUndoManager); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoUnit_GetDescription(self: *const T, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).GetDescription(@ptrCast(*const IOleUndoUnit, self), pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoUnit_GetUnitType(self: *const T, pClsid: ?*Guid, plID: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).GetUnitType(@ptrCast(*const IOleUndoUnit, self), pClsid, plID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoUnit_OnNextAdd(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoUnit.VTable, self.vtable).OnNextAdd(@ptrCast(*const IOleUndoUnit, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleParentUndoUnit_Value = Guid.initString("a1faf330-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IOleParentUndoUnit = &IID_IOleParentUndoUnit_Value; pub const IOleParentUndoUnit = extern struct { pub const VTable = extern struct { base: IOleUndoUnit.VTable, Open: fn( self: *const IOleParentUndoUnit, pPUU: ?*IOleParentUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IOleParentUndoUnit, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IOleParentUndoUnit, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindUnit: fn( self: *const IOleParentUndoUnit, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParentState: fn( self: *const IOleParentUndoUnit, pdwState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleUndoUnit.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_Open(self: *const T, pPUU: ?*IOleParentUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).Open(@ptrCast(*const IOleParentUndoUnit, self), pPUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_Close(self: *const T, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).Close(@ptrCast(*const IOleParentUndoUnit, self), pPUU, fCommit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_Add(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).Add(@ptrCast(*const IOleParentUndoUnit, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_FindUnit(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).FindUnit(@ptrCast(*const IOleParentUndoUnit, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleParentUndoUnit_GetParentState(self: *const T, pdwState: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleParentUndoUnit.VTable, self.vtable).GetParentState(@ptrCast(*const IOleParentUndoUnit, self), pdwState); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumOleUndoUnits_Value = Guid.initString("b3e7c340-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IEnumOleUndoUnits = &IID_IEnumOleUndoUnits_Value; pub const IEnumOleUndoUnits = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOleUndoUnits, cElt: u32, rgElt: [*]?*IOleUndoUnit, pcEltFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOleUndoUnits, cElt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOleUndoUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOleUndoUnits, ppEnum: ?*?*IEnumOleUndoUnits, ) 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 IEnumOleUndoUnits_Next(self: *const T, cElt: u32, rgElt: [*]?*IOleUndoUnit, pcEltFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Next(@ptrCast(*const IEnumOleUndoUnits, self), cElt, rgElt, pcEltFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleUndoUnits_Skip(self: *const T, cElt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Skip(@ptrCast(*const IEnumOleUndoUnits, self), cElt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleUndoUnits_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Reset(@ptrCast(*const IEnumOleUndoUnits, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleUndoUnits_Clone(self: *const T, ppEnum: ?*?*IEnumOleUndoUnits) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleUndoUnits.VTable, self.vtable).Clone(@ptrCast(*const IEnumOleUndoUnits, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleUndoManager_Value = Guid.initString("d001f200-ef97-11ce-9bc9-00aa00608e01"); pub const IID_IOleUndoManager = &IID_IOleUndoManager_Value; pub const IOleUndoManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Open: fn( self: *const IOleUndoManager, pPUU: ?*IOleParentUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Close: fn( self: *const IOleUndoManager, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Add: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOpenParentState: fn( self: *const IOleUndoManager, pdwState: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DiscardFrom: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UndoTo: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RedoTo: fn( self: *const IOleUndoManager, pUU: ?*IOleUndoUnit, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumUndoable: fn( self: *const IOleUndoManager, ppEnum: ?*?*IEnumOleUndoUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumRedoable: fn( self: *const IOleUndoManager, ppEnum: ?*?*IEnumOleUndoUnits, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLastUndoDescription: fn( self: *const IOleUndoManager, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLastRedoDescription: fn( self: *const IOleUndoManager, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Enable: fn( self: *const IOleUndoManager, fEnable: 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 IOleUndoManager_Open(self: *const T, pPUU: ?*IOleParentUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Open(@ptrCast(*const IOleUndoManager, self), pPUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_Close(self: *const T, pPUU: ?*IOleParentUndoUnit, fCommit: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Close(@ptrCast(*const IOleUndoManager, self), pPUU, fCommit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_Add(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Add(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_GetOpenParentState(self: *const T, pdwState: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).GetOpenParentState(@ptrCast(*const IOleUndoManager, self), pdwState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_DiscardFrom(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).DiscardFrom(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_UndoTo(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).UndoTo(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_RedoTo(self: *const T, pUU: ?*IOleUndoUnit) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).RedoTo(@ptrCast(*const IOleUndoManager, self), pUU); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_EnumUndoable(self: *const T, ppEnum: ?*?*IEnumOleUndoUnits) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).EnumUndoable(@ptrCast(*const IOleUndoManager, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_EnumRedoable(self: *const T, ppEnum: ?*?*IEnumOleUndoUnits) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).EnumRedoable(@ptrCast(*const IOleUndoManager, self), ppEnum); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_GetLastUndoDescription(self: *const T, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).GetLastUndoDescription(@ptrCast(*const IOleUndoManager, self), pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_GetLastRedoDescription(self: *const T, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).GetLastRedoDescription(@ptrCast(*const IOleUndoManager, self), pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUndoManager_Enable(self: *const T, fEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUndoManager.VTable, self.vtable).Enable(@ptrCast(*const IOleUndoManager, self), fEnable); } };} pub usingnamespace MethodMixin(@This()); }; pub const POINTERINACTIVE = enum(i32) { ACTIVATEONENTRY = 1, DEACTIVATEONLEAVE = 2, ACTIVATEONDRAG = 4, }; pub const POINTERINACTIVE_ACTIVATEONENTRY = POINTERINACTIVE.ACTIVATEONENTRY; pub const POINTERINACTIVE_DEACTIVATEONLEAVE = POINTERINACTIVE.DEACTIVATEONLEAVE; pub const POINTERINACTIVE_ACTIVATEONDRAG = POINTERINACTIVE.ACTIVATEONDRAG; // TODO: this type is limited to platform 'windows5.0' const IID_IPointerInactive_Value = Guid.initString("55980ba0-35aa-11cf-b671-00aa004cd6d8"); pub const IID_IPointerInactive = &IID_IPointerInactive_Value; pub const IPointerInactive = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetActivationPolicy: fn( self: *const IPointerInactive, pdwPolicy: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInactiveMouseMove: fn( self: *const IPointerInactive, pRectBounds: ?*RECT, x: i32, y: i32, grfKeyState: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OnInactiveSetCursor: fn( self: *const IPointerInactive, pRectBounds: ?*RECT, x: i32, y: i32, dwMouseMsg: u32, fSetAlways: 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 IPointerInactive_GetActivationPolicy(self: *const T, pdwPolicy: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPointerInactive.VTable, self.vtable).GetActivationPolicy(@ptrCast(*const IPointerInactive, self), pdwPolicy); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPointerInactive_OnInactiveMouseMove(self: *const T, pRectBounds: ?*RECT, x: i32, y: i32, grfKeyState: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IPointerInactive.VTable, self.vtable).OnInactiveMouseMove(@ptrCast(*const IPointerInactive, self), pRectBounds, x, y, grfKeyState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPointerInactive_OnInactiveSetCursor(self: *const T, pRectBounds: ?*RECT, x: i32, y: i32, dwMouseMsg: u32, fSetAlways: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPointerInactive.VTable, self.vtable).OnInactiveSetCursor(@ptrCast(*const IPointerInactive, self), pRectBounds, x, y, dwMouseMsg, fSetAlways); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IObjectWithSite_Value = Guid.initString("fc4801a3-2ba9-11cf-a229-00aa003d7352"); pub const IID_IObjectWithSite = &IID_IObjectWithSite_Value; pub const IObjectWithSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetSite: fn( self: *const IObjectWithSite, pUnkSite: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSite: fn( self: *const IObjectWithSite, riid: ?*const Guid, ppvSite: ?*?*anyopaque, ) 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 IObjectWithSite_SetSite(self: *const T, pUnkSite: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IObjectWithSite.VTable, self.vtable).SetSite(@ptrCast(*const IObjectWithSite, self), pUnkSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IObjectWithSite_GetSite(self: *const T, riid: ?*const Guid, ppvSite: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IObjectWithSite.VTable, self.vtable).GetSite(@ptrCast(*const IObjectWithSite, self), riid, ppvSite); } };} pub usingnamespace MethodMixin(@This()); }; pub const CALPOLESTR = extern struct { cElems: u32, pElems: ?*?PWSTR, }; pub const CADWORD = extern struct { cElems: u32, pElems: ?*u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IPerPropertyBrowsing_Value = Guid.initString("376bd3aa-3845-101b-84ed-08002b2ec713"); pub const IID_IPerPropertyBrowsing = &IID_IPerPropertyBrowsing_Value; pub const IPerPropertyBrowsing = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDisplayString: fn( self: *const IPerPropertyBrowsing, dispID: i32, pBstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, MapPropertyToPage: fn( self: *const IPerPropertyBrowsing, dispID: i32, pClsid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPredefinedStrings: fn( self: *const IPerPropertyBrowsing, dispID: i32, pCaStringsOut: ?*CALPOLESTR, pCaCookiesOut: ?*CADWORD, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPredefinedValue: fn( self: *const IPerPropertyBrowsing, dispID: i32, dwCookie: u32, pVarOut: ?*VARIANT, ) 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 IPerPropertyBrowsing_GetDisplayString(self: *const T, dispID: i32, pBstr: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).GetDisplayString(@ptrCast(*const IPerPropertyBrowsing, self), dispID, pBstr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerPropertyBrowsing_MapPropertyToPage(self: *const T, dispID: i32, pClsid: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).MapPropertyToPage(@ptrCast(*const IPerPropertyBrowsing, self), dispID, pClsid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerPropertyBrowsing_GetPredefinedStrings(self: *const T, dispID: i32, pCaStringsOut: ?*CALPOLESTR, pCaCookiesOut: ?*CADWORD) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).GetPredefinedStrings(@ptrCast(*const IPerPropertyBrowsing, self), dispID, pCaStringsOut, pCaCookiesOut); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPerPropertyBrowsing_GetPredefinedValue(self: *const T, dispID: i32, dwCookie: u32, pVarOut: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IPerPropertyBrowsing.VTable, self.vtable).GetPredefinedValue(@ptrCast(*const IPerPropertyBrowsing, self), dispID, dwCookie, pVarOut); } };} pub usingnamespace MethodMixin(@This()); }; pub const PROPBAG2_TYPE = enum(i32) { UNDEFINED = 0, DATA = 1, URL = 2, OBJECT = 3, STREAM = 4, STORAGE = 5, MONIKER = 6, }; pub const PROPBAG2_TYPE_UNDEFINED = PROPBAG2_TYPE.UNDEFINED; pub const PROPBAG2_TYPE_DATA = PROPBAG2_TYPE.DATA; pub const PROPBAG2_TYPE_URL = PROPBAG2_TYPE.URL; pub const PROPBAG2_TYPE_OBJECT = PROPBAG2_TYPE.OBJECT; pub const PROPBAG2_TYPE_STREAM = PROPBAG2_TYPE.STREAM; pub const PROPBAG2_TYPE_STORAGE = PROPBAG2_TYPE.STORAGE; pub const PROPBAG2_TYPE_MONIKER = PROPBAG2_TYPE.MONIKER; const IID_IPersistPropertyBag2_Value = Guid.initString("22f55881-280b-11d0-a8a9-00a0c90c2004"); pub const IID_IPersistPropertyBag2 = &IID_IPersistPropertyBag2_Value; pub const IPersistPropertyBag2 = extern struct { pub const VTable = extern struct { base: IPersist.VTable, InitNew: fn( self: *const IPersistPropertyBag2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Load: fn( self: *const IPersistPropertyBag2, pPropBag: ?*IPropertyBag2, pErrLog: ?*IErrorLog, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Save: fn( self: *const IPersistPropertyBag2, pPropBag: ?*IPropertyBag2, fClearDirty: BOOL, fSaveAllProperties: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsDirty: fn( self: *const IPersistPropertyBag2, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IPersist.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_InitNew(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).InitNew(@ptrCast(*const IPersistPropertyBag2, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_Load(self: *const T, pPropBag: ?*IPropertyBag2, pErrLog: ?*IErrorLog) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).Load(@ptrCast(*const IPersistPropertyBag2, self), pPropBag, pErrLog); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_Save(self: *const T, pPropBag: ?*IPropertyBag2, fClearDirty: BOOL, fSaveAllProperties: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).Save(@ptrCast(*const IPersistPropertyBag2, self), pPropBag, fClearDirty, fSaveAllProperties); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPersistPropertyBag2_IsDirty(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IPersistPropertyBag2.VTable, self.vtable).IsDirty(@ptrCast(*const IPersistPropertyBag2, self)); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IAdviseSinkEx_Value = Guid.initString("3af24290-0c96-11ce-a0cf-00aa00600ab8"); pub const IID_IAdviseSinkEx = &IID_IAdviseSinkEx_Value; pub const IAdviseSinkEx = extern struct { pub const VTable = extern struct { base: IAdviseSink.VTable, OnViewStatusChange: fn( self: *const IAdviseSinkEx, dwViewStatus: u32, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IAdviseSink.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IAdviseSinkEx_OnViewStatusChange(self: *const T, dwViewStatus: u32) callconv(.Inline) void { return @ptrCast(*const IAdviseSinkEx.VTable, self.vtable).OnViewStatusChange(@ptrCast(*const IAdviseSinkEx, self), dwViewStatus); } };} pub usingnamespace MethodMixin(@This()); }; pub const QACONTAINERFLAGS = enum(i32) { SHOWHATCHING = 1, SHOWGRABHANDLES = 2, USERMODE = 4, DISPLAYASDEFAULT = 8, UIDEAD = 16, AUTOCLIP = 32, MESSAGEREFLECT = 64, SUPPORTSMNEMONICS = 128, }; pub const QACONTAINER_SHOWHATCHING = QACONTAINERFLAGS.SHOWHATCHING; pub const QACONTAINER_SHOWGRABHANDLES = QACONTAINERFLAGS.SHOWGRABHANDLES; pub const QACONTAINER_USERMODE = QACONTAINERFLAGS.USERMODE; pub const QACONTAINER_DISPLAYASDEFAULT = QACONTAINERFLAGS.DISPLAYASDEFAULT; pub const QACONTAINER_UIDEAD = QACONTAINERFLAGS.UIDEAD; pub const QACONTAINER_AUTOCLIP = QACONTAINERFLAGS.AUTOCLIP; pub const QACONTAINER_MESSAGEREFLECT = QACONTAINERFLAGS.MESSAGEREFLECT; pub const QACONTAINER_SUPPORTSMNEMONICS = QACONTAINERFLAGS.SUPPORTSMNEMONICS; pub const QACONTAINER = extern struct { cbSize: u32, pClientSite: ?*IOleClientSite, pAdviseSink: ?*IAdviseSinkEx, pPropertyNotifySink: ?*IPropertyNotifySink, pUnkEventSink: ?*IUnknown, dwAmbientFlags: u32, colorFore: u32, colorBack: u32, pFont: ?*IFont, pUndoMgr: ?*IOleUndoManager, dwAppearance: u32, lcid: i32, hpal: ?HPALETTE, pBindHost: ?*IBindHost, pOleControlSite: ?*IOleControlSite, pServiceProvider: ?*IServiceProvider, }; pub const QACONTROL = extern struct { cbSize: u32, dwMiscStatus: u32, dwViewStatus: u32, dwEventCookie: u32, dwPropNotifyCookie: u32, dwPointerActivationPolicy: u32, }; // TODO: this type is limited to platform 'windows5.0' const IID_IQuickActivate_Value = Guid.initString("cf51ed10-62fe-11cf-bf86-00a0c9034836"); pub const IID_IQuickActivate = &IID_IQuickActivate_Value; pub const IQuickActivate = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QuickActivate: fn( self: *const IQuickActivate, pQaContainer: ?*QACONTAINER, pQaControl: ?*QACONTROL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetContentExtent: fn( self: *const IQuickActivate, pSizel: ?*SIZE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetContentExtent: fn( self: *const IQuickActivate, pSizel: ?*SIZE, ) 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 IQuickActivate_QuickActivate(self: *const T, pQaContainer: ?*QACONTAINER, pQaControl: ?*QACONTROL) callconv(.Inline) HRESULT { return @ptrCast(*const IQuickActivate.VTable, self.vtable).QuickActivate(@ptrCast(*const IQuickActivate, self), pQaContainer, pQaControl); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IQuickActivate_SetContentExtent(self: *const T, pSizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IQuickActivate.VTable, self.vtable).SetContentExtent(@ptrCast(*const IQuickActivate, self), pSizel); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IQuickActivate_GetContentExtent(self: *const T, pSizel: ?*SIZE) callconv(.Inline) HRESULT { return @ptrCast(*const IQuickActivate.VTable, self.vtable).GetContentExtent(@ptrCast(*const IQuickActivate, self), pSizel); } };} pub usingnamespace MethodMixin(@This()); }; pub const OCPFIPARAMS = extern struct { cbStructSize: u32, hWndOwner: ?HWND, x: i32, y: i32, lpszCaption: ?[*:0]const u16, cObjects: u32, lplpUnk: ?*?*IUnknown, cPages: u32, lpPages: ?*Guid, lcid: u32, dispidInitialProperty: i32, }; pub const FONTDESC = extern struct { cbSizeofstruct: u32, lpstrName: ?PWSTR, cySize: CY, sWeight: i16, sCharset: i16, fItalic: BOOL, fUnderline: BOOL, fStrikethrough: BOOL, }; pub const PICTDESC = extern struct { cbSizeofstruct: u32, picType: u32, Anonymous: extern union { bmp: extern struct { hbitmap: ?HBITMAP, hpal: ?HPALETTE, }, wmf: extern struct { hmeta: ?HMETAFILE, xExt: i32, yExt: i32, }, icon: extern struct { hicon: ?HICON, }, emf: extern struct { hemf: ?HENHMETAFILE, }, }, }; pub const OLE_TRISTATE = enum(i32) { Unchecked = 0, Checked = 1, Gray = 2, }; pub const triUnchecked = OLE_TRISTATE.Unchecked; pub const triChecked = OLE_TRISTATE.Checked; pub const triGray = OLE_TRISTATE.Gray; const IID_IVBGetControl_Value = Guid.initString("40a050a0-3c31-101b-a82e-08002b2b2337"); pub const IID_IVBGetControl = &IID_IVBGetControl_Value; pub const IVBGetControl = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, EnumControls: fn( self: *const IVBGetControl, dwOleContF: OLECONTF, dwWhich: ENUM_CONTROLS_WHICH_FLAGS, ppenumUnk: ?*?*IEnumUnknown, ) 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 IVBGetControl_EnumControls(self: *const T, dwOleContF: OLECONTF, dwWhich: ENUM_CONTROLS_WHICH_FLAGS, ppenumUnk: ?*?*IEnumUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IVBGetControl.VTable, self.vtable).EnumControls(@ptrCast(*const IVBGetControl, self), dwOleContF, dwWhich, ppenumUnk); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IGetOleObject_Value = Guid.initString("8a701da0-4feb-101b-a82e-08002b2b2337"); pub const IID_IGetOleObject = &IID_IGetOleObject_Value; pub const IGetOleObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetOleObject: fn( self: *const IGetOleObject, riid: ?*const Guid, ppvObj: ?*?*anyopaque, ) 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 IGetOleObject_GetOleObject(self: *const T, riid: ?*const Guid, ppvObj: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IGetOleObject.VTable, self.vtable).GetOleObject(@ptrCast(*const IGetOleObject, self), riid, ppvObj); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IVBFormat_Value = Guid.initString("9849fd60-3768-101b-8d72-ae6164ffe3cf"); pub const IID_IVBFormat = &IID_IVBFormat_Value; pub const IVBFormat = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Format: fn( self: *const IVBFormat, vData: ?*VARIANT, bstrFormat: ?BSTR, lpBuffer: ?*anyopaque, cb: u16, lcid: i32, sFirstDayOfWeek: i16, sFirstWeekOfYear: u16, rcb: ?*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 IVBFormat_Format(self: *const T, vData: ?*VARIANT, bstrFormat: ?BSTR, lpBuffer: ?*anyopaque, cb: u16, lcid: i32, sFirstDayOfWeek: i16, sFirstWeekOfYear: u16, rcb: ?*u16) callconv(.Inline) HRESULT { return @ptrCast(*const IVBFormat.VTable, self.vtable).Format(@ptrCast(*const IVBFormat, self), vData, bstrFormat, lpBuffer, cb, lcid, sFirstDayOfWeek, sFirstWeekOfYear, rcb); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IGetVBAObject_Value = Guid.initString("91733a60-3f4c-101b-a3f6-00aa0034e4e9"); pub const IID_IGetVBAObject = &IID_IGetVBAObject_Value; pub const IGetVBAObject = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetObject: fn( self: *const IGetVBAObject, riid: ?*const Guid, ppvObj: ?*?*anyopaque, dwReserved: 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 IGetVBAObject_GetObject(self: *const T, riid: ?*const Guid, ppvObj: ?*?*anyopaque, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IGetVBAObject.VTable, self.vtable).GetObject(@ptrCast(*const IGetVBAObject, self), riid, ppvObj, dwReserved); } };} pub usingnamespace MethodMixin(@This()); }; pub const DOCMISC = enum(i32) { CANCREATEMULTIPLEVIEWS = 1, SUPPORTCOMPLEXRECTANGLES = 2, CANTOPENEDIT = 4, NOFILESUPPORT = 8, }; pub const DOCMISC_CANCREATEMULTIPLEVIEWS = DOCMISC.CANCREATEMULTIPLEVIEWS; pub const DOCMISC_SUPPORTCOMPLEXRECTANGLES = DOCMISC.SUPPORTCOMPLEXRECTANGLES; pub const DOCMISC_CANTOPENEDIT = DOCMISC.CANTOPENEDIT; pub const DOCMISC_NOFILESUPPORT = DOCMISC.NOFILESUPPORT; // TODO: this type is limited to platform 'windows5.0' const IID_IOleDocument_Value = Guid.initString("b722bcc5-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleDocument = &IID_IOleDocument_Value; pub const IOleDocument = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateView: fn( self: *const IOleDocument, pIPSite: ?*IOleInPlaceSite, pstm: ?*IStream, dwReserved: u32, ppView: ?*?*IOleDocumentView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocMiscStatus: fn( self: *const IOleDocument, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumViews: fn( self: *const IOleDocument, ppEnum: ?*?*IEnumOleDocumentViews, ppView: ?*?*IOleDocumentView, ) 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 IOleDocument_CreateView(self: *const T, pIPSite: ?*IOleInPlaceSite, pstm: ?*IStream, dwReserved: u32, ppView: ?*?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocument.VTable, self.vtable).CreateView(@ptrCast(*const IOleDocument, self), pIPSite, pstm, dwReserved, ppView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocument_GetDocMiscStatus(self: *const T, pdwStatus: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocument.VTable, self.vtable).GetDocMiscStatus(@ptrCast(*const IOleDocument, self), pdwStatus); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocument_EnumViews(self: *const T, ppEnum: ?*?*IEnumOleDocumentViews, ppView: ?*?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocument.VTable, self.vtable).EnumViews(@ptrCast(*const IOleDocument, self), ppEnum, ppView); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleDocumentSite_Value = Guid.initString("b722bcc7-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleDocumentSite = &IID_IOleDocumentSite_Value; pub const IOleDocumentSite = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ActivateMe: fn( self: *const IOleDocumentSite, pViewToActivate: ?*IOleDocumentView, ) 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 IOleDocumentSite_ActivateMe(self: *const T, pViewToActivate: ?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentSite.VTable, self.vtable).ActivateMe(@ptrCast(*const IOleDocumentSite, self), pViewToActivate); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IOleDocumentView_Value = Guid.initString("b722bcc6-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleDocumentView = &IID_IOleDocumentView_Value; pub const IOleDocumentView = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetInPlaceSite: fn( self: *const IOleDocumentView, pIPSite: ?*IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInPlaceSite: fn( self: *const IOleDocumentView, ppIPSite: ?*?*IOleInPlaceSite, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDocument: fn( self: *const IOleDocumentView, ppunk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRect: fn( self: *const IOleDocumentView, prcView: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRect: fn( self: *const IOleDocumentView, prcView: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRectComplex: fn( self: *const IOleDocumentView, prcView: ?*RECT, prcHScroll: ?*RECT, prcVScroll: ?*RECT, prcSizeBox: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Show: fn( self: *const IOleDocumentView, fShow: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UIActivate: fn( self: *const IOleDocumentView, fUIActivate: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Open: fn( self: *const IOleDocumentView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseView: fn( self: *const IOleDocumentView, dwReserved: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SaveViewState: fn( self: *const IOleDocumentView, pstm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ApplyViewState: fn( self: *const IOleDocumentView, pstm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IOleDocumentView, pIPSiteNew: ?*IOleInPlaceSite, ppViewNew: ?*?*IOleDocumentView, ) 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 IOleDocumentView_SetInPlaceSite(self: *const T, pIPSite: ?*IOleInPlaceSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SetInPlaceSite(@ptrCast(*const IOleDocumentView, self), pIPSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_GetInPlaceSite(self: *const T, ppIPSite: ?*?*IOleInPlaceSite) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).GetInPlaceSite(@ptrCast(*const IOleDocumentView, self), ppIPSite); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_GetDocument(self: *const T, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).GetDocument(@ptrCast(*const IOleDocumentView, self), ppunk); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_SetRect(self: *const T, prcView: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SetRect(@ptrCast(*const IOleDocumentView, self), prcView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_GetRect(self: *const T, prcView: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).GetRect(@ptrCast(*const IOleDocumentView, self), prcView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_SetRectComplex(self: *const T, prcView: ?*RECT, prcHScroll: ?*RECT, prcVScroll: ?*RECT, prcSizeBox: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SetRectComplex(@ptrCast(*const IOleDocumentView, self), prcView, prcHScroll, prcVScroll, prcSizeBox); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_Show(self: *const T, fShow: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).Show(@ptrCast(*const IOleDocumentView, self), fShow); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_UIActivate(self: *const T, fUIActivate: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).UIActivate(@ptrCast(*const IOleDocumentView, self), fUIActivate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_Open(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).Open(@ptrCast(*const IOleDocumentView, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_CloseView(self: *const T, dwReserved: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).CloseView(@ptrCast(*const IOleDocumentView, self), dwReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_SaveViewState(self: *const T, pstm: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).SaveViewState(@ptrCast(*const IOleDocumentView, self), pstm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_ApplyViewState(self: *const T, pstm: ?*IStream) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).ApplyViewState(@ptrCast(*const IOleDocumentView, self), pstm); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleDocumentView_Clone(self: *const T, pIPSiteNew: ?*IOleInPlaceSite, ppViewNew: ?*?*IOleDocumentView) callconv(.Inline) HRESULT { return @ptrCast(*const IOleDocumentView.VTable, self.vtable).Clone(@ptrCast(*const IOleDocumentView, self), pIPSiteNew, ppViewNew); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IEnumOleDocumentViews_Value = Guid.initString("b722bcc8-4e68-101b-a2bc-00aa00404770"); pub const IID_IEnumOleDocumentViews = &IID_IEnumOleDocumentViews_Value; pub const IEnumOleDocumentViews = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Next: fn( self: *const IEnumOleDocumentViews, cViews: u32, rgpView: ?*?*IOleDocumentView, pcFetched: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Skip: fn( self: *const IEnumOleDocumentViews, cViews: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Reset: fn( self: *const IEnumOleDocumentViews, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Clone: fn( self: *const IEnumOleDocumentViews, ppEnum: ?*?*IEnumOleDocumentViews, ) 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 IEnumOleDocumentViews_Next(self: *const T, cViews: u32, rgpView: ?*?*IOleDocumentView, pcFetched: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Next(@ptrCast(*const IEnumOleDocumentViews, self), cViews, rgpView, pcFetched); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleDocumentViews_Skip(self: *const T, cViews: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Skip(@ptrCast(*const IEnumOleDocumentViews, self), cViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleDocumentViews_Reset(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Reset(@ptrCast(*const IEnumOleDocumentViews, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IEnumOleDocumentViews_Clone(self: *const T, ppEnum: ?*?*IEnumOleDocumentViews) callconv(.Inline) HRESULT { return @ptrCast(*const IEnumOleDocumentViews.VTable, self.vtable).Clone(@ptrCast(*const IEnumOleDocumentViews, self), ppEnum); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' const IID_IContinueCallback_Value = Guid.initString("b722bcca-4e68-101b-a2bc-00aa00404770"); pub const IID_IContinueCallback = &IID_IContinueCallback_Value; pub const IContinueCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, FContinue: fn( self: *const IContinueCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FContinuePrinting: fn( self: *const IContinueCallback, nCntPrinted: i32, nCurPage: i32, pwszPrintStatus: ?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 IContinueCallback_FContinue(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IContinueCallback.VTable, self.vtable).FContinue(@ptrCast(*const IContinueCallback, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IContinueCallback_FContinuePrinting(self: *const T, nCntPrinted: i32, nCurPage: i32, pwszPrintStatus: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IContinueCallback.VTable, self.vtable).FContinuePrinting(@ptrCast(*const IContinueCallback, self), nCntPrinted, nCurPage, pwszPrintStatus); } };} pub usingnamespace MethodMixin(@This()); }; pub const PRINTFLAG = enum(u32) { MAYBOTHERUSER = 1, PROMPTUSER = 2, USERMAYCHANGEPRINTER = 4, RECOMPOSETODEVICE = 8, DONTACTUALLYPRINT = 16, FORCEPROPERTIES = 32, PRINTTOFILE = 64, _, pub fn initFlags(o: struct { MAYBOTHERUSER: u1 = 0, PROMPTUSER: u1 = 0, USERMAYCHANGEPRINTER: u1 = 0, RECOMPOSETODEVICE: u1 = 0, DONTACTUALLYPRINT: u1 = 0, FORCEPROPERTIES: u1 = 0, PRINTTOFILE: u1 = 0, }) PRINTFLAG { return @intToEnum(PRINTFLAG, (if (o.MAYBOTHERUSER == 1) @enumToInt(PRINTFLAG.MAYBOTHERUSER) else 0) | (if (o.PROMPTUSER == 1) @enumToInt(PRINTFLAG.PROMPTUSER) else 0) | (if (o.USERMAYCHANGEPRINTER == 1) @enumToInt(PRINTFLAG.USERMAYCHANGEPRINTER) else 0) | (if (o.RECOMPOSETODEVICE == 1) @enumToInt(PRINTFLAG.RECOMPOSETODEVICE) else 0) | (if (o.DONTACTUALLYPRINT == 1) @enumToInt(PRINTFLAG.DONTACTUALLYPRINT) else 0) | (if (o.FORCEPROPERTIES == 1) @enumToInt(PRINTFLAG.FORCEPROPERTIES) else 0) | (if (o.PRINTTOFILE == 1) @enumToInt(PRINTFLAG.PRINTTOFILE) else 0) ); } }; pub const PRINTFLAG_MAYBOTHERUSER = PRINTFLAG.MAYBOTHERUSER; pub const PRINTFLAG_PROMPTUSER = PRINTFLAG.PROMPTUSER; pub const PRINTFLAG_USERMAYCHANGEPRINTER = PRINTFLAG.USERMAYCHANGEPRINTER; pub const PRINTFLAG_RECOMPOSETODEVICE = PRINTFLAG.RECOMPOSETODEVICE; pub const PRINTFLAG_DONTACTUALLYPRINT = PRINTFLAG.DONTACTUALLYPRINT; pub const PRINTFLAG_FORCEPROPERTIES = PRINTFLAG.FORCEPROPERTIES; pub const PRINTFLAG_PRINTTOFILE = PRINTFLAG.PRINTTOFILE; pub const PAGERANGE = extern struct { nFromPage: i32, nToPage: i32, }; pub const PAGESET = extern struct { cbStruct: u32, fOddPages: BOOL, fEvenPages: BOOL, cPageRange: u32, rgPages: [1]PAGERANGE, }; // TODO: this type is limited to platform 'windows5.0' const IID_IPrint_Value = Guid.initString("b722bcc9-4e68-101b-a2bc-00aa00404770"); pub const IID_IPrint = &IID_IPrint_Value; pub const IPrint = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetInitialPageNum: fn( self: *const IPrint, nFirstPage: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPageInfo: fn( self: *const IPrint, pnFirstPage: ?*i32, pcPages: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Print: fn( self: *const IPrint, grfFlags: u32, pptd: ?*?*DVTARGETDEVICE, ppPageSet: ?*?*PAGESET, pstgmOptions: ?*STGMEDIUM, pcallback: ?*IContinueCallback, nFirstPage: i32, pcPagesPrinted: ?*i32, pnLastPage: ?*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 IPrint_SetInitialPageNum(self: *const T, nFirstPage: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPrint.VTable, self.vtable).SetInitialPageNum(@ptrCast(*const IPrint, self), nFirstPage); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrint_GetPageInfo(self: *const T, pnFirstPage: ?*i32, pcPages: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPrint.VTable, self.vtable).GetPageInfo(@ptrCast(*const IPrint, self), pnFirstPage, pcPages); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPrint_Print(self: *const T, grfFlags: u32, pptd: ?*?*DVTARGETDEVICE, ppPageSet: ?*?*PAGESET, pstgmOptions: ?*STGMEDIUM, pcallback: ?*IContinueCallback, nFirstPage: i32, pcPagesPrinted: ?*i32, pnLastPage: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPrint.VTable, self.vtable).Print(@ptrCast(*const IPrint, self), grfFlags, pptd, ppPageSet, pstgmOptions, pcallback, nFirstPage, pcPagesPrinted, pnLastPage); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLECMDF = enum(i32) { SUPPORTED = 1, ENABLED = 2, LATCHED = 4, NINCHED = 8, INVISIBLE = 16, DEFHIDEONCTXTMENU = 32, }; pub const OLECMDF_SUPPORTED = OLECMDF.SUPPORTED; pub const OLECMDF_ENABLED = OLECMDF.ENABLED; pub const OLECMDF_LATCHED = OLECMDF.LATCHED; pub const OLECMDF_NINCHED = OLECMDF.NINCHED; pub const OLECMDF_INVISIBLE = OLECMDF.INVISIBLE; pub const OLECMDF_DEFHIDEONCTXTMENU = OLECMDF.DEFHIDEONCTXTMENU; pub const OLECMD = extern struct { cmdID: u32, cmdf: u32, }; pub const OLECMDTEXT = extern struct { cmdtextf: u32, cwActual: u32, cwBuf: u32, rgwz: [1]u16, }; pub const OLECMDTEXTF = enum(i32) { NONE = 0, NAME = 1, STATUS = 2, }; pub const OLECMDTEXTF_NONE = OLECMDTEXTF.NONE; pub const OLECMDTEXTF_NAME = OLECMDTEXTF.NAME; pub const OLECMDTEXTF_STATUS = OLECMDTEXTF.STATUS; pub const OLECMDEXECOPT = enum(i32) { DODEFAULT = 0, PROMPTUSER = 1, DONTPROMPTUSER = 2, SHOWHELP = 3, }; pub const OLECMDEXECOPT_DODEFAULT = OLECMDEXECOPT.DODEFAULT; pub const OLECMDEXECOPT_PROMPTUSER = OLECMDEXECOPT.PROMPTUSER; pub const OLECMDEXECOPT_DONTPROMPTUSER = OLECMDEXECOPT.DONTPROMPTUSER; pub const OLECMDEXECOPT_SHOWHELP = OLECMDEXECOPT.SHOWHELP; pub const OLECMDID = enum(i32) { OPEN = 1, NEW = 2, SAVE = 3, SAVEAS = 4, SAVECOPYAS = 5, PRINT = 6, PRINTPREVIEW = 7, PAGESETUP = 8, SPELL = 9, PROPERTIES = 10, CUT = 11, COPY = 12, PASTE = 13, PASTESPECIAL = 14, UNDO = 15, REDO = 16, SELECTALL = 17, CLEARSELECTION = 18, ZOOM = 19, GETZOOMRANGE = 20, UPDATECOMMANDS = 21, REFRESH = 22, STOP = 23, HIDETOOLBARS = 24, SETPROGRESSMAX = 25, SETPROGRESSPOS = 26, SETPROGRESSTEXT = 27, SETTITLE = 28, SETDOWNLOADSTATE = 29, STOPDOWNLOAD = 30, ONTOOLBARACTIVATED = 31, FIND = 32, DELETE = 33, HTTPEQUIV = 34, HTTPEQUIV_DONE = 35, ENABLE_INTERACTION = 36, ONUNLOAD = 37, PROPERTYBAG2 = 38, PREREFRESH = 39, SHOWSCRIPTERROR = 40, SHOWMESSAGE = 41, SHOWFIND = 42, SHOWPAGESETUP = 43, SHOWPRINT = 44, CLOSE = 45, ALLOWUILESSSAVEAS = 46, DONTDOWNLOADCSS = 47, UPDATEPAGESTATUS = 48, PRINT2 = 49, PRINTPREVIEW2 = 50, SETPRINTTEMPLATE = 51, GETPRINTTEMPLATE = 52, PAGEACTIONBLOCKED = 55, PAGEACTIONUIQUERY = 56, FOCUSVIEWCONTROLS = 57, FOCUSVIEWCONTROLSQUERY = 58, SHOWPAGEACTIONMENU = 59, ADDTRAVELENTRY = 60, UPDATETRAVELENTRY = 61, UPDATEBACKFORWARDSTATE = 62, OPTICAL_ZOOM = 63, OPTICAL_GETZOOMRANGE = 64, WINDOWSTATECHANGED = 65, ACTIVEXINSTALLSCOPE = 66, UPDATETRAVELENTRY_DATARECOVERY = 67, SHOWTASKDLG = 68, POPSTATEEVENT = 69, VIEWPORT_MODE = 70, LAYOUT_VIEWPORT_WIDTH = 71, VISUAL_VIEWPORT_EXCLUDE_BOTTOM = 72, USER_OPTICAL_ZOOM = 73, PAGEAVAILABLE = 74, GETUSERSCALABLE = 75, UPDATE_CARET = 76, ENABLE_VISIBILITY = 77, MEDIA_PLAYBACK = 78, SETFAVICON = 79, SET_HOST_FULLSCREENMODE = 80, EXITFULLSCREEN = 81, SCROLLCOMPLETE = 82, ONBEFOREUNLOAD = 83, SHOWMESSAGE_BLOCKABLE = 84, SHOWTASKDLG_BLOCKABLE = 85, }; pub const OLECMDID_OPEN = OLECMDID.OPEN; pub const OLECMDID_NEW = OLECMDID.NEW; pub const OLECMDID_SAVE = OLECMDID.SAVE; pub const OLECMDID_SAVEAS = OLECMDID.SAVEAS; pub const OLECMDID_SAVECOPYAS = OLECMDID.SAVECOPYAS; pub const OLECMDID_PRINT = OLECMDID.PRINT; pub const OLECMDID_PRINTPREVIEW = OLECMDID.PRINTPREVIEW; pub const OLECMDID_PAGESETUP = OLECMDID.PAGESETUP; pub const OLECMDID_SPELL = OLECMDID.SPELL; pub const OLECMDID_PROPERTIES = OLECMDID.PROPERTIES; pub const OLECMDID_CUT = OLECMDID.CUT; pub const OLECMDID_COPY = OLECMDID.COPY; pub const OLECMDID_PASTE = OLECMDID.PASTE; pub const OLECMDID_PASTESPECIAL = OLECMDID.PASTESPECIAL; pub const OLECMDID_UNDO = OLECMDID.UNDO; pub const OLECMDID_REDO = OLECMDID.REDO; pub const OLECMDID_SELECTALL = OLECMDID.SELECTALL; pub const OLECMDID_CLEARSELECTION = OLECMDID.CLEARSELECTION; pub const OLECMDID_ZOOM = OLECMDID.ZOOM; pub const OLECMDID_GETZOOMRANGE = OLECMDID.GETZOOMRANGE; pub const OLECMDID_UPDATECOMMANDS = OLECMDID.UPDATECOMMANDS; pub const OLECMDID_REFRESH = OLECMDID.REFRESH; pub const OLECMDID_STOP = OLECMDID.STOP; pub const OLECMDID_HIDETOOLBARS = OLECMDID.HIDETOOLBARS; pub const OLECMDID_SETPROGRESSMAX = OLECMDID.SETPROGRESSMAX; pub const OLECMDID_SETPROGRESSPOS = OLECMDID.SETPROGRESSPOS; pub const OLECMDID_SETPROGRESSTEXT = OLECMDID.SETPROGRESSTEXT; pub const OLECMDID_SETTITLE = OLECMDID.SETTITLE; pub const OLECMDID_SETDOWNLOADSTATE = OLECMDID.SETDOWNLOADSTATE; pub const OLECMDID_STOPDOWNLOAD = OLECMDID.STOPDOWNLOAD; pub const OLECMDID_ONTOOLBARACTIVATED = OLECMDID.ONTOOLBARACTIVATED; pub const OLECMDID_FIND = OLECMDID.FIND; pub const OLECMDID_DELETE = OLECMDID.DELETE; pub const OLECMDID_HTTPEQUIV = OLECMDID.HTTPEQUIV; pub const OLECMDID_HTTPEQUIV_DONE = OLECMDID.HTTPEQUIV_DONE; pub const OLECMDID_ENABLE_INTERACTION = OLECMDID.ENABLE_INTERACTION; pub const OLECMDID_ONUNLOAD = OLECMDID.ONUNLOAD; pub const OLECMDID_PROPERTYBAG2 = OLECMDID.PROPERTYBAG2; pub const OLECMDID_PREREFRESH = OLECMDID.PREREFRESH; pub const OLECMDID_SHOWSCRIPTERROR = OLECMDID.SHOWSCRIPTERROR; pub const OLECMDID_SHOWMESSAGE = OLECMDID.SHOWMESSAGE; pub const OLECMDID_SHOWFIND = OLECMDID.SHOWFIND; pub const OLECMDID_SHOWPAGESETUP = OLECMDID.SHOWPAGESETUP; pub const OLECMDID_SHOWPRINT = OLECMDID.SHOWPRINT; pub const OLECMDID_CLOSE = OLECMDID.CLOSE; pub const OLECMDID_ALLOWUILESSSAVEAS = OLECMDID.ALLOWUILESSSAVEAS; pub const OLECMDID_DONTDOWNLOADCSS = OLECMDID.DONTDOWNLOADCSS; pub const OLECMDID_UPDATEPAGESTATUS = OLECMDID.UPDATEPAGESTATUS; pub const OLECMDID_PRINT2 = OLECMDID.PRINT2; pub const OLECMDID_PRINTPREVIEW2 = OLECMDID.PRINTPREVIEW2; pub const OLECMDID_SETPRINTTEMPLATE = OLECMDID.SETPRINTTEMPLATE; pub const OLECMDID_GETPRINTTEMPLATE = OLECMDID.GETPRINTTEMPLATE; pub const OLECMDID_PAGEACTIONBLOCKED = OLECMDID.PAGEACTIONBLOCKED; pub const OLECMDID_PAGEACTIONUIQUERY = OLECMDID.PAGEACTIONUIQUERY; pub const OLECMDID_FOCUSVIEWCONTROLS = OLECMDID.FOCUSVIEWCONTROLS; pub const OLECMDID_FOCUSVIEWCONTROLSQUERY = OLECMDID.FOCUSVIEWCONTROLSQUERY; pub const OLECMDID_SHOWPAGEACTIONMENU = OLECMDID.SHOWPAGEACTIONMENU; pub const OLECMDID_ADDTRAVELENTRY = OLECMDID.ADDTRAVELENTRY; pub const OLECMDID_UPDATETRAVELENTRY = OLECMDID.UPDATETRAVELENTRY; pub const OLECMDID_UPDATEBACKFORWARDSTATE = OLECMDID.UPDATEBACKFORWARDSTATE; pub const OLECMDID_OPTICAL_ZOOM = OLECMDID.OPTICAL_ZOOM; pub const OLECMDID_OPTICAL_GETZOOMRANGE = OLECMDID.OPTICAL_GETZOOMRANGE; pub const OLECMDID_WINDOWSTATECHANGED = OLECMDID.WINDOWSTATECHANGED; pub const OLECMDID_ACTIVEXINSTALLSCOPE = OLECMDID.ACTIVEXINSTALLSCOPE; pub const OLECMDID_UPDATETRAVELENTRY_DATARECOVERY = OLECMDID.UPDATETRAVELENTRY_DATARECOVERY; pub const OLECMDID_SHOWTASKDLG = OLECMDID.SHOWTASKDLG; pub const OLECMDID_POPSTATEEVENT = OLECMDID.POPSTATEEVENT; pub const OLECMDID_VIEWPORT_MODE = OLECMDID.VIEWPORT_MODE; pub const OLECMDID_LAYOUT_VIEWPORT_WIDTH = OLECMDID.LAYOUT_VIEWPORT_WIDTH; pub const OLECMDID_VISUAL_VIEWPORT_EXCLUDE_BOTTOM = OLECMDID.VISUAL_VIEWPORT_EXCLUDE_BOTTOM; pub const OLECMDID_USER_OPTICAL_ZOOM = OLECMDID.USER_OPTICAL_ZOOM; pub const OLECMDID_PAGEAVAILABLE = OLECMDID.PAGEAVAILABLE; pub const OLECMDID_GETUSERSCALABLE = OLECMDID.GETUSERSCALABLE; pub const OLECMDID_UPDATE_CARET = OLECMDID.UPDATE_CARET; pub const OLECMDID_ENABLE_VISIBILITY = OLECMDID.ENABLE_VISIBILITY; pub const OLECMDID_MEDIA_PLAYBACK = OLECMDID.MEDIA_PLAYBACK; pub const OLECMDID_SETFAVICON = OLECMDID.SETFAVICON; pub const OLECMDID_SET_HOST_FULLSCREENMODE = OLECMDID.SET_HOST_FULLSCREENMODE; pub const OLECMDID_EXITFULLSCREEN = OLECMDID.EXITFULLSCREEN; pub const OLECMDID_SCROLLCOMPLETE = OLECMDID.SCROLLCOMPLETE; pub const OLECMDID_ONBEFOREUNLOAD = OLECMDID.ONBEFOREUNLOAD; pub const OLECMDID_SHOWMESSAGE_BLOCKABLE = OLECMDID.SHOWMESSAGE_BLOCKABLE; pub const OLECMDID_SHOWTASKDLG_BLOCKABLE = OLECMDID.SHOWTASKDLG_BLOCKABLE; pub const MEDIAPLAYBACK_STATE = enum(i32) { RESUME = 0, PAUSE = 1, PAUSE_AND_SUSPEND = 2, RESUME_FROM_SUSPEND = 3, }; pub const MEDIAPLAYBACK_RESUME = MEDIAPLAYBACK_STATE.RESUME; pub const MEDIAPLAYBACK_PAUSE = MEDIAPLAYBACK_STATE.PAUSE; pub const MEDIAPLAYBACK_PAUSE_AND_SUSPEND = MEDIAPLAYBACK_STATE.PAUSE_AND_SUSPEND; pub const MEDIAPLAYBACK_RESUME_FROM_SUSPEND = MEDIAPLAYBACK_STATE.RESUME_FROM_SUSPEND; pub const IGNOREMIME = enum(i32) { PROMPT = 1, TEXT = 2, }; pub const IGNOREMIME_PROMPT = IGNOREMIME.PROMPT; pub const IGNOREMIME_TEXT = IGNOREMIME.TEXT; pub const WPCSETTING = enum(i32) { LOGGING_ENABLED = 1, FILEDOWNLOAD_BLOCKED = 2, }; pub const WPCSETTING_LOGGING_ENABLED = WPCSETTING.LOGGING_ENABLED; pub const WPCSETTING_FILEDOWNLOAD_BLOCKED = WPCSETTING.FILEDOWNLOAD_BLOCKED; // TODO: this type is limited to platform 'windows5.0' const IID_IOleCommandTarget_Value = Guid.initString("b722bccb-4e68-101b-a2bc-00aa00404770"); pub const IID_IOleCommandTarget = &IID_IOleCommandTarget_Value; pub const IOleCommandTarget = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryStatus: fn( self: *const IOleCommandTarget, pguidCmdGroup: ?*const Guid, cCmds: u32, prgCmds: ?*OLECMD, pCmdText: ?*OLECMDTEXT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Exec: fn( self: *const IOleCommandTarget, pguidCmdGroup: ?*const Guid, nCmdID: u32, nCmdexecopt: u32, pvaIn: ?*VARIANT, pvaOut: ?*VARIANT, ) 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 IOleCommandTarget_QueryStatus(self: *const T, pguidCmdGroup: ?*const Guid, cCmds: u32, prgCmds: ?*OLECMD, pCmdText: ?*OLECMDTEXT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCommandTarget.VTable, self.vtable).QueryStatus(@ptrCast(*const IOleCommandTarget, self), pguidCmdGroup, cCmds, prgCmds, pCmdText); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleCommandTarget_Exec(self: *const T, pguidCmdGroup: ?*const Guid, nCmdID: u32, nCmdexecopt: u32, pvaIn: ?*VARIANT, pvaOut: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const IOleCommandTarget.VTable, self.vtable).Exec(@ptrCast(*const IOleCommandTarget, self), pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLECMDID_REFRESHFLAG = enum(i32) { NORMAL = 0, IFEXPIRED = 1, CONTINUE = 2, COMPLETELY = 3, NO_CACHE = 4, RELOAD = 5, LEVELMASK = 255, CLEARUSERINPUT = 4096, PROMPTIFOFFLINE = 8192, THROUGHSCRIPT = 16384, SKIPBEFOREUNLOADEVENT = 32768, PAGEACTION_ACTIVEXINSTALL = 65536, PAGEACTION_FILEDOWNLOAD = 131072, PAGEACTION_LOCALMACHINE = 262144, PAGEACTION_POPUPWINDOW = 524288, PAGEACTION_PROTLOCKDOWNLOCALMACHINE = 1048576, PAGEACTION_PROTLOCKDOWNTRUSTED = 2097152, PAGEACTION_PROTLOCKDOWNINTRANET = 4194304, PAGEACTION_PROTLOCKDOWNINTERNET = 8388608, PAGEACTION_PROTLOCKDOWNRESTRICTED = 16777216, PAGEACTION_MIXEDCONTENT = 33554432, PAGEACTION_INVALID_CERT = 67108864, PAGEACTION_ALLOW_VERSION = 134217728, }; pub const OLECMDIDF_REFRESH_NORMAL = OLECMDID_REFRESHFLAG.NORMAL; pub const OLECMDIDF_REFRESH_IFEXPIRED = OLECMDID_REFRESHFLAG.IFEXPIRED; pub const OLECMDIDF_REFRESH_CONTINUE = OLECMDID_REFRESHFLAG.CONTINUE; pub const OLECMDIDF_REFRESH_COMPLETELY = OLECMDID_REFRESHFLAG.COMPLETELY; pub const OLECMDIDF_REFRESH_NO_CACHE = OLECMDID_REFRESHFLAG.NO_CACHE; pub const OLECMDIDF_REFRESH_RELOAD = OLECMDID_REFRESHFLAG.RELOAD; pub const OLECMDIDF_REFRESH_LEVELMASK = OLECMDID_REFRESHFLAG.LEVELMASK; pub const OLECMDIDF_REFRESH_CLEARUSERINPUT = OLECMDID_REFRESHFLAG.CLEARUSERINPUT; pub const OLECMDIDF_REFRESH_PROMPTIFOFFLINE = OLECMDID_REFRESHFLAG.PROMPTIFOFFLINE; pub const OLECMDIDF_REFRESH_THROUGHSCRIPT = OLECMDID_REFRESHFLAG.THROUGHSCRIPT; pub const OLECMDIDF_REFRESH_SKIPBEFOREUNLOADEVENT = OLECMDID_REFRESHFLAG.SKIPBEFOREUNLOADEVENT; pub const OLECMDIDF_REFRESH_PAGEACTION_ACTIVEXINSTALL = OLECMDID_REFRESHFLAG.PAGEACTION_ACTIVEXINSTALL; pub const OLECMDIDF_REFRESH_PAGEACTION_FILEDOWNLOAD = OLECMDID_REFRESHFLAG.PAGEACTION_FILEDOWNLOAD; pub const OLECMDIDF_REFRESH_PAGEACTION_LOCALMACHINE = OLECMDID_REFRESHFLAG.PAGEACTION_LOCALMACHINE; pub const OLECMDIDF_REFRESH_PAGEACTION_POPUPWINDOW = OLECMDID_REFRESHFLAG.PAGEACTION_POPUPWINDOW; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNLOCALMACHINE = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNLOCALMACHINE; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNTRUSTED = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNTRUSTED; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNINTRANET = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNINTRANET; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNINTERNET = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNINTERNET; pub const OLECMDIDF_REFRESH_PAGEACTION_PROTLOCKDOWNRESTRICTED = OLECMDID_REFRESHFLAG.PAGEACTION_PROTLOCKDOWNRESTRICTED; pub const OLECMDIDF_REFRESH_PAGEACTION_MIXEDCONTENT = OLECMDID_REFRESHFLAG.PAGEACTION_MIXEDCONTENT; pub const OLECMDIDF_REFRESH_PAGEACTION_INVALID_CERT = OLECMDID_REFRESHFLAG.PAGEACTION_INVALID_CERT; pub const OLECMDIDF_REFRESH_PAGEACTION_ALLOW_VERSION = OLECMDID_REFRESHFLAG.PAGEACTION_ALLOW_VERSION; pub const OLECMDID_PAGEACTIONFLAG = enum(i32) { FILEDOWNLOAD = 1, ACTIVEXINSTALL = 2, ACTIVEXTRUSTFAIL = 4, ACTIVEXUSERDISABLE = 8, ACTIVEXDISALLOW = 16, ACTIVEXUNSAFE = 32, POPUPWINDOW = 64, LOCALMACHINE = 128, MIMETEXTPLAIN = 256, SCRIPTNAVIGATE = 512, // SCRIPTNAVIGATE_ACTIVEXINSTALL = 512, this enum value conflicts with SCRIPTNAVIGATE PROTLOCKDOWNLOCALMACHINE = 1024, PROTLOCKDOWNTRUSTED = 2048, PROTLOCKDOWNINTRANET = 4096, PROTLOCKDOWNINTERNET = 8192, PROTLOCKDOWNRESTRICTED = 16384, PROTLOCKDOWNDENY = 32768, POPUPALLOWED = 65536, SCRIPTPROMPT = 131072, ACTIVEXUSERAPPROVAL = 262144, MIXEDCONTENT = 524288, INVALID_CERT = 1048576, INTRANETZONEREQUEST = 2097152, XSSFILTERED = 4194304, SPOOFABLEIDNHOST = 8388608, ACTIVEX_EPM_INCOMPATIBLE = 16777216, SCRIPTNAVIGATE_ACTIVEXUSERAPPROVAL = 33554432, WPCBLOCKED = 67108864, WPCBLOCKED_ACTIVEX = 134217728, EXTENSION_COMPAT_BLOCKED = 268435456, NORESETACTIVEX = 536870912, GENERIC_STATE = 1073741824, RESET = -2147483648, }; pub const OLECMDIDF_PAGEACTION_FILEDOWNLOAD = OLECMDID_PAGEACTIONFLAG.FILEDOWNLOAD; pub const OLECMDIDF_PAGEACTION_ACTIVEXINSTALL = OLECMDID_PAGEACTIONFLAG.ACTIVEXINSTALL; pub const OLECMDIDF_PAGEACTION_ACTIVEXTRUSTFAIL = OLECMDID_PAGEACTIONFLAG.ACTIVEXTRUSTFAIL; pub const OLECMDIDF_PAGEACTION_ACTIVEXUSERDISABLE = OLECMDID_PAGEACTIONFLAG.ACTIVEXUSERDISABLE; pub const OLECMDIDF_PAGEACTION_ACTIVEXDISALLOW = OLECMDID_PAGEACTIONFLAG.ACTIVEXDISALLOW; pub const OLECMDIDF_PAGEACTION_ACTIVEXUNSAFE = OLECMDID_PAGEACTIONFLAG.ACTIVEXUNSAFE; pub const OLECMDIDF_PAGEACTION_POPUPWINDOW = OLECMDID_PAGEACTIONFLAG.POPUPWINDOW; pub const OLECMDIDF_PAGEACTION_LOCALMACHINE = OLECMDID_PAGEACTIONFLAG.LOCALMACHINE; pub const OLECMDIDF_PAGEACTION_MIMETEXTPLAIN = OLECMDID_PAGEACTIONFLAG.MIMETEXTPLAIN; pub const OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE = OLECMDID_PAGEACTIONFLAG.SCRIPTNAVIGATE; pub const OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE_ACTIVEXINSTALL = OLECMDID_PAGEACTIONFLAG.SCRIPTNAVIGATE; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNLOCALMACHINE = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNLOCALMACHINE; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNTRUSTED = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNTRUSTED; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNINTRANET = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNINTRANET; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNINTERNET = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNINTERNET; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNRESTRICTED = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNRESTRICTED; pub const OLECMDIDF_PAGEACTION_PROTLOCKDOWNDENY = OLECMDID_PAGEACTIONFLAG.PROTLOCKDOWNDENY; pub const OLECMDIDF_PAGEACTION_POPUPALLOWED = OLECMDID_PAGEACTIONFLAG.POPUPALLOWED; pub const OLECMDIDF_PAGEACTION_SCRIPTPROMPT = OLECMDID_PAGEACTIONFLAG.SCRIPTPROMPT; pub const OLECMDIDF_PAGEACTION_ACTIVEXUSERAPPROVAL = OLECMDID_PAGEACTIONFLAG.ACTIVEXUSERAPPROVAL; pub const OLECMDIDF_PAGEACTION_MIXEDCONTENT = OLECMDID_PAGEACTIONFLAG.MIXEDCONTENT; pub const OLECMDIDF_PAGEACTION_INVALID_CERT = OLECMDID_PAGEACTIONFLAG.INVALID_CERT; pub const OLECMDIDF_PAGEACTION_INTRANETZONEREQUEST = OLECMDID_PAGEACTIONFLAG.INTRANETZONEREQUEST; pub const OLECMDIDF_PAGEACTION_XSSFILTERED = OLECMDID_PAGEACTIONFLAG.XSSFILTERED; pub const OLECMDIDF_PAGEACTION_SPOOFABLEIDNHOST = OLECMDID_PAGEACTIONFLAG.SPOOFABLEIDNHOST; pub const OLECMDIDF_PAGEACTION_ACTIVEX_EPM_INCOMPATIBLE = OLECMDID_PAGEACTIONFLAG.ACTIVEX_EPM_INCOMPATIBLE; pub const OLECMDIDF_PAGEACTION_SCRIPTNAVIGATE_ACTIVEXUSERAPPROVAL = OLECMDID_PAGEACTIONFLAG.SCRIPTNAVIGATE_ACTIVEXUSERAPPROVAL; pub const OLECMDIDF_PAGEACTION_WPCBLOCKED = OLECMDID_PAGEACTIONFLAG.WPCBLOCKED; pub const OLECMDIDF_PAGEACTION_WPCBLOCKED_ACTIVEX = OLECMDID_PAGEACTIONFLAG.WPCBLOCKED_ACTIVEX; pub const OLECMDIDF_PAGEACTION_EXTENSION_COMPAT_BLOCKED = OLECMDID_PAGEACTIONFLAG.EXTENSION_COMPAT_BLOCKED; pub const OLECMDIDF_PAGEACTION_NORESETACTIVEX = OLECMDID_PAGEACTIONFLAG.NORESETACTIVEX; pub const OLECMDIDF_PAGEACTION_GENERIC_STATE = OLECMDID_PAGEACTIONFLAG.GENERIC_STATE; pub const OLECMDIDF_PAGEACTION_RESET = OLECMDID_PAGEACTIONFLAG.RESET; pub const OLECMDID_BROWSERSTATEFLAG = enum(i32) { EXTENSIONSOFF = 1, IESECURITY = 2, PROTECTEDMODE_OFF = 4, RESET = 8, REQUIRESACTIVEX = 16, DESKTOPHTMLDIALOG = 32, BLOCKEDVERSION = 64, }; pub const OLECMDIDF_BROWSERSTATE_EXTENSIONSOFF = OLECMDID_BROWSERSTATEFLAG.EXTENSIONSOFF; pub const OLECMDIDF_BROWSERSTATE_IESECURITY = OLECMDID_BROWSERSTATEFLAG.IESECURITY; pub const OLECMDIDF_BROWSERSTATE_PROTECTEDMODE_OFF = OLECMDID_BROWSERSTATEFLAG.PROTECTEDMODE_OFF; pub const OLECMDIDF_BROWSERSTATE_RESET = OLECMDID_BROWSERSTATEFLAG.RESET; pub const OLECMDIDF_BROWSERSTATE_REQUIRESACTIVEX = OLECMDID_BROWSERSTATEFLAG.REQUIRESACTIVEX; pub const OLECMDIDF_BROWSERSTATE_DESKTOPHTMLDIALOG = OLECMDID_BROWSERSTATEFLAG.DESKTOPHTMLDIALOG; pub const OLECMDIDF_BROWSERSTATE_BLOCKEDVERSION = OLECMDID_BROWSERSTATEFLAG.BLOCKEDVERSION; pub const OLECMDID_OPTICAL_ZOOMFLAG = enum(i32) { NOPERSIST = 1, NOLAYOUT = 16, NOTRANSIENT = 32, RELOADFORNEWTAB = 64, }; pub const OLECMDIDF_OPTICAL_ZOOM_NOPERSIST = OLECMDID_OPTICAL_ZOOMFLAG.NOPERSIST; pub const OLECMDIDF_OPTICAL_ZOOM_NOLAYOUT = OLECMDID_OPTICAL_ZOOMFLAG.NOLAYOUT; pub const OLECMDIDF_OPTICAL_ZOOM_NOTRANSIENT = OLECMDID_OPTICAL_ZOOMFLAG.NOTRANSIENT; pub const OLECMDIDF_OPTICAL_ZOOM_RELOADFORNEWTAB = OLECMDID_OPTICAL_ZOOMFLAG.RELOADFORNEWTAB; pub const PAGEACTION_UI = enum(i32) { DEFAULT = 0, MODAL = 1, MODELESS = 2, SILENT = 3, }; pub const PAGEACTION_UI_DEFAULT = PAGEACTION_UI.DEFAULT; pub const PAGEACTION_UI_MODAL = PAGEACTION_UI.MODAL; pub const PAGEACTION_UI_MODELESS = PAGEACTION_UI.MODELESS; pub const PAGEACTION_UI_SILENT = PAGEACTION_UI.SILENT; pub const OLECMDID_WINDOWSTATE_FLAG = enum(i32) { USERVISIBLE = 1, ENABLED = 2, USERVISIBLE_VALID = 65536, ENABLED_VALID = 131072, }; pub const OLECMDIDF_WINDOWSTATE_USERVISIBLE = OLECMDID_WINDOWSTATE_FLAG.USERVISIBLE; pub const OLECMDIDF_WINDOWSTATE_ENABLED = OLECMDID_WINDOWSTATE_FLAG.ENABLED; pub const OLECMDIDF_WINDOWSTATE_USERVISIBLE_VALID = OLECMDID_WINDOWSTATE_FLAG.USERVISIBLE_VALID; pub const OLECMDIDF_WINDOWSTATE_ENABLED_VALID = OLECMDID_WINDOWSTATE_FLAG.ENABLED_VALID; pub const OLECMDID_VIEWPORT_MODE_FLAG = enum(i32) { FIXED_LAYOUT_WIDTH = 1, EXCLUDE_VISUAL_BOTTOM = 2, FIXED_LAYOUT_WIDTH_VALID = 65536, EXCLUDE_VISUAL_BOTTOM_VALID = 131072, }; pub const OLECMDIDF_VIEWPORTMODE_FIXED_LAYOUT_WIDTH = OLECMDID_VIEWPORT_MODE_FLAG.FIXED_LAYOUT_WIDTH; pub const OLECMDIDF_VIEWPORTMODE_EXCLUDE_VISUAL_BOTTOM = OLECMDID_VIEWPORT_MODE_FLAG.EXCLUDE_VISUAL_BOTTOM; pub const OLECMDIDF_VIEWPORTMODE_FIXED_LAYOUT_WIDTH_VALID = OLECMDID_VIEWPORT_MODE_FLAG.FIXED_LAYOUT_WIDTH_VALID; pub const OLECMDIDF_VIEWPORTMODE_EXCLUDE_VISUAL_BOTTOM_VALID = OLECMDID_VIEWPORT_MODE_FLAG.EXCLUDE_VISUAL_BOTTOM_VALID; const IID_IZoomEvents_Value = Guid.initString("41b68150-904c-4e17-a0ba-a438182e359d"); pub const IID_IZoomEvents = &IID_IZoomEvents_Value; pub const IZoomEvents = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, OnZoomPercentChanged: fn( self: *const IZoomEvents, ulZoomPercent: 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 IZoomEvents_OnZoomPercentChanged(self: *const T, ulZoomPercent: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IZoomEvents.VTable, self.vtable).OnZoomPercentChanged(@ptrCast(*const IZoomEvents, self), ulZoomPercent); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IProtectFocus_Value = Guid.initString("d81f90a3-8156-44f7-ad28-5abb87003274"); pub const IID_IProtectFocus = &IID_IProtectFocus_Value; pub const IProtectFocus = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AllowFocusChange: fn( self: *const IProtectFocus, pfAllow: ?*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 IProtectFocus_AllowFocusChange(self: *const T, pfAllow: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectFocus.VTable, self.vtable).AllowFocusChange(@ptrCast(*const IProtectFocus, self), pfAllow); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IProtectedModeMenuServices_Value = Guid.initString("73c105ee-9dff-4a07-b83c-7eff290c266e"); pub const IID_IProtectedModeMenuServices = &IID_IProtectedModeMenuServices_Value; pub const IProtectedModeMenuServices = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateMenu: fn( self: *const IProtectedModeMenuServices, phMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LoadMenu: fn( self: *const IProtectedModeMenuServices, pszModuleName: ?[*:0]const u16, pszMenuName: ?[*:0]const u16, phMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) HRESULT, LoadMenuID: fn( self: *const IProtectedModeMenuServices, pszModuleName: ?[*:0]const u16, wResourceID: u16, phMenu: ?*?HMENU, ) 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 IProtectedModeMenuServices_CreateMenu(self: *const T, phMenu: ?*?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectedModeMenuServices.VTable, self.vtable).CreateMenu(@ptrCast(*const IProtectedModeMenuServices, self), phMenu); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProtectedModeMenuServices_LoadMenu(self: *const T, pszModuleName: ?[*:0]const u16, pszMenuName: ?[*:0]const u16, phMenu: ?*?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectedModeMenuServices.VTable, self.vtable).LoadMenu(@ptrCast(*const IProtectedModeMenuServices, self), pszModuleName, pszMenuName, phMenu); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IProtectedModeMenuServices_LoadMenuID(self: *const T, pszModuleName: ?[*:0]const u16, wResourceID: u16, phMenu: ?*?HMENU) callconv(.Inline) HRESULT { return @ptrCast(*const IProtectedModeMenuServices.VTable, self.vtable).LoadMenuID(@ptrCast(*const IProtectedModeMenuServices, self), pszModuleName, wResourceID, phMenu); } };} pub usingnamespace MethodMixin(@This()); }; pub const LPFNOLEUIHOOK = fn( param0: ?HWND, param1: u32, param2: WPARAM, param3: LPARAM, ) callconv(@import("std").os.windows.WINAPI) u32; pub const OLEUIINSERTOBJECTW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, clsid: Guid, lpszFile: ?PWSTR, cchFile: u32, cClsidExclude: u32, lpClsidExclude: ?*Guid, iid: Guid, oleRender: u32, lpFormatEtc: ?*FORMATETC, lpIOleClientSite: ?*IOleClientSite, lpIStorage: ?*IStorage, ppvObj: ?*?*anyopaque, sc: i32, hMetaPict: isize, }; pub const OLEUIINSERTOBJECTA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, clsid: Guid, lpszFile: ?PSTR, cchFile: u32, cClsidExclude: u32, lpClsidExclude: ?*Guid, iid: Guid, oleRender: u32, lpFormatEtc: ?*FORMATETC, lpIOleClientSite: ?*IOleClientSite, lpIStorage: ?*IStorage, ppvObj: ?*?*anyopaque, sc: i32, hMetaPict: isize, }; pub const OLEUIPASTEFLAG = enum(i32) { ENABLEICON = 2048, PASTEONLY = 0, PASTE = 512, LINKANYTYPE = 1024, LINKTYPE1 = 1, LINKTYPE2 = 2, LINKTYPE3 = 4, LINKTYPE4 = 8, LINKTYPE5 = 16, LINKTYPE6 = 32, LINKTYPE7 = 64, LINKTYPE8 = 128, }; pub const OLEUIPASTE_ENABLEICON = OLEUIPASTEFLAG.ENABLEICON; pub const OLEUIPASTE_PASTEONLY = OLEUIPASTEFLAG.PASTEONLY; pub const OLEUIPASTE_PASTE = OLEUIPASTEFLAG.PASTE; pub const OLEUIPASTE_LINKANYTYPE = OLEUIPASTEFLAG.LINKANYTYPE; pub const OLEUIPASTE_LINKTYPE1 = OLEUIPASTEFLAG.LINKTYPE1; pub const OLEUIPASTE_LINKTYPE2 = OLEUIPASTEFLAG.LINKTYPE2; pub const OLEUIPASTE_LINKTYPE3 = OLEUIPASTEFLAG.LINKTYPE3; pub const OLEUIPASTE_LINKTYPE4 = OLEUIPASTEFLAG.LINKTYPE4; pub const OLEUIPASTE_LINKTYPE5 = OLEUIPASTEFLAG.LINKTYPE5; pub const OLEUIPASTE_LINKTYPE6 = OLEUIPASTEFLAG.LINKTYPE6; pub const OLEUIPASTE_LINKTYPE7 = OLEUIPASTEFLAG.LINKTYPE7; pub const OLEUIPASTE_LINKTYPE8 = OLEUIPASTEFLAG.LINKTYPE8; pub const OLEUIPASTEENTRYW = extern struct { fmtetc: FORMATETC, lpstrFormatName: ?[*:0]const u16, lpstrResultText: ?[*:0]const u16, dwFlags: u32, dwScratchSpace: u32, }; pub const OLEUIPASTEENTRYA = extern struct { fmtetc: FORMATETC, lpstrFormatName: ?[*:0]const u8, lpstrResultText: ?[*:0]const u8, dwFlags: u32, dwScratchSpace: u32, }; pub const OLEUIPASTESPECIALW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, lpSrcDataObj: ?*IDataObject, arrPasteEntries: ?*OLEUIPASTEENTRYW, cPasteEntries: i32, arrLinkTypes: ?*u32, cLinkTypes: i32, cClsidExclude: u32, lpClsidExclude: ?*Guid, nSelectedIndex: i32, fLink: BOOL, hMetaPict: isize, sizel: SIZE, }; pub const OLEUIPASTESPECIALA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, lpSrcDataObj: ?*IDataObject, arrPasteEntries: ?*OLEUIPASTEENTRYA, cPasteEntries: i32, arrLinkTypes: ?*u32, cLinkTypes: i32, cClsidExclude: u32, lpClsidExclude: ?*Guid, nSelectedIndex: i32, fLink: BOOL, hMetaPict: isize, sizel: SIZE, }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkContainerW = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNextLink: fn( self: *const IOleUILinkContainerW, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) u32, SetLinkUpdateOptions: fn( self: *const IOleUILinkContainerW, dwLink: u32, dwUpdateOpt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkUpdateOptions: fn( self: *const IOleUILinkContainerW, dwLink: u32, lpdwUpdateOpt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLinkSource: fn( self: *const IOleUILinkContainerW, dwLink: u32, lpszDisplayName: ?PWSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkSource: fn( self: *const IOleUILinkContainerW, dwLink: u32, lplpszDisplayName: ?*?PWSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PWSTR, lplpszShortLinkType: ?*?PWSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenLinkSource: fn( self: *const IOleUILinkContainerW, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UpdateLink: fn( self: *const IOleUILinkContainerW, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CancelLink: fn( self: *const IOleUILinkContainerW, dwLink: 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 IOleUILinkContainerW_GetNextLink(self: *const T, dwLink: u32) callconv(.Inline) u32 { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).GetNextLink(@ptrCast(*const IOleUILinkContainerW, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_SetLinkUpdateOptions(self: *const T, dwLink: u32, dwUpdateOpt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).SetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerW, self), dwLink, dwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_GetLinkUpdateOptions(self: *const T, dwLink: u32, lpdwUpdateOpt: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).GetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerW, self), dwLink, lpdwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_SetLinkSource(self: *const T, dwLink: u32, lpszDisplayName: ?PWSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).SetLinkSource(@ptrCast(*const IOleUILinkContainerW, self), dwLink, lpszDisplayName, lenFileName, pchEaten, fValidateSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_GetLinkSource(self: *const T, dwLink: u32, lplpszDisplayName: ?*?PWSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PWSTR, lplpszShortLinkType: ?*?PWSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).GetLinkSource(@ptrCast(*const IOleUILinkContainerW, self), dwLink, lplpszDisplayName, lplenFileName, lplpszFullLinkType, lplpszShortLinkType, lpfSourceAvailable, lpfIsSelected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_OpenLinkSource(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).OpenLinkSource(@ptrCast(*const IOleUILinkContainerW, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_UpdateLink(self: *const T, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).UpdateLink(@ptrCast(*const IOleUILinkContainerW, self), dwLink, fErrorMessage, fReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerW_CancelLink(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerW.VTable, self.vtable).CancelLink(@ptrCast(*const IOleUILinkContainerW, self), dwLink); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkContainerA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetNextLink: fn( self: *const IOleUILinkContainerA, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) u32, SetLinkUpdateOptions: fn( self: *const IOleUILinkContainerA, dwLink: u32, dwUpdateOpt: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkUpdateOptions: fn( self: *const IOleUILinkContainerA, dwLink: u32, lpdwUpdateOpt: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetLinkSource: fn( self: *const IOleUILinkContainerA, dwLink: u32, lpszDisplayName: ?PSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetLinkSource: fn( self: *const IOleUILinkContainerA, dwLink: u32, lplpszDisplayName: ?*?PSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PSTR, lplpszShortLinkType: ?*?PSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenLinkSource: fn( self: *const IOleUILinkContainerA, dwLink: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, UpdateLink: fn( self: *const IOleUILinkContainerA, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CancelLink: fn( self: *const IOleUILinkContainerA, dwLink: 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 IOleUILinkContainerA_GetNextLink(self: *const T, dwLink: u32) callconv(.Inline) u32 { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).GetNextLink(@ptrCast(*const IOleUILinkContainerA, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_SetLinkUpdateOptions(self: *const T, dwLink: u32, dwUpdateOpt: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).SetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerA, self), dwLink, dwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_GetLinkUpdateOptions(self: *const T, dwLink: u32, lpdwUpdateOpt: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).GetLinkUpdateOptions(@ptrCast(*const IOleUILinkContainerA, self), dwLink, lpdwUpdateOpt); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_SetLinkSource(self: *const T, dwLink: u32, lpszDisplayName: ?PSTR, lenFileName: u32, pchEaten: ?*u32, fValidateSource: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).SetLinkSource(@ptrCast(*const IOleUILinkContainerA, self), dwLink, lpszDisplayName, lenFileName, pchEaten, fValidateSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_GetLinkSource(self: *const T, dwLink: u32, lplpszDisplayName: ?*?PSTR, lplenFileName: ?*u32, lplpszFullLinkType: ?*?PSTR, lplpszShortLinkType: ?*?PSTR, lpfSourceAvailable: ?*BOOL, lpfIsSelected: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).GetLinkSource(@ptrCast(*const IOleUILinkContainerA, self), dwLink, lplpszDisplayName, lplenFileName, lplpszFullLinkType, lplpszShortLinkType, lpfSourceAvailable, lpfIsSelected); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_OpenLinkSource(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).OpenLinkSource(@ptrCast(*const IOleUILinkContainerA, self), dwLink); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_UpdateLink(self: *const T, dwLink: u32, fErrorMessage: BOOL, fReserved: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).UpdateLink(@ptrCast(*const IOleUILinkContainerA, self), dwLink, fErrorMessage, fReserved); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkContainerA_CancelLink(self: *const T, dwLink: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkContainerA.VTable, self.vtable).CancelLink(@ptrCast(*const IOleUILinkContainerA, self), dwLink); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEUIEDITLINKSW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, lpOleUILinkContainer: ?*IOleUILinkContainerW, }; pub const OLEUIEDITLINKSA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, lpOleUILinkContainer: ?*IOleUILinkContainerA, }; pub const OLEUICHANGEICONW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, hMetaPict: isize, clsid: Guid, szIconExe: [260]u16, cchIconExe: i32, }; pub const OLEUICHANGEICONA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, hMetaPict: isize, clsid: Guid, szIconExe: [260]CHAR, cchIconExe: i32, }; pub const OLEUICONVERTW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, clsid: Guid, clsidConvertDefault: Guid, clsidActivateDefault: Guid, clsidNew: Guid, dvAspect: u32, wFormat: u16, fIsLinkedObject: BOOL, hMetaPict: isize, lpszUserType: ?PWSTR, fObjectsIconChanged: BOOL, lpszDefLabel: ?PWSTR, cClsidExclude: u32, lpClsidExclude: ?*Guid, }; pub const OLEUICONVERTA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, clsid: Guid, clsidConvertDefault: Guid, clsidActivateDefault: Guid, clsidNew: Guid, dvAspect: u32, wFormat: u16, fIsLinkedObject: BOOL, hMetaPict: isize, lpszUserType: ?PSTR, fObjectsIconChanged: BOOL, lpszDefLabel: ?PSTR, cClsidExclude: u32, lpClsidExclude: ?*Guid, }; pub const OLEUIBUSYW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, hTask: ?HTASK, lphWndDialog: ?*?HWND, }; pub const OLEUIBUSYA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, hTask: ?HTASK, lphWndDialog: ?*?HWND, }; pub const OLEUICHANGESOURCEW = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u16, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u16, hResource: ?HRSRC, lpOFN: ?*OPENFILENAMEW, dwReserved1: [4]u32, lpOleUILinkContainer: ?*IOleUILinkContainerW, dwLink: u32, lpszDisplayName: ?PWSTR, nFileLength: u32, lpszFrom: ?PWSTR, lpszTo: ?PWSTR, }; pub const OLEUICHANGESOURCEA = extern struct { cbStruct: u32, dwFlags: u32, hWndOwner: ?HWND, lpszCaption: ?[*:0]const u8, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, hInstance: ?HINSTANCE, lpszTemplate: ?[*:0]const u8, hResource: ?HRSRC, lpOFN: ?*OPENFILENAMEA, dwReserved1: [4]u32, lpOleUILinkContainer: ?*IOleUILinkContainerA, dwLink: u32, lpszDisplayName: ?PSTR, nFileLength: u32, lpszFrom: ?PSTR, lpszTo: ?PSTR, }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUIObjInfoW = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetObjectInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PWSTR, lplpszType: ?*?PWSTR, lplpszShortType: ?*?PWSTR, lplpszLocation: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConvertInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConvertObject: fn( self: *const IOleUIObjInfoW, dwObject: u32, clsidNew: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetViewInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetViewInfo: fn( self: *const IOleUIObjInfoW, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: 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 IOleUIObjInfoW_GetObjectInfo(self: *const T, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PWSTR, lplpszType: ?*?PWSTR, lplpszShortType: ?*?PWSTR, lplpszLocation: ?*?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, lpdwObjSize, lplpszLabel, lplpszType, lplpszShortType, lplpszLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_GetConvertInfo(self: *const T, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).GetConvertInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, lpClassID, lpwFormat, lpConvertDefaultClassID, lplpClsidExclude, lpcClsidExclude); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_ConvertObject(self: *const T, dwObject: u32, clsidNew: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).ConvertObject(@ptrCast(*const IOleUIObjInfoW, self), dwObject, clsidNew); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_GetViewInfo(self: *const T, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).GetViewInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, phMetaPict, pdvAspect, pnCurrentScale); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoW_SetViewInfo(self: *const T, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoW.VTable, self.vtable).SetViewInfo(@ptrCast(*const IOleUIObjInfoW, self), dwObject, hMetaPict, dvAspect, nCurrentScale, bRelativeToOrig); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUIObjInfoA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetObjectInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PSTR, lplpszType: ?*?PSTR, lplpszShortType: ?*?PSTR, lplpszLocation: ?*?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConvertInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConvertObject: fn( self: *const IOleUIObjInfoA, dwObject: u32, clsidNew: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetViewInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetViewInfo: fn( self: *const IOleUIObjInfoA, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: 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 IOleUIObjInfoA_GetObjectInfo(self: *const T, dwObject: u32, lpdwObjSize: ?*u32, lplpszLabel: ?*?PSTR, lplpszType: ?*?PSTR, lplpszShortType: ?*?PSTR, lplpszLocation: ?*?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, lpdwObjSize, lplpszLabel, lplpszType, lplpszShortType, lplpszLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_GetConvertInfo(self: *const T, dwObject: u32, lpClassID: ?*Guid, lpwFormat: ?*u16, lpConvertDefaultClassID: ?*Guid, lplpClsidExclude: ?*?*Guid, lpcClsidExclude: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).GetConvertInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, lpClassID, lpwFormat, lpConvertDefaultClassID, lplpClsidExclude, lpcClsidExclude); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_ConvertObject(self: *const T, dwObject: u32, clsidNew: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).ConvertObject(@ptrCast(*const IOleUIObjInfoA, self), dwObject, clsidNew); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_GetViewInfo(self: *const T, dwObject: u32, phMetaPict: ?*isize, pdvAspect: ?*u32, pnCurrentScale: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).GetViewInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, phMetaPict, pdvAspect, pnCurrentScale); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUIObjInfoA_SetViewInfo(self: *const T, dwObject: u32, hMetaPict: isize, dvAspect: u32, nCurrentScale: i32, bRelativeToOrig: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUIObjInfoA.VTable, self.vtable).SetViewInfo(@ptrCast(*const IOleUIObjInfoA, self), dwObject, hMetaPict, dvAspect, nCurrentScale, bRelativeToOrig); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkInfoW = extern struct { pub const VTable = extern struct { base: IOleUILinkContainerW.VTable, GetLastUpdate: fn( self: *const IOleUILinkInfoW, dwLink: u32, lpLastUpdate: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleUILinkContainerW.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkInfoW_GetLastUpdate(self: *const T, dwLink: u32, lpLastUpdate: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkInfoW.VTable, self.vtable).GetLastUpdate(@ptrCast(*const IOleUILinkInfoW, self), dwLink, lpLastUpdate); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.0' pub const IOleUILinkInfoA = extern struct { pub const VTable = extern struct { base: IOleUILinkContainerA.VTable, GetLastUpdate: fn( self: *const IOleUILinkInfoA, dwLink: u32, lpLastUpdate: ?*FILETIME, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IOleUILinkContainerA.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IOleUILinkInfoA_GetLastUpdate(self: *const T, dwLink: u32, lpLastUpdate: ?*FILETIME) callconv(.Inline) HRESULT { return @ptrCast(*const IOleUILinkInfoA.VTable, self.vtable).GetLastUpdate(@ptrCast(*const IOleUILinkInfoA, self), dwLink, lpLastUpdate); } };} pub usingnamespace MethodMixin(@This()); }; pub const OLEUIGNRLPROPSW = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSW, }; pub const OLEUIGNRLPROPSA = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSA, }; pub const OLEUIVIEWPROPSW = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSW, nScaleMin: i32, nScaleMax: i32, }; pub const OLEUIVIEWPROPSA = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSA, nScaleMin: i32, nScaleMax: i32, }; pub const OLEUILINKPROPSW = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSW, }; pub const OLEUILINKPROPSA = extern struct { cbStruct: u32, dwFlags: u32, dwReserved1: [2]u32, lpfnHook: ?LPFNOLEUIHOOK, lCustData: LPARAM, dwReserved2: [3]u32, lpOP: ?*OLEUIOBJECTPROPSA, }; pub const OLEUIOBJECTPROPSW = extern struct { cbStruct: u32, dwFlags: u32, lpPS: ?*PROPSHEETHEADERW_V2, dwObject: u32, lpObjInfo: ?*IOleUIObjInfoW, dwLink: u32, lpLinkInfo: ?*IOleUILinkInfoW, lpGP: ?*OLEUIGNRLPROPSW, lpVP: ?*OLEUIVIEWPROPSW, lpLP: ?*OLEUILINKPROPSW, }; pub const OLEUIOBJECTPROPSA = extern struct { cbStruct: u32, dwFlags: u32, lpPS: ?*PROPSHEETHEADERA_V2, dwObject: u32, lpObjInfo: ?*IOleUIObjInfoA, dwLink: u32, lpLinkInfo: ?*IOleUILinkInfoA, lpGP: ?*OLEUIGNRLPROPSA, lpVP: ?*OLEUIVIEWPROPSA, lpLP: ?*OLEUILINKPROPSA, }; const IID_IDispatchEx_Value = Guid.initString("a6ef9860-c720-11d0-9337-00a0c90dcaa9"); pub const IID_IDispatchEx = &IID_IDispatchEx_Value; pub const IDispatchEx = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, GetDispID: fn( self: *const IDispatchEx, bstrName: ?BSTR, grfdex: u32, pid: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InvokeEx: fn( self: *const IDispatchEx, id: i32, lcid: u32, wFlags: u16, pdp: ?*DISPPARAMS, pvarRes: ?*VARIANT, pei: ?*EXCEPINFO, pspCaller: ?*IServiceProvider, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteMemberByName: fn( self: *const IDispatchEx, bstrName: ?BSTR, grfdex: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteMemberByDispID: fn( self: *const IDispatchEx, id: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMemberProperties: fn( self: *const IDispatchEx, id: i32, grfdexFetch: u32, pgrfdex: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMemberName: fn( self: *const IDispatchEx, id: i32, pbstrName: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNextDispID: fn( self: *const IDispatchEx, grfdex: u32, id: i32, pid: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNameSpaceParent: fn( self: *const IDispatchEx, ppunk: ?*?*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 IDispatchEx_GetDispID(self: *const T, bstrName: ?BSTR, grfdex: u32, pid: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).GetDispID(@ptrCast(*const IDispatchEx, self), bstrName, grfdex, pid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatchEx_InvokeEx(self: *const T, id: i32, lcid: u32, wFlags: u16, pdp: ?*DISPPARAMS, pvarRes: ?*VARIANT, pei: ?*EXCEPINFO, pspCaller: ?*IServiceProvider) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).InvokeEx(@ptrCast(*const IDispatchEx, self), id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatchEx_DeleteMemberByName(self: *const T, bstrName: ?BSTR, grfdex: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).DeleteMemberByName(@ptrCast(*const IDispatchEx, self), bstrName, grfdex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatchEx_DeleteMemberByDispID(self: *const T, id: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).DeleteMemberByDispID(@ptrCast(*const IDispatchEx, self), id); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatchEx_GetMemberProperties(self: *const T, id: i32, grfdexFetch: u32, pgrfdex: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).GetMemberProperties(@ptrCast(*const IDispatchEx, self), id, grfdexFetch, pgrfdex); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatchEx_GetMemberName(self: *const T, id: i32, pbstrName: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).GetMemberName(@ptrCast(*const IDispatchEx, self), id, pbstrName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatchEx_GetNextDispID(self: *const T, grfdex: u32, id: i32, pid: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).GetNextDispID(@ptrCast(*const IDispatchEx, self), grfdex, id, pid); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispatchEx_GetNameSpaceParent(self: *const T, ppunk: ?*?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDispatchEx.VTable, self.vtable).GetNameSpaceParent(@ptrCast(*const IDispatchEx, self), ppunk); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDispError_Value = Guid.initString("a6ef9861-c720-11d0-9337-00a0c90dcaa9"); pub const IID_IDispError = &IID_IDispError_Value; pub const IDispError = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, QueryErrorInfo: fn( self: *const IDispError, guidErrorType: Guid, ppde: ?*?*IDispError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNext: fn( self: *const IDispError, ppde: ?*?*IDispError, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHresult: fn( self: *const IDispError, phr: ?*HRESULT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSource: fn( self: *const IDispError, pbstrSource: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetHelpInfo: fn( self: *const IDispError, pbstrFileName: ?*?BSTR, pdwContext: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDescription: fn( self: *const IDispError, pbstrDescription: ?*?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 IDispError_QueryErrorInfo(self: *const T, guidErrorType: Guid, ppde: ?*?*IDispError) callconv(.Inline) HRESULT { return @ptrCast(*const IDispError.VTable, self.vtable).QueryErrorInfo(@ptrCast(*const IDispError, self), guidErrorType, ppde); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispError_GetNext(self: *const T, ppde: ?*?*IDispError) callconv(.Inline) HRESULT { return @ptrCast(*const IDispError.VTable, self.vtable).GetNext(@ptrCast(*const IDispError, self), ppde); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispError_GetHresult(self: *const T, phr: ?*HRESULT) callconv(.Inline) HRESULT { return @ptrCast(*const IDispError.VTable, self.vtable).GetHresult(@ptrCast(*const IDispError, self), phr); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispError_GetSource(self: *const T, pbstrSource: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDispError.VTable, self.vtable).GetSource(@ptrCast(*const IDispError, self), pbstrSource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispError_GetHelpInfo(self: *const T, pbstrFileName: ?*?BSTR, pdwContext: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDispError.VTable, self.vtable).GetHelpInfo(@ptrCast(*const IDispError, self), pbstrFileName, pdwContext); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDispError_GetDescription(self: *const T, pbstrDescription: ?*?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDispError.VTable, self.vtable).GetDescription(@ptrCast(*const IDispError, self), pbstrDescription); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IVariantChangeType_Value = Guid.initString("a6ef9862-c720-11d0-9337-00a0c90dcaa9"); pub const IID_IVariantChangeType = &IID_IVariantChangeType_Value; pub const IVariantChangeType = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ChangeType: fn( self: *const IVariantChangeType, pvarDst: ?*VARIANT, pvarSrc: ?*VARIANT, lcid: u32, vtNew: 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 IVariantChangeType_ChangeType(self: *const T, pvarDst: ?*VARIANT, pvarSrc: ?*VARIANT, lcid: u32, vtNew: u16) callconv(.Inline) HRESULT { return @ptrCast(*const IVariantChangeType.VTable, self.vtable).ChangeType(@ptrCast(*const IVariantChangeType, self), pvarDst, pvarSrc, lcid, vtNew); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IObjectIdentity_Value = Guid.initString("ca04b7e6-0d21-11d1-8cc5-00c04fc2b085"); pub const IID_IObjectIdentity = &IID_IObjectIdentity_Value; pub const IObjectIdentity = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsEqualObject: fn( self: *const IObjectIdentity, punk: ?*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 IObjectIdentity_IsEqualObject(self: *const T, punk: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IObjectIdentity.VTable, self.vtable).IsEqualObject(@ptrCast(*const IObjectIdentity, self), punk); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ICanHandleException_Value = Guid.initString("c5598e60-b307-11d1-b27d-006008c3fbfb"); pub const IID_ICanHandleException = &IID_ICanHandleException_Value; pub const ICanHandleException = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CanHandleException: fn( self: *const ICanHandleException, pExcepInfo: ?*EXCEPINFO, pvar: ?*VARIANT, ) 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 ICanHandleException_CanHandleException(self: *const T, pExcepInfo: ?*EXCEPINFO, pvar: ?*VARIANT) callconv(.Inline) HRESULT { return @ptrCast(*const ICanHandleException.VTable, self.vtable).CanHandleException(@ptrCast(*const ICanHandleException, self), pExcepInfo, pvar); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IProvideRuntimeContext_Value = Guid.initString("10e2414a-ec59-49d2-bc51-5add2c36febc"); pub const IID_IProvideRuntimeContext = &IID_IProvideRuntimeContext_Value; pub const IProvideRuntimeContext = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCurrentSourceContext: fn( self: *const IProvideRuntimeContext, pdwContext: ?*usize, pfExecutingGlobalCode: ?*i16, ) 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 IProvideRuntimeContext_GetCurrentSourceContext(self: *const T, pdwContext: ?*usize, pfExecutingGlobalCode: ?*i16) callconv(.Inline) HRESULT { return @ptrCast(*const IProvideRuntimeContext.VTable, self.vtable).GetCurrentSourceContext(@ptrCast(*const IProvideRuntimeContext, self), pdwContext, pfExecutingGlobalCode); } };} pub usingnamespace MethodMixin(@This()); }; //-------------------------------------------------------------------------------- // Section: Functions (456) //-------------------------------------------------------------------------------- pub extern "OLEAUT32" fn DosDateTimeToVariantTime( wDosDate: u16, wDosTime: u16, pvtime: ?*f64, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "OLEAUT32" fn VariantTimeToDosDateTime( vtime: f64, pwDosDate: ?*u16, pwDosTime: ?*u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "OLEAUT32" fn SystemTimeToVariantTime( lpSystemTime: ?*SYSTEMTIME, pvtime: ?*f64, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "OLEAUT32" fn VariantTimeToSystemTime( vtime: f64, lpSystemTime: ?*SYSTEMTIME, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "OLEAUT32" fn SafeArrayAllocDescriptor( cDims: u32, ppsaOut: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayAllocDescriptorEx( vt: u16, cDims: u32, ppsaOut: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayAllocData( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayCreate( vt: u16, cDims: u32, rgsabound: ?*SAFEARRAYBOUND, ) callconv(@import("std").os.windows.WINAPI) ?*SAFEARRAY; pub extern "OLEAUT32" fn SafeArrayCreateEx( vt: u16, cDims: u32, rgsabound: ?*SAFEARRAYBOUND, pvExtra: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*SAFEARRAY; pub extern "OLEAUT32" fn SafeArrayCopyData( psaSource: ?*SAFEARRAY, psaTarget: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLEAUT32" fn SafeArrayReleaseDescriptor( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLEAUT32" fn SafeArrayDestroyDescriptor( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLEAUT32" fn SafeArrayReleaseData( pData: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLEAUT32" fn SafeArrayDestroyData( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLEAUT32" fn SafeArrayAddRef( psa: ?*SAFEARRAY, ppDataToRelease: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayDestroy( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayRedim( psa: ?*SAFEARRAY, psaboundNew: ?*SAFEARRAYBOUND, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayGetDim( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLEAUT32" fn SafeArrayGetElemsize( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLEAUT32" fn SafeArrayGetUBound( psa: ?*SAFEARRAY, nDim: u32, plUbound: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayGetLBound( psa: ?*SAFEARRAY, nDim: u32, plLbound: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayLock( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayUnlock( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayAccessData( psa: ?*SAFEARRAY, ppvData: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayUnaccessData( psa: ?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayGetElement( psa: ?*SAFEARRAY, rgIndices: ?*i32, pv: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayPutElement( psa: ?*SAFEARRAY, rgIndices: ?*i32, pv: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayCopy( psa: ?*SAFEARRAY, ppsaOut: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayPtrOfIndex( psa: ?*SAFEARRAY, rgIndices: ?*i32, ppvData: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArraySetRecordInfo( psa: ?*SAFEARRAY, prinfo: ?*IRecordInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayGetRecordInfo( psa: ?*SAFEARRAY, prinfo: ?*?*IRecordInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArraySetIID( psa: ?*SAFEARRAY, guid: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayGetIID( psa: ?*SAFEARRAY, pguid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayGetVartype( psa: ?*SAFEARRAY, pvt: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn SafeArrayCreateVector( vt: u16, lLbound: i32, cElements: u32, ) callconv(@import("std").os.windows.WINAPI) ?*SAFEARRAY; pub extern "OLEAUT32" fn SafeArrayCreateVectorEx( vt: u16, lLbound: i32, cElements: u32, pvExtra: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) ?*SAFEARRAY; pub extern "OLEAUT32" fn VariantInit( pvarg: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLEAUT32" fn VariantClear( pvarg: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VariantCopy( pvargDest: ?*VARIANT, pvargSrc: ?*const VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VariantCopyInd( pvarDest: ?*VARIANT, pvargSrc: ?*const VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VariantChangeType( pvargDest: ?*VARIANT, pvarSrc: ?*const VARIANT, wFlags: u16, vt: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VariantChangeTypeEx( pvargDest: ?*VARIANT, pvarSrc: ?*const VARIANT, lcid: u32, wFlags: u16, vt: u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VectorFromBstr( bstr: ?BSTR, ppsa: ?*?*SAFEARRAY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn BstrFromVector( psa: ?*SAFEARRAY, pbstr: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromI2( sIn: i16, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromI4( lIn: i32, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromI8( i64In: i64, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromR4( fltIn: f32, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromR8( dblIn: f64, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromCy( cyIn: CY, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromDate( dateIn: f64, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromDisp( pdispIn: ?*IDispatch, lcid: u32, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromBool( boolIn: i16, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromI1( cIn: CHAR, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromUI2( uiIn: u16, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromUI4( ulIn: u32, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromUI8( ui64In: u64, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI1FromDec( pdecIn: ?*const DECIMAL, pbOut: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromUI1( bIn: u8, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromI4( lIn: i32, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromI8( i64In: i64, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromR4( fltIn: f32, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromR8( dblIn: f64, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromCy( cyIn: CY, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromDate( dateIn: f64, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromDisp( pdispIn: ?*IDispatch, lcid: u32, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromBool( boolIn: i16, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromI1( cIn: CHAR, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromUI2( uiIn: u16, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromUI4( ulIn: u32, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromUI8( ui64In: u64, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI2FromDec( pdecIn: ?*const DECIMAL, psOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromUI1( bIn: u8, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromI2( sIn: i16, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromI8( i64In: i64, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromR4( fltIn: f32, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromR8( dblIn: f64, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromCy( cyIn: CY, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromDate( dateIn: f64, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromDisp( pdispIn: ?*IDispatch, lcid: u32, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromBool( boolIn: i16, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromI1( cIn: CHAR, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromUI2( uiIn: u16, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromUI4( ulIn: u32, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromUI8( ui64In: u64, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI4FromDec( pdecIn: ?*const DECIMAL, plOut: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromUI1( bIn: u8, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromI2( sIn: i16, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromR4( fltIn: f32, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromR8( dblIn: f64, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromCy( cyIn: CY, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromDate( dateIn: f64, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromDisp( pdispIn: ?*IDispatch, lcid: u32, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromBool( boolIn: i16, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromI1( cIn: CHAR, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromUI2( uiIn: u16, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromUI4( ulIn: u32, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromUI8( ui64In: u64, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI8FromDec( pdecIn: ?*const DECIMAL, pi64Out: ?*i64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromUI1( bIn: u8, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromI2( sIn: i16, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromI4( lIn: i32, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromI8( i64In: i64, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromR8( dblIn: f64, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromCy( cyIn: CY, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromDate( dateIn: f64, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromDisp( pdispIn: ?*IDispatch, lcid: u32, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromBool( boolIn: i16, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromI1( cIn: CHAR, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromUI2( uiIn: u16, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromUI4( ulIn: u32, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromUI8( ui64In: u64, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4FromDec( pdecIn: ?*const DECIMAL, pfltOut: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromUI1( bIn: u8, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromI2( sIn: i16, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromI4( lIn: i32, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromI8( i64In: i64, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromR4( fltIn: f32, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromCy( cyIn: CY, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromDate( dateIn: f64, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromDisp( pdispIn: ?*IDispatch, lcid: u32, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromBool( boolIn: i16, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromI1( cIn: CHAR, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromUI2( uiIn: u16, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromUI4( ulIn: u32, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromUI8( ui64In: u64, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8FromDec( pdecIn: ?*const DECIMAL, pdblOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromUI1( bIn: u8, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromI2( sIn: i16, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromI4( lIn: i32, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromI8( i64In: i64, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromR4( fltIn: f32, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromR8( dblIn: f64, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromCy( cyIn: CY, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromDisp( pdispIn: ?*IDispatch, lcid: u32, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromBool( boolIn: i16, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromI1( cIn: CHAR, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromUI2( uiIn: u16, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromUI4( ulIn: u32, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromUI8( ui64In: u64, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromDec( pdecIn: ?*const DECIMAL, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromUI1( bIn: u8, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromI2( sIn: i16, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromI4( lIn: i32, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromI8( i64In: i64, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromR4( fltIn: f32, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromR8( dblIn: f64, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromDate( dateIn: f64, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromDisp( pdispIn: ?*IDispatch, lcid: u32, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromBool( boolIn: i16, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromI1( cIn: CHAR, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromUI2( uiIn: u16, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromUI4( ulIn: u32, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromUI8( ui64In: u64, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFromDec( pdecIn: ?*const DECIMAL, pcyOut: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromUI1( bVal: u8, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromI2( iVal: i16, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromI4( lIn: i32, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromI8( i64In: i64, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromR4( fltIn: f32, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromR8( dblIn: f64, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromCy( cyIn: CY, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromDate( dateIn: f64, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromDisp( pdispIn: ?*IDispatch, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromBool( boolIn: i16, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromI1( cIn: CHAR, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromUI2( uiIn: u16, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromUI4( ulIn: u32, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromUI8( ui64In: u64, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrFromDec( pdecIn: ?*const DECIMAL, lcid: u32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromUI1( bIn: u8, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromI2( sIn: i16, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromI4( lIn: i32, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromI8( i64In: i64, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromR4( fltIn: f32, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromR8( dblIn: f64, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromDate( dateIn: f64, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromCy( cyIn: CY, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromDisp( pdispIn: ?*IDispatch, lcid: u32, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromI1( cIn: CHAR, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromUI2( uiIn: u16, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromUI4( ulIn: u32, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromUI8( i64In: u64, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBoolFromDec( pdecIn: ?*const DECIMAL, pboolOut: ?*i16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromUI1( bIn: u8, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromI2( uiIn: i16, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromI4( lIn: i32, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromI8( i64In: i64, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromR4( fltIn: f32, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromR8( dblIn: f64, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromDate( dateIn: f64, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromCy( cyIn: CY, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromDisp( pdispIn: ?*IDispatch, lcid: u32, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromBool( boolIn: i16, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromUI2( uiIn: u16, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromUI4( ulIn: u32, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromUI8( i64In: u64, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarI1FromDec( pdecIn: ?*const DECIMAL, pcOut: ?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromUI1( bIn: u8, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromI2( uiIn: i16, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromI4( lIn: i32, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromI8( i64In: i64, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromR4( fltIn: f32, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromR8( dblIn: f64, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromDate( dateIn: f64, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromCy( cyIn: CY, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromDisp( pdispIn: ?*IDispatch, lcid: u32, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromBool( boolIn: i16, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromI1( cIn: CHAR, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromUI4( ulIn: u32, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromUI8( i64In: u64, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI2FromDec( pdecIn: ?*const DECIMAL, puiOut: ?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromUI1( bIn: u8, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromI2( uiIn: i16, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromI4( lIn: i32, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromI8( i64In: i64, plOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromR4( fltIn: f32, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromR8( dblIn: f64, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromDate( dateIn: f64, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromCy( cyIn: CY, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromDisp( pdispIn: ?*IDispatch, lcid: u32, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromBool( boolIn: i16, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromI1( cIn: CHAR, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromUI2( uiIn: u16, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromUI8( ui64In: u64, plOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI4FromDec( pdecIn: ?*const DECIMAL, pulOut: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromUI1( bIn: u8, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromI2( sIn: i16, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromI8( ui64In: i64, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromR4( fltIn: f32, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromR8( dblIn: f64, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromCy( cyIn: CY, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromDate( dateIn: f64, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromDisp( pdispIn: ?*IDispatch, lcid: u32, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromBool( boolIn: i16, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromI1( cIn: CHAR, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromUI2( uiIn: u16, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromUI4( ulIn: u32, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUI8FromDec( pdecIn: ?*const DECIMAL, pi64Out: ?*u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromUI1( bIn: u8, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromI2( uiIn: i16, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromI4( lIn: i32, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromI8( i64In: i64, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromR4( fltIn: f32, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromR8( dblIn: f64, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromDate( dateIn: f64, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromCy( cyIn: CY, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromDisp( pdispIn: ?*IDispatch, lcid: u32, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromBool( boolIn: i16, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromI1( cIn: CHAR, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromUI2( uiIn: u16, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromUI4( ulIn: u32, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFromUI8( ui64In: u64, pdecOut: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarParseNumFromStr( strIn: ?[*:0]const u16, lcid: u32, dwFlags: u32, pnumprs: ?*NUMPARSE, rgbDig: ?*u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarNumFromParseNum( pnumprs: ?*NUMPARSE, rgbDig: ?*u8, dwVtBits: u32, pvar: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarAdd( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarAnd( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCat( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDiv( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarEqv( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarIdiv( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarImp( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarMod( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarMul( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarOr( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarPow( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarSub( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarXor( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarAbs( pvarIn: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarFix( pvarIn: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarInt( pvarIn: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarNeg( pvarIn: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarNot( pvarIn: ?*VARIANT, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarRound( pvarIn: ?*VARIANT, cDecimals: i32, pvarResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCmp( pvarLeft: ?*VARIANT, pvarRight: ?*VARIANT, lcid: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecAdd( pdecLeft: ?*DECIMAL, pdecRight: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecDiv( pdecLeft: ?*DECIMAL, pdecRight: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecMul( pdecLeft: ?*DECIMAL, pdecRight: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecSub( pdecLeft: ?*DECIMAL, pdecRight: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecAbs( pdecIn: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecFix( pdecIn: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecInt( pdecIn: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecNeg( pdecIn: ?*DECIMAL, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecRound( pdecIn: ?*DECIMAL, cDecimals: i32, pdecResult: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecCmp( pdecLeft: ?*DECIMAL, pdecRight: ?*DECIMAL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDecCmpR8( pdecLeft: ?*DECIMAL, dblRight: f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyAdd( cyLeft: CY, cyRight: CY, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyMul( cyLeft: CY, cyRight: CY, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyMulI4( cyLeft: CY, lRight: i32, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyMulI8( cyLeft: CY, lRight: i64, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCySub( cyLeft: CY, cyRight: CY, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyAbs( cyIn: CY, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyFix( cyIn: CY, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyInt( cyIn: CY, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyNeg( cyIn: CY, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyRound( cyIn: CY, cDecimals: i32, pcyResult: ?*CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyCmp( cyLeft: CY, cyRight: CY, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarCyCmpR8( cyLeft: CY, dblRight: f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrCat( bstrLeft: ?BSTR, bstrRight: ?BSTR, pbstrResult: ?*?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarBstrCmp( bstrLeft: ?BSTR, bstrRight: ?BSTR, lcid: u32, dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8Pow( dblLeft: f64, dblRight: f64, pdblResult: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR4CmpR8( fltLeft: f32, dblRight: f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarR8Round( dblIn: f64, cDecimals: i32, pdblResult: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromUdate( pudateIn: ?*UDATE, dwFlags: u32, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarDateFromUdateEx( pudateIn: ?*UDATE, lcid: u32, dwFlags: u32, pdateOut: ?*f64, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarUdateFromDate( dateIn: f64, dwFlags: u32, pudateOut: ?*UDATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn GetAltMonthNames( lcid: u32, prgp: ?*?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarFormat( pvarIn: ?*VARIANT, pstrFormat: ?PWSTR, iFirstDay: i32, iFirstWeek: i32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarFormatDateTime( pvarIn: ?*VARIANT, iNamedFormat: i32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarFormatNumber( pvarIn: ?*VARIANT, iNumDig: i32, iIncLead: i32, iUseParens: i32, iGroup: i32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarFormatPercent( pvarIn: ?*VARIANT, iNumDig: i32, iIncLead: i32, iUseParens: i32, iGroup: i32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarFormatCurrency( pvarIn: ?*VARIANT, iNumDig: i32, iIncLead: i32, iUseParens: i32, iGroup: i32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarWeekdayName( iWeekday: i32, fAbbrev: i32, iFirstDay: i32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarMonthName( iMonth: i32, fAbbrev: i32, dwFlags: u32, pbstrOut: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarFormatFromTokens( pvarIn: ?*VARIANT, pstrFormat: ?PWSTR, pbTokCur: ?*u8, dwFlags: u32, pbstrOut: ?*?BSTR, lcid: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn VarTokenizeFormatString( pstrFormat: ?PWSTR, rgbTok: [*:0]u8, cbTok: i32, iFirstDay: i32, iFirstWeek: i32, lcid: u32, pcbActual: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn LHashValOfNameSysA( syskind: SYSKIND, lcid: u32, szName: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLEAUT32" fn LHashValOfNameSys( syskind: SYSKIND, lcid: u32, szName: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLEAUT32" fn LoadTypeLib( szFile: ?[*:0]const u16, pptlib: ?*?*ITypeLib, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn LoadTypeLibEx( szFile: ?[*:0]const u16, regkind: REGKIND, pptlib: ?*?*ITypeLib, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn LoadRegTypeLib( rguid: ?*const Guid, wVerMajor: u16, wVerMinor: u16, lcid: u32, pptlib: ?*?*ITypeLib, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn QueryPathOfRegTypeLib( guid: ?*const Guid, wMaj: u16, wMin: u16, lcid: u32, lpbstrPathName: ?*?*u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn RegisterTypeLib( ptlib: ?*ITypeLib, szFullPath: ?[*:0]const u16, szHelpDir: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn UnRegisterTypeLib( libID: ?*const Guid, wVerMajor: u16, wVerMinor: u16, lcid: u32, syskind: SYSKIND, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn RegisterTypeLibForUser( ptlib: ?*ITypeLib, szFullPath: ?PWSTR, szHelpDir: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn UnRegisterTypeLibForUser( libID: ?*const Guid, wMajorVerNum: u16, wMinorVerNum: u16, lcid: u32, syskind: SYSKIND, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn CreateTypeLib( syskind: SYSKIND, szFile: ?[*:0]const u16, ppctlib: ?*?*ICreateTypeLib, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn CreateTypeLib2( syskind: SYSKIND, szFile: ?[*:0]const u16, ppctlib: ?*?*ICreateTypeLib2, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn DispGetParam( pdispparams: ?*DISPPARAMS, position: u32, vtTarg: u16, pvarResult: ?*VARIANT, puArgErr: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn DispGetIDsOfNames( ptinfo: ?*ITypeInfo, rgszNames: [*]?PWSTR, cNames: u32, rgdispid: [*]i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn DispInvoke( _this: ?*anyopaque, ptinfo: ?*ITypeInfo, dispidMember: i32, wFlags: u16, pparams: ?*DISPPARAMS, pvarResult: ?*VARIANT, pexcepinfo: ?*EXCEPINFO, puArgErr: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn CreateDispTypeInfo( pidata: ?*INTERFACEDATA, lcid: u32, pptinfo: ?*?*ITypeInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn CreateStdDispatch( punkOuter: ?*IUnknown, pvThis: ?*anyopaque, ptinfo: ?*ITypeInfo, ppunkStdDisp: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn DispCallFunc( pvInstance: ?*anyopaque, oVft: usize, cc: CALLCONV, vtReturn: u16, cActuals: u32, prgvt: [*:0]u16, prgpvarg: [*]?*VARIANT, pvargResult: ?*VARIANT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn RegisterActiveObject( punk: ?*IUnknown, rclsid: ?*const Guid, dwFlags: u32, pdwRegister: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn RevokeActiveObject( dwRegister: u32, pvReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn GetActiveObject( rclsid: ?*const Guid, pvReserved: ?*anyopaque, ppunk: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn CreateErrorInfo( pperrinfo: ?*?*ICreateErrorInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn GetRecordInfoFromTypeInfo( pTypeInfo: ?*ITypeInfo, ppRecInfo: ?*?*IRecordInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn GetRecordInfoFromGuids( rGuidTypeLib: ?*const Guid, uVerMajor: u32, uVerMinor: u32, lcid: u32, rGuidTypeInfo: ?*const Guid, ppRecInfo: ?*?*IRecordInfo, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn OaBuildVersion( ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLEAUT32" fn ClearCustData( pCustData: ?*CUSTDATA, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLEAUT32" fn OaEnablePerUserTLibRegistration( ) callconv(@import("std").os.windows.WINAPI) void; pub extern "ole32" fn OleBuildVersion( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleInitialize( pvReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleUninitialize( ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleQueryLinkFromData( pSrcDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleQueryCreateFromData( pSrcDataObject: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreate( rclsid: ?*const Guid, riid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateEx( rclsid: ?*const Guid, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateFromData( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateFromDataEx( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateLinkFromData( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLinkFromDataEx( pSrcDataObj: ?*IDataObject, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateStaticFromData( pSrcDataObj: ?*IDataObject, iid: ?*const Guid, renderopt: u32, pFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLink( pmkLinkSrc: ?*IMoniker, riid: ?*const Guid, renderopt: u32, lpFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLinkEx( pmkLinkSrc: ?*IMoniker, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateLinkToFile( lpszFileName: ?[*:0]const u16, riid: ?*const Guid, renderopt: u32, lpFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateLinkToFileEx( lpszFileName: ?[*:0]const u16, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateFromFile( rclsid: ?*const Guid, lpszFileName: ?[*:0]const u16, riid: ?*const Guid, renderopt: u32, lpFormatEtc: ?*FORMATETC, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateFromFileEx( rclsid: ?*const Guid, lpszFileName: ?[*:0]const u16, riid: ?*const Guid, dwFlags: u32, renderopt: u32, cFormats: u32, rgAdvf: ?*u32, rgFormatEtc: ?*FORMATETC, lpAdviseSink: ?*IAdviseSink, rgdwConnection: ?*u32, pClientSite: ?*IOleClientSite, pStg: ?*IStorage, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleLoad( pStg: ?*IStorage, riid: ?*const Guid, pClientSite: ?*IOleClientSite, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSave( pPS: ?*IPersistStorage, pStg: ?*IStorage, fSameAsLoad: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleLoadFromStream( pStm: ?*IStream, iidInterface: ?*const Guid, ppvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSaveToStream( pPStm: ?*IPersistStream, pStm: ?*IStream, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSetContainedObject( pUnknown: ?*IUnknown, fContained: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleNoteObjectVisible( pUnknown: ?*IUnknown, fVisible: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn RegisterDragDrop( hwnd: ?HWND, pDropTarget: ?*IDropTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn RevokeDragDrop( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn DoDragDrop( pDataObj: ?*IDataObject, pDropSource: ?*IDropSource, dwOKEffects: u32, pdwEffect: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSetClipboard( pDataObj: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleGetClipboard( ppDataObj: ?*?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "ole32" fn OleGetClipboardWithEnterpriseInfo( dataObject: ?*?*IDataObject, dataEnterpriseId: ?*?PWSTR, sourceDescription: ?*?PWSTR, targetDescription: ?*?PWSTR, dataDescription: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleFlushClipboard( ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleIsCurrentClipboard( pDataObj: ?*IDataObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateMenuDescriptor( hmenuCombined: ?HMENU, lpMenuWidths: ?*OleMenuGroupWidths, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleSetMenuDescriptor( holemenu: isize, hwndFrame: ?HWND, hwndActiveObject: ?HWND, lpFrame: ?*IOleInPlaceFrame, lpActiveObj: ?*IOleInPlaceActiveObject, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleDestroyMenuDescriptor( holemenu: isize, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleTranslateAccelerator( lpFrame: ?*IOleInPlaceFrame, lpFrameInfo: ?*OIFI, lpmsg: ?*MSG, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleDuplicateData( hSrc: ?HANDLE, cfFormat: u16, uiFlags: u32, ) callconv(@import("std").os.windows.WINAPI) ?HANDLE; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleDraw( pUnknown: ?*IUnknown, dwAspect: u32, hdcDraw: ?HDC, lprcBounds: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRun( pUnknown: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleIsRunning( pObject: ?*IOleObject, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleLockRunning( pUnknown: ?*IUnknown, fLock: BOOL, fLastUnlockCloses: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn ReleaseStgMedium( param0: ?*STGMEDIUM, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn CreateOleAdviseHolder( ppOAHolder: ?*?*IOleAdviseHolder, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleCreateDefaultHandler( clsid: ?*const Guid, pUnkOuter: ?*IUnknown, riid: ?*const Guid, lplpObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleCreateEmbeddingHelper( clsid: ?*const Guid, pUnkOuter: ?*IUnknown, flags: u32, pCF: ?*IClassFactory, riid: ?*const Guid, lplpObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn IsAccelerator( hAccel: ?HACCEL, cAccelEntries: i32, lpMsg: ?*MSG, lpwCmd: ?*u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleGetIconOfFile( lpszPath: ?PWSTR, fUseFileAsLabel: BOOL, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleGetIconOfClass( rclsid: ?*const Guid, lpszLabel: ?PWSTR, fUseTypeAsLabel: BOOL, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleMetafilePictFromIconAndLabel( hIcon: ?HICON, lpszLabel: ?PWSTR, lpszSourceFile: ?PWSTR, iIconIndex: u32, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRegGetUserType( clsid: ?*const Guid, dwFormOfType: u32, pszUserType: ?*?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRegGetMiscStatus( clsid: ?*const Guid, dwAspect: u32, pdwStatus: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleRegEnumFormatEtc( clsid: ?*const Guid, dwDirection: u32, ppenum: ?*?*IEnumFORMATETC, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleRegEnumVerbs( clsid: ?*const Guid, ppenum: ?*?*IEnumOLEVERB, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleDoAutoConvert( pStg: ?*IStorage, pClsidNew: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLE32" fn OleGetAutoConvert( clsidOld: ?*const Guid, pClsidNew: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "ole32" fn OleSetAutoConvert( clsidOld: ?*const Guid, clsidNew: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLE32" fn HRGN_UserSize( param0: ?*u32, param1: u32, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLE32" fn HRGN_UserMarshal( param0: ?*u32, param1: ?*u8, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HRGN_UserUnmarshal( param0: ?*u32, param1: [*:0]u8, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "OLE32" fn HRGN_UserFree( param0: ?*u32, param1: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "api-ms-win-core-marshal-l1-1-0" fn HRGN_UserSize64( param0: ?*u32, param1: u32, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "api-ms-win-core-marshal-l1-1-0" fn HRGN_UserMarshal64( param0: ?*u32, param1: ?*u8, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "api-ms-win-core-marshal-l1-1-0" fn HRGN_UserUnmarshal64( param0: ?*u32, param1: [*:0]u8, param2: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) ?*u8; pub extern "api-ms-win-core-marshal-l1-1-0" fn HRGN_UserFree64( param0: ?*u32, param1: ?*?HRGN, ) callconv(@import("std").os.windows.WINAPI) void; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreatePropertyFrame( hwndOwner: ?HWND, x: u32, y: u32, lpszCaption: ?[*:0]const u16, cObjects: u32, ppUnk: ?*?*IUnknown, cPages: u32, pPageClsID: ?*Guid, lcid: u32, dwReserved: u32, pvReserved: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreatePropertyFrameIndirect( lpParams: ?*OCPFIPARAMS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleTranslateColor( clr: u32, hpal: ?HPALETTE, lpcolorref: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreateFontIndirect( lpFontDesc: ?*FONTDESC, riid: ?*const Guid, lplpvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleCreatePictureIndirect( lpPictDesc: ?*PICTDESC, riid: ?*const Guid, fOwn: BOOL, lplpvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleLoadPicture( lpstream: ?*IStream, lSize: i32, fRunmode: BOOL, riid: ?*const Guid, lplpvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleLoadPictureEx( lpstream: ?*IStream, lSize: i32, fRunmode: BOOL, riid: ?*const Guid, xSizeDesired: u32, ySizeDesired: u32, dwFlags: u32, lplpvObj: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleLoadPicturePath( szURLorPath: ?PWSTR, punkCaller: ?*IUnknown, dwReserved: u32, clrReserved: u32, riid: ?*const Guid, ppvRet: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn OleLoadPictureFile( varFileName: VARIANT, lplpdispPicture: ?*?*IDispatch, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn OleLoadPictureFileEx( varFileName: VARIANT, xSizeDesired: u32, ySizeDesired: u32, dwFlags: u32, lplpdispPicture: ?*?*IDispatch, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "OLEAUT32" fn OleSavePictureFile( lpdispPicture: ?*IDispatch, bstrFileName: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "OLEAUT32" fn OleIconToCursor( hinstExe: ?HINSTANCE, hIcon: ?HICON, ) callconv(@import("std").os.windows.WINAPI) ?HCURSOR; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIAddVerbMenuW( lpOleObj: ?*IOleObject, lpszShortType: ?[*:0]const u16, hMenu: ?HMENU, uPos: u32, uIDVerbMin: u32, uIDVerbMax: u32, bAddConvert: BOOL, idConvert: u32, lphMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIAddVerbMenuA( lpOleObj: ?*IOleObject, lpszShortType: ?[*:0]const u8, hMenu: ?HMENU, uPos: u32, uIDVerbMin: u32, uIDVerbMax: u32, bAddConvert: BOOL, idConvert: u32, lphMenu: ?*?HMENU, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIInsertObjectW( param0: ?*OLEUIINSERTOBJECTW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIInsertObjectA( param0: ?*OLEUIINSERTOBJECTA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPasteSpecialW( param0: ?*OLEUIPASTESPECIALW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPasteSpecialA( param0: ?*OLEUIPASTESPECIALA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIEditLinksW( param0: ?*OLEUIEDITLINKSW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIEditLinksA( param0: ?*OLEUIEDITLINKSA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeIconW( param0: ?*OLEUICHANGEICONW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeIconA( param0: ?*OLEUICHANGEICONA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIConvertW( param0: ?*OLEUICONVERTW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIConvertA( param0: ?*OLEUICONVERTA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUICanConvertOrActivateAs( rClsid: ?*const Guid, fIsLinkedObject: BOOL, wFormat: u16, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIBusyW( param0: ?*OLEUIBUSYW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIBusyA( param0: ?*OLEUIBUSYA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeSourceW( param0: ?*OLEUICHANGESOURCEW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIChangeSourceA( param0: ?*OLEUICHANGESOURCEA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIObjectPropertiesW( param0: ?*OLEUIOBJECTPROPSW, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIObjectPropertiesA( param0: ?*OLEUIOBJECTPROPSA, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPromptUserW( nTemplate: i32, hwndParent: ?HWND, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIPromptUserA( nTemplate: i32, hwndParent: ?HWND, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIUpdateLinksW( lpOleUILinkCntr: ?*IOleUILinkContainerW, hwndParent: ?HWND, lpszTitle: ?PWSTR, cLinks: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "oledlg" fn OleUIUpdateLinksA( lpOleUILinkCntr: ?*IOleUILinkContainerA, hwndParent: ?HWND, lpszTitle: ?PSTR, cLinks: i32, ) callconv(@import("std").os.windows.WINAPI) BOOL; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (26) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const OLEUIINSERTOBJECT = thismodule.OLEUIINSERTOBJECTA; pub const OLEUIPASTEENTRY = thismodule.OLEUIPASTEENTRYA; pub const OLEUIPASTESPECIAL = thismodule.OLEUIPASTESPECIALA; pub const IOleUILinkContainer = thismodule.IOleUILinkContainerA; pub const OLEUIEDITLINKS = thismodule.OLEUIEDITLINKSA; pub const OLEUICHANGEICON = thismodule.OLEUICHANGEICONA; pub const OLEUICONVERT = thismodule.OLEUICONVERTA; pub const OLEUIBUSY = thismodule.OLEUIBUSYA; pub const OLEUICHANGESOURCE = thismodule.OLEUICHANGESOURCEA; pub const IOleUIObjInfo = thismodule.IOleUIObjInfoA; pub const IOleUILinkInfo = thismodule.IOleUILinkInfoA; pub const OLEUIGNRLPROPS = thismodule.OLEUIGNRLPROPSA; pub const OLEUIVIEWPROPS = thismodule.OLEUIVIEWPROPSA; pub const OLEUILINKPROPS = thismodule.OLEUILINKPROPSA; pub const OLEUIOBJECTPROPS = thismodule.OLEUIOBJECTPROPSA; pub const OleUIAddVerbMenu = thismodule.OleUIAddVerbMenuA; pub const OleUIInsertObject = thismodule.OleUIInsertObjectA; pub const OleUIPasteSpecial = thismodule.OleUIPasteSpecialA; pub const OleUIEditLinks = thismodule.OleUIEditLinksA; pub const OleUIChangeIcon = thismodule.OleUIChangeIconA; pub const OleUIConvert = thismodule.OleUIConvertA; pub const OleUIBusy = thismodule.OleUIBusyA; pub const OleUIChangeSource = thismodule.OleUIChangeSourceA; pub const OleUIObjectProperties = thismodule.OleUIObjectPropertiesA; pub const OleUIPromptUser = thismodule.OleUIPromptUserA; pub const OleUIUpdateLinks = thismodule.OleUIUpdateLinksA; }, .wide => struct { pub const OLEUIINSERTOBJECT = thismodule.OLEUIINSERTOBJECTW; pub const OLEUIPASTEENTRY = thismodule.OLEUIPASTEENTRYW; pub const OLEUIPASTESPECIAL = thismodule.OLEUIPASTESPECIALW; pub const IOleUILinkContainer = thismodule.IOleUILinkContainerW; pub const OLEUIEDITLINKS = thismodule.OLEUIEDITLINKSW; pub const OLEUICHANGEICON = thismodule.OLEUICHANGEICONW; pub const OLEUICONVERT = thismodule.OLEUICONVERTW; pub const OLEUIBUSY = thismodule.OLEUIBUSYW; pub const OLEUICHANGESOURCE = thismodule.OLEUICHANGESOURCEW; pub const IOleUIObjInfo = thismodule.IOleUIObjInfoW; pub const IOleUILinkInfo = thismodule.IOleUILinkInfoW; pub const OLEUIGNRLPROPS = thismodule.OLEUIGNRLPROPSW; pub const OLEUIVIEWPROPS = thismodule.OLEUIVIEWPROPSW; pub const OLEUILINKPROPS = thismodule.OLEUILINKPROPSW; pub const OLEUIOBJECTPROPS = thismodule.OLEUIOBJECTPROPSW; pub const OleUIAddVerbMenu = thismodule.OleUIAddVerbMenuW; pub const OleUIInsertObject = thismodule.OleUIInsertObjectW; pub const OleUIPasteSpecial = thismodule.OleUIPasteSpecialW; pub const OleUIEditLinks = thismodule.OleUIEditLinksW; pub const OleUIChangeIcon = thismodule.OleUIChangeIconW; pub const OleUIConvert = thismodule.OleUIConvertW; pub const OleUIBusy = thismodule.OleUIBusyW; pub const OleUIChangeSource = thismodule.OleUIChangeSourceW; pub const OleUIObjectProperties = thismodule.OleUIObjectPropertiesW; pub const OleUIPromptUser = thismodule.OleUIPromptUserW; pub const OleUIUpdateLinks = thismodule.OleUIUpdateLinksW; }, .unspecified => if (@import("builtin").is_test) struct { pub const OLEUIINSERTOBJECT = *opaque{}; pub const OLEUIPASTEENTRY = *opaque{}; pub const OLEUIPASTESPECIAL = *opaque{}; pub const IOleUILinkContainer = *opaque{}; pub const OLEUIEDITLINKS = *opaque{}; pub const OLEUICHANGEICON = *opaque{}; pub const OLEUICONVERT = *opaque{}; pub const OLEUIBUSY = *opaque{}; pub const OLEUICHANGESOURCE = *opaque{}; pub const IOleUIObjInfo = *opaque{}; pub const IOleUILinkInfo = *opaque{}; pub const OLEUIGNRLPROPS = *opaque{}; pub const OLEUIVIEWPROPS = *opaque{}; pub const OLEUILINKPROPS = *opaque{}; pub const OLEUIOBJECTPROPS = *opaque{}; pub const OleUIAddVerbMenu = *opaque{}; pub const OleUIInsertObject = *opaque{}; pub const OleUIPasteSpecial = *opaque{}; pub const OleUIEditLinks = *opaque{}; pub const OleUIChangeIcon = *opaque{}; pub const OleUIConvert = *opaque{}; pub const OleUIBusy = *opaque{}; pub const OleUIChangeSource = *opaque{}; pub const OleUIObjectProperties = *opaque{}; pub const OleUIPromptUser = *opaque{}; pub const OleUIUpdateLinks = *opaque{}; } else struct { pub const OLEUIINSERTOBJECT = @compileError("'OLEUIINSERTOBJECT' requires that UNICODE be set to true or false in the root module"); pub const OLEUIPASTEENTRY = @compileError("'OLEUIPASTEENTRY' requires that UNICODE be set to true or false in the root module"); pub const OLEUIPASTESPECIAL = @compileError("'OLEUIPASTESPECIAL' requires that UNICODE be set to true or false in the root module"); pub const IOleUILinkContainer = @compileError("'IOleUILinkContainer' requires that UNICODE be set to true or false in the root module"); pub const OLEUIEDITLINKS = @compileError("'OLEUIEDITLINKS' requires that UNICODE be set to true or false in the root module"); pub const OLEUICHANGEICON = @compileError("'OLEUICHANGEICON' requires that UNICODE be set to true or false in the root module"); pub const OLEUICONVERT = @compileError("'OLEUICONVERT' requires that UNICODE be set to true or false in the root module"); pub const OLEUIBUSY = @compileError("'OLEUIBUSY' requires that UNICODE be set to true or false in the root module"); pub const OLEUICHANGESOURCE = @compileError("'OLEUICHANGESOURCE' requires that UNICODE be set to true or false in the root module"); pub const IOleUIObjInfo = @compileError("'IOleUIObjInfo' requires that UNICODE be set to true or false in the root module"); pub const IOleUILinkInfo = @compileError("'IOleUILinkInfo' requires that UNICODE be set to true or false in the root module"); pub const OLEUIGNRLPROPS = @compileError("'OLEUIGNRLPROPS' requires that UNICODE be set to true or false in the root module"); pub const OLEUIVIEWPROPS = @compileError("'OLEUIVIEWPROPS' requires that UNICODE be set to true or false in the root module"); pub const OLEUILINKPROPS = @compileError("'OLEUILINKPROPS' requires that UNICODE be set to true or false in the root module"); pub const OLEUIOBJECTPROPS = @compileError("'OLEUIOBJECTPROPS' requires that UNICODE be set to true or false in the root module"); pub const OleUIAddVerbMenu = @compileError("'OleUIAddVerbMenu' requires that UNICODE be set to true or false in the root module"); pub const OleUIInsertObject = @compileError("'OleUIInsertObject' requires that UNICODE be set to true or false in the root module"); pub const OleUIPasteSpecial = @compileError("'OleUIPasteSpecial' requires that UNICODE be set to true or false in the root module"); pub const OleUIEditLinks = @compileError("'OleUIEditLinks' requires that UNICODE be set to true or false in the root module"); pub const OleUIChangeIcon = @compileError("'OleUIChangeIcon' requires that UNICODE be set to true or false in the root module"); pub const OleUIConvert = @compileError("'OleUIConvert' requires that UNICODE be set to true or false in the root module"); pub const OleUIBusy = @compileError("'OleUIBusy' requires that UNICODE be set to true or false in the root module"); pub const OleUIChangeSource = @compileError("'OleUIChangeSource' requires that UNICODE be set to true or false in the root module"); pub const OleUIObjectProperties = @compileError("'OleUIObjectProperties' requires that UNICODE be set to true or false in the root module"); pub const OleUIPromptUser = @compileError("'OleUIPromptUser' requires that UNICODE be set to true or false in the root module"); pub const OleUIUpdateLinks = @compileError("'OleUIUpdateLinks' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (87) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BSTR = @import("../foundation.zig").BSTR; const BYTE_SIZEDARR = @import("../system/com.zig").BYTE_SIZEDARR; const CALLCONV = @import("../system/com.zig").CALLCONV; const CHAR = @import("../foundation.zig").CHAR; const CUSTDATA = @import("../system/com.zig").CUSTDATA; const CY = @import("../system/com.zig").CY; const DECIMAL = @import("../foundation.zig").DECIMAL; const DISPPARAMS = @import("../system/com.zig").DISPPARAMS; const DVASPECT = @import("../system/com.zig").DVASPECT; const DVTARGETDEVICE = @import("../system/com.zig").DVTARGETDEVICE; const EXCEPINFO = @import("../system/com.zig").EXCEPINFO; const FILETIME = @import("../foundation.zig").FILETIME; const FLAGGED_WORD_BLOB = @import("../system/com.zig").FLAGGED_WORD_BLOB; const FORMATETC = @import("../system/com.zig").FORMATETC; const FUNCDESC = @import("../system/com.zig").FUNCDESC; const HACCEL = @import("../ui/windows_and_messaging.zig").HACCEL; const HANDLE = @import("../foundation.zig").HANDLE; const HBITMAP = @import("../graphics/gdi.zig").HBITMAP; const HCURSOR = @import("../ui/windows_and_messaging.zig").HCURSOR; const HDC = @import("../graphics/gdi.zig").HDC; const HENHMETAFILE = @import("../graphics/gdi.zig").HENHMETAFILE; const HFONT = @import("../graphics/gdi.zig").HFONT; const HICON = @import("../ui/windows_and_messaging.zig").HICON; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HMENU = @import("../ui/windows_and_messaging.zig").HMENU; const HMETAFILE = @import("../graphics/gdi.zig").HMETAFILE; const HPALETTE = @import("../graphics/gdi.zig").HPALETTE; const HRESULT = @import("../foundation.zig").HRESULT; const HRGN = @import("../graphics/gdi.zig").HRGN; const HRSRC = @import("../foundation.zig").HRSRC; const HTASK = @import("../media.zig").HTASK; const HWND = @import("../foundation.zig").HWND; const HYPER_SIZEDARR = @import("../system/com.zig").HYPER_SIZEDARR; const IAdviseSink = @import("../system/com.zig").IAdviseSink; const IBindCtx = @import("../system/com.zig").IBindCtx; const IBindHost = @import("../system/com.zig").IBindHost; const IClassFactory = @import("../system/com.zig").IClassFactory; const IDataObject = @import("../system/com.zig").IDataObject; const IDispatch = @import("../system/com.zig").IDispatch; const IDLDESC = @import("../system/com.zig").IDLDESC; const IEnumFORMATETC = @import("../system/com.zig").IEnumFORMATETC; const IEnumSTATDATA = @import("../system/com.zig").IEnumSTATDATA; const IEnumUnknown = @import("../system/com.zig").IEnumUnknown; const IErrorLog = @import("../system/com.zig").IErrorLog; const IMoniker = @import("../system/com.zig").IMoniker; const INVOKEKIND = @import("../system/com.zig").INVOKEKIND; const IPersist = @import("../system/com.zig").IPersist; const IPersistStorage = @import("../system/com/structured_storage.zig").IPersistStorage; const IPersistStream = @import("../system/com.zig").IPersistStream; const IPropertyBag = @import("../system/com/structured_storage.zig").IPropertyBag; const IPropertyBag2 = @import("../system/com/structured_storage.zig").IPropertyBag2; const IServiceProvider = @import("../system/com.zig").IServiceProvider; const IStorage = @import("../system/com/structured_storage.zig").IStorage; const IStream = @import("../system/com.zig").IStream; const ITypeInfo = @import("../system/com.zig").ITypeInfo; const ITypeLib = @import("../system/com.zig").ITypeLib; const IUnknown = @import("../system/com.zig").IUnknown; const LOGPALETTE = @import("../graphics/gdi.zig").LOGPALETTE; const LONG_SIZEDARR = @import("../system/com.zig").LONG_SIZEDARR; const LPARAM = @import("../foundation.zig").LPARAM; const LRESULT = @import("../foundation.zig").LRESULT; const MSG = @import("../ui/windows_and_messaging.zig").MSG; const OPENFILENAMEA = @import("../ui/controls/dialogs.zig").OPENFILENAMEA; const OPENFILENAMEW = @import("../ui/controls/dialogs.zig").OPENFILENAMEW; const POINT = @import("../foundation.zig").POINT; const POINTL = @import("../foundation.zig").POINTL; const PROPSHEETHEADERA_V2 = @import("../ui/controls.zig").PROPSHEETHEADERA_V2; const PROPSHEETHEADERW_V2 = @import("../ui/controls.zig").PROPSHEETHEADERW_V2; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; const RECT = @import("../foundation.zig").RECT; const RECTL = @import("../foundation.zig").RECTL; const SAFEARRAY = @import("../system/com.zig").SAFEARRAY; const SAFEARRAYBOUND = @import("../system/com.zig").SAFEARRAYBOUND; const SHORT_SIZEDARR = @import("../system/com.zig").SHORT_SIZEDARR; const SIZE = @import("../foundation.zig").SIZE; const STGMEDIUM = @import("../system/com.zig").STGMEDIUM; const SYSKIND = @import("../system/com.zig").SYSKIND; const SYSTEMTIME = @import("../foundation.zig").SYSTEMTIME; const TEXTMETRICW = @import("../graphics/gdi.zig").TEXTMETRICW; const TYPEDESC = @import("../system/com.zig").TYPEDESC; const TYPEKIND = @import("../system/com.zig").TYPEKIND; const VARDESC = @import("../system/com.zig").VARDESC; const VARIANT = @import("../system/com.zig").VARIANT; const WPARAM = @import("../foundation.zig").WPARAM; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "LPFNOLEUIHOOK")) { _ = LPFNOLEUIHOOK; } @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/ole.zig
//-------------------------------------------------------------------------------- // Section: Types (15) //-------------------------------------------------------------------------------- const CLSID_Catalog_Value = Guid.initString("6eb22881-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_Catalog = &CLSID_Catalog_Value; const CLSID_CatalogObject_Value = Guid.initString("6eb22882-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_CatalogObject = &CLSID_CatalogObject_Value; const CLSID_CatalogCollection_Value = Guid.initString("6eb22883-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_CatalogCollection = &CLSID_CatalogCollection_Value; const CLSID_ComponentUtil_Value = Guid.initString("6eb22884-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_ComponentUtil = &CLSID_ComponentUtil_Value; const CLSID_PackageUtil_Value = Guid.initString("6eb22885-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_PackageUtil = &CLSID_PackageUtil_Value; const CLSID_RemoteComponentUtil_Value = Guid.initString("6eb22886-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_RemoteComponentUtil = &CLSID_RemoteComponentUtil_Value; const CLSID_RoleAssociationUtil_Value = Guid.initString("6eb22887-8a19-11d0-81b6-00a0c9231c29"); pub const CLSID_RoleAssociationUtil = &CLSID_RoleAssociationUtil_Value; const IID_ICatalog_Value = Guid.initString("6eb22870-8a19-11d0-81b6-00a0c9231c29"); pub const IID_ICatalog = &IID_ICatalog_Value; pub const ICatalog = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, GetCollection: fn( self: *const ICatalog, bstrCollName: ?BSTR, ppCatalogCollection: ?*?*IDispatch, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Connect: fn( self: *const ICatalog, bstrConnectString: ?BSTR, ppCatalogCollection: ?*?*IDispatch, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MajorVersion: fn( self: *const ICatalog, retval: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_MinorVersion: fn( self: *const ICatalog, retval: ?*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 ICatalog_GetCollection(self: *const T, bstrCollName: ?BSTR, ppCatalogCollection: ?*?*IDispatch) callconv(.Inline) HRESULT { return @ptrCast(*const ICatalog.VTable, self.vtable).GetCollection(@ptrCast(*const ICatalog, self), bstrCollName, ppCatalogCollection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatalog_Connect(self: *const T, bstrConnectString: ?BSTR, ppCatalogCollection: ?*?*IDispatch) callconv(.Inline) HRESULT { return @ptrCast(*const ICatalog.VTable, self.vtable).Connect(@ptrCast(*const ICatalog, self), bstrConnectString, ppCatalogCollection); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatalog_get_MajorVersion(self: *const T, retval: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ICatalog.VTable, self.vtable).get_MajorVersion(@ptrCast(*const ICatalog, self), retval); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ICatalog_get_MinorVersion(self: *const T, retval: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ICatalog.VTable, self.vtable).get_MinorVersion(@ptrCast(*const ICatalog, self), retval); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IComponentUtil_Value = Guid.initString("6eb22873-8a19-11d0-81b6-00a0c9231c29"); pub const IID_IComponentUtil = &IID_IComponentUtil_Value; pub const IComponentUtil = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, InstallComponent: fn( self: *const IComponentUtil, bstrDLLFile: ?BSTR, bstrTypelibFile: ?BSTR, bstrProxyStubDLLFile: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ImportComponent: fn( self: *const IComponentUtil, bstrCLSID: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ImportComponentByName: fn( self: *const IComponentUtil, bstrProgID: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCLSIDs: fn( self: *const IComponentUtil, bstrDLLFile: ?BSTR, bstrTypelibFile: ?BSTR, aCLSIDs: ?*?*SAFEARRAY, ) 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 IComponentUtil_InstallComponent(self: *const T, bstrDLLFile: ?BSTR, bstrTypelibFile: ?BSTR, bstrProxyStubDLLFile: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IComponentUtil.VTable, self.vtable).InstallComponent(@ptrCast(*const IComponentUtil, self), bstrDLLFile, bstrTypelibFile, bstrProxyStubDLLFile); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComponentUtil_ImportComponent(self: *const T, bstrCLSID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IComponentUtil.VTable, self.vtable).ImportComponent(@ptrCast(*const IComponentUtil, self), bstrCLSID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComponentUtil_ImportComponentByName(self: *const T, bstrProgID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IComponentUtil.VTable, self.vtable).ImportComponentByName(@ptrCast(*const IComponentUtil, self), bstrProgID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IComponentUtil_GetCLSIDs(self: *const T, bstrDLLFile: ?BSTR, bstrTypelibFile: ?BSTR, aCLSIDs: ?*?*SAFEARRAY) callconv(.Inline) HRESULT { return @ptrCast(*const IComponentUtil.VTable, self.vtable).GetCLSIDs(@ptrCast(*const IComponentUtil, self), bstrDLLFile, bstrTypelibFile, aCLSIDs); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IPackageUtil_Value = Guid.initString("6eb22874-8a19-11d0-81b6-00a0c9231c29"); pub const IID_IPackageUtil = &IID_IPackageUtil_Value; pub const IPackageUtil = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, InstallPackage: fn( self: *const IPackageUtil, bstrPackageFile: ?BSTR, bstrInstallPath: ?BSTR, lOptions: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ExportPackage: fn( self: *const IPackageUtil, bstrPackageID: ?BSTR, bstrPackageFile: ?BSTR, lOptions: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ShutdownPackage: fn( self: *const IPackageUtil, bstrPackageID: ?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 IPackageUtil_InstallPackage(self: *const T, bstrPackageFile: ?BSTR, bstrInstallPath: ?BSTR, lOptions: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPackageUtil.VTable, self.vtable).InstallPackage(@ptrCast(*const IPackageUtil, self), bstrPackageFile, bstrInstallPath, lOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPackageUtil_ExportPackage(self: *const T, bstrPackageID: ?BSTR, bstrPackageFile: ?BSTR, lOptions: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IPackageUtil.VTable, self.vtable).ExportPackage(@ptrCast(*const IPackageUtil, self), bstrPackageID, bstrPackageFile, lOptions); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IPackageUtil_ShutdownPackage(self: *const T, bstrPackageID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IPackageUtil.VTable, self.vtable).ShutdownPackage(@ptrCast(*const IPackageUtil, self), bstrPackageID); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRemoteComponentUtil_Value = Guid.initString("6eb22875-8a19-11d0-81b6-00a0c9231c29"); pub const IID_IRemoteComponentUtil = &IID_IRemoteComponentUtil_Value; pub const IRemoteComponentUtil = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, InstallRemoteComponent: fn( self: *const IRemoteComponentUtil, bstrServer: ?BSTR, bstrPackageID: ?BSTR, bstrCLSID: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, InstallRemoteComponentByName: fn( self: *const IRemoteComponentUtil, bstrServer: ?BSTR, bstrPackageName: ?BSTR, bstrProgID: ?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 IRemoteComponentUtil_InstallRemoteComponent(self: *const T, bstrServer: ?BSTR, bstrPackageID: ?BSTR, bstrCLSID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRemoteComponentUtil.VTable, self.vtable).InstallRemoteComponent(@ptrCast(*const IRemoteComponentUtil, self), bstrServer, bstrPackageID, bstrCLSID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRemoteComponentUtil_InstallRemoteComponentByName(self: *const T, bstrServer: ?BSTR, bstrPackageName: ?BSTR, bstrProgID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRemoteComponentUtil.VTable, self.vtable).InstallRemoteComponentByName(@ptrCast(*const IRemoteComponentUtil, self), bstrServer, bstrPackageName, bstrProgID); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IRoleAssociationUtil_Value = Guid.initString("6eb22876-8a19-11d0-81b6-00a0c9231c29"); pub const IID_IRoleAssociationUtil = &IID_IRoleAssociationUtil_Value; pub const IRoleAssociationUtil = extern struct { pub const VTable = extern struct { base: IDispatch.VTable, AssociateRole: fn( self: *const IRoleAssociationUtil, bstrRoleID: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AssociateRoleByName: fn( self: *const IRoleAssociationUtil, bstrRoleName: ?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 IRoleAssociationUtil_AssociateRole(self: *const T, bstrRoleID: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRoleAssociationUtil.VTable, self.vtable).AssociateRole(@ptrCast(*const IRoleAssociationUtil, self), bstrRoleID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IRoleAssociationUtil_AssociateRoleByName(self: *const T, bstrRoleName: ?BSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IRoleAssociationUtil.VTable, self.vtable).AssociateRoleByName(@ptrCast(*const IRoleAssociationUtil, self), bstrRoleName); } };} pub usingnamespace MethodMixin(@This()); }; pub const __MIDL___MIDL_itf_mtxadmin_0107_0001 = enum(i32) { s = 1, }; pub const mtsInstallUsers = __MIDL___MIDL_itf_mtxadmin_0107_0001.s; pub const __MIDL___MIDL_itf_mtxadmin_0107_0002 = enum(i32) { s = 1, }; pub const mtsExportUsers = __MIDL___MIDL_itf_mtxadmin_0107_0002.s; pub const __MIDL___MIDL_itf_mtxadmin_0107_0003 = enum(i32) { ObjectErrors = -2146368511, ObjectInvalid = -2146368510, KeyMissing = -2146368509, AlreadyInstalled = -2146368508, DownloadFailed = -2146368507, PDFWriteFail = -2146368505, PDFReadFail = -2146368504, PDFVersion = -2146368503, CoReqCompInstalled = -2146368496, BadPath = -2146368502, PackageExists = -2146368501, RoleExists = -2146368500, CantCopyFile = -2146368499, NoTypeLib = -2146368498, NoUser = -2146368497, // InvalidUserids = -2146368496, this enum value conflicts with CoReqCompInstalled NoRegistryCLSID = -2146368495, BadRegistryProgID = -2146368494, AuthenticationLevel = -2146368493, UserPasswdNotValid = -2146368492, NoRegistryRead = -2146368491, NoRegistryWrite = -2146368490, NoRegistryRepair = -2146368489, CLSIDOrIIDMismatch = -2146368488, RemoteInterface = -2146368487, DllRegisterServer = -2146368486, NoServerShare = -2146368485, NoAccessToUNC = -2146368484, DllLoadFailed = -2146368483, BadRegistryLibID = -2146368482, PackDirNotFound = -2146368481, TreatAs = -2146368480, BadForward = -2146368479, BadIID = -2146368478, RegistrarFailed = -2146368477, CompFileDoesNotExist = -2146368476, CompFileLoadDLLFail = -2146368475, CompFileGetClassObj = -2146368474, CompFileClassNotAvail = -2146368473, CompFileBadTLB = -2146368472, CompFileNotInstallable = -2146368471, NotChangeable = -2146368470, NotDeletable = -2146368469, Session = -2146368468, CompFileNoRegistrar = -2146368460, }; pub const mtsErrObjectErrors = __MIDL___MIDL_itf_mtxadmin_0107_0003.ObjectErrors; pub const mtsErrObjectInvalid = __MIDL___MIDL_itf_mtxadmin_0107_0003.ObjectInvalid; pub const mtsErrKeyMissing = __MIDL___MIDL_itf_mtxadmin_0107_0003.KeyMissing; pub const mtsErrAlreadyInstalled = __MIDL___MIDL_itf_mtxadmin_0107_0003.AlreadyInstalled; pub const mtsErrDownloadFailed = __MIDL___MIDL_itf_mtxadmin_0107_0003.DownloadFailed; pub const mtsErrPDFWriteFail = __MIDL___MIDL_itf_mtxadmin_0107_0003.PDFWriteFail; pub const mtsErrPDFReadFail = __MIDL___MIDL_itf_mtxadmin_0107_0003.PDFReadFail; pub const mtsErrPDFVersion = __MIDL___MIDL_itf_mtxadmin_0107_0003.PDFVersion; pub const mtsErrCoReqCompInstalled = __MIDL___MIDL_itf_mtxadmin_0107_0003.CoReqCompInstalled; pub const mtsErrBadPath = __MIDL___MIDL_itf_mtxadmin_0107_0003.BadPath; pub const mtsErrPackageExists = __MIDL___MIDL_itf_mtxadmin_0107_0003.PackageExists; pub const mtsErrRoleExists = __MIDL___MIDL_itf_mtxadmin_0107_0003.RoleExists; pub const mtsErrCantCopyFile = __MIDL___MIDL_itf_mtxadmin_0107_0003.CantCopyFile; pub const mtsErrNoTypeLib = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoTypeLib; pub const mtsErrNoUser = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoUser; pub const mtsErrInvalidUserids = __MIDL___MIDL_itf_mtxadmin_0107_0003.CoReqCompInstalled; pub const mtsErrNoRegistryCLSID = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoRegistryCLSID; pub const mtsErrBadRegistryProgID = __MIDL___MIDL_itf_mtxadmin_0107_0003.BadRegistryProgID; pub const mtsErrAuthenticationLevel = __MIDL___MIDL_itf_mtxadmin_0107_0003.AuthenticationLevel; pub const mtsErrUserPasswdNotValid = __MIDL___MIDL_itf_mtxadmin_0107_0003.UserPasswdNotValid; pub const mtsErrNoRegistryRead = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoRegistryRead; pub const mtsErrNoRegistryWrite = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoRegistryWrite; pub const mtsErrNoRegistryRepair = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoRegistryRepair; pub const mtsErrCLSIDOrIIDMismatch = __MIDL___MIDL_itf_mtxadmin_0107_0003.CLSIDOrIIDMismatch; pub const mtsErrRemoteInterface = __MIDL___MIDL_itf_mtxadmin_0107_0003.RemoteInterface; pub const mtsErrDllRegisterServer = __MIDL___MIDL_itf_mtxadmin_0107_0003.DllRegisterServer; pub const mtsErrNoServerShare = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoServerShare; pub const mtsErrNoAccessToUNC = __MIDL___MIDL_itf_mtxadmin_0107_0003.NoAccessToUNC; pub const mtsErrDllLoadFailed = __MIDL___MIDL_itf_mtxadmin_0107_0003.DllLoadFailed; pub const mtsErrBadRegistryLibID = __MIDL___MIDL_itf_mtxadmin_0107_0003.BadRegistryLibID; pub const mtsErrPackDirNotFound = __MIDL___MIDL_itf_mtxadmin_0107_0003.PackDirNotFound; pub const mtsErrTreatAs = __MIDL___MIDL_itf_mtxadmin_0107_0003.TreatAs; pub const mtsErrBadForward = __MIDL___MIDL_itf_mtxadmin_0107_0003.BadForward; pub const mtsErrBadIID = __MIDL___MIDL_itf_mtxadmin_0107_0003.BadIID; pub const mtsErrRegistrarFailed = __MIDL___MIDL_itf_mtxadmin_0107_0003.RegistrarFailed; pub const mtsErrCompFileDoesNotExist = __MIDL___MIDL_itf_mtxadmin_0107_0003.CompFileDoesNotExist; pub const mtsErrCompFileLoadDLLFail = __MIDL___MIDL_itf_mtxadmin_0107_0003.CompFileLoadDLLFail; pub const mtsErrCompFileGetClassObj = __MIDL___MIDL_itf_mtxadmin_0107_0003.CompFileGetClassObj; pub const mtsErrCompFileClassNotAvail = __MIDL___MIDL_itf_mtxadmin_0107_0003.CompFileClassNotAvail; pub const mtsErrCompFileBadTLB = __MIDL___MIDL_itf_mtxadmin_0107_0003.CompFileBadTLB; pub const mtsErrCompFileNotInstallable = __MIDL___MIDL_itf_mtxadmin_0107_0003.CompFileNotInstallable; pub const mtsErrNotChangeable = __MIDL___MIDL_itf_mtxadmin_0107_0003.NotChangeable; pub const mtsErrNotDeletable = __MIDL___MIDL_itf_mtxadmin_0107_0003.NotDeletable; pub const mtsErrSession = __MIDL___MIDL_itf_mtxadmin_0107_0003.Session; pub const mtsErrCompFileNoRegistrar = __MIDL___MIDL_itf_mtxadmin_0107_0003.CompFileNoRegistrar; //-------------------------------------------------------------------------------- // 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 (5) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BSTR = @import("../foundation.zig").BSTR; const HRESULT = @import("../foundation.zig").HRESULT; const IDispatch = @import("../system/com.zig").IDispatch; const SAFEARRAY = @import("../system/com.zig").SAFEARRAY; 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/transaction_server.zig
const std = @import("std"); const print = std.debug.print; const Pos = struct { x: usize, y: usize }; const Grid = struct { allocator: *std.mem.Allocator, grid: *[1000][1000]bool, pub fn init(allocator: *std.mem.Allocator) !Grid { var grid = try allocator.create([1000][1000]bool); for (grid) |*row| { for (row) |*cell| { cell.* = false; } } return Grid{ .allocator = allocator, .grid = grid, }; } pub fn deinit(self: *Grid) void { self.allocator.free(self.grid); self.* = undefined; } pub fn on(self: Grid, low: Pos, high: Pos) void { var x = low.x; while (x <= high.x) : (x += 1) { var y = low.y; while (y <= high.y) : (y += 1) { self.grid[y][x] = true; } } } pub fn off(self: Grid, low: Pos, high: Pos) void { var x = low.x; while (x <= high.x) : (x += 1) { var y = low.y; while (y <= high.y) : (y += 1) { self.grid[y][x] = false; } } } pub fn toggle(self: Grid, low: Pos, high: Pos) void { var x = low.x; while (x <= high.x) : (x += 1) { var y = low.y; while (y <= high.y) : (y += 1) { self.grid[y][x] = !self.grid[y][x]; } } } pub fn count_on(self: Grid) usize { var count: usize = 0; var x: usize = 0; while (x <= 999) : (x += 1) { var y: usize = 0; while (y <= 999) : (y += 1) { if (self.grid[y][x]) { count += 1; } } } return count; } }; const Grid2 = struct { allocator: *std.mem.Allocator, grid: *[1000][1000]usize, pub fn init(allocator: *std.mem.Allocator) !Grid2 { var grid = try allocator.create([1000][1000]usize); for (grid) |*row| { for (row) |*cell| { cell.* = 0; } } return Grid2{ .allocator = allocator, .grid = grid, }; } pub fn deinit(self: *Grid2) void { self.allocator.free(self.grid); self.* = undefined; } pub fn on(self: Grid2, low: Pos, high: Pos) void { var x = low.x; while (x <= high.x) : (x += 1) { var y = low.y; while (y <= high.y) : (y += 1) { self.grid[y][x] += 1; } } } pub fn off(self: Grid2, low: Pos, high: Pos) void { var x = low.x; while (x <= high.x) : (x += 1) { var y = low.y; while (y <= high.y) : (y += 1) { if (self.grid[y][x] > 0) { self.grid[y][x] -= 1; } } } } pub fn toggle(self: Grid2, low: Pos, high: Pos) void { var x = low.x; while (x <= high.x) : (x += 1) { var y = low.y; while (y <= high.y) : (y += 1) { self.grid[y][x] += 2; } } } pub fn brightness(self: Grid2) usize { var brightness_amount: usize = 0; var x: usize = 0; while (x <= 999) : (x += 1) { var y: usize = 0; while (y <= 999) : (y += 1) { brightness_amount += self.grid[y][x]; } } return brightness_amount; } }; pub fn main() anyerror!void { const allocator = std.heap.page_allocator; var file = try std.fs.cwd().openFile( "./inputs/day06.txt", .{ .read = true, }, ); var reader = std.io.bufferedReader(file.reader()).reader(); var line = std.ArrayList(u8).init(allocator); defer line.deinit(); var grid = try Grid.init(allocator); defer grid.deinit(); var grid2 = try Grid2.init(allocator); defer grid2.deinit(); while (reader.readUntilDelimiterArrayList(&line, '\n', 100)) { var tokens = std.mem.tokenize(u8, line.items, " "); var f: fn (Grid, Pos, Pos) void = undefined; var g: fn (Grid2, Pos, Pos) void = undefined; var t = tokens.next().?; if (std.mem.eql(u8, t, "toggle")) { f = Grid.toggle; g = Grid2.toggle; } else if (std.mem.eql(u8, t, "turn")) { var dir = tokens.next().?; if (std.mem.eql(u8, dir, "on")) { f = Grid.on; g = Grid2.on; } else if (std.mem.eql(u8, dir, "off")) { f = Grid.off; g = Grid2.off; } } var start: Pos = undefined; var start_token = tokens.next().?; { var it = std.mem.tokenize(u8, start_token, ","); start.x = try std.fmt.parseInt(usize, it.next().?, 10); start.y = try std.fmt.parseInt(usize, it.next().?, 10); } _ = tokens.next(); // through var end: Pos = undefined; var end_token = tokens.next().?; { var it = std.mem.tokenize(u8, end_token, ","); end.x = try std.fmt.parseInt(usize, it.next().?, 10); end.y = try std.fmt.parseInt(usize, it.next().?, 10); } f(grid, start, end); g(grid2, start, end); } else |err| { if (err != error.EndOfStream) { return err; } } print("Lights on: {d}\n", .{grid.count_on()}); print("Brightness: {d}\n", .{grid2.brightness()}); }
src/day06.zig
const std = @import("std"); const Allocator = std.mem.Allocator; /// A node in a circular double linked list. // /// The most useful property is that a node can remove itself from a list without having a referece /// to it with O(1) time complexity. One node is selected to act as the head of the list. Iteration /// is performed by following next or previous links from the head node until they point to the head /// node. /// /// Note that D can be set to void if you prefer to store nodes in another struct as opposed to /// nodes carrying data. In that case use @fieldParentPtr to perform necessary pointer /// manipulations. /// pub fn NodeType(comptime D: type) type { return struct { const Self = @This(); next_: *Self, prev_: *Self, datum: D, /// Initialize node with the specified datum and next and prev links pointing to itself /// thereby forming a single element list. pub fn init(self: *Self, datum: D) void { self.next_ = self; self.prev_ = self; self.datum = datum; } /// Allocate node using the supplied allocator and initialize it the same way init does. pub fn new(allocator: *Allocator, datum: D) !*Self { var node = try allocator.create(Self); init(node, datum); return node; } /// Link other node next to self. pub fn linkNext(self: *Self, other: *Self) void { const tmp = other.prev_; self.next_.prev_ = tmp; tmp.next_ = self.next_; other.prev_ = self; self.next_ = other; } /// Link other node previous to self. pub fn linkPrev(self: *Self, other: *Self) void { const tmp = other.prev_; self.prev_.next_ = other; tmp.next_ = self; other.prev_ = self.prev_; self.prev_ = tmp; } /// Unlink node from any list that it's part of. /// This function is safe to call on linked and unlinked nodes provided that they has at one /// time been initialized properly. pub fn unlink(self: *Self) void { self.next_.prev_ = self.prev_; self.prev_.next_ = self.next_; self.next_ = self; self.prev_ = self; } /// Follow the next link of node. pub inline fn next(self: *Self) *Self { return self.next_; } /// Follow the previous link of node. pub inline fn prev(self: *Self) *Self { return self.prev_; } /// Check if node is linked to another node than itself. /// This can be applied to the sentinel list head node to check if the list is empty. pub inline fn isLinked(self: *Self) bool { return self.next_ != self; } }; } test "linkNext" { var n: [5]Test.Node = undefined; Test.initNodes(n[0..]); // Link nodes form a list const h1 = &n[0]; h1.linkNext(&n[1]); h1.linkNext(&n[2]); // Link two multi node lists together const h2 = &n[3]; h2.linkNext(&n[4]); h1.linkNext(h2); // Expected node order [0, 3, 4, 2, 1] const expectedLinks = [_]Test.VNode{ Test.VNode{.next = &n[3], .prev = &n[1]}, Test.VNode{.next = &n[4], .prev = &n[0]}, Test.VNode{.next = &n[2], .prev = &n[3]}, Test.VNode{.next = &n[1], .prev = &n[4]}, Test.VNode{.next = &n[0], .prev = &n[2]}, }; Test.checkLinks(h1, expectedLinks[0..]); } test "linkPrev" { var n: [5]Test.Node = undefined; Test.initNodes(n[0..]); // Link nodes form a list const h1 = &n[0]; h1.linkPrev(&n[1]); h1.linkPrev(&n[2]); // Link two multi node lists together const h2 = &n[3]; h2.linkPrev(&n[4]); h1.linkPrev(h2); // Expected node order [0, 1, 2, 3, 4] const expectedLinks = [_]Test.VNode{ Test.VNode{.next = &n[1], .prev = &n[4]}, Test.VNode{.next = &n[2], .prev = &n[0]}, Test.VNode{.next = &n[3], .prev = &n[1]}, Test.VNode{.next = &n[4], .prev = &n[2]}, Test.VNode{.next = &n[0], .prev = &n[3]}, }; Test.checkLinks(h1, expectedLinks[0..]); } test "unlink" { var n: [3]Test.Node = undefined; Test.initNodes(n[0..]); const h1 = &n[0]; h1.linkPrev(&n[1]); h1.linkPrev(&n[2]); // Expected node order [0, 2] n[1].unlink(); const expectedLinks = [_]Test.VNode{ Test.VNode{.next = &n[2], .prev = &n[2]}, Test.VNode{.next = &n[0], .prev = &n[0]}, }; Test.checkLinks(h1, expectedLinks[0..]); // Test that the unlinked node point to itself const expectedLinks2 = [_]Test.VNode{ Test.VNode{.next = &n[1], .prev = &n[1]}, }; Test.checkLinks(&n[1], expectedLinks2[0..]); // Remove last node // Expected node order [0] // // Do it twice to make sure that unlinking an unlinked node has no effect. const expectedLinks3 = [_]Test.VNode{ Test.VNode{.next = &n[0], .prev = &n[0]}, }; var i: usize = 0; while (i < 2) : (i += 1) { n[2].unlink(); Test.checkLinks(h1, expectedLinks3[0..]); } } test "isLinked" { var buffer: [100]u8 = undefined; const allocator = &std.heap.FixedBufferAllocator.init(&buffer).allocator; const n0 = try Test.Node.new(allocator, 0); const n1 = try Test.Node.new(allocator, 1); try Test.expectEqual(false, n0.isLinked()); n0.linkPrev(n1); try Test.expectEqual(true, n0.isLinked()); try Test.expectEqual(true, n1.isLinked()); } test "iterate" { var n: [5]Test.Node = undefined; Test.initNodes(n[0..]); const h = &n[0]; for (n[1..]) |*t| { h.linkPrev(t); } var sum: u32 = 0; var it = h.next(); while (it != h) : (it = it.next()) { sum += it.datum; } try Test.expectEqual(@as(u32, 1+2+3+4), sum); } const Test = struct { const expectEqual = std.testing.expectEqual; const Node = NodeType(u32); const VNode = struct { next: *Test.Node, prev: *Test.Node, }; fn initNodes(nodes: []Test.Node) void { for (nodes) |*node, i| { node.init(@intCast(u32, i)); } } fn checkLinks(firstNode: *Node, expectedLinks: []const VNode) void { var n = firstNode; for (expectedLinks) |v, i| { if (n.next() != v.next) { std.debug.panic("expected next node of {} (index {}) to be {}; got {}", .{n.datum, i, v.next.datum, n.next().datum}); } if (n.prev() != v.prev) { std.debug.panic("expected previous node of {} (index {}) to be {}; got {}", .{n.datum, i, v.prev.datum, n.prev().datum}); } n = n.next(); } } };
list.zig
pub const E_SURFACE_CONTENTS_LOST = @as(u32, 2150301728); //-------------------------------------------------------------------------------- // Section: Types (19) //-------------------------------------------------------------------------------- const IID_ISurfaceImageSourceNative_Value = @import("../../zig.zig").Guid.initString("f2e9edc1-d307-4525-9886-0fafaa44163c"); pub const IID_ISurfaceImageSourceNative = &IID_ISurfaceImageSourceNative_Value; pub const ISurfaceImageSourceNative = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetDevice: fn( self: *const ISurfaceImageSourceNative, device: ?*IDXGIDevice, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BeginDraw: fn( self: *const ISurfaceImageSourceNative, updateRect: RECT, surface: ?*?*IDXGISurface, offset: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EndDraw: fn( self: *const ISurfaceImageSourceNative, ) 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 ISurfaceImageSourceNative_SetDevice(self: *const T, device: ?*IDXGIDevice) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNative.VTable, self.vtable).SetDevice(@ptrCast(*const ISurfaceImageSourceNative, self), device); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurfaceImageSourceNative_BeginDraw(self: *const T, updateRect: RECT, surface: ?*?*IDXGISurface, offset: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNative.VTable, self.vtable).BeginDraw(@ptrCast(*const ISurfaceImageSourceNative, self), updateRect, surface, offset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurfaceImageSourceNative_EndDraw(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNative.VTable, self.vtable).EndDraw(@ptrCast(*const ISurfaceImageSourceNative, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IVirtualSurfaceUpdatesCallbackNative_Value = @import("../../zig.zig").Guid.initString("dbf2e947-8e6c-4254-9eee-7738f71386c9"); pub const IID_IVirtualSurfaceUpdatesCallbackNative = &IID_IVirtualSurfaceUpdatesCallbackNative_Value; pub const IVirtualSurfaceUpdatesCallbackNative = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, UpdatesNeeded: fn( self: *const IVirtualSurfaceUpdatesCallbackNative, ) 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 IVirtualSurfaceUpdatesCallbackNative_UpdatesNeeded(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IVirtualSurfaceUpdatesCallbackNative.VTable, self.vtable).UpdatesNeeded(@ptrCast(*const IVirtualSurfaceUpdatesCallbackNative, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IVirtualSurfaceImageSourceNative_Value = @import("../../zig.zig").Guid.initString("e9550983-360b-4f53-b391-afd695078691"); pub const IID_IVirtualSurfaceImageSourceNative = &IID_IVirtualSurfaceImageSourceNative_Value; pub const IVirtualSurfaceImageSourceNative = extern struct { pub const VTable = extern struct { base: ISurfaceImageSourceNative.VTable, Invalidate: fn( self: *const IVirtualSurfaceImageSourceNative, updateRect: RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUpdateRectCount: fn( self: *const IVirtualSurfaceImageSourceNative, count: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUpdateRects: fn( self: *const IVirtualSurfaceImageSourceNative, updates: [*]RECT, count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVisibleBounds: fn( self: *const IVirtualSurfaceImageSourceNative, bounds: ?*RECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RegisterForUpdatesNeeded: fn( self: *const IVirtualSurfaceImageSourceNative, callback: ?*IVirtualSurfaceUpdatesCallbackNative, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Resize: fn( self: *const IVirtualSurfaceImageSourceNative, newWidth: i32, newHeight: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISurfaceImageSourceNative.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVirtualSurfaceImageSourceNative_Invalidate(self: *const T, updateRect: RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IVirtualSurfaceImageSourceNative.VTable, self.vtable).Invalidate(@ptrCast(*const IVirtualSurfaceImageSourceNative, self), updateRect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVirtualSurfaceImageSourceNative_GetUpdateRectCount(self: *const T, count: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IVirtualSurfaceImageSourceNative.VTable, self.vtable).GetUpdateRectCount(@ptrCast(*const IVirtualSurfaceImageSourceNative, self), count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVirtualSurfaceImageSourceNative_GetUpdateRects(self: *const T, updates: [*]RECT, count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IVirtualSurfaceImageSourceNative.VTable, self.vtable).GetUpdateRects(@ptrCast(*const IVirtualSurfaceImageSourceNative, self), updates, count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVirtualSurfaceImageSourceNative_GetVisibleBounds(self: *const T, bounds: ?*RECT) callconv(.Inline) HRESULT { return @ptrCast(*const IVirtualSurfaceImageSourceNative.VTable, self.vtable).GetVisibleBounds(@ptrCast(*const IVirtualSurfaceImageSourceNative, self), bounds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVirtualSurfaceImageSourceNative_RegisterForUpdatesNeeded(self: *const T, callback: ?*IVirtualSurfaceUpdatesCallbackNative) callconv(.Inline) HRESULT { return @ptrCast(*const IVirtualSurfaceImageSourceNative.VTable, self.vtable).RegisterForUpdatesNeeded(@ptrCast(*const IVirtualSurfaceImageSourceNative, self), callback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IVirtualSurfaceImageSourceNative_Resize(self: *const T, newWidth: i32, newHeight: i32) callconv(.Inline) HRESULT { return @ptrCast(*const IVirtualSurfaceImageSourceNative.VTable, self.vtable).Resize(@ptrCast(*const IVirtualSurfaceImageSourceNative, self), newWidth, newHeight); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISwapChainBackgroundPanelNative_Value = @import("../../zig.zig").Guid.initString("43bebd4e-add5-4035-8f85-5608d08e9dc9"); pub const IID_ISwapChainBackgroundPanelNative = &IID_ISwapChainBackgroundPanelNative_Value; pub const ISwapChainBackgroundPanelNative = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetSwapChain: fn( self: *const ISwapChainBackgroundPanelNative, swapChain: ?*IDXGISwapChain, ) 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 ISwapChainBackgroundPanelNative_SetSwapChain(self: *const T, swapChain: ?*IDXGISwapChain) callconv(.Inline) HRESULT { return @ptrCast(*const ISwapChainBackgroundPanelNative.VTable, self.vtable).SetSwapChain(@ptrCast(*const ISwapChainBackgroundPanelNative, self), swapChain); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISurfaceImageSourceManagerNative_Value = @import("../../zig.zig").Guid.initString("4c8798b7-1d88-4a0f-b59b-b93f600de8c8"); pub const IID_ISurfaceImageSourceManagerNative = &IID_ISurfaceImageSourceManagerNative_Value; pub const ISurfaceImageSourceManagerNative = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, FlushAllSurfacesWithDevice: fn( self: *const ISurfaceImageSourceManagerNative, device: ?*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 ISurfaceImageSourceManagerNative_FlushAllSurfacesWithDevice(self: *const T, device: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceManagerNative.VTable, self.vtable).FlushAllSurfacesWithDevice(@ptrCast(*const ISurfaceImageSourceManagerNative, self), device); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISurfaceImageSourceNativeWithD2D_Value = @import("../../zig.zig").Guid.initString("54298223-41e1-4a41-9c08-02e8256864a1"); pub const IID_ISurfaceImageSourceNativeWithD2D = &IID_ISurfaceImageSourceNativeWithD2D_Value; pub const ISurfaceImageSourceNativeWithD2D = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetDevice: fn( self: *const ISurfaceImageSourceNativeWithD2D, device: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BeginDraw: fn( self: *const ISurfaceImageSourceNativeWithD2D, updateRect: ?*const RECT, iid: ?*const Guid, updateObject: ?*?*anyopaque, offset: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EndDraw: fn( self: *const ISurfaceImageSourceNativeWithD2D, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SuspendDraw: fn( self: *const ISurfaceImageSourceNativeWithD2D, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ResumeDraw: fn( self: *const ISurfaceImageSourceNativeWithD2D, ) 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 ISurfaceImageSourceNativeWithD2D_SetDevice(self: *const T, device: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNativeWithD2D.VTable, self.vtable).SetDevice(@ptrCast(*const ISurfaceImageSourceNativeWithD2D, self), device); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurfaceImageSourceNativeWithD2D_BeginDraw(self: *const T, updateRect: ?*const RECT, iid: ?*const Guid, updateObject: ?*?*anyopaque, offset: ?*POINT) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNativeWithD2D.VTable, self.vtable).BeginDraw(@ptrCast(*const ISurfaceImageSourceNativeWithD2D, self), updateRect, iid, updateObject, offset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurfaceImageSourceNativeWithD2D_EndDraw(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNativeWithD2D.VTable, self.vtable).EndDraw(@ptrCast(*const ISurfaceImageSourceNativeWithD2D, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurfaceImageSourceNativeWithD2D_SuspendDraw(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNativeWithD2D.VTable, self.vtable).SuspendDraw(@ptrCast(*const ISurfaceImageSourceNativeWithD2D, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISurfaceImageSourceNativeWithD2D_ResumeDraw(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ISurfaceImageSourceNativeWithD2D.VTable, self.vtable).ResumeDraw(@ptrCast(*const ISurfaceImageSourceNativeWithD2D, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISwapChainPanelNative_Value = @import("../../zig.zig").Guid.initString("f92f19d2-3ade-45a6-a20c-f6f1ea90554b"); pub const IID_ISwapChainPanelNative = &IID_ISwapChainPanelNative_Value; pub const ISwapChainPanelNative = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetSwapChain: fn( self: *const ISwapChainPanelNative, swapChain: ?*IDXGISwapChain, ) 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 ISwapChainPanelNative_SetSwapChain(self: *const T, swapChain: ?*IDXGISwapChain) callconv(.Inline) HRESULT { return @ptrCast(*const ISwapChainPanelNative.VTable, self.vtable).SetSwapChain(@ptrCast(*const ISwapChainPanelNative, self), swapChain); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ISwapChainPanelNative2_Value = @import("../../zig.zig").Guid.initString("d5a2f60c-37b2-44a2-937b-8d8eb9726821"); pub const IID_ISwapChainPanelNative2 = &IID_ISwapChainPanelNative2_Value; pub const ISwapChainPanelNative2 = extern struct { pub const VTable = extern struct { base: ISwapChainPanelNative.VTable, SetSwapChainHandle: fn( self: *const ISwapChainPanelNative2, swapChainHandle: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ISwapChainPanelNative.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISwapChainPanelNative2_SetSwapChainHandle(self: *const T, swapChainHandle: ?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const ISwapChainPanelNative2.VTable, self.vtable).SetSwapChainHandle(@ptrCast(*const ISwapChainPanelNative2, self), swapChainHandle); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDesktopWindowXamlSourceNative_Value = @import("../../zig.zig").Guid.initString("3cbcf1bf-2f76-4e9c-96ab-e84b37972554"); pub const IID_IDesktopWindowXamlSourceNative = &IID_IDesktopWindowXamlSourceNative_Value; pub const IDesktopWindowXamlSourceNative = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AttachToWindow: fn( self: *const IDesktopWindowXamlSourceNative, parentWnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) HRESULT, // TODO: this function has a "SpecialName", should Zig do anything with this? get_WindowHandle: fn( self: *const IDesktopWindowXamlSourceNative, hWnd: ?*?HWND, ) 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 IDesktopWindowXamlSourceNative_AttachToWindow(self: *const T, parentWnd: ?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IDesktopWindowXamlSourceNative.VTable, self.vtable).AttachToWindow(@ptrCast(*const IDesktopWindowXamlSourceNative, self), parentWnd); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDesktopWindowXamlSourceNative_get_WindowHandle(self: *const T, hWnd: ?*?HWND) callconv(.Inline) HRESULT { return @ptrCast(*const IDesktopWindowXamlSourceNative.VTable, self.vtable).get_WindowHandle(@ptrCast(*const IDesktopWindowXamlSourceNative, self), hWnd); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDesktopWindowXamlSourceNative2_Value = @import("../../zig.zig").Guid.initString("e3dcd8c7-3057-4692-99c3-7b7720afda31"); pub const IID_IDesktopWindowXamlSourceNative2 = &IID_IDesktopWindowXamlSourceNative2_Value; pub const IDesktopWindowXamlSourceNative2 = extern struct { pub const VTable = extern struct { base: IDesktopWindowXamlSourceNative.VTable, PreTranslateMessage: fn( self: *const IDesktopWindowXamlSourceNative2, message: ?*const MSG, result: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDesktopWindowXamlSourceNative.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDesktopWindowXamlSourceNative2_PreTranslateMessage(self: *const T, message: ?*const MSG, result: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const IDesktopWindowXamlSourceNative2.VTable, self.vtable).PreTranslateMessage(@ptrCast(*const IDesktopWindowXamlSourceNative2, self), message, result); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IReferenceTrackerTarget_Value = @import("../../zig.zig").Guid.initString("64bd43f8-bfee-4ec4-b7eb-2935158dae21"); pub const IID_IReferenceTrackerTarget = &IID_IReferenceTrackerTarget_Value; pub const IReferenceTrackerTarget = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AddRefFromReferenceTracker: fn( self: *const IReferenceTrackerTarget, ) callconv(@import("std").os.windows.WINAPI) u32, ReleaseFromReferenceTracker: fn( self: *const IReferenceTrackerTarget, ) callconv(@import("std").os.windows.WINAPI) u32, Peg: fn( self: *const IReferenceTrackerTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unpeg: fn( self: *const IReferenceTrackerTarget, ) 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 IReferenceTrackerTarget_AddRefFromReferenceTracker(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IReferenceTrackerTarget.VTable, self.vtable).AddRefFromReferenceTracker(@ptrCast(*const IReferenceTrackerTarget, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerTarget_ReleaseFromReferenceTracker(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const IReferenceTrackerTarget.VTable, self.vtable).ReleaseFromReferenceTracker(@ptrCast(*const IReferenceTrackerTarget, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerTarget_Peg(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerTarget.VTable, self.vtable).Peg(@ptrCast(*const IReferenceTrackerTarget, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerTarget_Unpeg(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerTarget.VTable, self.vtable).Unpeg(@ptrCast(*const IReferenceTrackerTarget, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IReferenceTracker_Value = @import("../../zig.zig").Guid.initString("11d3b13a-180e-4789-a8be-7712882893e6"); pub const IID_IReferenceTracker = &IID_IReferenceTracker_Value; pub const IReferenceTracker = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ConnectFromTrackerSource: fn( self: *const IReferenceTracker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DisconnectFromTrackerSource: fn( self: *const IReferenceTracker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindTrackerTargets: fn( self: *const IReferenceTracker, callback: ?*IFindReferenceTargetsCallback, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetReferenceTrackerManager: fn( self: *const IReferenceTracker, value: ?*?*IReferenceTrackerManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddRefFromTrackerSource: fn( self: *const IReferenceTracker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseFromTrackerSource: fn( self: *const IReferenceTracker, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PegFromTrackerSource: fn( self: *const IReferenceTracker, ) 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 IReferenceTracker_ConnectFromTrackerSource(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTracker.VTable, self.vtable).ConnectFromTrackerSource(@ptrCast(*const IReferenceTracker, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTracker_DisconnectFromTrackerSource(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTracker.VTable, self.vtable).DisconnectFromTrackerSource(@ptrCast(*const IReferenceTracker, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTracker_FindTrackerTargets(self: *const T, callback: ?*IFindReferenceTargetsCallback) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTracker.VTable, self.vtable).FindTrackerTargets(@ptrCast(*const IReferenceTracker, self), callback); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTracker_GetReferenceTrackerManager(self: *const T, value: ?*?*IReferenceTrackerManager) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTracker.VTable, self.vtable).GetReferenceTrackerManager(@ptrCast(*const IReferenceTracker, self), value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTracker_AddRefFromTrackerSource(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTracker.VTable, self.vtable).AddRefFromTrackerSource(@ptrCast(*const IReferenceTracker, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTracker_ReleaseFromTrackerSource(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTracker.VTable, self.vtable).ReleaseFromTrackerSource(@ptrCast(*const IReferenceTracker, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTracker_PegFromTrackerSource(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTracker.VTable, self.vtable).PegFromTrackerSource(@ptrCast(*const IReferenceTracker, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IReferenceTrackerManager_Value = @import("../../zig.zig").Guid.initString("3cf184b4-7ccb-4dda-8455-7e6ce99a3298"); pub const IID_IReferenceTrackerManager = &IID_IReferenceTrackerManager_Value; pub const IReferenceTrackerManager = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, ReferenceTrackingStarted: fn( self: *const IReferenceTrackerManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindTrackerTargetsCompleted: fn( self: *const IReferenceTrackerManager, findFailed: u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReferenceTrackingCompleted: fn( self: *const IReferenceTrackerManager, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetReferenceTrackerHost: fn( self: *const IReferenceTrackerManager, value: ?*IReferenceTrackerHost, ) 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 IReferenceTrackerManager_ReferenceTrackingStarted(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerManager.VTable, self.vtable).ReferenceTrackingStarted(@ptrCast(*const IReferenceTrackerManager, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerManager_FindTrackerTargetsCompleted(self: *const T, findFailed: u8) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerManager.VTable, self.vtable).FindTrackerTargetsCompleted(@ptrCast(*const IReferenceTrackerManager, self), findFailed); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerManager_ReferenceTrackingCompleted(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerManager.VTable, self.vtable).ReferenceTrackingCompleted(@ptrCast(*const IReferenceTrackerManager, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerManager_SetReferenceTrackerHost(self: *const T, value: ?*IReferenceTrackerHost) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerManager.VTable, self.vtable).SetReferenceTrackerHost(@ptrCast(*const IReferenceTrackerManager, self), value); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IFindReferenceTargetsCallback_Value = @import("../../zig.zig").Guid.initString("04b3486c-4687-4229-8d14-505ab584dd88"); pub const IID_IFindReferenceTargetsCallback = &IID_IFindReferenceTargetsCallback_Value; pub const IFindReferenceTargetsCallback = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, FoundTrackerTarget: fn( self: *const IFindReferenceTargetsCallback, target: ?*IReferenceTrackerTarget, ) 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 IFindReferenceTargetsCallback_FoundTrackerTarget(self: *const T, target: ?*IReferenceTrackerTarget) callconv(.Inline) HRESULT { return @ptrCast(*const IFindReferenceTargetsCallback.VTable, self.vtable).FoundTrackerTarget(@ptrCast(*const IFindReferenceTargetsCallback, self), target); } };} pub usingnamespace MethodMixin(@This()); }; pub const XAML_REFERENCETRACKER_DISCONNECT = enum(i32) { DEFAULT = 0, SUSPEND = 1, }; pub const XAML_REFERENCETRACKER_DISCONNECT_DEFAULT = XAML_REFERENCETRACKER_DISCONNECT.DEFAULT; pub const XAML_REFERENCETRACKER_DISCONNECT_SUSPEND = XAML_REFERENCETRACKER_DISCONNECT.SUSPEND; const IID_IReferenceTrackerHost_Value = @import("../../zig.zig").Guid.initString("29a71c6a-3c42-4416-a39d-e2825a07a773"); pub const IID_IReferenceTrackerHost = &IID_IReferenceTrackerHost_Value; pub const IReferenceTrackerHost = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, DisconnectUnusedReferenceSources: fn( self: *const IReferenceTrackerHost, options: XAML_REFERENCETRACKER_DISCONNECT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseDisconnectedReferenceSources: fn( self: *const IReferenceTrackerHost, ) callconv(@import("std").os.windows.WINAPI) HRESULT, NotifyEndOfReferenceTrackingOnThread: fn( self: *const IReferenceTrackerHost, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTrackerTarget: fn( self: *const IReferenceTrackerHost, unknown: ?*IUnknown, newReference: ?*?*IReferenceTrackerTarget, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddMemoryPressure: fn( self: *const IReferenceTrackerHost, bytesAllocated: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RemoveMemoryPressure: fn( self: *const IReferenceTrackerHost, bytesAllocated: 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 IReferenceTrackerHost_DisconnectUnusedReferenceSources(self: *const T, options: XAML_REFERENCETRACKER_DISCONNECT) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerHost.VTable, self.vtable).DisconnectUnusedReferenceSources(@ptrCast(*const IReferenceTrackerHost, self), options); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerHost_ReleaseDisconnectedReferenceSources(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerHost.VTable, self.vtable).ReleaseDisconnectedReferenceSources(@ptrCast(*const IReferenceTrackerHost, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerHost_NotifyEndOfReferenceTrackingOnThread(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerHost.VTable, self.vtable).NotifyEndOfReferenceTrackingOnThread(@ptrCast(*const IReferenceTrackerHost, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerHost_GetTrackerTarget(self: *const T, unknown: ?*IUnknown, newReference: ?*?*IReferenceTrackerTarget) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerHost.VTable, self.vtable).GetTrackerTarget(@ptrCast(*const IReferenceTrackerHost, self), unknown, newReference); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerHost_AddMemoryPressure(self: *const T, bytesAllocated: u64) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerHost.VTable, self.vtable).AddMemoryPressure(@ptrCast(*const IReferenceTrackerHost, self), bytesAllocated); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IReferenceTrackerHost_RemoveMemoryPressure(self: *const T, bytesAllocated: u64) callconv(.Inline) HRESULT { return @ptrCast(*const IReferenceTrackerHost.VTable, self.vtable).RemoveMemoryPressure(@ptrCast(*const IReferenceTrackerHost, self), bytesAllocated); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IReferenceTrackerExtension_Value = @import("../../zig.zig").Guid.initString("4e897caa-59d5-4613-8f8c-f7ebd1f399b0"); pub const IID_IReferenceTrackerExtension = &IID_IReferenceTrackerExtension_Value; pub const IReferenceTrackerExtension = 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()); }; pub const TrackerHandle__ = extern struct { unused: i32, }; const IID_ITrackerOwner_Value = @import("../../zig.zig").Guid.initString("eb24c20b-9816-4ac7-8cff-36f67a118f4e"); pub const IID_ITrackerOwner = &IID_ITrackerOwner_Value; pub const ITrackerOwner = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateTrackerHandle: fn( self: *const ITrackerOwner, returnValue: ?*?*TrackerHandle__, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteTrackerHandle: fn( self: *const ITrackerOwner, handle: ?*TrackerHandle__, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTrackerValue: fn( self: *const ITrackerOwner, handle: ?*TrackerHandle__, value: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, TryGetSafeTrackerValue: fn( self: *const ITrackerOwner, handle: ?*TrackerHandle__, returnValue: ?*?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) u8, }; 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 ITrackerOwner_CreateTrackerHandle(self: *const T, returnValue: ?*?*TrackerHandle__) callconv(.Inline) HRESULT { return @ptrCast(*const ITrackerOwner.VTable, self.vtable).CreateTrackerHandle(@ptrCast(*const ITrackerOwner, self), returnValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrackerOwner_DeleteTrackerHandle(self: *const T, handle: ?*TrackerHandle__) callconv(.Inline) HRESULT { return @ptrCast(*const ITrackerOwner.VTable, self.vtable).DeleteTrackerHandle(@ptrCast(*const ITrackerOwner, self), handle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrackerOwner_SetTrackerValue(self: *const T, handle: ?*TrackerHandle__, value: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ITrackerOwner.VTable, self.vtable).SetTrackerValue(@ptrCast(*const ITrackerOwner, self), handle, value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ITrackerOwner_TryGetSafeTrackerValue(self: *const T, handle: ?*TrackerHandle__, returnValue: ?*?*IUnknown) callconv(.Inline) u8 { return @ptrCast(*const ITrackerOwner.VTable, self.vtable).TryGetSafeTrackerValue(@ptrCast(*const ITrackerOwner, self), handle, returnValue); } };} 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 HANDLE = @import("../../foundation.zig").HANDLE; const HRESULT = @import("../../foundation.zig").HRESULT; const HWND = @import("../../foundation.zig").HWND; const IDXGIDevice = @import("../../graphics/dxgi.zig").IDXGIDevice; const IDXGISurface = @import("../../graphics/dxgi.zig").IDXGISurface; const IDXGISwapChain = @import("../../graphics/dxgi.zig").IDXGISwapChain; const IUnknown = @import("../../system/com.zig").IUnknown; const MSG = @import("../../ui/windows_and_messaging.zig").MSG; const POINT = @import("../../foundation.zig").POINT; const RECT = @import("../../foundation.zig").RECT; 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/win_rt/xaml.zig
const std = @import("std"); const TypeInfo = std.builtin.TypeInfo; const warn = std.debug.warn; pub fn CanonicalHuffmanTree(comptime Tlen: type, max_len: usize) type { return struct { const Self = @This(); pub const Tval: type = @Type(TypeInfo{ .Int = .{ .is_signed = false, .bits = @floatToInt(comptime_int, @ceil(@log2(@intToFloat(f64, max_len)))), }, }); const bit_width_count: usize = (1 << @typeInfo(Tlen).Int.bits); pub const Tkey: type = @Type(TypeInfo{ .Int = .{ .is_signed = false, .bits = bit_width_count, }, }); // Number of symbols that are actually in the tree. symbol_count: Tkey, // Map: packed symbol index -> symbol. //symbol_tree: []Tval, // TODO: Understand slices --GM symbol_tree_raw: [max_len]Tval, // backing buffer for symbol_tree // Map: bit width -> value past last possible value for the bit width. symbol_ends: [bit_width_count]Tkey, // Map: bit width -> index into symbol_tree to first entry of the given bit width. symbol_offsets: [bit_width_count]Tkey, pub fn fromLengths(lengths: []const Tlen) Self { const symbol_count = @intCast(Tkey, lengths.len); // Sort the symbols in length order, ignoring 0-length var symbol_tree = [1]Tval{0} ** max_len; var symbol_ends = [1]Tkey{0} ** bit_width_count; var symbol_offsets = [1]Tkey{0} ** bit_width_count; var nonzero_count: Tkey = 0; var end_value: Tkey = 0; { var bit_width: usize = 1; while (bit_width < bit_width_count) : (bit_width += 1) { end_value <<= 1; var start_index = nonzero_count; symbol_offsets[bit_width] = start_index; for (lengths) |bw, i| { if (bw == bit_width) { //warn("{} entry {} = {}\n", bit_width, nonzero_count, i); symbol_tree[nonzero_count] = @intCast(Tval, i); nonzero_count += 1; end_value += 1; } } symbol_ends[bit_width] = end_value; //warn("nzcount {} = {} / {}\n", bit_width, start_index, end_value); } } // Return our tree return Self{ .symbol_count = symbol_count, .symbol_tree_raw = symbol_tree, //.symbol_tree = symbol_tree[0..nonzero_count], .symbol_ends = symbol_ends, .symbol_offsets = symbol_offsets, }; } pub fn readFrom(self: *const Self, stream: var) !Tval { var v: usize = 0; // Calculate the bit width and offset // TODO: Clean this mess up, it's quite unintuitive right now var bit_width: usize = 0; var value_offset: usize = 0; //warn("{} -> {}\n", bit_width, self.symbol_ends[bit_width]); while (v >= self.symbol_ends[bit_width]) { v <<= 1; v |= try stream.readBitsNoEof(u1, 1); value_offset = self.symbol_ends[bit_width] * 2; bit_width += 1; //warn("{}: v={} - {} -> {} (offs={})\n", bit_width, v, value_offset, self.symbol_ends[bit_width], self.symbol_offsets[bit_width]); } // Find the correct index const idx: Tkey = @intCast(Tkey, (v - value_offset) + self.symbol_offsets[bit_width]); //warn("{}\n", idx); // Now read it const result = self.symbol_tree_raw[idx]; return result; } }; }
src/huffman.zig
const std = @import("std"); usingnamespace @import("common.zig"); usingnamespace @import("compiler.zig"); usingnamespace @import("lexer.zig"); usingnamespace @import("parser.zig"); usingnamespace @import("ast.zig"); usingnamespace @import("type_checker.zig"); usingnamespace @import("error_handler.zig"); usingnamespace @import("code_formatter.zig"); usingnamespace @import("code_runner.zig"); usingnamespace @import("dot_printer.zig"); usingnamespace @import("job.zig"); pub const Coroutine = @import("stackfull_coroutine.zig").StackfullCoroutine(FiberContext); pub const FiberWaitCondition = struct { const Self = @This(); evalFn: fn (self: *Self) bool, reportErrorFn: fn (self: *Self, compiler: *Compiler) void, pub fn eval(self: *Self) bool { return self.evalFn(self); } pub fn reportError(self: *Self, compiler: *Compiler) void { self.reportErrorFn(self, compiler); } }; pub const FiberContext = struct { madeProgress: bool = false, wasCancelled: bool = false, done: bool = false, state: enum { Running, Suspended } = .Suspended, coro: Coroutine, compiler: *Compiler, job: ?*Job, codeRunner: CodeRunner, const Self = @This(); pub fn init(compiler: *Compiler) !*Self { var context = try compiler.allocator.create(Self); const coro = try Coroutine.init( Self.run, context, compiler.allocator, ); context.* = Self{ .compiler = compiler, .coro = coro, .job = null, .codeRunner = try CodeRunner.init(compiler), }; return context; } pub fn deinit(self: *Self) void { self.coro.deinit(); self.codeRunner.deinit(); self.compiler.allocator.destroy(self); } pub fn run() void { var self = Coroutine.current().getUserData() orelse unreachable; while (true) { if (self.job) |job| { std.log.debug("[{}, {any}] Running next job.", .{ self.madeProgress, self.state }); self.done = false; job.run() catch |err| { self.compiler.reportError(null, "Job failed with error: {any}", .{err}); }; self.madeProgress = true; self.done = true; std.log.debug("[{}, {any}] done", .{ self.madeProgress, self.state }); } Coroutine.yield() catch unreachable; if (self.wasCancelled) break; } std.log.debug("[{}, {any}] Cancelled", .{ self.madeProgress, self.state }); } pub fn step(self: *Self) !void { _ = try self.coro.call(); } pub fn waitUntil(self: *Self, condition: *FiberWaitCondition) !void { if (condition.eval()) return; var ctx = Coroutine.current().getUserData() orelse unreachable; ctx.state = .Suspended; defer ctx.state = .Running; ctx.madeProgress = true; while (true) { std.log.debug("[Job] Suspending job because condition is not met.", .{}); Coroutine.yield() catch unreachable; if (ctx.wasCancelled) { std.log.debug("[Job] Job was cancelled, reporting error.", .{}); condition.reportError(ctx.job.?.compiler.?); return error.WaitFailed; } else if (condition.eval()) { std.log.debug("[Job] Resuming job.", .{}); ctx.madeProgress = true; return; } else { std.log.debug("[Job] Condition still not met, no progress made.", .{}); ctx.madeProgress = false; } } } }; pub const Job = struct { const Self = @This(); runFn: fn (self: *Self) anyerror!void, freeFn: fn (self: *Self, allocator: *std.mem.Allocator) void, compiler: ?*Compiler = null, pub fn run(self: *Self) anyerror!void { try self.runFn(self); } pub fn free(self: *Self, allocator: *std.mem.Allocator) void { return self.freeFn(self, allocator); } }; pub const CompileAstJob = struct { job: Job = Job{ .runFn = run, .freeFn = free, }, ast: *Ast, const Self = @This(); pub fn init(ast: *Ast) Self { return Self{ .ast = ast, }; } pub fn free(job: *Job, allocator: *std.mem.Allocator) void { const self = @fieldParentPtr(Self, "job", job); allocator.destroy(self); } pub fn run(job: *Job) anyerror!void { const self = @fieldParentPtr(Self, "job", job); var ctx = Coroutine.current().getUserData() orelse unreachable; var compiler = job.compiler orelse unreachable; const ast = self.ast; const astSpec = @as(std.meta.TagType(AstSpec), ast.spec); std.log.debug("[CompileAstJob {} @ {}] Start", .{ astSpec, ast.location }); var typeChecker = try TypeChecker.init(compiler, &ctx.codeRunner); defer typeChecker.deinit(); try typeChecker.compileAst(self.ast, .{}); if (self.ast.typ.is(.Error) or self.ast.typ.is(.Unknown)) { const location = &self.ast.location; std.log.debug("[CompileAstJob {} @ {}] Failed to compile top level expr.", .{ astSpec, ast.location }); } else { std.log.debug("[CompileAstJob {} @ {}] Run ast.", .{ astSpec, ast.location }); try ctx.codeRunner.runAst(self.ast); } std.log.debug("[CompileAstJob {} @ {}] Done.", .{ astSpec, ast.location }); } }; pub const LoadFileJob = struct { job: Job = Job{ .runFn = run, .freeFn = free, }, fileName: String, const Self = @This(); pub fn init(msg: String) Self { return Self{ .msg = msg, }; } pub fn free(job: *Job, allocator: *std.mem.Allocator) void { const self = @fieldParentPtr(Self, "job", job); allocator.destroy(self); } pub fn run(job: *Job) anyerror!void { const self = @fieldParentPtr(Self, "job", job); var ctx = Coroutine.current().getUserData() orelse unreachable; var compiler: *Compiler = job.compiler orelse unreachable; std.log.debug("[LoadFileJob '{s}'] Load file.", .{self.fileName}); const fileContent = try std.fs.cwd().readFileAlloc(compiler.allocator, self.fileName, std.math.maxInt(usize)); const fullPath = try std.fs.cwd().realpathAlloc(compiler.allocator, self.fileName); var sourceFile = try compiler.allocateSourceFile( StringBuf.fromOwnedSlice(compiler.allocator, fullPath), StringBuf.fromOwnedSlice(compiler.allocator, fileContent), ); var lexer = try Lexer.init(sourceFile.path.items, sourceFile.content.items); var parser = Parser.init(lexer, &compiler.astAllocator.allocator, compiler.errorReporter); defer parser.deinit(); while (try parser.parseTopLevelExpression()) |ast| { _ = try compiler.allocateAndAddJob(CompileAstJob.init(ast)); try sourceFile.asts.append(ast); } std.log.debug("[LoadFileJob '{s}'] Done.", .{self.fileName}); } };
src/job.zig
const os = @import("root").os; const paging = os.memory.paging; const platform = os.platform; const libalign = os.lib.libalign; const std = @import("std"); pub const MemmapEntry = packed struct { base: u64, length: u64, type: u32, unused: u32, pub fn format(self: *const MemmapEntry, fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { try writer.print("Base: 0x{X}, length: 0x{X}, type=0x{X}", .{self.base, self.length, self.type}); } }; pub fn consume_physmem(ent: *const MemmapEntry) void { if(ent.type != 1) return; os.log("Stivale: Consuming 0x{X} to 0x{X}\n", .{ent.base, ent.base + ent.length}); os.memory.pmm.consume(ent.base, ent.length); } pub fn map_phys(ent: *const MemmapEntry, context: *platform.paging.PagingContext) void { if(ent.type != 1 and ent.type != 0x1000) return; var new_ent = ent.*; new_ent.base = libalign.align_down(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.align_up(u64, platform.paging.page_sizes[0], new_ent.length); if(new_ent.length == 0) return; os.log("Stivale: Mapping phys mem 0x{X} to 0x{X}\n", .{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"); } pub fn phys_high(map: []const MemmapEntry) usize { if(map.len == 0) @panic("No memmap!"); const ent = map[map.len - 1]; return ent.base + ent.length; } pub fn detect_phys_base() void { const base: usize = switch(std.builtin.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; }
src/boot/stivale_common.zig
const std = @import("std"); const path = std.fs.path; const assert = std.debug.assert; const target_util = @import("target.zig"); const Compilation = @import("Compilation.zig"); const build_options = @import("build_options"); const trace = @import("tracy.zig").trace; const libcxxabi_files = [_][]const u8{ "src/abort_message.cpp", "src/cxa_aux_runtime.cpp", "src/cxa_default_handlers.cpp", "src/cxa_demangle.cpp", "src/cxa_exception.cpp", "src/cxa_exception_storage.cpp", "src/cxa_guard.cpp", "src/cxa_handlers.cpp", "src/cxa_noexception.cpp", "src/cxa_personality.cpp", "src/cxa_thread_atexit.cpp", "src/cxa_vector.cpp", "src/cxa_virtual.cpp", "src/fallback_malloc.cpp", "src/private_typeinfo.cpp", "src/stdlib_exception.cpp", "src/stdlib_new_delete.cpp", "src/stdlib_stdexcept.cpp", "src/stdlib_typeinfo.cpp", }; const libcxx_files = [_][]const u8{ "src/algorithm.cpp", "src/any.cpp", "src/atomic.cpp", "src/barrier.cpp", "src/bind.cpp", "src/charconv.cpp", "src/chrono.cpp", "src/condition_variable.cpp", "src/condition_variable_destructor.cpp", "src/debug.cpp", "src/exception.cpp", "src/experimental/memory_resource.cpp", "src/filesystem/directory_iterator.cpp", "src/filesystem/int128_builtins.cpp", "src/filesystem/operations.cpp", "src/format.cpp", "src/functional.cpp", "src/future.cpp", "src/hash.cpp", "src/ios.cpp", "src/ios.instantiations.cpp", "src/iostream.cpp", "src/locale.cpp", "src/memory.cpp", "src/mutex.cpp", "src/mutex_destructor.cpp", "src/new.cpp", "src/optional.cpp", "src/random.cpp", "src/random_shuffle.cpp", "src/regex.cpp", "src/shared_mutex.cpp", "src/stdexcept.cpp", "src/string.cpp", "src/strstream.cpp", "src/support/ibm/xlocale_zos.cpp", "src/support/solaris/xlocale.cpp", "src/support/win32/locale_win32.cpp", "src/support/win32/support.cpp", "src/support/win32/thread_win32.cpp", "src/system_error.cpp", "src/thread.cpp", "src/typeinfo.cpp", "src/utility.cpp", "src/valarray.cpp", "src/variant.cpp", "src/vector.cpp", }; pub fn buildLibCXX(comp: *Compilation) !void { if (!build_options.have_llvm) { return error.ZigCompilerNotBuiltWithLLVMExtensions; } const tracy = trace(@src()); defer tracy.end(); var arena_allocator = std.heap.ArenaAllocator.init(comp.gpa); defer arena_allocator.deinit(); const arena = &arena_allocator.allocator; const root_name = "c++"; const output_mode = .Lib; const link_mode = .Static; const target = comp.getTarget(); const basename = try std.zig.binNameAlloc(arena, .{ .root_name = root_name, .target = target, .output_mode = output_mode, .link_mode = link_mode, }); const emit_bin = Compilation.EmitLoc{ .directory = null, // Put it in the cache directory. .basename = basename, }; const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); for (libcxx_files) |cxx_src| { var cflags = std.ArrayList([]const u8).init(arena); if (target.os.tag == .windows or target.os.tag == .wasi) { // Filesystem stuff isn't supported on WASI and Windows. if (std.mem.startsWith(u8, cxx_src, "src/filesystem/")) continue; } if (std.mem.startsWith(u8, cxx_src, "src/support/win32/") and target.os.tag != .windows) continue; if (std.mem.startsWith(u8, cxx_src, "src/support/solaris/") and target.os.tag != .solaris) continue; if (std.mem.startsWith(u8, cxx_src, "src/support/ibm/") and target.os.tag != .zos) continue; try cflags.append("-DNDEBUG"); try cflags.append("-D_LIBCPP_BUILDING_LIBRARY"); try cflags.append("-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER"); try cflags.append("-DLIBCXX_BUILDING_LIBCXXABI"); try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); try cflags.append("-D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS"); try cflags.append("-D_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS"); try cflags.append("-fvisibility=hidden"); try cflags.append("-fvisibility-inlines-hidden"); if (target.abi.isMusl()) { try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC"); } if (target.os.tag == .wasi) { // WASI doesn't support thread and exception yet. try cflags.append("-D_LIBCPP_HAS_NO_THREADS"); try cflags.append("-fno-exceptions"); } if (target.os.tag == .zos) { try cflags.append("-fno-aligned-allocation"); } else { try cflags.append("-faligned-allocation"); } try cflags.append("-I"); try cflags.append(cxx_include_path); try cflags.append("-I"); try cflags.append(cxxabi_include_path); if (target_util.supports_fpic(target)) { try cflags.append("-fPIC"); } try cflags.append("-nostdinc++"); try cflags.append("-std=c++20"); try cflags.append("-Wno-user-defined-literals"); c_source_files.appendAssumeCapacity(.{ .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", cxx_src }), .extra_flags = cflags.items, }); } const sub_compilation = try Compilation.create(comp.gpa, .{ .local_cache_directory = comp.global_cache_directory, .global_cache_directory = comp.global_cache_directory, .zig_lib_directory = comp.zig_lib_directory, .target = target, .root_name = root_name, .main_pkg = null, .output_mode = output_mode, .thread_pool = comp.thread_pool, .libc_installation = comp.bin_file.options.libc_installation, .emit_bin = emit_bin, .optimize_mode = comp.compilerRtOptMode(), .link_mode = link_mode, .want_sanitize_c = false, .want_stack_check = false, .want_red_zone = comp.bin_file.options.red_zone, .omit_frame_pointer = comp.bin_file.options.omit_frame_pointer, .want_valgrind = false, .want_tsan = comp.bin_file.options.tsan, .want_pic = comp.bin_file.options.pic, .want_pie = comp.bin_file.options.pie, .want_lto = comp.bin_file.options.lto, .function_sections = comp.bin_file.options.function_sections, .emit_h = null, .strip = comp.compilerRtStrip(), .is_native_os = comp.bin_file.options.is_native_os, .is_native_abi = comp.bin_file.options.is_native_abi, .self_exe_path = comp.self_exe_path, .c_source_files = c_source_files.items, .verbose_cc = comp.verbose_cc, .verbose_link = comp.bin_file.options.verbose_link, .verbose_air = comp.verbose_air, .verbose_llvm_ir = comp.verbose_llvm_ir, .verbose_cimport = comp.verbose_cimport, .verbose_llvm_cpu_features = comp.verbose_llvm_cpu_features, .clang_passthrough_mode = comp.clang_passthrough_mode, .link_libc = true, .skip_linker_dependencies = true, }); defer sub_compilation.destroy(); try sub_compilation.updateSubCompilation(); assert(comp.libcxx_static_lib == null); comp.libcxx_static_lib = Compilation.CRTFile{ .full_object_path = try sub_compilation.bin_file.options.emit.?.directory.join( comp.gpa, &[_][]const u8{basename}, ), .lock = sub_compilation.bin_file.toOwnedLock(), }; } pub fn buildLibCXXABI(comp: *Compilation) !void { if (!build_options.have_llvm) { return error.ZigCompilerNotBuiltWithLLVMExtensions; } const tracy = trace(@src()); defer tracy.end(); var arena_allocator = std.heap.ArenaAllocator.init(comp.gpa); defer arena_allocator.deinit(); const arena = &arena_allocator.allocator; const root_name = "c++abi"; const output_mode = .Lib; const link_mode = .Static; const target = comp.getTarget(); const basename = try std.zig.binNameAlloc(arena, .{ .root_name = root_name, .target = target, .output_mode = output_mode, .link_mode = link_mode, }); const emit_bin = Compilation.EmitLoc{ .directory = null, // Put it in the cache directory. .basename = basename, }; const cxxabi_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", "include" }); const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); for (libcxxabi_files) |cxxabi_src| { var cflags = std.ArrayList([]const u8).init(arena); if (target.os.tag == .wasi) { // WASI doesn't support thread and exception yet. if (std.mem.startsWith(u8, cxxabi_src, "src/cxa_thread_atexit.cpp") or std.mem.startsWith(u8, cxxabi_src, "src/cxa_exception.cpp") or std.mem.startsWith(u8, cxxabi_src, "src/cxa_personality.cpp")) continue; try cflags.append("-D_LIBCXXABI_HAS_NO_THREADS"); try cflags.append("-fno-exceptions"); } else { try cflags.append("-DHAVE___CXA_THREAD_ATEXIT_IMPL"); } try cflags.append("-D_LIBCPP_DISABLE_EXTERN_TEMPLATE"); try cflags.append("-D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS"); try cflags.append("-D_LIBCXXABI_BUILDING_LIBRARY"); try cflags.append("-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS"); try cflags.append("-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS"); try cflags.append("-fvisibility=hidden"); try cflags.append("-fvisibility-inlines-hidden"); if (target.abi.isMusl()) { try cflags.append("-D_LIBCPP_HAS_MUSL_LIBC"); } try cflags.append("-I"); try cflags.append(cxxabi_include_path); try cflags.append("-I"); try cflags.append(cxx_include_path); if (target_util.supports_fpic(target)) { try cflags.append("-fPIC"); } try cflags.append("-nostdinc++"); try cflags.append("-fstrict-aliasing"); try cflags.append("-funwind-tables"); try cflags.append("-std=c++11"); c_source_files.appendAssumeCapacity(.{ .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxxabi", cxxabi_src }), .extra_flags = cflags.items, }); } const sub_compilation = try Compilation.create(comp.gpa, .{ .local_cache_directory = comp.global_cache_directory, .global_cache_directory = comp.global_cache_directory, .zig_lib_directory = comp.zig_lib_directory, .target = target, .root_name = root_name, .main_pkg = null, .output_mode = output_mode, .thread_pool = comp.thread_pool, .libc_installation = comp.bin_file.options.libc_installation, .emit_bin = emit_bin, .optimize_mode = comp.compilerRtOptMode(), .link_mode = link_mode, .want_sanitize_c = false, .want_stack_check = false, .want_red_zone = comp.bin_file.options.red_zone, .omit_frame_pointer = comp.bin_file.options.omit_frame_pointer, .want_valgrind = false, .want_tsan = comp.bin_file.options.tsan, .want_pic = comp.bin_file.options.pic, .want_pie = comp.bin_file.options.pie, .want_lto = comp.bin_file.options.lto, .function_sections = comp.bin_file.options.function_sections, .emit_h = null, .strip = comp.compilerRtStrip(), .is_native_os = comp.bin_file.options.is_native_os, .is_native_abi = comp.bin_file.options.is_native_abi, .self_exe_path = comp.self_exe_path, .c_source_files = c_source_files.items, .verbose_cc = comp.verbose_cc, .verbose_link = comp.bin_file.options.verbose_link, .verbose_air = comp.verbose_air, .verbose_llvm_ir = comp.verbose_llvm_ir, .verbose_cimport = comp.verbose_cimport, .verbose_llvm_cpu_features = comp.verbose_llvm_cpu_features, .clang_passthrough_mode = comp.clang_passthrough_mode, .link_libc = true, .skip_linker_dependencies = true, }); defer sub_compilation.destroy(); try sub_compilation.updateSubCompilation(); assert(comp.libcxxabi_static_lib == null); comp.libcxxabi_static_lib = Compilation.CRTFile{ .full_object_path = try sub_compilation.bin_file.options.emit.?.directory.join( comp.gpa, &[_][]const u8{basename}, ), .lock = sub_compilation.bin_file.toOwnedLock(), }; }
src/libcxx.zig
const std = @import("std"); const builtin = @import("builtin"); const mem = std.mem; const expectEqual = std.testing.expectEqual; const Vector = std.meta.Vector; const minInt = std.math.minInt; const maxInt = std.math.maxInt; const Op = enum { add, sub, mul, shl }; fn testSaturatingOp(comptime op: Op, comptime T: type, test_data: [3]T) !void { const a = test_data[0]; const b = test_data[1]; const expected = test_data[2]; { const actual = switch (op) { .add => a +| b, .sub => a -| b, .mul => a *| b, .shl => a <<| b, }; try expectEqual(expected, actual); } { var actual = a; switch (op) { .add => actual +|= b, .sub => actual -|= b, .mul => actual *|= b, .shl => actual <<|= b, } try expectEqual(expected, actual); } } test "saturating add" { const S = struct { fn doTheTest() !void { // .{a, b, expected a+b} try testSaturatingOp(.add, i8, .{ -3, 10, 7 }); try testSaturatingOp(.add, i8, .{ -128, -128, -128 }); try testSaturatingOp(.add, i2, .{ 1, 1, 1 }); try testSaturatingOp(.add, i64, .{ maxInt(i64), 1, maxInt(i64) }); try testSaturatingOp(.add, i128, .{ maxInt(i128), -maxInt(i128), 0 }); try testSaturatingOp(.add, i128, .{ minInt(i128), maxInt(i128), -1 }); try testSaturatingOp(.add, i8, .{ 127, 127, 127 }); try testSaturatingOp(.add, u8, .{ 3, 10, 13 }); try testSaturatingOp(.add, u8, .{ 255, 255, 255 }); try testSaturatingOp(.add, u2, .{ 3, 2, 3 }); try testSaturatingOp(.add, u3, .{ 7, 1, 7 }); try testSaturatingOp(.add, u128, .{ maxInt(u128), 1, maxInt(u128) }); const u8x3 = std.meta.Vector(3, u8); try expectEqual(u8x3{ 255, 255, 255 }, (u8x3{ 255, 254, 1 } +| u8x3{ 1, 2, 255 })); const i8x3 = std.meta.Vector(3, i8); try expectEqual(i8x3{ 127, 127, 127 }, (i8x3{ 127, 126, 1 } +| i8x3{ 1, 2, 127 })); } }; try S.doTheTest(); comptime try S.doTheTest(); } test "saturating subtraction" { const S = struct { fn doTheTest() !void { // .{a, b, expected a-b} try testSaturatingOp(.sub, i8, .{ -3, 10, -13 }); try testSaturatingOp(.sub, i8, .{ -128, -128, 0 }); try testSaturatingOp(.sub, i8, .{ -1, 127, -128 }); try testSaturatingOp(.sub, i64, .{ minInt(i64), 1, minInt(i64) }); try testSaturatingOp(.sub, i128, .{ maxInt(i128), -1, maxInt(i128) }); try testSaturatingOp(.sub, i128, .{ minInt(i128), -maxInt(i128), -1 }); try testSaturatingOp(.sub, u8, .{ 10, 3, 7 }); try testSaturatingOp(.sub, u8, .{ 0, 255, 0 }); try testSaturatingOp(.sub, u5, .{ 0, 31, 0 }); try testSaturatingOp(.sub, u128, .{ 0, maxInt(u128), 0 }); const u8x3 = std.meta.Vector(3, u8); try expectEqual(u8x3{ 0, 0, 0 }, (u8x3{ 0, 0, 0 } -| u8x3{ 255, 255, 255 })); } }; try S.doTheTest(); comptime try S.doTheTest(); } test "saturating multiplication" { // TODO: once #9660 has been solved, remove this line if (std.builtin.target.cpu.arch == .wasm32) return error.SkipZigTest; const S = struct { fn doTheTest() !void { // .{a, b, expected a*b} try testSaturatingOp(.mul, i8, .{ -3, 10, -30 }); try testSaturatingOp(.mul, i4, .{ 2, 4, 7 }); try testSaturatingOp(.mul, i8, .{ 2, 127, 127 }); // TODO: uncomment these after #9643 has been solved - this should happen at 0.9.0/llvm-13 release // try testSaturatingOp(.mul, i8, .{ -128, -128, 127 }); // try testSaturatingOp(.mul, i8, .{ maxInt(i8), maxInt(i8), maxInt(i8) }); try testSaturatingOp(.mul, i16, .{ maxInt(i16), -1, minInt(i16) + 1 }); try testSaturatingOp(.mul, i128, .{ maxInt(i128), -1, minInt(i128) + 1 }); try testSaturatingOp(.mul, i128, .{ minInt(i128), -1, maxInt(i128) }); try testSaturatingOp(.mul, u8, .{ 10, 3, 30 }); try testSaturatingOp(.mul, u8, .{ 2, 255, 255 }); try testSaturatingOp(.mul, u128, .{ maxInt(u128), maxInt(u128), maxInt(u128) }); const u8x3 = std.meta.Vector(3, u8); try expectEqual(u8x3{ 255, 255, 255 }, (u8x3{ 2, 2, 2 } *| u8x3{ 255, 255, 255 })); } }; try S.doTheTest(); comptime try S.doTheTest(); } test "saturating shift-left" { const S = struct { fn doTheTest() !void { // .{a, b, expected a<<b} try testSaturatingOp(.shl, i8, .{ 1, 2, 4 }); try testSaturatingOp(.shl, i8, .{ 127, 1, 127 }); try testSaturatingOp(.shl, i8, .{ -128, 1, -128 }); // TODO: remove this check once #9668 is completed if (std.builtin.target.cpu.arch != .wasm32) { // skip testing ints > 64 bits on wasm due to miscompilation / wasmtime ci error try testSaturatingOp(.shl, i128, .{ maxInt(i128), 64, maxInt(i128) }); try testSaturatingOp(.shl, u128, .{ maxInt(u128), 64, maxInt(u128) }); } try testSaturatingOp(.shl, u8, .{ 1, 2, 4 }); try testSaturatingOp(.shl, u8, .{ 255, 1, 255 }); const u8x3 = std.meta.Vector(3, u8); try expectEqual(u8x3{ 255, 255, 255 }, (u8x3{ 255, 255, 255 } <<| u8x3{ 1, 1, 1 })); } }; try S.doTheTest(); comptime try S.doTheTest(); }
test/behavior/saturating_arithmetic.zig
const math = @import("std").math; const gmath = @import("gmath.zig").gmath(f64); const Jazbz = @import("jabz.zig").Jazbz(f64); const AzBz = Jazbz.AzBz; const colors = @import("colors.zig").Colors(Jazbz); const GridSize = @import("gridsize.zig").GridSize; const V2 = @import("affine.zig").V2; const v2 = @import("affine.zig").V2.init; const mix = gmath.mix; const coMix = gmath.coMix; pub fn CheckedBackground(comptime count: usize) type { const fore = colors.steelBlue; const dark = mix(fore, colors.black, 0.3); const light = mix(fore, colors.white, 0.3); const tileCount: f64 = @intToFloat(f64, count); const tiles = v2(tileCount, tileCount); const u = tiles.inverse(); const uh = u.scale(0.5); const smooth = 0.001; return struct { pub fn content(baseJab: Jazbz, x: f64, y: f64) Jazbz { const p = v2(x, y); var c0 = light; var c1 = dark; const i = p.mul(tiles).floor(); const xi = @floatToInt(isize, i.x) + @as(isize, if (i.x < 0) 1 else 0); const yi = @floatToInt(isize, i.y) + @as(isize, if (i.y < 0) 1 else 0); if (xi & 1 == yi & 1) { c0 = dark; c1 = light; } const d = p.sub(p.quantize(u)); const sy = gmath.smoothstepC3(-smooth, smooth, if (d.y > uh.y) u.y - d.y else d.y); const sx = gmath.smoothstepC3(-smooth, smooth, if (d.x > uh.x) u.x - d.x else d.x); return mix(c0, c1, sx + sy - 2 * sx * sy); } }; } pub const OverlayGrid = struct { const Self = @This(); tiles: V2 = .{ .x = 12, .y = 12 }, origin: V2 = .{ .x = 0, .y = 0 }, stroke: f64 = 0.006, outline: Jazbz = Jazbz.grey(0.5), highlight: Jazbz = Jazbz{ .j = 0.8, .azbz = AzBz.green }, pub fn compile(comptime self: *const Self) type { const d = self.tiles.inverse(); const halfStroke = self.stroke * 0.5; const pp = self.highlight; const np = Jazbz{ .j = self.highlight.j, .azbz = self.highlight.azbz.rotate90() }; const pn = Jazbz{ .j = self.highlight.j, .azbz = self.highlight.azbz.rotate270() }; const nn = Jazbz{ .j = self.highlight.j, .azbz = self.highlight.azbz.rotate180() }; return struct { pub fn content(baseJab: Jazbz, x: f64, y: f64) Jazbz { const p = v2(x, y).sub(self.origin); const q = p.quantize(d); const edgeDist = math.min(math.min(math.fabs(p.x - q.x), math.fabs(p.y - q.y)), math.min(math.fabs(q.x + d.x - p.x), math.fabs(q.y + d.y - p.y))); var jab = baseJab; jab = mix(self.outline, jab, gmath.smoothstepC2(0, self.stroke, edgeDist)); const highight = if (p.x < 0) if (p.y < 0) nn else np else if (p.y < 0) pn else pp; jab = mix(highight, jab, gmath.smoothstepC2(0, halfStroke, edgeDist)); return jab; } }; } };
lib/debug_shaders.zig
const std = @import("std"); const zp = @import("zplay.zig"); const GraphicsContext = zp.graphics.common.Context; const event = zp.event; const sdl = zp.deps.sdl; /// application context pub const Context = struct { /// internal window window: sdl.Window, /// graphics context graphics: GraphicsContext = undefined, /// quit switch quit: bool = false, /// resizable mode resizable: bool = undefined, /// fullscreen mode fullscreen: bool = undefined, /// relative mouse mode relative_mouse: bool = undefined, /// number of seconds since launch/last-frame tick: f32 = undefined, delta_tick: f32 = undefined, /// kill app pub fn kill(self: *Context) void { self.quit = true; } /// poll event pub fn pollEvent(self: *Context) ?event.Event { _ = self; while (sdl.pollEvent()) |e| { if (event.Event.init(e)) |ze| { return ze; } } return null; } /// toggle resizable pub fn toggleResizable(self: *Context, on_off: ?bool) void { if (on_off) |state| { self.resizable = state; } else { self.resizable = !self.resizable; } _ = sdl.c.SDL_SetWindowResizable( self.window.ptr, if (self.resizable) sdl.c.SDL_TRUE else sdl.c.SDL_FALSE, ); } /// toggle fullscreen pub fn toggleFullscreeen(self: *Context, on_off: ?bool) void { if (on_off) |state| { self.fullscreen = state; } else { self.fullscreen = !self.fullscreen; } _ = sdl.c.SDL_SetWindowFullscreen( self.window.ptr, if (self.fullscreen) sdl.c.SDL_WINDOW_FULLSCREEN_DESKTOP else 0, ); } /// toggle relative mouse mode pub fn toggleRelativeMouseMode(self: *Context, on_off: ?bool) void { if (on_off) |state| { self.relative_mouse = state; } else { self.relative_mouse = !self.relative_mouse; } _ = sdl.c.SDL_SetRelativeMouseMode( if (self.relative_mouse) sdl.c.SDL_TRUE else sdl.c.SDL_FALSE, ); } /// get position of window pub fn getPosition(self: Context, x: *u32, y: *u32) void { sdl.c.SDL_GetWindowPosition( self.window.ptr, @ptrCast(*c_int, x), @ptrCast(*c_int, y), ); } /// get size of window pub fn getWindowSize(self: Context, w: *u32, h: *u32) void { sdl.c.SDL_GetWindowSize( self.window.ptr, @ptrCast(*c_int, w), @ptrCast(*c_int, h), ); } /// get key status pub fn isKeyPressed(self: Context, key: sdl.Scancode) bool { _ = self; const state = sdl.c.SDL_GetKeyboardState(null); return state[@enumToInt(key)] == 1; } /// get mouse state pub fn getMouseState(self: Context) sdl.MouseState { _ = self; return sdl.getMouseState(); } /// move mouse to given position (relative to window) pub fn setMousePosition(self: Context, xrel: f32, yrel: f32) void { var w: i32 = undefined; var h: i32 = undefined; sdl.c.SDL_GetWindowSize(self.window.ptr, &w, &h); sdl.c.SDL_WarpMouseInWindow( self.window.ptr, @floatToInt(i32, @intToFloat(f32, w) * xrel), @floatToInt(i32, @intToFloat(f32, h) * yrel), ); } }; /// application configurations pub const Game = struct { /// called once before rendering loop starts initFn: fn (ctx: *Context) anyerror!void, /// called every frame loopFn: fn (ctx: *Context) void, /// called before life ends quitFn: fn (ctx: *Context) void, /// window's title title: [:0]const u8 = "zplay", /// position of window pos_x: sdl.WindowPosition = .default, pos_y: sdl.WindowPosition = .default, /// width/height of window width: u32 = 800, height: u32 = 600, // resizable switch enable_resizable: bool = false, /// display switch enable_fullscreen: bool = false, /// borderless window enable_borderless: bool = false, /// minimize window enable_minimized: bool = false, /// maximize window enable_maximized: bool = false, /// relative mouse mode switch enable_relative_mouse_mode: bool = false, /// graphics api graphics_api: GraphicsContext.Api = .opengl, // vsync switch enable_vsync: bool = true, /// enable MSAA enable_msaa: bool = false, /// enable high resolution depth buffer enable_highres_depth: bool = false, }; /// entrance point, never return until application is killed pub fn run(g: Game) !void { try sdl.init(sdl.InitFlags.everything); defer sdl.quit(); // prepare graphics params try GraphicsContext.prepare(g); // create window var flags = sdl.WindowFlags{ .allow_high_dpi = true, .mouse_capture = true, .mouse_focus = true, }; if (g.enable_borderless) { flags.borderless = true; } if (g.enable_minimized) { flags.minimized = true; } if (g.enable_maximized) { flags.maximized = true; } if (g.graphics_api == .opengl) { flags.opengl = true; } var context: Context = .{ .window = try sdl.createWindow( g.title, g.pos_x, g.pos_y, g.width, g.height, flags, ), }; defer context.window.destroy(); // allocate graphics context context.graphics = try GraphicsContext.init( context.window, g.graphics_api, ); defer context.graphics.deinit(); context.graphics.setVsyncMode(g.enable_vsync); // apply window options, still changable through Context's methods context.toggleResizable(g.enable_resizable); context.toggleFullscreeen(g.enable_fullscreen); context.toggleRelativeMouseMode(g.enable_relative_mouse_mode); // init before loop try g.initFn(&context); defer g.quitFn(&context); // init time clock const counter_freq = @intToFloat(f32, sdl.c.SDL_GetPerformanceFrequency()); var last_counter = sdl.c.SDL_GetPerformanceCounter(); context.tick = 0; // game loop while (!context.quit) { // update tick const counter = sdl.c.SDL_GetPerformanceCounter(); context.delta_tick = @intToFloat(f32, counter - last_counter) / counter_freq; context.tick += context.delta_tick; last_counter = counter; // main loop g.loopFn(&context); // swap buffers context.graphics.swap(context.window); } }
src/core.zig
const std = @import("std"); const gemtext = @import("../gemtext.zig"); const Fragment = gemtext.Fragment; /// Renders a sequence of fragments into a gemini text document. /// `fragments` is a slice of fragments which describe the document, /// `writer` is a `std.io.Writer` structure that will be the target of the document rendering. /// The document will be rendered with CR LF line endings. pub fn render(fragments: []const Fragment, writer: anytype) !void { const line_ending = "\r\n"; for (fragments) |fragment| { switch (fragment) { .empty => try writer.writeAll(line_ending), .paragraph => |paragraph| try writer.print("{s}" ++ line_ending, .{paragraph}), .preformatted => |preformatted| { if (preformatted.alt_text) |alt_text| { try writer.print("```{s}" ++ line_ending, .{alt_text}); } else { try writer.writeAll("```" ++ line_ending); } for (preformatted.text.lines) |line| { try writer.writeAll(line); try writer.writeAll(line_ending); } try writer.writeAll("```" ++ line_ending); }, .quote => |quote| for (quote.lines) |line| { try writer.writeAll("> "); try writer.writeAll(line); try writer.writeAll(line_ending); }, .link => |link| { try writer.writeAll("=> "); try writer.writeAll(link.href); if (link.title) |title| { try writer.writeAll(" "); try writer.writeAll(title); } try writer.writeAll(line_ending); }, .list => |list| for (list.lines) |line| { try writer.writeAll("* "); try writer.writeAll(line); try writer.writeAll(line_ending); }, .heading => |heading| { switch (heading.level) { .h1 => try writer.writeAll("# "), .h2 => try writer.writeAll("## "), .h3 => try writer.writeAll("### "), } try writer.writeAll(heading.text); try writer.writeAll(line_ending); }, } } }
src/renderers/gemtext.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 MockFileSystem = yeti.FileSystem; test "tokenize array" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const module = try codebase.createEntity(.{}); const code = "[1, 2, 3]"; var tokens = try tokenize(module, code); { const token = tokens.next().?; try expectEqual(token.get(components.TokenKind), .left_bracket); try expectEqual(token.get(components.Span), .{ .begin = .{ .column = 0, .row = 0 }, .end = .{ .column = 1, .row = 0 }, }); } { const token = tokens.next().?; try expectEqual(token.get(components.TokenKind), .int); try expectEqualStrings(literalOf(token), "1"); try expectEqual(token.get(components.Span), .{ .begin = .{ .column = 1, .row = 0 }, .end = .{ .column = 2, .row = 0 }, }); } { const token = tokens.next().?; try expectEqual(token.get(components.TokenKind), .comma); try expectEqual(token.get(components.Span), .{ .begin = .{ .column = 2, .row = 0 }, .end = .{ .column = 3, .row = 0 }, }); } { const token = tokens.next().?; try expectEqual(token.get(components.TokenKind), .int); try expectEqualStrings(literalOf(token), "2"); try expectEqual(token.get(components.Span), .{ .begin = .{ .column = 4, .row = 0 }, .end = .{ .column = 5, .row = 0 }, }); } { const token = tokens.next().?; try expectEqual(token.get(components.TokenKind), .comma); try expectEqual(token.get(components.Span), .{ .begin = .{ .column = 5, .row = 0 }, .end = .{ .column = 6, .row = 0 }, }); } { const token = tokens.next().?; try expectEqual(token.get(components.TokenKind), .int); try expectEqualStrings(literalOf(token), "3"); try expectEqual(token.get(components.Span), .{ .begin = .{ .column = 7, .row = 0 }, .end = .{ .column = 8, .row = 0 }, }); } { const token = tokens.next().?; try expectEqual(token.get(components.TokenKind), .right_bracket); try expectEqual(token.get(components.Span), .{ .begin = .{ .column = 8, .row = 0 }, .end = .{ .column = 9, .row = 0 }, }); } try expectEqual(tokens.next(), null); } test "parse array 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() []f32 { \\ [1, 2, 3] \\} ; var tokens = try tokenize(module, code); try parse(module, &tokens); const top_level = module.get(components.TopLevel); const overloads = top_level.findString("start").get(components.Overloads).slice(); try expectEqual(overloads.len, 1); const start = overloads[0]; const return_type = start.get(components.ReturnTypeAst).entity; try expectEqual(return_type.get(components.AstKind), .array); try expectEqualStrings(literalOf(return_type.get(components.Value).entity), "f32"); const body = overloads[0].get(components.Body).slice(); try expectEqual(body.len, 1); const array_literal = body[0]; try expectEqual(array_literal.get(components.AstKind), .array_literal); const values = array_literal.get(components.Values).slice(); try expectEqual(values.len, 3); try expectEqualStrings(literalOf(values[0]), "1"); try expectEqualStrings(literalOf(values[1]), "2"); try expectEqualStrings(literalOf(values[2]), "3"); } test "parse multiline array 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() []f32 { \\ [ 1, 2, \\ 3, 4, \\ 5, 6 ] \\} ; var tokens = try tokenize(module, code); try parse(module, &tokens); const top_level = module.get(components.TopLevel); const overloads = top_level.findString("start").get(components.Overloads).slice(); try expectEqual(overloads.len, 1); const start = overloads[0]; const return_type = start.get(components.ReturnTypeAst).entity; try expectEqual(return_type.get(components.AstKind), .array); try expectEqualStrings(literalOf(return_type.get(components.Value).entity), "f32"); const body = overloads[0].get(components.Body).slice(); try expectEqual(body.len, 1); const array_literal = body[0]; try expectEqual(array_literal.get(components.AstKind), .array_literal); const values = array_literal.get(components.Values).slice(); try expectEqual(values.len, 6); try expectEqualStrings(literalOf(values[0]), "1"); try expectEqualStrings(literalOf(values[1]), "2"); try expectEqualStrings(literalOf(values[2]), "3"); try expectEqualStrings(literalOf(values[3]), "4"); try expectEqualStrings(literalOf(values[4]), "5"); try expectEqualStrings(literalOf(values[5]), "6"); } test "analyze semantics of array literal" { var arena = Arena.init(std.heap.page_allocator); defer arena.deinit(); var codebase = try initCodebase(&arena); const builtins = codebase.get(components.Builtins); var fs = try MockFileSystem.init(&arena); _ = try fs.newFile("foo.yeti", \\start() []f32 { \\ [1, 2, 3] \\} ); _ = try analyzeSemantics(codebase, fs, "foo.yeti"); 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); const return_type = start.get(components.ReturnType).entity; try expectEqualStrings(literalOf(return_type), "[]f32"); const body = start.get(components.Body).slice(); try expectEqual(body.len, 1); const array_literal = body[0]; try expectEqual(array_literal.get(components.AstKind), .array_literal); try expectEqual(typeOf(array_literal), return_type); const values = array_literal.get(components.Values).slice(); try expectEqual(values.len, 3); try expectEqual(typeOf(values[0]), builtins.IntLiteral); try expectEqual(typeOf(values[1]), builtins.IntLiteral); try expectEqual(typeOf(values[2]), builtins.IntLiteral); } test "codegen of array literal" { 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", \\start() []f32 { \\ [1, 2, 3] \\} ); 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 wasm_instructions = start.get(components.WasmInstructions).slice(); try expectEqual(wasm_instructions.len, 2); { const constant = wasm_instructions[0]; try expectEqual(constant.get(components.WasmInstructionKind), .i32_const); try expectEqualStrings(literalOf(constant.get(components.Constant).entity), "0"); } { const constant = wasm_instructions[1]; try expectEqual(constant.get(components.WasmInstructionKind), .i32_const); try expectEqualStrings(literalOf(constant.get(components.Constant).entity), "3"); } const data_segment = codebase.get(components.DataSegment); try expectEqual(data_segment.end, 96); const entities = data_segment.entities.slice(); try expectEqual(entities.len, 1); } test "print wasm i32 array literal" { 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", \\start() []i32 { \\ [1, 2, 3] \\} ); const module = try analyzeSemantics(codebase, fs, "foo.yeti"); try codegen(module); const wasm = try printWasm(module); try expectEqualStrings(wasm, \\(module \\ \\ (func $foo/start (result i32 i32) \\ (i32.const 0) \\ (i32.const 3)) \\ \\ (export "_start" (func $foo/start)) \\ \\ (data (i32.const 0) "\01\00\00\00\02\00\00\00\03\00\00\00") \\ \\ (memory 1) \\ (export "memory" (memory 0))) ); } test "print wasm f32 array literal" { 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", \\start() []f32 { \\ [1, 2, 3] \\} ); const module = try analyzeSemantics(codebase, fs, "foo.yeti"); try codegen(module); const wasm = try printWasm(module); try expectEqualStrings(wasm, \\(module \\ \\ (func $foo/start (result i32 i32) \\ (i32.const 0) \\ (i32.const 3)) \\ \\ (export "_start" (func $foo/start)) \\ \\ (data (i32.const 0) "\00\00\80\3f\00\00\00\40\00\00\40\40") \\ \\ (memory 1) \\ (export "memory" (memory 0))) ); }
src/tests/test_arrays.zig
pub const D3D10_16BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 65535); pub const D3D10_32BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 4294967295); pub const D3D10_8BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 255); pub const D3D10_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = @as(u32, 9); pub const D3D10_CLIP_OR_CULL_DISTANCE_COUNT = @as(u32, 8); pub const D3D10_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT = @as(u32, 2); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = @as(u32, 14); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS = @as(u32, 4); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT = @as(u32, 15); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT = @as(u32, 15); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST = @as(u32, 1); pub const D3D10_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT = @as(u32, 64); pub const D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT = @as(u32, 1); pub const D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST = @as(u32, 1); pub const D3D10_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS = @as(u32, 1); pub const D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT = @as(u32, 128); pub const D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST = @as(u32, 1); pub const D3D10_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = @as(u32, 128); pub const D3D10_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS = @as(u32, 1); pub const D3D10_COMMONSHADER_SAMPLER_REGISTER_COUNT = @as(u32, 16); pub const D3D10_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST = @as(u32, 1); pub const D3D10_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT = @as(u32, 16); pub const D3D10_COMMONSHADER_SUBROUTINE_NESTING_LIMIT = @as(u32, 32); pub const D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_COMMONSHADER_TEMP_REGISTER_COUNT = @as(u32, 4096); pub const D3D10_COMMONSHADER_TEMP_REGISTER_READS_PER_INST = @as(u32, 3); pub const D3D10_COMMONSHADER_TEMP_REGISTER_READ_PORTS = @as(u32, 3); pub const D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX = @as(u32, 10); pub const D3D10_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN = @as(i32, -10); pub const D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE = @as(i32, -8); pub const D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE = @as(u32, 7); pub const D3D10_DEFAULT_BLEND_FACTOR_ALPHA = @as(f32, 1); pub const D3D10_DEFAULT_BLEND_FACTOR_BLUE = @as(f32, 1); pub const D3D10_DEFAULT_BLEND_FACTOR_GREEN = @as(f32, 1); pub const D3D10_DEFAULT_BLEND_FACTOR_RED = @as(f32, 1); pub const D3D10_DEFAULT_BORDER_COLOR_COMPONENT = @as(f32, 0); pub const D3D10_DEFAULT_DEPTH_BIAS = @as(u32, 0); pub const D3D10_DEFAULT_DEPTH_BIAS_CLAMP = @as(f32, 0); pub const D3D10_DEFAULT_MAX_ANISOTROPY = @as(f32, 16); pub const D3D10_DEFAULT_MIP_LOD_BIAS = @as(f32, 0); pub const D3D10_DEFAULT_RENDER_TARGET_ARRAY_INDEX = @as(u32, 0); pub const D3D10_DEFAULT_SAMPLE_MASK = @as(u32, 4294967295); pub const D3D10_DEFAULT_SCISSOR_ENDX = @as(u32, 0); pub const D3D10_DEFAULT_SCISSOR_ENDY = @as(u32, 0); pub const D3D10_DEFAULT_SCISSOR_STARTX = @as(u32, 0); pub const D3D10_DEFAULT_SCISSOR_STARTY = @as(u32, 0); pub const D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS = @as(f32, 0); pub const D3D10_DEFAULT_STENCIL_READ_MASK = @as(u32, 255); pub const D3D10_DEFAULT_STENCIL_REFERENCE = @as(u32, 0); pub const D3D10_DEFAULT_STENCIL_WRITE_MASK = @as(u32, 255); pub const D3D10_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX = @as(u32, 0); pub const D3D10_DEFAULT_VIEWPORT_HEIGHT = @as(u32, 0); pub const D3D10_DEFAULT_VIEWPORT_MAX_DEPTH = @as(f32, 0); pub const D3D10_DEFAULT_VIEWPORT_MIN_DEPTH = @as(f32, 0); pub const D3D10_DEFAULT_VIEWPORT_TOPLEFTX = @as(u32, 0); pub const D3D10_DEFAULT_VIEWPORT_TOPLEFTY = @as(u32, 0); pub const D3D10_DEFAULT_VIEWPORT_WIDTH = @as(u32, 0); pub const D3D10_FLOAT16_FUSED_TOLERANCE_IN_ULP = @as(f64, 6.0e-01); pub const D3D10_FLOAT32_MAX = @as(f32, 3.4028235e+38); pub const D3D10_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = @as(f32, 6.0e-01); pub const D3D10_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR = @as(f32, 2.4e+00); pub const D3D10_FLOAT_TO_SRGB_EXPONENT_NUMERATOR = @as(f32, 1); pub const D3D10_FLOAT_TO_SRGB_OFFSET = @as(f32, 5.5e-02); pub const D3D10_FLOAT_TO_SRGB_SCALE_1 = @as(f32, 1.292e+01); pub const D3D10_FLOAT_TO_SRGB_SCALE_2 = @as(f32, 1.055e+00); pub const D3D10_FLOAT_TO_SRGB_THRESHOLD = @as(f32, 3.1308e-03); pub const D3D10_FTOI_INSTRUCTION_MAX_INPUT = @as(f32, 2.1474836e+09); pub const D3D10_FTOI_INSTRUCTION_MIN_INPUT = @as(f32, -2.1474836e+09); pub const D3D10_FTOU_INSTRUCTION_MAX_INPUT = @as(f32, 4.2949673e+09); pub const D3D10_FTOU_INSTRUCTION_MIN_INPUT = @as(f32, 0); pub const D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS = @as(u32, 1); pub const D3D10_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_GS_INPUT_PRIM_CONST_REGISTER_COUNT = @as(u32, 1); pub const D3D10_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST = @as(u32, 2); pub const D3D10_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_GS_INPUT_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_GS_INPUT_REGISTER_COUNT = @as(u32, 16); pub const D3D10_GS_INPUT_REGISTER_READS_PER_INST = @as(u32, 2); pub const D3D10_GS_INPUT_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_GS_INPUT_REGISTER_VERTICES = @as(u32, 6); pub const D3D10_GS_OUTPUT_ELEMENTS = @as(u32, 32); pub const D3D10_GS_OUTPUT_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_GS_OUTPUT_REGISTER_COUNT = @as(u32, 32); pub const D3D10_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES = @as(u32, 0); pub const D3D10_IA_DEFAULT_PRIMITIVE_TOPOLOGY = @as(u32, 0); pub const D3D10_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES = @as(u32, 0); pub const D3D10_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT = @as(u32, 1); pub const D3D10_IA_INSTANCE_ID_BIT_COUNT = @as(u32, 32); pub const D3D10_IA_INTEGER_ARITHMETIC_BIT_COUNT = @as(u32, 32); pub const D3D10_IA_PRIMITIVE_ID_BIT_COUNT = @as(u32, 32); pub const D3D10_IA_VERTEX_ID_BIT_COUNT = @as(u32, 32); pub const D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = @as(u32, 16); pub const D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = @as(u32, 64); pub const D3D10_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = @as(u32, 16); pub const D3D10_INTEGER_DIVIDE_BY_ZERO_QUOTIENT = @as(u32, 4294967295); pub const D3D10_INTEGER_DIVIDE_BY_ZERO_REMAINDER = @as(u32, 4294967295); pub const D3D10_LINEAR_GAMMA = @as(f32, 1); pub const D3D10_MAX_BORDER_COLOR_COMPONENT = @as(f32, 1); pub const D3D10_MAX_DEPTH = @as(f32, 1); pub const D3D10_MAX_MAXANISOTROPY = @as(u32, 16); pub const D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT = @as(u32, 32); pub const D3D10_MAX_POSITION_VALUE = @as(f32, 3.4028236e+34); pub const D3D10_MAX_TEXTURE_DIMENSION_2_TO_EXP = @as(u32, 17); pub const D3D10_MIN_BORDER_COLOR_COMPONENT = @as(f32, 0); pub const D3D10_MIN_DEPTH = @as(f32, 0); pub const D3D10_MIN_MAXANISOTROPY = @as(u32, 0); pub const D3D10_MIP_LOD_BIAS_MAX = @as(f32, 1.599e+01); pub const D3D10_MIP_LOD_BIAS_MIN = @as(f32, -16); pub const D3D10_MIP_LOD_FRACTIONAL_BIT_COUNT = @as(u32, 6); pub const D3D10_MIP_LOD_RANGE_BIT_COUNT = @as(u32, 8); pub const D3D10_MULTISAMPLE_ANTIALIAS_LINE_WIDTH = @as(f32, 1.4e+00); pub const D3D10_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT = @as(u32, 0); pub const D3D10_PIXEL_ADDRESS_RANGE_BIT_COUNT = @as(u32, 13); pub const D3D10_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = @as(u32, 15); pub const D3D10_PS_FRONTFACING_DEFAULT_VALUE = @as(u32, 4294967295); pub const D3D10_PS_FRONTFACING_FALSE_VALUE = @as(u32, 0); pub const D3D10_PS_FRONTFACING_TRUE_VALUE = @as(u32, 4294967295); pub const D3D10_PS_INPUT_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_PS_INPUT_REGISTER_COUNT = @as(u32, 32); pub const D3D10_PS_INPUT_REGISTER_READS_PER_INST = @as(u32, 2); pub const D3D10_PS_INPUT_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT = @as(f32, 0); pub const D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS = @as(u32, 1); pub const D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_PS_OUTPUT_DEPTH_REGISTER_COUNT = @as(u32, 1); pub const D3D10_PS_OUTPUT_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_PS_OUTPUT_REGISTER_COUNT = @as(u32, 8); pub const D3D10_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT = @as(f32, 5.0e-01); pub const D3D10_REQ_BLEND_OBJECT_COUNT_PER_CONTEXT = @as(u32, 4096); pub const D3D10_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP = @as(u32, 27); pub const D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT = @as(u32, 4096); pub const D3D10_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_CONTEXT = @as(u32, 4096); pub const D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = @as(u32, 32); pub const D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP = @as(u32, 32); pub const D3D10_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION = @as(u32, 8192); pub const D3D10_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT = @as(u32, 1024); pub const D3D10_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT = @as(u32, 4096); pub const D3D10_REQ_MAXANISOTROPY = @as(u32, 16); pub const D3D10_REQ_MIP_LEVELS = @as(u32, 14); pub const D3D10_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES = @as(u32, 2048); pub const D3D10_REQ_RASTERIZER_OBJECT_COUNT_PER_CONTEXT = @as(u32, 4096); pub const D3D10_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH = @as(u32, 8192); pub const D3D10_REQ_RESOURCE_SIZE_IN_MEGABYTES = @as(u32, 128); pub const D3D10_REQ_RESOURCE_VIEW_COUNT_PER_CONTEXT_2_TO_EXP = @as(u32, 20); pub const D3D10_REQ_SAMPLER_OBJECT_COUNT_PER_CONTEXT = @as(u32, 4096); pub const D3D10_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION = @as(u32, 512); pub const D3D10_REQ_TEXTURE1D_U_DIMENSION = @as(u32, 8192); pub const D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION = @as(u32, 512); pub const D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION = @as(u32, 8192); pub const D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = @as(u32, 2048); pub const D3D10_REQ_TEXTURECUBE_DIMENSION = @as(u32, 8192); pub const D3D10_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = @as(u32, 0); pub const D3D10_SHADER_MAJOR_VERSION = @as(u32, 4); pub const D3D10_SHADER_MINOR_VERSION = @as(u32, 0); pub const D3D10_SHIFT_INSTRUCTION_PAD_VALUE = @as(u32, 0); pub const D3D10_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = @as(u32, 5); pub const D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT = @as(u32, 8); pub const D3D10_SO_BUFFER_MAX_STRIDE_IN_BYTES = @as(u32, 2048); pub const D3D10_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = @as(u32, 256); pub const D3D10_SO_BUFFER_SLOT_COUNT = @as(u32, 4); pub const D3D10_SO_DDI_REGISTER_INDEX_DENOTING_GAP = @as(u32, 4294967295); pub const D3D10_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER = @as(u32, 1); pub const D3D10_SO_SINGLE_BUFFER_COMPONENT_LIMIT = @as(u32, 64); pub const D3D10_SRGB_GAMMA = @as(f32, 2.2e+00); pub const D3D10_SRGB_TO_FLOAT_DENOMINATOR_1 = @as(f32, 1.292e+01); pub const D3D10_SRGB_TO_FLOAT_DENOMINATOR_2 = @as(f32, 1.055e+00); pub const D3D10_SRGB_TO_FLOAT_EXPONENT = @as(f32, 2.4e+00); pub const D3D10_SRGB_TO_FLOAT_OFFSET = @as(f32, 5.5e-02); pub const D3D10_SRGB_TO_FLOAT_THRESHOLD = @as(f32, 4.045e-02); pub const D3D10_SRGB_TO_FLOAT_TOLERANCE_IN_ULP = @as(f32, 5.0e-01); pub const D3D10_STANDARD_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_STANDARD_COMPONENT_BIT_COUNT_DOUBLED = @as(u32, 64); pub const D3D10_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE = @as(u32, 4); pub const D3D10_STANDARD_PIXEL_COMPONENT_COUNT = @as(u32, 128); pub const D3D10_STANDARD_PIXEL_ELEMENT_COUNT = @as(u32, 32); pub const D3D10_STANDARD_VECTOR_SIZE = @as(u32, 4); pub const D3D10_STANDARD_VERTEX_ELEMENT_COUNT = @as(u32, 16); pub const D3D10_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT = @as(u32, 64); pub const D3D10_SUBPIXEL_FRACTIONAL_BIT_COUNT = @as(u32, 8); pub const D3D10_SUBTEXEL_FRACTIONAL_BIT_COUNT = @as(u32, 6); pub const D3D10_TEXEL_ADDRESS_RANGE_BIT_COUNT = @as(u32, 18); pub const D3D10_UNBOUND_MEMORY_ACCESS_RESULT = @as(u32, 0); pub const D3D10_VIEWPORT_AND_SCISSORRECT_MAX_INDEX = @as(u32, 15); pub const D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = @as(u32, 16); pub const D3D10_VIEWPORT_BOUNDS_MAX = @as(u32, 16383); pub const D3D10_VIEWPORT_BOUNDS_MIN = @as(i32, -16384); pub const D3D10_VS_INPUT_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_VS_INPUT_REGISTER_COUNT = @as(u32, 16); pub const D3D10_VS_INPUT_REGISTER_READS_PER_INST = @as(u32, 2); pub const D3D10_VS_INPUT_REGISTER_READ_PORTS = @as(u32, 1); pub const D3D10_VS_OUTPUT_REGISTER_COMPONENTS = @as(u32, 4); pub const D3D10_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_VS_OUTPUT_REGISTER_COUNT = @as(u32, 16); pub const D3D10_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT = @as(u32, 10); pub const D3D10_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = @as(u32, 25); pub const D3D10_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP = @as(u32, 25); pub const D3D_MAJOR_VERSION = @as(u32, 10); pub const D3D_MINOR_VERSION = @as(u32, 0); pub const D3D_SPEC_DATE_DAY = @as(u32, 8); pub const D3D_SPEC_DATE_MONTH = @as(u32, 8); pub const D3D_SPEC_DATE_YEAR = @as(u32, 2006); pub const D3D_SPEC_VERSION = @as(f64, 1.050005e+00); pub const _FACD3D10 = @as(u32, 2169); pub const D3D10_APPEND_ALIGNED_ELEMENT = @as(u32, 4294967295); pub const D3D10_FILTER_TYPE_MASK = @as(u32, 3); pub const D3D10_MIN_FILTER_SHIFT = @as(u32, 4); pub const D3D10_MAG_FILTER_SHIFT = @as(u32, 2); pub const D3D10_MIP_FILTER_SHIFT = @as(u32, 0); pub const D3D10_COMPARISON_FILTERING_BIT = @as(u32, 128); pub const D3D10_ANISOTROPIC_FILTERING_BIT = @as(u32, 64); pub const D3D10_TEXT_1BIT_BIT = @as(u32, 2147483648); pub const D3D10_SDK_VERSION = @as(u32, 29); pub const D3D10_1_DEFAULT_SAMPLE_MASK = @as(u32, 4294967295); pub const D3D10_1_FLOAT16_FUSED_TOLERANCE_IN_ULP = @as(f64, 6.0e-01); pub const D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = @as(f32, 6.0e-01); pub const D3D10_1_GS_INPUT_REGISTER_COUNT = @as(u32, 32); pub const D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = @as(u32, 32); pub const D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = @as(u32, 128); pub const D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = @as(u32, 32); pub const D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENTS = @as(u32, 1); pub const D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32); pub const D3D10_1_PS_OUTPUT_MASK_REGISTER_COUNT = @as(u32, 1); pub const D3D10_1_SHADER_MAJOR_VERSION = @as(u32, 4); pub const D3D10_1_SHADER_MINOR_VERSION = @as(u32, 1); pub const D3D10_1_SO_BUFFER_MAX_STRIDE_IN_BYTES = @as(u32, 2048); pub const D3D10_1_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = @as(u32, 256); pub const D3D10_1_SO_BUFFER_SLOT_COUNT = @as(u32, 4); pub const D3D10_1_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER = @as(u32, 1); pub const D3D10_1_SO_SINGLE_BUFFER_COMPONENT_LIMIT = @as(u32, 64); pub const D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT = @as(u32, 32); pub const D3D10_1_SUBPIXEL_FRACTIONAL_BIT_COUNT = @as(u32, 8); pub const D3D10_1_VS_INPUT_REGISTER_COUNT = @as(u32, 32); pub const D3D10_1_VS_OUTPUT_REGISTER_COUNT = @as(u32, 32); pub const D3D10_SDK_LAYERS_VERSION = @as(u32, 11); pub const D3D10_DEBUG_FEATURE_FLUSH_PER_RENDER_OP = @as(u32, 1); pub const D3D10_DEBUG_FEATURE_FINISH_PER_RENDER_OP = @as(u32, 2); pub const D3D10_DEBUG_FEATURE_PRESENT_PER_RENDER_OP = @as(u32, 4); pub const DXGI_DEBUG_D3D10 = Guid.initString("243b4c52-3606-4d3a-99d7-a7e7b33ed706"); pub const D3D10_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT = @as(u32, 1024); pub const D3D10_SHADER_DEBUG = @as(u32, 1); pub const D3D10_SHADER_SKIP_VALIDATION = @as(u32, 2); pub const D3D10_SHADER_SKIP_OPTIMIZATION = @as(u32, 4); pub const D3D10_SHADER_PACK_MATRIX_ROW_MAJOR = @as(u32, 8); pub const D3D10_SHADER_PACK_MATRIX_COLUMN_MAJOR = @as(u32, 16); pub const D3D10_SHADER_PARTIAL_PRECISION = @as(u32, 32); pub const D3D10_SHADER_FORCE_VS_SOFTWARE_NO_OPT = @as(u32, 64); pub const D3D10_SHADER_FORCE_PS_SOFTWARE_NO_OPT = @as(u32, 128); pub const D3D10_SHADER_NO_PRESHADER = @as(u32, 256); pub const D3D10_SHADER_AVOID_FLOW_CONTROL = @as(u32, 512); pub const D3D10_SHADER_PREFER_FLOW_CONTROL = @as(u32, 1024); pub const D3D10_SHADER_ENABLE_STRICTNESS = @as(u32, 2048); pub const D3D10_SHADER_ENABLE_BACKWARDS_COMPATIBILITY = @as(u32, 4096); pub const D3D10_SHADER_IEEE_STRICTNESS = @as(u32, 8192); pub const D3D10_SHADER_WARNINGS_ARE_ERRORS = @as(u32, 262144); pub const D3D10_SHADER_RESOURCES_MAY_ALIAS = @as(u32, 524288); pub const D3D10_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES = @as(u32, 1048576); pub const D3D10_ALL_RESOURCES_BOUND = @as(u32, 2097152); pub const D3D10_SHADER_DEBUG_NAME_FOR_SOURCE = @as(u32, 4194304); pub const D3D10_SHADER_DEBUG_NAME_FOR_BINARY = @as(u32, 8388608); pub const D3D10_SHADER_OPTIMIZATION_LEVEL0 = @as(u32, 16384); pub const D3D10_SHADER_OPTIMIZATION_LEVEL1 = @as(u32, 0); pub const D3D10_SHADER_OPTIMIZATION_LEVEL3 = @as(u32, 32768); pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_LATEST = @as(u32, 0); pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_0 = @as(u32, 16); pub const D3D10_SHADER_FLAGS2_FORCE_ROOT_SIGNATURE_1_1 = @as(u32, 32); pub const D3D10_EFFECT_COMPILE_CHILD_EFFECT = @as(u32, 1); pub const D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS = @as(u32, 2); pub const D3D10_EFFECT_SINGLE_THREADED = @as(u32, 8); pub const D3D10_EFFECT_VARIABLE_POOLED = @as(u32, 1); pub const D3D10_EFFECT_VARIABLE_ANNOTATION = @as(u32, 2); pub const D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT = @as(u32, 4); pub const GUID_DeviceType = Guid.initString("d722fb4d-7a68-437a-b20c-5804ee2494a6"); //-------------------------------------------------------------------------------- // Section: Types (177) //-------------------------------------------------------------------------------- pub const D3D10_INPUT_CLASSIFICATION = enum(i32) { VERTEX_DATA = 0, INSTANCE_DATA = 1, }; pub const D3D10_INPUT_PER_VERTEX_DATA = D3D10_INPUT_CLASSIFICATION.VERTEX_DATA; pub const D3D10_INPUT_PER_INSTANCE_DATA = D3D10_INPUT_CLASSIFICATION.INSTANCE_DATA; pub const D3D10_INPUT_ELEMENT_DESC = extern struct { SemanticName: ?[*:0]const u8, SemanticIndex: u32, Format: DXGI_FORMAT, InputSlot: u32, AlignedByteOffset: u32, InputSlotClass: D3D10_INPUT_CLASSIFICATION, InstanceDataStepRate: u32, }; pub const D3D10_FILL_MODE = enum(i32) { WIREFRAME = 2, SOLID = 3, }; pub const D3D10_FILL_WIREFRAME = D3D10_FILL_MODE.WIREFRAME; pub const D3D10_FILL_SOLID = D3D10_FILL_MODE.SOLID; pub const D3D10_CULL_MODE = enum(i32) { NONE = 1, FRONT = 2, BACK = 3, }; pub const D3D10_CULL_NONE = D3D10_CULL_MODE.NONE; pub const D3D10_CULL_FRONT = D3D10_CULL_MODE.FRONT; pub const D3D10_CULL_BACK = D3D10_CULL_MODE.BACK; pub const D3D10_SO_DECLARATION_ENTRY = extern struct { SemanticName: ?[*:0]const u8, SemanticIndex: u32, StartComponent: u8, ComponentCount: u8, OutputSlot: u8, }; pub const D3D10_VIEWPORT = extern struct { TopLeftX: i32, TopLeftY: i32, Width: u32, Height: u32, MinDepth: f32, MaxDepth: f32, }; pub const D3D10_RESOURCE_DIMENSION = enum(i32) { UNKNOWN = 0, BUFFER = 1, TEXTURE1D = 2, TEXTURE2D = 3, TEXTURE3D = 4, }; pub const D3D10_RESOURCE_DIMENSION_UNKNOWN = D3D10_RESOURCE_DIMENSION.UNKNOWN; pub const D3D10_RESOURCE_DIMENSION_BUFFER = D3D10_RESOURCE_DIMENSION.BUFFER; pub const D3D10_RESOURCE_DIMENSION_TEXTURE1D = D3D10_RESOURCE_DIMENSION.TEXTURE1D; pub const D3D10_RESOURCE_DIMENSION_TEXTURE2D = D3D10_RESOURCE_DIMENSION.TEXTURE2D; pub const D3D10_RESOURCE_DIMENSION_TEXTURE3D = D3D10_RESOURCE_DIMENSION.TEXTURE3D; pub const D3D10_DSV_DIMENSION = enum(i32) { UNKNOWN = 0, TEXTURE1D = 1, TEXTURE1DARRAY = 2, TEXTURE2D = 3, TEXTURE2DARRAY = 4, TEXTURE2DMS = 5, TEXTURE2DMSARRAY = 6, }; pub const D3D10_DSV_DIMENSION_UNKNOWN = D3D10_DSV_DIMENSION.UNKNOWN; pub const D3D10_DSV_DIMENSION_TEXTURE1D = D3D10_DSV_DIMENSION.TEXTURE1D; pub const D3D10_DSV_DIMENSION_TEXTURE1DARRAY = D3D10_DSV_DIMENSION.TEXTURE1DARRAY; pub const D3D10_DSV_DIMENSION_TEXTURE2D = D3D10_DSV_DIMENSION.TEXTURE2D; pub const D3D10_DSV_DIMENSION_TEXTURE2DARRAY = D3D10_DSV_DIMENSION.TEXTURE2DARRAY; pub const D3D10_DSV_DIMENSION_TEXTURE2DMS = D3D10_DSV_DIMENSION.TEXTURE2DMS; pub const D3D10_DSV_DIMENSION_TEXTURE2DMSARRAY = D3D10_DSV_DIMENSION.TEXTURE2DMSARRAY; pub const D3D10_RTV_DIMENSION = enum(i32) { UNKNOWN = 0, BUFFER = 1, TEXTURE1D = 2, TEXTURE1DARRAY = 3, TEXTURE2D = 4, TEXTURE2DARRAY = 5, TEXTURE2DMS = 6, TEXTURE2DMSARRAY = 7, TEXTURE3D = 8, }; pub const D3D10_RTV_DIMENSION_UNKNOWN = D3D10_RTV_DIMENSION.UNKNOWN; pub const D3D10_RTV_DIMENSION_BUFFER = D3D10_RTV_DIMENSION.BUFFER; pub const D3D10_RTV_DIMENSION_TEXTURE1D = D3D10_RTV_DIMENSION.TEXTURE1D; pub const D3D10_RTV_DIMENSION_TEXTURE1DARRAY = D3D10_RTV_DIMENSION.TEXTURE1DARRAY; pub const D3D10_RTV_DIMENSION_TEXTURE2D = D3D10_RTV_DIMENSION.TEXTURE2D; pub const D3D10_RTV_DIMENSION_TEXTURE2DARRAY = D3D10_RTV_DIMENSION.TEXTURE2DARRAY; pub const D3D10_RTV_DIMENSION_TEXTURE2DMS = D3D10_RTV_DIMENSION.TEXTURE2DMS; pub const D3D10_RTV_DIMENSION_TEXTURE2DMSARRAY = D3D10_RTV_DIMENSION.TEXTURE2DMSARRAY; pub const D3D10_RTV_DIMENSION_TEXTURE3D = D3D10_RTV_DIMENSION.TEXTURE3D; pub const D3D10_USAGE = enum(i32) { DEFAULT = 0, IMMUTABLE = 1, DYNAMIC = 2, STAGING = 3, }; pub const D3D10_USAGE_DEFAULT = D3D10_USAGE.DEFAULT; pub const D3D10_USAGE_IMMUTABLE = D3D10_USAGE.IMMUTABLE; pub const D3D10_USAGE_DYNAMIC = D3D10_USAGE.DYNAMIC; pub const D3D10_USAGE_STAGING = D3D10_USAGE.STAGING; pub const D3D10_BIND_FLAG = enum(i32) { VERTEX_BUFFER = 1, INDEX_BUFFER = 2, CONSTANT_BUFFER = 4, SHADER_RESOURCE = 8, STREAM_OUTPUT = 16, RENDER_TARGET = 32, DEPTH_STENCIL = 64, }; pub const D3D10_BIND_VERTEX_BUFFER = D3D10_BIND_FLAG.VERTEX_BUFFER; pub const D3D10_BIND_INDEX_BUFFER = D3D10_BIND_FLAG.INDEX_BUFFER; pub const D3D10_BIND_CONSTANT_BUFFER = D3D10_BIND_FLAG.CONSTANT_BUFFER; pub const D3D10_BIND_SHADER_RESOURCE = D3D10_BIND_FLAG.SHADER_RESOURCE; pub const D3D10_BIND_STREAM_OUTPUT = D3D10_BIND_FLAG.STREAM_OUTPUT; pub const D3D10_BIND_RENDER_TARGET = D3D10_BIND_FLAG.RENDER_TARGET; pub const D3D10_BIND_DEPTH_STENCIL = D3D10_BIND_FLAG.DEPTH_STENCIL; pub const D3D10_CPU_ACCESS_FLAG = enum(i32) { WRITE = 65536, READ = 131072, }; pub const D3D10_CPU_ACCESS_WRITE = D3D10_CPU_ACCESS_FLAG.WRITE; pub const D3D10_CPU_ACCESS_READ = D3D10_CPU_ACCESS_FLAG.READ; pub const D3D10_RESOURCE_MISC_FLAG = enum(i32) { GENERATE_MIPS = 1, SHARED = 2, TEXTURECUBE = 4, SHARED_KEYEDMUTEX = 16, GDI_COMPATIBLE = 32, }; pub const D3D10_RESOURCE_MISC_GENERATE_MIPS = D3D10_RESOURCE_MISC_FLAG.GENERATE_MIPS; pub const D3D10_RESOURCE_MISC_SHARED = D3D10_RESOURCE_MISC_FLAG.SHARED; pub const D3D10_RESOURCE_MISC_TEXTURECUBE = D3D10_RESOURCE_MISC_FLAG.TEXTURECUBE; pub const D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX = D3D10_RESOURCE_MISC_FLAG.SHARED_KEYEDMUTEX; pub const D3D10_RESOURCE_MISC_GDI_COMPATIBLE = D3D10_RESOURCE_MISC_FLAG.GDI_COMPATIBLE; pub const D3D10_MAP = enum(i32) { READ = 1, WRITE = 2, READ_WRITE = 3, WRITE_DISCARD = 4, WRITE_NO_OVERWRITE = 5, }; pub const D3D10_MAP_READ = D3D10_MAP.READ; pub const D3D10_MAP_WRITE = D3D10_MAP.WRITE; pub const D3D10_MAP_READ_WRITE = D3D10_MAP.READ_WRITE; pub const D3D10_MAP_WRITE_DISCARD = D3D10_MAP.WRITE_DISCARD; pub const D3D10_MAP_WRITE_NO_OVERWRITE = D3D10_MAP.WRITE_NO_OVERWRITE; pub const D3D10_MAP_FLAG = enum(i32) { T = 1048576, }; pub const D3D10_MAP_FLAG_DO_NOT_WAIT = D3D10_MAP_FLAG.T; pub const D3D10_RAISE_FLAG = enum(i32) { R = 1, }; pub const D3D10_RAISE_FLAG_DRIVER_INTERNAL_ERROR = D3D10_RAISE_FLAG.R; pub const D3D10_CLEAR_FLAG = enum(i32) { DEPTH = 1, STENCIL = 2, }; pub const D3D10_CLEAR_DEPTH = D3D10_CLEAR_FLAG.DEPTH; pub const D3D10_CLEAR_STENCIL = D3D10_CLEAR_FLAG.STENCIL; pub const D3D10_BOX = extern struct { left: u32, top: u32, front: u32, right: u32, bottom: u32, back: u32, }; const IID_ID3D10DeviceChild_Value = @import("../zig.zig").Guid.initString("9b7e4c00-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10DeviceChild = &IID_ID3D10DeviceChild_Value; pub const ID3D10DeviceChild = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDevice: fn( self: *const ID3D10DeviceChild, ppDevice: ?*?*ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) void, GetPrivateData: fn( self: *const ID3D10DeviceChild, guid: ?*const Guid, pDataSize: ?*u32, // TODO: what to do with BytesParamIndex 1? pData: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPrivateData: fn( self: *const ID3D10DeviceChild, guid: ?*const Guid, DataSize: u32, // TODO: what to do with BytesParamIndex 1? pData: ?*const c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPrivateDataInterface: fn( self: *const ID3D10DeviceChild, guid: ?*const Guid, pData: ?*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 ID3D10DeviceChild_GetDevice(self: *const T, ppDevice: ?*?*ID3D10Device) callconv(.Inline) void { return @ptrCast(*const ID3D10DeviceChild.VTable, self.vtable).GetDevice(@ptrCast(*const ID3D10DeviceChild, self), ppDevice); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10DeviceChild_GetPrivateData(self: *const T, guid: ?*const Guid, pDataSize: ?*u32, pData: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10DeviceChild.VTable, self.vtable).GetPrivateData(@ptrCast(*const ID3D10DeviceChild, self), guid, pDataSize, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10DeviceChild_SetPrivateData(self: *const T, guid: ?*const Guid, DataSize: u32, pData: ?*const c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10DeviceChild.VTable, self.vtable).SetPrivateData(@ptrCast(*const ID3D10DeviceChild, self), guid, DataSize, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10DeviceChild_SetPrivateDataInterface(self: *const T, guid: ?*const Guid, pData: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10DeviceChild.VTable, self.vtable).SetPrivateDataInterface(@ptrCast(*const ID3D10DeviceChild, self), guid, pData); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_COMPARISON_FUNC = enum(i32) { NEVER = 1, LESS = 2, EQUAL = 3, LESS_EQUAL = 4, GREATER = 5, NOT_EQUAL = 6, GREATER_EQUAL = 7, ALWAYS = 8, }; pub const D3D10_COMPARISON_NEVER = D3D10_COMPARISON_FUNC.NEVER; pub const D3D10_COMPARISON_LESS = D3D10_COMPARISON_FUNC.LESS; pub const D3D10_COMPARISON_EQUAL = D3D10_COMPARISON_FUNC.EQUAL; pub const D3D10_COMPARISON_LESS_EQUAL = D3D10_COMPARISON_FUNC.LESS_EQUAL; pub const D3D10_COMPARISON_GREATER = D3D10_COMPARISON_FUNC.GREATER; pub const D3D10_COMPARISON_NOT_EQUAL = D3D10_COMPARISON_FUNC.NOT_EQUAL; pub const D3D10_COMPARISON_GREATER_EQUAL = D3D10_COMPARISON_FUNC.GREATER_EQUAL; pub const D3D10_COMPARISON_ALWAYS = D3D10_COMPARISON_FUNC.ALWAYS; pub const D3D10_DEPTH_WRITE_MASK = enum(i32) { ZERO = 0, ALL = 1, }; pub const D3D10_DEPTH_WRITE_MASK_ZERO = D3D10_DEPTH_WRITE_MASK.ZERO; pub const D3D10_DEPTH_WRITE_MASK_ALL = D3D10_DEPTH_WRITE_MASK.ALL; pub const D3D10_STENCIL_OP = enum(i32) { KEEP = 1, ZERO = 2, REPLACE = 3, INCR_SAT = 4, DECR_SAT = 5, INVERT = 6, INCR = 7, DECR = 8, }; pub const D3D10_STENCIL_OP_KEEP = D3D10_STENCIL_OP.KEEP; pub const D3D10_STENCIL_OP_ZERO = D3D10_STENCIL_OP.ZERO; pub const D3D10_STENCIL_OP_REPLACE = D3D10_STENCIL_OP.REPLACE; pub const D3D10_STENCIL_OP_INCR_SAT = D3D10_STENCIL_OP.INCR_SAT; pub const D3D10_STENCIL_OP_DECR_SAT = D3D10_STENCIL_OP.DECR_SAT; pub const D3D10_STENCIL_OP_INVERT = D3D10_STENCIL_OP.INVERT; pub const D3D10_STENCIL_OP_INCR = D3D10_STENCIL_OP.INCR; pub const D3D10_STENCIL_OP_DECR = D3D10_STENCIL_OP.DECR; pub const D3D10_DEPTH_STENCILOP_DESC = extern struct { StencilFailOp: D3D10_STENCIL_OP, StencilDepthFailOp: D3D10_STENCIL_OP, StencilPassOp: D3D10_STENCIL_OP, StencilFunc: D3D10_COMPARISON_FUNC, }; pub const D3D10_DEPTH_STENCIL_DESC = extern struct { DepthEnable: BOOL, DepthWriteMask: D3D10_DEPTH_WRITE_MASK, DepthFunc: D3D10_COMPARISON_FUNC, StencilEnable: BOOL, StencilReadMask: u8, StencilWriteMask: u8, FrontFace: D3D10_DEPTH_STENCILOP_DESC, BackFace: D3D10_DEPTH_STENCILOP_DESC, }; const IID_ID3D10DepthStencilState_Value = @import("../zig.zig").Guid.initString("2b4b1cc8-a4ad-41f8-8322-ca86fc3ec675"); pub const IID_ID3D10DepthStencilState = &IID_ID3D10DepthStencilState_Value; pub const ID3D10DepthStencilState = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, GetDesc: fn( self: *const ID3D10DepthStencilState, pDesc: ?*D3D10_DEPTH_STENCIL_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10DepthStencilState_GetDesc(self: *const T, pDesc: ?*D3D10_DEPTH_STENCIL_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10DepthStencilState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10DepthStencilState, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_BLEND = enum(i32) { ZERO = 1, ONE = 2, SRC_COLOR = 3, INV_SRC_COLOR = 4, SRC_ALPHA = 5, INV_SRC_ALPHA = 6, DEST_ALPHA = 7, INV_DEST_ALPHA = 8, DEST_COLOR = 9, INV_DEST_COLOR = 10, SRC_ALPHA_SAT = 11, BLEND_FACTOR = 14, INV_BLEND_FACTOR = 15, SRC1_COLOR = 16, INV_SRC1_COLOR = 17, SRC1_ALPHA = 18, INV_SRC1_ALPHA = 19, }; pub const D3D10_BLEND_ZERO = D3D10_BLEND.ZERO; pub const D3D10_BLEND_ONE = D3D10_BLEND.ONE; pub const D3D10_BLEND_SRC_COLOR = D3D10_BLEND.SRC_COLOR; pub const D3D10_BLEND_INV_SRC_COLOR = D3D10_BLEND.INV_SRC_COLOR; pub const D3D10_BLEND_SRC_ALPHA = D3D10_BLEND.SRC_ALPHA; pub const D3D10_BLEND_INV_SRC_ALPHA = D3D10_BLEND.INV_SRC_ALPHA; pub const D3D10_BLEND_DEST_ALPHA = D3D10_BLEND.DEST_ALPHA; pub const D3D10_BLEND_INV_DEST_ALPHA = D3D10_BLEND.INV_DEST_ALPHA; pub const D3D10_BLEND_DEST_COLOR = D3D10_BLEND.DEST_COLOR; pub const D3D10_BLEND_INV_DEST_COLOR = D3D10_BLEND.INV_DEST_COLOR; pub const D3D10_BLEND_SRC_ALPHA_SAT = D3D10_BLEND.SRC_ALPHA_SAT; pub const D3D10_BLEND_BLEND_FACTOR = D3D10_BLEND.BLEND_FACTOR; pub const D3D10_BLEND_INV_BLEND_FACTOR = D3D10_BLEND.INV_BLEND_FACTOR; pub const D3D10_BLEND_SRC1_COLOR = D3D10_BLEND.SRC1_COLOR; pub const D3D10_BLEND_INV_SRC1_COLOR = D3D10_BLEND.INV_SRC1_COLOR; pub const D3D10_BLEND_SRC1_ALPHA = D3D10_BLEND.SRC1_ALPHA; pub const D3D10_BLEND_INV_SRC1_ALPHA = D3D10_BLEND.INV_SRC1_ALPHA; pub const D3D10_BLEND_OP = enum(i32) { ADD = 1, SUBTRACT = 2, REV_SUBTRACT = 3, MIN = 4, MAX = 5, }; pub const D3D10_BLEND_OP_ADD = D3D10_BLEND_OP.ADD; pub const D3D10_BLEND_OP_SUBTRACT = D3D10_BLEND_OP.SUBTRACT; pub const D3D10_BLEND_OP_REV_SUBTRACT = D3D10_BLEND_OP.REV_SUBTRACT; pub const D3D10_BLEND_OP_MIN = D3D10_BLEND_OP.MIN; pub const D3D10_BLEND_OP_MAX = D3D10_BLEND_OP.MAX; pub const D3D10_COLOR_WRITE_ENABLE = enum(i32) { RED = 1, GREEN = 2, BLUE = 4, ALPHA = 8, ALL = 15, }; pub const D3D10_COLOR_WRITE_ENABLE_RED = D3D10_COLOR_WRITE_ENABLE.RED; pub const D3D10_COLOR_WRITE_ENABLE_GREEN = D3D10_COLOR_WRITE_ENABLE.GREEN; pub const D3D10_COLOR_WRITE_ENABLE_BLUE = D3D10_COLOR_WRITE_ENABLE.BLUE; pub const D3D10_COLOR_WRITE_ENABLE_ALPHA = D3D10_COLOR_WRITE_ENABLE.ALPHA; pub const D3D10_COLOR_WRITE_ENABLE_ALL = D3D10_COLOR_WRITE_ENABLE.ALL; pub const D3D10_BLEND_DESC = extern struct { AlphaToCoverageEnable: BOOL, BlendEnable: [8]BOOL, SrcBlend: D3D10_BLEND, DestBlend: D3D10_BLEND, BlendOp: D3D10_BLEND_OP, SrcBlendAlpha: D3D10_BLEND, DestBlendAlpha: D3D10_BLEND, BlendOpAlpha: D3D10_BLEND_OP, RenderTargetWriteMask: [8]u8, }; const IID_ID3D10BlendState_Value = @import("../zig.zig").Guid.initString("edad8d19-8a35-4d6d-8566-2ea276cde161"); pub const IID_ID3D10BlendState = &IID_ID3D10BlendState_Value; pub const ID3D10BlendState = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, GetDesc: fn( self: *const ID3D10BlendState, pDesc: ?*D3D10_BLEND_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10BlendState_GetDesc(self: *const T, pDesc: ?*D3D10_BLEND_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10BlendState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10BlendState, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_RASTERIZER_DESC = extern struct { FillMode: D3D10_FILL_MODE, CullMode: D3D10_CULL_MODE, FrontCounterClockwise: BOOL, DepthBias: i32, DepthBiasClamp: f32, SlopeScaledDepthBias: f32, DepthClipEnable: BOOL, ScissorEnable: BOOL, MultisampleEnable: BOOL, AntialiasedLineEnable: BOOL, }; const IID_ID3D10RasterizerState_Value = @import("../zig.zig").Guid.initString("a2a07292-89af-4345-be2e-c53d9fbb6e9f"); pub const IID_ID3D10RasterizerState = &IID_ID3D10RasterizerState_Value; pub const ID3D10RasterizerState = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, GetDesc: fn( self: *const ID3D10RasterizerState, pDesc: ?*D3D10_RASTERIZER_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10RasterizerState_GetDesc(self: *const T, pDesc: ?*D3D10_RASTERIZER_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10RasterizerState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10RasterizerState, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_SUBRESOURCE_DATA = extern struct { pSysMem: ?*const c_void, SysMemPitch: u32, SysMemSlicePitch: u32, }; const IID_ID3D10Resource_Value = @import("../zig.zig").Guid.initString("9b7e4c01-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Resource = &IID_ID3D10Resource_Value; pub const ID3D10Resource = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, GetType: fn( self: *const ID3D10Resource, rType: ?*D3D10_RESOURCE_DIMENSION, ) callconv(@import("std").os.windows.WINAPI) void, SetEvictionPriority: fn( self: *const ID3D10Resource, EvictionPriority: u32, ) callconv(@import("std").os.windows.WINAPI) void, GetEvictionPriority: fn( self: *const ID3D10Resource, ) callconv(@import("std").os.windows.WINAPI) u32, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Resource_GetType(self: *const T, rType: ?*D3D10_RESOURCE_DIMENSION) callconv(.Inline) void { return @ptrCast(*const ID3D10Resource.VTable, self.vtable).GetType(@ptrCast(*const ID3D10Resource, self), rType); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Resource_SetEvictionPriority(self: *const T, EvictionPriority: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Resource.VTable, self.vtable).SetEvictionPriority(@ptrCast(*const ID3D10Resource, self), EvictionPriority); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Resource_GetEvictionPriority(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10Resource.VTable, self.vtable).GetEvictionPriority(@ptrCast(*const ID3D10Resource, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_BUFFER_DESC = extern struct { ByteWidth: u32, Usage: D3D10_USAGE, BindFlags: u32, CPUAccessFlags: u32, MiscFlags: u32, }; const IID_ID3D10Buffer_Value = @import("../zig.zig").Guid.initString("9b7e4c02-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Buffer = &IID_ID3D10Buffer_Value; pub const ID3D10Buffer = extern struct { pub const VTable = extern struct { base: ID3D10Resource.VTable, Map: fn( self: *const ID3D10Buffer, MapType: D3D10_MAP, MapFlags: u32, ppData: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unmap: fn( self: *const ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) void, GetDesc: fn( self: *const ID3D10Buffer, pDesc: ?*D3D10_BUFFER_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Resource.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Buffer_Map(self: *const T, MapType: D3D10_MAP, MapFlags: u32, ppData: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Buffer.VTable, self.vtable).Map(@ptrCast(*const ID3D10Buffer, self), MapType, MapFlags, ppData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Buffer_Unmap(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Buffer.VTable, self.vtable).Unmap(@ptrCast(*const ID3D10Buffer, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Buffer_GetDesc(self: *const T, pDesc: ?*D3D10_BUFFER_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10Buffer.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10Buffer, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_TEXTURE1D_DESC = extern struct { Width: u32, MipLevels: u32, ArraySize: u32, Format: DXGI_FORMAT, Usage: D3D10_USAGE, BindFlags: u32, CPUAccessFlags: u32, MiscFlags: u32, }; const IID_ID3D10Texture1D_Value = @import("../zig.zig").Guid.initString("9b7e4c03-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Texture1D = &IID_ID3D10Texture1D_Value; pub const ID3D10Texture1D = extern struct { pub const VTable = extern struct { base: ID3D10Resource.VTable, Map: fn( self: *const ID3D10Texture1D, Subresource: u32, MapType: D3D10_MAP, MapFlags: u32, ppData: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unmap: fn( self: *const ID3D10Texture1D, Subresource: u32, ) callconv(@import("std").os.windows.WINAPI) void, GetDesc: fn( self: *const ID3D10Texture1D, pDesc: ?*D3D10_TEXTURE1D_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Resource.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture1D_Map(self: *const T, Subresource: u32, MapType: D3D10_MAP, MapFlags: u32, ppData: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Texture1D.VTable, self.vtable).Map(@ptrCast(*const ID3D10Texture1D, self), Subresource, MapType, MapFlags, ppData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture1D_Unmap(self: *const T, Subresource: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Texture1D.VTable, self.vtable).Unmap(@ptrCast(*const ID3D10Texture1D, self), Subresource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture1D_GetDesc(self: *const T, pDesc: ?*D3D10_TEXTURE1D_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10Texture1D.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10Texture1D, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_TEXTURE2D_DESC = extern struct { Width: u32, Height: u32, MipLevels: u32, ArraySize: u32, Format: DXGI_FORMAT, SampleDesc: DXGI_SAMPLE_DESC, Usage: D3D10_USAGE, BindFlags: u32, CPUAccessFlags: u32, MiscFlags: u32, }; pub const D3D10_MAPPED_TEXTURE2D = extern struct { pData: ?*c_void, RowPitch: u32, }; const IID_ID3D10Texture2D_Value = @import("../zig.zig").Guid.initString("9b7e4c04-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Texture2D = &IID_ID3D10Texture2D_Value; pub const ID3D10Texture2D = extern struct { pub const VTable = extern struct { base: ID3D10Resource.VTable, Map: fn( self: *const ID3D10Texture2D, Subresource: u32, MapType: D3D10_MAP, MapFlags: u32, pMappedTex2D: ?*D3D10_MAPPED_TEXTURE2D, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unmap: fn( self: *const ID3D10Texture2D, Subresource: u32, ) callconv(@import("std").os.windows.WINAPI) void, GetDesc: fn( self: *const ID3D10Texture2D, pDesc: ?*D3D10_TEXTURE2D_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Resource.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture2D_Map(self: *const T, Subresource: u32, MapType: D3D10_MAP, MapFlags: u32, pMappedTex2D: ?*D3D10_MAPPED_TEXTURE2D) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Texture2D.VTable, self.vtable).Map(@ptrCast(*const ID3D10Texture2D, self), Subresource, MapType, MapFlags, pMappedTex2D); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture2D_Unmap(self: *const T, Subresource: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Texture2D.VTable, self.vtable).Unmap(@ptrCast(*const ID3D10Texture2D, self), Subresource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture2D_GetDesc(self: *const T, pDesc: ?*D3D10_TEXTURE2D_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10Texture2D.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10Texture2D, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_TEXTURE3D_DESC = extern struct { Width: u32, Height: u32, Depth: u32, MipLevels: u32, Format: DXGI_FORMAT, Usage: D3D10_USAGE, BindFlags: u32, CPUAccessFlags: u32, MiscFlags: u32, }; pub const D3D10_MAPPED_TEXTURE3D = extern struct { pData: ?*c_void, RowPitch: u32, DepthPitch: u32, }; const IID_ID3D10Texture3D_Value = @import("../zig.zig").Guid.initString("9b7e4c05-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Texture3D = &IID_ID3D10Texture3D_Value; pub const ID3D10Texture3D = extern struct { pub const VTable = extern struct { base: ID3D10Resource.VTable, Map: fn( self: *const ID3D10Texture3D, Subresource: u32, MapType: D3D10_MAP, MapFlags: u32, pMappedTex3D: ?*D3D10_MAPPED_TEXTURE3D, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unmap: fn( self: *const ID3D10Texture3D, Subresource: u32, ) callconv(@import("std").os.windows.WINAPI) void, GetDesc: fn( self: *const ID3D10Texture3D, pDesc: ?*D3D10_TEXTURE3D_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Resource.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture3D_Map(self: *const T, Subresource: u32, MapType: D3D10_MAP, MapFlags: u32, pMappedTex3D: ?*D3D10_MAPPED_TEXTURE3D) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Texture3D.VTable, self.vtable).Map(@ptrCast(*const ID3D10Texture3D, self), Subresource, MapType, MapFlags, pMappedTex3D); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture3D_Unmap(self: *const T, Subresource: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Texture3D.VTable, self.vtable).Unmap(@ptrCast(*const ID3D10Texture3D, self), Subresource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Texture3D_GetDesc(self: *const T, pDesc: ?*D3D10_TEXTURE3D_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10Texture3D.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10Texture3D, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_TEXTURECUBE_FACE = enum(i32) { POSITIVE_X = 0, NEGATIVE_X = 1, POSITIVE_Y = 2, NEGATIVE_Y = 3, POSITIVE_Z = 4, NEGATIVE_Z = 5, }; pub const D3D10_TEXTURECUBE_FACE_POSITIVE_X = D3D10_TEXTURECUBE_FACE.POSITIVE_X; pub const D3D10_TEXTURECUBE_FACE_NEGATIVE_X = D3D10_TEXTURECUBE_FACE.NEGATIVE_X; pub const D3D10_TEXTURECUBE_FACE_POSITIVE_Y = D3D10_TEXTURECUBE_FACE.POSITIVE_Y; pub const D3D10_TEXTURECUBE_FACE_NEGATIVE_Y = D3D10_TEXTURECUBE_FACE.NEGATIVE_Y; pub const D3D10_TEXTURECUBE_FACE_POSITIVE_Z = D3D10_TEXTURECUBE_FACE.POSITIVE_Z; pub const D3D10_TEXTURECUBE_FACE_NEGATIVE_Z = D3D10_TEXTURECUBE_FACE.NEGATIVE_Z; const IID_ID3D10View_Value = @import("../zig.zig").Guid.initString("c902b03f-60a7-49ba-9936-2a3ab37a7e33"); pub const IID_ID3D10View = &IID_ID3D10View_Value; pub const ID3D10View = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, GetResource: fn( self: *const ID3D10View, ppResource: ?*?*ID3D10Resource, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10View_GetResource(self: *const T, ppResource: ?*?*ID3D10Resource) callconv(.Inline) void { return @ptrCast(*const ID3D10View.VTable, self.vtable).GetResource(@ptrCast(*const ID3D10View, self), ppResource); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_BUFFER_SRV = extern struct { Anonymous1: extern union { FirstElement: u32, ElementOffset: u32, }, Anonymous2: extern union { NumElements: u32, ElementWidth: u32, }, }; pub const D3D10_TEX1D_SRV = extern struct { MostDetailedMip: u32, MipLevels: u32, }; pub const D3D10_TEX1D_ARRAY_SRV = extern struct { MostDetailedMip: u32, MipLevels: u32, FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_TEX2D_SRV = extern struct { MostDetailedMip: u32, MipLevels: u32, }; pub const D3D10_TEX2D_ARRAY_SRV = extern struct { MostDetailedMip: u32, MipLevels: u32, FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_TEX3D_SRV = extern struct { MostDetailedMip: u32, MipLevels: u32, }; pub const D3D10_TEXCUBE_SRV = extern struct { MostDetailedMip: u32, MipLevels: u32, }; pub const D3D10_TEX2DMS_SRV = extern struct { UnusedField_NothingToDefine: u32, }; pub const D3D10_TEX2DMS_ARRAY_SRV = extern struct { FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_SHADER_RESOURCE_VIEW_DESC = extern struct { Format: DXGI_FORMAT, ViewDimension: D3D_SRV_DIMENSION, Anonymous: extern union { Buffer: D3D10_BUFFER_SRV, Texture1D: D3D10_TEX1D_SRV, Texture1DArray: D3D10_TEX1D_ARRAY_SRV, Texture2D: D3D10_TEX2D_SRV, Texture2DArray: D3D10_TEX2D_ARRAY_SRV, Texture2DMS: D3D10_TEX2DMS_SRV, Texture2DMSArray: D3D10_TEX2DMS_ARRAY_SRV, Texture3D: D3D10_TEX3D_SRV, TextureCube: D3D10_TEXCUBE_SRV, }, }; const IID_ID3D10ShaderResourceView_Value = @import("../zig.zig").Guid.initString("9b7e4c07-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10ShaderResourceView = &IID_ID3D10ShaderResourceView_Value; pub const ID3D10ShaderResourceView = extern struct { pub const VTable = extern struct { base: ID3D10View.VTable, GetDesc: fn( self: *const ID3D10ShaderResourceView, pDesc: ?*D3D10_SHADER_RESOURCE_VIEW_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10View.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderResourceView_GetDesc(self: *const T, pDesc: ?*D3D10_SHADER_RESOURCE_VIEW_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10ShaderResourceView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10ShaderResourceView, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_BUFFER_RTV = extern struct { Anonymous1: extern union { FirstElement: u32, ElementOffset: u32, }, Anonymous2: extern union { NumElements: u32, ElementWidth: u32, }, }; pub const D3D10_TEX1D_RTV = extern struct { MipSlice: u32, }; pub const D3D10_TEX1D_ARRAY_RTV = extern struct { MipSlice: u32, FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_TEX2D_RTV = extern struct { MipSlice: u32, }; pub const D3D10_TEX2DMS_RTV = extern struct { UnusedField_NothingToDefine: u32, }; pub const D3D10_TEX2D_ARRAY_RTV = extern struct { MipSlice: u32, FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_TEX2DMS_ARRAY_RTV = extern struct { FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_TEX3D_RTV = extern struct { MipSlice: u32, FirstWSlice: u32, WSize: u32, }; pub const D3D10_RENDER_TARGET_VIEW_DESC = extern struct { Format: DXGI_FORMAT, ViewDimension: D3D10_RTV_DIMENSION, Anonymous: extern union { Buffer: D3D10_BUFFER_RTV, Texture1D: D3D10_TEX1D_RTV, Texture1DArray: D3D10_TEX1D_ARRAY_RTV, Texture2D: D3D10_TEX2D_RTV, Texture2DArray: D3D10_TEX2D_ARRAY_RTV, Texture2DMS: D3D10_TEX2DMS_RTV, Texture2DMSArray: D3D10_TEX2DMS_ARRAY_RTV, Texture3D: D3D10_TEX3D_RTV, }, }; const IID_ID3D10RenderTargetView_Value = @import("../zig.zig").Guid.initString("9b7e4c08-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10RenderTargetView = &IID_ID3D10RenderTargetView_Value; pub const ID3D10RenderTargetView = extern struct { pub const VTable = extern struct { base: ID3D10View.VTable, GetDesc: fn( self: *const ID3D10RenderTargetView, pDesc: ?*D3D10_RENDER_TARGET_VIEW_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10View.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10RenderTargetView_GetDesc(self: *const T, pDesc: ?*D3D10_RENDER_TARGET_VIEW_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10RenderTargetView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10RenderTargetView, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_TEX1D_DSV = extern struct { MipSlice: u32, }; pub const D3D10_TEX1D_ARRAY_DSV = extern struct { MipSlice: u32, FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_TEX2D_DSV = extern struct { MipSlice: u32, }; pub const D3D10_TEX2D_ARRAY_DSV = extern struct { MipSlice: u32, FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_TEX2DMS_DSV = extern struct { UnusedField_NothingToDefine: u32, }; pub const D3D10_TEX2DMS_ARRAY_DSV = extern struct { FirstArraySlice: u32, ArraySize: u32, }; pub const D3D10_DEPTH_STENCIL_VIEW_DESC = extern struct { Format: DXGI_FORMAT, ViewDimension: D3D10_DSV_DIMENSION, Anonymous: extern union { Texture1D: D3D10_TEX1D_DSV, Texture1DArray: D3D10_TEX1D_ARRAY_DSV, Texture2D: D3D10_TEX2D_DSV, Texture2DArray: D3D10_TEX2D_ARRAY_DSV, Texture2DMS: D3D10_TEX2DMS_DSV, Texture2DMSArray: D3D10_TEX2DMS_ARRAY_DSV, }, }; const IID_ID3D10DepthStencilView_Value = @import("../zig.zig").Guid.initString("9b7e4c09-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10DepthStencilView = &IID_ID3D10DepthStencilView_Value; pub const ID3D10DepthStencilView = extern struct { pub const VTable = extern struct { base: ID3D10View.VTable, GetDesc: fn( self: *const ID3D10DepthStencilView, pDesc: ?*D3D10_DEPTH_STENCIL_VIEW_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10View.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10DepthStencilView_GetDesc(self: *const T, pDesc: ?*D3D10_DEPTH_STENCIL_VIEW_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10DepthStencilView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10DepthStencilView, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10VertexShader_Value = @import("../zig.zig").Guid.initString("9b7e4c0a-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10VertexShader = &IID_ID3D10VertexShader_Value; pub const ID3D10VertexShader = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10GeometryShader_Value = @import("../zig.zig").Guid.initString("6316be88-54cd-4040-ab44-20461bc81f68"); pub const IID_ID3D10GeometryShader = &IID_ID3D10GeometryShader_Value; pub const ID3D10GeometryShader = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10PixelShader_Value = @import("../zig.zig").Guid.initString("4968b601-9d00-4cde-8346-8e7f675819b6"); pub const IID_ID3D10PixelShader = &IID_ID3D10PixelShader_Value; pub const ID3D10PixelShader = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10InputLayout_Value = @import("../zig.zig").Guid.initString("9b7e4c0b-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10InputLayout = &IID_ID3D10InputLayout_Value; pub const ID3D10InputLayout = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_FILTER = enum(i32) { MIN_MAG_MIP_POINT = 0, MIN_MAG_POINT_MIP_LINEAR = 1, MIN_POINT_MAG_LINEAR_MIP_POINT = 4, MIN_POINT_MAG_MIP_LINEAR = 5, MIN_LINEAR_MAG_MIP_POINT = 16, MIN_LINEAR_MAG_POINT_MIP_LINEAR = 17, MIN_MAG_LINEAR_MIP_POINT = 20, MIN_MAG_MIP_LINEAR = 21, ANISOTROPIC = 85, COMPARISON_MIN_MAG_MIP_POINT = 128, COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 129, COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 132, COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 133, COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 144, COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 145, COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 148, COMPARISON_MIN_MAG_MIP_LINEAR = 149, COMPARISON_ANISOTROPIC = 213, TEXT_1BIT = -2147483648, }; pub const D3D10_FILTER_MIN_MAG_MIP_POINT = D3D10_FILTER.MIN_MAG_MIP_POINT; pub const D3D10_FILTER_MIN_MAG_POINT_MIP_LINEAR = D3D10_FILTER.MIN_MAG_POINT_MIP_LINEAR; pub const D3D10_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = D3D10_FILTER.MIN_POINT_MAG_LINEAR_MIP_POINT; pub const D3D10_FILTER_MIN_POINT_MAG_MIP_LINEAR = D3D10_FILTER.MIN_POINT_MAG_MIP_LINEAR; pub const D3D10_FILTER_MIN_LINEAR_MAG_MIP_POINT = D3D10_FILTER.MIN_LINEAR_MAG_MIP_POINT; pub const D3D10_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = D3D10_FILTER.MIN_LINEAR_MAG_POINT_MIP_LINEAR; pub const D3D10_FILTER_MIN_MAG_LINEAR_MIP_POINT = D3D10_FILTER.MIN_MAG_LINEAR_MIP_POINT; pub const D3D10_FILTER_MIN_MAG_MIP_LINEAR = D3D10_FILTER.MIN_MAG_MIP_LINEAR; pub const D3D10_FILTER_ANISOTROPIC = D3D10_FILTER.ANISOTROPIC; pub const D3D10_FILTER_COMPARISON_MIN_MAG_MIP_POINT = D3D10_FILTER.COMPARISON_MIN_MAG_MIP_POINT; pub const D3D10_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = D3D10_FILTER.COMPARISON_MIN_MAG_POINT_MIP_LINEAR; pub const D3D10_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = D3D10_FILTER.COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT; pub const D3D10_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = D3D10_FILTER.COMPARISON_MIN_POINT_MAG_MIP_LINEAR; pub const D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = D3D10_FILTER.COMPARISON_MIN_LINEAR_MAG_MIP_POINT; pub const D3D10_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = D3D10_FILTER.COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR; pub const D3D10_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = D3D10_FILTER.COMPARISON_MIN_MAG_LINEAR_MIP_POINT; pub const D3D10_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = D3D10_FILTER.COMPARISON_MIN_MAG_MIP_LINEAR; pub const D3D10_FILTER_COMPARISON_ANISOTROPIC = D3D10_FILTER.COMPARISON_ANISOTROPIC; pub const D3D10_FILTER_TEXT_1BIT = D3D10_FILTER.TEXT_1BIT; pub const D3D10_FILTER_TYPE = enum(i32) { POINT = 0, LINEAR = 1, }; pub const D3D10_FILTER_TYPE_POINT = D3D10_FILTER_TYPE.POINT; pub const D3D10_FILTER_TYPE_LINEAR = D3D10_FILTER_TYPE.LINEAR; pub const D3D10_TEXTURE_ADDRESS_MODE = enum(i32) { WRAP = 1, MIRROR = 2, CLAMP = 3, BORDER = 4, MIRROR_ONCE = 5, }; pub const D3D10_TEXTURE_ADDRESS_WRAP = D3D10_TEXTURE_ADDRESS_MODE.WRAP; pub const D3D10_TEXTURE_ADDRESS_MIRROR = D3D10_TEXTURE_ADDRESS_MODE.MIRROR; pub const D3D10_TEXTURE_ADDRESS_CLAMP = D3D10_TEXTURE_ADDRESS_MODE.CLAMP; pub const D3D10_TEXTURE_ADDRESS_BORDER = D3D10_TEXTURE_ADDRESS_MODE.BORDER; pub const D3D10_TEXTURE_ADDRESS_MIRROR_ONCE = D3D10_TEXTURE_ADDRESS_MODE.MIRROR_ONCE; pub const D3D10_SAMPLER_DESC = extern struct { Filter: D3D10_FILTER, AddressU: D3D10_TEXTURE_ADDRESS_MODE, AddressV: D3D10_TEXTURE_ADDRESS_MODE, AddressW: D3D10_TEXTURE_ADDRESS_MODE, MipLODBias: f32, MaxAnisotropy: u32, ComparisonFunc: D3D10_COMPARISON_FUNC, BorderColor: [4]f32, MinLOD: f32, MaxLOD: f32, }; const IID_ID3D10SamplerState_Value = @import("../zig.zig").Guid.initString("9b7e4c0c-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10SamplerState = &IID_ID3D10SamplerState_Value; pub const ID3D10SamplerState = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, GetDesc: fn( self: *const ID3D10SamplerState, pDesc: ?*D3D10_SAMPLER_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10SamplerState_GetDesc(self: *const T, pDesc: ?*D3D10_SAMPLER_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10SamplerState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10SamplerState, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_FORMAT_SUPPORT = enum(i32) { BUFFER = 1, IA_VERTEX_BUFFER = 2, IA_INDEX_BUFFER = 4, SO_BUFFER = 8, TEXTURE1D = 16, TEXTURE2D = 32, TEXTURE3D = 64, TEXTURECUBE = 128, SHADER_LOAD = 256, SHADER_SAMPLE = 512, SHADER_SAMPLE_COMPARISON = 1024, SHADER_SAMPLE_MONO_TEXT = 2048, MIP = 4096, MIP_AUTOGEN = 8192, RENDER_TARGET = 16384, BLENDABLE = 32768, DEPTH_STENCIL = 65536, CPU_LOCKABLE = 131072, MULTISAMPLE_RESOLVE = 262144, DISPLAY = 524288, CAST_WITHIN_BIT_LAYOUT = 1048576, MULTISAMPLE_RENDERTARGET = 2097152, MULTISAMPLE_LOAD = 4194304, SHADER_GATHER = 8388608, BACK_BUFFER_CAST = 16777216, }; pub const D3D10_FORMAT_SUPPORT_BUFFER = D3D10_FORMAT_SUPPORT.BUFFER; pub const D3D10_FORMAT_SUPPORT_IA_VERTEX_BUFFER = D3D10_FORMAT_SUPPORT.IA_VERTEX_BUFFER; pub const D3D10_FORMAT_SUPPORT_IA_INDEX_BUFFER = D3D10_FORMAT_SUPPORT.IA_INDEX_BUFFER; pub const D3D10_FORMAT_SUPPORT_SO_BUFFER = D3D10_FORMAT_SUPPORT.SO_BUFFER; pub const D3D10_FORMAT_SUPPORT_TEXTURE1D = D3D10_FORMAT_SUPPORT.TEXTURE1D; pub const D3D10_FORMAT_SUPPORT_TEXTURE2D = D3D10_FORMAT_SUPPORT.TEXTURE2D; pub const D3D10_FORMAT_SUPPORT_TEXTURE3D = D3D10_FORMAT_SUPPORT.TEXTURE3D; pub const D3D10_FORMAT_SUPPORT_TEXTURECUBE = D3D10_FORMAT_SUPPORT.TEXTURECUBE; pub const D3D10_FORMAT_SUPPORT_SHADER_LOAD = D3D10_FORMAT_SUPPORT.SHADER_LOAD; pub const D3D10_FORMAT_SUPPORT_SHADER_SAMPLE = D3D10_FORMAT_SUPPORT.SHADER_SAMPLE; pub const D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = D3D10_FORMAT_SUPPORT.SHADER_SAMPLE_COMPARISON; pub const D3D10_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = D3D10_FORMAT_SUPPORT.SHADER_SAMPLE_MONO_TEXT; pub const D3D10_FORMAT_SUPPORT_MIP = D3D10_FORMAT_SUPPORT.MIP; pub const D3D10_FORMAT_SUPPORT_MIP_AUTOGEN = D3D10_FORMAT_SUPPORT.MIP_AUTOGEN; pub const D3D10_FORMAT_SUPPORT_RENDER_TARGET = D3D10_FORMAT_SUPPORT.RENDER_TARGET; pub const D3D10_FORMAT_SUPPORT_BLENDABLE = D3D10_FORMAT_SUPPORT.BLENDABLE; pub const D3D10_FORMAT_SUPPORT_DEPTH_STENCIL = D3D10_FORMAT_SUPPORT.DEPTH_STENCIL; pub const D3D10_FORMAT_SUPPORT_CPU_LOCKABLE = D3D10_FORMAT_SUPPORT.CPU_LOCKABLE; pub const D3D10_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = D3D10_FORMAT_SUPPORT.MULTISAMPLE_RESOLVE; pub const D3D10_FORMAT_SUPPORT_DISPLAY = D3D10_FORMAT_SUPPORT.DISPLAY; pub const D3D10_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = D3D10_FORMAT_SUPPORT.CAST_WITHIN_BIT_LAYOUT; pub const D3D10_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = D3D10_FORMAT_SUPPORT.MULTISAMPLE_RENDERTARGET; pub const D3D10_FORMAT_SUPPORT_MULTISAMPLE_LOAD = D3D10_FORMAT_SUPPORT.MULTISAMPLE_LOAD; pub const D3D10_FORMAT_SUPPORT_SHADER_GATHER = D3D10_FORMAT_SUPPORT.SHADER_GATHER; pub const D3D10_FORMAT_SUPPORT_BACK_BUFFER_CAST = D3D10_FORMAT_SUPPORT.BACK_BUFFER_CAST; const IID_ID3D10Asynchronous_Value = @import("../zig.zig").Guid.initString("9b7e4c0d-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Asynchronous = &IID_ID3D10Asynchronous_Value; pub const ID3D10Asynchronous = extern struct { pub const VTable = extern struct { base: ID3D10DeviceChild.VTable, Begin: fn( self: *const ID3D10Asynchronous, ) callconv(@import("std").os.windows.WINAPI) void, End: fn( self: *const ID3D10Asynchronous, ) callconv(@import("std").os.windows.WINAPI) void, GetData: fn( self: *const ID3D10Asynchronous, // TODO: what to do with BytesParamIndex 1? pData: ?*c_void, DataSize: u32, GetDataFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDataSize: fn( self: *const ID3D10Asynchronous, ) callconv(@import("std").os.windows.WINAPI) u32, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10DeviceChild.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Asynchronous_Begin(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Asynchronous.VTable, self.vtable).Begin(@ptrCast(*const ID3D10Asynchronous, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Asynchronous_End(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Asynchronous.VTable, self.vtable).End(@ptrCast(*const ID3D10Asynchronous, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Asynchronous_GetData(self: *const T, pData: ?*c_void, DataSize: u32, GetDataFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Asynchronous.VTable, self.vtable).GetData(@ptrCast(*const ID3D10Asynchronous, self), pData, DataSize, GetDataFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Asynchronous_GetDataSize(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10Asynchronous.VTable, self.vtable).GetDataSize(@ptrCast(*const ID3D10Asynchronous, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_ASYNC_GETDATA_FLAG = enum(i32) { H = 1, }; pub const D3D10_ASYNC_GETDATA_DONOTFLUSH = D3D10_ASYNC_GETDATA_FLAG.H; pub const D3D10_QUERY = enum(i32) { EVENT = 0, OCCLUSION = 1, TIMESTAMP = 2, TIMESTAMP_DISJOINT = 3, PIPELINE_STATISTICS = 4, OCCLUSION_PREDICATE = 5, SO_STATISTICS = 6, SO_OVERFLOW_PREDICATE = 7, }; pub const D3D10_QUERY_EVENT = D3D10_QUERY.EVENT; pub const D3D10_QUERY_OCCLUSION = D3D10_QUERY.OCCLUSION; pub const D3D10_QUERY_TIMESTAMP = D3D10_QUERY.TIMESTAMP; pub const D3D10_QUERY_TIMESTAMP_DISJOINT = D3D10_QUERY.TIMESTAMP_DISJOINT; pub const D3D10_QUERY_PIPELINE_STATISTICS = D3D10_QUERY.PIPELINE_STATISTICS; pub const D3D10_QUERY_OCCLUSION_PREDICATE = D3D10_QUERY.OCCLUSION_PREDICATE; pub const D3D10_QUERY_SO_STATISTICS = D3D10_QUERY.SO_STATISTICS; pub const D3D10_QUERY_SO_OVERFLOW_PREDICATE = D3D10_QUERY.SO_OVERFLOW_PREDICATE; pub const D3D10_QUERY_MISC_FLAG = enum(i32) { T = 1, }; pub const D3D10_QUERY_MISC_PREDICATEHINT = D3D10_QUERY_MISC_FLAG.T; pub const D3D10_QUERY_DESC = extern struct { Query: D3D10_QUERY, MiscFlags: u32, }; const IID_ID3D10Query_Value = @import("../zig.zig").Guid.initString("9b7e4c0e-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Query = &IID_ID3D10Query_Value; pub const ID3D10Query = extern struct { pub const VTable = extern struct { base: ID3D10Asynchronous.VTable, GetDesc: fn( self: *const ID3D10Query, pDesc: ?*D3D10_QUERY_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Asynchronous.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Query_GetDesc(self: *const T, pDesc: ?*D3D10_QUERY_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10Query.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10Query, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10Predicate_Value = @import("../zig.zig").Guid.initString("9b7e4c10-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Predicate = &IID_ID3D10Predicate_Value; pub const ID3D10Predicate = extern struct { pub const VTable = extern struct { base: ID3D10Query.VTable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Query.MethodMixin(T); };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_QUERY_DATA_TIMESTAMP_DISJOINT = extern struct { Frequency: u64, Disjoint: BOOL, }; pub const D3D10_QUERY_DATA_PIPELINE_STATISTICS = extern struct { IAVertices: u64, IAPrimitives: u64, VSInvocations: u64, GSInvocations: u64, GSPrimitives: u64, CInvocations: u64, CPrimitives: u64, PSInvocations: u64, }; pub const D3D10_QUERY_DATA_SO_STATISTICS = extern struct { NumPrimitivesWritten: u64, PrimitivesStorageNeeded: u64, }; pub const D3D10_COUNTER = enum(i32) { GPU_IDLE = 0, VERTEX_PROCESSING = 1, GEOMETRY_PROCESSING = 2, PIXEL_PROCESSING = 3, OTHER_GPU_PROCESSING = 4, HOST_ADAPTER_BANDWIDTH_UTILIZATION = 5, LOCAL_VIDMEM_BANDWIDTH_UTILIZATION = 6, VERTEX_THROUGHPUT_UTILIZATION = 7, TRIANGLE_SETUP_THROUGHPUT_UTILIZATION = 8, FILLRATE_THROUGHPUT_UTILIZATION = 9, VS_MEMORY_LIMITED = 10, VS_COMPUTATION_LIMITED = 11, GS_MEMORY_LIMITED = 12, GS_COMPUTATION_LIMITED = 13, PS_MEMORY_LIMITED = 14, PS_COMPUTATION_LIMITED = 15, POST_TRANSFORM_CACHE_HIT_RATE = 16, TEXTURE_CACHE_HIT_RATE = 17, DEVICE_DEPENDENT_0 = 1073741824, }; pub const D3D10_COUNTER_GPU_IDLE = D3D10_COUNTER.GPU_IDLE; pub const D3D10_COUNTER_VERTEX_PROCESSING = D3D10_COUNTER.VERTEX_PROCESSING; pub const D3D10_COUNTER_GEOMETRY_PROCESSING = D3D10_COUNTER.GEOMETRY_PROCESSING; pub const D3D10_COUNTER_PIXEL_PROCESSING = D3D10_COUNTER.PIXEL_PROCESSING; pub const D3D10_COUNTER_OTHER_GPU_PROCESSING = D3D10_COUNTER.OTHER_GPU_PROCESSING; pub const D3D10_COUNTER_HOST_ADAPTER_BANDWIDTH_UTILIZATION = D3D10_COUNTER.HOST_ADAPTER_BANDWIDTH_UTILIZATION; pub const D3D10_COUNTER_LOCAL_VIDMEM_BANDWIDTH_UTILIZATION = D3D10_COUNTER.LOCAL_VIDMEM_BANDWIDTH_UTILIZATION; pub const D3D10_COUNTER_VERTEX_THROUGHPUT_UTILIZATION = D3D10_COUNTER.VERTEX_THROUGHPUT_UTILIZATION; pub const D3D10_COUNTER_TRIANGLE_SETUP_THROUGHPUT_UTILIZATION = D3D10_COUNTER.TRIANGLE_SETUP_THROUGHPUT_UTILIZATION; pub const D3D10_COUNTER_FILLRATE_THROUGHPUT_UTILIZATION = D3D10_COUNTER.FILLRATE_THROUGHPUT_UTILIZATION; pub const D3D10_COUNTER_VS_MEMORY_LIMITED = D3D10_COUNTER.VS_MEMORY_LIMITED; pub const D3D10_COUNTER_VS_COMPUTATION_LIMITED = D3D10_COUNTER.VS_COMPUTATION_LIMITED; pub const D3D10_COUNTER_GS_MEMORY_LIMITED = D3D10_COUNTER.GS_MEMORY_LIMITED; pub const D3D10_COUNTER_GS_COMPUTATION_LIMITED = D3D10_COUNTER.GS_COMPUTATION_LIMITED; pub const D3D10_COUNTER_PS_MEMORY_LIMITED = D3D10_COUNTER.PS_MEMORY_LIMITED; pub const D3D10_COUNTER_PS_COMPUTATION_LIMITED = D3D10_COUNTER.PS_COMPUTATION_LIMITED; pub const D3D10_COUNTER_POST_TRANSFORM_CACHE_HIT_RATE = D3D10_COUNTER.POST_TRANSFORM_CACHE_HIT_RATE; pub const D3D10_COUNTER_TEXTURE_CACHE_HIT_RATE = D3D10_COUNTER.TEXTURE_CACHE_HIT_RATE; pub const D3D10_COUNTER_DEVICE_DEPENDENT_0 = D3D10_COUNTER.DEVICE_DEPENDENT_0; pub const D3D10_COUNTER_TYPE = enum(i32) { FLOAT32 = 0, UINT16 = 1, UINT32 = 2, UINT64 = 3, }; pub const D3D10_COUNTER_TYPE_FLOAT32 = D3D10_COUNTER_TYPE.FLOAT32; pub const D3D10_COUNTER_TYPE_UINT16 = D3D10_COUNTER_TYPE.UINT16; pub const D3D10_COUNTER_TYPE_UINT32 = D3D10_COUNTER_TYPE.UINT32; pub const D3D10_COUNTER_TYPE_UINT64 = D3D10_COUNTER_TYPE.UINT64; pub const D3D10_COUNTER_DESC = extern struct { Counter: D3D10_COUNTER, MiscFlags: u32, }; pub const D3D10_COUNTER_INFO = extern struct { LastDeviceDependentCounter: D3D10_COUNTER, NumSimultaneousCounters: u32, NumDetectableParallelUnits: u8, }; const IID_ID3D10Counter_Value = @import("../zig.zig").Guid.initString("9b7e4c11-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Counter = &IID_ID3D10Counter_Value; pub const ID3D10Counter = extern struct { pub const VTable = extern struct { base: ID3D10Asynchronous.VTable, GetDesc: fn( self: *const ID3D10Counter, pDesc: ?*D3D10_COUNTER_DESC, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Asynchronous.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Counter_GetDesc(self: *const T, pDesc: ?*D3D10_COUNTER_DESC) callconv(.Inline) void { return @ptrCast(*const ID3D10Counter.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10Counter, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10Device_Value = @import("../zig.zig").Guid.initString("9b7e4c0f-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Device = &IID_ID3D10Device_Value; pub const ID3D10Device = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, VSSetConstantBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) void, PSSetShaderResources: fn( self: *const ID3D10Device, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) void, PSSetShader: fn( self: *const ID3D10Device, pPixelShader: ?*ID3D10PixelShader, ) callconv(@import("std").os.windows.WINAPI) void, PSSetSamplers: fn( self: *const ID3D10Device, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) void, VSSetShader: fn( self: *const ID3D10Device, pVertexShader: ?*ID3D10VertexShader, ) callconv(@import("std").os.windows.WINAPI) void, DrawIndexed: fn( self: *const ID3D10Device, IndexCount: u32, StartIndexLocation: u32, BaseVertexLocation: i32, ) callconv(@import("std").os.windows.WINAPI) void, Draw: fn( self: *const ID3D10Device, VertexCount: u32, StartVertexLocation: u32, ) callconv(@import("std").os.windows.WINAPI) void, PSSetConstantBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) void, IASetInputLayout: fn( self: *const ID3D10Device, pInputLayout: ?*ID3D10InputLayout, ) callconv(@import("std").os.windows.WINAPI) void, IASetVertexBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppVertexBuffers: ?[*]?*ID3D10Buffer, pStrides: ?[*]const u32, pOffsets: ?[*]const u32, ) callconv(@import("std").os.windows.WINAPI) void, IASetIndexBuffer: fn( self: *const ID3D10Device, pIndexBuffer: ?*ID3D10Buffer, Format: DXGI_FORMAT, Offset: u32, ) callconv(@import("std").os.windows.WINAPI) void, DrawIndexedInstanced: fn( self: *const ID3D10Device, IndexCountPerInstance: u32, InstanceCount: u32, StartIndexLocation: u32, BaseVertexLocation: i32, StartInstanceLocation: u32, ) callconv(@import("std").os.windows.WINAPI) void, DrawInstanced: fn( self: *const ID3D10Device, VertexCountPerInstance: u32, InstanceCount: u32, StartVertexLocation: u32, StartInstanceLocation: u32, ) callconv(@import("std").os.windows.WINAPI) void, GSSetConstantBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) void, GSSetShader: fn( self: *const ID3D10Device, pShader: ?*ID3D10GeometryShader, ) callconv(@import("std").os.windows.WINAPI) void, IASetPrimitiveTopology: fn( self: *const ID3D10Device, Topology: D3D_PRIMITIVE_TOPOLOGY, ) callconv(@import("std").os.windows.WINAPI) void, VSSetShaderResources: fn( self: *const ID3D10Device, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) void, VSSetSamplers: fn( self: *const ID3D10Device, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) void, SetPredication: fn( self: *const ID3D10Device, pPredicate: ?*ID3D10Predicate, PredicateValue: BOOL, ) callconv(@import("std").os.windows.WINAPI) void, GSSetShaderResources: fn( self: *const ID3D10Device, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) void, GSSetSamplers: fn( self: *const ID3D10Device, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) void, OMSetRenderTargets: fn( self: *const ID3D10Device, NumViews: u32, ppRenderTargetViews: ?[*]?*ID3D10RenderTargetView, pDepthStencilView: ?*ID3D10DepthStencilView, ) callconv(@import("std").os.windows.WINAPI) void, OMSetBlendState: fn( self: *const ID3D10Device, pBlendState: ?*ID3D10BlendState, BlendFactor: ?*const f32, SampleMask: u32, ) callconv(@import("std").os.windows.WINAPI) void, OMSetDepthStencilState: fn( self: *const ID3D10Device, pDepthStencilState: ?*ID3D10DepthStencilState, StencilRef: u32, ) callconv(@import("std").os.windows.WINAPI) void, SOSetTargets: fn( self: *const ID3D10Device, NumBuffers: u32, ppSOTargets: ?[*]?*ID3D10Buffer, pOffsets: ?[*]const u32, ) callconv(@import("std").os.windows.WINAPI) void, DrawAuto: fn( self: *const ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) void, RSSetState: fn( self: *const ID3D10Device, pRasterizerState: ?*ID3D10RasterizerState, ) callconv(@import("std").os.windows.WINAPI) void, RSSetViewports: fn( self: *const ID3D10Device, NumViewports: u32, pViewports: ?[*]const D3D10_VIEWPORT, ) callconv(@import("std").os.windows.WINAPI) void, RSSetScissorRects: fn( self: *const ID3D10Device, NumRects: u32, pRects: ?[*]const RECT, ) callconv(@import("std").os.windows.WINAPI) void, CopySubresourceRegion: fn( self: *const ID3D10Device, pDstResource: ?*ID3D10Resource, DstSubresource: u32, DstX: u32, DstY: u32, DstZ: u32, pSrcResource: ?*ID3D10Resource, SrcSubresource: u32, pSrcBox: ?*const D3D10_BOX, ) callconv(@import("std").os.windows.WINAPI) void, CopyResource: fn( self: *const ID3D10Device, pDstResource: ?*ID3D10Resource, pSrcResource: ?*ID3D10Resource, ) callconv(@import("std").os.windows.WINAPI) void, UpdateSubresource: fn( self: *const ID3D10Device, pDstResource: ?*ID3D10Resource, DstSubresource: u32, pDstBox: ?*const D3D10_BOX, pSrcData: ?*const c_void, SrcRowPitch: u32, SrcDepthPitch: u32, ) callconv(@import("std").os.windows.WINAPI) void, ClearRenderTargetView: fn( self: *const ID3D10Device, pRenderTargetView: ?*ID3D10RenderTargetView, ColorRGBA: ?*const f32, ) callconv(@import("std").os.windows.WINAPI) void, ClearDepthStencilView: fn( self: *const ID3D10Device, pDepthStencilView: ?*ID3D10DepthStencilView, ClearFlags: u32, Depth: f32, Stencil: u8, ) callconv(@import("std").os.windows.WINAPI) void, GenerateMips: fn( self: *const ID3D10Device, pShaderResourceView: ?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) void, ResolveSubresource: fn( self: *const ID3D10Device, pDstResource: ?*ID3D10Resource, DstSubresource: u32, pSrcResource: ?*ID3D10Resource, SrcSubresource: u32, Format: DXGI_FORMAT, ) callconv(@import("std").os.windows.WINAPI) void, VSGetConstantBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) void, PSGetShaderResources: fn( self: *const ID3D10Device, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) void, PSGetShader: fn( self: *const ID3D10Device, ppPixelShader: ?*?*ID3D10PixelShader, ) callconv(@import("std").os.windows.WINAPI) void, PSGetSamplers: fn( self: *const ID3D10Device, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) void, VSGetShader: fn( self: *const ID3D10Device, ppVertexShader: ?*?*ID3D10VertexShader, ) callconv(@import("std").os.windows.WINAPI) void, PSGetConstantBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) void, IAGetInputLayout: fn( self: *const ID3D10Device, ppInputLayout: ?*?*ID3D10InputLayout, ) callconv(@import("std").os.windows.WINAPI) void, IAGetVertexBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppVertexBuffers: ?[*]?*ID3D10Buffer, pStrides: ?[*]u32, pOffsets: ?[*]u32, ) callconv(@import("std").os.windows.WINAPI) void, IAGetIndexBuffer: fn( self: *const ID3D10Device, pIndexBuffer: ?*?*ID3D10Buffer, Format: ?*DXGI_FORMAT, Offset: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void, GSGetConstantBuffers: fn( self: *const ID3D10Device, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) void, GSGetShader: fn( self: *const ID3D10Device, ppGeometryShader: ?*?*ID3D10GeometryShader, ) callconv(@import("std").os.windows.WINAPI) void, IAGetPrimitiveTopology: fn( self: *const ID3D10Device, pTopology: ?*D3D_PRIMITIVE_TOPOLOGY, ) callconv(@import("std").os.windows.WINAPI) void, VSGetShaderResources: fn( self: *const ID3D10Device, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) void, VSGetSamplers: fn( self: *const ID3D10Device, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) void, GetPredication: fn( self: *const ID3D10Device, ppPredicate: ?*?*ID3D10Predicate, pPredicateValue: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) void, GSGetShaderResources: fn( self: *const ID3D10Device, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) void, GSGetSamplers: fn( self: *const ID3D10Device, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) void, OMGetRenderTargets: fn( self: *const ID3D10Device, NumViews: u32, ppRenderTargetViews: ?[*]?*ID3D10RenderTargetView, ppDepthStencilView: ?*?*ID3D10DepthStencilView, ) callconv(@import("std").os.windows.WINAPI) void, OMGetBlendState: fn( self: *const ID3D10Device, ppBlendState: ?*?*ID3D10BlendState, BlendFactor: ?*f32, pSampleMask: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void, OMGetDepthStencilState: fn( self: *const ID3D10Device, ppDepthStencilState: ?*?*ID3D10DepthStencilState, pStencilRef: ?*u32, ) callconv(@import("std").os.windows.WINAPI) void, SOGetTargets: fn( self: *const ID3D10Device, NumBuffers: u32, ppSOTargets: ?[*]?*ID3D10Buffer, pOffsets: ?[*]u32, ) callconv(@import("std").os.windows.WINAPI) void, RSGetState: fn( self: *const ID3D10Device, ppRasterizerState: ?*?*ID3D10RasterizerState, ) callconv(@import("std").os.windows.WINAPI) void, RSGetViewports: fn( self: *const ID3D10Device, NumViewports: ?*u32, pViewports: ?[*]D3D10_VIEWPORT, ) callconv(@import("std").os.windows.WINAPI) void, RSGetScissorRects: fn( self: *const ID3D10Device, NumRects: ?*u32, pRects: ?[*]RECT, ) callconv(@import("std").os.windows.WINAPI) void, GetDeviceRemovedReason: fn( self: *const ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetExceptionMode: fn( self: *const ID3D10Device, RaiseFlags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetExceptionMode: fn( self: *const ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) u32, GetPrivateData: fn( self: *const ID3D10Device, guid: ?*const Guid, pDataSize: ?*u32, // TODO: what to do with BytesParamIndex 1? pData: ?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPrivateData: fn( self: *const ID3D10Device, guid: ?*const Guid, DataSize: u32, // TODO: what to do with BytesParamIndex 1? pData: ?*const c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetPrivateDataInterface: fn( self: *const ID3D10Device, guid: ?*const Guid, pData: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClearState: fn( self: *const ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) void, Flush: fn( self: *const ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) void, CreateBuffer: fn( self: *const ID3D10Device, pDesc: ?*const D3D10_BUFFER_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppBuffer: ?*?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateTexture1D: fn( self: *const ID3D10Device, pDesc: ?*const D3D10_TEXTURE1D_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppTexture1D: ?*?*ID3D10Texture1D, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateTexture2D: fn( self: *const ID3D10Device, pDesc: ?*const D3D10_TEXTURE2D_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppTexture2D: ?*?*ID3D10Texture2D, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateTexture3D: fn( self: *const ID3D10Device, pDesc: ?*const D3D10_TEXTURE3D_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppTexture3D: ?*?*ID3D10Texture3D, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateShaderResourceView: fn( self: *const ID3D10Device, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_SHADER_RESOURCE_VIEW_DESC, ppSRView: ?*?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateRenderTargetView: fn( self: *const ID3D10Device, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_RENDER_TARGET_VIEW_DESC, ppRTView: ?*?*ID3D10RenderTargetView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateDepthStencilView: fn( self: *const ID3D10Device, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_DEPTH_STENCIL_VIEW_DESC, ppDepthStencilView: ?*?*ID3D10DepthStencilView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateInputLayout: fn( self: *const ID3D10Device, pInputElementDescs: [*]const D3D10_INPUT_ELEMENT_DESC, NumElements: u32, pShaderBytecodeWithInputSignature: [*]const u8, BytecodeLength: usize, ppInputLayout: ?*?*ID3D10InputLayout, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateVertexShader: fn( self: *const ID3D10Device, pShaderBytecode: [*]const u8, BytecodeLength: usize, ppVertexShader: ?*?*ID3D10VertexShader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateGeometryShader: fn( self: *const ID3D10Device, pShaderBytecode: [*]const u8, BytecodeLength: usize, ppGeometryShader: ?*?*ID3D10GeometryShader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateGeometryShaderWithStreamOutput: fn( self: *const ID3D10Device, pShaderBytecode: [*]const u8, BytecodeLength: usize, pSODeclaration: ?[*]const D3D10_SO_DECLARATION_ENTRY, NumEntries: u32, OutputStreamStride: u32, ppGeometryShader: ?*?*ID3D10GeometryShader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreatePixelShader: fn( self: *const ID3D10Device, pShaderBytecode: [*]const u8, BytecodeLength: usize, ppPixelShader: ?*?*ID3D10PixelShader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlendState: fn( self: *const ID3D10Device, pBlendStateDesc: ?*const D3D10_BLEND_DESC, ppBlendState: ?*?*ID3D10BlendState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateDepthStencilState: fn( self: *const ID3D10Device, pDepthStencilDesc: ?*const D3D10_DEPTH_STENCIL_DESC, ppDepthStencilState: ?*?*ID3D10DepthStencilState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateRasterizerState: fn( self: *const ID3D10Device, pRasterizerDesc: ?*const D3D10_RASTERIZER_DESC, ppRasterizerState: ?*?*ID3D10RasterizerState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateSamplerState: fn( self: *const ID3D10Device, pSamplerDesc: ?*const D3D10_SAMPLER_DESC, ppSamplerState: ?*?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateQuery: fn( self: *const ID3D10Device, pQueryDesc: ?*const D3D10_QUERY_DESC, ppQuery: ?*?*ID3D10Query, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreatePredicate: fn( self: *const ID3D10Device, pPredicateDesc: ?*const D3D10_QUERY_DESC, ppPredicate: ?*?*ID3D10Predicate, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateCounter: fn( self: *const ID3D10Device, pCounterDesc: ?*const D3D10_COUNTER_DESC, ppCounter: ?*?*ID3D10Counter, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CheckFormatSupport: fn( self: *const ID3D10Device, Format: DXGI_FORMAT, pFormatSupport: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CheckMultisampleQualityLevels: fn( self: *const ID3D10Device, Format: DXGI_FORMAT, SampleCount: u32, pNumQualityLevels: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CheckCounterInfo: fn( self: *const ID3D10Device, pCounterInfo: ?*D3D10_COUNTER_INFO, ) callconv(@import("std").os.windows.WINAPI) void, CheckCounter: fn( self: *const ID3D10Device, pDesc: ?*const D3D10_COUNTER_DESC, pType: ?*D3D10_COUNTER_TYPE, pActiveCounters: ?*u32, szName: ?[*:0]u8, pNameLength: ?*u32, szUnits: ?[*:0]u8, pUnitsLength: ?*u32, szDescription: ?[*:0]u8, pDescriptionLength: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetCreationFlags: fn( self: *const ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) u32, OpenSharedResource: fn( self: *const ID3D10Device, hResource: ?HANDLE, ReturnedInterface: ?*const Guid, ppResource: ?*?*c_void, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTextFilterSize: fn( self: *const ID3D10Device, Width: u32, Height: u32, ) callconv(@import("std").os.windows.WINAPI) void, GetTextFilterSize: fn( self: *const ID3D10Device, pWidth: ?*u32, pHeight: ?*u32, ) 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 ID3D10Device_VSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSSetConstantBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppConstantBuffers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSSetShaderResources(@ptrCast(*const ID3D10Device, self), StartSlot, NumViews, ppShaderResourceViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSSetShader(self: *const T, pPixelShader: ?*ID3D10PixelShader) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSSetShader(@ptrCast(*const ID3D10Device, self), pPixelShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSSetSamplers(@ptrCast(*const ID3D10Device, self), StartSlot, NumSamplers, ppSamplers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_VSSetShader(self: *const T, pVertexShader: ?*ID3D10VertexShader) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSSetShader(@ptrCast(*const ID3D10Device, self), pVertexShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_DrawIndexed(self: *const T, IndexCount: u32, StartIndexLocation: u32, BaseVertexLocation: i32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).DrawIndexed(@ptrCast(*const ID3D10Device, self), IndexCount, StartIndexLocation, BaseVertexLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_Draw(self: *const T, VertexCount: u32, StartVertexLocation: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).Draw(@ptrCast(*const ID3D10Device, self), VertexCount, StartVertexLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSSetConstantBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppConstantBuffers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IASetInputLayout(self: *const T, pInputLayout: ?*ID3D10InputLayout) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IASetInputLayout(@ptrCast(*const ID3D10Device, self), pInputLayout); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IASetVertexBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppVertexBuffers: ?[*]?*ID3D10Buffer, pStrides: ?[*]const u32, pOffsets: ?[*]const u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IASetVertexBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IASetIndexBuffer(self: *const T, pIndexBuffer: ?*ID3D10Buffer, Format: DXGI_FORMAT, Offset: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IASetIndexBuffer(@ptrCast(*const ID3D10Device, self), pIndexBuffer, Format, Offset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_DrawIndexedInstanced(self: *const T, IndexCountPerInstance: u32, InstanceCount: u32, StartIndexLocation: u32, BaseVertexLocation: i32, StartInstanceLocation: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).DrawIndexedInstanced(@ptrCast(*const ID3D10Device, self), IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_DrawInstanced(self: *const T, VertexCountPerInstance: u32, InstanceCount: u32, StartVertexLocation: u32, StartInstanceLocation: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).DrawInstanced(@ptrCast(*const ID3D10Device, self), VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSSetConstantBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppConstantBuffers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSSetShader(self: *const T, pShader: ?*ID3D10GeometryShader) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSSetShader(@ptrCast(*const ID3D10Device, self), pShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IASetPrimitiveTopology(self: *const T, Topology: D3D_PRIMITIVE_TOPOLOGY) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IASetPrimitiveTopology(@ptrCast(*const ID3D10Device, self), Topology); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_VSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSSetShaderResources(@ptrCast(*const ID3D10Device, self), StartSlot, NumViews, ppShaderResourceViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_VSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSSetSamplers(@ptrCast(*const ID3D10Device, self), StartSlot, NumSamplers, ppSamplers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_SetPredication(self: *const T, pPredicate: ?*ID3D10Predicate, PredicateValue: BOOL) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).SetPredication(@ptrCast(*const ID3D10Device, self), pPredicate, PredicateValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSSetShaderResources(@ptrCast(*const ID3D10Device, self), StartSlot, NumViews, ppShaderResourceViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSSetSamplers(@ptrCast(*const ID3D10Device, self), StartSlot, NumSamplers, ppSamplers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_OMSetRenderTargets(self: *const T, NumViews: u32, ppRenderTargetViews: ?[*]?*ID3D10RenderTargetView, pDepthStencilView: ?*ID3D10DepthStencilView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).OMSetRenderTargets(@ptrCast(*const ID3D10Device, self), NumViews, ppRenderTargetViews, pDepthStencilView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_OMSetBlendState(self: *const T, pBlendState: ?*ID3D10BlendState, BlendFactor: ?*const f32, SampleMask: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).OMSetBlendState(@ptrCast(*const ID3D10Device, self), pBlendState, BlendFactor, SampleMask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_OMSetDepthStencilState(self: *const T, pDepthStencilState: ?*ID3D10DepthStencilState, StencilRef: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).OMSetDepthStencilState(@ptrCast(*const ID3D10Device, self), pDepthStencilState, StencilRef); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_SOSetTargets(self: *const T, NumBuffers: u32, ppSOTargets: ?[*]?*ID3D10Buffer, pOffsets: ?[*]const u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).SOSetTargets(@ptrCast(*const ID3D10Device, self), NumBuffers, ppSOTargets, pOffsets); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_DrawAuto(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).DrawAuto(@ptrCast(*const ID3D10Device, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_RSSetState(self: *const T, pRasterizerState: ?*ID3D10RasterizerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).RSSetState(@ptrCast(*const ID3D10Device, self), pRasterizerState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_RSSetViewports(self: *const T, NumViewports: u32, pViewports: ?[*]const D3D10_VIEWPORT) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).RSSetViewports(@ptrCast(*const ID3D10Device, self), NumViewports, pViewports); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_RSSetScissorRects(self: *const T, NumRects: u32, pRects: ?[*]const RECT) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).RSSetScissorRects(@ptrCast(*const ID3D10Device, self), NumRects, pRects); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CopySubresourceRegion(self: *const T, pDstResource: ?*ID3D10Resource, DstSubresource: u32, DstX: u32, DstY: u32, DstZ: u32, pSrcResource: ?*ID3D10Resource, SrcSubresource: u32, pSrcBox: ?*const D3D10_BOX) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CopySubresourceRegion(@ptrCast(*const ID3D10Device, self), pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CopyResource(self: *const T, pDstResource: ?*ID3D10Resource, pSrcResource: ?*ID3D10Resource) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CopyResource(@ptrCast(*const ID3D10Device, self), pDstResource, pSrcResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_UpdateSubresource(self: *const T, pDstResource: ?*ID3D10Resource, DstSubresource: u32, pDstBox: ?*const D3D10_BOX, pSrcData: ?*const c_void, SrcRowPitch: u32, SrcDepthPitch: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).UpdateSubresource(@ptrCast(*const ID3D10Device, self), pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_ClearRenderTargetView(self: *const T, pRenderTargetView: ?*ID3D10RenderTargetView, ColorRGBA: ?*const f32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).ClearRenderTargetView(@ptrCast(*const ID3D10Device, self), pRenderTargetView, ColorRGBA); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_ClearDepthStencilView(self: *const T, pDepthStencilView: ?*ID3D10DepthStencilView, ClearFlags: u32, Depth: f32, Stencil: u8) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).ClearDepthStencilView(@ptrCast(*const ID3D10Device, self), pDepthStencilView, ClearFlags, Depth, Stencil); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GenerateMips(self: *const T, pShaderResourceView: ?*ID3D10ShaderResourceView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GenerateMips(@ptrCast(*const ID3D10Device, self), pShaderResourceView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_ResolveSubresource(self: *const T, pDstResource: ?*ID3D10Resource, DstSubresource: u32, pSrcResource: ?*ID3D10Resource, SrcSubresource: u32, Format: DXGI_FORMAT) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).ResolveSubresource(@ptrCast(*const ID3D10Device, self), pDstResource, DstSubresource, pSrcResource, SrcSubresource, Format); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_VSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSGetConstantBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppConstantBuffers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSGetShaderResources(@ptrCast(*const ID3D10Device, self), StartSlot, NumViews, ppShaderResourceViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSGetShader(self: *const T, ppPixelShader: ?*?*ID3D10PixelShader) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSGetShader(@ptrCast(*const ID3D10Device, self), ppPixelShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSGetSamplers(@ptrCast(*const ID3D10Device, self), StartSlot, NumSamplers, ppSamplers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_VSGetShader(self: *const T, ppVertexShader: ?*?*ID3D10VertexShader) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSGetShader(@ptrCast(*const ID3D10Device, self), ppVertexShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_PSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).PSGetConstantBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppConstantBuffers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IAGetInputLayout(self: *const T, ppInputLayout: ?*?*ID3D10InputLayout) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IAGetInputLayout(@ptrCast(*const ID3D10Device, self), ppInputLayout); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IAGetVertexBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppVertexBuffers: ?[*]?*ID3D10Buffer, pStrides: ?[*]u32, pOffsets: ?[*]u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IAGetVertexBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IAGetIndexBuffer(self: *const T, pIndexBuffer: ?*?*ID3D10Buffer, Format: ?*DXGI_FORMAT, Offset: ?*u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IAGetIndexBuffer(@ptrCast(*const ID3D10Device, self), pIndexBuffer, Format, Offset); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D10Buffer) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSGetConstantBuffers(@ptrCast(*const ID3D10Device, self), StartSlot, NumBuffers, ppConstantBuffers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSGetShader(self: *const T, ppGeometryShader: ?*?*ID3D10GeometryShader) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSGetShader(@ptrCast(*const ID3D10Device, self), ppGeometryShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_IAGetPrimitiveTopology(self: *const T, pTopology: ?*D3D_PRIMITIVE_TOPOLOGY) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).IAGetPrimitiveTopology(@ptrCast(*const ID3D10Device, self), pTopology); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_VSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSGetShaderResources(@ptrCast(*const ID3D10Device, self), StartSlot, NumViews, ppShaderResourceViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_VSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).VSGetSamplers(@ptrCast(*const ID3D10Device, self), StartSlot, NumSamplers, ppSamplers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GetPredication(self: *const T, ppPredicate: ?*?*ID3D10Predicate, pPredicateValue: ?*BOOL) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GetPredication(@ptrCast(*const ID3D10Device, self), ppPredicate, pPredicateValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D10ShaderResourceView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSGetShaderResources(@ptrCast(*const ID3D10Device, self), StartSlot, NumViews, ppShaderResourceViews); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D10SamplerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GSGetSamplers(@ptrCast(*const ID3D10Device, self), StartSlot, NumSamplers, ppSamplers); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_OMGetRenderTargets(self: *const T, NumViews: u32, ppRenderTargetViews: ?[*]?*ID3D10RenderTargetView, ppDepthStencilView: ?*?*ID3D10DepthStencilView) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).OMGetRenderTargets(@ptrCast(*const ID3D10Device, self), NumViews, ppRenderTargetViews, ppDepthStencilView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_OMGetBlendState(self: *const T, ppBlendState: ?*?*ID3D10BlendState, BlendFactor: ?*f32, pSampleMask: ?*u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).OMGetBlendState(@ptrCast(*const ID3D10Device, self), ppBlendState, BlendFactor, pSampleMask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_OMGetDepthStencilState(self: *const T, ppDepthStencilState: ?*?*ID3D10DepthStencilState, pStencilRef: ?*u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).OMGetDepthStencilState(@ptrCast(*const ID3D10Device, self), ppDepthStencilState, pStencilRef); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_SOGetTargets(self: *const T, NumBuffers: u32, ppSOTargets: ?[*]?*ID3D10Buffer, pOffsets: ?[*]u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).SOGetTargets(@ptrCast(*const ID3D10Device, self), NumBuffers, ppSOTargets, pOffsets); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_RSGetState(self: *const T, ppRasterizerState: ?*?*ID3D10RasterizerState) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).RSGetState(@ptrCast(*const ID3D10Device, self), ppRasterizerState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_RSGetViewports(self: *const T, NumViewports: ?*u32, pViewports: ?[*]D3D10_VIEWPORT) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).RSGetViewports(@ptrCast(*const ID3D10Device, self), NumViewports, pViewports); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_RSGetScissorRects(self: *const T, NumRects: ?*u32, pRects: ?[*]RECT) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).RSGetScissorRects(@ptrCast(*const ID3D10Device, self), NumRects, pRects); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GetDeviceRemovedReason(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GetDeviceRemovedReason(@ptrCast(*const ID3D10Device, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_SetExceptionMode(self: *const T, RaiseFlags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).SetExceptionMode(@ptrCast(*const ID3D10Device, self), RaiseFlags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GetExceptionMode(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GetExceptionMode(@ptrCast(*const ID3D10Device, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GetPrivateData(self: *const T, guid: ?*const Guid, pDataSize: ?*u32, pData: ?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GetPrivateData(@ptrCast(*const ID3D10Device, self), guid, pDataSize, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_SetPrivateData(self: *const T, guid: ?*const Guid, DataSize: u32, pData: ?*const c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).SetPrivateData(@ptrCast(*const ID3D10Device, self), guid, DataSize, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_SetPrivateDataInterface(self: *const T, guid: ?*const Guid, pData: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).SetPrivateDataInterface(@ptrCast(*const ID3D10Device, self), guid, pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_ClearState(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).ClearState(@ptrCast(*const ID3D10Device, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_Flush(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).Flush(@ptrCast(*const ID3D10Device, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateBuffer(self: *const T, pDesc: ?*const D3D10_BUFFER_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppBuffer: ?*?*ID3D10Buffer) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateBuffer(@ptrCast(*const ID3D10Device, self), pDesc, pInitialData, ppBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateTexture1D(self: *const T, pDesc: ?*const D3D10_TEXTURE1D_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppTexture1D: ?*?*ID3D10Texture1D) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateTexture1D(@ptrCast(*const ID3D10Device, self), pDesc, pInitialData, ppTexture1D); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateTexture2D(self: *const T, pDesc: ?*const D3D10_TEXTURE2D_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppTexture2D: ?*?*ID3D10Texture2D) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateTexture2D(@ptrCast(*const ID3D10Device, self), pDesc, pInitialData, ppTexture2D); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateTexture3D(self: *const T, pDesc: ?*const D3D10_TEXTURE3D_DESC, pInitialData: ?*const D3D10_SUBRESOURCE_DATA, ppTexture3D: ?*?*ID3D10Texture3D) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateTexture3D(@ptrCast(*const ID3D10Device, self), pDesc, pInitialData, ppTexture3D); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateShaderResourceView(self: *const T, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_SHADER_RESOURCE_VIEW_DESC, ppSRView: ?*?*ID3D10ShaderResourceView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateShaderResourceView(@ptrCast(*const ID3D10Device, self), pResource, pDesc, ppSRView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateRenderTargetView(self: *const T, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_RENDER_TARGET_VIEW_DESC, ppRTView: ?*?*ID3D10RenderTargetView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateRenderTargetView(@ptrCast(*const ID3D10Device, self), pResource, pDesc, ppRTView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateDepthStencilView(self: *const T, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_DEPTH_STENCIL_VIEW_DESC, ppDepthStencilView: ?*?*ID3D10DepthStencilView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateDepthStencilView(@ptrCast(*const ID3D10Device, self), pResource, pDesc, ppDepthStencilView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateInputLayout(self: *const T, pInputElementDescs: [*]const D3D10_INPUT_ELEMENT_DESC, NumElements: u32, pShaderBytecodeWithInputSignature: [*]const u8, BytecodeLength: usize, ppInputLayout: ?*?*ID3D10InputLayout) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateInputLayout(@ptrCast(*const ID3D10Device, self), pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateVertexShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, ppVertexShader: ?*?*ID3D10VertexShader) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateVertexShader(@ptrCast(*const ID3D10Device, self), pShaderBytecode, BytecodeLength, ppVertexShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateGeometryShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, ppGeometryShader: ?*?*ID3D10GeometryShader) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateGeometryShader(@ptrCast(*const ID3D10Device, self), pShaderBytecode, BytecodeLength, ppGeometryShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateGeometryShaderWithStreamOutput(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pSODeclaration: ?[*]const D3D10_SO_DECLARATION_ENTRY, NumEntries: u32, OutputStreamStride: u32, ppGeometryShader: ?*?*ID3D10GeometryShader) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateGeometryShaderWithStreamOutput(@ptrCast(*const ID3D10Device, self), pShaderBytecode, BytecodeLength, pSODeclaration, NumEntries, OutputStreamStride, ppGeometryShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreatePixelShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, ppPixelShader: ?*?*ID3D10PixelShader) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreatePixelShader(@ptrCast(*const ID3D10Device, self), pShaderBytecode, BytecodeLength, ppPixelShader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateBlendState(self: *const T, pBlendStateDesc: ?*const D3D10_BLEND_DESC, ppBlendState: ?*?*ID3D10BlendState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateBlendState(@ptrCast(*const ID3D10Device, self), pBlendStateDesc, ppBlendState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateDepthStencilState(self: *const T, pDepthStencilDesc: ?*const D3D10_DEPTH_STENCIL_DESC, ppDepthStencilState: ?*?*ID3D10DepthStencilState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateDepthStencilState(@ptrCast(*const ID3D10Device, self), pDepthStencilDesc, ppDepthStencilState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateRasterizerState(self: *const T, pRasterizerDesc: ?*const D3D10_RASTERIZER_DESC, ppRasterizerState: ?*?*ID3D10RasterizerState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateRasterizerState(@ptrCast(*const ID3D10Device, self), pRasterizerDesc, ppRasterizerState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateSamplerState(self: *const T, pSamplerDesc: ?*const D3D10_SAMPLER_DESC, ppSamplerState: ?*?*ID3D10SamplerState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateSamplerState(@ptrCast(*const ID3D10Device, self), pSamplerDesc, ppSamplerState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateQuery(self: *const T, pQueryDesc: ?*const D3D10_QUERY_DESC, ppQuery: ?*?*ID3D10Query) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateQuery(@ptrCast(*const ID3D10Device, self), pQueryDesc, ppQuery); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreatePredicate(self: *const T, pPredicateDesc: ?*const D3D10_QUERY_DESC, ppPredicate: ?*?*ID3D10Predicate) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreatePredicate(@ptrCast(*const ID3D10Device, self), pPredicateDesc, ppPredicate); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CreateCounter(self: *const T, pCounterDesc: ?*const D3D10_COUNTER_DESC, ppCounter: ?*?*ID3D10Counter) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CreateCounter(@ptrCast(*const ID3D10Device, self), pCounterDesc, ppCounter); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CheckFormatSupport(self: *const T, Format: DXGI_FORMAT, pFormatSupport: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CheckFormatSupport(@ptrCast(*const ID3D10Device, self), Format, pFormatSupport); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CheckMultisampleQualityLevels(self: *const T, Format: DXGI_FORMAT, SampleCount: u32, pNumQualityLevels: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CheckMultisampleQualityLevels(@ptrCast(*const ID3D10Device, self), Format, SampleCount, pNumQualityLevels); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CheckCounterInfo(self: *const T, pCounterInfo: ?*D3D10_COUNTER_INFO) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CheckCounterInfo(@ptrCast(*const ID3D10Device, self), pCounterInfo); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_CheckCounter(self: *const T, pDesc: ?*const D3D10_COUNTER_DESC, pType: ?*D3D10_COUNTER_TYPE, pActiveCounters: ?*u32, szName: ?[*:0]u8, pNameLength: ?*u32, szUnits: ?[*:0]u8, pUnitsLength: ?*u32, szDescription: ?[*:0]u8, pDescriptionLength: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).CheckCounter(@ptrCast(*const ID3D10Device, self), pDesc, pType, pActiveCounters, szName, pNameLength, szUnits, pUnitsLength, szDescription, pDescriptionLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GetCreationFlags(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GetCreationFlags(@ptrCast(*const ID3D10Device, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_OpenSharedResource(self: *const T, hResource: ?HANDLE, ReturnedInterface: ?*const Guid, ppResource: ?*?*c_void) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device.VTable, self.vtable).OpenSharedResource(@ptrCast(*const ID3D10Device, self), hResource, ReturnedInterface, ppResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_SetTextFilterSize(self: *const T, Width: u32, Height: u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).SetTextFilterSize(@ptrCast(*const ID3D10Device, self), Width, Height); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device_GetTextFilterSize(self: *const T, pWidth: ?*u32, pHeight: ?*u32) callconv(.Inline) void { return @ptrCast(*const ID3D10Device.VTable, self.vtable).GetTextFilterSize(@ptrCast(*const ID3D10Device, self), pWidth, pHeight); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10Multithread_Value = @import("../zig.zig").Guid.initString("9b7e4e00-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Multithread = &IID_ID3D10Multithread_Value; pub const ID3D10Multithread = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Enter: fn( self: *const ID3D10Multithread, ) callconv(@import("std").os.windows.WINAPI) void, Leave: fn( self: *const ID3D10Multithread, ) callconv(@import("std").os.windows.WINAPI) void, SetMultithreadProtected: fn( self: *const ID3D10Multithread, bMTProtect: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetMultithreadProtected: fn( self: *const ID3D10Multithread, ) callconv(@import("std").os.windows.WINAPI) BOOL, }; 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 ID3D10Multithread_Enter(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Multithread.VTable, self.vtable).Enter(@ptrCast(*const ID3D10Multithread, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Multithread_Leave(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10Multithread.VTable, self.vtable).Leave(@ptrCast(*const ID3D10Multithread, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Multithread_SetMultithreadProtected(self: *const T, bMTProtect: BOOL) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10Multithread.VTable, self.vtable).SetMultithreadProtected(@ptrCast(*const ID3D10Multithread, self), bMTProtect); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Multithread_GetMultithreadProtected(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10Multithread.VTable, self.vtable).GetMultithreadProtected(@ptrCast(*const ID3D10Multithread, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_CREATE_DEVICE_FLAG = enum(i32) { SINGLETHREADED = 1, DEBUG = 2, SWITCH_TO_REF = 4, PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 8, ALLOW_NULL_FROM_MAP = 16, BGRA_SUPPORT = 32, PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 128, STRICT_VALIDATION = 512, DEBUGGABLE = 1024, }; pub const D3D10_CREATE_DEVICE_SINGLETHREADED = D3D10_CREATE_DEVICE_FLAG.SINGLETHREADED; pub const D3D10_CREATE_DEVICE_DEBUG = D3D10_CREATE_DEVICE_FLAG.DEBUG; pub const D3D10_CREATE_DEVICE_SWITCH_TO_REF = D3D10_CREATE_DEVICE_FLAG.SWITCH_TO_REF; pub const D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = D3D10_CREATE_DEVICE_FLAG.PREVENT_INTERNAL_THREADING_OPTIMIZATIONS; pub const D3D10_CREATE_DEVICE_ALLOW_NULL_FROM_MAP = D3D10_CREATE_DEVICE_FLAG.ALLOW_NULL_FROM_MAP; pub const D3D10_CREATE_DEVICE_BGRA_SUPPORT = D3D10_CREATE_DEVICE_FLAG.BGRA_SUPPORT; pub const D3D10_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = D3D10_CREATE_DEVICE_FLAG.PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY; pub const D3D10_CREATE_DEVICE_STRICT_VALIDATION = D3D10_CREATE_DEVICE_FLAG.STRICT_VALIDATION; pub const D3D10_CREATE_DEVICE_DEBUGGABLE = D3D10_CREATE_DEVICE_FLAG.DEBUGGABLE; const IID_ID3D10Debug_Value = @import("../zig.zig").Guid.initString("9b7e4e01-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Debug = &IID_ID3D10Debug_Value; pub const ID3D10Debug = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetFeatureMask: fn( self: *const ID3D10Debug, Mask: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFeatureMask: fn( self: *const ID3D10Debug, ) callconv(@import("std").os.windows.WINAPI) u32, SetPresentPerRenderOpDelay: fn( self: *const ID3D10Debug, Milliseconds: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPresentPerRenderOpDelay: fn( self: *const ID3D10Debug, ) callconv(@import("std").os.windows.WINAPI) u32, SetSwapChain: fn( self: *const ID3D10Debug, pSwapChain: ?*IDXGISwapChain, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetSwapChain: fn( self: *const ID3D10Debug, ppSwapChain: ?*?*IDXGISwapChain, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Validate: fn( self: *const ID3D10Debug, ) 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 ID3D10Debug_SetFeatureMask(self: *const T, Mask: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Debug.VTable, self.vtable).SetFeatureMask(@ptrCast(*const ID3D10Debug, self), Mask); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Debug_GetFeatureMask(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10Debug.VTable, self.vtable).GetFeatureMask(@ptrCast(*const ID3D10Debug, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Debug_SetPresentPerRenderOpDelay(self: *const T, Milliseconds: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Debug.VTable, self.vtable).SetPresentPerRenderOpDelay(@ptrCast(*const ID3D10Debug, self), Milliseconds); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Debug_GetPresentPerRenderOpDelay(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10Debug.VTable, self.vtable).GetPresentPerRenderOpDelay(@ptrCast(*const ID3D10Debug, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Debug_SetSwapChain(self: *const T, pSwapChain: ?*IDXGISwapChain) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Debug.VTable, self.vtable).SetSwapChain(@ptrCast(*const ID3D10Debug, self), pSwapChain); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Debug_GetSwapChain(self: *const T, ppSwapChain: ?*?*IDXGISwapChain) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Debug.VTable, self.vtable).GetSwapChain(@ptrCast(*const ID3D10Debug, self), ppSwapChain); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Debug_Validate(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Debug.VTable, self.vtable).Validate(@ptrCast(*const ID3D10Debug, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10SwitchToRef_Value = @import("../zig.zig").Guid.initString("9b7e4e02-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10SwitchToRef = &IID_ID3D10SwitchToRef_Value; pub const ID3D10SwitchToRef = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetUseRef: fn( self: *const ID3D10SwitchToRef, UseRef: BOOL, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetUseRef: fn( self: *const ID3D10SwitchToRef, ) callconv(@import("std").os.windows.WINAPI) BOOL, }; 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 ID3D10SwitchToRef_SetUseRef(self: *const T, UseRef: BOOL) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10SwitchToRef.VTable, self.vtable).SetUseRef(@ptrCast(*const ID3D10SwitchToRef, self), UseRef); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10SwitchToRef_GetUseRef(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10SwitchToRef.VTable, self.vtable).GetUseRef(@ptrCast(*const ID3D10SwitchToRef, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_MESSAGE_CATEGORY = enum(i32) { APPLICATION_DEFINED = 0, MISCELLANEOUS = 1, INITIALIZATION = 2, CLEANUP = 3, COMPILATION = 4, STATE_CREATION = 5, STATE_SETTING = 6, STATE_GETTING = 7, RESOURCE_MANIPULATION = 8, EXECUTION = 9, SHADER = 10, }; pub const D3D10_MESSAGE_CATEGORY_APPLICATION_DEFINED = D3D10_MESSAGE_CATEGORY.APPLICATION_DEFINED; pub const D3D10_MESSAGE_CATEGORY_MISCELLANEOUS = D3D10_MESSAGE_CATEGORY.MISCELLANEOUS; pub const D3D10_MESSAGE_CATEGORY_INITIALIZATION = D3D10_MESSAGE_CATEGORY.INITIALIZATION; pub const D3D10_MESSAGE_CATEGORY_CLEANUP = D3D10_MESSAGE_CATEGORY.CLEANUP; pub const D3D10_MESSAGE_CATEGORY_COMPILATION = D3D10_MESSAGE_CATEGORY.COMPILATION; pub const D3D10_MESSAGE_CATEGORY_STATE_CREATION = D3D10_MESSAGE_CATEGORY.STATE_CREATION; pub const D3D10_MESSAGE_CATEGORY_STATE_SETTING = D3D10_MESSAGE_CATEGORY.STATE_SETTING; pub const D3D10_MESSAGE_CATEGORY_STATE_GETTING = D3D10_MESSAGE_CATEGORY.STATE_GETTING; pub const D3D10_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = D3D10_MESSAGE_CATEGORY.RESOURCE_MANIPULATION; pub const D3D10_MESSAGE_CATEGORY_EXECUTION = D3D10_MESSAGE_CATEGORY.EXECUTION; pub const D3D10_MESSAGE_CATEGORY_SHADER = D3D10_MESSAGE_CATEGORY.SHADER; pub const D3D10_MESSAGE_SEVERITY = enum(i32) { CORRUPTION = 0, ERROR = 1, WARNING = 2, INFO = 3, MESSAGE = 4, }; pub const D3D10_MESSAGE_SEVERITY_CORRUPTION = D3D10_MESSAGE_SEVERITY.CORRUPTION; pub const D3D10_MESSAGE_SEVERITY_ERROR = D3D10_MESSAGE_SEVERITY.ERROR; pub const D3D10_MESSAGE_SEVERITY_WARNING = D3D10_MESSAGE_SEVERITY.WARNING; pub const D3D10_MESSAGE_SEVERITY_INFO = D3D10_MESSAGE_SEVERITY.INFO; pub const D3D10_MESSAGE_SEVERITY_MESSAGE = D3D10_MESSAGE_SEVERITY.MESSAGE; pub const D3D10_MESSAGE_ID = enum(i32) { UNKNOWN = 0, DEVICE_IASETVERTEXBUFFERS_HAZARD = 1, DEVICE_IASETINDEXBUFFER_HAZARD = 2, DEVICE_VSSETSHADERRESOURCES_HAZARD = 3, DEVICE_VSSETCONSTANTBUFFERS_HAZARD = 4, DEVICE_GSSETSHADERRESOURCES_HAZARD = 5, DEVICE_GSSETCONSTANTBUFFERS_HAZARD = 6, DEVICE_PSSETSHADERRESOURCES_HAZARD = 7, DEVICE_PSSETCONSTANTBUFFERS_HAZARD = 8, DEVICE_OMSETRENDERTARGETS_HAZARD = 9, DEVICE_SOSETTARGETS_HAZARD = 10, STRING_FROM_APPLICATION = 11, CORRUPTED_THIS = 12, CORRUPTED_PARAMETER1 = 13, CORRUPTED_PARAMETER2 = 14, CORRUPTED_PARAMETER3 = 15, CORRUPTED_PARAMETER4 = 16, CORRUPTED_PARAMETER5 = 17, CORRUPTED_PARAMETER6 = 18, CORRUPTED_PARAMETER7 = 19, CORRUPTED_PARAMETER8 = 20, CORRUPTED_PARAMETER9 = 21, CORRUPTED_PARAMETER10 = 22, CORRUPTED_PARAMETER11 = 23, CORRUPTED_PARAMETER12 = 24, CORRUPTED_PARAMETER13 = 25, CORRUPTED_PARAMETER14 = 26, CORRUPTED_PARAMETER15 = 27, CORRUPTED_MULTITHREADING = 28, MESSAGE_REPORTING_OUTOFMEMORY = 29, IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = 30, IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = 31, IASETINDEXBUFFER_UNBINDDELETINGOBJECT = 32, VSSETSHADER_UNBINDDELETINGOBJECT = 33, VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 34, VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 35, VSSETSAMPLERS_UNBINDDELETINGOBJECT = 36, GSSETSHADER_UNBINDDELETINGOBJECT = 37, GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 38, GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 39, GSSETSAMPLERS_UNBINDDELETINGOBJECT = 40, SOSETTARGETS_UNBINDDELETINGOBJECT = 41, PSSETSHADER_UNBINDDELETINGOBJECT = 42, PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 43, PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 44, PSSETSAMPLERS_UNBINDDELETINGOBJECT = 45, RSSETSTATE_UNBINDDELETINGOBJECT = 46, OMSETBLENDSTATE_UNBINDDELETINGOBJECT = 47, OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = 48, OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = 49, SETPREDICATION_UNBINDDELETINGOBJECT = 50, GETPRIVATEDATA_MOREDATA = 51, SETPRIVATEDATA_INVALIDFREEDATA = 52, SETPRIVATEDATA_INVALIDIUNKNOWN = 53, SETPRIVATEDATA_INVALIDFLAGS = 54, SETPRIVATEDATA_CHANGINGPARAMS = 55, SETPRIVATEDATA_OUTOFMEMORY = 56, CREATEBUFFER_UNRECOGNIZEDFORMAT = 57, CREATEBUFFER_INVALIDSAMPLES = 58, CREATEBUFFER_UNRECOGNIZEDUSAGE = 59, CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = 60, CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = 61, CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = 62, CREATEBUFFER_INVALIDCPUACCESSFLAGS = 63, CREATEBUFFER_INVALIDBINDFLAGS = 64, CREATEBUFFER_INVALIDINITIALDATA = 65, CREATEBUFFER_INVALIDDIMENSIONS = 66, CREATEBUFFER_INVALIDMIPLEVELS = 67, CREATEBUFFER_INVALIDMISCFLAGS = 68, CREATEBUFFER_INVALIDARG_RETURN = 69, CREATEBUFFER_OUTOFMEMORY_RETURN = 70, CREATEBUFFER_NULLDESC = 71, CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = 72, CREATEBUFFER_LARGEALLOCATION = 73, CREATETEXTURE1D_UNRECOGNIZEDFORMAT = 74, CREATETEXTURE1D_UNSUPPORTEDFORMAT = 75, CREATETEXTURE1D_INVALIDSAMPLES = 76, CREATETEXTURE1D_UNRECOGNIZEDUSAGE = 77, CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = 78, CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = 79, CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = 80, CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = 81, CREATETEXTURE1D_INVALIDBINDFLAGS = 82, CREATETEXTURE1D_INVALIDINITIALDATA = 83, CREATETEXTURE1D_INVALIDDIMENSIONS = 84, CREATETEXTURE1D_INVALIDMIPLEVELS = 85, CREATETEXTURE1D_INVALIDMISCFLAGS = 86, CREATETEXTURE1D_INVALIDARG_RETURN = 87, CREATETEXTURE1D_OUTOFMEMORY_RETURN = 88, CREATETEXTURE1D_NULLDESC = 89, CREATETEXTURE1D_LARGEALLOCATION = 90, CREATETEXTURE2D_UNRECOGNIZEDFORMAT = 91, CREATETEXTURE2D_UNSUPPORTEDFORMAT = 92, CREATETEXTURE2D_INVALIDSAMPLES = 93, CREATETEXTURE2D_UNRECOGNIZEDUSAGE = 94, CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = 95, CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = 96, CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = 97, CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = 98, CREATETEXTURE2D_INVALIDBINDFLAGS = 99, CREATETEXTURE2D_INVALIDINITIALDATA = 100, CREATETEXTURE2D_INVALIDDIMENSIONS = 101, CREATETEXTURE2D_INVALIDMIPLEVELS = 102, CREATETEXTURE2D_INVALIDMISCFLAGS = 103, CREATETEXTURE2D_INVALIDARG_RETURN = 104, CREATETEXTURE2D_OUTOFMEMORY_RETURN = 105, CREATETEXTURE2D_NULLDESC = 106, CREATETEXTURE2D_LARGEALLOCATION = 107, CREATETEXTURE3D_UNRECOGNIZEDFORMAT = 108, CREATETEXTURE3D_UNSUPPORTEDFORMAT = 109, CREATETEXTURE3D_INVALIDSAMPLES = 110, CREATETEXTURE3D_UNRECOGNIZEDUSAGE = 111, CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = 112, CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = 113, CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = 114, CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = 115, CREATETEXTURE3D_INVALIDBINDFLAGS = 116, CREATETEXTURE3D_INVALIDINITIALDATA = 117, CREATETEXTURE3D_INVALIDDIMENSIONS = 118, CREATETEXTURE3D_INVALIDMIPLEVELS = 119, CREATETEXTURE3D_INVALIDMISCFLAGS = 120, CREATETEXTURE3D_INVALIDARG_RETURN = 121, CREATETEXTURE3D_OUTOFMEMORY_RETURN = 122, CREATETEXTURE3D_NULLDESC = 123, CREATETEXTURE3D_LARGEALLOCATION = 124, CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = 125, CREATESHADERRESOURCEVIEW_INVALIDDESC = 126, CREATESHADERRESOURCEVIEW_INVALIDFORMAT = 127, CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = 128, CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = 129, CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = 130, CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = 131, CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = 132, CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = 133, CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = 134, CREATERENDERTARGETVIEW_INVALIDDESC = 135, CREATERENDERTARGETVIEW_INVALIDFORMAT = 136, CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = 137, CREATERENDERTARGETVIEW_INVALIDRESOURCE = 138, CREATERENDERTARGETVIEW_TOOMANYOBJECTS = 139, CREATERENDERTARGETVIEW_INVALIDARG_RETURN = 140, CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = 141, CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = 142, CREATEDEPTHSTENCILVIEW_INVALIDDESC = 143, CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = 144, CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = 145, CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = 146, CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = 147, CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = 148, CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = 149, CREATEINPUTLAYOUT_OUTOFMEMORY = 150, CREATEINPUTLAYOUT_TOOMANYELEMENTS = 151, CREATEINPUTLAYOUT_INVALIDFORMAT = 152, CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = 153, CREATEINPUTLAYOUT_INVALIDSLOT = 154, CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = 155, CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = 156, CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = 157, CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = 158, CREATEINPUTLAYOUT_INVALIDALIGNMENT = 159, CREATEINPUTLAYOUT_DUPLICATESEMANTIC = 160, CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = 161, CREATEINPUTLAYOUT_NULLSEMANTIC = 162, CREATEINPUTLAYOUT_MISSINGELEMENT = 163, CREATEINPUTLAYOUT_NULLDESC = 164, CREATEVERTEXSHADER_OUTOFMEMORY = 165, CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = 166, CREATEVERTEXSHADER_INVALIDSHADERTYPE = 167, CREATEGEOMETRYSHADER_OUTOFMEMORY = 168, CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = 169, CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = 170, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = 171, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = 172, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 173, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = 174, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = 175, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = 176, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = 177, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = 178, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = 179, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = 180, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = 181, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = 182, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = 183, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = 184, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = 185, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = 186, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = 187, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = 188, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = 189, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = 190, CREATEPIXELSHADER_OUTOFMEMORY = 191, CREATEPIXELSHADER_INVALIDSHADERBYTECODE = 192, CREATEPIXELSHADER_INVALIDSHADERTYPE = 193, CREATERASTERIZERSTATE_INVALIDFILLMODE = 194, CREATERASTERIZERSTATE_INVALIDCULLMODE = 195, CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = 196, CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = 197, CREATERASTERIZERSTATE_TOOMANYOBJECTS = 198, CREATERASTERIZERSTATE_NULLDESC = 199, CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = 200, CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = 201, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = 202, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = 203, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = 204, CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = 205, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = 206, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = 207, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = 208, CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = 209, CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = 210, CREATEDEPTHSTENCILSTATE_NULLDESC = 211, CREATEBLENDSTATE_INVALIDSRCBLEND = 212, CREATEBLENDSTATE_INVALIDDESTBLEND = 213, CREATEBLENDSTATE_INVALIDBLENDOP = 214, CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = 215, CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = 216, CREATEBLENDSTATE_INVALIDBLENDOPALPHA = 217, CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = 218, CREATEBLENDSTATE_TOOMANYOBJECTS = 219, CREATEBLENDSTATE_NULLDESC = 220, CREATESAMPLERSTATE_INVALIDFILTER = 221, CREATESAMPLERSTATE_INVALIDADDRESSU = 222, CREATESAMPLERSTATE_INVALIDADDRESSV = 223, CREATESAMPLERSTATE_INVALIDADDRESSW = 224, CREATESAMPLERSTATE_INVALIDMIPLODBIAS = 225, CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = 226, CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = 227, CREATESAMPLERSTATE_INVALIDMINLOD = 228, CREATESAMPLERSTATE_INVALIDMAXLOD = 229, CREATESAMPLERSTATE_TOOMANYOBJECTS = 230, CREATESAMPLERSTATE_NULLDESC = 231, CREATEQUERYORPREDICATE_INVALIDQUERY = 232, CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = 233, CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = 234, CREATEQUERYORPREDICATE_NULLDESC = 235, DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = 236, DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = 237, IASETVERTEXBUFFERS_INVALIDBUFFER = 238, DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = 239, DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = 240, IASETINDEXBUFFER_INVALIDBUFFER = 241, DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = 242, DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = 243, DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = 244, DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = 245, VSSETCONSTANTBUFFERS_INVALIDBUFFER = 246, DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 247, DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = 248, DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = 249, GSSETCONSTANTBUFFERS_INVALIDBUFFER = 250, DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 251, DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = 252, SOSETTARGETS_INVALIDBUFFER = 253, DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = 254, DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = 255, PSSETCONSTANTBUFFERS_INVALIDBUFFER = 256, DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 257, DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = 258, DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = 259, DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = 260, CLEARRENDERTARGETVIEW_DENORMFLUSH = 261, CLEARDEPTHSTENCILVIEW_DENORMFLUSH = 262, CLEARDEPTHSTENCILVIEW_INVALID = 263, DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = 264, DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = 265, DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 266, DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = 267, DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = 268, DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 269, DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = 270, DEVICE_SOGETTARGETS_BUFFERS_EMPTY = 271, DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = 272, DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 273, DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = 274, DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = 275, DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = 276, DEVICE_GENERATEMIPS_RESOURCE_INVALID = 277, COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = 278, COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = 279, COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = 280, COPYSUBRESOURCEREGION_INVALIDSOURCE = 281, COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = 282, COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = 283, COPYRESOURCE_INVALIDSOURCE = 284, COPYRESOURCE_INVALIDDESTINATIONSTATE = 285, COPYRESOURCE_INVALIDSOURCESTATE = 286, UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = 287, UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = 288, UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = 289, DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = 290, DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = 291, DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = 292, DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = 293, DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = 294, BUFFER_MAP_INVALIDMAPTYPE = 295, BUFFER_MAP_INVALIDFLAGS = 296, BUFFER_MAP_ALREADYMAPPED = 297, BUFFER_MAP_DEVICEREMOVED_RETURN = 298, BUFFER_UNMAP_NOTMAPPED = 299, TEXTURE1D_MAP_INVALIDMAPTYPE = 300, TEXTURE1D_MAP_INVALIDSUBRESOURCE = 301, TEXTURE1D_MAP_INVALIDFLAGS = 302, TEXTURE1D_MAP_ALREADYMAPPED = 303, TEXTURE1D_MAP_DEVICEREMOVED_RETURN = 304, TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = 305, TEXTURE1D_UNMAP_NOTMAPPED = 306, TEXTURE2D_MAP_INVALIDMAPTYPE = 307, TEXTURE2D_MAP_INVALIDSUBRESOURCE = 308, TEXTURE2D_MAP_INVALIDFLAGS = 309, TEXTURE2D_MAP_ALREADYMAPPED = 310, TEXTURE2D_MAP_DEVICEREMOVED_RETURN = 311, TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = 312, TEXTURE2D_UNMAP_NOTMAPPED = 313, TEXTURE3D_MAP_INVALIDMAPTYPE = 314, TEXTURE3D_MAP_INVALIDSUBRESOURCE = 315, TEXTURE3D_MAP_INVALIDFLAGS = 316, TEXTURE3D_MAP_ALREADYMAPPED = 317, TEXTURE3D_MAP_DEVICEREMOVED_RETURN = 318, TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = 319, TEXTURE3D_UNMAP_NOTMAPPED = 320, CHECKFORMATSUPPORT_FORMAT_DEPRECATED = 321, CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = 322, SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = 323, SETEXCEPTIONMODE_INVALIDARG_RETURN = 324, SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = 325, REF_SIMULATING_INFINITELY_FAST_HARDWARE = 326, REF_THREADING_MODE = 327, REF_UMDRIVER_EXCEPTION = 328, REF_KMDRIVER_EXCEPTION = 329, REF_HARDWARE_EXCEPTION = 330, REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = 331, REF_PROBLEM_PARSING_SHADER = 332, REF_OUT_OF_MEMORY = 333, REF_INFO = 334, DEVICE_DRAW_VERTEXPOS_OVERFLOW = 335, DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = 336, DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = 337, DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = 338, DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = 339, DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = 340, DEVICE_DRAW_VERTEX_SHADER_NOT_SET = 341, DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 342, DEVICE_SHADER_LINKAGE_REGISTERINDEX = 343, DEVICE_SHADER_LINKAGE_COMPONENTTYPE = 344, DEVICE_SHADER_LINKAGE_REGISTERMASK = 345, DEVICE_SHADER_LINKAGE_SYSTEMVALUE = 346, DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 347, DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = 348, DEVICE_DRAW_INPUTLAYOUT_NOT_SET = 349, DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = 350, DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = 351, DEVICE_DRAW_SAMPLER_NOT_SET = 352, DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = 353, DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = 354, DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = 355, DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = 356, DEVICE_DRAW_INDEX_BUFFER_NOT_SET = 357, DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = 358, DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = 359, DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = 360, DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = 361, DEVICE_DRAW_POSITION_NOT_PRESENT = 362, DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = 363, DEVICE_DRAW_BOUND_RESOURCE_MAPPED = 364, DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = 365, DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = 366, DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = 367, DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = 368, DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = 369, DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = 370, DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = 371, DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = 372, DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = 373, DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = 374, DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = 375, DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 376, DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 377, DEVICE_REMOVAL_PROCESS_AT_FAULT = 378, DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = 379, DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = 380, DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = 381, DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = 382, DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = 383, DEVICE_DRAW_VIEWPORT_NOT_SET = 384, CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = 385, CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = 386, DEVICE_RSSETVIEWPORTS_DENORMFLUSH = 387, OMSETRENDERTARGETS_INVALIDVIEW = 388, DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = 389, DEVICE_DRAW_SAMPLER_MISMATCH = 390, CREATEINPUTLAYOUT_TYPE_MISMATCH = 391, BLENDSTATE_GETDESC_LEGACY = 392, SHADERRESOURCEVIEW_GETDESC_LEGACY = 393, CREATEQUERY_OUTOFMEMORY_RETURN = 394, CREATEPREDICATE_OUTOFMEMORY_RETURN = 395, CREATECOUNTER_OUTOFRANGE_COUNTER = 396, CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = 397, CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = 398, CREATECOUNTER_OUTOFMEMORY_RETURN = 399, CREATECOUNTER_NONEXCLUSIVE_RETURN = 400, CREATECOUNTER_NULLDESC = 401, CHECKCOUNTER_OUTOFRANGE_COUNTER = 402, CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = 403, SETPREDICATION_INVALID_PREDICATE_STATE = 404, QUERY_BEGIN_UNSUPPORTED = 405, PREDICATE_BEGIN_DURING_PREDICATION = 406, QUERY_BEGIN_DUPLICATE = 407, QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = 408, PREDICATE_END_DURING_PREDICATION = 409, QUERY_END_ABANDONING_PREVIOUS_RESULTS = 410, QUERY_END_WITHOUT_BEGIN = 411, QUERY_GETDATA_INVALID_DATASIZE = 412, QUERY_GETDATA_INVALID_FLAGS = 413, QUERY_GETDATA_INVALID_CALL = 414, DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = 415, DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = 416, DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 417, DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = 418, DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = 419, CREATEINPUTLAYOUT_EMPTY_LAYOUT = 420, DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = 421, LIVE_OBJECT_SUMMARY = 422, LIVE_BUFFER = 423, LIVE_TEXTURE1D = 424, LIVE_TEXTURE2D = 425, LIVE_TEXTURE3D = 426, LIVE_SHADERRESOURCEVIEW = 427, LIVE_RENDERTARGETVIEW = 428, LIVE_DEPTHSTENCILVIEW = 429, LIVE_VERTEXSHADER = 430, LIVE_GEOMETRYSHADER = 431, LIVE_PIXELSHADER = 432, LIVE_INPUTLAYOUT = 433, LIVE_SAMPLER = 434, LIVE_BLENDSTATE = 435, LIVE_DEPTHSTENCILSTATE = 436, LIVE_RASTERIZERSTATE = 437, LIVE_QUERY = 438, LIVE_PREDICATE = 439, LIVE_COUNTER = 440, LIVE_DEVICE = 441, LIVE_SWAPCHAIN = 442, D3D10_MESSAGES_END = 443, D3D10L9_MESSAGES_START = 1048576, CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = 1048577, CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = 1048578, CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = 1048579, CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = 1048580, CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = 1048581, VSSETSAMPLERS_NOT_SUPPORTED = 1048582, VSSETSAMPLERS_TOO_MANY_SAMPLERS = 1048583, PSSETSAMPLERS_TOO_MANY_SAMPLERS = 1048584, CREATERESOURCE_NO_ARRAYS = 1048585, CREATERESOURCE_NO_VB_AND_IB_BIND = 1048586, CREATERESOURCE_NO_TEXTURE_1D = 1048587, CREATERESOURCE_DIMENSION_OUT_OF_RANGE = 1048588, CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = 1048589, OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = 1048590, OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = 1048591, IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = 1048592, DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = 1048593, DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = 1048594, DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = 1048595, COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = 1048596, COPYRESOURCE_NO_TEXTURE_3D_READBACK = 1048597, COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = 1048598, CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = 1048599, CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = 1048600, CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = 1048601, DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = 1048602, CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = 1048603, CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = 1048604, CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = 1048605, CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = 1048606, CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = 1048607, CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = 1048608, CREATERESOURCE_NO_DWORD_INDEX_BUFFER = 1048609, CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = 1048610, CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = 1048611, CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = 1048612, CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = 1048613, CREATERESOURCE_NO_STREAM_OUT = 1048614, CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = 1048615, CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = 1048616, CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = 1048617, VSSHADERRESOURCES_NOT_SUPPORTED = 1048618, GEOMETRY_SHADER_NOT_SUPPORTED = 1048619, STREAM_OUT_NOT_SUPPORTED = 1048620, TEXT_FILTER_NOT_SUPPORTED = 1048621, CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = 1048622, CREATEBLENDSTATE_NO_MRT_BLEND = 1048623, CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = 1048624, CREATESAMPLERSTATE_NO_MIRRORONCE = 1048625, DRAWINSTANCED_NOT_SUPPORTED = 1048626, DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = 1048627, DRAWINDEXED_POINTLIST_UNSUPPORTED = 1048628, SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = 1048629, CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = 1048630, CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = 1048631, DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = 1048632, SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = 1048633, CREATERESOURCE_NON_POW_2_MIPMAP = 1048634, CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = 1048635, OMSETRENDERTARGETS_NO_SRGB_MRT = 1048636, COPYRESOURCE_NO_3D_MISMATCHED_UPDATES = 1048637, D3D10L9_MESSAGES_END = 1048638, }; pub const D3D10_MESSAGE_ID_UNKNOWN = D3D10_MESSAGE_ID.UNKNOWN; pub const D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD = D3D10_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD = D3D10_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD = D3D10_MESSAGE_ID.DEVICE_VSSETSHADERRESOURCES_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD = D3D10_MESSAGE_ID.DEVICE_VSSETCONSTANTBUFFERS_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD = D3D10_MESSAGE_ID.DEVICE_GSSETSHADERRESOURCES_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD = D3D10_MESSAGE_ID.DEVICE_GSSETCONSTANTBUFFERS_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD = D3D10_MESSAGE_ID.DEVICE_PSSETSHADERRESOURCES_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD = D3D10_MESSAGE_ID.DEVICE_PSSETCONSTANTBUFFERS_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD = D3D10_MESSAGE_ID.DEVICE_OMSETRENDERTARGETS_HAZARD; pub const D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD = D3D10_MESSAGE_ID.DEVICE_SOSETTARGETS_HAZARD; pub const D3D10_MESSAGE_ID_STRING_FROM_APPLICATION = D3D10_MESSAGE_ID.STRING_FROM_APPLICATION; pub const D3D10_MESSAGE_ID_CORRUPTED_THIS = D3D10_MESSAGE_ID.CORRUPTED_THIS; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER1; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER2 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER2; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER3 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER3; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER4 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER4; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER5 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER5; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER6 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER6; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER7 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER7; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER8 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER8; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER9 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER9; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER10 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER10; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER11 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER11; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER12 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER12; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER13 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER13; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER14 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER14; pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER15 = D3D10_MESSAGE_ID.CORRUPTED_PARAMETER15; pub const D3D10_MESSAGE_ID_CORRUPTED_MULTITHREADING = D3D10_MESSAGE_ID.CORRUPTED_MULTITHREADING; pub const D3D10_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = D3D10_MESSAGE_ID.MESSAGE_REPORTING_OUTOFMEMORY; pub const D3D10_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.IASETINPUTLAYOUT_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.IASETINDEXBUFFER_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.VSSETSHADER_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.VSSETSAMPLERS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.GSSETSHADER_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.GSSETSAMPLERS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.SOSETTARGETS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.PSSETSHADER_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.PSSETSAMPLERS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.RSSETSTATE_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.OMSETBLENDSTATE_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.OMSETRENDERTARGETS_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT = D3D10_MESSAGE_ID.SETPREDICATION_UNBINDDELETINGOBJECT; pub const D3D10_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = D3D10_MESSAGE_ID.GETPRIVATEDATA_MOREDATA; pub const D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = D3D10_MESSAGE_ID.SETPRIVATEDATA_INVALIDFREEDATA; pub const D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = D3D10_MESSAGE_ID.SETPRIVATEDATA_INVALIDIUNKNOWN; pub const D3D10_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = D3D10_MESSAGE_ID.SETPRIVATEDATA_INVALIDFLAGS; pub const D3D10_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = D3D10_MESSAGE_ID.SETPRIVATEDATA_CHANGINGPARAMS; pub const D3D10_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = D3D10_MESSAGE_ID.SETPRIVATEDATA_OUTOFMEMORY; pub const D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT = D3D10_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDFORMAT; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDSAMPLES; pub const D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE = D3D10_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDUSAGE; pub const D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = D3D10_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = D3D10_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDINITIALDATA; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDMIPLEVELS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATEBUFFER_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATEBUFFER_NULLDESC = D3D10_MESSAGE_ID.CREATEBUFFER_NULLDESC; pub const D3D10_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = D3D10_MESSAGE_ID.CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS; pub const D3D10_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION = D3D10_MESSAGE_ID.CREATEBUFFER_LARGEALLOCATION; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT = D3D10_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDFORMAT; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT = D3D10_MESSAGE_ID.CREATETEXTURE1D_UNSUPPORTEDFORMAT; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDSAMPLES; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE = D3D10_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDUSAGE; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDINITIALDATA; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDMIPLEVELS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN = D3D10_MESSAGE_ID.CREATETEXTURE1D_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATETEXTURE1D_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_NULLDESC = D3D10_MESSAGE_ID.CREATETEXTURE1D_NULLDESC; pub const D3D10_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION = D3D10_MESSAGE_ID.CREATETEXTURE1D_LARGEALLOCATION; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT = D3D10_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDFORMAT; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT = D3D10_MESSAGE_ID.CREATETEXTURE2D_UNSUPPORTEDFORMAT; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDSAMPLES; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE = D3D10_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDUSAGE; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDINITIALDATA; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDMIPLEVELS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN = D3D10_MESSAGE_ID.CREATETEXTURE2D_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATETEXTURE2D_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_NULLDESC = D3D10_MESSAGE_ID.CREATETEXTURE2D_NULLDESC; pub const D3D10_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION = D3D10_MESSAGE_ID.CREATETEXTURE2D_LARGEALLOCATION; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT = D3D10_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDFORMAT; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT = D3D10_MESSAGE_ID.CREATETEXTURE3D_UNSUPPORTEDFORMAT; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDSAMPLES; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE = D3D10_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDUSAGE; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDCPUACCESSFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDBINDFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDINITIALDATA; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDMIPLEVELS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN = D3D10_MESSAGE_ID.CREATETEXTURE3D_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATETEXTURE3D_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_NULLDESC = D3D10_MESSAGE_ID.CREATETEXTURE3D_NULLDESC; pub const D3D10_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION = D3D10_MESSAGE_ID.CREATETEXTURE3D_LARGEALLOCATION; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDDESC; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDFORMAT; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDRESOURCE; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDDESC; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDFORMAT; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDRESOURCE; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_TOOMANYOBJECTS; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDDESC; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDFORMAT; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_OUTOFMEMORY; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_TOOMANYELEMENTS; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDFORMAT; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDSLOT; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDALIGNMENT; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_DUPLICATESEMANTIC; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_NULLSEMANTIC; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_MISSINGELEMENT; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_NULLDESC; pub const D3D10_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = D3D10_MESSAGE_ID.CREATEVERTEXSHADER_OUTOFMEMORY; pub const D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = D3D10_MESSAGE_ID.CREATEVERTEXSHADER_INVALIDSHADERBYTECODE; pub const D3D10_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = D3D10_MESSAGE_ID.CREATEVERTEXSHADER_INVALIDSHADERTYPE; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADER_OUTOFMEMORY; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADER_INVALIDSHADERTYPE; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE; pub const D3D10_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = D3D10_MESSAGE_ID.CREATEPIXELSHADER_OUTOFMEMORY; pub const D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = D3D10_MESSAGE_ID.CREATEPIXELSHADER_INVALIDSHADERBYTECODE; pub const D3D10_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = D3D10_MESSAGE_ID.CREATEPIXELSHADER_INVALIDSHADERTYPE; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDFILLMODE; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDCULLMODE; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_TOOMANYOBJECTS; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_NULLDESC; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_NULLDESC; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = D3D10_MESSAGE_ID.CREATEBLENDSTATE_INVALIDSRCBLEND; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = D3D10_MESSAGE_ID.CREATEBLENDSTATE_INVALIDDESTBLEND; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = D3D10_MESSAGE_ID.CREATEBLENDSTATE_INVALIDBLENDOP; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = D3D10_MESSAGE_ID.CREATEBLENDSTATE_INVALIDSRCBLENDALPHA; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = D3D10_MESSAGE_ID.CREATEBLENDSTATE_INVALIDDESTBLENDALPHA; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = D3D10_MESSAGE_ID.CREATEBLENDSTATE_INVALIDBLENDOPALPHA; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = D3D10_MESSAGE_ID.CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS = D3D10_MESSAGE_ID.CREATEBLENDSTATE_TOOMANYOBJECTS; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = D3D10_MESSAGE_ID.CREATEBLENDSTATE_NULLDESC; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDFILTER; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDADDRESSU; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDADDRESSV; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDADDRESSW; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMIPLODBIAS; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMAXANISOTROPY; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMINLOD; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMAXLOD; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_TOOMANYOBJECTS; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_NULLDESC; pub const D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY = D3D10_MESSAGE_ID.CREATEQUERYORPREDICATE_INVALIDQUERY; pub const D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = D3D10_MESSAGE_ID.CREATEQUERYORPREDICATE_INVALIDMISCFLAGS; pub const D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = D3D10_MESSAGE_ID.CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG; pub const D3D10_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC = D3D10_MESSAGE_ID.CREATEQUERYORPREDICATE_NULLDESC; pub const D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = D3D10_MESSAGE_ID.DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED; pub const D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = D3D10_MESSAGE_ID.DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED; pub const D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER = D3D10_MESSAGE_ID.IASETVERTEXBUFFERS_INVALIDBUFFER; pub const D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = D3D10_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE; pub const D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER = D3D10_MESSAGE_ID.IASETINDEXBUFFER_INVALIDBUFFER; pub const D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = D3D10_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_FORMAT_INVALID; pub const D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = D3D10_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE; pub const D3D10_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = D3D10_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED; pub const D3D10_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = D3D10_MESSAGE_ID.DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY; pub const D3D10_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D10_MESSAGE_ID.VSSETCONSTANTBUFFERS_INVALIDBUFFER; pub const D3D10_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = D3D10_MESSAGE_ID.DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY; pub const D3D10_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D10_MESSAGE_ID.GSSETCONSTANTBUFFERS_INVALIDBUFFER; pub const D3D10_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY; pub const D3D10_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER = D3D10_MESSAGE_ID.SOSETTARGETS_INVALIDBUFFER; pub const D3D10_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = D3D10_MESSAGE_ID.DEVICE_SOSETTARGETS_OFFSET_UNALIGNED; pub const D3D10_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = D3D10_MESSAGE_ID.DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY; pub const D3D10_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D10_MESSAGE_ID.PSSETCONSTANTBUFFERS_INVALIDBUFFER; pub const D3D10_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = D3D10_MESSAGE_ID.DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT; pub const D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = D3D10_MESSAGE_ID.DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR; pub const D3D10_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = D3D10_MESSAGE_ID.CLEARRENDERTARGETVIEW_DENORMFLUSH; pub const D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = D3D10_MESSAGE_ID.CLEARDEPTHSTENCILVIEW_DENORMFLUSH; pub const D3D10_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = D3D10_MESSAGE_ID.CLEARDEPTHSTENCILVIEW_INVALID; pub const D3D10_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = D3D10_MESSAGE_ID.DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = D3D10_MESSAGE_ID.DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_SOGETTARGETS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = D3D10_MESSAGE_ID.DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = D3D10_MESSAGE_ID.DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = D3D10_MESSAGE_ID.DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = D3D10_MESSAGE_ID.DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY; pub const D3D10_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID = D3D10_MESSAGE_ID.DEVICE_GENERATEMIPS_RESOURCE_INVALID; pub const D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = D3D10_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE; pub const D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = D3D10_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE; pub const D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = D3D10_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCEBOX; pub const D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE = D3D10_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCE; pub const D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = D3D10_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE; pub const D3D10_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = D3D10_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCESTATE; pub const D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = D3D10_MESSAGE_ID.COPYRESOURCE_INVALIDSOURCE; pub const D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = D3D10_MESSAGE_ID.COPYRESOURCE_INVALIDDESTINATIONSTATE; pub const D3D10_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = D3D10_MESSAGE_ID.COPYRESOURCE_INVALIDSOURCESTATE; pub const D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = D3D10_MESSAGE_ID.UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE; pub const D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = D3D10_MESSAGE_ID.UPDATESUBRESOURCE_INVALIDDESTINATIONBOX; pub const D3D10_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = D3D10_MESSAGE_ID.UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE; pub const D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = D3D10_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID; pub const D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = D3D10_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID; pub const D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = D3D10_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID; pub const D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = D3D10_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID; pub const D3D10_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = D3D10_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID; pub const D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = D3D10_MESSAGE_ID.BUFFER_MAP_INVALIDMAPTYPE; pub const D3D10_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = D3D10_MESSAGE_ID.BUFFER_MAP_INVALIDFLAGS; pub const D3D10_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = D3D10_MESSAGE_ID.BUFFER_MAP_ALREADYMAPPED; pub const D3D10_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = D3D10_MESSAGE_ID.BUFFER_MAP_DEVICEREMOVED_RETURN; pub const D3D10_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = D3D10_MESSAGE_ID.BUFFER_UNMAP_NOTMAPPED; pub const D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = D3D10_MESSAGE_ID.TEXTURE1D_MAP_INVALIDMAPTYPE; pub const D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = D3D10_MESSAGE_ID.TEXTURE1D_MAP_INVALIDSUBRESOURCE; pub const D3D10_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = D3D10_MESSAGE_ID.TEXTURE1D_MAP_INVALIDFLAGS; pub const D3D10_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = D3D10_MESSAGE_ID.TEXTURE1D_MAP_ALREADYMAPPED; pub const D3D10_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = D3D10_MESSAGE_ID.TEXTURE1D_MAP_DEVICEREMOVED_RETURN; pub const D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = D3D10_MESSAGE_ID.TEXTURE1D_UNMAP_INVALIDSUBRESOURCE; pub const D3D10_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = D3D10_MESSAGE_ID.TEXTURE1D_UNMAP_NOTMAPPED; pub const D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = D3D10_MESSAGE_ID.TEXTURE2D_MAP_INVALIDMAPTYPE; pub const D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = D3D10_MESSAGE_ID.TEXTURE2D_MAP_INVALIDSUBRESOURCE; pub const D3D10_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = D3D10_MESSAGE_ID.TEXTURE2D_MAP_INVALIDFLAGS; pub const D3D10_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = D3D10_MESSAGE_ID.TEXTURE2D_MAP_ALREADYMAPPED; pub const D3D10_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = D3D10_MESSAGE_ID.TEXTURE2D_MAP_DEVICEREMOVED_RETURN; pub const D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = D3D10_MESSAGE_ID.TEXTURE2D_UNMAP_INVALIDSUBRESOURCE; pub const D3D10_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = D3D10_MESSAGE_ID.TEXTURE2D_UNMAP_NOTMAPPED; pub const D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = D3D10_MESSAGE_ID.TEXTURE3D_MAP_INVALIDMAPTYPE; pub const D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = D3D10_MESSAGE_ID.TEXTURE3D_MAP_INVALIDSUBRESOURCE; pub const D3D10_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = D3D10_MESSAGE_ID.TEXTURE3D_MAP_INVALIDFLAGS; pub const D3D10_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = D3D10_MESSAGE_ID.TEXTURE3D_MAP_ALREADYMAPPED; pub const D3D10_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = D3D10_MESSAGE_ID.TEXTURE3D_MAP_DEVICEREMOVED_RETURN; pub const D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = D3D10_MESSAGE_ID.TEXTURE3D_UNMAP_INVALIDSUBRESOURCE; pub const D3D10_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = D3D10_MESSAGE_ID.TEXTURE3D_UNMAP_NOTMAPPED; pub const D3D10_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = D3D10_MESSAGE_ID.CHECKFORMATSUPPORT_FORMAT_DEPRECATED; pub const D3D10_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = D3D10_MESSAGE_ID.CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED; pub const D3D10_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = D3D10_MESSAGE_ID.SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS; pub const D3D10_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = D3D10_MESSAGE_ID.SETEXCEPTIONMODE_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = D3D10_MESSAGE_ID.SETEXCEPTIONMODE_DEVICEREMOVED_RETURN; pub const D3D10_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = D3D10_MESSAGE_ID.REF_SIMULATING_INFINITELY_FAST_HARDWARE; pub const D3D10_MESSAGE_ID_REF_THREADING_MODE = D3D10_MESSAGE_ID.REF_THREADING_MODE; pub const D3D10_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = D3D10_MESSAGE_ID.REF_UMDRIVER_EXCEPTION; pub const D3D10_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = D3D10_MESSAGE_ID.REF_KMDRIVER_EXCEPTION; pub const D3D10_MESSAGE_ID_REF_HARDWARE_EXCEPTION = D3D10_MESSAGE_ID.REF_HARDWARE_EXCEPTION; pub const D3D10_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = D3D10_MESSAGE_ID.REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE; pub const D3D10_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = D3D10_MESSAGE_ID.REF_PROBLEM_PARSING_SHADER; pub const D3D10_MESSAGE_ID_REF_OUT_OF_MEMORY = D3D10_MESSAGE_ID.REF_OUT_OF_MEMORY; pub const D3D10_MESSAGE_ID_REF_INFO = D3D10_MESSAGE_ID.REF_INFO; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = D3D10_MESSAGE_ID.DEVICE_DRAW_VERTEXPOS_OVERFLOW; pub const D3D10_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = D3D10_MESSAGE_ID.DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW; pub const D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = D3D10_MESSAGE_ID.DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW; pub const D3D10_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = D3D10_MESSAGE_ID.DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW; pub const D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = D3D10_MESSAGE_ID.DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW; pub const D3D10_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = D3D10_MESSAGE_ID.DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_VERTEX_SHADER_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = D3D10_MESSAGE_ID.DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND; pub const D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = D3D10_MESSAGE_ID.DEVICE_SHADER_LINKAGE_REGISTERINDEX; pub const D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = D3D10_MESSAGE_ID.DEVICE_SHADER_LINKAGE_COMPONENTTYPE; pub const D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = D3D10_MESSAGE_ID.DEVICE_SHADER_LINKAGE_REGISTERMASK; pub const D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = D3D10_MESSAGE_ID.DEVICE_SHADER_LINKAGE_SYSTEMVALUE; pub const D3D10_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = D3D10_MESSAGE_ID.DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_VERTEX_BUFFER_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_INPUTLAYOUT_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = D3D10_MESSAGE_ID.DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_SAMPLER_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = D3D10_MESSAGE_ID.DEVICE_DRAW_VIEW_DIMENSION_MISMATCH; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = D3D10_MESSAGE_ID.DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = D3D10_MESSAGE_ID.DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_INDEX_BUFFER_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = D3D10_MESSAGE_ID.DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = D3D10_MESSAGE_ID.DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = D3D10_MESSAGE_ID.DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = D3D10_MESSAGE_ID.DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT = D3D10_MESSAGE_ID.DEVICE_DRAW_POSITION_NOT_PRESENT; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_OUTPUT_STREAM_NOT_SET; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED = D3D10_MESSAGE_ID.DEVICE_DRAW_BOUND_RESOURCE_MAPPED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = D3D10_MESSAGE_ID.DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = D3D10_MESSAGE_ID.DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = D3D10_MESSAGE_ID.DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = D3D10_MESSAGE_ID.DEVICE_DRAW_INDEX_OFFSET_UNALIGNED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = D3D10_MESSAGE_ID.DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = D3D10_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = D3D10_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = D3D10_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = D3D10_MESSAGE_ID.DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = D3D10_MESSAGE_ID.DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = D3D10_MESSAGE_ID.DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = D3D10_MESSAGE_ID.DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = D3D10_MESSAGE_ID.DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0; pub const D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = D3D10_MESSAGE_ID.DEVICE_REMOVAL_PROCESS_AT_FAULT; pub const D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = D3D10_MESSAGE_ID.DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT; pub const D3D10_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = D3D10_MESSAGE_ID.DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT; pub const D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = D3D10_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN; pub const D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = D3D10_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = D3D10_MESSAGE_ID.DEVICE_DRAW_VIEWPORT_NOT_SET; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC; pub const D3D10_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = D3D10_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC; pub const D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = D3D10_MESSAGE_ID.DEVICE_RSSETVIEWPORTS_DENORMFLUSH; pub const D3D10_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = D3D10_MESSAGE_ID.OMSETRENDERTARGETS_INVALIDVIEW; pub const D3D10_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = D3D10_MESSAGE_ID.DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = D3D10_MESSAGE_ID.DEVICE_DRAW_SAMPLER_MISMATCH; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_TYPE_MISMATCH; pub const D3D10_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = D3D10_MESSAGE_ID.BLENDSTATE_GETDESC_LEGACY; pub const D3D10_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = D3D10_MESSAGE_ID.SHADERRESOURCEVIEW_GETDESC_LEGACY; pub const D3D10_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATEQUERY_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATEPREDICATE_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER = D3D10_MESSAGE_ID.CREATECOUNTER_OUTOFRANGE_COUNTER; pub const D3D10_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = D3D10_MESSAGE_ID.CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED; pub const D3D10_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = D3D10_MESSAGE_ID.CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER; pub const D3D10_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN = D3D10_MESSAGE_ID.CREATECOUNTER_OUTOFMEMORY_RETURN; pub const D3D10_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN = D3D10_MESSAGE_ID.CREATECOUNTER_NONEXCLUSIVE_RETURN; pub const D3D10_MESSAGE_ID_CREATECOUNTER_NULLDESC = D3D10_MESSAGE_ID.CREATECOUNTER_NULLDESC; pub const D3D10_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER = D3D10_MESSAGE_ID.CHECKCOUNTER_OUTOFRANGE_COUNTER; pub const D3D10_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = D3D10_MESSAGE_ID.CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER; pub const D3D10_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE = D3D10_MESSAGE_ID.SETPREDICATION_INVALID_PREDICATE_STATE; pub const D3D10_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED = D3D10_MESSAGE_ID.QUERY_BEGIN_UNSUPPORTED; pub const D3D10_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION = D3D10_MESSAGE_ID.PREDICATE_BEGIN_DURING_PREDICATION; pub const D3D10_MESSAGE_ID_QUERY_BEGIN_DUPLICATE = D3D10_MESSAGE_ID.QUERY_BEGIN_DUPLICATE; pub const D3D10_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = D3D10_MESSAGE_ID.QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS; pub const D3D10_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION = D3D10_MESSAGE_ID.PREDICATE_END_DURING_PREDICATION; pub const D3D10_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS = D3D10_MESSAGE_ID.QUERY_END_ABANDONING_PREVIOUS_RESULTS; pub const D3D10_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN = D3D10_MESSAGE_ID.QUERY_END_WITHOUT_BEGIN; pub const D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE = D3D10_MESSAGE_ID.QUERY_GETDATA_INVALID_DATASIZE; pub const D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS = D3D10_MESSAGE_ID.QUERY_GETDATA_INVALID_FLAGS; pub const D3D10_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL = D3D10_MESSAGE_ID.QUERY_GETDATA_INVALID_CALL; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = D3D10_MESSAGE_ID.DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = D3D10_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = D3D10_MESSAGE_ID.DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN; pub const D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = D3D10_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE; pub const D3D10_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = D3D10_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_EMPTY_LAYOUT; pub const D3D10_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = D3D10_MESSAGE_ID.DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH; pub const D3D10_MESSAGE_ID_LIVE_OBJECT_SUMMARY = D3D10_MESSAGE_ID.LIVE_OBJECT_SUMMARY; pub const D3D10_MESSAGE_ID_LIVE_BUFFER = D3D10_MESSAGE_ID.LIVE_BUFFER; pub const D3D10_MESSAGE_ID_LIVE_TEXTURE1D = D3D10_MESSAGE_ID.LIVE_TEXTURE1D; pub const D3D10_MESSAGE_ID_LIVE_TEXTURE2D = D3D10_MESSAGE_ID.LIVE_TEXTURE2D; pub const D3D10_MESSAGE_ID_LIVE_TEXTURE3D = D3D10_MESSAGE_ID.LIVE_TEXTURE3D; pub const D3D10_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW = D3D10_MESSAGE_ID.LIVE_SHADERRESOURCEVIEW; pub const D3D10_MESSAGE_ID_LIVE_RENDERTARGETVIEW = D3D10_MESSAGE_ID.LIVE_RENDERTARGETVIEW; pub const D3D10_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW = D3D10_MESSAGE_ID.LIVE_DEPTHSTENCILVIEW; pub const D3D10_MESSAGE_ID_LIVE_VERTEXSHADER = D3D10_MESSAGE_ID.LIVE_VERTEXSHADER; pub const D3D10_MESSAGE_ID_LIVE_GEOMETRYSHADER = D3D10_MESSAGE_ID.LIVE_GEOMETRYSHADER; pub const D3D10_MESSAGE_ID_LIVE_PIXELSHADER = D3D10_MESSAGE_ID.LIVE_PIXELSHADER; pub const D3D10_MESSAGE_ID_LIVE_INPUTLAYOUT = D3D10_MESSAGE_ID.LIVE_INPUTLAYOUT; pub const D3D10_MESSAGE_ID_LIVE_SAMPLER = D3D10_MESSAGE_ID.LIVE_SAMPLER; pub const D3D10_MESSAGE_ID_LIVE_BLENDSTATE = D3D10_MESSAGE_ID.LIVE_BLENDSTATE; pub const D3D10_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE = D3D10_MESSAGE_ID.LIVE_DEPTHSTENCILSTATE; pub const D3D10_MESSAGE_ID_LIVE_RASTERIZERSTATE = D3D10_MESSAGE_ID.LIVE_RASTERIZERSTATE; pub const D3D10_MESSAGE_ID_LIVE_QUERY = D3D10_MESSAGE_ID.LIVE_QUERY; pub const D3D10_MESSAGE_ID_LIVE_PREDICATE = D3D10_MESSAGE_ID.LIVE_PREDICATE; pub const D3D10_MESSAGE_ID_LIVE_COUNTER = D3D10_MESSAGE_ID.LIVE_COUNTER; pub const D3D10_MESSAGE_ID_LIVE_DEVICE = D3D10_MESSAGE_ID.LIVE_DEVICE; pub const D3D10_MESSAGE_ID_LIVE_SWAPCHAIN = D3D10_MESSAGE_ID.LIVE_SWAPCHAIN; pub const D3D10_MESSAGE_ID_D3D10_MESSAGES_END = D3D10_MESSAGE_ID.D3D10_MESSAGES_END; pub const D3D10_MESSAGE_ID_D3D10L9_MESSAGES_START = D3D10_MESSAGE_ID.D3D10L9_MESSAGES_START; pub const D3D10_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = D3D10_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE; pub const D3D10_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED = D3D10_MESSAGE_ID.VSSETSAMPLERS_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS = D3D10_MESSAGE_ID.VSSETSAMPLERS_TOO_MANY_SAMPLERS; pub const D3D10_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS = D3D10_MESSAGE_ID.PSSETSAMPLERS_TOO_MANY_SAMPLERS; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS = D3D10_MESSAGE_ID.CREATERESOURCE_NO_ARRAYS; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND = D3D10_MESSAGE_ID.CREATERESOURCE_NO_VB_AND_IB_BIND; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D = D3D10_MESSAGE_ID.CREATERESOURCE_NO_TEXTURE_1D; pub const D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE = D3D10_MESSAGE_ID.CREATERESOURCE_DIMENSION_OUT_OF_RANGE; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = D3D10_MESSAGE_ID.CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE; pub const D3D10_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = D3D10_MESSAGE_ID.OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS; pub const D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = D3D10_MESSAGE_ID.OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS; pub const D3D10_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = D3D10_MESSAGE_ID.IASETVERTEXBUFFERS_BAD_BUFFER_INDEX; pub const D3D10_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = D3D10_MESSAGE_ID.DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS; pub const D3D10_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = D3D10_MESSAGE_ID.DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED; pub const D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = D3D10_MESSAGE_ID.DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS; pub const D3D10_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = D3D10_MESSAGE_ID.COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY; pub const D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK = D3D10_MESSAGE_ID.COPYRESOURCE_NO_TEXTURE_3D_READBACK; pub const D3D10_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = D3D10_MESSAGE_ID.COPYRESOURCE_NO_TEXTURE_ONLY_READBACK; pub const D3D10_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = D3D10_MESSAGE_ID.CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = D3D10_MESSAGE_ID.CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE; pub const D3D10_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = D3D10_MESSAGE_ID.CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE; pub const D3D10_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = D3D10_MESSAGE_ID.DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO; pub const D3D10_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = D3D10_MESSAGE_ID.CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = D3D10_MESSAGE_ID.CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER = D3D10_MESSAGE_ID.CREATERESOURCE_NO_DWORD_INDEX_BUFFER; pub const D3D10_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = D3D10_MESSAGE_ID.CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE; pub const D3D10_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = D3D10_MESSAGE_ID.CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = D3D10_MESSAGE_ID.CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = D3D10_MESSAGE_ID.CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT = D3D10_MESSAGE_ID.CREATERESOURCE_NO_STREAM_OUT; pub const D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = D3D10_MESSAGE_ID.CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = D3D10_MESSAGE_ID.CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES; pub const D3D10_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = D3D10_MESSAGE_ID.CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED; pub const D3D10_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED = D3D10_MESSAGE_ID.VSSHADERRESOURCES_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED = D3D10_MESSAGE_ID.GEOMETRY_SHADER_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED = D3D10_MESSAGE_ID.STREAM_OUT_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED = D3D10_MESSAGE_ID.TEXT_FILTER_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = D3D10_MESSAGE_ID.CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND = D3D10_MESSAGE_ID.CREATEBLENDSTATE_NO_MRT_BLEND; pub const D3D10_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = D3D10_MESSAGE_ID.CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_NO_MIRRORONCE; pub const D3D10_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED = D3D10_MESSAGE_ID.DRAWINSTANCED_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = D3D10_MESSAGE_ID.DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3; pub const D3D10_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED = D3D10_MESSAGE_ID.DRAWINDEXED_POINTLIST_UNSUPPORTED; pub const D3D10_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = D3D10_MESSAGE_ID.SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO; pub const D3D10_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = D3D10_MESSAGE_ID.CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION; pub const D3D10_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = D3D10_MESSAGE_ID.CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED; pub const D3D10_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = D3D10_MESSAGE_ID.DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR; pub const D3D10_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = D3D10_MESSAGE_ID.SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA; pub const D3D10_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP = D3D10_MESSAGE_ID.CREATERESOURCE_NON_POW_2_MIPMAP; pub const D3D10_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = D3D10_MESSAGE_ID.CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED; pub const D3D10_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT = D3D10_MESSAGE_ID.OMSETRENDERTARGETS_NO_SRGB_MRT; pub const D3D10_MESSAGE_ID_COPYRESOURCE_NO_3D_MISMATCHED_UPDATES = D3D10_MESSAGE_ID.COPYRESOURCE_NO_3D_MISMATCHED_UPDATES; pub const D3D10_MESSAGE_ID_D3D10L9_MESSAGES_END = D3D10_MESSAGE_ID.D3D10L9_MESSAGES_END; pub const D3D10_MESSAGE = extern struct { Category: D3D10_MESSAGE_CATEGORY, Severity: D3D10_MESSAGE_SEVERITY, ID: D3D10_MESSAGE_ID, pDescription: ?*const u8, DescriptionByteLength: usize, }; pub const D3D10_INFO_QUEUE_FILTER_DESC = extern struct { NumCategories: u32, pCategoryList: ?*D3D10_MESSAGE_CATEGORY, NumSeverities: u32, pSeverityList: ?*D3D10_MESSAGE_SEVERITY, NumIDs: u32, pIDList: ?*D3D10_MESSAGE_ID, }; pub const D3D10_INFO_QUEUE_FILTER = extern struct { AllowList: D3D10_INFO_QUEUE_FILTER_DESC, DenyList: D3D10_INFO_QUEUE_FILTER_DESC, }; const IID_ID3D10InfoQueue_Value = @import("../zig.zig").Guid.initString("1b940b17-2642-4d1f-ab1f-b99bad0c395f"); pub const IID_ID3D10InfoQueue = &IID_ID3D10InfoQueue_Value; pub const ID3D10InfoQueue = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, SetMessageCountLimit: fn( self: *const ID3D10InfoQueue, MessageCountLimit: u64, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClearStoredMessages: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) void, GetMessage: fn( self: *const ID3D10InfoQueue, MessageIndex: u64, // TODO: what to do with BytesParamIndex 2? pMessage: ?*D3D10_MESSAGE, pMessageByteLength: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetNumMessagesAllowedByStorageFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u64, GetNumMessagesDeniedByStorageFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u64, GetNumStoredMessages: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u64, GetNumStoredMessagesAllowedByRetrievalFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u64, GetNumMessagesDiscardedByMessageCountLimit: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u64, GetMessageCountLimit: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u64, AddStorageFilterEntries: fn( self: *const ID3D10InfoQueue, pFilter: ?*D3D10_INFO_QUEUE_FILTER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStorageFilter: fn( self: *const ID3D10InfoQueue, // TODO: what to do with BytesParamIndex 1? pFilter: ?*D3D10_INFO_QUEUE_FILTER, pFilterByteLength: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClearStorageFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) void, PushEmptyStorageFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PushCopyOfStorageFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PushStorageFilter: fn( self: *const ID3D10InfoQueue, pFilter: ?*D3D10_INFO_QUEUE_FILTER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PopStorageFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) void, GetStorageFilterStackSize: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u32, AddRetrievalFilterEntries: fn( self: *const ID3D10InfoQueue, pFilter: ?*D3D10_INFO_QUEUE_FILTER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRetrievalFilter: fn( self: *const ID3D10InfoQueue, // TODO: what to do with BytesParamIndex 1? pFilter: ?*D3D10_INFO_QUEUE_FILTER, pFilterByteLength: ?*usize, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ClearRetrievalFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) void, PushEmptyRetrievalFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PushCopyOfRetrievalFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PushRetrievalFilter: fn( self: *const ID3D10InfoQueue, pFilter: ?*D3D10_INFO_QUEUE_FILTER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, PopRetrievalFilter: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) void, GetRetrievalFilterStackSize: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) u32, AddMessage: fn( self: *const ID3D10InfoQueue, Category: D3D10_MESSAGE_CATEGORY, Severity: D3D10_MESSAGE_SEVERITY, ID: D3D10_MESSAGE_ID, pDescription: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddApplicationMessage: fn( self: *const ID3D10InfoQueue, Severity: D3D10_MESSAGE_SEVERITY, pDescription: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBreakOnCategory: fn( self: *const ID3D10InfoQueue, Category: D3D10_MESSAGE_CATEGORY, bEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBreakOnSeverity: fn( self: *const ID3D10InfoQueue, Severity: D3D10_MESSAGE_SEVERITY, bEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBreakOnID: fn( self: *const ID3D10InfoQueue, ID: D3D10_MESSAGE_ID, bEnable: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBreakOnCategory: fn( self: *const ID3D10InfoQueue, Category: D3D10_MESSAGE_CATEGORY, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetBreakOnSeverity: fn( self: *const ID3D10InfoQueue, Severity: D3D10_MESSAGE_SEVERITY, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetBreakOnID: fn( self: *const ID3D10InfoQueue, ID: D3D10_MESSAGE_ID, ) callconv(@import("std").os.windows.WINAPI) BOOL, SetMuteDebugOutput: fn( self: *const ID3D10InfoQueue, bMute: BOOL, ) callconv(@import("std").os.windows.WINAPI) void, GetMuteDebugOutput: fn( self: *const ID3D10InfoQueue, ) callconv(@import("std").os.windows.WINAPI) BOOL, }; 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 ID3D10InfoQueue_SetMessageCountLimit(self: *const T, MessageCountLimit: u64) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).SetMessageCountLimit(@ptrCast(*const ID3D10InfoQueue, self), MessageCountLimit); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_ClearStoredMessages(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).ClearStoredMessages(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetMessage(self: *const T, MessageIndex: u64, pMessage: ?*D3D10_MESSAGE, pMessageByteLength: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetMessage(@ptrCast(*const ID3D10InfoQueue, self), MessageIndex, pMessage, pMessageByteLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetNumMessagesAllowedByStorageFilter(self: *const T) callconv(.Inline) u64 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetNumMessagesAllowedByStorageFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetNumMessagesDeniedByStorageFilter(self: *const T) callconv(.Inline) u64 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetNumMessagesDeniedByStorageFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetNumStoredMessages(self: *const T) callconv(.Inline) u64 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetNumStoredMessages(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(self: *const T) callconv(.Inline) u64 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetNumStoredMessagesAllowedByRetrievalFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(self: *const T) callconv(.Inline) u64 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetNumMessagesDiscardedByMessageCountLimit(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetMessageCountLimit(self: *const T) callconv(.Inline) u64 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetMessageCountLimit(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_AddStorageFilterEntries(self: *const T, pFilter: ?*D3D10_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).AddStorageFilterEntries(@ptrCast(*const ID3D10InfoQueue, self), pFilter); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetStorageFilter(self: *const T, pFilter: ?*D3D10_INFO_QUEUE_FILTER, pFilterByteLength: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetStorageFilter(@ptrCast(*const ID3D10InfoQueue, self), pFilter, pFilterByteLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_ClearStorageFilter(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).ClearStorageFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PushEmptyStorageFilter(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PushEmptyStorageFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PushCopyOfStorageFilter(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PushCopyOfStorageFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PushStorageFilter(self: *const T, pFilter: ?*D3D10_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PushStorageFilter(@ptrCast(*const ID3D10InfoQueue, self), pFilter); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PopStorageFilter(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PopStorageFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetStorageFilterStackSize(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetStorageFilterStackSize(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_AddRetrievalFilterEntries(self: *const T, pFilter: ?*D3D10_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).AddRetrievalFilterEntries(@ptrCast(*const ID3D10InfoQueue, self), pFilter); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetRetrievalFilter(self: *const T, pFilter: ?*D3D10_INFO_QUEUE_FILTER, pFilterByteLength: ?*usize) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetRetrievalFilter(@ptrCast(*const ID3D10InfoQueue, self), pFilter, pFilterByteLength); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_ClearRetrievalFilter(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).ClearRetrievalFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PushEmptyRetrievalFilter(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PushEmptyRetrievalFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PushCopyOfRetrievalFilter(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PushCopyOfRetrievalFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PushRetrievalFilter(self: *const T, pFilter: ?*D3D10_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PushRetrievalFilter(@ptrCast(*const ID3D10InfoQueue, self), pFilter); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_PopRetrievalFilter(self: *const T) callconv(.Inline) void { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).PopRetrievalFilter(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetRetrievalFilterStackSize(self: *const T) callconv(.Inline) u32 { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetRetrievalFilterStackSize(@ptrCast(*const ID3D10InfoQueue, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_AddMessage(self: *const T, Category: D3D10_MESSAGE_CATEGORY, Severity: D3D10_MESSAGE_SEVERITY, ID: D3D10_MESSAGE_ID, pDescription: ?[*:0]const u8) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).AddMessage(@ptrCast(*const ID3D10InfoQueue, self), Category, Severity, ID, pDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_AddApplicationMessage(self: *const T, Severity: D3D10_MESSAGE_SEVERITY, pDescription: ?[*:0]const u8) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).AddApplicationMessage(@ptrCast(*const ID3D10InfoQueue, self), Severity, pDescription); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_SetBreakOnCategory(self: *const T, Category: D3D10_MESSAGE_CATEGORY, bEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).SetBreakOnCategory(@ptrCast(*const ID3D10InfoQueue, self), Category, bEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_SetBreakOnSeverity(self: *const T, Severity: D3D10_MESSAGE_SEVERITY, bEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).SetBreakOnSeverity(@ptrCast(*const ID3D10InfoQueue, self), Severity, bEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_SetBreakOnID(self: *const T, ID: D3D10_MESSAGE_ID, bEnable: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).SetBreakOnID(@ptrCast(*const ID3D10InfoQueue, self), ID, bEnable); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetBreakOnCategory(self: *const T, Category: D3D10_MESSAGE_CATEGORY) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetBreakOnCategory(@ptrCast(*const ID3D10InfoQueue, self), Category); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetBreakOnSeverity(self: *const T, Severity: D3D10_MESSAGE_SEVERITY) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetBreakOnSeverity(@ptrCast(*const ID3D10InfoQueue, self), Severity); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetBreakOnID(self: *const T, ID: D3D10_MESSAGE_ID) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetBreakOnID(@ptrCast(*const ID3D10InfoQueue, self), ID); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_SetMuteDebugOutput(self: *const T, bMute: BOOL) callconv(.Inline) void { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).SetMuteDebugOutput(@ptrCast(*const ID3D10InfoQueue, self), bMute); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10InfoQueue_GetMuteDebugOutput(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10InfoQueue.VTable, self.vtable).GetMuteDebugOutput(@ptrCast(*const ID3D10InfoQueue, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_DRIVER_TYPE = enum(i32) { HARDWARE = 0, REFERENCE = 1, NULL = 2, SOFTWARE = 3, WARP = 5, }; pub const D3D10_DRIVER_TYPE_HARDWARE = D3D10_DRIVER_TYPE.HARDWARE; pub const D3D10_DRIVER_TYPE_REFERENCE = D3D10_DRIVER_TYPE.REFERENCE; pub const D3D10_DRIVER_TYPE_NULL = D3D10_DRIVER_TYPE.NULL; pub const D3D10_DRIVER_TYPE_SOFTWARE = D3D10_DRIVER_TYPE.SOFTWARE; pub const D3D10_DRIVER_TYPE_WARP = D3D10_DRIVER_TYPE.WARP; pub const D3D10_SHADER_DESC = extern struct { Version: u32, Creator: ?[*:0]const u8, Flags: u32, ConstantBuffers: u32, BoundResources: u32, InputParameters: u32, OutputParameters: u32, InstructionCount: u32, TempRegisterCount: u32, TempArrayCount: u32, DefCount: u32, DclCount: u32, TextureNormalInstructions: u32, TextureLoadInstructions: u32, TextureCompInstructions: u32, TextureBiasInstructions: u32, TextureGradientInstructions: u32, FloatInstructionCount: u32, IntInstructionCount: u32, UintInstructionCount: u32, StaticFlowControlCount: u32, DynamicFlowControlCount: u32, MacroInstructionCount: u32, ArrayInstructionCount: u32, CutInstructionCount: u32, EmitInstructionCount: u32, GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY, GSMaxOutputVertexCount: u32, }; pub const D3D10_SHADER_BUFFER_DESC = extern struct { Name: ?[*:0]const u8, Type: D3D_CBUFFER_TYPE, Variables: u32, Size: u32, uFlags: u32, }; pub const D3D10_SHADER_VARIABLE_DESC = extern struct { Name: ?[*:0]const u8, StartOffset: u32, Size: u32, uFlags: u32, DefaultValue: ?*c_void, }; pub const D3D10_SHADER_TYPE_DESC = extern struct { Class: D3D_SHADER_VARIABLE_CLASS, Type: D3D_SHADER_VARIABLE_TYPE, Rows: u32, Columns: u32, Elements: u32, Members: u32, Offset: u32, }; pub const D3D10_SHADER_INPUT_BIND_DESC = extern struct { Name: ?[*:0]const u8, Type: D3D_SHADER_INPUT_TYPE, BindPoint: u32, BindCount: u32, uFlags: u32, ReturnType: D3D_RESOURCE_RETURN_TYPE, Dimension: D3D_SRV_DIMENSION, NumSamples: u32, }; pub const D3D10_SIGNATURE_PARAMETER_DESC = extern struct { SemanticName: ?[*:0]const u8, SemanticIndex: u32, Register: u32, SystemValueType: D3D_NAME, ComponentType: D3D_REGISTER_COMPONENT_TYPE, Mask: u8, ReadWriteMask: u8, }; const IID_ID3D10ShaderReflectionType_Value = @import("../zig.zig").Guid.initString("c530ad7d-9b16-4395-a979-ba2ecff83add"); pub const IID_ID3D10ShaderReflectionType = &IID_ID3D10ShaderReflectionType_Value; pub const ID3D10ShaderReflectionType = extern struct { pub const VTable = extern struct { GetDesc: fn( self: *const ID3D10ShaderReflectionType, pDesc: ?*D3D10_SHADER_TYPE_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMemberTypeByIndex: fn( self: *const ID3D10ShaderReflectionType, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionType, GetMemberTypeByName: fn( self: *const ID3D10ShaderReflectionType, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionType, GetMemberTypeName: fn( self: *const ID3D10ShaderReflectionType, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionType_GetDesc(self: *const T, pDesc: ?*D3D10_SHADER_TYPE_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflectionType.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10ShaderReflectionType, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionType_GetMemberTypeByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10ShaderReflectionType { return @ptrCast(*const ID3D10ShaderReflectionType.VTable, self.vtable).GetMemberTypeByIndex(@ptrCast(*const ID3D10ShaderReflectionType, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionType_GetMemberTypeByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10ShaderReflectionType { return @ptrCast(*const ID3D10ShaderReflectionType.VTable, self.vtable).GetMemberTypeByName(@ptrCast(*const ID3D10ShaderReflectionType, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionType_GetMemberTypeName(self: *const T, Index: u32) callconv(.Inline) ?PSTR { return @ptrCast(*const ID3D10ShaderReflectionType.VTable, self.vtable).GetMemberTypeName(@ptrCast(*const ID3D10ShaderReflectionType, self), Index); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10ShaderReflectionVariable_Value = @import("../zig.zig").Guid.initString("1bf63c95-2650-405d-99c1-3636bd1da0a1"); pub const IID_ID3D10ShaderReflectionVariable = &IID_ID3D10ShaderReflectionVariable_Value; pub const ID3D10ShaderReflectionVariable = extern struct { pub const VTable = extern struct { GetDesc: fn( self: *const ID3D10ShaderReflectionVariable, pDesc: ?*D3D10_SHADER_VARIABLE_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetType: fn( self: *const ID3D10ShaderReflectionVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionType, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionVariable_GetDesc(self: *const T, pDesc: ?*D3D10_SHADER_VARIABLE_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflectionVariable.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10ShaderReflectionVariable, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionVariable_GetType(self: *const T) callconv(.Inline) ?*ID3D10ShaderReflectionType { return @ptrCast(*const ID3D10ShaderReflectionVariable.VTable, self.vtable).GetType(@ptrCast(*const ID3D10ShaderReflectionVariable, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10ShaderReflectionConstantBuffer_Value = @import("../zig.zig").Guid.initString("66c66a94-dddd-4b62-a66a-f0da33c2b4d0"); pub const IID_ID3D10ShaderReflectionConstantBuffer = &IID_ID3D10ShaderReflectionConstantBuffer_Value; pub const ID3D10ShaderReflectionConstantBuffer = extern struct { pub const VTable = extern struct { GetDesc: fn( self: *const ID3D10ShaderReflectionConstantBuffer, pDesc: ?*D3D10_SHADER_BUFFER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVariableByIndex: fn( self: *const ID3D10ShaderReflectionConstantBuffer, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionVariable, GetVariableByName: fn( self: *const ID3D10ShaderReflectionConstantBuffer, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionVariable, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionConstantBuffer_GetDesc(self: *const T, pDesc: ?*D3D10_SHADER_BUFFER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflectionConstantBuffer.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10ShaderReflectionConstantBuffer, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionConstantBuffer_GetVariableByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10ShaderReflectionVariable { return @ptrCast(*const ID3D10ShaderReflectionConstantBuffer.VTable, self.vtable).GetVariableByIndex(@ptrCast(*const ID3D10ShaderReflectionConstantBuffer, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflectionConstantBuffer_GetVariableByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10ShaderReflectionVariable { return @ptrCast(*const ID3D10ShaderReflectionConstantBuffer.VTable, self.vtable).GetVariableByName(@ptrCast(*const ID3D10ShaderReflectionConstantBuffer, self), Name); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10ShaderReflection_Value = @import("../zig.zig").Guid.initString("d40e20b6-f8f7-42ad-ab20-4baf8f15dfaa"); pub const IID_ID3D10ShaderReflection = &IID_ID3D10ShaderReflection_Value; pub const ID3D10ShaderReflection = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDesc: fn( self: *const ID3D10ShaderReflection, pDesc: ?*D3D10_SHADER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConstantBufferByIndex: fn( self: *const ID3D10ShaderReflection, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionConstantBuffer, GetConstantBufferByName: fn( self: *const ID3D10ShaderReflection, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionConstantBuffer, GetResourceBindingDesc: fn( self: *const ID3D10ShaderReflection, ResourceIndex: u32, pDesc: ?*D3D10_SHADER_INPUT_BIND_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputParameterDesc: fn( self: *const ID3D10ShaderReflection, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOutputParameterDesc: fn( self: *const ID3D10ShaderReflection, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC, ) 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 ID3D10ShaderReflection_GetDesc(self: *const T, pDesc: ?*D3D10_SHADER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10ShaderReflection, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection_GetConstantBufferByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10ShaderReflectionConstantBuffer { return @ptrCast(*const ID3D10ShaderReflection.VTable, self.vtable).GetConstantBufferByIndex(@ptrCast(*const ID3D10ShaderReflection, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection_GetConstantBufferByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10ShaderReflectionConstantBuffer { return @ptrCast(*const ID3D10ShaderReflection.VTable, self.vtable).GetConstantBufferByName(@ptrCast(*const ID3D10ShaderReflection, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection_GetResourceBindingDesc(self: *const T, ResourceIndex: u32, pDesc: ?*D3D10_SHADER_INPUT_BIND_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection.VTable, self.vtable).GetResourceBindingDesc(@ptrCast(*const ID3D10ShaderReflection, self), ResourceIndex, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection_GetInputParameterDesc(self: *const T, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection.VTable, self.vtable).GetInputParameterDesc(@ptrCast(*const ID3D10ShaderReflection, self), ParameterIndex, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection_GetOutputParameterDesc(self: *const T, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection.VTable, self.vtable).GetOutputParameterDesc(@ptrCast(*const ID3D10ShaderReflection, self), ParameterIndex, pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_DEVICE_STATE_TYPES = enum(i32) { SO_BUFFERS = 1, OM_RENDER_TARGETS = 2, OM_DEPTH_STENCIL_STATE = 3, OM_BLEND_STATE = 4, VS = 5, VS_SAMPLERS = 6, VS_SHADER_RESOURCES = 7, VS_CONSTANT_BUFFERS = 8, GS = 9, GS_SAMPLERS = 10, GS_SHADER_RESOURCES = 11, GS_CONSTANT_BUFFERS = 12, PS = 13, PS_SAMPLERS = 14, PS_SHADER_RESOURCES = 15, PS_CONSTANT_BUFFERS = 16, IA_VERTEX_BUFFERS = 17, IA_INDEX_BUFFER = 18, IA_INPUT_LAYOUT = 19, IA_PRIMITIVE_TOPOLOGY = 20, RS_VIEWPORTS = 21, RS_SCISSOR_RECTS = 22, RS_RASTERIZER_STATE = 23, PREDICATION = 24, }; pub const D3D10_DST_SO_BUFFERS = D3D10_DEVICE_STATE_TYPES.SO_BUFFERS; pub const D3D10_DST_OM_RENDER_TARGETS = D3D10_DEVICE_STATE_TYPES.OM_RENDER_TARGETS; pub const D3D10_DST_OM_DEPTH_STENCIL_STATE = D3D10_DEVICE_STATE_TYPES.OM_DEPTH_STENCIL_STATE; pub const D3D10_DST_OM_BLEND_STATE = D3D10_DEVICE_STATE_TYPES.OM_BLEND_STATE; pub const D3D10_DST_VS = D3D10_DEVICE_STATE_TYPES.VS; pub const D3D10_DST_VS_SAMPLERS = D3D10_DEVICE_STATE_TYPES.VS_SAMPLERS; pub const D3D10_DST_VS_SHADER_RESOURCES = D3D10_DEVICE_STATE_TYPES.VS_SHADER_RESOURCES; pub const D3D10_DST_VS_CONSTANT_BUFFERS = D3D10_DEVICE_STATE_TYPES.VS_CONSTANT_BUFFERS; pub const D3D10_DST_GS = D3D10_DEVICE_STATE_TYPES.GS; pub const D3D10_DST_GS_SAMPLERS = D3D10_DEVICE_STATE_TYPES.GS_SAMPLERS; pub const D3D10_DST_GS_SHADER_RESOURCES = D3D10_DEVICE_STATE_TYPES.GS_SHADER_RESOURCES; pub const D3D10_DST_GS_CONSTANT_BUFFERS = D3D10_DEVICE_STATE_TYPES.GS_CONSTANT_BUFFERS; pub const D3D10_DST_PS = D3D10_DEVICE_STATE_TYPES.PS; pub const D3D10_DST_PS_SAMPLERS = D3D10_DEVICE_STATE_TYPES.PS_SAMPLERS; pub const D3D10_DST_PS_SHADER_RESOURCES = D3D10_DEVICE_STATE_TYPES.PS_SHADER_RESOURCES; pub const D3D10_DST_PS_CONSTANT_BUFFERS = D3D10_DEVICE_STATE_TYPES.PS_CONSTANT_BUFFERS; pub const D3D10_DST_IA_VERTEX_BUFFERS = D3D10_DEVICE_STATE_TYPES.IA_VERTEX_BUFFERS; pub const D3D10_DST_IA_INDEX_BUFFER = D3D10_DEVICE_STATE_TYPES.IA_INDEX_BUFFER; pub const D3D10_DST_IA_INPUT_LAYOUT = D3D10_DEVICE_STATE_TYPES.IA_INPUT_LAYOUT; pub const D3D10_DST_IA_PRIMITIVE_TOPOLOGY = D3D10_DEVICE_STATE_TYPES.IA_PRIMITIVE_TOPOLOGY; pub const D3D10_DST_RS_VIEWPORTS = D3D10_DEVICE_STATE_TYPES.RS_VIEWPORTS; pub const D3D10_DST_RS_SCISSOR_RECTS = D3D10_DEVICE_STATE_TYPES.RS_SCISSOR_RECTS; pub const D3D10_DST_RS_RASTERIZER_STATE = D3D10_DEVICE_STATE_TYPES.RS_RASTERIZER_STATE; pub const D3D10_DST_PREDICATION = D3D10_DEVICE_STATE_TYPES.PREDICATION; pub const D3D10_STATE_BLOCK_MASK = extern struct { VS: u8, VSSamplers: [2]u8, VSShaderResources: [16]u8, VSConstantBuffers: [2]u8, GS: u8, GSSamplers: [2]u8, GSShaderResources: [16]u8, GSConstantBuffers: [2]u8, PS: u8, PSSamplers: [2]u8, PSShaderResources: [16]u8, PSConstantBuffers: [2]u8, IAVertexBuffers: [2]u8, IAIndexBuffer: u8, IAInputLayout: u8, IAPrimitiveTopology: u8, OMRenderTargets: u8, OMDepthStencilState: u8, OMBlendState: u8, RSViewports: u8, RSScissorRects: u8, RSRasterizerState: u8, SOBuffers: u8, Predication: u8, }; const IID_ID3D10StateBlock_Value = @import("../zig.zig").Guid.initString("0803425a-57f5-4dd6-9465-a87570834a08"); pub const IID_ID3D10StateBlock = &IID_ID3D10StateBlock_Value; pub const ID3D10StateBlock = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Capture: fn( self: *const ID3D10StateBlock, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Apply: fn( self: *const ID3D10StateBlock, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ReleaseAllDeviceObjects: fn( self: *const ID3D10StateBlock, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDevice: fn( self: *const ID3D10StateBlock, ppDevice: ?*?*ID3D10Device, ) 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 ID3D10StateBlock_Capture(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10StateBlock.VTable, self.vtable).Capture(@ptrCast(*const ID3D10StateBlock, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10StateBlock_Apply(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10StateBlock.VTable, self.vtable).Apply(@ptrCast(*const ID3D10StateBlock, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10StateBlock_ReleaseAllDeviceObjects(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10StateBlock.VTable, self.vtable).ReleaseAllDeviceObjects(@ptrCast(*const ID3D10StateBlock, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10StateBlock_GetDevice(self: *const T, ppDevice: ?*?*ID3D10Device) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10StateBlock.VTable, self.vtable).GetDevice(@ptrCast(*const ID3D10StateBlock, self), ppDevice); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_EFFECT_TYPE_DESC = extern struct { TypeName: ?[*:0]const u8, Class: D3D_SHADER_VARIABLE_CLASS, Type: D3D_SHADER_VARIABLE_TYPE, Elements: u32, Members: u32, Rows: u32, Columns: u32, PackedSize: u32, UnpackedSize: u32, Stride: u32, }; const IID_ID3D10EffectType_Value = @import("../zig.zig").Guid.initString("4e9e1ddc-cd9d-4772-a837-00180b9b88fd"); pub const IID_ID3D10EffectType = &IID_ID3D10EffectType_Value; pub const ID3D10EffectType = extern struct { pub const VTable = extern struct { IsValid: fn( self: *const ID3D10EffectType, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetDesc: fn( self: *const ID3D10EffectType, pDesc: ?*D3D10_EFFECT_TYPE_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMemberTypeByIndex: fn( self: *const ID3D10EffectType, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectType, GetMemberTypeByName: fn( self: *const ID3D10EffectType, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectType, GetMemberTypeBySemantic: fn( self: *const ID3D10EffectType, Semantic: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectType, GetMemberName: fn( self: *const ID3D10EffectType, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR, GetMemberSemantic: fn( self: *const ID3D10EffectType, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?PSTR, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectType_IsValid(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10EffectType.VTable, self.vtable).IsValid(@ptrCast(*const ID3D10EffectType, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectType_GetDesc(self: *const T, pDesc: ?*D3D10_EFFECT_TYPE_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectType.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10EffectType, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectType_GetMemberTypeByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectType { return @ptrCast(*const ID3D10EffectType.VTable, self.vtable).GetMemberTypeByIndex(@ptrCast(*const ID3D10EffectType, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectType_GetMemberTypeByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectType { return @ptrCast(*const ID3D10EffectType.VTable, self.vtable).GetMemberTypeByName(@ptrCast(*const ID3D10EffectType, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectType_GetMemberTypeBySemantic(self: *const T, Semantic: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectType { return @ptrCast(*const ID3D10EffectType.VTable, self.vtable).GetMemberTypeBySemantic(@ptrCast(*const ID3D10EffectType, self), Semantic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectType_GetMemberName(self: *const T, Index: u32) callconv(.Inline) ?PSTR { return @ptrCast(*const ID3D10EffectType.VTable, self.vtable).GetMemberName(@ptrCast(*const ID3D10EffectType, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectType_GetMemberSemantic(self: *const T, Index: u32) callconv(.Inline) ?PSTR { return @ptrCast(*const ID3D10EffectType.VTable, self.vtable).GetMemberSemantic(@ptrCast(*const ID3D10EffectType, self), Index); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_EFFECT_VARIABLE_DESC = extern struct { Name: ?[*:0]const u8, Semantic: ?[*:0]const u8, Flags: u32, Annotations: u32, BufferOffset: u32, ExplicitBindPoint: u32, }; const IID_ID3D10EffectVariable_Value = @import("../zig.zig").Guid.initString("ae897105-00e6-45bf-bb8e-281dd6db8e1b"); pub const IID_ID3D10EffectVariable = &IID_ID3D10EffectVariable_Value; pub const ID3D10EffectVariable = extern struct { pub const VTable = extern struct { IsValid: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetType: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectType, GetDesc: fn( self: *const ID3D10EffectVariable, pDesc: ?*D3D10_EFFECT_VARIABLE_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAnnotationByIndex: fn( self: *const ID3D10EffectVariable, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetAnnotationByName: fn( self: *const ID3D10EffectVariable, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetMemberByIndex: fn( self: *const ID3D10EffectVariable, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetMemberByName: fn( self: *const ID3D10EffectVariable, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetMemberBySemantic: fn( self: *const ID3D10EffectVariable, Semantic: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetElement: fn( self: *const ID3D10EffectVariable, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetParentConstantBuffer: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectConstantBuffer, AsScalar: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectScalarVariable, AsVector: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVectorVariable, AsMatrix: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectMatrixVariable, AsString: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectStringVariable, AsShaderResource: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectShaderResourceVariable, AsRenderTargetView: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectRenderTargetViewVariable, AsDepthStencilView: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectDepthStencilViewVariable, AsConstantBuffer: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectConstantBuffer, AsShader: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectShaderVariable, AsBlend: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectBlendVariable, AsDepthStencil: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectDepthStencilVariable, AsRasterizer: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectRasterizerVariable, AsSampler: fn( self: *const ID3D10EffectVariable, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectSamplerVariable, SetRawValue: fn( self: *const ID3D10EffectVariable, // TODO: what to do with BytesParamIndex 2? pData: ?*c_void, Offset: u32, ByteCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRawValue: fn( self: *const ID3D10EffectVariable, // TODO: what to do with BytesParamIndex 2? pData: ?*c_void, Offset: u32, ByteCount: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_IsValid(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).IsValid(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetType(self: *const T) callconv(.Inline) ?*ID3D10EffectType { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetType(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetDesc(self: *const T, pDesc: ?*D3D10_EFFECT_VARIABLE_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10EffectVariable, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetAnnotationByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetAnnotationByIndex(@ptrCast(*const ID3D10EffectVariable, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetAnnotationByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetAnnotationByName(@ptrCast(*const ID3D10EffectVariable, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetMemberByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetMemberByIndex(@ptrCast(*const ID3D10EffectVariable, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetMemberByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetMemberByName(@ptrCast(*const ID3D10EffectVariable, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetMemberBySemantic(self: *const T, Semantic: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetMemberBySemantic(@ptrCast(*const ID3D10EffectVariable, self), Semantic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetElement(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetElement(@ptrCast(*const ID3D10EffectVariable, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetParentConstantBuffer(self: *const T) callconv(.Inline) ?*ID3D10EffectConstantBuffer { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetParentConstantBuffer(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsScalar(self: *const T) callconv(.Inline) ?*ID3D10EffectScalarVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsScalar(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsVector(self: *const T) callconv(.Inline) ?*ID3D10EffectVectorVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsVector(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsMatrix(self: *const T) callconv(.Inline) ?*ID3D10EffectMatrixVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsMatrix(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsString(self: *const T) callconv(.Inline) ?*ID3D10EffectStringVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsString(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsShaderResource(self: *const T) callconv(.Inline) ?*ID3D10EffectShaderResourceVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsShaderResource(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsRenderTargetView(self: *const T) callconv(.Inline) ?*ID3D10EffectRenderTargetViewVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsRenderTargetView(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsDepthStencilView(self: *const T) callconv(.Inline) ?*ID3D10EffectDepthStencilViewVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsDepthStencilView(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsConstantBuffer(self: *const T) callconv(.Inline) ?*ID3D10EffectConstantBuffer { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsConstantBuffer(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsShader(self: *const T) callconv(.Inline) ?*ID3D10EffectShaderVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsShader(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsBlend(self: *const T) callconv(.Inline) ?*ID3D10EffectBlendVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsBlend(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsDepthStencil(self: *const T) callconv(.Inline) ?*ID3D10EffectDepthStencilVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsDepthStencil(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsRasterizer(self: *const T) callconv(.Inline) ?*ID3D10EffectRasterizerVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsRasterizer(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_AsSampler(self: *const T) callconv(.Inline) ?*ID3D10EffectSamplerVariable { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).AsSampler(@ptrCast(*const ID3D10EffectVariable, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_SetRawValue(self: *const T, pData: ?*c_void, Offset: u32, ByteCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).SetRawValue(@ptrCast(*const ID3D10EffectVariable, self), pData, Offset, ByteCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVariable_GetRawValue(self: *const T, pData: ?*c_void, Offset: u32, ByteCount: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVariable.VTable, self.vtable).GetRawValue(@ptrCast(*const ID3D10EffectVariable, self), pData, Offset, ByteCount); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectScalarVariable_Value = @import("../zig.zig").Guid.initString("00e48f7b-d2c8-49e8-a86c-022dee53431f"); pub const IID_ID3D10EffectScalarVariable = &IID_ID3D10EffectScalarVariable_Value; pub const ID3D10EffectScalarVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, SetFloat: fn( self: *const ID3D10EffectScalarVariable, Value: f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFloat: fn( self: *const ID3D10EffectScalarVariable, pValue: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFloatArray: fn( self: *const ID3D10EffectScalarVariable, pData: [*]f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFloatArray: fn( self: *const ID3D10EffectScalarVariable, pData: [*]f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetInt: fn( self: *const ID3D10EffectScalarVariable, Value: i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInt: fn( self: *const ID3D10EffectScalarVariable, pValue: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIntArray: fn( self: *const ID3D10EffectScalarVariable, pData: [*]i32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIntArray: fn( self: *const ID3D10EffectScalarVariable, pData: [*]i32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBool: fn( self: *const ID3D10EffectScalarVariable, Value: BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBool: fn( self: *const ID3D10EffectScalarVariable, pValue: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBoolArray: fn( self: *const ID3D10EffectScalarVariable, pData: [*]BOOL, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoolArray: fn( self: *const ID3D10EffectScalarVariable, pData: [*]BOOL, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_SetFloat(self: *const T, Value: f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).SetFloat(@ptrCast(*const ID3D10EffectScalarVariable, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_GetFloat(self: *const T, pValue: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).GetFloat(@ptrCast(*const ID3D10EffectScalarVariable, self), pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_SetFloatArray(self: *const T, pData: [*]f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).SetFloatArray(@ptrCast(*const ID3D10EffectScalarVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_GetFloatArray(self: *const T, pData: [*]f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).GetFloatArray(@ptrCast(*const ID3D10EffectScalarVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_SetInt(self: *const T, Value: i32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).SetInt(@ptrCast(*const ID3D10EffectScalarVariable, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_GetInt(self: *const T, pValue: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).GetInt(@ptrCast(*const ID3D10EffectScalarVariable, self), pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_SetIntArray(self: *const T, pData: [*]i32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).SetIntArray(@ptrCast(*const ID3D10EffectScalarVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_GetIntArray(self: *const T, pData: [*]i32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).GetIntArray(@ptrCast(*const ID3D10EffectScalarVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_SetBool(self: *const T, Value: BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).SetBool(@ptrCast(*const ID3D10EffectScalarVariable, self), Value); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_GetBool(self: *const T, pValue: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).GetBool(@ptrCast(*const ID3D10EffectScalarVariable, self), pValue); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_SetBoolArray(self: *const T, pData: [*]BOOL, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).SetBoolArray(@ptrCast(*const ID3D10EffectScalarVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectScalarVariable_GetBoolArray(self: *const T, pData: [*]BOOL, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectScalarVariable.VTable, self.vtable).GetBoolArray(@ptrCast(*const ID3D10EffectScalarVariable, self), pData, Offset, Count); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectVectorVariable_Value = @import("../zig.zig").Guid.initString("62b98c44-1f82-4c67-bcd0-72cf8f217e81"); pub const IID_ID3D10EffectVectorVariable = &IID_ID3D10EffectVectorVariable_Value; pub const ID3D10EffectVectorVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, SetBoolVector: fn( self: *const ID3D10EffectVectorVariable, pData: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIntVector: fn( self: *const ID3D10EffectVectorVariable, pData: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFloatVector: fn( self: *const ID3D10EffectVectorVariable, pData: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoolVector: fn( self: *const ID3D10EffectVectorVariable, pData: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIntVector: fn( self: *const ID3D10EffectVectorVariable, pData: ?*i32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFloatVector: fn( self: *const ID3D10EffectVectorVariable, pData: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetBoolVectorArray: fn( self: *const ID3D10EffectVectorVariable, pData: ?*BOOL, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetIntVectorArray: fn( self: *const ID3D10EffectVectorVariable, pData: ?*i32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetFloatVectorArray: fn( self: *const ID3D10EffectVectorVariable, pData: ?*f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBoolVectorArray: fn( self: *const ID3D10EffectVectorVariable, pData: ?*BOOL, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetIntVectorArray: fn( self: *const ID3D10EffectVectorVariable, pData: ?*i32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFloatVectorArray: fn( self: *const ID3D10EffectVectorVariable, pData: ?*f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_SetBoolVector(self: *const T, pData: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).SetBoolVector(@ptrCast(*const ID3D10EffectVectorVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_SetIntVector(self: *const T, pData: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).SetIntVector(@ptrCast(*const ID3D10EffectVectorVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_SetFloatVector(self: *const T, pData: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).SetFloatVector(@ptrCast(*const ID3D10EffectVectorVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_GetBoolVector(self: *const T, pData: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).GetBoolVector(@ptrCast(*const ID3D10EffectVectorVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_GetIntVector(self: *const T, pData: ?*i32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).GetIntVector(@ptrCast(*const ID3D10EffectVectorVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_GetFloatVector(self: *const T, pData: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).GetFloatVector(@ptrCast(*const ID3D10EffectVectorVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_SetBoolVectorArray(self: *const T, pData: ?*BOOL, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).SetBoolVectorArray(@ptrCast(*const ID3D10EffectVectorVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_SetIntVectorArray(self: *const T, pData: ?*i32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).SetIntVectorArray(@ptrCast(*const ID3D10EffectVectorVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_SetFloatVectorArray(self: *const T, pData: ?*f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).SetFloatVectorArray(@ptrCast(*const ID3D10EffectVectorVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_GetBoolVectorArray(self: *const T, pData: ?*BOOL, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).GetBoolVectorArray(@ptrCast(*const ID3D10EffectVectorVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_GetIntVectorArray(self: *const T, pData: ?*i32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).GetIntVectorArray(@ptrCast(*const ID3D10EffectVectorVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectVectorVariable_GetFloatVectorArray(self: *const T, pData: ?*f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectVectorVariable.VTable, self.vtable).GetFloatVectorArray(@ptrCast(*const ID3D10EffectVectorVariable, self), pData, Offset, Count); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectMatrixVariable_Value = @import("../zig.zig").Guid.initString("50666c24-b82f-4eed-a172-5b6e7e8522e0"); pub const IID_ID3D10EffectMatrixVariable = &IID_ID3D10EffectMatrixVariable_Value; pub const ID3D10EffectMatrixVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, SetMatrix: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMatrix: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMatrixArray: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMatrixArray: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMatrixTranspose: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMatrixTranspose: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetMatrixTransposeArray: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMatrixTransposeArray: fn( self: *const ID3D10EffectMatrixVariable, pData: ?*f32, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_SetMatrix(self: *const T, pData: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).SetMatrix(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_GetMatrix(self: *const T, pData: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).GetMatrix(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_SetMatrixArray(self: *const T, pData: ?*f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).SetMatrixArray(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_GetMatrixArray(self: *const T, pData: ?*f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).GetMatrixArray(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_SetMatrixTranspose(self: *const T, pData: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).SetMatrixTranspose(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_GetMatrixTranspose(self: *const T, pData: ?*f32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).GetMatrixTranspose(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_SetMatrixTransposeArray(self: *const T, pData: ?*f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).SetMatrixTransposeArray(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectMatrixVariable_GetMatrixTransposeArray(self: *const T, pData: ?*f32, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectMatrixVariable.VTable, self.vtable).GetMatrixTransposeArray(@ptrCast(*const ID3D10EffectMatrixVariable, self), pData, Offset, Count); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectStringVariable_Value = @import("../zig.zig").Guid.initString("71417501-8df9-4e0a-a78a-255f9756baff"); pub const IID_ID3D10EffectStringVariable = &IID_ID3D10EffectStringVariable_Value; pub const ID3D10EffectStringVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, GetString: fn( self: *const ID3D10EffectStringVariable, ppString: ?*?PSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetStringArray: fn( self: *const ID3D10EffectStringVariable, ppStrings: [*]?PSTR, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectStringVariable_GetString(self: *const T, ppString: ?*?PSTR) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectStringVariable.VTable, self.vtable).GetString(@ptrCast(*const ID3D10EffectStringVariable, self), ppString); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectStringVariable_GetStringArray(self: *const T, ppStrings: [*]?PSTR, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectStringVariable.VTable, self.vtable).GetStringArray(@ptrCast(*const ID3D10EffectStringVariable, self), ppStrings, Offset, Count); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectShaderResourceVariable_Value = @import("../zig.zig").Guid.initString("c0a7157b-d872-4b1d-8073-efc2acd4b1fc"); pub const IID_ID3D10EffectShaderResourceVariable = &IID_ID3D10EffectShaderResourceVariable_Value; pub const ID3D10EffectShaderResourceVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, SetResource: fn( self: *const ID3D10EffectShaderResourceVariable, pResource: ?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetResource: fn( self: *const ID3D10EffectShaderResourceVariable, ppResource: ?*?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetResourceArray: fn( self: *const ID3D10EffectShaderResourceVariable, ppResources: [*]?*ID3D10ShaderResourceView, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetResourceArray: fn( self: *const ID3D10EffectShaderResourceVariable, ppResources: [*]?*ID3D10ShaderResourceView, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderResourceVariable_SetResource(self: *const T, pResource: ?*ID3D10ShaderResourceView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderResourceVariable.VTable, self.vtable).SetResource(@ptrCast(*const ID3D10EffectShaderResourceVariable, self), pResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderResourceVariable_GetResource(self: *const T, ppResource: ?*?*ID3D10ShaderResourceView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderResourceVariable.VTable, self.vtable).GetResource(@ptrCast(*const ID3D10EffectShaderResourceVariable, self), ppResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderResourceVariable_SetResourceArray(self: *const T, ppResources: [*]?*ID3D10ShaderResourceView, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderResourceVariable.VTable, self.vtable).SetResourceArray(@ptrCast(*const ID3D10EffectShaderResourceVariable, self), ppResources, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderResourceVariable_GetResourceArray(self: *const T, ppResources: [*]?*ID3D10ShaderResourceView, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderResourceVariable.VTable, self.vtable).GetResourceArray(@ptrCast(*const ID3D10EffectShaderResourceVariable, self), ppResources, Offset, Count); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectRenderTargetViewVariable_Value = @import("../zig.zig").Guid.initString("28ca0cc3-c2c9-40bb-b57f-67b737122b17"); pub const IID_ID3D10EffectRenderTargetViewVariable = &IID_ID3D10EffectRenderTargetViewVariable_Value; pub const ID3D10EffectRenderTargetViewVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, SetRenderTarget: fn( self: *const ID3D10EffectRenderTargetViewVariable, pResource: ?*ID3D10RenderTargetView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRenderTarget: fn( self: *const ID3D10EffectRenderTargetViewVariable, ppResource: ?*?*ID3D10RenderTargetView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetRenderTargetArray: fn( self: *const ID3D10EffectRenderTargetViewVariable, ppResources: [*]?*ID3D10RenderTargetView, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetRenderTargetArray: fn( self: *const ID3D10EffectRenderTargetViewVariable, ppResources: [*]?*ID3D10RenderTargetView, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectRenderTargetViewVariable_SetRenderTarget(self: *const T, pResource: ?*ID3D10RenderTargetView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectRenderTargetViewVariable.VTable, self.vtable).SetRenderTarget(@ptrCast(*const ID3D10EffectRenderTargetViewVariable, self), pResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectRenderTargetViewVariable_GetRenderTarget(self: *const T, ppResource: ?*?*ID3D10RenderTargetView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectRenderTargetViewVariable.VTable, self.vtable).GetRenderTarget(@ptrCast(*const ID3D10EffectRenderTargetViewVariable, self), ppResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectRenderTargetViewVariable_SetRenderTargetArray(self: *const T, ppResources: [*]?*ID3D10RenderTargetView, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectRenderTargetViewVariable.VTable, self.vtable).SetRenderTargetArray(@ptrCast(*const ID3D10EffectRenderTargetViewVariable, self), ppResources, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectRenderTargetViewVariable_GetRenderTargetArray(self: *const T, ppResources: [*]?*ID3D10RenderTargetView, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectRenderTargetViewVariable.VTable, self.vtable).GetRenderTargetArray(@ptrCast(*const ID3D10EffectRenderTargetViewVariable, self), ppResources, Offset, Count); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectDepthStencilViewVariable_Value = @import("../zig.zig").Guid.initString("3e02c918-cc79-4985-b622-2d92ad701623"); pub const IID_ID3D10EffectDepthStencilViewVariable = &IID_ID3D10EffectDepthStencilViewVariable_Value; pub const ID3D10EffectDepthStencilViewVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, SetDepthStencil: fn( self: *const ID3D10EffectDepthStencilViewVariable, pResource: ?*ID3D10DepthStencilView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDepthStencil: fn( self: *const ID3D10EffectDepthStencilViewVariable, ppResource: ?*?*ID3D10DepthStencilView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDepthStencilArray: fn( self: *const ID3D10EffectDepthStencilViewVariable, ppResources: [*]?*ID3D10DepthStencilView, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDepthStencilArray: fn( self: *const ID3D10EffectDepthStencilViewVariable, ppResources: [*]?*ID3D10DepthStencilView, Offset: u32, Count: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectDepthStencilViewVariable_SetDepthStencil(self: *const T, pResource: ?*ID3D10DepthStencilView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectDepthStencilViewVariable.VTable, self.vtable).SetDepthStencil(@ptrCast(*const ID3D10EffectDepthStencilViewVariable, self), pResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectDepthStencilViewVariable_GetDepthStencil(self: *const T, ppResource: ?*?*ID3D10DepthStencilView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectDepthStencilViewVariable.VTable, self.vtable).GetDepthStencil(@ptrCast(*const ID3D10EffectDepthStencilViewVariable, self), ppResource); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectDepthStencilViewVariable_SetDepthStencilArray(self: *const T, ppResources: [*]?*ID3D10DepthStencilView, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectDepthStencilViewVariable.VTable, self.vtable).SetDepthStencilArray(@ptrCast(*const ID3D10EffectDepthStencilViewVariable, self), ppResources, Offset, Count); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectDepthStencilViewVariable_GetDepthStencilArray(self: *const T, ppResources: [*]?*ID3D10DepthStencilView, Offset: u32, Count: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectDepthStencilViewVariable.VTable, self.vtable).GetDepthStencilArray(@ptrCast(*const ID3D10EffectDepthStencilViewVariable, self), ppResources, Offset, Count); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectConstantBuffer_Value = @import("../zig.zig").Guid.initString("56648f4d-cc8b-4444-a5ad-b5a3d76e91b3"); pub const IID_ID3D10EffectConstantBuffer = &IID_ID3D10EffectConstantBuffer_Value; pub const ID3D10EffectConstantBuffer = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, SetConstantBuffer: fn( self: *const ID3D10EffectConstantBuffer, pConstantBuffer: ?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConstantBuffer: fn( self: *const ID3D10EffectConstantBuffer, ppConstantBuffer: ?*?*ID3D10Buffer, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTextureBuffer: fn( self: *const ID3D10EffectConstantBuffer, pTextureBuffer: ?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTextureBuffer: fn( self: *const ID3D10EffectConstantBuffer, ppTextureBuffer: ?*?*ID3D10ShaderResourceView, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectConstantBuffer_SetConstantBuffer(self: *const T, pConstantBuffer: ?*ID3D10Buffer) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectConstantBuffer.VTable, self.vtable).SetConstantBuffer(@ptrCast(*const ID3D10EffectConstantBuffer, self), pConstantBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectConstantBuffer_GetConstantBuffer(self: *const T, ppConstantBuffer: ?*?*ID3D10Buffer) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectConstantBuffer.VTable, self.vtable).GetConstantBuffer(@ptrCast(*const ID3D10EffectConstantBuffer, self), ppConstantBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectConstantBuffer_SetTextureBuffer(self: *const T, pTextureBuffer: ?*ID3D10ShaderResourceView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectConstantBuffer.VTable, self.vtable).SetTextureBuffer(@ptrCast(*const ID3D10EffectConstantBuffer, self), pTextureBuffer); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectConstantBuffer_GetTextureBuffer(self: *const T, ppTextureBuffer: ?*?*ID3D10ShaderResourceView) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectConstantBuffer.VTable, self.vtable).GetTextureBuffer(@ptrCast(*const ID3D10EffectConstantBuffer, self), ppTextureBuffer); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_EFFECT_SHADER_DESC = extern struct { pInputSignature: ?*const u8, IsInline: BOOL, pBytecode: ?*const u8, BytecodeLength: u32, SODecl: ?[*:0]const u8, NumInputSignatureEntries: u32, NumOutputSignatureEntries: u32, }; const IID_ID3D10EffectShaderVariable_Value = @import("../zig.zig").Guid.initString("80849279-c799-4797-8c33-0407a07d9e06"); pub const IID_ID3D10EffectShaderVariable = &IID_ID3D10EffectShaderVariable_Value; pub const ID3D10EffectShaderVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, GetShaderDesc: fn( self: *const ID3D10EffectShaderVariable, ShaderIndex: u32, pDesc: ?*D3D10_EFFECT_SHADER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVertexShader: fn( self: *const ID3D10EffectShaderVariable, ShaderIndex: u32, ppVS: ?*?*ID3D10VertexShader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGeometryShader: fn( self: *const ID3D10EffectShaderVariable, ShaderIndex: u32, ppGS: ?*?*ID3D10GeometryShader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPixelShader: fn( self: *const ID3D10EffectShaderVariable, ShaderIndex: u32, ppPS: ?*?*ID3D10PixelShader, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputSignatureElementDesc: fn( self: *const ID3D10EffectShaderVariable, ShaderIndex: u32, Element: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOutputSignatureElementDesc: fn( self: *const ID3D10EffectShaderVariable, ShaderIndex: u32, Element: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderVariable_GetShaderDesc(self: *const T, ShaderIndex: u32, pDesc: ?*D3D10_EFFECT_SHADER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderVariable.VTable, self.vtable).GetShaderDesc(@ptrCast(*const ID3D10EffectShaderVariable, self), ShaderIndex, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderVariable_GetVertexShader(self: *const T, ShaderIndex: u32, ppVS: ?*?*ID3D10VertexShader) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderVariable.VTable, self.vtable).GetVertexShader(@ptrCast(*const ID3D10EffectShaderVariable, self), ShaderIndex, ppVS); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderVariable_GetGeometryShader(self: *const T, ShaderIndex: u32, ppGS: ?*?*ID3D10GeometryShader) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderVariable.VTable, self.vtable).GetGeometryShader(@ptrCast(*const ID3D10EffectShaderVariable, self), ShaderIndex, ppGS); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderVariable_GetPixelShader(self: *const T, ShaderIndex: u32, ppPS: ?*?*ID3D10PixelShader) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderVariable.VTable, self.vtable).GetPixelShader(@ptrCast(*const ID3D10EffectShaderVariable, self), ShaderIndex, ppPS); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderVariable_GetInputSignatureElementDesc(self: *const T, ShaderIndex: u32, Element: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderVariable.VTable, self.vtable).GetInputSignatureElementDesc(@ptrCast(*const ID3D10EffectShaderVariable, self), ShaderIndex, Element, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectShaderVariable_GetOutputSignatureElementDesc(self: *const T, ShaderIndex: u32, Element: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectShaderVariable.VTable, self.vtable).GetOutputSignatureElementDesc(@ptrCast(*const ID3D10EffectShaderVariable, self), ShaderIndex, Element, pDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectBlendVariable_Value = @import("../zig.zig").Guid.initString("1fcd2294-df6d-4eae-86b3-0e9160cfb07b"); pub const IID_ID3D10EffectBlendVariable = &IID_ID3D10EffectBlendVariable_Value; pub const ID3D10EffectBlendVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, GetBlendState: fn( self: *const ID3D10EffectBlendVariable, Index: u32, ppBlendState: ?*?*ID3D10BlendState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBackingStore: fn( self: *const ID3D10EffectBlendVariable, Index: u32, pBlendDesc: ?*D3D10_BLEND_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectBlendVariable_GetBlendState(self: *const T, Index: u32, ppBlendState: ?*?*ID3D10BlendState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectBlendVariable.VTable, self.vtable).GetBlendState(@ptrCast(*const ID3D10EffectBlendVariable, self), Index, ppBlendState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectBlendVariable_GetBackingStore(self: *const T, Index: u32, pBlendDesc: ?*D3D10_BLEND_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectBlendVariable.VTable, self.vtable).GetBackingStore(@ptrCast(*const ID3D10EffectBlendVariable, self), Index, pBlendDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectDepthStencilVariable_Value = @import("../zig.zig").Guid.initString("af482368-330a-46a5-9a5c-01c71af24c8d"); pub const IID_ID3D10EffectDepthStencilVariable = &IID_ID3D10EffectDepthStencilVariable_Value; pub const ID3D10EffectDepthStencilVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, GetDepthStencilState: fn( self: *const ID3D10EffectDepthStencilVariable, Index: u32, ppDepthStencilState: ?*?*ID3D10DepthStencilState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBackingStore: fn( self: *const ID3D10EffectDepthStencilVariable, Index: u32, pDepthStencilDesc: ?*D3D10_DEPTH_STENCIL_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectDepthStencilVariable_GetDepthStencilState(self: *const T, Index: u32, ppDepthStencilState: ?*?*ID3D10DepthStencilState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectDepthStencilVariable.VTable, self.vtable).GetDepthStencilState(@ptrCast(*const ID3D10EffectDepthStencilVariable, self), Index, ppDepthStencilState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectDepthStencilVariable_GetBackingStore(self: *const T, Index: u32, pDepthStencilDesc: ?*D3D10_DEPTH_STENCIL_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectDepthStencilVariable.VTable, self.vtable).GetBackingStore(@ptrCast(*const ID3D10EffectDepthStencilVariable, self), Index, pDepthStencilDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectRasterizerVariable_Value = @import("../zig.zig").Guid.initString("21af9f0e-4d94-4ea9-9785-2cb76b8c0b34"); pub const IID_ID3D10EffectRasterizerVariable = &IID_ID3D10EffectRasterizerVariable_Value; pub const ID3D10EffectRasterizerVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, GetRasterizerState: fn( self: *const ID3D10EffectRasterizerVariable, Index: u32, ppRasterizerState: ?*?*ID3D10RasterizerState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBackingStore: fn( self: *const ID3D10EffectRasterizerVariable, Index: u32, pRasterizerDesc: ?*D3D10_RASTERIZER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectRasterizerVariable_GetRasterizerState(self: *const T, Index: u32, ppRasterizerState: ?*?*ID3D10RasterizerState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectRasterizerVariable.VTable, self.vtable).GetRasterizerState(@ptrCast(*const ID3D10EffectRasterizerVariable, self), Index, ppRasterizerState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectRasterizerVariable_GetBackingStore(self: *const T, Index: u32, pRasterizerDesc: ?*D3D10_RASTERIZER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectRasterizerVariable.VTable, self.vtable).GetBackingStore(@ptrCast(*const ID3D10EffectRasterizerVariable, self), Index, pRasterizerDesc); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectSamplerVariable_Value = @import("../zig.zig").Guid.initString("6530d5c7-07e9-4271-a418-e7ce4bd1e480"); pub const IID_ID3D10EffectSamplerVariable = &IID_ID3D10EffectSamplerVariable_Value; pub const ID3D10EffectSamplerVariable = extern struct { pub const VTable = extern struct { base: ID3D10EffectVariable.VTable, GetSampler: fn( self: *const ID3D10EffectSamplerVariable, Index: u32, ppSampler: ?*?*ID3D10SamplerState, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBackingStore: fn( self: *const ID3D10EffectSamplerVariable, Index: u32, pSamplerDesc: ?*D3D10_SAMPLER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10EffectVariable.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectSamplerVariable_GetSampler(self: *const T, Index: u32, ppSampler: ?*?*ID3D10SamplerState) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectSamplerVariable.VTable, self.vtable).GetSampler(@ptrCast(*const ID3D10EffectSamplerVariable, self), Index, ppSampler); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectSamplerVariable_GetBackingStore(self: *const T, Index: u32, pSamplerDesc: ?*D3D10_SAMPLER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectSamplerVariable.VTable, self.vtable).GetBackingStore(@ptrCast(*const ID3D10EffectSamplerVariable, self), Index, pSamplerDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_PASS_DESC = extern struct { Name: ?[*:0]const u8, Annotations: u32, pIAInputSignature: ?*u8, IAInputSignatureSize: usize, StencilRef: u32, SampleMask: u32, BlendFactor: [4]f32, }; pub const D3D10_PASS_SHADER_DESC = extern struct { pShaderVariable: ?*ID3D10EffectShaderVariable, ShaderIndex: u32, }; const IID_ID3D10EffectPass_Value = @import("../zig.zig").Guid.initString("5cfbeb89-1a06-46e0-b282-e3f9bfa36a54"); pub const IID_ID3D10EffectPass = &IID_ID3D10EffectPass_Value; pub const ID3D10EffectPass = extern struct { pub const VTable = extern struct { IsValid: fn( self: *const ID3D10EffectPass, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetDesc: fn( self: *const ID3D10EffectPass, pDesc: ?*D3D10_PASS_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVertexShaderDesc: fn( self: *const ID3D10EffectPass, pDesc: ?*D3D10_PASS_SHADER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGeometryShaderDesc: fn( self: *const ID3D10EffectPass, pDesc: ?*D3D10_PASS_SHADER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetPixelShaderDesc: fn( self: *const ID3D10EffectPass, pDesc: ?*D3D10_PASS_SHADER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAnnotationByIndex: fn( self: *const ID3D10EffectPass, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetAnnotationByName: fn( self: *const ID3D10EffectPass, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, Apply: fn( self: *const ID3D10EffectPass, Flags: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ComputeStateBlockMask: fn( self: *const ID3D10EffectPass, pStateBlockMask: ?*D3D10_STATE_BLOCK_MASK, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_IsValid(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).IsValid(@ptrCast(*const ID3D10EffectPass, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_GetDesc(self: *const T, pDesc: ?*D3D10_PASS_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10EffectPass, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_GetVertexShaderDesc(self: *const T, pDesc: ?*D3D10_PASS_SHADER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).GetVertexShaderDesc(@ptrCast(*const ID3D10EffectPass, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_GetGeometryShaderDesc(self: *const T, pDesc: ?*D3D10_PASS_SHADER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).GetGeometryShaderDesc(@ptrCast(*const ID3D10EffectPass, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_GetPixelShaderDesc(self: *const T, pDesc: ?*D3D10_PASS_SHADER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).GetPixelShaderDesc(@ptrCast(*const ID3D10EffectPass, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_GetAnnotationByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).GetAnnotationByIndex(@ptrCast(*const ID3D10EffectPass, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_GetAnnotationByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).GetAnnotationByName(@ptrCast(*const ID3D10EffectPass, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_Apply(self: *const T, Flags: u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).Apply(@ptrCast(*const ID3D10EffectPass, self), Flags); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectPass_ComputeStateBlockMask(self: *const T, pStateBlockMask: ?*D3D10_STATE_BLOCK_MASK) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectPass.VTable, self.vtable).ComputeStateBlockMask(@ptrCast(*const ID3D10EffectPass, self), pStateBlockMask); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_TECHNIQUE_DESC = extern struct { Name: ?[*:0]const u8, Passes: u32, Annotations: u32, }; const IID_ID3D10EffectTechnique_Value = @import("../zig.zig").Guid.initString("db122ce8-d1c9-4292-b237-24ed3de8b175"); pub const IID_ID3D10EffectTechnique = &IID_ID3D10EffectTechnique_Value; pub const ID3D10EffectTechnique = extern struct { pub const VTable = extern struct { IsValid: fn( self: *const ID3D10EffectTechnique, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetDesc: fn( self: *const ID3D10EffectTechnique, pDesc: ?*D3D10_TECHNIQUE_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetAnnotationByIndex: fn( self: *const ID3D10EffectTechnique, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetAnnotationByName: fn( self: *const ID3D10EffectTechnique, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetPassByIndex: fn( self: *const ID3D10EffectTechnique, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectPass, GetPassByName: fn( self: *const ID3D10EffectTechnique, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectPass, ComputeStateBlockMask: fn( self: *const ID3D10EffectTechnique, pStateBlockMask: ?*D3D10_STATE_BLOCK_MASK, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectTechnique_IsValid(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10EffectTechnique.VTable, self.vtable).IsValid(@ptrCast(*const ID3D10EffectTechnique, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectTechnique_GetDesc(self: *const T, pDesc: ?*D3D10_TECHNIQUE_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectTechnique.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10EffectTechnique, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectTechnique_GetAnnotationByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectTechnique.VTable, self.vtable).GetAnnotationByIndex(@ptrCast(*const ID3D10EffectTechnique, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectTechnique_GetAnnotationByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10EffectTechnique.VTable, self.vtable).GetAnnotationByName(@ptrCast(*const ID3D10EffectTechnique, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectTechnique_GetPassByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectPass { return @ptrCast(*const ID3D10EffectTechnique.VTable, self.vtable).GetPassByIndex(@ptrCast(*const ID3D10EffectTechnique, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectTechnique_GetPassByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectPass { return @ptrCast(*const ID3D10EffectTechnique.VTable, self.vtable).GetPassByName(@ptrCast(*const ID3D10EffectTechnique, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10EffectTechnique_ComputeStateBlockMask(self: *const T, pStateBlockMask: ?*D3D10_STATE_BLOCK_MASK) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10EffectTechnique.VTable, self.vtable).ComputeStateBlockMask(@ptrCast(*const ID3D10EffectTechnique, self), pStateBlockMask); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_EFFECT_DESC = extern struct { IsChildEffect: BOOL, ConstantBuffers: u32, SharedConstantBuffers: u32, GlobalVariables: u32, SharedGlobalVariables: u32, Techniques: u32, }; const IID_ID3D10Effect_Value = @import("../zig.zig").Guid.initString("51b0ca8b-ec0b-4519-870d-8ee1cb5017c7"); pub const IID_ID3D10Effect = &IID_ID3D10Effect_Value; pub const ID3D10Effect = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, IsValid: fn( self: *const ID3D10Effect, ) callconv(@import("std").os.windows.WINAPI) BOOL, IsPool: fn( self: *const ID3D10Effect, ) callconv(@import("std").os.windows.WINAPI) BOOL, GetDevice: fn( self: *const ID3D10Effect, ppDevice: ?*?*ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDesc: fn( self: *const ID3D10Effect, pDesc: ?*D3D10_EFFECT_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConstantBufferByIndex: fn( self: *const ID3D10Effect, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectConstantBuffer, GetConstantBufferByName: fn( self: *const ID3D10Effect, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectConstantBuffer, GetVariableByIndex: fn( self: *const ID3D10Effect, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetVariableByName: fn( self: *const ID3D10Effect, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetVariableBySemantic: fn( self: *const ID3D10Effect, Semantic: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectVariable, GetTechniqueByIndex: fn( self: *const ID3D10Effect, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectTechnique, GetTechniqueByName: fn( self: *const ID3D10Effect, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10EffectTechnique, Optimize: fn( self: *const ID3D10Effect, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsOptimized: fn( self: *const ID3D10Effect, ) callconv(@import("std").os.windows.WINAPI) BOOL, }; 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 ID3D10Effect_IsValid(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).IsValid(@ptrCast(*const ID3D10Effect, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_IsPool(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).IsPool(@ptrCast(*const ID3D10Effect, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetDevice(self: *const T, ppDevice: ?*?*ID3D10Device) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetDevice(@ptrCast(*const ID3D10Effect, self), ppDevice); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetDesc(self: *const T, pDesc: ?*D3D10_EFFECT_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10Effect, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetConstantBufferByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectConstantBuffer { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetConstantBufferByIndex(@ptrCast(*const ID3D10Effect, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetConstantBufferByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectConstantBuffer { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetConstantBufferByName(@ptrCast(*const ID3D10Effect, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetVariableByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetVariableByIndex(@ptrCast(*const ID3D10Effect, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetVariableByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetVariableByName(@ptrCast(*const ID3D10Effect, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetVariableBySemantic(self: *const T, Semantic: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectVariable { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetVariableBySemantic(@ptrCast(*const ID3D10Effect, self), Semantic); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetTechniqueByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10EffectTechnique { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetTechniqueByIndex(@ptrCast(*const ID3D10Effect, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_GetTechniqueByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10EffectTechnique { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).GetTechniqueByName(@ptrCast(*const ID3D10Effect, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_Optimize(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).Optimize(@ptrCast(*const ID3D10Effect, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Effect_IsOptimized(self: *const T) callconv(.Inline) BOOL { return @ptrCast(*const ID3D10Effect.VTable, self.vtable).IsOptimized(@ptrCast(*const ID3D10Effect, self)); } };} pub usingnamespace MethodMixin(@This()); }; const IID_ID3D10EffectPool_Value = @import("../zig.zig").Guid.initString("9537ab04-3250-412e-8213-fcd2f8677933"); pub const IID_ID3D10EffectPool = &IID_ID3D10EffectPool_Value; pub const ID3D10EffectPool = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, AsEffect: fn( self: *const ID3D10EffectPool, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10Effect, }; 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 ID3D10EffectPool_AsEffect(self: *const T) callconv(.Inline) ?*ID3D10Effect { return @ptrCast(*const ID3D10EffectPool.VTable, self.vtable).AsEffect(@ptrCast(*const ID3D10EffectPool, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_FEATURE_LEVEL1 = enum(i32) { @"10_0" = 40960, @"10_1" = 41216, @"9_1" = 37120, @"9_2" = 37376, @"9_3" = 37632, }; pub const D3D10_FEATURE_LEVEL_10_0 = D3D10_FEATURE_LEVEL1.@"10_0"; pub const D3D10_FEATURE_LEVEL_10_1 = D3D10_FEATURE_LEVEL1.@"10_1"; pub const D3D10_FEATURE_LEVEL_9_1 = D3D10_FEATURE_LEVEL1.@"9_1"; pub const D3D10_FEATURE_LEVEL_9_2 = D3D10_FEATURE_LEVEL1.@"9_2"; pub const D3D10_FEATURE_LEVEL_9_3 = D3D10_FEATURE_LEVEL1.@"9_3"; pub const D3D10_RENDER_TARGET_BLEND_DESC1 = extern struct { BlendEnable: BOOL, SrcBlend: D3D10_BLEND, DestBlend: D3D10_BLEND, BlendOp: D3D10_BLEND_OP, SrcBlendAlpha: D3D10_BLEND, DestBlendAlpha: D3D10_BLEND, BlendOpAlpha: D3D10_BLEND_OP, RenderTargetWriteMask: u8, }; pub const D3D10_BLEND_DESC1 = extern struct { AlphaToCoverageEnable: BOOL, IndependentBlendEnable: BOOL, RenderTarget: [8]D3D10_RENDER_TARGET_BLEND_DESC1, }; const IID_ID3D10BlendState1_Value = @import("../zig.zig").Guid.initString("edad8d99-8a35-4d6d-8566-2ea276cde161"); pub const IID_ID3D10BlendState1 = &IID_ID3D10BlendState1_Value; pub const ID3D10BlendState1 = extern struct { pub const VTable = extern struct { base: ID3D10BlendState.VTable, GetDesc1: fn( self: *const ID3D10BlendState1, pDesc: ?*D3D10_BLEND_DESC1, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10BlendState.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10BlendState1_GetDesc1(self: *const T, pDesc: ?*D3D10_BLEND_DESC1) callconv(.Inline) void { return @ptrCast(*const ID3D10BlendState1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D10BlendState1, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_TEXCUBE_ARRAY_SRV1 = extern struct { MostDetailedMip: u32, MipLevels: u32, First2DArrayFace: u32, NumCubes: u32, }; pub const D3D10_SHADER_RESOURCE_VIEW_DESC1 = extern struct { Format: DXGI_FORMAT, ViewDimension: D3D_SRV_DIMENSION, Anonymous: extern union { Buffer: D3D10_BUFFER_SRV, Texture1D: D3D10_TEX1D_SRV, Texture1DArray: D3D10_TEX1D_ARRAY_SRV, Texture2D: D3D10_TEX2D_SRV, Texture2DArray: D3D10_TEX2D_ARRAY_SRV, Texture2DMS: D3D10_TEX2DMS_SRV, Texture2DMSArray: D3D10_TEX2DMS_ARRAY_SRV, Texture3D: D3D10_TEX3D_SRV, TextureCube: D3D10_TEXCUBE_SRV, TextureCubeArray: D3D10_TEXCUBE_ARRAY_SRV1, }, }; const IID_ID3D10ShaderResourceView1_Value = @import("../zig.zig").Guid.initString("9b7e4c87-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10ShaderResourceView1 = &IID_ID3D10ShaderResourceView1_Value; pub const ID3D10ShaderResourceView1 = extern struct { pub const VTable = extern struct { base: ID3D10ShaderResourceView.VTable, GetDesc1: fn( self: *const ID3D10ShaderResourceView1, pDesc: ?*D3D10_SHADER_RESOURCE_VIEW_DESC1, ) callconv(@import("std").os.windows.WINAPI) void, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10ShaderResourceView.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderResourceView1_GetDesc1(self: *const T, pDesc: ?*D3D10_SHADER_RESOURCE_VIEW_DESC1) callconv(.Inline) void { return @ptrCast(*const ID3D10ShaderResourceView1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D10ShaderResourceView1, self), pDesc); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS = enum(i32) { STANDARD_MULTISAMPLE_PATTERN = -1, CENTER_MULTISAMPLE_PATTERN = -2, }; pub const D3D10_STANDARD_MULTISAMPLE_PATTERN = D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS.STANDARD_MULTISAMPLE_PATTERN; pub const D3D10_CENTER_MULTISAMPLE_PATTERN = D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS.CENTER_MULTISAMPLE_PATTERN; const IID_ID3D10Device1_Value = @import("../zig.zig").Guid.initString("9b7e4c8f-342c-4106-a19f-4f2704f689f0"); pub const IID_ID3D10Device1 = &IID_ID3D10Device1_Value; pub const ID3D10Device1 = extern struct { pub const VTable = extern struct { base: ID3D10Device.VTable, CreateShaderResourceView1: fn( self: *const ID3D10Device1, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_SHADER_RESOURCE_VIEW_DESC1, ppSRView: ?*?*ID3D10ShaderResourceView1, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateBlendState1: fn( self: *const ID3D10Device1, pBlendStateDesc: ?*const D3D10_BLEND_DESC1, ppBlendState: ?*?*ID3D10BlendState1, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetFeatureLevel: fn( self: *const ID3D10Device1, ) callconv(@import("std").os.windows.WINAPI) D3D10_FEATURE_LEVEL1, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace ID3D10Device.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device1_CreateShaderResourceView1(self: *const T, pResource: ?*ID3D10Resource, pDesc: ?*const D3D10_SHADER_RESOURCE_VIEW_DESC1, ppSRView: ?*?*ID3D10ShaderResourceView1) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device1.VTable, self.vtable).CreateShaderResourceView1(@ptrCast(*const ID3D10Device1, self), pResource, pDesc, ppSRView); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device1_CreateBlendState1(self: *const T, pBlendStateDesc: ?*const D3D10_BLEND_DESC1, ppBlendState: ?*?*ID3D10BlendState1) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10Device1.VTable, self.vtable).CreateBlendState1(@ptrCast(*const ID3D10Device1, self), pBlendStateDesc, ppBlendState); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10Device1_GetFeatureLevel(self: *const T) callconv(.Inline) D3D10_FEATURE_LEVEL1 { return @ptrCast(*const ID3D10Device1.VTable, self.vtable).GetFeatureLevel(@ptrCast(*const ID3D10Device1, self)); } };} pub usingnamespace MethodMixin(@This()); }; pub const D3D10_SHADER_DEBUG_REGTYPE = enum(i32) { @"0_SHADER_DEBUG_REG_INPUT" = 0, @"0_SHADER_DEBUG_REG_OUTPUT" = 1, @"0_SHADER_DEBUG_REG_CBUFFER" = 2, @"0_SHADER_DEBUG_REG_TBUFFER" = 3, @"0_SHADER_DEBUG_REG_TEMP" = 4, @"0_SHADER_DEBUG_REG_TEMPARRAY" = 5, @"0_SHADER_DEBUG_REG_TEXTURE" = 6, @"0_SHADER_DEBUG_REG_SAMPLER" = 7, @"0_SHADER_DEBUG_REG_IMMEDIATECBUFFER" = 8, @"0_SHADER_DEBUG_REG_LITERAL" = 9, @"0_SHADER_DEBUG_REG_UNUSED" = 10, @"1_SHADER_DEBUG_REG_INTERFACE_POINTERS" = 11, @"1_SHADER_DEBUG_REG_UAV" = 12, @"0_SHADER_DEBUG_REG_FORCE_DWORD" = 2147483647, }; pub const D3D10_SHADER_DEBUG_REG_INPUT = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_INPUT"; pub const D3D10_SHADER_DEBUG_REG_OUTPUT = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_OUTPUT"; pub const D3D10_SHADER_DEBUG_REG_CBUFFER = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_CBUFFER"; pub const D3D10_SHADER_DEBUG_REG_TBUFFER = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_TBUFFER"; pub const D3D10_SHADER_DEBUG_REG_TEMP = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_TEMP"; pub const D3D10_SHADER_DEBUG_REG_TEMPARRAY = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_TEMPARRAY"; pub const D3D10_SHADER_DEBUG_REG_TEXTURE = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_TEXTURE"; pub const D3D10_SHADER_DEBUG_REG_SAMPLER = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_SAMPLER"; pub const D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_IMMEDIATECBUFFER"; pub const D3D10_SHADER_DEBUG_REG_LITERAL = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_LITERAL"; pub const D3D10_SHADER_DEBUG_REG_UNUSED = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_UNUSED"; pub const D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS = D3D10_SHADER_DEBUG_REGTYPE.@"1_SHADER_DEBUG_REG_INTERFACE_POINTERS"; pub const D3D11_SHADER_DEBUG_REG_UAV = D3D10_SHADER_DEBUG_REGTYPE.@"1_SHADER_DEBUG_REG_UAV"; pub const D3D10_SHADER_DEBUG_REG_FORCE_DWORD = D3D10_SHADER_DEBUG_REGTYPE.@"0_SHADER_DEBUG_REG_FORCE_DWORD"; pub const D3D10_SHADER_DEBUG_SCOPETYPE = enum(i32) { GLOBAL = 0, BLOCK = 1, FORLOOP = 2, STRUCT = 3, FUNC_PARAMS = 4, STATEBLOCK = 5, NAMESPACE = 6, ANNOTATION = 7, FORCE_DWORD = 2147483647, }; pub const D3D10_SHADER_DEBUG_SCOPE_GLOBAL = D3D10_SHADER_DEBUG_SCOPETYPE.GLOBAL; pub const D3D10_SHADER_DEBUG_SCOPE_BLOCK = D3D10_SHADER_DEBUG_SCOPETYPE.BLOCK; pub const D3D10_SHADER_DEBUG_SCOPE_FORLOOP = D3D10_SHADER_DEBUG_SCOPETYPE.FORLOOP; pub const D3D10_SHADER_DEBUG_SCOPE_STRUCT = D3D10_SHADER_DEBUG_SCOPETYPE.STRUCT; pub const D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS = D3D10_SHADER_DEBUG_SCOPETYPE.FUNC_PARAMS; pub const D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK = D3D10_SHADER_DEBUG_SCOPETYPE.STATEBLOCK; pub const D3D10_SHADER_DEBUG_SCOPE_NAMESPACE = D3D10_SHADER_DEBUG_SCOPETYPE.NAMESPACE; pub const D3D10_SHADER_DEBUG_SCOPE_ANNOTATION = D3D10_SHADER_DEBUG_SCOPETYPE.ANNOTATION; pub const D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = D3D10_SHADER_DEBUG_SCOPETYPE.FORCE_DWORD; pub const D3D10_SHADER_DEBUG_VARTYPE = enum(i32) { VARIABLE = 0, FUNCTION = 1, FORCE_DWORD = 2147483647, }; pub const D3D10_SHADER_DEBUG_VAR_VARIABLE = D3D10_SHADER_DEBUG_VARTYPE.VARIABLE; pub const D3D10_SHADER_DEBUG_VAR_FUNCTION = D3D10_SHADER_DEBUG_VARTYPE.FUNCTION; pub const D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = D3D10_SHADER_DEBUG_VARTYPE.FORCE_DWORD; pub const D3D10_SHADER_DEBUG_TOKEN_INFO = extern struct { File: u32, Line: u32, Column: u32, TokenLength: u32, TokenId: u32, }; pub const D3D10_SHADER_DEBUG_VAR_INFO = extern struct { TokenId: u32, Type: D3D_SHADER_VARIABLE_TYPE, Register: u32, Component: u32, ScopeVar: u32, ScopeVarOffset: u32, }; pub const D3D10_SHADER_DEBUG_INPUT_INFO = extern struct { Var: u32, InitialRegisterSet: D3D10_SHADER_DEBUG_REGTYPE, InitialBank: u32, InitialRegister: u32, InitialComponent: u32, InitialValue: u32, }; pub const D3D10_SHADER_DEBUG_SCOPEVAR_INFO = extern struct { TokenId: u32, VarType: D3D10_SHADER_DEBUG_VARTYPE, Class: D3D_SHADER_VARIABLE_CLASS, Rows: u32, Columns: u32, StructMemberScope: u32, uArrayIndices: u32, ArrayElements: u32, ArrayStrides: u32, uVariables: u32, uFirstVariable: u32, }; pub const D3D10_SHADER_DEBUG_SCOPE_INFO = extern struct { ScopeType: D3D10_SHADER_DEBUG_SCOPETYPE, Name: u32, uNameLen: u32, uVariables: u32, VariableData: u32, }; pub const D3D10_SHADER_DEBUG_OUTPUTVAR = extern struct { Var: u32, uValueMin: u32, uValueMax: u32, iValueMin: i32, iValueMax: i32, fValueMin: f32, fValueMax: f32, bNaNPossible: BOOL, bInfPossible: BOOL, }; pub const D3D10_SHADER_DEBUG_OUTPUTREG_INFO = extern struct { OutputRegisterSet: D3D10_SHADER_DEBUG_REGTYPE, OutputReg: u32, TempArrayReg: u32, OutputComponents: [4]u32, OutputVars: [4]D3D10_SHADER_DEBUG_OUTPUTVAR, IndexReg: u32, IndexComp: u32, }; pub const D3D10_SHADER_DEBUG_INST_INFO = extern struct { Id: u32, Opcode: u32, uOutputs: u32, pOutputs: [2]D3D10_SHADER_DEBUG_OUTPUTREG_INFO, TokenId: u32, NestingLevel: u32, Scopes: u32, ScopeInfo: u32, AccessedVars: u32, AccessedVarsInfo: u32, }; pub const D3D10_SHADER_DEBUG_FILE_INFO = extern struct { FileName: u32, FileNameLen: u32, FileData: u32, FileLen: u32, }; pub const D3D10_SHADER_DEBUG_INFO = extern struct { Size: u32, Creator: u32, EntrypointName: u32, ShaderTarget: u32, CompileFlags: u32, Files: u32, FileInfo: u32, Instructions: u32, InstructionInfo: u32, Variables: u32, VariableInfo: u32, InputVariables: u32, InputVariableInfo: u32, Tokens: u32, TokenInfo: u32, Scopes: u32, ScopeInfo: u32, ScopeVariables: u32, ScopeVariableInfo: u32, UintOffset: u32, StringOffset: u32, }; const IID_ID3D10ShaderReflection1_Value = @import("../zig.zig").Guid.initString("c3457783-a846-47ce-9520-cea6f66e7447"); pub const IID_ID3D10ShaderReflection1 = &IID_ID3D10ShaderReflection1_Value; pub const ID3D10ShaderReflection1 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetDesc: fn( self: *const ID3D10ShaderReflection1, pDesc: ?*D3D10_SHADER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConstantBufferByIndex: fn( self: *const ID3D10ShaderReflection1, Index: u32, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionConstantBuffer, GetConstantBufferByName: fn( self: *const ID3D10ShaderReflection1, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionConstantBuffer, GetResourceBindingDesc: fn( self: *const ID3D10ShaderReflection1, ResourceIndex: u32, pDesc: ?*D3D10_SHADER_INPUT_BIND_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetInputParameterDesc: fn( self: *const ID3D10ShaderReflection1, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetOutputParameterDesc: fn( self: *const ID3D10ShaderReflection1, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVariableByName: fn( self: *const ID3D10ShaderReflection1, Name: ?[*:0]const u8, ) callconv(@import("std").os.windows.WINAPI) ?*ID3D10ShaderReflectionVariable, GetResourceBindingDescByName: fn( self: *const ID3D10ShaderReflection1, Name: ?[*:0]const u8, pDesc: ?*D3D10_SHADER_INPUT_BIND_DESC, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMovInstructionCount: fn( self: *const ID3D10ShaderReflection1, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetMovcInstructionCount: fn( self: *const ID3D10ShaderReflection1, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConversionInstructionCount: fn( self: *const ID3D10ShaderReflection1, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetBitwiseInstructionCount: fn( self: *const ID3D10ShaderReflection1, pCount: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetGSInputPrimitive: fn( self: *const ID3D10ShaderReflection1, pPrim: ?*D3D_PRIMITIVE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsLevel9Shader: fn( self: *const ID3D10ShaderReflection1, pbLevel9Shader: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsSampleFrequencyShader: fn( self: *const ID3D10ShaderReflection1, pbSampleFrequency: ?*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 ID3D10ShaderReflection1_GetDesc(self: *const T, pDesc: ?*D3D10_SHADER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D10ShaderReflection1, self), pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetConstantBufferByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D10ShaderReflectionConstantBuffer { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetConstantBufferByIndex(@ptrCast(*const ID3D10ShaderReflection1, self), Index); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetConstantBufferByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10ShaderReflectionConstantBuffer { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetConstantBufferByName(@ptrCast(*const ID3D10ShaderReflection1, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetResourceBindingDesc(self: *const T, ResourceIndex: u32, pDesc: ?*D3D10_SHADER_INPUT_BIND_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetResourceBindingDesc(@ptrCast(*const ID3D10ShaderReflection1, self), ResourceIndex, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetInputParameterDesc(self: *const T, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetInputParameterDesc(@ptrCast(*const ID3D10ShaderReflection1, self), ParameterIndex, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetOutputParameterDesc(self: *const T, ParameterIndex: u32, pDesc: ?*D3D10_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetOutputParameterDesc(@ptrCast(*const ID3D10ShaderReflection1, self), ParameterIndex, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetVariableByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D10ShaderReflectionVariable { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetVariableByName(@ptrCast(*const ID3D10ShaderReflection1, self), Name); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetResourceBindingDescByName(self: *const T, Name: ?[*:0]const u8, pDesc: ?*D3D10_SHADER_INPUT_BIND_DESC) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetResourceBindingDescByName(@ptrCast(*const ID3D10ShaderReflection1, self), Name, pDesc); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetMovInstructionCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetMovInstructionCount(@ptrCast(*const ID3D10ShaderReflection1, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetMovcInstructionCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetMovcInstructionCount(@ptrCast(*const ID3D10ShaderReflection1, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetConversionInstructionCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetConversionInstructionCount(@ptrCast(*const ID3D10ShaderReflection1, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetBitwiseInstructionCount(self: *const T, pCount: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetBitwiseInstructionCount(@ptrCast(*const ID3D10ShaderReflection1, self), pCount); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_GetGSInputPrimitive(self: *const T, pPrim: ?*D3D_PRIMITIVE) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).GetGSInputPrimitive(@ptrCast(*const ID3D10ShaderReflection1, self), pPrim); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_IsLevel9Shader(self: *const T, pbLevel9Shader: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).IsLevel9Shader(@ptrCast(*const ID3D10ShaderReflection1, self), pbLevel9Shader); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ID3D10ShaderReflection1_IsSampleFrequencyShader(self: *const T, pbSampleFrequency: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ID3D10ShaderReflection1.VTable, self.vtable).IsSampleFrequencyShader(@ptrCast(*const ID3D10ShaderReflection1, self), pbSampleFrequency); } };} pub usingnamespace MethodMixin(@This()); }; pub const PFN_D3D10_CREATE_DEVICE1 = fn( param0: ?*IDXGIAdapter, param1: D3D10_DRIVER_TYPE, param2: ?HINSTANCE, param3: u32, param4: D3D10_FEATURE_LEVEL1, param5: u32, param6: ?*?*ID3D10Device1, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub const PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1 = fn( param0: ?*IDXGIAdapter, param1: D3D10_DRIVER_TYPE, param2: ?HINSTANCE, param3: u32, param4: D3D10_FEATURE_LEVEL1, param5: u32, param6: ?*DXGI_SWAP_CHAIN_DESC, param7: ?*?*IDXGISwapChain, param8: ?*?*ID3D10Device1, ) callconv(@import("std").os.windows.WINAPI) HRESULT; //-------------------------------------------------------------------------------- // Section: Functions (29) //-------------------------------------------------------------------------------- pub extern "d3d10" fn D3D10CreateDevice( pAdapter: ?*IDXGIAdapter, DriverType: D3D10_DRIVER_TYPE, Software: ?HINSTANCE, Flags: u32, SDKVersion: u32, ppDevice: ?*?*ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10CreateDeviceAndSwapChain( pAdapter: ?*IDXGIAdapter, DriverType: D3D10_DRIVER_TYPE, Software: ?HINSTANCE, Flags: u32, SDKVersion: u32, pSwapChainDesc: ?*DXGI_SWAP_CHAIN_DESC, ppSwapChain: ?*?*IDXGISwapChain, ppDevice: ?*?*ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10CreateBlob( NumBytes: usize, ppBuffer: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10CompileShader( // TODO: what to do with BytesParamIndex 1? pSrcData: ?[*:0]const u8, SrcDataSize: usize, pFileName: ?[*:0]const u8, pDefines: ?*const D3D_SHADER_MACRO, pInclude: ?*ID3DInclude, pFunctionName: ?[*:0]const u8, pProfile: ?[*:0]const u8, Flags: u32, ppShader: ?*?*ID3DBlob, ppErrorMsgs: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10DisassembleShader( // TODO: what to do with BytesParamIndex 1? pShader: ?*const c_void, BytecodeLength: usize, EnableColorCode: BOOL, pComments: ?[*:0]const u8, ppDisassembly: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10GetPixelShaderProfile( pDevice: ?*ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "d3d10" fn D3D10GetVertexShaderProfile( pDevice: ?*ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "d3d10" fn D3D10GetGeometryShaderProfile( pDevice: ?*ID3D10Device, ) callconv(@import("std").os.windows.WINAPI) ?PSTR; pub extern "d3d10" fn D3D10ReflectShader( // TODO: what to do with BytesParamIndex 1? pShaderBytecode: ?*const c_void, BytecodeLength: usize, ppReflector: ?*?*ID3D10ShaderReflection, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10PreprocessShader( // TODO: what to do with BytesParamIndex 1? pSrcData: ?[*:0]const u8, SrcDataSize: usize, pFileName: ?[*:0]const u8, pDefines: ?*const D3D_SHADER_MACRO, pInclude: ?*ID3DInclude, ppShaderText: ?*?*ID3DBlob, ppErrorMsgs: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10GetInputSignatureBlob( // TODO: what to do with BytesParamIndex 1? pShaderBytecode: ?*const c_void, BytecodeLength: usize, ppSignatureBlob: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10GetOutputSignatureBlob( // TODO: what to do with BytesParamIndex 1? pShaderBytecode: ?*const c_void, BytecodeLength: usize, ppSignatureBlob: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10GetInputAndOutputSignatureBlob( // TODO: what to do with BytesParamIndex 1? pShaderBytecode: ?*const c_void, BytecodeLength: usize, ppSignatureBlob: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10GetShaderDebugInfo( // TODO: what to do with BytesParamIndex 1? pShaderBytecode: ?*const c_void, BytecodeLength: usize, ppDebugInfo: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskUnion( pA: ?*D3D10_STATE_BLOCK_MASK, pB: ?*D3D10_STATE_BLOCK_MASK, pResult: ?*D3D10_STATE_BLOCK_MASK, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskIntersect( pA: ?*D3D10_STATE_BLOCK_MASK, pB: ?*D3D10_STATE_BLOCK_MASK, pResult: ?*D3D10_STATE_BLOCK_MASK, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskDifference( pA: ?*D3D10_STATE_BLOCK_MASK, pB: ?*D3D10_STATE_BLOCK_MASK, pResult: ?*D3D10_STATE_BLOCK_MASK, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskEnableCapture( pMask: ?*D3D10_STATE_BLOCK_MASK, StateType: D3D10_DEVICE_STATE_TYPES, RangeStart: u32, RangeLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskDisableCapture( pMask: ?*D3D10_STATE_BLOCK_MASK, StateType: D3D10_DEVICE_STATE_TYPES, RangeStart: u32, RangeLength: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskEnableAll( pMask: ?*D3D10_STATE_BLOCK_MASK, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskDisableAll( pMask: ?*D3D10_STATE_BLOCK_MASK, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10StateBlockMaskGetSetting( pMask: ?*D3D10_STATE_BLOCK_MASK, StateType: D3D10_DEVICE_STATE_TYPES, Entry: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub extern "d3d10" fn D3D10CreateStateBlock( pDevice: ?*ID3D10Device, pStateBlockMask: ?*D3D10_STATE_BLOCK_MASK, ppStateBlock: ?*?*ID3D10StateBlock, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10CompileEffectFromMemory( // TODO: what to do with BytesParamIndex 1? pData: ?*c_void, DataLength: usize, pSrcFileName: ?[*:0]const u8, pDefines: ?*const D3D_SHADER_MACRO, pInclude: ?*ID3DInclude, HLSLFlags: u32, FXFlags: u32, ppCompiledEffect: ?*?*ID3DBlob, ppErrors: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10CreateEffectFromMemory( // TODO: what to do with BytesParamIndex 1? pData: ?*c_void, DataLength: usize, FXFlags: u32, pDevice: ?*ID3D10Device, pEffectPool: ?*ID3D10EffectPool, ppEffect: ?*?*ID3D10Effect, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10CreateEffectPoolFromMemory( // TODO: what to do with BytesParamIndex 1? pData: ?*c_void, DataLength: usize, FXFlags: u32, pDevice: ?*ID3D10Device, ppEffectPool: ?*?*ID3D10EffectPool, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10" fn D3D10DisassembleEffect( pEffect: ?*ID3D10Effect, EnableColorCode: BOOL, ppDisassembly: ?*?*ID3DBlob, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10_1" fn D3D10CreateDevice1( pAdapter: ?*IDXGIAdapter, DriverType: D3D10_DRIVER_TYPE, Software: ?HINSTANCE, Flags: u32, HardwareLevel: D3D10_FEATURE_LEVEL1, SDKVersion: u32, ppDevice: ?*?*ID3D10Device1, ) callconv(@import("std").os.windows.WINAPI) HRESULT; pub extern "d3d10_1" fn D3D10CreateDeviceAndSwapChain1( pAdapter: ?*IDXGIAdapter, DriverType: D3D10_DRIVER_TYPE, Software: ?HINSTANCE, Flags: u32, HardwareLevel: D3D10_FEATURE_LEVEL1, SDKVersion: u32, pSwapChainDesc: ?*DXGI_SWAP_CHAIN_DESC, ppSwapChain: ?*?*IDXGISwapChain, ppDevice: ?*?*ID3D10Device1, ) 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 (26) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const D3D_CBUFFER_TYPE = @import("../graphics/direct3d11.zig").D3D_CBUFFER_TYPE; const D3D_NAME = @import("../graphics/direct3d11.zig").D3D_NAME; const D3D_PRIMITIVE = @import("../graphics/direct3d11.zig").D3D_PRIMITIVE; const D3D_PRIMITIVE_TOPOLOGY = @import("../graphics/direct3d11.zig").D3D_PRIMITIVE_TOPOLOGY; const D3D_REGISTER_COMPONENT_TYPE = @import("../graphics/direct3d11.zig").D3D_REGISTER_COMPONENT_TYPE; const D3D_RESOURCE_RETURN_TYPE = @import("../graphics/direct3d11.zig").D3D_RESOURCE_RETURN_TYPE; const D3D_SHADER_INPUT_TYPE = @import("../graphics/direct3d11.zig").D3D_SHADER_INPUT_TYPE; const D3D_SHADER_MACRO = @import("../graphics/direct3d11.zig").D3D_SHADER_MACRO; const D3D_SHADER_VARIABLE_CLASS = @import("../graphics/direct3d11.zig").D3D_SHADER_VARIABLE_CLASS; const D3D_SHADER_VARIABLE_TYPE = @import("../graphics/direct3d11.zig").D3D_SHADER_VARIABLE_TYPE; const D3D_SRV_DIMENSION = @import("../graphics/direct3d11.zig").D3D_SRV_DIMENSION; const DXGI_FORMAT = @import("../graphics/dxgi.zig").DXGI_FORMAT; const DXGI_SAMPLE_DESC = @import("../graphics/dxgi.zig").DXGI_SAMPLE_DESC; const DXGI_SWAP_CHAIN_DESC = @import("../graphics/dxgi.zig").DXGI_SWAP_CHAIN_DESC; const HANDLE = @import("../foundation.zig").HANDLE; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HRESULT = @import("../foundation.zig").HRESULT; const ID3DBlob = @import("../graphics/direct3d11.zig").ID3DBlob; const ID3DInclude = @import("../graphics/direct3d11.zig").ID3DInclude; const IDXGIAdapter = @import("../graphics/dxgi.zig").IDXGIAdapter; const IDXGISwapChain = @import("../graphics/dxgi.zig").IDXGISwapChain; const IUnknown = @import("../system/com.zig").IUnknown; const PSTR = @import("../foundation.zig").PSTR; const RECT = @import("../foundation.zig").RECT; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PFN_D3D10_CREATE_DEVICE1")) { _ = PFN_D3D10_CREATE_DEVICE1; } if (@hasDecl(@This(), "PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1")) { _ = PFN_D3D10_CREATE_DEVICE_AND_SWAP_CHAIN1; } @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/graphics/direct3d10.zig
const std = @import("std"); const assert = std.debug.assert; /// All integers are in big-endian format (needs a byteswap). pub const ExecHdr = extern struct { magic: u32, text: u32, data: u32, bss: u32, syms: u32, /// You should truncate this to 32 bits on 64 bit systems, then but the actual 8 bytes /// in the fat header. entry: u32, spsz: u32, pcsz: u32, comptime { assert(@sizeOf(@This()) == 32); } /// It is up to the caller to disgard the last 8 bytes if the header is not fat. pub fn toU8s(self: *@This()) [40]u8 { var buf: [40]u8 = undefined; var i: u8 = 0; inline for (std.meta.fields(@This())) |f| { std.mem.writeIntSliceBig(u32, buf[i .. i + 4], @field(self, f.name)); i += 4; } return buf; } }; pub const Sym = struct { /// Big endian in the file value: u64, type: Type, name: []const u8, pub const undefined_symbol: Sym = .{ .value = undefined, .type = .bad, .name = "undefined_symbol", }; /// The type field is one of the following characters with the /// high bit set: /// T text segment symbol /// t static text segment symbol /// L leaf function text segment symbol /// l static leaf function text segment symbol /// D data segment symbol /// d static data segment symbol /// B bss segment symbol /// b static bss segment symbol /// a automatic (local) variable symbol /// p function parameter symbol /// f source file name components /// z source file name /// Z source file line offset /// m for '.frame' pub const Type = enum(u8) { T = 0x80 | 'T', t = 0x80 | 't', L = 0x80 | 'L', l = 0x80 | 'l', D = 0x80 | 'D', d = 0x80 | 'd', B = 0x80 | 'B', b = 0x80 | 'b', a = 0x80 | 'a', p = 0x80 | 'p', f = 0x80 | 'f', z = 0x80 | 'z', Z = 0x80 | 'Z', m = 0x80 | 'm', /// represents an undefined symbol, to be removed in flush bad = 0, pub fn toGlobal(self: Type) Type { return switch (self) { .t => .T, .b => .B, .d => .D, else => unreachable, }; } }; }; pub const HDR_MAGIC = 0x00008000; pub inline fn _MAGIC(f: anytype, b: anytype) @TypeOf(f | ((((@as(c_int, 4) * b) + @as(c_int, 0)) * b) + @as(c_int, 7))) { return f | ((((@as(c_int, 4) * b) + @as(c_int, 0)) * b) + @as(c_int, 7)); } pub const A_MAGIC = _MAGIC(0, 8); // 68020 pub const I_MAGIC = _MAGIC(0, 11); // intel 386 pub const J_MAGIC = _MAGIC(0, 12); // intel 960 (retired) pub const K_MAGIC = _MAGIC(0, 13); // sparc pub const V_MAGIC = _MAGIC(0, 16); // mips 3000 BE pub const X_MAGIC = _MAGIC(0, 17); // att dsp 3210 (retired) pub const M_MAGIC = _MAGIC(0, 18); // mips 4000 BE pub const D_MAGIC = _MAGIC(0, 19); // amd 29000 (retired) pub const E_MAGIC = _MAGIC(0, 20); // arm pub const Q_MAGIC = _MAGIC(0, 21); // powerpc pub const N_MAGIC = _MAGIC(0, 22); // mips 4000 LE pub const L_MAGIC = _MAGIC(0, 23); // dec alpha (retired) pub const P_MAGIC = _MAGIC(0, 24); // mips 3000 LE pub const U_MAGIC = _MAGIC(0, 25); // sparc64 pub const S_MAGIC = _MAGIC(HDR_MAGIC, 26); // amd64 pub const T_MAGIC = _MAGIC(HDR_MAGIC, 27); // powerpc64 pub const R_MAGIC = _MAGIC(HDR_MAGIC, 28); // arm64 pub fn magicFromArch(arch: std.Target.Cpu.Arch) !u32 { return switch (arch) { .i386 => I_MAGIC, .sparc => K_MAGIC, // TODO should sparcv9 and sparcel go here? .mips => V_MAGIC, .arm => E_MAGIC, .aarch64 => R_MAGIC, .powerpc => Q_MAGIC, .powerpc64 => T_MAGIC, .x86_64 => S_MAGIC, else => error.ArchNotSupportedByPlan9, }; } /// gets the quantization of pc for the arch pub fn getPCQuant(arch: std.Target.Cpu.Arch) !u8 { return switch (arch) { .i386, .x86_64 => 1, .powerpc, .powerpc64, .mips, .sparc, .arm, .aarch64 => 4, else => error.ArchNotSupportedByPlan9, }; }
src/link/Plan9/aout.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const SueComparison = enum { eq, gt, lt }; const SueComparer = struct { value: u8 = 0, real_comparer: SueComparison = SueComparison.eq, fn real_compare(self: SueComparer, other: u8) bool { return switch (self.real_comparer) { SueComparison.eq => other == self.value, SueComparison.gt => other > self.value, SueComparison.lt => other < self.value, }; } }; pub fn run(problem: *aoc.Problem) !aoc.Solution { var target = std.StringHashMap(SueComparer).init(problem.allocator); defer target.deinit(); try target.putNoClobber("children", SueComparer { .value = 3 }); try target.putNoClobber("cats", SueComparer { .value = 7, .real_comparer = SueComparison.gt }); try target.putNoClobber("samoyeds", SueComparer { .value = 2 }); try target.putNoClobber("pomeranians", SueComparer { .value = 3, .real_comparer = SueComparison.lt }); try target.putNoClobber("akitas", SueComparer {}); try target.putNoClobber("vizslas", SueComparer {}); try target.putNoClobber("goldfish", SueComparer { .value = 5, .real_comparer = SueComparison.lt }); try target.putNoClobber("trees", SueComparer { .value = 3, .real_comparer = SueComparison.gt }); try target.putNoClobber("cars", SueComparer { .value = 2 }); try target.putNoClobber("perfumes", SueComparer { .value = 1 }); var fake: []const u8 = undefined; var real: []const u8 = undefined; while (problem.line()) |line| { var is_fake = true; var is_real = true; var tokens = std.mem.tokenize(u8, line, " :,"); _ = tokens.next().?; const sue = tokens.next().?; while (tokens.next()) |key| { const comparer = target.get(key).?; const actual_value = try std.fmt.parseInt(u8, tokens.next().?, 10); if (comparer.value != actual_value) { is_fake = false; } if (!comparer.real_compare(actual_value)) { is_real = false; } } if (is_fake) { fake = sue; } else if (is_real) { real = sue; } } return problem.solution(fake, real); }
src/main/zig/2015/day16.zig
const std = @import("std"); const zang = @import("zang"); const note_frequencies = @import("zang-12tet"); const common = @import("common.zig"); const c = @import("common/c.zig"); const Instrument = @import("scriptgen.zig").Instrument; pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb; pub const AUDIO_SAMPLE_RATE = 44100; pub const AUDIO_BUFFER_SIZE = 1024; pub const DESCRIPTION = \\example_script \\ \\Play a scripted sound module with the keyboard. ; const a4 = 440.0; pub const MainModule = struct { comptime { std.debug.assert(Instrument.num_outputs == 1); } pub const num_outputs = 2; pub const num_temps = Instrument.num_temps; pub const output_audio = common.AudioOut{ .mono = 0 }; pub const output_visualize = 0; pub const output_sync_oscilloscope = 1; key: ?i32, iq: zang.Notes(Instrument.Params).ImpulseQueue, idgen: zang.IdGenerator, instr: Instrument, trig: zang.Trigger(Instrument.Params), pub fn init() MainModule { return .{ .key = null, .iq = zang.Notes(Instrument.Params).ImpulseQueue.init(), .idgen = zang.IdGenerator.init(), .instr = Instrument.init(), .trig = zang.Trigger(Instrument.Params).init(), }; } pub fn paint(self: *MainModule, span: zang.Span, outputs: [num_outputs][]f32, temps: [num_temps][]f32) void { var ctr = self.trig.counter(span, self.iq.consume()); while (self.trig.next(&ctr)) |result| { self.instr.paint(result.span, .{outputs[0]}, temps, result.note_id_changed, result.params); switch (result.params.freq) { .constant => |freq| zang.addScalarInto(result.span, outputs[1], freq), .buffer => |freq| zang.addInto(result.span, outputs[1], freq), } } } pub fn keyEvent(self: *MainModule, key: i32, down: bool, impulse_frame: usize) bool { const rel_freq = common.getKeyRelFreq(key) orelse return false; if (down or (if (self.key) |nh| nh == key else false)) { self.key = if (down) key else null; self.iq.push(impulse_frame, self.idgen.nextId(), .{ .sample_rate = AUDIO_SAMPLE_RATE, .freq = zang.constant(a4 * rel_freq), .note_on = down, }); } return true; } };
examples/example_script.zig
const std = @import("std"); const os = std.os; const utils = @import("utils.zig"); // Shorthand for comparing a [*:0] to a []const u8 const eql = utils.eql; const print = utils.print; const Files = std.ArrayList(File); const File = struct { time: i128, name: []const u8, kind: std.fs.Dir.Entry.Kind, }; const TimeType = enum { /// Access time atime, /// Creation time ctime, /// Modification time mtime, }; const Args = struct { dir: []const u8 = "./", reverse: bool = false, recursive: bool = false, verbose: bool = false, time: TimeType = .mtime, }; pub fn main() !void { const args = parseArgs(os.argv[1..os.argv.len]) orelse os.exit(2); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer if (gpa.deinit()) @panic("memory leak"); const allocator = gpa.allocator(); var arena_allocator = std.heap.ArenaAllocator.init(allocator); defer arena_allocator.deinit(); const arena = arena_allocator.allocator(); var files = Files.init(arena); const fd = try os.open(args.dir, 0, os.O.RDONLY); defer os.close(fd); if (!(try isDir(fd))) { std.debug.print("{s} is not a directory\n", .{args.dir}); os.exit(1); } try searchDir(arena, args, fd, null, &files); if (args.verbose) { print("found {} files\n", .{files.items.len}); } utils.insertionSort(File, files.items); if (args.reverse) { std.mem.reverse(File, files.items); } const use_colors = os.isatty(std.io.getStdOut().handle); const setColor = if (use_colors) utils.setColor else utils.noOpSetColor; for (files.items) |file| { switch (file.kind) { .Directory => { setColor(.red); print("{s}", .{file.name}); setColor(.default); print("\n", .{}); }, .SymLink => { setColor(.green); print("{s}", .{file.name}); setColor(.default); print("\n", .{}); }, .File => { print("{s}\n", .{file.name}); }, else => @panic("unexpected file type!"), } } } fn searchDir(allocator: std.mem.Allocator, args: Args, fd: os.fd_t, prefix: ?[]const u8, files: *Files) anyerror!void { var dir = std.fs.Dir{ .fd = fd }; var iter = dir.iterate(); while (try iter.next()) |entry| { switch (entry.kind) { .File, .Directory, .SymLink => { const file = dir.openFile(entry.name, .{}) catch |err| switch (err) { error.AccessDenied => continue, // Broken symbolic link, possibly more? error.FileNotFound => continue, else => return err, }; defer file.close(); const stat = try file.stat(); const time = switch (args.time) { .atime => stat.atime, .ctime => stat.ctime, .mtime => stat.mtime, }; var fname = blk: { if (prefix) |p| { break :blk try std.mem.join(allocator, "/", &[_][]const u8{ p, entry.name }); } else { var fname = try allocator.alloc(u8, entry.name.len); std.mem.copy(u8, fname, entry.name); break :blk fname; } }; const f = File{ .time = time, .name = fname, .kind = entry.kind, }; try files.append(f); if (args.recursive and entry.kind == .Directory) { try searchDir(allocator, args, file.handle, fname, files); } }, else => {}, } } } fn isDir(fd: os.fd_t) !bool { const stat = try os.fstat(fd); return ((stat.mode & os.S.IFMT) == os.S.IFDIR); } fn usage() void { print("Program prints files in directory, sorted by last (access|creation|modification) time\n", .{}); print("{s} [options, with a space between each] directory\n", .{os.argv[0]}); print("-r to print in reversed order", .{}); print("-R for recursive searching\n", .{}); print("-v for verbose output\n", .{}); print("-[a, c, m]time to change which time metric files are sorted by\n", .{}); } fn parseArgs(argv: [][*:0]u8) ?Args { var args = Args{}; var stop_parsing_options: ?usize = null; for (argv) |i, index| { if (eql(i, "--")) { stop_parsing_options = index; break; } if (eql(i, "-h") or eql(i, "--h") or eql(i, "-?") or eql(i, "--?") or eql(i, "-help") or eql(i, "--help")) { usage(); return null; } else if (eql(i, "-r")) { args.reverse = true; } else if (eql(i, "-R")) { args.recursive = true; } else if (eql(i, "-v")) { args.verbose = true; } else if (i[0] == '-' and std.meta.stringToEnum(TimeType, std.mem.span(i)[1..]) != null) { args.time = std.meta.stringToEnum(TimeType, std.mem.span(i)[1..]).?; } else { args.dir = std.mem.span(i); } } if (stop_parsing_options) |index| { for (argv[index..argv.len]) |arg| { args.dir = std.mem.span(arg); } } return args; }
main.zig
pub const PRINTTICKET_ISTREAM_APIS = @as(u32, 1); pub const S_PT_NO_CONFLICT = @as(u32, 262145); pub const S_PT_CONFLICT_RESOLVED = @as(u32, 262146); pub const E_PRINTTICKET_FORMAT = @as(u32, 2147745795); pub const E_PRINTCAPABILITIES_FORMAT = @as(u32, 2147745796); pub const E_DELTA_PRINTTICKET_FORMAT = @as(u32, 2147745797); pub const E_PRINTDEVICECAPABILITIES_FORMAT = @as(u32, 2147745798); //-------------------------------------------------------------------------------- // Section: Types (2) //-------------------------------------------------------------------------------- pub const EDefaultDevmodeType = enum(i32) { UserDefaultDevmode = 0, PrinterDefaultDevmode = 1, }; pub const kUserDefaultDevmode = EDefaultDevmodeType.UserDefaultDevmode; pub const kPrinterDefaultDevmode = EDefaultDevmodeType.PrinterDefaultDevmode; pub const EPrintTicketScope = enum(i32) { PageScope = 0, DocumentScope = 1, JobScope = 2, }; pub const kPTPageScope = EPrintTicketScope.PageScope; pub const kPTDocumentScope = EPrintTicketScope.DocumentScope; pub const kPTJobScope = EPrintTicketScope.JobScope; //-------------------------------------------------------------------------------- // Section: Functions (11) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTQuerySchemaVersionSupport( pszPrinterName: ?[*:0]const u16, pMaxVersion: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTOpenProvider( pszPrinterName: ?[*:0]const u16, dwVersion: u32, phProvider: ?*?HPTPROVIDER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTOpenProviderEx( pszPrinterName: ?[*:0]const u16, dwMaxVersion: u32, dwPrefVersion: u32, phProvider: ?*?HPTPROVIDER, pUsedVersion: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTCloseProvider( hProvider: ?HPTPROVIDER, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTReleaseMemory( pBuffer: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTGetPrintCapabilities( hProvider: ?HPTPROVIDER, pPrintTicket: ?*IStream, pCapabilities: ?*IStream, pbstrErrorMessage: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows10.0.15063' pub extern "prntvpt" fn PTGetPrintDeviceCapabilities( hProvider: ?HPTPROVIDER, pPrintTicket: ?*IStream, pDeviceCapabilities: ?*IStream, pbstrErrorMessage: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows10.0.15063' pub extern "prntvpt" fn PTGetPrintDeviceResources( hProvider: ?HPTPROVIDER, pszLocaleName: ?[*:0]const u16, pPrintTicket: ?*IStream, pDeviceResources: ?*IStream, pbstrErrorMessage: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTMergeAndValidatePrintTicket( hProvider: ?HPTPROVIDER, pBaseTicket: ?*IStream, pDeltaTicket: ?*IStream, scope: EPrintTicketScope, pResultTicket: ?*IStream, pbstrErrorMessage: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTConvertPrintTicketToDevMode( hProvider: ?HPTPROVIDER, pPrintTicket: ?*IStream, baseDevmodeType: EDefaultDevmodeType, scope: EPrintTicketScope, pcbDevmode: ?*u32, ppDevmode: ?*?*DEVMODEA, pbstrErrorMessage: ?*?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "prntvpt" fn PTConvertDevModeToPrintTicket( hProvider: ?HPTPROVIDER, cbDevmode: u32, pDevmode: ?*DEVMODEA, scope: EPrintTicketScope, pPrintTicket: ?*IStream, ) 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 (6) //-------------------------------------------------------------------------------- const BSTR = @import("../../foundation.zig").BSTR; const DEVMODEA = @import("../../graphics/gdi.zig").DEVMODEA; const HPTPROVIDER = @import("../../storage/xps.zig").HPTPROVIDER; const HRESULT = @import("../../foundation.zig").HRESULT; const IStream = @import("../../system/com.zig").IStream; 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/graphics/printing/print_ticket.zig
const std = @import("std"); const SDL = @import("sdl2"); const zigimg = @import("zigimg"); const utils = @import("utils.zig"); /// # Usage /// Specify the relative path to an image from the command line as an argument to this executable. /// This image will be displayed. /// # Example /// This will open the given bmp image and display it. If we use the example like this we can open /// 24 bit RGB and 32bit RGBA datasets. /// `zig build run -- assets/logo.bmp` /// We can also let the user specify how the conversion from a zigimg Image structure to a texture /// will be performed. If nothing is specified, the buffers will be used as the pixels of an sdl surface. /// But we can also optionally specify `--color-iter` as the first argument, which will tell the example program /// to use the color iterator of the image to perform the conversion. This is even more flexible than the /// buffer based algorithm, because it can deal with any kind of image data, not just 24/32 bit RGB(A). pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var allocator: *std.mem.Allocator = &gpa.allocator; try SDL.init(.{ .video = true, .events = true, .audio = false }); defer SDL.quit(); var program_config = try utils.parseProcessArgs(allocator); const img = try zigimg.image.Image.fromFile(allocator, &program_config.image_file); defer img.deinit(); var window = try SDL.createWindow("Example: zigimg with SDL2", .{ .centered = {} }, .{ .centered = {} }, img.width, img.height, .{ .shown = true }); defer window.destroy(); var renderer = try SDL.createRenderer(window, null, .{}); defer renderer.destroy(); const dst_rect = SDL.Rectangle{ .x = 0, .y = 0, .width = @intCast(c_int, img.width), .height = @intCast(c_int, img.height) }; // allow user to decide wheter the color iterator or should be used for conversion of if the image buffer should be // directly copied into a surface and then into a texture. var texture = switch (program_config.image_conversion) { .buffer => try utils.sdlTextureFromImage(renderer, img), .color_iterator => try utils.sdlTextureFromImageUsingColorIterator(renderer, img), }; try renderer.setColor(SDL.Color{ .r = 128, .g = 128, .b = 128, .a = 0 }); try renderer.clear(); try renderer.copy(texture, null, dst_rect); renderer.present(); mainloop: while (true) { while (SDL.pollEvent()) |ev| { switch (ev) { .quit => break :mainloop, else => {}, } } } }
src/main.zig
const std = @import("std"); const print = std.debug.print; pub fn main() anyerror!void { const allocator = std.heap.page_allocator; var file = try std.fs.cwd().openFile( "./inputs/day08.txt", .{ .read = true, }, ); var reader = std.io.bufferedReader(file.reader()).reader(); var line = std.ArrayList(u8).init(allocator); defer line.deinit(); var total_code_chars: usize = 0; var total_value_chars: usize = 0; var total_encode_chars: usize = 0; while (reader.readUntilDelimiterArrayList(&line, '\n', 100)) { const code_chars = line.items.len; var value_chars: usize = 0; var encode_chars: usize = 2; var escaped = false; var hex_rem: u8 = 0; for (line.items) |c| { if (hex_rem > 0) { hex_rem -= 1; continue; } switch (c) { '"' => { encode_chars += 2; if (escaped) { value_chars += 1; escaped = false; } }, '\\' => { encode_chars += 2; if (escaped) { value_chars += 1; escaped = false; } else { escaped = true; } }, 'x' => { encode_chars += 1; value_chars += 1; if (escaped) { encode_chars += 2; hex_rem = 2; escaped = false; } }, else => { encode_chars += 1; value_chars += 1; }, } } total_code_chars += code_chars; total_value_chars += value_chars; total_encode_chars += encode_chars; } else |err| { if (err != error.EndOfStream) { return err; } } print("Part 1: {d}\n", .{total_code_chars - total_value_chars}); print("Part 2: {d}\n", .{total_encode_chars - total_code_chars}); }
src/day08.zig
const std = @import("std"); const os = std.os; const print = std.debug.print; const net = std.net; const fmt = std.fmt; const mem = std.mem; const io = std.io; pub fn main() !void { var allocator = std.heap.page_allocator; var args = os.argv; if (args.len < 3) { print("usage: tcp_client hostname port\n", .{}); os.exit(1); } print("Configuring remote address...\n", .{}); var url = mem.span(args[1]); var port = mem.span(args[2]); var port_no = try fmt.parseInt(u16, port, 0); const addrs_list = try std.net.getAddressList(allocator, url, port_no); defer addrs_list.deinit(); var peer_address: net.Address = undefined; // take the IPv4 address by checking its size outer: for (addrs_list.addrs) |addr| { const bytes = @ptrCast(*const [4]u8, &addr.in.sa.addr); if (bytes.len > 0) { peer_address = addr; break :outer; } } print("Remote address is {}\n", .{peer_address.in}); print("Creating socket...\n", .{}); const socket_peer = try os.socket(os.AF_INET, os.SOCK_STREAM, os.IPPROTO_TCP); defer { print("Closing socket...\n", .{}); os.close(socket_peer); } print("Connecting...\n", .{}); try os.connect(socket_peer, &peer_address.any, peer_address.getOsSockLen()); print("Connected...\n", .{}); print("To send data, enter text followed by an enter.\n", .{}); var pfd = [2]os.pollfd{ os.pollfd{ .fd = 0, // stdin .events = os.POLLIN, .revents = undefined, }, os.pollfd{ .fd = socket_peer, .events = os.POLLIN, .revents = undefined, }, }; while (true) { const nevents = os.poll(&pfd, 100) catch 0; if (nevents == 0) continue; if ((pfd[0].revents & os.POLLIN) == os.POLLIN) { var read: [4096]u8 = undefined; const stdin = io.getStdIn(); const raw_input = stdin.reader().readUntilDelimiterOrEof(read[0..], '\n') catch |err| { print("error: cannot read from STDIN: {}\n", .{err}); return; } orelse return; const input = try fmt.bufPrint(read[0..], "{s}\n", .{raw_input}); print("Sending: {s}\n", .{raw_input}); var bytes_sent = os.send(socket_peer, input, 0); print("Sent {} bytes.\n", .{bytes_sent}); } if ((pfd[1].revents & os.POLLIN) == os.POLLIN) { var read: [4096]u8 = undefined; const bytes_received = try os.recv(socket_peer, read[0..], 0); if (bytes_received < 1) { print("Connection closed by peer.\n", .{}); break; } print("Received ({} bytes): {s}", .{ bytes_received, read[0..bytes_received] }); } } print("Finished.\n", .{}); return; }
chap03/tcp_client.zig
const std = @import("std"); const math = std.math; const testing = std.testing; const __divxf3 = @import("divxf3.zig").__divxf3; fn compareResult(result: f80, expected: u80) bool { const rep = @bitCast(u80, result); if (rep == expected) return true; // test other possible NaN representations (signal NaN) if (math.isNan(result) and math.isNan(@bitCast(f80, expected))) return true; return false; } fn expect__divxf3_result(a: f80, b: f80, expected: u80) !void { const x = __divxf3(a, b); const ret = compareResult(x, expected); try testing.expect(ret == true); } fn test__divxf3(a: f80, b: f80) !void { const integerBit = 1 << math.floatFractionalBits(f80); const x = __divxf3(a, b); // Next float (assuming normal, non-zero result) const x_plus_eps = @bitCast(f80, (@bitCast(u80, x) + 1) | integerBit); // Prev float (assuming normal, non-zero result) const x_minus_eps = @bitCast(f80, (@bitCast(u80, x) - 1) | integerBit); // Make sure result is more accurate than the adjacent floats const err_x = @fabs(@mulAdd(f80, x, b, -a)); const err_x_plus_eps = @fabs(@mulAdd(f80, x_plus_eps, b, -a)); const err_x_minus_eps = @fabs(@mulAdd(f80, x_minus_eps, b, -a)); try testing.expect(err_x_minus_eps > err_x); try testing.expect(err_x_plus_eps > err_x); } test "divxf3" { // qNaN / any = qNaN try expect__divxf3_result(math.qnan_f80, 0x1.23456789abcdefp+5, 0x7fffC000000000000000); // NaN / any = NaN try expect__divxf3_result(math.nan_f80, 0x1.23456789abcdefp+5, 0x7fffC000000000000000); // inf / any(except inf and nan) = inf try expect__divxf3_result(math.inf(f80), 0x1.23456789abcdefp+5, 0x7fff8000000000000000); // inf / inf = nan try expect__divxf3_result(math.inf(f80), math.inf(f80), 0x7fffC000000000000000); // inf / nan = nan try expect__divxf3_result(math.inf(f80), math.nan(f80), 0x7fffC000000000000000); try test__divxf3(0x1.a23b45362464523375893ab4cdefp+5, 0x1.eedcbaba3a94546558237654321fp-1); try test__divxf3(0x1.a2b34c56d745382f9abf2c3dfeffp-50, 0x1.ed2c3ba15935332532287654321fp-9); try test__divxf3(0x1.2345f6aaaa786555f42432abcdefp+456, 0x1.edacbba9874f765463544dd3621fp+6400); try test__divxf3(0x1.2d3456f789ba6322bc665544edefp-234, 0x1.eddcdba39f3c8b7a36564354321fp-4455); try test__divxf3(0x1.2345f6b77b7a8953365433abcdefp+234, 0x1.edcba987d6bb3aa467754354321fp-4055); try test__divxf3(0x1.a23b45362464523375893ab4cdefp+5, 0x1.a2b34c56d745382f9abf2c3dfeffp-50); try test__divxf3(0x1.a23b45362464523375893ab4cdefp+5, 0x1.1234567890abcdef987654321123p0); try test__divxf3(0x1.a23b45362464523375893ab4cdefp+5, 0x1.12394205810257120adae8929f23p+16); try test__divxf3(0x1.a23b45362464523375893ab4cdefp+5, 0x1.febdcefa1231245f9abf2c3dfeffp-50); // Result rounds down to zero try expect__divxf3_result(6.72420628622418701252535563464350521E-4932, 2.0, 0x0); }
lib/compiler_rt/divxf3_test.zig
const std = @import("std"); const terminal = @import("zig-terminal"); const ArrayList = std.ArrayList; const Op = enum { add, subtract, multiply, divide, }; const Token = union(enum) { paren: u8, op: Op, number: []u8, }; fn tokenize(src: []u8, allocator: *std.mem.Allocator) ![]Token { var tokens = ArrayList(Token).init(allocator); errdefer tokens.deinit(); var iter: usize = 0; while (iter < src.len) { const ch = src[iter]; iter += 1; switch (ch) { '(', ')' => try tokens.append(.{ .paren = ch }), '+' => try tokens.append(.{ .op = .add }), '-' => try tokens.append(.{ .op = .subtract }), '*' => try tokens.append(.{ .op = .multiply }), '/' => try tokens.append(.{ .op = .divide }), '0'...'9' => { var value = ArrayList(u8).init(allocator); errdefer value.deinit(); try value.append(ch); while (iter < src.len) { const next = src[iter]; switch (next) { '0'...'9' => { iter += 1; try value.append(next); }, else => break, } } try tokens.append(.{ .number = value.items }); }, ' ' => {}, else => return error.InvalidCharacter, } } return tokens.items; } const ComputeError = error{ BadInput, InvalidNumber, NotImplemented, ExpectedOp, OutOfMemory, BadDivisionParams, DivisionByZero, BadSubtractionParams, }; fn compute(tokens: []Token, iter: *usize, allocator: *std.mem.Allocator) ComputeError!isize { if (iter.* >= tokens.len) { return error.BadInput; } const token = tokens[iter.*]; iter.* += 1; switch (token) { .number => |num| { const n = std.fmt.parseInt(isize, num, 10) catch return error.InvalidNumber; return n; }, .paren => |paren| { if (paren == '(') { const next = tokens[iter.*]; iter.* += 1; switch (next) { .op => |op| switch (op) { .add => { var sum: isize = 0; while (iter.* < tokens.len) { const second_next = tokens[iter.*]; switch (second_next) { .paren => |subparen| { if (subparen == ')') { break; } sum += try compute(tokens, iter, allocator); }, else => { sum += try compute(tokens, iter, allocator); }, } } iter.* += 1; return sum; }, .multiply => { var product: isize = 1; while (iter.* < tokens.len) { const second_next = tokens[iter.*]; switch (second_next) { .paren => |subparen| { if (subparen == ')') { break; } product *= try compute(tokens, iter, allocator); }, else => { product *= try compute(tokens, iter, allocator); }, } } iter.* += 1; return product; }, .divide => { var params = ArrayList(isize).init(allocator); errdefer params.deinit(); while (iter.* < tokens.len) { const second_next = tokens[iter.*]; switch (second_next) { .paren => |subparen| { if (subparen == ')') { break; } const result = try compute(tokens, iter, allocator); try params.append(result); }, else => { const result = try compute(tokens, iter, allocator); try params.append(result); }, } } iter.* += 1; const items = params.items; if (items.len < 2) { return error.BadDivisionParams; } var result = items[0]; for (items[1..]) |item| { if (item == 0) return error.DivisionByZero; result = @divFloor(result, item); } return result; }, .subtract => { var sub: isize = 0; while (iter.* < tokens.len) { const second_next = tokens[iter.*]; switch (second_next) { .paren => |subparen| { if (subparen == ')') { break; } sub -= try compute(tokens, iter, allocator); }, else => { sub -= try compute(tokens, iter, allocator); }, } } iter.* += 1; return sub; }, }, else => return error.ExpectedOp, } } return error.BadInput; }, else => return error.BadInput, } } fn eval(expr: []u8) !isize { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); var tokens = try tokenize(expr, &arena.allocator); var iter: usize = 0; const result = try compute(tokens, &iter, &arena.allocator); return result; } pub fn main() anyerror!void { var term = terminal.Terminal.init(); try term.printWithAttributes(.{ .blue, "Crisp Version 0.0.1 🚀\n", "Type :q to Exit\n\n", .reset, }); while (true) { try term.printWithAttributes(.{ terminal.TextAttributes{ .foreground = .magenta, .bold = true, }, "crisp> ", terminal.TextAttributes{ .foreground = .cyan, .bold = true, }, }); const chars = try term.reader().readUntilDelimiterAlloc( std.heap.page_allocator, '\n', std.math.maxInt(usize), ); defer std.heap.page_allocator.free(chars); try term.resetAttributes(); if (std.mem.eql(u8, chars, ":q")) { try term.printWithAttributes(.{ terminal.TextAttributes{ .foreground = .green, .bold = true, }, "\nGoodbye 👋\n", .reset, }); std.process.exit(0); } if (eval(chars)) |result| { try term.printWithAttributes(.{ .{ .foreground = .green, .bold = true }, terminal.format("\n-> {}\n\n", .{result}), .reset, }); } else |err| switch (err) { error.OutOfMemory => try term.printWithAttributes(.{ terminal.TextAttributes{ .foreground = .red, .bold = true, }, "Error: out of memory \n\n", .reset, }), error.InvalidCharacter => try term.printWithAttributes(.{ terminal.TextAttributes{ .foreground = .red, .bold = true, }, "Error: invalid character \n\n", .reset, }), error.DivisionByZero => try term.printWithAttributes(.{ terminal.TextAttributes{ .foreground = .red, .bold = true, }, "Error: canot divide by zero \n\n", .reset, }), else => try term.printWithAttributes(.{ terminal.TextAttributes{ .foreground = .red, .bold = true, }, "Error: error calculating result \n\n", .reset, }), } } }
src/main.zig
const std = @import("std"); pub const DebugInterface = struct { const Self = @This(); pub const TraceError = error{DebugBreak}; traceInstructionFn: fn (self: *Self, ip: u16, instruction: Instruction, input0: u16, input1: u16, output: u16) void, traceAddressFn: fn (self: *Self, virt: u16) TraceError!void, /// Traces a address to the debugger. If a breakpoint is set there, /// it must return `error.DebugBreak`. pub fn traceAddress(self: *Self, virt: u16) TraceError!void { return self.traceAddressFn(self, virt); } /// Traces a successfully executed instructions. pub fn traceInstruction(self: *Self, ip: u16, instruction: Instruction, input0: u16, input1: u16, output: u16) void { self.traceInstructionFn(self, ip, instruction, input0, input1, output); } }; pub const Interrupt = enum(u3) { reset, nmi, bus, unused_3, arith, software, reserved, irq, }; pub fn SpuMk2(comptime MemoryInterface: type) type { return struct { const Self = @This(); memory: MemoryInterface, debug_interface: ?*DebugInterface, ip: u16, bp: u16, fr: FlagRegister, sp: u16, ir: u16, pub fn init(memory: MemoryInterface) Self { return Self{ .memory = memory, .debug_interface = null, .ip = 0x0000, .fr = std.mem.zeroes(FlagRegister), .bp = undefined, .sp = undefined, .ir = 0x0001, // reset on start }; } pub fn reset(self: *Self) void { self.ip = 0x0000; self.fr = std.mem.zeroes(FlagRegister); self.bp = undefined; self.sp = undefined; self.ir = 0x0001; // reset on start } pub fn triggerInterrupt(self: *Self, intr: Interrupt) void { self.ir |= @as(u16, 1) << @enumToInt(intr); } pub fn readByte(self: *Self, address: u16) !u8 { return self.memory.read8(address); } pub fn writeByte(self: *Self, address: u16, value: u8) !void { return self.memory.write8(address, value); } pub fn readWord(self: *Self, address: u16) !u16 { if ((address & 1) != 0) return error.UnalignedAccess; return self.memory.read16(address); } pub fn writeWord(self: *Self, address: u16, value: u16) !void { if ((address & 1) != 0) return error.UnalignedAccess; return self.memory.write16(address, value); } pub fn fetch(self: *Self) !u16 { const value = try self.readWord(self.ip); self.ip +%= 2; return value; } pub fn peek(self: *Self) !u16 { return try self.readWord(self.sp); } pub fn pop(self: *Self) !u16 { const value = try self.readWord(self.sp); self.sp +%= 2; return value; } pub fn push(self: *Self, value: u16) !void { self.sp -%= 2; try self.writeWord(self.sp, value); } pub fn executeSingle(self: *Self) !void { if (self.debug_interface) |debug| { try debug.traceAddress(self.ip); } { comptime var i = 7; inline while (i >= 0) : (i -= 1) { const mask: u16 = (1 << i); if ((self.ir & mask) != 0) { if (i < 4 or (self.fr.int & mask) != 0) { self.ir &= ~mask; // mask interrupt if (i >= 4) { self.fr.int &= ~mask; } const ip = try self.readWord(2 * i); // RESET is a special case! if (i != 0) { try self.push(if (i < 4) 0 else mask); try self.push(self.ip); } else { self.fr = std.mem.zeroes(FlagRegister); } self.ip = ip; // std.debug.print("Interrupt {} was triggered, jump to 0x{X:0>4}, FR={b:0>8}, IR={b:0>8}\n", .{ // i, // ip, // self.fr.int, // self.ir, // }); } } } } const start_ip = self.ip; const instruction = @bitCast(Instruction, try self.fetch()); if (instruction.reserved == 1) { switch (@bitCast(u16, instruction)) { // 0x8000 => self.trace_enabled = false, // 0x8001 => self.trace_enabled = true, // 0x8002 => try @import("root").dumpState(self), else => return error.BadInstruction, } return; } const execute = switch (instruction.condition) { .always => true, .when_zero => self.fr.bits.zero, .not_zero => !self.fr.bits.zero, .greater_zero => !self.fr.bits.zero and !self.fr.bits.negative, .less_than_zero => !self.fr.bits.zero and self.fr.bits.negative, .greater_or_equal_zero => self.fr.bits.zero or !self.fr.bits.negative, .less_or_equal_zero => self.fr.bits.zero or self.fr.bits.negative, .overflow => self.fr.bits.carry, }; if (execute) { const input0 = switch (instruction.input0) { .zero => @as(u16, 0), .immediate => try self.fetch(), .peek => try self.peek(), .pop => try self.pop(), }; const input1 = switch (instruction.input1) { .zero => @as(u16, 0), .immediate => try self.fetch(), .peek => try self.peek(), .pop => try self.pop(), }; const output = switch (instruction.command) { .copy => input0, .get => try self.readWord(self.bp +% 2 *% input0), .set => blk: { try self.writeWord(self.bp +% 2 *% input0, input1); break :blk input1; }, .store8 => blk: { const val = @truncate(u8, input0); try self.writeByte(input1, val); break :blk val; }, .store16 => blk: { try self.writeWord(input1, input0); break :blk input1; }, .load8 => try self.readByte(input0), .load16 => try self.readWord(input0), .frget => self.fr.int & ~input1, .frset => blk: { const previous = self.fr.int; self.fr.int = (self.fr.int & input1) | (input0 & ~input1); break :blk previous; }, .bpget => self.bp, .bpset => blk: { self.bp = input0; break :blk self.bp; }, .spget => self.sp, .spset => blk: { self.sp = input0; break :blk self.sp; }, .add => blk: { var result: u16 = undefined; self.fr.bits.carry = @addWithOverflow(u16, input0, input1, &result); break :blk result; }, .sub => blk: { var result: u16 = undefined; self.fr.bits.carry = @subWithOverflow(u16, input0, input1, &result); break :blk result; }, .mul => blk: { var result: u16 = undefined; self.fr.bits.carry = @mulWithOverflow(u16, input0, input1, &result); break :blk result; }, .div => input0 / input1, .mod => input0 % input1, .@"and" => input0 & input1, .@"or" => input0 | input1, .xor => input0 ^ input1, .not => ~input0, .signext => if ((input0 & 0x80) != 0) (input0 & 0xFF) | 0xFF00 else (input0 & 0xFF), .rol => (input0 << 1) | (input0 >> 15), .ror => (input0 >> 1) | (input0 << 15), .bswap => (input0 << 8) | (input0 >> 8), .asr => (input0 & 0x8000) | (input0 >> 1), .lsl => input0 << 1, .lsr => input0 >> 1, .cpuid => 0, .halt => switch (input1) { 0xDEAD => return error.DebugBreak, // "hidden" control else => return error.CpuHalted, }, .setip => blk: { const out = self.ip; self.ip = input0; self.fr.int |= input1; break :blk out; }, .addip => blk: { const out = self.ip; self.ip += input0; self.fr.int |= input1; break :blk out; }, .intr => blk: { self.ir |= input0; break :blk input0; }, _ => return error.BadInstruction, }; switch (instruction.output) { .discard => {}, .push => try self.push(output), } if (instruction.modify_flags) { self.fr.bits.negative = (output & 0x8000) != 0; self.fr.bits.zero = (output == 0x0000); } if (self.debug_interface) |intf| { intf.traceInstruction(start_ip, instruction, input0, input1, output); } } else { if (instruction.input0 == .immediate) self.ip +%= 2; if (instruction.input1 == .immediate) self.ip +%= 2; } } pub fn runBatch(self: *Self, count: u64) !void { var i: u64 = count; while (i > 0) { i -= 1; try self.executeSingle(); } } }; } pub const ExecutionCondition = enum(u3) { always = 0, when_zero = 1, not_zero = 2, greater_zero = 3, less_than_zero = 4, greater_or_equal_zero = 5, less_or_equal_zero = 6, overflow = 7, }; pub const InputBehaviour = enum(u2) { zero = 0, immediate = 1, peek = 2, pop = 3, }; pub const OutputBehaviour = enum(u1) { discard = 0, push = 1, }; pub const Command = enum(u6) { copy = 0b000000, get = 0b000010, set = 0b000011, store8 = 0b000100, store16 = 0b000101, load8 = 0b000110, load16 = 0b000111, cpuid = 0b001000, halt = 0b001001, frget = 0b001010, frset = 0b001011, bpget = 0b001100, bpset = 0b001101, spget = 0b001110, spset = 0b001111, add = 0b010000, sub = 0b010001, mul = 0b010010, div = 0b010011, mod = 0b010100, @"and" = 0b010101, @"or" = 0b010110, xor = 0b010111, not = 0b011000, signext = 0b011001, rol = 0b011010, ror = 0b011011, bswap = 0b011100, asr = 0b011101, lsl = 0b011110, lsr = 0b011111, setip = 0b100000, addip = 0b100001, intr = 0b100010, _, }; pub const Instruction = packed struct { condition: ExecutionCondition, input0: InputBehaviour, input1: InputBehaviour, modify_flags: bool, output: OutputBehaviour, command: Command, reserved: u1 = 0, pub fn format(instr: Instruction, comptime fmt: []const u8, options: std.fmt.FormatOptions, out: anytype) !void { _ = options; _ = fmt; try out.writeAll(switch (instr.condition) { .always => " ", .when_zero => "== 0", .not_zero => "!= 0", .greater_zero => " > 0", .less_than_zero => " < 0", .greater_or_equal_zero => ">= 0", .less_or_equal_zero => "<= 0", .overflow => "ovfl", }); try out.writeAll(" "); try out.writeAll(switch (instr.input0) { .zero => "zero", .immediate => "imm ", .peek => "peek", .pop => "pop ", }); try out.writeAll(" "); try out.writeAll(switch (instr.input1) { .zero => "zero", .immediate => "imm ", .peek => "peek", .pop => "pop ", }); try out.writeAll(" "); const tag = @tagName(instr.command); var tagstr = [_]u8{' '} ** 9; std.mem.copy(u8, &tagstr, tag); try out.writeAll(&tagstr); try out.writeAll(" "); try out.writeAll(switch (instr.output) { .discard => "discard", .push => "push ", }); try out.writeAll(" "); try out.writeAll(if (instr.modify_flags) "+ flags" else " "); } }; pub const FlagRegister = extern union { int: u16, bits: packed struct { zero: bool, negative: bool, carry: bool, carry_enabled: bool, interrupt0_enabled: bool, interrupt1_enabled: bool, interrupt2_enabled: bool, interrupt3_enabled: bool, reserved: u8 = 0, }, };
tools/common/spu-mk2.zig
const std = @import("std"); const xr = @import("openxr"); const c = @import("c.zig"); const Allocator = std.mem.Allocator; const BaseDispatch = struct { xrCreateInstance: xr.PfnCreateInstance, usingnamespace xr.BaseWrapper(@This()); }; const InstanceDispatch = struct { xrDestroyInstance: xr.PfnDestroyInstance, xrGetSystem: xr.PfnGetSystem, xrGetSystemProperties: xr.PfnGetSystemProperties, xrCreateSession: xr.PfnCreateSession, xrPollEvent: xr.PfnPollEvent, usingnamespace xr.InstanceWrapper(@This()); }; const SessionDispatch = struct { xrBeginSession: xr.PfnBeginSession, xrEndSession: xr.PfnEndSession, usingnamespace xr.SessionWrapper(@This()); }; fn getProcAddr(instance: xr.Instance, name: [*:0]const u8) !xr.PfnVoidFunction { var out: xr.PfnVoidFunction = undefined; const result = c.xrGetInstanceProcAddr(instance, name, &out); return switch (result) { .success => out, .error_handle_invalid => error.HandleInvalid, .error_instance_lost => error.InstanceLost, .error_runtime_failure => error.RuntimeFailure, .error_out_of_memory => error.OutOfMemory, .error_function_unsupported => error.FunctionUnsupported, .error_validation_failure => error.ValidationFailure, else => error.Unknown, }; } pub fn main() !void { var name: [128]u8 = undefined; std.mem.copy(u8, name[0..], "openxr-zig-test" ++ [_]u8{0}); const zero = [_:0]u8{0}; const xrb = try BaseDispatch.load(getProcAddr); const inst = try xrb.createInstance(.{ .create_flags = .{}, .application_info = .{ .application_name = name, .application_version = 0, .engine_name = name, .engine_version = 0, .api_version = xr.makeVersion(1, 0, 0), }, .enabled_api_layer_count = 0, .enabled_api_layer_names = @ptrCast([*]const [*:0]const u8, &zero), .enabled_extension_count = 0, .enabled_extension_names = @ptrCast([*]const [*:0]const u8, &zero), }); const xri = try InstanceDispatch.load(inst, getProcAddr); defer xri.destroyInstance(inst) catch unreachable; const system = try xri.getSystem(inst, .{ .form_factor = .head_mounted_display }); var system_properties = xr.SystemProperties.empty(); try xri.getSystemProperties(inst, system, &system_properties); std.debug.print( \\system {}: \\ vendor Id: {} \\ systemName: {} \\ gfx \\ max swapchain image resolution: {}x{} \\ max layer count: {} \\ tracking \\ orientation tracking: {} \\ positional tracking: {} , .{ system, system_properties.vendor_id, system_properties.system_name, system_properties.graphics_properties.max_swapchain_image_width, system_properties.graphics_properties.max_swapchain_image_height, system_properties.graphics_properties.max_layer_count, system_properties.tracking_properties.orientation_tracking, system_properties.tracking_properties.position_tracking, }); const session = try xri.createSession(inst, .{ .create_flags = .{}, .system_id = system, }); }
examples/test.zig
const std = @import("std"); const big = std.math.big; const heap = std.heap; const io = std.io; const mem = std.mem; usingnamespace @import("primitive_types.zig"); const bigint = @import("bigint.zig"); const PrimitiveReader = @import("primitive/reader.zig").PrimitiveReader; const RowData = @import("frame.zig").RowData; const ColumnData = @import("frame.zig").ColumnData; const GlobalTableSpec = @import("metadata.zig").GlobalTableSpec; const RowsMetadata = @import("metadata.zig").RowsMetadata; const ColumnSpec = @import("metadata.zig").ColumnSpec; const testing = @import("testing.zig"); pub const RawBytes = struct { data: []const u8, }; pub const Iterator = struct { const Self = @This(); metadata: RowsMetadata, rows: []const RowData, pos: usize, pub fn init(metadata: RowsMetadata, rows: []const RowData) Self { return Self{ .metadata = metadata, .rows = rows, .pos = 0, }; } pub const ScanOptions = struct { /// If this is provided, scan will populate some information about failures. /// This will provide more detail than an error can. diags: ?*Diagnostics = null, pub const Diagnostics = struct { /// If the struct type in which the CQL data should be scanned is incompatible incompatible_metadata: IncompatibleMetadata = IncompatibleMetadata{}, pub const IncompatibleMetadata = struct { /// The number of columns in the CQL result. metadata_columns: usize = 0, /// The number of fields in the struct to scan into. struct_fields: usize = 0, /// If there was an attempt to scan a CQL type into an incompatible native type, both type names /// will be provided here. incompatible_types: IncompatibleTypes = IncompatibleTypes{}, pub const IncompatibleTypes = struct { cql_type_name: ?[]const u8 = null, native_type_name: ?[]const u8 = null, }; }; }; }; const Diags = ScanOptions.Diagnostics; pub fn scan(self: *Self, allocator: *mem.Allocator, options: ScanOptions, args: anytype) !bool { var dummy_diags = Diags{}; var diags = options.diags orelse &dummy_diags; const child = switch (@typeInfo(@TypeOf(args))) { .Pointer => |info| info.child, else => @compileError("Expected a pointer to a tuple or struct, found " ++ @typeName(@TypeOf(args))), }; if (@typeInfo(child) != .Struct) { @compileError("Expected tuple or struct argument, found " ++ @typeName(child) ++ " of type " ++ @tagName(@typeInfo(child))); } if (self.pos >= self.rows.len) { return false; } if (self.metadata.column_specs.len != @typeInfo(child).Struct.fields.len) { diags.incompatible_metadata.metadata_columns = self.metadata.column_specs.len; diags.incompatible_metadata.struct_fields = @typeInfo(child).Struct.fields.len; return error.IncompatibleMetadata; } inline for (@typeInfo(child).Struct.fields) |struct_field, _i| { const i = @as(usize, _i); const column_spec = self.metadata.column_specs[i]; const column_data = self.rows[self.pos].slice[i]; @field(args, struct_field.name) = try self.readType(allocator, diags, column_spec, column_data.slice, struct_field.field_type); } self.pos += 1; return true; } fn readType(self: *Self, allocator: *mem.Allocator, diags: *Diags, column_spec: ColumnSpec, column_data: []const u8, comptime Type: type) !Type { const type_info = @typeInfo(Type); // TODO(vincent): if the struct is packed we could maybe read stuff directly // TODO(vincent): handle packed enum // TODO(vincent): handle union switch (type_info) { .Int => return try self.readInt(diags, column_spec, column_data, Type), .Float => return try self.readFloat(diags, column_spec, column_data, Type), .Pointer => |pointer| switch (pointer.size) { .One => { return try self.readType(allocator, diags, column_spec, column_data, @TypeOf(pointer.child)); }, .Slice => { return try self.readSlice(allocator, diags, column_spec, column_data, Type); }, else => @compileError("invalid pointer size " ++ @tagName(pointer.size)), }, .Struct => return try self.readStruct(allocator, diags, column_spec, column_data, Type), .Array => return try self.readArray(diags, column_spec, column_data, Type), else => @compileError("field type " ++ @typeName(Type) ++ " not handled yet"), } } fn readFloatFromSlice(comptime Type: type, slice: []const u8) Type { var r: Type = 0.0; // Compute the number of bytes needed for the float type we're trying to read. comptime const len = @divExact(@typeInfo(Type).Float.bits, 8); std.debug.assert(slice.len <= len); // See readIntFromSlice below for an explanation as to why we do this. var buf = [_]u8{0} ** len; const padding = len - slice.len; mem.copy(u8, buf[padding..buf.len], slice); var bytes = @ptrCast(*const [len]u8, &buf); return @ptrCast(*align(1) const Type, bytes).*; } fn readIntFromSlice(comptime Type: type, slice: []const u8) Type { var r: Type = 0; // Compute the number of bytes needed for the integer type we're trying to read. comptime const len = @divExact(@typeInfo(Type).Int.bits, 8); std.debug.assert(slice.len <= len); // This may be confusing. // // This function needs to be able to read a integers from // the slice even if the integer type has more bytes than the slice has. // // For example, if we read a tinyint from Cassandra which is a u8, // we need to be able to read that into a u16/u32/u64/u128. // // To do that we allocate a buffer of how many bytes the integer type has, // then we copy the slice data in it starting from the correct position. // // So for example if we have a u32 and we read a u16, we allocate a 4 byte buffer: // [0x00, 0x00, 0x00, 0x00] // Then to write at the correct position we compute the padding, in this case 2 bytes. // With that we write the data: // [0x00, 0x00, 0x21, 0x20] // Now the u32 will have to correct data. var buf = [_]u8{0} ** len; const padding = len - slice.len; mem.copy(u8, buf[padding..buf.len], slice); var bytes = @ptrCast(*const [len]u8, &buf); return mem.readIntBig(Type, bytes); } fn readInt(self: *Self, diags: *Diags, column_spec: ColumnSpec, column_data: []const u8, comptime Type: type) !Type { var r: Type = 0; const option = column_spec.option; switch (Type) { u8, i8 => { switch (option) { .Tinyint => return readIntFromSlice(Type, column_data), .Custom => { if (column_spec.custom_class_name) |class_name| { const new_option = getOptionIDFromCassandraClassName(class_name) catch |err| switch (err) {}; switch (new_option) { .Tinyint => { var new_column_spec = column_spec; new_column_spec.option = new_option; return self.readInt(diags, new_column_spec, column_data, Type); }, else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(new_option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } } else { return error.NoCQLCustomClassName; } }, else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } }, u16, i16 => { switch (option) { .Tinyint, .Smallint, => return readIntFromSlice(Type, column_data), else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } }, u32, i32 => { switch (option) { .Tinyint, .Smallint, .Int, .Date, => return readIntFromSlice(Type, column_data), else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } }, u64, i64, u128, i128 => { switch (option) { .Tinyint, .Smallint, .Int, .Bigint, .Counter, .Date, .Time, .Timestamp, => return readIntFromSlice(Type, column_data), else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } }, else => @compileError("int type " ++ @typeName(Type) ++ " is invalid"), } return r; } fn readFloat(self: *Self, diags: *Diags, column_spec: ColumnSpec, column_data: []const u8, comptime Type: type) !Type { var r: Type = 0.0; const option = column_spec.option; switch (Type) { f32 => { switch (option) { .Float => return readFloatFromSlice(f32, column_data), else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } }, f64 => { switch (option) { .Float => { const f_32 = readFloatFromSlice(f32, column_data); return @floatCast(Type, f_32); }, .Double => return readFloatFromSlice(f64, column_data), else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } }, f128 => { switch (option) { .Float => { const f_32 = readFloatFromSlice(f32, column_data); return @floatCast(Type, f_32); }, .Double => { const f_64 = readFloatFromSlice(f64, column_data); return @floatCast(Type, f_64); }, else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } }, else => @compileError("float type " ++ @typeName(Type) ++ " is invalid"), } return r; } fn readSlice(self: *Self, allocator: *mem.Allocator, diags: *Diags, column_spec: ColumnSpec, column_data: []const u8, comptime Type: type) !Type { const type_info = @typeInfo(Type); const ChildType = std.meta.Elem(Type); if (@typeInfo(ChildType) == .Array) { @compileError("cannot read a slice of arrays, use a slice instead as the element type"); } const id = column_spec.option; // Special case the u8 type because it's used for strings. // We can simply reuse the column data slice for this so make sure the // user uses a []const u8 in its struct. if (type_info.Pointer.is_const and ChildType == u8) { var slice: Type = undefined; switch (id) { .Blob, .UUID, .Timeuuid, .Ascii, .Varchar => { slice = column_data; }, else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(id); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } return slice; } switch (ChildType) { u8, i8, u16, i16, u32, i32, i64, u64 => { const NonConstType = @Type(std.builtin.TypeInfo{ .Pointer = .{ .size = .Slice, .is_const = false, .is_volatile = type_info.Pointer.is_volatile, .alignment = type_info.Pointer.alignment, .child = ChildType, .is_allowzero = type_info.Pointer.is_allowzero, .sentinel = type_info.Pointer.sentinel, }, }); var slice: NonConstType = undefined; switch (id) { .Set, .List => { if (column_spec.listset_element_type_option == null) { return error.InvalidColumnSpec; } const child_option = column_spec.listset_element_type_option.?; var child_column_spec = switch (child_option) { .Custom => ColumnSpec{ .custom_class_name = column_spec.custom_class_name.?, .option = child_option, }, else => ColumnSpec{ .option = child_option, }, }; var pr = PrimitiveReader.init(); pr.reset(column_data); const n = try pr.readInt(u32); slice = try allocator.alloc(ChildType, @as(usize, n)); errdefer allocator.free(slice); var i: usize = 0; while (i < n) : (i += 1) { const bytes = (try pr.readBytes(allocator)) orelse unreachable; defer allocator.free(bytes); slice[i] = try self.readType(allocator, diags, child_column_spec, bytes, ChildType); } }, else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(id); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } return slice; }, else => @compileError("type " ++ @typeName(Type) ++ " is invalid"), } } fn readStruct(self: *Self, allocator: *mem.Allocator, diags: *Diags, column_spec: ColumnSpec, column_data: []const u8, comptime Type: type) !Type { if (Type == big.int.Const) { var m = try bigint.fromBytes(allocator, column_data); return m.toConst(); } if (Type == RawBytes) { return RawBytes{ .data = column_data, }; } if (comptime std.meta.trait.hasFn("scan")(Type)) { var res: Type = undefined; try res.scan(allocator, column_spec, column_data); return res; } @compileError("type " ++ @typeName(Type) ++ " is invalid"); } fn readArray(self: *Self, diags: *Diags, column_spec: ColumnSpec, column_data: []const u8, comptime Type: type) !Type { const ChildType = std.meta.Elem(Type); var array: Type = undefined; const option = column_spec.option; // NOTE(vincent): Arrays are fixed size and the only thing we know has a fixed size with CQL is a UUID. // Maybe in the future we could allow more advanced stuff like reading blobs for arrays of packed struct/union/enum // Maybe we can also allow reading strings and adding zeroes to tne end ? switch (option) { .UUID, .Timeuuid => mem.copy(u8, &array, column_data[0..array.len]), else => { diags.incompatible_metadata.incompatible_types.cql_type_name = @tagName(option); diags.incompatible_metadata.incompatible_types.native_type_name = @typeName(Type); return error.IncompatibleMetadata; }, } return array; } fn getOptionIDFromCassandraClassName(name: []const u8) !OptionID { if (mem.eql(u8, "org.apache.cassandra.db.marshal.ByteType", name)) { return .Tinyint; } return .Custom; } }; fn columnSpec(id: OptionID) ColumnSpec { return ColumnSpec{ .keyspace = null, .table = null, .name = "name", .option = id, .listset_element_type_option = null, .map_key_type_option = null, .map_value_type_option = null, .custom_class_name = null, }; } fn testIteratorScan(allocator: *mem.Allocator, column_specs: []ColumnSpec, data: []const []const u8, diags: ?*Iterator.ScanOptions.Diagnostics, row: anytype) !void { const metadata = RowsMetadata{ .paging_state = null, .new_metadata_id = null, .global_table_spec = GlobalTableSpec{ .keyspace = "foobar", .table = "user", }, .columns_count = column_specs.len, .column_specs = column_specs, }; var column_data = std.ArrayList(ColumnData).init(allocator); for (data) |d| { _ = try column_data.append(ColumnData{ .slice = d }); } const row_data = &[_]RowData{ RowData{ .slice = column_data.toOwnedSlice() }, }; var iterator = Iterator.init(metadata, row_data); var options = Iterator.ScanOptions{ .diags = diags, }; testing.expect(try iterator.scan(allocator, options, row)); } test "iterator scan: incompatible metadata" { var arena = testing.arenaAllocator(); defer arena.deinit(); var diags = Iterator.ScanOptions.Diagnostics{}; { const Row = struct { u_8: u8, i_8: i8, }; var row: Row = undefined; const column_specs = &[_]ColumnSpec{columnSpec(.Tinyint)}; const test_data = &[_][]const u8{ "\x20", "\x20" }; var err = testIteratorScan(&arena.allocator, column_specs, test_data, &diags, &row); testing.expectError(error.IncompatibleMetadata, err); testing.expectEqual(@as(usize, 1), diags.incompatible_metadata.metadata_columns); testing.expectEqual(@as(usize, 2), diags.incompatible_metadata.struct_fields); } diags.incompatible_metadata.metadata_columns = 0; diags.incompatible_metadata.struct_fields = 0; { const Row = struct { b: u8, }; var row: Row = undefined; const column_specs = &[_]ColumnSpec{columnSpec(.Int)}; const test_data = &[_][]const u8{"\x01"}; var err = testIteratorScan(&arena.allocator, column_specs, test_data, &diags, &row); testing.expectError(error.IncompatibleMetadata, err); testing.expectEqual(@as(usize, 0), diags.incompatible_metadata.metadata_columns); testing.expectEqual(@as(usize, 0), diags.incompatible_metadata.struct_fields); testing.expectEqualStrings("Int", diags.incompatible_metadata.incompatible_types.cql_type_name.?); testing.expectEqualStrings("u8", diags.incompatible_metadata.incompatible_types.native_type_name.?); } } test "iterator scan: u8/i8" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { u_8: u8, i_8: i8, }; var row: Row = undefined; const column_specs = &[_]ColumnSpec{ columnSpec(.Tinyint), columnSpec(.Tinyint), }; const test_data = &[_][]const u8{ "\x20", "\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u8, 0x20), row.u_8); testing.expectEqual(@as(i8, 0x20), row.i_8); } test "iterator scan: u16/i16" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { u_16: u16, i_16: i16, }; var row: Row = undefined; { const column_specs = &[_]ColumnSpec{ columnSpec(.Tinyint), columnSpec(.Tinyint), }; const test_data = &[_][]const u8{ "\x20", "\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u16, 0x20), row.u_16); testing.expectEqual(@as(i16, 0x20), row.i_16); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Smallint), columnSpec(.Smallint), }; const test_data = &[_][]const u8{ "\x21\x20", "\x22\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u16, 0x2120), row.u_16); testing.expectEqual(@as(i16, 0x2220), row.i_16); } } test "iterator scan: u32/i32" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { u_32: u32, i_32: i32, }; var row: Row = undefined; { const column_specs = &[_]ColumnSpec{ columnSpec(.Tinyint), columnSpec(.Tinyint), }; const test_data = &[_][]const u8{ "\x20", "\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u32, 0x20), row.u_32); testing.expectEqual(@as(i32, 0x20), row.i_32); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Smallint), columnSpec(.Smallint), }; const test_data = &[_][]const u8{ "\x21\x20", "\x22\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u32, 0x2120), row.u_32); testing.expectEqual(@as(i32, 0x2220), row.i_32); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Int), columnSpec(.Int), }; const test_data = &[_][]const u8{ "\x21\x22\x23\x24", "\x25\x26\x27\x28" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u32, 0x21222324), row.u_32); testing.expectEqual(@as(i32, 0x25262728), row.i_32); } } test "iterator scan: u64/i64" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { u_64: u64, i_64: i64, }; var row: Row = undefined; { const column_specs = &[_]ColumnSpec{ columnSpec(.Tinyint), columnSpec(.Tinyint), }; const test_data = &[_][]const u8{ "\x20", "\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u64, 0x20), row.u_64); testing.expectEqual(@as(i64, 0x20), row.i_64); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Smallint), columnSpec(.Smallint), }; const test_data = &[_][]const u8{ "\x22\x20", "\x23\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u64, 0x2220), row.u_64); testing.expectEqual(@as(i64, 0x2320), row.i_64); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Int), columnSpec(.Int), }; const test_data = &[_][]const u8{ "\x24\x22\x28\x21", "\x22\x29\x23\x22" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u64, 0x24222821), row.u_64); testing.expectEqual(@as(i64, 0x22292322), row.i_64); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Bigint), columnSpec(.Bigint), }; const test_data = &[_][]const u8{ "\x21\x22\x23\x24\x25\x26\x27\x28", "\x31\x32\x33\x34\x35\x36\x37\x38" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u64, 0x2122232425262728), row.u_64); testing.expectEqual(@as(i64, 0x3132333435363738), row.i_64); } } test "iterator scan: u128/i128" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { u_128: u128, i_128: i128, }; var row: Row = undefined; { const column_specs = &[_]ColumnSpec{ columnSpec(.Tinyint), columnSpec(.Tinyint), }; const test_data = &[_][]const u8{ "\x20", "\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u128, 0x20), row.u_128); testing.expectEqual(@as(i128, 0x20), row.i_128); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Smallint), columnSpec(.Smallint), }; const test_data = &[_][]const u8{ "\x22\x20", "\x23\x20" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u128, 0x2220), row.u_128); testing.expectEqual(@as(i128, 0x2320), row.i_128); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Bigint), columnSpec(.Bigint), }; const test_data = &[_][]const u8{ "\x24\x22\x28\x21", "\x22\x29\x23\x22" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u128, 0x24222821), row.u_128); testing.expectEqual(@as(i128, 0x22292322), row.i_128); } { const column_specs = &[_]ColumnSpec{ columnSpec(.Bigint), columnSpec(.Bigint), }; const test_data = &[_][]const u8{ "\x21\x22\x23\x24\x25\x26\x27\x28", "\x31\x32\x33\x34\x35\x36\x37\x38" }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u128, 0x2122232425262728), row.u_128); testing.expectEqual(@as(i128, 0x3132333435363738), row.i_128); } } test "iterator scan: f32" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { f_32: f32, }; var row: Row = undefined; const column_specs = &[_]ColumnSpec{columnSpec(.Float)}; const test_data = &[_][]const u8{"\x85\xeb\x01\x40"}; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(f32, 2.03), row.f_32); } test "iterator scan: f64" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { f_64: f64, }; var row: Row = undefined; { const column_specs = &[_]ColumnSpec{columnSpec(.Float)}; const test_data = &[_][]const u8{"\x85\xeb\x01\x40"}; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectInDelta(@as(f64, 2.03), row.f_64, 0.000001); } { const column_specs = &[_]ColumnSpec{columnSpec(.Double)}; const test_data = &[_][]const u8{"\x05\x51\xf7\x01\x40\x12\xe6\x40"}; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectInDelta(@as(f64, 45202.00024), row.f_64, 0.000001); } } test "iterator scan: f128" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { f_128: f128, }; var row: Row = undefined; { const column_specs = &[_]ColumnSpec{columnSpec(.Float)}; const test_data = &[_][]const u8{"\x85\xeb\x01\x40"}; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectInDelta(@as(f128, 2.03), row.f_128, 0.000001); } { const column_specs = &[_]ColumnSpec{columnSpec(.Double)}; const test_data = &[_][]const u8{"\x05\x51\xf7\x01\x40\x12\xe6\x40"}; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectInDelta(@as(f128, 45202.00024), row.f_128, 0.000001); } } test "iterator scan: blobs, uuids, timeuuids" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { blob: []const u8, uuid: [16]u8, tuuid: [16]u8, }; var row: Row = undefined; const column_specs = &[_]ColumnSpec{ columnSpec(.Blob), columnSpec(.UUID), columnSpec(.Timeuuid), }; const test_data = &[_][]const u8{ "Vincent", "\x02\x9a\x93\xa9\xc3\x27\x4c\x79\xbe\x32\x71\x8e\x22\xb5\x02\x4c", "\xe9\x13\x93\x2e\x7a\xb7\x11\xea\xbf\x1b\x10\xc3\x7b\x6e\x96\xcc", }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqualStrings("Vincent", row.blob); testing.expectEqualSlices(u8, "\x02\x9a\x93\xa9\xc3\x27\x4c\x79\xbe\x32\x71\x8e\x22\xb5\x02\x4c", &row.uuid); testing.expectEqualSlices(u8, "\xe9\x13\x93\x2e\x7a\xb7\x11\xea\xbf\x1b\x10\xc3\x7b\x6e\x96\xcc", &row.tuuid); } test "iterator scan: ascii/varchar" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { ascii: []const u8, varchar: []const u8, }; var row: Row = undefined; const column_specs = &[_]ColumnSpec{ columnSpec(.Ascii), columnSpec(.Varchar), }; const test_data = &[_][]const u8{ "Ascii vincent", "Varchar vincent", }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqualStrings("Ascii vincent", row.ascii); testing.expectEqualStrings("Varchar vincent", row.varchar); } test "iterator scan: set/list" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { set: []const u32, list: []const u32, // set_of_uuid: []const []const u8, // list_of_uuid: []const []const u8, }; var row: Row = undefined; var spec1 = columnSpec(.Set); spec1.listset_element_type_option = .Int; var spec2 = columnSpec(.List); spec2.listset_element_type_option = .Int; // var spec3 = columnSpec(.Set); // spec3.listset_element_type_option = .UUID; // var spec4 = columnSpec(.List); // spec4.listset_element_type_option = .UUID; const column_specs = &[_]ColumnSpec{ spec1, spec2 }; const test_data = &[_][]const u8{ "\x00\x00\x00\x02\x00\x00\x00\x04\x21\x22\x23\x24\x00\x00\x00\x04\x31\x32\x33\x34", "\x00\x00\x00\x02\x00\x00\x00\x04\x41\x42\x43\x44\x00\x00\x00\x04\x51\x52\x53\x54", // "\x00\x00\x00\x02\x00\x00\x00\x10\x14\x2d\x6b\x2d\x2c\xe6\x45\x80\x95\x53\x15\x87\xa9\x6d\xec\x94\x00\x00\x00\x10\x8a\xa8\xc1\x37\xd0\x53\x41\x12\xbf\xee\x5f\x96\x28\x7e\xe5\x1a", // "\x00\x00\x00\x02\x00\x00\x00\x10\x14\x2d\x6b\x2d\x2c\xe6\x45\x80\x95\x53\x15\x87\xa9\x6d\xec\x94\x00\x00\x00\x10\x8a\xa8\xc1\x37\xd0\x53\x41\x12\xbf\xee\x5f\x96\x28\x7e\xe5\x1a", }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(usize, 2), row.set.len); testing.expectEqual(@as(u32, 0x21222324), row.set[0]); testing.expectEqual(@as(u32, 0x31323334), row.set[1]); testing.expectEqual(@as(usize, 2), row.list.len); testing.expectEqual(@as(u32, 0x41424344), row.list[0]); testing.expectEqual(@as(u32, 0x51525354), row.list[1]); // testing.expectEqual(@as(usize, 2), row.set_of_uuid.len); // testing.expectEqualSlices(u8, "\x14\x2d\x6b\x2d\x2c\xe6\x45\x80\x95\x53\x15\x87\xa9\x6d\xec\x94", row.set_of_uuid[0]); // testing.expectEqualSlices(u8, "\x8a\xa8\xc1\x37\xd0\x53\x41\x12\xbf\xee\x5f\x96\x28\x7e\xe5\x1a", row.set_of_uuid[1]); // testing.expectEqual(@as(usize, 2), row.list_of_uuid.len); // testing.expectEqualSlices(u8, "\x14\x2d\x6b\x2d\x2c\xe6\x45\x80\x95\x53\x15\x87\xa9\x6d\xec\x94", row.list_of_uuid[0]); // testing.expectEqualSlices(u8, "\x8a\xa8\xc1\x37\xd0\x53\x41\x12\xbf\xee\x5f\x96\x28\x7e\xe5\x1a", row.list_of_uuid[1]); } test "iterator scan: set of tinyint" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { set: []u8, }; var row: Row = undefined; var spec1 = columnSpec(.Set); spec1.listset_element_type_option = .Tinyint; const column_specs = &[_]ColumnSpec{spec1}; const test_data = &[_][]const u8{ "\x00\x00\x00\x02\x00\x00\x00\x01\x20\x00\x00\x00\x01\x21", }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(usize, 2), row.set.len); testing.expectEqual(@as(u8, 0x20), row.set[0]); testing.expectEqual(@as(u8, 0x21), row.set[1]); } test "iterator scan: set of tinyint into RawBytes" { var arena = testing.arenaAllocator(); defer arena.deinit(); const Row = struct { list_timestamp: []u64, age: u32, set: RawBytes, name: []const u8, }; var row: Row = undefined; var spec1 = columnSpec(.List); spec1.listset_element_type_option = .Timestamp; var spec2 = columnSpec(.Int); var spec3 = columnSpec(.Set); spec3.listset_element_type_option = .Tinyint; var spec4 = columnSpec(.Varchar); const column_specs = &[_]ColumnSpec{ spec1, spec2, spec3, spec4 }; const test_data = &[_][]const u8{ "\x00\x00\x00\x02\x00\x00\x00\x08\xbc\xbc\xbc\xbc\xbc\xbc\xbc\xbc\x00\x00\x00\x08\xbe\xbe\xbe\xbe\xbe\xbe\xbe\xbe", "\x10\x11\x12\x13", "\x00\x00\x00\x02\x00\x00\x00\x01\x20\x00\x00\x00\x01\x21", "foobar", }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(u32, 0x10111213), row.age); testing.expectEqualSlices(u8, test_data[2], row.set.data); testing.expectEqualStrings("foobar", row.name); testing.expectEqual(@as(usize, 2), row.list_timestamp.len); testing.expectEqual(@as(u64, 0xbcbcbcbcbcbcbcbc), row.list_timestamp[0]); testing.expectEqual(@as(u64, 0xbebebebebebebebe), row.list_timestamp[1]); } test "iterator scan: into user provided scanner" { var arena = testing.arenaAllocator(); defer arena.deinit(); const MyTimestampList = struct { data: []u64, pub fn scan(self: *@This(), allocator: *mem.Allocator, column_spec: ColumnSpec, data: []const u8) !void { var fbs = io.fixedBufferStream(data); var in = fbs.reader(); const n = @as(usize, try in.readIntBig(u32)); self.data = try allocator.alloc(u64, n); var i: usize = 0; while (i < n) : (i += 1) { _ = try in.readIntBig(u32); // void the bytes length self.data[i] = try in.readIntBig(u64); } } }; const Row = struct { list_timestamp: MyTimestampList, age: u32, }; var row: Row = undefined; var spec1 = columnSpec(.List); spec1.listset_element_type_option = .Timestamp; var spec2 = columnSpec(.Int); const column_specs = &[_]ColumnSpec{ spec1, spec2 }; const test_data = &[_][]const u8{ "\x00\x00\x00\x02\x00\x00\x00\x08\xbc\xbc\xbc\xbc\xbc\xbc\xbc\xbc\x00\x00\x00\x08\xbe\xbe\xbe\xbe\xbe\xbe\xbe\xbe", "\x10\x11\x12\x13", }; try testIteratorScan(&arena.allocator, column_specs, test_data, null, &row); testing.expectEqual(@as(usize, 2), row.list_timestamp.data.len); testing.expectEqual(@as(u64, 0xbcbcbcbcbcbcbcbc), row.list_timestamp.data[0]); testing.expectEqual(@as(u64, 0xbebebebebebebebe), row.list_timestamp.data[1]); testing.expectEqual(@as(u32, 0x10111213), row.age); }
src/iterator.zig
const std = @import("std"); const object = @import("object.zig"); const Value = object.Value; const Allocator = std.mem.Allocator; const assert = std.debug.assert; // Notes: // // Lua tables are a combination of an array and a hash table // where contiguous integer keys from 1..n are stored in an array // while any other keys are put into the hash table // // Lua's table implementation uses a lua_State but as far as // I can tell it is only ever used to allocate memory, so // we can omit that dependency here and just pass an allocator // around instead // // TODO: Some functions (like luaH_next) push things onto the Lua stack. // This could potentially be dealt with through an intermediate function // to keep Table ignorant of the stack/lua_State. // // TODO: There seem to be quite a few quirks specific to the particular implementation // of the hybrid array/hashmap data structure that Lua uses for its tables. // Using Zig's std lib might prove to be too different, and a port of the // Lua implementation might end up being necessary to keep compatibility. pub const Table = struct { array: ArrayPortion, map: MapPortion.HashMap, allocator: *Allocator, const ArrayPortion = std.ArrayList(Value); const MapPortion = struct { pub const HashMap: type = std.ArrayHashMap(Value, Value, KeyContext, false); pub const KeyContext = struct { // TODO: This is woefully underimplemented pub fn hash(self: @This(), key: Value) u32 { _ = self; // TODO: is there a better way to avoid unused param error? switch (key) { .boolean => |val| { const autoHashFn = std.array_hash_map.getAutoHashFn(@TypeOf(val), void); return autoHashFn({}, val); }, .number => |val| { const floatBits = @typeInfo(@TypeOf(val)).Float.bits; const hashType = std.meta.Int(.unsigned, floatBits); const autoHashFn = std.array_hash_map.getAutoHashFn(hashType, void); return autoHashFn({}, @bitCast(hashType, val)); }, .string, .table, .function, .userdata, .thread => { // TODO //const ptrHashFn = std.hash_map.getHashPtrAddrFn(*object.GCObject); //return ptrHashFn(val); return 0; }, .light_userdata => |val| { const ptrHashFn = std.array_hash_map.getHashPtrAddrFn(@TypeOf(val), void); return ptrHashFn({}, val); }, .nil => { // TODO: nil key will lead to a 'table index is nil' error // so might be able to short-circuit here instead return 0; }, .none => unreachable, } } pub fn eql(self: @This(), a: Value, b: Value) bool { _ = self; // TODO: is there a better way to avoid unused param error? if (a.getType() != b.getType()) { return false; } // TODO: type-specific eql const autoEqlFn = std.array_hash_map.getAutoEqlFn(Value, void); return autoEqlFn({}, a, b); } }; }; pub fn init(allocator: *Allocator) Table { // no initial capacity removes the chance of failure return initCapacity(allocator, 0, 0) catch unreachable; } pub fn initCapacity(allocator: *Allocator, narray: usize, nhash: usize) !Table { var self = Table{ .array = ArrayPortion.init(allocator), .map = MapPortion.HashMap.init(allocator), .allocator = allocator, }; errdefer self.deinit(); if (narray > 0) { // this is kinda weird, but it more closely matches how Lua expects things // to work try self.array.appendNTimes(Value.nil, narray); } if (nhash > 0) { try self.map.ensureCapacity(nhash); } return self; } pub fn deinit(self: *Table) void { self.array.deinit(); self.map.deinit(); } /// returns the index for `key' if `key' is an appropriate key to live in /// the array part of the table, error.InvalidType otherwise. pub fn arrayIndex(key: Value) !usize { if (key != .number) { return error.InvalidArrayKey; } const float_val = key.number; // TODO: better handling of float vals that can't be converted to usize (out of range, negative, etc) const int_val = @floatToInt(usize, float_val); // must be positive and the float and int version of the key must be the same if (int_val < 0 or @intToFloat(f64, int_val) != float_val) { return error.InvalidArrayKey; } return int_val; } pub fn toLuaIndex(index: usize) usize { return index + 1; } pub fn fromLuaIndex(index: usize) usize { assert(index > 0); return index - 1; } pub fn isLuaIndexInArrayBounds(self: *Table, lua_index: usize) bool { return lua_index > 0 and lua_index <= self.array.items.len; } pub fn arrayGet(self: *Table, lua_index: usize) ?*Value { if (isLuaIndexInArrayBounds(self, lua_index)) { return &(self.array.items[fromLuaIndex(lua_index)]); } return null; } pub fn get(self: *Table, key: Value) ?*Value { switch (key) { .nil => return null, .none => unreachable, .number => { // try the array portion if (arrayIndex(key)) |lua_i| { if (self.arrayGet(lua_i)) |val| { return val; } } else |err| switch (err) { error.InvalidArrayKey => {}, } // fall back to the map portion }, else => {}, } const entry = self.map.getEntry(key); return if (entry != null) entry.?.value_ptr else null; } // Some notes: // - In Lua this is luaH_set, luaH_setnum, luaH_setstr // - Lua basically sticks everything in the hash map part of the // table and then 'rehashes' once the hash map needs to resize // and only then fills up the array portion with contiguous // non-nil indexes // - The Lua version of this function doesn't accept a value // to initialize the newly added key with, it returns a pointer // for the caller to initialize. This functionality is kept here // (TODO: for now?) pub fn getOrCreate(self: *Table, key: Value) !*Value { // note: this will handle 'adding' things to keys with nil values if (self.get(key)) |val| { return val; } if (key == .nil) { return error.TableIndexIsNil; } if (key == .number and std.math.isNan(key.number)) { return error.TableIndexIsNan; } //if (arrayIndex(key)) |lua_i| { // if (self.arrayGet(lua_i)) |val| { // return val; // } //} else |err| switch (err) { // error.InvalidArrayKey => {}, //} // TODO: handle growing/shrinking the array portion const result = try self.map.getOrPutValue(key, Value.nil); return result.value_ptr; } /// luaH_getn equivalent pub fn getn(self: *Table) usize { // There is a quirk in the Lua implementation of this which means that // the table's length is equal to the allocated size of the array if // the map part is empty and the last value of the array part is non-nil // (even if there are nil values somewhere before the last value) // // Example: // tbl = {1,2,3,4,5,6} // assert(#tbl == 6) // tbl[3] = nil // assert(#tbl == 6) // tbl[6] = nil // assert(#tbl == 2) // // This is a direct port of the Lua implementation to maintain // that quirk var j: usize = self.array.items.len; if (j > 0 and self.array.items[fromLuaIndex(j)] == .nil) { var i: usize = 0; while (j - i > 1) { var m: usize = (i + j) / 2; if (self.array.items[fromLuaIndex(m)] == .nil) { j = m; } else { i = m; } } return i; } // if the map portion is empty and the array portion is contiguous, // then just return the array portion length if (self.map.count() == 0) { return j; } // need to check the map portion for any remaining contiguous keys now var last_contiguous_i: usize = j; j += 1; while (self.map.get(Value{ .number = @intToFloat(f64, j) })) |value| { if (value == .nil) { break; } last_contiguous_i = j; j *= 2; // There's another quirk here where a maliciously constructed table // can take advantage of the binary search algorithm here to // erroneously inflate the calculated length of contiguous non-nil // indexes, but Lua will only backtrack and do a linear search if the // size gets out of control // // Example: // // tbl = {1,2,nil,4,5} // assert(#tbl == 5) // tbl[10] = 10 // assert(#tbl == 10) // tbl[20] = 20 // assert(#tbl == 20) // // i = 40 // while i<2147483647 do // tbl[i] = i // i = i*2 // end // assert(#tbl == 2) if (j > std.math.maxInt(i32)) { var i: usize = 1; linear_search: while (self.get(Value{ .number = @intToFloat(f64, i) })) |linear_val| { if (linear_val.* == Value.nil) { break :linear_search; } i += 1; } return i - 1; } } while (j - last_contiguous_i > 1) { var m: usize = (last_contiguous_i + j) / 2; if (self.map.get(Value{ .number = @intToFloat(f64, m) })) |value| { if (value != .nil) { // if value is non-nil, then search values above last_contiguous_i = m; continue; } } // if value is nil, then search values below j = m; } return last_contiguous_i; } pub const KV = struct { key: Value, value: Value, }; /// extremely loose luaH_next equivalent, minus the stack /// interaction pub fn next(self: *Table, key: Value) ?Table.KV { var next_i: usize = 1; if (arrayIndex(key)) |cur_i| { next_i = cur_i + 1; } else |err| switch (err) { error.InvalidArrayKey => {}, } while (self.isLuaIndexInArrayBounds(next_i)) : (next_i += 1) { const val = self.array.items[fromLuaIndex(next_i)]; if (val != .nil) { return Table.KV{ .key = Value{ .number = @intToFloat(f64, next_i) }, .value = val, }; } } if (self.map.getIndex(key)) |cur_map_i| { next_i = cur_map_i + 1; var items = self.map.unmanaged.entries; if (items.len > next_i) { const next_kv = items.get(next_i); return Table.KV{ .key = next_kv.key, .value = next_kv.value, }; } } else { const first_kv = self.map.iterator().next(); if (first_kv != null) { return Table.KV{ .key = first_kv.?.key_ptr.*, .value = first_kv.?.value_ptr.*, }; } } return null; } }; test "arrayIndex" { const nil = Value.nil; var dummyObj = object.GCObject{}; const str = Value{ .string = &dummyObj }; const valid_num = Value{ .number = 10 }; const invalid_num = Value{ .number = 5.5 }; try std.testing.expectError(error.InvalidArrayKey, Table.arrayIndex(nil)); try std.testing.expectError(error.InvalidArrayKey, Table.arrayIndex(str)); try std.testing.expectError(error.InvalidArrayKey, Table.arrayIndex(invalid_num)); try std.testing.expectEqual(@as(usize, 10), try Table.arrayIndex(valid_num)); } test "init and initCapacity" { var tbl = Table.init(std.testing.allocator); defer tbl.deinit(); var tblCapacity = try Table.initCapacity(std.testing.allocator, 5, 5); defer tblCapacity.deinit(); } test "get" { var tbl = try Table.initCapacity(std.testing.allocator, 5, 5); defer tbl.deinit(); // TODO: This is basically just a test of how its currently implemented, not // necessarily how it *should* work. // because we pre-allocated the array portion, this will give us nil // instead of null try std.testing.expectEqual(Value.nil, tbl.get(Value{ .number = 1 }).?.*); // hash map preallocation will still give us null though var dummyObj = object.GCObject{}; try std.testing.expect(null == tbl.get(Value{ .string = &dummyObj })); } test "getn" { var tbl = try Table.initCapacity(std.testing.allocator, 5, 5); defer tbl.deinit(); try std.testing.expectEqual(@as(usize, 0), tbl.getn()); const key = Value{ .number = 1 }; const val = try tbl.getOrCreate(key); try std.testing.expectEqual(@as(usize, 0), tbl.getn()); val.* = Value{ .number = 1 }; try std.testing.expectEqual(@as(usize, 1), tbl.getn()); val.* = Value.nil; try std.testing.expectEqual(@as(usize, 0), tbl.getn()); } test "getn quirk 1" { // tbl = {1,2,3,4,5,6} var tbl = try Table.initCapacity(std.testing.allocator, 6, 0); defer tbl.deinit(); var i: usize = 1; while (i <= 6) : (i += 1) { const key = Value{ .number = @intToFloat(f64, i) }; const val = tbl.get(key).?; val.* = key; } // assert(#tbl == 6) try std.testing.expectEqual(@as(usize, 6), tbl.getn()); // tbl[3] = nil const val3 = tbl.get(Value{ .number = 3 }).?; val3.* = Value.nil; // assert(#tbl == 6) try std.testing.expectEqual(@as(usize, 6), tbl.getn()); // tbl[6] = nil const val6 = tbl.get(Value{ .number = 6 }).?; val6.* = Value.nil; // assert(#tbl == 2) try std.testing.expectEqual(@as(usize, 2), tbl.getn()); } test "getn quirk 2" { // For some reason, {1,2,nil,4,5} seems to put the first 4 elements in // the array, and the '5' in the hash map. // TODO: Why does this work this way in Lua? // tbl = {1,2,nil,4,5} var tbl = try Table.initCapacity(std.testing.allocator, 4, 0); defer tbl.deinit(); var i: usize = 1; while (i <= 5) : (i += 1) { const key = Value{ .number = @intToFloat(f64, i) }; const val = try tbl.getOrCreate(key); val.* = if (i != 3) key else Value.nil; } // assert(#tbl == 5) try std.testing.expectEqual(@as(usize, 5), tbl.getn()); // tbl[10] = 10 const val10 = try tbl.getOrCreate(Value{ .number = 10 }); val10.* = Value{ .number = 10 }; // assert(#tbl == 10) try std.testing.expectEqual(@as(usize, 10), tbl.getn()); // tbl[20] = 20 const val20 = try tbl.getOrCreate(Value{ .number = 20 }); val20.* = Value{ .number = 20 }; // assert(#tbl == 20) try std.testing.expectEqual(@as(usize, 20), tbl.getn()); // i = 40 // while i<2147483647 do // tbl[i] = i // i = i*2 // end i = 40; while (i < std.math.maxInt(i32)) : (i *= 2) { const val = try tbl.getOrCreate(Value{ .number = @intToFloat(f64, i) }); val.* = Value{ .number = @intToFloat(f64, i) }; } // assert(#tbl == 2) try std.testing.expectEqual(@as(usize, 2), tbl.getn()); } test "getn quirk 2, next iterator" { var tbl = try Table.initCapacity(std.testing.allocator, 4, 0); defer tbl.deinit(); var i: usize = 1; while (i <= 5) : (i += 1) { const key = Value{ .number = @intToFloat(f64, i) }; const val = try tbl.getOrCreate(key); val.* = if (i != 3) key else Value.nil; } // 1-5 except 3 var expected_iterations: usize = 4; i = 10; while (i < std.math.maxInt(i32)) : (i *= 2) { const val = try tbl.getOrCreate(Value{ .number = @intToFloat(f64, i) }); val.* = Value{ .number = @intToFloat(f64, i) }; expected_iterations += 1; } var iterations: usize = 0; var kv = Table.KV{ .key = Value.nil, .value = Value.nil }; while (tbl.next(kv.key)) |next_kv| { iterations += 1; kv = next_kv; } try std.testing.expectEqual(expected_iterations, iterations); }
src/table.zig
const __fixdfsi = @import("fixdfsi.zig").__fixdfsi; const std = @import("std"); const math = std.math; const testing = std.testing; const warn = std.debug.warn; fn test__fixdfsi(a: f64, expected: i32) !void { const x = __fixdfsi(a); //warn("a={}:{x} x={}:{x} expected={}:{x}:@as(u64, {x})\n", .{a, @bitCast(u64, a), x, x, expected, expected, @bitCast(u32, expected)}); try testing.expect(x == expected); } test "fixdfsi" { //warn("\n", .{}); try test__fixdfsi(-math.f64_max, math.minInt(i32)); try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000); try test__fixdfsi(-0x1.0000000000000p+127, -0x80000000); try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000); try test__fixdfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000); try test__fixdfsi(-0x1.0000000000001p+63, -0x80000000); try test__fixdfsi(-0x1.0000000000000p+63, -0x80000000); try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000); try test__fixdfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000); try test__fixdfsi(-0x1.FFFFFEp+62, -0x80000000); try test__fixdfsi(-0x1.FFFFFCp+62, -0x80000000); try test__fixdfsi(-0x1.000000p+31, -0x80000000); try test__fixdfsi(-0x1.FFFFFFp+30, -0x7FFFFFC0); try test__fixdfsi(-0x1.FFFFFEp+30, -0x7FFFFF80); try test__fixdfsi(-2.01, -2); try test__fixdfsi(-2.0, -2); try test__fixdfsi(-1.99, -1); try test__fixdfsi(-1.0, -1); try test__fixdfsi(-0.99, 0); try test__fixdfsi(-0.5, 0); try test__fixdfsi(-math.f64_min, 0); try test__fixdfsi(0.0, 0); try test__fixdfsi(math.f64_min, 0); try test__fixdfsi(0.5, 0); try test__fixdfsi(0.99, 0); try test__fixdfsi(1.0, 1); try test__fixdfsi(1.5, 1); try test__fixdfsi(1.99, 1); try test__fixdfsi(2.0, 2); try test__fixdfsi(2.01, 2); try test__fixdfsi(0x1.FFFFFEp+30, 0x7FFFFF80); try test__fixdfsi(0x1.FFFFFFp+30, 0x7FFFFFC0); try test__fixdfsi(0x1.000000p+31, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFCp+62, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFEp+62, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF); try test__fixdfsi(0x1.0000000000000p+63, 0x7FFFFFFF); try test__fixdfsi(0x1.0000000000001p+63, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF); try test__fixdfsi(0x1.0000000000000p+127, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF); try test__fixdfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32)); try test__fixdfsi(math.f64_max, math.maxInt(i32)); }
lib/std/special/compiler_rt/fixdfsi_test.zig
const std = @import("std"); pub const MethodType = enum { Connect, Custom, Delete, Get, Head, Options, Patch, Post, Put, Trace, }; pub const Method = union(MethodType) { Connect: void, Custom: []const u8, Delete: void, Get: void, Head: void, Options: void, Patch: void, Post: void, Put: void, Trace: void, const Error = error{ Invalid, }; pub fn to_bytes(self: Method) []const u8 { return switch (self) { .Connect => "CONNECT", .Custom => |name| name, .Delete => "DELETE", .Get => "GET", .Head => "HEAD", .Options => "OPTIONS", .Patch => "PATCH", .Post => "POST", .Put => "PUT", .Trace => "TRACE", }; } pub fn custom(value: []const u8) Error!Method { for (value) |char| { if (!is_token(char)) { return error.Invalid; } } return Method{ .Custom = value }; } pub fn from_bytes(value: []const u8) Error!Method { switch (value.len) { 3 => { if (std.mem.eql(u8, value, "GET")) { return .Get; } else if (std.mem.eql(u8, value, "PUT")) { return .Put; } else { return try Method.custom(value); } }, 4 => { if (std.mem.eql(u8, value, "HEAD")) { return .Head; } else if (std.mem.eql(u8, value, "POST")) { return .Post; } else { return try Method.custom(value); } }, 5 => { if (std.mem.eql(u8, value, "PATCH")) { return .Patch; } else if (std.mem.eql(u8, value, "TRACE")) { return .Trace; } else { return try Method.custom(value); } }, 6 => { if (std.mem.eql(u8, value, "DELETE")) { return .Delete; } else { return try Method.custom(value); } }, 7 => { if (std.mem.eql(u8, value, "CONNECT")) { return .Connect; } else if (std.mem.eql(u8, value, "OPTIONS")) { return .Options; } else { return try Method.custom(value); } }, else => { return try Method.custom(value); }, } } // Determines if a character is a token character. // // Cf: https://tools.ietf.org/html/rfc7230#section-3.2.6 // > token = 1*tchar // > // > tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" // > / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" // > / DIGIT / ALPHA // > ; any VCHAR, except delimiters inline fn is_token(char: u8) bool { return char > 0x1f and char < 0x7f; } }; const expect = std.testing.expect; const expectEqualStrings = std.testing.expectEqualStrings; const expectError = std.testing.expectError; test "Convert to bytes" { var connect = Method{ .Connect = undefined }; try expectEqualStrings(connect.to_bytes(), "CONNECT"); var lauch_missile = Method{ .Custom = "LAUNCH-MISSILE" }; try expectEqualStrings(lauch_missile.to_bytes(), "LAUNCH-MISSILE"); var delete = Method{ .Delete = undefined }; try expectEqualStrings(delete.to_bytes(), "DELETE"); var get = Method{ .Get = undefined }; try expectEqualStrings(get.to_bytes(), "GET"); var head = Method{ .Head = undefined }; try expectEqualStrings(head.to_bytes(), "HEAD"); var options = Method{ .Options = undefined }; try expectEqualStrings(options.to_bytes(), "OPTIONS"); var patch = Method{ .Patch = undefined }; try expectEqualStrings(patch.to_bytes(), "PATCH"); var post = Method{ .Post = undefined }; try expectEqualStrings(post.to_bytes(), "POST"); var put = Method{ .Put = undefined }; try expectEqualStrings(put.to_bytes(), "PUT"); var trace = Method{ .Trace = undefined }; try expectEqualStrings(trace.to_bytes(), "TRACE"); } test "FromBytes - Success" { var method = try Method.from_bytes("CONNECT"); try expect(method == .Connect); method = try Method.from_bytes("DELETE"); try expect(method == .Delete); method = try Method.from_bytes("GET"); try expect(method == .Get); method = try Method.from_bytes("HEAD"); try expect(method == .Head); method = try Method.from_bytes("OPTIONS"); try expect(method == .Options); method = try Method.from_bytes("PATCH"); try expect(method == .Patch); method = try Method.from_bytes("POST"); try expect(method == .Post); method = try Method.from_bytes("PUT"); try expect(method == .Put); method = try Method.from_bytes("TRACE"); try expect(method == .Trace); method = try Method.from_bytes("LAUNCH-MISSILE"); try expectEqualStrings(method.Custom, "LAUNCH-MISSILE"); } test "FromBytes - Invalid character" { const failure = Method.from_bytes("LAUNCH\r\nMISSILE"); try expectError(error.Invalid, failure); }
src/methods.zig
usingnamespace @import("../engine/engine.zig"); const Literal = @import("../parser/literal.zig").Literal; const LiteralValue = @import("../parser/literal.zig").LiteralValue; const MapTo = @import("mapto.zig").MapTo; const MapToValue = @import("mapto.zig").MapToValue; const std = @import("std"); const testing = std.testing; const mem = std.mem; pub fn SequenceContext(comptime Payload: type, comptime Value: type) type { return []const *Parser(Payload, Value); } /// Represents a sequence of parsed values. /// /// In the case of a non-ambiguous grammar, a `Sequence` combinator will yield: /// /// ``` /// stream(value1, value2) /// ``` /// /// In the case of an ambiguous grammar, it would yield a stream with only the first parse path. /// Use SequenceAmbiguous if ambiguou parse paths are desirable. pub fn SequenceValue(comptime Value: type) type { return struct { results: *ResultStream(Result(Value)), pub fn deinit(self: *const @This(), allocator: *mem.Allocator) void { self.results.deinit(); allocator.destroy(self.results); } }; } /// Matches the `input` parsers sequentially. The parsers must produce the same data type (use /// MapTo, if needed.) If ambiguous parse paths are desirable, use SequenceAmbiguous. /// /// The `input` parsers must remain alive for as long as the `Sequence` parser will be used. pub fn Sequence(comptime Payload: type, comptime Value: type) type { return struct { parser: Parser(Payload, SequenceValue(Value)) = Parser(Payload, SequenceValue(Value)).init(parse, nodeName, deinit), input: SequenceContext(Payload, Value), const Self = @This(); pub fn init(input: SequenceContext(Payload, Value)) Self { return Self{ .input = input }; } pub fn deinit(parser: *Parser(Payload, SequenceValue(Value)), allocator: *mem.Allocator) void { const self = @fieldParentPtr(Self, "parser", parser); for (self.input) |child_parser| { child_parser.deinit(allocator); } } pub fn nodeName(parser: *const Parser(Payload, SequenceValue(Value)), node_name_cache: *std.AutoHashMap(usize, ParserNodeName)) Error!u64 { const self = @fieldParentPtr(Self, "parser", parser); var v = std.hash_map.hashString("Sequence"); for (self.input) |in_parser| { v +%= try in_parser.nodeName(node_name_cache); } return v; } pub fn parse(parser: *const Parser(Payload, SequenceValue(Value)), in_ctx: *const Context(Payload, SequenceValue(Value))) callconv(.Async) Error!void { const self = @fieldParentPtr(Self, "parser", parser); var ctx = in_ctx.with(self.input); defer ctx.results.close(); // Invoke each child parser to produce each of our results. Each time we ask a child // parser to parse, it can produce a set of results (its result stream) which are // varying parse paths / interpretations, we take the first successful one. // Return early if we're not trying to parse anything (stream close signals to the // consumer there were no matches). if (self.input.len == 0) { return; } var buffer = try ctx.allocator.create(ResultStream(Result(Value))); errdefer ctx.allocator.destroy(buffer); errdefer buffer.deinit(); buffer.* = try ResultStream(Result(Value)).init(ctx.allocator, ctx.key); var offset: usize = ctx.offset; for (self.input) |child_parser| { const child_node_name = try child_parser.nodeName(&in_ctx.memoizer.node_name_cache); var child_ctx = try in_ctx.initChild(Value, child_node_name, offset); defer child_ctx.deinitChild(); if (!child_ctx.existing_results) try child_parser.parse(&child_ctx); var num_local_values: usize = 0; var sub = child_ctx.subscribe(); while (sub.next()) |next| { switch (next.result) { .err => { buffer.close(); buffer.deinit(); ctx.allocator.destroy(buffer); try ctx.results.add(Result(SequenceValue(Value)).initError(next.offset, next.result.err)); return; }, else => { // TODO(slimsag): need path committal functionality if (num_local_values == 0) { // TODO(slimsag): if no consumption, could get stuck forever! offset = next.offset; try buffer.add(next.toUnowned()); } num_local_values += 1; }, } } } buffer.close(); try ctx.results.add(Result(SequenceValue(Value)).init(offset, .{ .results = buffer })); } }; } test "sequence" { nosuspend { const allocator = testing.allocator; const Payload = void; const ctx = try Context(Payload, SequenceValue(LiteralValue)).init(allocator, "abc123abc456_123abc", {}); defer ctx.deinit(); var seq = Sequence(Payload, LiteralValue).init(&.{ (&Literal(Payload).init("abc").parser).ref(), (&Literal(Payload).init("123ab").parser).ref(), (&Literal(Payload).init("c45").parser).ref(), (&Literal(Payload).init("6").parser).ref(), }); try seq.parser.parse(&ctx); var sub = ctx.subscribe(); var sequence = sub.next().?.result.value; try testing.expect(sub.next() == null); // stream closed var sequenceSub = sequence.results.subscribe(ctx.key, ctx.path, Result(LiteralValue).initError(ctx.offset, "matches only the empty language")); try testing.expectEqual(@as(usize, 3), sequenceSub.next().?.offset); try testing.expectEqual(@as(usize, 8), sequenceSub.next().?.offset); try testing.expectEqual(@as(usize, 11), sequenceSub.next().?.offset); try testing.expectEqual(@as(usize, 12), sequenceSub.next().?.offset); try testing.expect(sequenceSub.next() == null); // stream closed } }
src/combn/combinator/sequence.zig
const std = @import("std"); const fs = std.fs; const io = std.io; const log = std.log; const mem = std.mem; const process = std.process; const time = std.time; const allocator = std.heap.page_allocator; const c = @cImport({ @cInclude("SDL.h"); }); const chip8 = @import("chip8.zig"); const ErrorSet = error{SDLError}; // Global log level pub const log_level: log.Level = .warn; // Screen dimensions const ScreenWidth = 64; const ScreenHeight = 32; const ScreenFactor = 10; // Run the CPU at 500Hz const ClockRate = 500.0; const MillisPerClock = @floatToInt(i64, (1.0 / ClockRate) * 1000.0); // The sound and delay timers clock at 60Hz const TimerClockRate = 60.0; const MillisPerTimerClock = @floatToInt(i64, (1.0 / TimerClockRate) * 1000.0); // The number of audio samples to produce for a beep const SamplesPerBeep = 8192; fn powerUp(machine: *chip8.Chip8) !void { var window = c.SDL_CreateWindow("chip8z", 100, 100, ScreenWidth * ScreenFactor, ScreenHeight * ScreenFactor, c.SDL_WINDOW_SHOWN); if (window == null) { log.warn("Unable to create window: {s}", .{c.SDL_GetError()}); return ErrorSet.SDLError; } defer c.SDL_DestroyWindow(window); var surface = c.SDL_GetWindowSurface(window); var event: c.SDL_Event = undefined; var quit = false; var timerClockNow: i64 = time.milliTimestamp(); var clockNow: i64 = undefined; while (!quit) { clockNow = time.milliTimestamp(); while (c.SDL_PollEvent(&event) != 0) { switch (event.type) { c.SDL_QUIT => quit = true, c.SDL_KEYDOWN => { switch (event.key.keysym.sym) { c.SDLK_1 => machine.keyDown(0x01), c.SDLK_2 => machine.keyDown(0x02), c.SDLK_3 => machine.keyDown(0x03), c.SDLK_4 => machine.keyDown(0x0c), c.SDLK_q => machine.keyDown(0x04), c.SDLK_w => machine.keyDown(0x05), c.SDLK_e => machine.keyDown(0x06), c.SDLK_r => machine.keyDown(0x0d), c.SDLK_a => machine.keyDown(0x07), c.SDLK_s => machine.keyDown(0x08), c.SDLK_d => machine.keyDown(0x09), c.SDLK_f => machine.keyDown(0x0e), c.SDLK_z => machine.keyDown(0x0a), c.SDLK_x => machine.keyDown(0x00), c.SDLK_c => machine.keyDown(0x0b), c.SDLK_v => machine.keyDown(0x0f), else => {}, } }, c.SDL_KEYUP => { switch (event.key.keysym.sym) { c.SDLK_1 => machine.keyUp(0x01), c.SDLK_2 => machine.keyUp(0x02), c.SDLK_3 => machine.keyUp(0x03), c.SDLK_4 => machine.keyUp(0x0c), c.SDLK_q => machine.keyUp(0x04), c.SDLK_w => machine.keyUp(0x05), c.SDLK_e => machine.keyUp(0x06), c.SDLK_r => machine.keyUp(0x0d), c.SDLK_a => machine.keyUp(0x07), c.SDLK_s => machine.keyUp(0x08), c.SDLK_d => machine.keyUp(0x09), c.SDLK_f => machine.keyUp(0x0e), c.SDLK_z => machine.keyUp(0x0a), c.SDLK_x => machine.keyUp(0x00), c.SDLK_c => machine.keyUp(0x0b), c.SDLK_v => machine.keyUp(0x0f), else => {}, } }, else => {}, } } const should_render = machine.step(); if (should_render) { for (machine.Screen) |row, y| { for (row) |cell, x| { var rect = c.SDL_Rect{ .x = @intCast(c_int, x * ScreenFactor), .y = @intCast(c_int, y * ScreenFactor), .w = ScreenFactor, .h = ScreenFactor, }; var color = [3]u8{ 0x30, 0x30, 0x30 }; if (cell == 1) { color = [3]u8{ 0x30, 0xbb, 0x30 }; } var rv = c.SDL_FillRect(surface, &rect, c.SDL_MapRGB(surface.*.format, color[0], color[1], color[2])); if (rv != 0) { log.warn("Failed to fill rect: {s}", .{c.SDL_GetError()}); return ErrorSet.SDLError; } } } if (c.SDL_UpdateWindowSurface(window) != 0) { log.warn("Failed to update window surface: {s}", .{c.SDL_GetError()}); return ErrorSet.SDLError; } } const now = time.milliTimestamp(); var timeDiff = now - clockNow; if (timeDiff < MillisPerClock) { const timeToSleep = @intCast(u64, MillisPerClock - timeDiff); time.sleep(timeToSleep * time.ns_per_ms); } timeDiff = now - timerClockNow; if (timeDiff >= MillisPerTimerClock) { machine.tickTimers(); timerClockNow = now; if (machine.ST > 0) { beep(); } } } } var playback_device_id: c.SDL_AudioDeviceID = undefined; fn beep() void { const tone_volume: f32 = 0.1; const period: usize = 44100 / 415; // if it's not Baroque, don't fix it! *groan* var buf = mem.zeroes([SamplesPerBeep]f32); var s: usize = 0; while (s < SamplesPerBeep) { if (((s / period) % 2) == 0) { buf[s] = tone_volume; } else { buf[s] = -tone_volume; } s += 1; } const rv = c.SDL_QueueAudio(playback_device_id, &buf, buf.len); if (rv != 0) { log.warn("Unable to queue audio samples: {s}", .{c.SDL_GetError()}); } } pub fn main() !void { const args = try process.argsAlloc(allocator); defer process.argsFree(allocator, args); if (args.len == 1) { log.warn("usage: {s} <rom>", .{args[0]}); process.exit(1); } if (c.SDL_Init(c.SDL_INIT_VIDEO | c.SDL_INIT_AUDIO) != 0) { log.warn("Unable to initialise SDL: {s}", .{c.SDL_GetError()}); return ErrorSet.SDLError; } defer c.SDL_Quit(); // // Setup audio // var want_spec: c.SDL_AudioSpec = undefined; // 44.1kHz want_spec.freq = 44100; // Prefer f32s want_spec.format = c.AUDIO_F32; // Stereo want_spec.channels = 2; // The number of samples to hold in the buffer want_spec.samples = 1024; // Prefer to queue audio samples want_spec.callback = null; var have_spec: c.SDL_AudioSpec = undefined; playback_device_id = c.SDL_OpenAudioDevice(null, c.SDL_FALSE, &want_spec, &have_spec, c.SDL_AUDIO_ALLOW_FORMAT_CHANGE); if (playback_device_id == 0) { log.warn("Unable to initialise audio: {s}", .{c.SDL_GetError()}); } else { log.info("Device ID: {}, channels: {}, freq: {} Hz, samples: {}", .{ playback_device_id, have_spec.channels, have_spec.freq, have_spec.samples }); } // Unpause the audio device, otherwise nothing will play... c.SDL_PauseAudioDevice(playback_device_id, c.SDL_FALSE); // // Read the ROM data // const dir = fs.cwd(); const file = try dir.openFile(args[1], .{ .read = true }); defer file.close(); var prgRom: [4096]u8 = undefined; const reader = file.reader(); const nBytes = try reader.readAll(prgRom[0..]); log.info("Read {} bytes of PRG ROM", .{nBytes}); // // Create the CHIP-8 machine and go! // var machine = chip8.Chip8.init(prgRom[0..nBytes]); try powerUp(&machine); }
src/main.zig
const std = @import("std"); const instr = @import("instr.zig"); const Bus = @import("Bus.zig"); const Self = @This(); const Reg0 = 0; const Reg1 = 1; const Reg2 = 2; const Reg3 = 3; const Reg4 = 4; const Reg5 = 5; const Reg6 = 6; const Reg7 = 7; const Reg8 = 8; const Reg9 = 9; const Reg10 = 10; const Reg11 = 11; const Reg12 = 12; const Reg13 = 13; const Reg14 = 14; const Reg15 = 15; const Reg8Fiq = 16; const Reg9Fiq = 17; const Reg10Fiq = 18; const Reg11Fiq = 19; const Reg12Fiq = 20; const Reg13Fiq = 21; const Reg14Fiq = 22; const Reg13Svc = 23; const Reg14Svc = 24; const Reg13Abt = 25; const Reg14Abt = 26; const Reg13Irq = 27; const Reg14Irq = 28; const Reg13Und = 29; const Reg14Und = 30; const Cpsr = struct { signed: bool = false, zero: bool = false, carry: bool = false, overflow: bool = false, _: u20 = undefined, irq_disable: bool = false, fiq_disable: bool = false, state: enum(u1) { arm, thumb } = .arm, mode: enum(u5) { user = 0b10000, fiq = 0b10001, irq = 0b10010, svc = 0b10011, abt = 0b10111, und = 0b11011, system = 0b11111, } = .user, }; regs: [31]u32 = [_]u32{0} ** 31, cpsr: Cpsr = .{}, spsr_fiq: Cpsr = undefined, spsr_svc: Cpsr = undefined, spsr_abt: Cpsr = undefined, spsr_irq: Cpsr = undefined, spsr_und: Cpsr = undefined, bus: Bus, pub fn init() Self { return .{ .bus = Bus.init() }; } pub fn deinit(self: Self) void { _ = self; } fn getRegPtr(self: *Self, reg: instr.Register) *u32 { const idx = switch (self.cpsr.mode) { .fiq => if (reg > 7 and reg < 15) reg + @intCast(usize, Reg8Fiq - Reg8) else reg, .svc => if (reg == 13 or reg == 14) reg + @intCast(usize, Reg13Svc - Reg13) else reg, .abt => if (reg == 13 or reg == 14) reg + @intCast(usize, Reg13Abt - Reg13) else reg, .irq => if (reg == 13 or reg == 14) reg + @intCast(usize, Reg13Irq - Reg13) else reg, .und => if (reg == 13 or reg == 14) reg + @intCast(usize, Reg13Und - Reg13) else reg, else => reg, }; return &self.regs[idx]; } fn getReg(self: *Self, reg: instr.Register) u32 { return self.getRegPtr(reg).*; } fn setReg(self: *Self, reg: instr.Register, n: u32) void { self.getRegPtr(reg).* = n; } fn readWord(self: *Self) u32 { return self.bus.readWord(self.getReg(15)); } pub fn clock(self: *Self) void { const opcode = instr.parseOpcode(self.readWord()); switch (opcode.instr) { else => std.debug.todo("unimplemented opcode"), } } // Logical Alu fn alu(self: *Self, payload: instr.AluInstr) void { const op2 = switch (payload.op2) { .reg => |s| blk: { const reg = self.getReg(s.reg); const shift_by = switch (s.shift_by) { .imm => |imm| imm, .reg => |reg| self.getReg(reg), }; break :blk switch (s.shift_type) { .lsl => .{ .val = reg << shift_by, .carry = @as(bool, reg >> (32 - shift_by) & 0x1), }, .lsr => .{ .val = reg >> shift_by, .carry = @as(bool, reg >> shift_by & 0x1), }, .asr => .{ .val = @bitCast(u32, @bitCast(i32, reg) >> shift_by), .carry = @as(bool, reg >> shift_by & 0x1), }, .ror => .{ .val = std.math.rotr(u32, reg, shift_by), .carry = @as(bool, reg >> shift_by & 0x1), }, }; }, .imm => |s| .{ .val = std.math.rotr(u32, s.imm, s.rot * 2), .carry = @as(bool, s.imm >> s.rot & 0x1), }, }; const res = switch (payload.op) { .mov => op2.val, .mvn => ~op2.val, .orr => payload.rn | op2.val, .eor, .teq => payload.rn ^ op2.val, .and_, .tst => payload.rn & op2.val, .bic => payload.rn & ~op2.val, .add => payload.rn + op2.val, .adc => payload.rn + op2.val + self.cpsr.carry, .sub => payload.rn - op2.val, .sbc => payload.rn - op2.val + self.cpsr.carry - 1, .rsb => op2.val - payload.rn, .rsc => op2.val - payload.rn + self.cpsr.carry - 1, .cmp => payload.rn - op2.val, .cmn => payload.rn + op2.val, }; if (payload.op != .tst or payload.op != .teq or payload.op != .cmp or payload.op != .cmn) self.setReg(payload.rd, res); if (payload.s and payload.rd != 15) { if (res == 0) self.cpsr.zero = true; blk: { if (payload.op.isLogical()) { switch (payload.op2) { .reg => |reg| if (reg.shift_by == 0) break :blk, .imm => |imm| if (imm.rot == 0) break :blk, } } self.cpsr.carry = op2.carry; } if (!payload.op.isLogical()) self.cpsr.overflow = res >> 31 != payload.rd >> 31; self.cpsr.signed = @as(bool, res >> 31); } } test "reg access" { var cpu = Self.init(); for (cpu.regs) |*p, i| { p.* = @intCast(u32, i); } try std.testing.expect(cpu.getReg(13) == Reg13); cpu.cpsr.mode = .fiq; try std.testing.expect(cpu.getReg(13) == Reg13Fiq); cpu.cpsr.mode = .irq; try std.testing.expect(cpu.getReg(13) == Reg13Irq); cpu.cpsr.mode = .svc; try std.testing.expect(cpu.getReg(13) == Reg13Svc); cpu.cpsr.mode = .abt; try std.testing.expect(cpu.getReg(13) == Reg13Abt); cpu.cpsr.mode = .und; try std.testing.expect(cpu.getReg(13) == Reg13Und); cpu.cpsr.mode = .system; try std.testing.expect(cpu.getReg(13) == Reg13); } test "static analysis" { std.testing.refAllDecls(@This()); }
src/Cpu.zig
const std = @import("std"); const zCord = @import("zCord"); const WorkContext = @import("WorkContext.zig"); const util = @import("util.zig"); test { _ = WorkContext; _ = util; } const auto_restart = true; //const auto_restart = std.builtin.mode == .Debug; pub usingnamespace if (auto_restart) RestartHandler else struct {}; const RestartHandler = struct { pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { std.debug.print("PANIC -- {s}\n", .{msg}); if (error_return_trace) |t| { std.debug.dumpStackTrace(t.*); } std.debug.dumpCurrentStackTrace(@returnAddress()); const err = std.os.execveZ( std.os.argv[0], @ptrCast([*:null]?[*:0]u8, std.os.argv.ptr), @ptrCast([*:null]?[*:0]u8, std.os.environ.ptr), ); std.debug.print("{s}\n", .{@errorName(err)}); std.os.exit(42); } }; pub fn main() !void { util.mapSigaction(struct { pub fn WINCH(signum: c_int) callconv(.C) void { _ = signum; WorkContext.reload(); } pub fn USR1(signum: c_int) callconv(.C) void { _ = signum; const err = std.os.execveZ( std.os.argv[0], @ptrCast([*:null]?[*:0]u8, std.os.argv.ptr), @ptrCast([*:null]?[*:0]u8, std.os.environ.ptr), ); std.debug.print("{s}\n", .{@errorName(err)}); } }); try zCord.root_ca.preload(std.heap.page_allocator); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; util.PoolString.prefill(); var auth_buf: [0x100]u8 = undefined; const client = zCord.Client{ .auth_token = try std.fmt.bufPrint(&auth_buf, "Bot {s}", .{std.os.getenv("DISCORD_AUTH") orelse return error.AuthNotFound}), }; var gateway = try client.startGateway(.{ .allocator = &gpa.allocator, .intents = .{ .guild_messages = true, .direct_messages = true }, .presence = .{ .status = .online, .activities = &.{ .{ .type = .Watching, .name = "examples: %%666 or %%std.ArrayList", }, }, }, }); defer gateway.destroy(); const work = try WorkContext.create( &gpa.allocator, client, std.os.getenv("ZIGLIB") orelse return error.ZiglibNotFound, std.os.getenv("GITHUB_AUTH"), ); while (true) { const event = try gateway.recvEvent(); defer event.deinit(); processEvent(event, work) catch |err| { std.debug.print("{}\n", .{err}); }; } } pub fn processEvent(event: zCord.Gateway.Event, ctx: *WorkContext) !void { if (event.name != .message_create) return; var channel_id: ?zCord.Snowflake(.channel) = null; var source_msg_id: ?zCord.Snowflake(.message) = null; // If `channel_id` was guaranteed to exist before `content`, we wouldn't need to build this list :( var base: ?*util.PoolString = null; // This is needed to maintain insertion order. If we only used base, it would be in reverse order. var tail: *util.PoolString = undefined; defer while (base) |text| { base = text.next; text.destroy(); }; while (try event.data.objectMatch(enum { id, content, channel_id })) |match| switch (match.key) { .id => { source_msg_id = try zCord.Snowflake(.message).consumeJsonElement(match.value); }, .channel_id => { channel_id = try zCord.Snowflake(.channel).consumeJsonElement(match.value); }, .content => { const reader = try match.value.stringReader(); while (try findAsk(reader)) |text| { text.next = null; if (base == null) { base = text; tail = text; } else { tail.next = text; tail = text; } } _ = try match.value.finalizeToken(); }, }; if (channel_id != null and source_msg_id != null) { while (base) |text| { base = text.next; std.debug.print(">> %%{s}\n", .{text.array.slice()}); if (ctx.ask_mailbox.putOverwrite(.{ .channel_id = channel_id.?, .source_msg_id = source_msg_id.?, .text = text })) |existing| { existing.text.destroy(); } } } } fn findAsk(reader: anytype) !?*util.PoolString { const State = enum { no_match, percent, ready, endless, }; var state = State.no_match; var string = try util.PoolString.create(); errdefer string.destroy(); while (reader.readByte()) |c| { switch (state) { .no_match => { if (c == '%') { state = .percent; } }, .percent => { state = if (c == '%') .ready else .no_match; }, .ready => { switch (c) { ' ', ',', '\n', '\t', ':', ';', '(', ')', '!', '?', '[', ']', '{', '}' => { if (std.mem.eql(u8, string.array.slice(), "run")) { state = .endless; try string.array.append(c); } else { break; } }, else => try string.array.append(c), } }, .endless => try string.array.append(c), } } else |err| switch (err) { error.EndOfStream => {}, else => |e| return e, } // Strip trailing period if (string.array.len > 0 and string.array.get(string.array.len - 1) == '.') { _ = string.array.pop(); } if (string.array.len == 0) { string.destroy(); return null; } else { return string; } }
src/main.zig
const std = @import("std"); const ArrayList = std.ArrayList; const expect = std.testing.expect; const print = std.debug.print; const eql = std.mem.eql; const meta = std.meta; const Vector = meta.Vector; const len = std.mem.len; const test_allocator = std.testing.allocator; pub fn main() void { print("Hello, {s}!\n", .{"World"}); const string = [_]u8{ 'a', 'b', 'c' }; for (string) |character, index| { print("Counting: {d}!\n", .{character}); } } // Export functions export fn add(a: i32, b: i32) i32 { return a + b; } // Private functions fn fibonacci(n: u16) u16 { if (n == 0 or n == 1) { return n; } return fibonacci(n - 1) + fibonacci(n - 2); } fn failingFunction() error{Oops}!void { return error.Oops; } fn failFn() error{Oops}!i32 { try failingFunction(); return 12; } var problems: u32 = 98; fn failFnCounter() error{Oops}!void { errdefer problems += 1; try failingFunction(); } fn total(values: []const u8) usize { var count: usize = 0; for (values) |v| count += v; return count; } fn rangeHasNumber(begin: usize, end: usize, number: usize) bool { var i = begin; return while (i < end) : (i += 1) { if (i == number) { break true; } } else false; } fn ticker(step: u8) void { while (true) { std.time.sleep(1 * std.time.ns_per_s); tick += @as(isize, step); } } // Structs const Stuff = struct { x: i32, y: i32, fn swap(self: *Stuff) void { const tmp = self.x; self.x = self.y; self.y = tmp; } }; const Place = struct { lat: f32, long: f32 }; // Tests test "if statement" { const a = true; var x: u16 = 0; if (a) { x += 1; } else { x += 2; } expect(x == 1); } test "while" { var i: u8 = 2; while (i < 100) { i *= 2; } expect(i == 128); } test "while with continue expression" { var sum: u8 = 0; var i: u8 = 1; while (i <= 10) : (i += 1) { sum += i; } expect(sum == 55); } test "for" { //character literals are equivalent to integer literals const string = [_]u8{ 'a', 'b', 'c' }; for (string) |character, index| { expect(character == index + 97); } for (string) |character| {} for (string) |_, index| {} for (string) |_| {} } test "function recursion" { const x = fibonacci(10); expect(x == 55); } test "defer" { var x: i16 = 5; { // defer is executed when exiting the block defer x += 2; expect(x == 5); } expect(x == 7); } test "multi defer" { var x: f32 = 5; { // defers are executed in reverse order defer x += 2; defer x /= 2; } expect(x == 4.5); } test "try" { var v = failFn() catch |err| { expect(err == error.Oops); return; }; expect(v == 12); // is never reached } test "errdefer" { failFnCounter() catch |err| { expect(err == error.Oops); expect(problems == 99); return; }; } test "switch statement" { var x: i8 = 10; switch (x) { -1...1 => { x = -x; }, 10, 100 => { //special considerations must be made //when dividing signed integers x = @divExact(x, 10); }, else => {}, } expect(x == 1); } test "switch expression" { var x: i8 = 10; x = switch (x) { -1...1 => -x, 10, 100 => @divExact(x, 10), else => x, }; expect(x == 1); } test "out of bounds, no safety" { @setRuntimeSafety(false); const a = [3]u8{ 1, 2, 3 }; var index: u8 = 5; const b = a[index]; } test "slices" { const array = [_]u8{ 1, 2, 3, 4, 5 }; const slice = array[0..3]; expect(total(slice) == 6); } test "slices 2" { const array = [_]u8{ 1, 2, 3, 4, 5 }; const slice = array[0..3]; expect(@TypeOf(slice) == *const [3]u8); } test "slices 3" { var array = [_]u8{ 1, 2, 3, 4, 5 }; var slice = array[2..]; expect(total(slice) == 12); } test "automatic dereference" { var thing = Stuff{ .x = 10, .y = 20 }; thing.swap(); expect(thing.x == 20); expect(thing.y == 10); } test "integer widening" { const a: u8 = 250; const b: u16 = a; const c: u32 = b; expect(c == a); } test "@intCast" { const x: u64 = 200; const y = @intCast(u8, x); expect(@TypeOf(y) == u8); } test "well defined overflow" { var a: u8 = 255; a +%= 1; expect(a == 0); } test "float widening" { const a: f16 = 0; const b: f32 = a; const c: f128 = b; expect(c == @as(f128, a)); } test "int-float conversion" { const a: i32 = 0; const b = @intToFloat(f32, a); const c = @floatToInt(i32, b); expect(c == a); expect(@TypeOf(c) == @TypeOf(a)); } // Labelled loops test "nested continue" { var count: usize = 0; outer: for ([_]i32{ 1, 2, 3, 4, 5, 6, 7, 8 }) |_| { for ([_]i32{ 1, 2, 3, 4, 5 }) |_| { count += 1; continue :outer; } } expect(count == 8); } test "while loop expression" { expect(rangeHasNumber(0, 10, 3)); } test "optional" { var found_index: ?usize = null; const data = [_]i32{ 1, 2, 3, 4, 5, 6, 7, 8, 12 }; for (data) |v, i| { if (v == 10) found_index = i; } expect(found_index == null); } test "orelse" { var a: ?f32 = null; var b = a orelse 0; expect(b == 0); expect(@TypeOf(b) == f32); } // Executed at compile time test "comptime blocks" { var x = comptime fibonacci(10); var y = comptime blk: { break :blk fibonacci(10); }; } test "comptime_int" { const a = 12; const b = a + 10; const c: u4 = a; const d: f32 = b; } test "branching on types" { const a = 5; const b: if (a < 10) f32 else i32 = 5; expect(@TypeOf(b) == f32); } // Concatenating arrays test "++" { const x: [4]u8 = undefined; const y = x[0..]; const a: [6]u8 = undefined; const b = a[0..]; const new = y ++ b; expect(new.len == 10); } // Multiplying / repeating arrays test "**" { const pattern = [_]u8{ 0xCC, 0xAA }; const memory = pattern ** 3; expect(eql(u8, &memory, &[_]u8{ 0xCC, 0xAA, 0xCC, 0xAA, 0xCC, 0xAA })); } // Compile time loop unrolling test "inline for" { const types = [_]type{ i32, f32, u8, bool }; var sum: usize = 0; inline for (types) |T| sum += @sizeOf(T); expect(sum == 10); var sum2: u32 = 0; const some_array = [5]u8{ 1, 2, 3, 4, 5 }; inline for (some_array) |i| sum2 += i; expect(sum2 == 15); } // No struct type defined test "anonymous struct literal" { const Point = struct { x: i32, y: i32 }; var pt: Point = .{ .x = 13, .y = 67, }; expect(pt.x == 13); expect(pt.y == 67); } test "string literal" { expect(@TypeOf("hello") == *const [5:0]u8); } test "C string" { const c_string: [*:0]const u8 = "hello"; var array: [5]u8 = undefined; var i: usize = 0; while (c_string[i] != 0) : (i += 1) { array[i] = c_string[i]; } } test "vector add" { const x: Vector(4, f32) = .{ 1, -10, 20, -1 }; const y: Vector(4, f32) = .{ 2, 10, 0, 1 }; const z = x + y; expect(meta.eql(z, Vector(4, f32){ 3, 0, 20, 0 })); } test "vector indexing" { const x: Vector(4, u8) = .{ 255, 0, 255, 0 }; expect(x[0] == 255); } test "vector * scalar" { const x: Vector(3, f32) = .{ 12.5, 37.5, 2.5 }; const y = x * @splat(3, @as(f32, 2)); expect(meta.eql(y, Vector(3, f32){ 25, 75, 5 })); } test "vector looping" { const x = Vector(4, u8){ 255, 0, 255, 0 }; var sum = blk: { var tmp: u10 = 0; var i: u8 = 0; while (i < len(x)) : (i += 1) tmp += x[i]; break :blk tmp; }; expect(sum == 510); } test "vector coercing" { const arr: [4]f32 = @Vector(4, f32){ 1, 2, 3, 4 }; } test "json parse" { var stream = std.json.TokenStream.init( \\{ "lat": 40.684540, "long": -74.401422 } ); const x = try std.json.parse(Place, &stream, .{}); expect(x.lat == 40.684540); expect(x.long == -74.401422); } test "json stringify" { const x = Place{ .lat = 51.997664, .long = -0.740687, }; var buf: [100]u8 = undefined; var fba = std.heap.FixedBufferAllocator.init(&buf); var string = std.ArrayList(u8).init(&fba.allocator); try std.json.stringify(x, .{}, string.writer()); expect(eql(u8, string.items, \\{"lat":5.19976654e+01,"long":-7.40687012e-01} )); } test "random numbers" { var prng = std.rand.DefaultPrng.init(blk: { var seed: u64 = undefined; try std.os.getrandom(std.mem.asBytes(&seed)); break :blk seed; }); const rand = &prng.random; const a = rand.float(f32); const b = rand.boolean(); const c = rand.int(u8); const d = rand.intRangeAtMost(u8, 0, 255); } test "arraylist" { // test_allocator only works in tests var list = ArrayList(u8).init(test_allocator); defer list.deinit(); try list.append('H'); try list.append('e'); try list.append('l'); try list.append('l'); try list.append('o'); try list.appendSlice(" World!"); expect(eql(u8, list.items, "Hello World!")); } test "hash map" { const Point = struct { x: i32, y: i32 }; var map = std.AutoHashMap(u32, Point).init( test_allocator, ); defer map.deinit(); try map.put(1525, .{ .x = 1, .y = -4 }); try map.put(1550, .{ .x = 2, .y = -3 }); try map.put(1575, .{ .x = 3, .y = -2 }); try map.put(1600, .{ .x = 4, .y = -1 }); expect(map.count() == 4); var sum = Point{ .x = 0, .y = 0 }; var iterator = map.iterator(); while (iterator.next()) |entry| { sum.x += entry.value.x; sum.y += entry.value.y; } expect(sum.x == 10); expect(sum.y == -10); } test "string hashmap" { var map = std.StringHashMap(enum { cool, uncool }).init( test_allocator, ); defer map.deinit(); try map.put("loris", .uncool); try map.put("me", .cool); expect(map.get("me").? == .cool); expect(map.get("loris").? == .uncool); } test "stack" { const string = "(()())"; var stack = std.ArrayList(usize).init( test_allocator, ); defer stack.deinit(); const Pair = struct { open: usize, close: usize }; var pairs = std.ArrayList(Pair).init( test_allocator, ); defer pairs.deinit(); for (string) |char, i| { if (char == '(') try stack.append(i); if (char == ')') try pairs.append(.{ .open = stack.pop(), .close = i, }); } for (pairs.items) |pair, i| { expect(std.meta.eql(pair, switch (i) { 0 => Pair{ .open = 1, .close = 2 }, 1 => Pair{ .open = 3, .close = 4 }, 2 => Pair{ .open = 0, .close = 5 }, else => unreachable, })); } } test "sorting" { var data = [_]u8{ 10, 240, 0, 0, 10, 5 }; std.sort.sort(u8, &data, {}, comptime std.sort.asc(u8)); expect(eql(u8, &data, &[_]u8{ 0, 0, 5, 10, 10, 240 })); std.sort.sort(u8, &data, {}, comptime std.sort.desc(u8)); expect(eql(u8, &data, &[_]u8{ 240, 10, 10, 5, 0, 0 })); } // Errors //test "out of bounds" { // const a = [3]u8{ 1, 2, 3 }; // var index: u8 = 5; // const b = a[index]; //} //test "unreachable" { // const x: i32 = 1; // const y: u32 = if (x == 2) 5 else unreachable; //}
main.zig
const Server = @This(); const lsp = @import("lsp"); const std = @import("std"); const tres = @import("tres"); arena: std.heap.ArenaAllocator, parser: std.json.Parser, read_buf: std.ArrayList(u8), write_buf: std.ArrayList(u8), const SampleDirection = enum { client_to_server, server_to_client, }; const SampleEntryKind = enum { @"send-request", @"receive-request", @"send-response", @"receive-response", @"send-notification", @"receive-notification", fn getDirection(self: SampleEntryKind) SampleDirection { return switch (self) { .@"send-request", .@"send-response", .@"send-notification" => .client_to_server, else => .server_to_client, }; } }; // TODO: Handle responses const SampleEntry = struct { isLSPMessage: bool, @"type": SampleEntryKind, message: std.json.Value, }; pub fn readLine(self: *Server, reader: anytype) !void { while (true) { var byte = try reader.readByte(); if (byte == '\n') { return; } if (self.read_buf.items.len == self.read_buf.capacity) { try self.read_buf.ensureTotalCapacity(self.read_buf.capacity + 1); } try self.read_buf.append(byte); } } pub fn flushArena(self: *Server) void { self.arena.deinit(); self.arena.state = .{}; } fn emitParamUnions(writer: anytype) !void { try writer.writeAll("pub const RequestParams = union(enum) {\n"); const req_info = @typeInfo(lsp.RequestParams).Union; inline for (req_info.fields) |field| { const actual_type: []const u8 = blk: { const old_type = @typeName(field.field_type); if (std.mem.eql(u8, old_type, "Value")) break :blk "std.json.Value"; var new_type: [std.mem.replacementSize(u8, old_type, ".lsp.", "")]u8 = undefined; _ = std.mem.replace(u8, old_type, ".lsp.", "", &new_type); break :blk &new_type; }; try writer.print(" {s}: {s},\n", .{ field.name, actual_type }); } try writer.writeAll("};\n\n"); try writer.writeAll("pub const ResponseParams = union(enum) {\n"); const res_info = @typeInfo(lsp.ResponseParams).Union; inline for (res_info.fields) |field| { const actual_type: []const u8 = blk: { const old_type = @typeName(field.field_type); if (std.mem.eql(u8, old_type, "Value")) break :blk "std.json.Value"; var new_type: [std.mem.replacementSize(u8, old_type, ".lsp.", "")]u8 = undefined; _ = std.mem.replace(u8, old_type, ".lsp.", "", &new_type); break :blk &new_type; }; try writer.print(" {s}: {s},\n", .{ field.name, actual_type }); } try writer.writeAll("};\n\n"); } test { @setEvalBranchQuota(100_000); var log_dir = try std.fs.cwd().openDir("samples", .{ .iterate = true }); defer log_dir.close(); var log = try log_dir.openFile("amogus-html.log", .{}); defer log.close(); var reader = log.reader(); // reader.readAll() const allocator = std.heap.page_allocator; var arena = std.heap.ArenaAllocator.init(allocator); var server = Server{ .arena = arena, .parser = std.json.Parser.init(arena.allocator(), false), .read_buf = try std.ArrayList(u8).initCapacity(allocator, 1024), .write_buf = try std.ArrayList(u8).initCapacity(allocator, 1024), }; var parser = std.json.Parser.init(server.arena.allocator(), false); var request_map = std.AutoHashMap(i64, []const u8).init(allocator); defer request_map.deinit(); // const fd = try std.fs.cwd().createFile("params.zig", .{}); // defer fd.close(); // try emitParamUnions(fd.writer()); while (true) { server.readLine(reader) catch |err| switch (err) { error.EndOfStream => return, else => return std.log.err("{s}", .{err}), }; const tree = try parser.parse(server.read_buf.items); defer parser.reset(); const entry = try tres.parse(SampleEntry, tree.root, .{ .allocator = arena.allocator() }); if (entry.isLSPMessage) { switch (entry.@"type") { .@"send-request", .@"receive-request", // .@"send-notification", .@"receive-notification", => a: { const request = tres.parse(lsp.Request, entry.message, .{ .allocator = arena.allocator(), .suppress_error_logs = false, }) catch { std.log.err("Cannot handle Request or Notification of method \"{s}\"", .{entry.message.Object.get("method").?.String}); break :a; }; if (request.id) |id| { try request_map.put(id.integer, try allocator.dupe(u8, request.method)); } if (!std.mem.startsWith(u8, request.method, "$/")) { if (request.params == .unknown) { std.debug.print("unknown req: {s}\n", .{request.method}); } } }, // .@"send-response", .@"receive-response" => b: { const response = tres.parse(lsp.Response, entry.message, .{ .allocator = arena.allocator(), .suppress_error_logs = false, }) catch { std.log.err("Cannot handle Response of id \"{}\"", .{entry.message.Object.get("id").?}); std.debug.print("{s}\n", .{server.read_buf.items}); break :b; }; if (response.err) |_| {} else { const old_method = request_map.get(response.id.integer) orelse { std.debug.print("missing request: {d}\n", .{response.id.integer}); break :b; }; _ = request_map.remove(response.id.integer); const params = response.fromMethod(old_method, .{ .allocator = arena.allocator(), .suppress_error_logs = false, }) catch { std.log.err("Cannot handle Response params of method \"{s}\"", .{old_method}); break :b; }; if (params == null) { std.debug.print("unknown res: {s}\n", .{old_method}); } } }, else => {}, } } server.read_buf.items.len = 0; // arena.deinit(); } }
tests/tests.zig
const std = @import("std"); const Answer = struct { @"0": u32, @"1": u32 }; fn count_candidates(candidates: []bool) u32 { var n: u32 = 0; for (candidates) |candidate| { if (candidate) { n += 1; } } return n; } fn find_candidate(candidates: []bool) ?usize { for (candidates) |candidate, i| { if (candidate) { return i; } } return null; } fn find_rating(report: []u32, bitwidth: usize, oxy_criterion: bool, allocator: *std.mem.Allocator) !u32 { var candidates = std.ArrayList(bool).init(allocator); for (report) |_| { try candidates.append(true); } defer candidates.deinit(); var i: u32 = 0; while (count_candidates(candidates.items) > 1) : (i += 1) { const j = bitwidth - i - 1; var num_ones: u32 = 0; for (report) |n, ni| { if (n & (1 <<| j) > 0 and candidates.items[ni]) { num_ones += 1; } } const num_candidates = count_candidates(candidates.items); const keepbit: u32 = if ((oxy_criterion and 2 * num_ones >= num_candidates) or (!oxy_criterion and 2 * num_ones < num_candidates)) 1 else 0; for (report) |n, ni| { if ((n & (1 <<| j)) >> @intCast(u6, j) != keepbit) { candidates.items[ni] = false; } } } return report[find_candidate(candidates.items).?]; } fn run(filename: []const u8) !Answer { const file = try std.fs.cwd().openFile(filename, .{ .read = true }); defer file.close(); var reader = std.io.bufferedReader(file.reader()).reader(); var buffer: [1024]u8 = undefined; var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var report = std.ArrayList(u32).init(&gpa.allocator); defer report.deinit(); var bitwidth: usize = undefined; while (try reader.readUntilDelimiterOrEof(&buffer, '\n')) |line| { bitwidth = line.len; try report.append(try std.fmt.parseInt(u32, line, 2)); } // Part 1 var gamma_rate: u32 = 0; { var i: u32 = 0; while (i < bitwidth) : (i += 1) { var num_ones: u32 = 0; for (report.items) |n| { if (n & (1 <<| i) > 0) { num_ones += 1; } } if (2 * num_ones > report.items.len) { gamma_rate |= 1 <<| i; } } } const epsilon_rate: u32 = ((1 <<| @intCast(u32, bitwidth)) - 1) & ~gamma_rate; // Part 2 const oxygen_rating = try find_rating(report.items, bitwidth, true, &gpa.allocator); const co2_rating = try find_rating(report.items, bitwidth, false, &gpa.allocator); return Answer{ .@"0" = gamma_rate * epsilon_rate, .@"1" = oxygen_rating * co2_rating }; } pub fn main() !void { const answer = try run("inputs/" ++ @typeName(@This()) ++ ".txt"); std.debug.print("{d}\n", .{answer.@"0"}); std.debug.print("{d}\n", .{answer.@"1"}); } test { const answer = try run("test-inputs/" ++ @typeName(@This()) ++ ".txt"); try std.testing.expectEqual(answer.@"0", 198); try std.testing.expectEqual(answer.@"1", 230); }
src/day03.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const testing = std.testing; const Allocator = mem.Allocator; const ArrayList = std.ArrayList; /// String struct; compatible with c-style strings pub const String = struct { bytes: []const u8 = "\x00", allocator: ?*Allocator = null, // Initialization /// Init with const []u8 slice; Slice must end with a null; pub fn init(slice: []const u8) !String { if (slice.len == 0) { return error.EmptySlice; } if (slice[slice.len - 1] != 0) { return error.NotNullTerminated; } return String{ .bytes = slice }; } /// Meant to be compatible with c"" text pub fn initCstr(ptr: [*]const u8) !String { const length = mem.len(u8, ptr); if (length == 0) { return error.EmptySlice; } const result = ptr[0 .. length + 1]; if (result[result.len - 1] != 0) { return error.NotNullTerminated; } return String{ .bytes = result }; } /// Init with pre allocated []u8 /// String assumes ownership and will free given []u8 with given allocator pub fn fromOwnedSlice(alloc: *Allocator, slice: []u8) !String { if (slice.len == 0) { return error.EmptySlice; } if (slice[slice.len - 1] != 0) { return error.NotNullTerminated; } return String{ .bytes = slice, .allocator = alloc, }; } /// Init with given slice, copied using given allocator pub fn fromSlice(alloc: *Allocator, slice: []const u8) !String { if (slice.len == 0) { return error.EmptySlice; } const copy = if (slice.len > 0 and slice[slice.len - 1] != 0) try alloc.alloc(u8, slice.len + 1) else try alloc.alloc(u8, slice.len); mem.copy(u8, copy, slice); if (copy.len > slice.len) { copy[slice.len] = 0; } return String{ .bytes = copy, .allocator = alloc, }; } /// Init with given String, copied using given allocator pub fn initCopy(alloc: *Allocator, other: *const String) !String { return try fromSlice(alloc, other.bytes); } // Destruction /// Free string if allocator is provided /// This fn is destructive and resets the state of the string to prevent use after being freed /// Requires the String to be mutable pub fn deinit(self: *String) void { self.deinitComptime(); self.allocator = null; self.bytes = "\x00"; } /// Free string if allocator is provided pub fn deinitComptime(self: *const String) void { if (self.allocator) |alloc| { alloc.free(self.bytes); } } pub fn deinitArrayList(list: ArrayList(String)) void { defer list.deinit(); for (list.toSlice()) |*str| { str.deinit(); } } // Utilities /// Get length of string, assumes last byte is null pub fn len(self: *const String) usize { return self.bytes.len - 1; } /// Returns slice of []u8 owned by this String /// Slice excludes null terminator pub fn toSlice(self: *const String) []const u8 { return self.bytes[0..self.len()]; } /// Returns Owned slice of String contents, including null terminator /// String is reset at this point and no longer tracks the slice pub fn toOwnedSlice(self: *String) []const u8 { const ret = self.bytes; self.bytes = ""; self.allocator = null; return ret; } /// Returns a [*]const u8 of the string, can be passed to c functions pub fn cstr(self: *const String) [*]const u8 { return self.bytes.ptr; } /// Compares two strings /// Return values are -1, 0, 1 /// Target String only considers content and not trailing null pub fn cmp(self: *const String, other: String) mem.Compare { return self.cmpSlice(other.bytes[0..other.len()]); } /// Compares a slice to a string /// String only considers content and not trailing null pub fn cmpSlice(self: *const String, slice: []const u8) mem.Compare { return mem.compare(u8, self.bytes[0..self.len()], slice); } /// Checks for string equality pub fn eql(self: *const String, slice: String) bool { return if (self.cmp(slice) == mem.Compare.Equal) true else false; } pub fn eqlSlice(self: *const String, other: []const u8) bool { return if (self.cmpSlice(other) == mem.Compare.Equal) true else false; } /// Duplicate a string pub fn dupe(self: *const String) !String { if (self.allocator) |alloc| { return fromSlice(alloc, self.bytes); } return error.NoAllocator; } /// Duplicate a string, with a specific allocator pub fn dupeWith(self: *const String, alloc: *Allocator) !String { return fromSlice(alloc, self.bytes); } /// Concat two strings, using the allocator of the first pub fn concat(self: *const String, other: String) !String { return self.concatSlice(other.bytes[0..other.len()]); } /// Concat a string and a slice, using the allocator of the first pub fn concatSlice(self: *const String, slice: []const u8) !String { if (self.allocator) |alloc| { return self.concatSliceWithAllocator(slice, alloc); } return error.NoAllocator; } /// Concat a string and a slice, using the given allocator pub fn concatSliceWithAllocator(self: *const String, slice: []const u8, alloc: *Allocator) !String { const newlen = self.len() + slice.len; const result = try alloc.alloc(u8, newlen + 1); mem.copy(u8, result, self.bytes); mem.copy(u8, result[self.len()..], slice); result[newlen] = 0; return String{ .bytes = result, .allocator = self.allocator, }; } /// Find a string within a given string pub fn find(self: *const String, other: String) ?usize { return self.findSlice(other.bytes); } /// Find a slice within a given string pub fn findSlice(self: *const String, slice: []const u8) ?usize { return mem.indexOf(u8, self.bytes, slice); } /// Split string on a space pub fn split(self: *const String) !ArrayList(String) { return self.splitAt(" "); } /// Split string on given slice pub fn splitAt(self: *const String, slice: []const u8) !ArrayList(String) { if (slice.len == 0) { return error.EmptySlice; } if (self.allocator) |alloc| { return self.splitWithAllocator(slice, alloc); } return error.NoAllocator; } /// Split on given slice using given allocator pub fn splitWithAllocator(self: *const String, slice: []const u8, alloc: *Allocator) !ArrayList(String) { if (slice.len == 0) { return error.EmptySlice; } var selfitr = self.toSlice(); var index = mem.indexOf(u8, selfitr, slice); if (index == null) { return error.SliceNotFound; } var list = ArrayList(String).init(alloc); errdefer list.deinit(); while (index != null) : ({ selfitr = selfitr[index.? + slice.len .. selfitr.len]; index = mem.indexOf(u8, selfitr, slice); }) { const part = selfitr[0..index.?]; if (part.len > 0) { const substr = try String.fromSlice(alloc, part); try list.append(substr); } } if (selfitr.len > 0) { const substr = try String.fromSlice(alloc, selfitr); try list.append(substr); } return list; } /// Join an ArrayList of strings into a single string with a delimiter /// Uses the list's allocator pub fn join(list: ArrayList(String), delim: []const u8) !String { return String.joinWith(list.allocator, list, delim); } /// Join an ArrayList of strings into a single string with a delimiter /// Uses the given allocator pub fn joinWith(alloc: *Allocator, list: ArrayList(String), delim: []const u8) !String { var total_len: usize = 0; const lslice = list.toSlice(); for (lslice) |str, i| { total_len += str.len(); if (i > 0 and i != list.len) { total_len += delim.len; } } const result = try alloc.alloc(u8, total_len + 1); errdefer alloc.free(result); result[total_len] = 0; var index: usize = 0; for (lslice) |str, i| { if (delim.len > 0 and i > 0 and i != list.len) { mem.copy(u8, result[index..], delim); index += delim.len; } const sslice = str.toSlice(); mem.copy(u8, result[index..], sslice); index += sslice.len; } return String{ .bytes = result, .allocator = alloc, }; } }; test "string initialization" { const allocator = std.heap.direct_allocator; // init bare struct var str1 = String{}; defer str1.deinit(); // init with string, manually terminated const raw_str2 = "String2\x00"; var str2 = try String.init(raw_str2); defer str2.deinit(); testing.expect(str2.len() == 7); // check null terminator testing.expect(str2.bytes[str2.len()] == 0); const raw_str3 = c"String3"; var str3 = try String.initCstr(raw_str3); defer str3.deinit(); testing.expect(str3.len() == 7); // check null terminator testing.expect(str3.bytes[str3.len()] == 0); // error trying to init from empty slice testing.expectError(error.EmptySlice, String.fromSlice(allocator, "")); // init copy of text var str4 = try String.fromSlice(allocator, "String4"); defer str4.deinit(); // init from preallocated owned slice const msg = try allocator.alloc(u8, 8); mem.copy(u8, msg, "String5\x00"); var str5 = try String.fromOwnedSlice(allocator, msg); defer str5.deinit(); // init copy of other string var str6 = try String.initCopy(allocator, &str4); defer str6.deinit(); } test "to Owned slice" { const alloc = std.heap.direct_allocator; const buf = try alloc.alloc(u8, 10); buf[9] = 0; var str = try String.fromOwnedSlice(alloc, buf); const buf2 = str.toOwnedSlice(); defer alloc.free(buf2); testing.expect(buf.ptr == buf2.ptr); testing.expect(str.allocator == null); testing.expect(mem.compare(u8, str.bytes, "") == mem.Compare.Equal); } test "String compare and equals" { const alloc = std.heap.direct_allocator; var str1 = try String.fromSlice(alloc, "CompareMe"); var str2 = try String.fromSlice(alloc, "CompareMe"); var str3 = try String.fromSlice(alloc, "COMPAREME"); defer str1.deinit(); defer str2.deinit(); defer str3.deinit(); // test cmp testing.expect(str1.cmpSlice("CompareMe") == mem.Compare.Equal); testing.expect(str1.cmp(str2) == mem.Compare.Equal); testing.expect(str1.cmpSlice("COMPAREME") == mem.Compare.GreaterThan); testing.expect(str1.cmp(str3) == mem.Compare.GreaterThan); // test eql testing.expect(str1.eqlSlice("CompareMe")); testing.expect(str1.eql(str2)); testing.expect(str1.eql(str3) == false); } test "String duplication" { const alloc = std.heap.direct_allocator; var str1 = try String.fromSlice(alloc, "Dupe me"); var str2 = try str1.dupe(); defer str1.deinit(); defer str2.deinit(); testing.expect(str1.eql(str2)); testing.expect(str1.bytes.ptr != str2.bytes.ptr); } test "String concatenation" { const alloc = std.heap.direct_allocator; var str1 = try String.fromSlice(alloc, "Con"); var str2 = try String.fromSlice(alloc, "Cat"); var str3 = try str1.concat(str2); var str4 = try str3.concatSlice("ing"); testing.expect(str3.eqlSlice("ConCat")); testing.expect(str4.eqlSlice("ConCating")); str1.deinit(); str2.deinit(); str3.deinit(); str4.deinit(); } test "String finding" { const alloc = std.heap.direct_allocator; var str = try String.fromSlice(alloc, "The cow jumped over the moon."); var str2 = try String.fromSlice(alloc, "moon."); defer str.deinit(); defer str.deinit(); testing.expect(str.findSlice("The").? == 0); testing.expect(str.findSlice("the").? == 20); testing.expect(str.findSlice("cat") == null); testing.expect(str.find(str2).? == 24); } test "String Splitting" { const alloc = std.heap.direct_allocator; var str = try String.fromSlice(alloc, " Please Split me 5 times "); defer str.deinit(); testing.expectError(error.EmptySlice, str.splitAt("")); testing.expectError(error.SliceNotFound, str.splitAt("Blah")); var splitstr: ArrayList(String) = try str.split(); defer String.deinitArrayList(splitstr); for (splitstr.toSlice()) |val, i| { switch (i) { 0 => testing.expect(val.eqlSlice("Please")), 1 => testing.expect(val.eqlSlice("Split")), 2 => testing.expect(val.eqlSlice("me")), 3 => testing.expect(val.eqlSlice("5")), 4 => testing.expect(val.eqlSlice("times")), else => return error.BadIndex, } } var str2 = try String.fromSlice(alloc, "Thic|=|Splitting"); defer str2.deinit(); var splitstr2 = try str2.splitAt("|=|"); defer String.deinitArrayList(splitstr2); testing.expect(splitstr2.at(0).eqlSlice("Thic")); testing.expect(splitstr2.at(1).eqlSlice("Splitting")); } test "String Joining" { const alloc = std.heap.direct_allocator; var list = ArrayList(String).init(alloc); defer String.deinitArrayList(list); var str1 = try String.fromSlice(alloc, "Hello"); var str2 = try String.fromSlice(alloc, "New"); var str3 = try String.fromSlice(alloc, "World!"); try list.append(str1); try list.append(str2); try list.append(str3); var jstr1 = try String.join(list, " "); var jstr2 = try String.join(list, ""); var jstr3 = try String.join(list, "==="); defer jstr1.deinit(); defer jstr2.deinit(); defer jstr3.deinit(); testing.expect(jstr1.eqlSlice("Hello New World!")); testing.expect(jstr2.eqlSlice("HelloNewWorld!")); testing.expect(jstr3.eqlSlice("Hello===New===World!")); }
strings.zig
const std = @import("std"); const printf = std.debug.print; const fs = std.fs; const os = std.os; const io = std.io; const mem = std.mem; const c = @cImport({ @cInclude("sys/ioctl.h"); @cInclude("linux/if_tun.h"); @cInclude("net/if.h"); }); const Error = error{ Create, Read, IfConfig, GetInet, DeviceGone, BadDevice, }; pub fn Device( comptime Context: type, comptime nameFn: fn (context: Context) []const u8, comptime getFd: fn (context: Context) i32, comptime ifcfgFn: fn (name: []const u8, info: IfConfigInfo) Error!void, comptime closeFn: fn (context: Context) void, ) type { return struct { context: Context, const Self = @This(); /// Returns the name of the interface. pub fn name(self: Self) []const u8 { return nameFn(self.context); } /// Return a file descriptor for the already configured device. pub fn fd(self: Self) i32 { return getFd(self.context); } /// Route the device for the system. pub fn ifcfg(self: Self, info: IfConfigInfo) Error!void { return ifcfgFn(nameFn(self.context), info); } // Finalizes and closes the device, undoing all of it's configuration. pub fn close(self: Self) void { closeFn(self.context); } }; } pub const TunDevice = struct { file: fs.File, name: []const u8, const Self = @This(); const Reader = io.Reader(*Self, Error, read); const Dev = Device(*Self, name, getFd, virtifcfg, close); /// Creates, initializes and configures a virtual TUN device /// with a given name, clone file device descriptor, network, /// netmask and a concrete IP address. pub fn init( deviceName: []const u8, file: fs.File, ) !Self { var ifr_name = [_]u8{0} ** c.IFNAMSIZ; mem.copy(u8, ifr_name[0..c.IFNAMSIZ], deviceName[0..]); const ifr = os.linux.ifreq{ .ifrn = .{ .name = ifr_name, }, .ifru = .{ .flags = c.IFF_TUN, }, }; const errno = os.linux.ioctl(file.handle, c.TUNSETIFF, @ptrToInt(&ifr)); if (errno != 0) { return error.Create; } const flag = try os.fcntl(file.handle, os.F_GETFL, 0); const fcntlRet = try os.fcntl(file.handle, os.F_SETFL, flag | os.O_NONBLOCK); return Self{ .name = deviceName, .file = file, }; } pub fn device(self: *Self) Dev { return .{ .context = self }; } /// Get the name of the interface. fn name(self: *Self) []const u8 { return self.name; } // Returns the file device. fn getFd(self: *Self) i32 { return self.file.handle; } /// Closes the underlying file device. fn close(self: *Self) void { self.file.close(); } }; /// Contains all the nescesary information to configure a network interface. pub const IfConfigInfo = struct { address: os.sockaddr, netmask: os.sockaddr, }; /// Configures and ups the virtual network interface. fn virtifcfg(name: []const u8, info: IfConfigInfo) Error!void { const flags = os.SOCK_DGRAM | os.SOCK_CLOEXEC | os.SOCK_NONBLOCK; const fd = os.socket(os.AF_INET, flags, 0) catch |err| { return error.GetInet; }; var ifr_name = [_]u8{0} ** c.IFNAMSIZ; mem.copy(u8, ifr_name[0..c.IFNAMSIZ], name[0..]); try doIoctl(fd, c.SIOCSIFADDR, @ptrToInt(&os.linux.ifreq{ .ifrn = .{ .name = ifr_name, }, .ifru = .{ .addr = info.address, }, })); try doIoctl(fd, c.SIOCSIFNETMASK, @ptrToInt(&os.linux.ifreq{ .ifrn = .{ .name = ifr_name, }, .ifru = .{ .addr = info.netmask, }, })); try doIoctl(fd, c.SIOCSIFFLAGS, @ptrToInt(&os.linux.ifreq{ .ifrn = .{ .name = ifr_name, }, .ifru = .{ .flags = 1 | c.IFF_UP, }, })); } fn doIoctl(fd: i32, flags: u16, addr: u64) Error!void { switch (os.errno(os.system.ioctl(fd, flags, addr))) { 0 => return, os.EBADF => return error.DeviceGone, os.EFAULT => return error.IfConfig, os.EINVAL => return error.IfConfig, os.ENOTTY => return error.BadDevice, os.ENXIO => unreachable, os.EINTR => unreachable, os.EIO => unreachable, os.ENODEV => unreachable, else => return error.IfConfig, } }
src/dev.zig
const x86_64 = @import("../../index.zig"); const bitjuggle = @import("bitjuggle"); const std = @import("std"); /// A physical memory frame. Page size 4 KiB pub const PhysFrame = extern struct { const size: x86_64.structures.paging.PageSize = .Size4KiB; start_address: x86_64.PhysAddr, /// Returns the frame that starts at the given physical address. /// /// Returns an error if the address is not correctly aligned (i.e. is not a valid frame start) pub fn fromStartAddress(address: x86_64.PhysAddr) PhysFrameError!PhysFrame { if (!address.isAligned(size.bytes())) { return PhysFrameError.AddressNotAligned; } return containingAddress(address); } /// Returns the frame that starts at the given physical address. /// Without validaing the addresses alignment pub fn fromStartAddressUnchecked(address: x86_64.PhysAddr) PhysFrame { return .{ .start_address = address }; } /// Returns the frame that contains the given physical address. pub fn containingAddress(address: x86_64.PhysAddr) PhysFrame { return .{ .start_address = address.alignDown(size.bytes()), }; } /// Returns the size of the frame (4KB, 2MB or 1GB). pub fn sizeOf(self: PhysFrame) u64 { _ = self; return size.bytes(); } pub fn format(value: PhysFrame, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; _ = options; try writer.print("PhysFrame[" ++ size.sizeString() ++ "](0x{x})", .{value.start_address.value}); } comptime { std.testing.refAllDecls(@This()); } }; /// A physical memory frame. Page size 2 MiB pub const PhysFrame2MiB = extern struct { const size: x86_64.structures.paging.PageSize = .Size2MiB; start_address: x86_64.PhysAddr, /// Returns the frame that starts at the given physical address. /// /// Returns an error if the address is not correctly aligned (i.e. is not a valid frame start) pub fn fromStartAddress(address: x86_64.PhysAddr) PhysFrameError!PhysFrame2MiB { if (!address.isAligned(size.bytes())) { return PhysFrameError.AddressNotAligned; } return containingAddress(address); } /// Returns the frame that starts at the given physical address. /// Without validaing the addresses alignment pub fn fromStartAddressUnchecked(address: x86_64.PhysAddr) PhysFrame2MiB { return .{ .start_address = address }; } /// Returns the frame that contains the given physical address. pub fn containingAddress(address: x86_64.PhysAddr) PhysFrame2MiB { return .{ .start_address = address.alignDown(size.bytes()), }; } /// Returns the size of the frame (4KB, 2MB or 1GB). pub fn sizeOf(self: PhysFrame2MiB) u64 { _ = self; return size.bytes(); } pub fn format(value: PhysFrame2MiB, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; _ = options; try writer.print("PhysFrame[" ++ size.sizeString() ++ "](0x{x})", .{value.start_address.value}); } comptime { std.testing.refAllDecls(@This()); } }; /// A physical memory frame. Page size 1 GiB pub const PhysFrame1GiB = extern struct { const size: x86_64.structures.paging.PageSize = .Size1GiB; start_address: x86_64.PhysAddr, /// Returns the frame that starts at the given physical address. /// /// Returns an error if the address is not correctly aligned (i.e. is not a valid frame start) pub fn fromStartAddress(address: x86_64.PhysAddr) PhysFrameError!PhysFrame1GiB { if (!address.isAligned(size.bytes())) { return PhysFrameError.AddressNotAligned; } return containingAddress(address); } /// Returns the frame that starts at the given physical address. /// Without validaing the addresses alignment pub fn fromStartAddressUnchecked(address: x86_64.PhysAddr) PhysFrame1GiB { return .{ .start_address = address }; } /// Returns the frame that contains the given physical address. pub fn containingAddress(address: x86_64.PhysAddr) PhysFrame1GiB { return .{ .start_address = address.alignDown(size.bytes()), }; } /// Returns the size of the frame (4KB, 2MB or 1GB). pub fn sizeOf(self: PhysFrame1GiB) u64 { _ = self; return size.bytes(); } pub fn format(value: PhysFrame1GiB, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; _ = options; try writer.print("PhysFrame[" ++ size.sizeString() ++ "](0x{x})", .{value.start_address.value}); } comptime { std.testing.refAllDecls(@This()); } }; pub const PhysFrameError = error{AddressNotAligned}; /// Generates iterators for ranges of physical memory frame. Page size 4 KiB pub const PhysFrameIterator = struct { /// Returns a range of frames, exclusive `end`. pub fn range(start: PhysFrame, end: PhysFrame) PhysFrameRange { return .{ .start = start, .end = end }; } /// Returns a range of frames, inclusive `end`. pub fn rangeInclusive(start: PhysFrame, end: PhysFrame) PhysFrameRangeInclusive { return .{ .start = start, .end = end }; } comptime { std.testing.refAllDecls(@This()); } }; /// Generates iterators for ranges of physical memory frame. Page size 2 MiB pub const PhysFrameIterator2MiB = struct { /// Returns a range of frames, exclusive `end`. pub fn range(start: PhysFrame2MiB, end: PhysFrame2MiB) PhysFrameRange2MiB { return .{ .start = start, .end = end }; } /// Returns a range of frames, inclusive `end`. pub fn rangeInclusive(start: PhysFrame2MiB, end: PhysFrame2MiB) PhysFrameRange2MiBInclusive { return .{ .start = start, .end = end }; } comptime { std.testing.refAllDecls(@This()); } }; /// Generates iterators for ranges of physical memory frame. Page size 1 GiB pub const PhysFrameIterator1GiB = struct { /// Returns a range of frames, exclusive `end`. pub fn range(start: PhysFrame1GiB, end: PhysFrame1GiB) PhysFrameRange1GiB { return .{ .start = start, .end = end }; } /// Returns a range of frames, inclusive `end`. pub fn rangeInclusive(start: PhysFrame1GiB, end: PhysFrame1GiB) PhysFrameRange1GiBInclusive { return .{ .start = start, .end = end }; } comptime { std.testing.refAllDecls(@This()); } }; /// A range of physical memory frames, exclusive the upper bound. Page size 4 KiB pub const PhysFrameRange = struct { /// The start of the range, inclusive. start: ?PhysFrame, /// The end of the range, exclusive. end: PhysFrame, /// Returns whether the range contains no frames. pub fn isEmpty(self: PhysFrameRange) bool { if (self.start) |x| { return x.start_address.value >= self.end.start_address.value; } return true; } pub fn next(self: *PhysFrameRange) ?PhysFrame { if (self.start) |start| { if (start.start_address.value < self.end.start_address.value) { const frame = start; const opt_addr = x86_64.PhysAddr.init(start.start_address.value + PhysFrame.size.bytes()) catch null; if (opt_addr) |addr| { self.start = PhysFrame.containingAddress(addr); } else { self.start = null; } return frame; } } return null; } comptime { std.testing.refAllDecls(@This()); } }; /// A range of physical memory frames, exclusive the upper bound. Page size 2 MiB pub const PhysFrameRange2MiB = struct { /// The start of the range, inclusive. start: ?PhysFrame2MiB, /// The end of the range, exclusive. end: PhysFrame2MiB, /// Returns whether the range contains no frames. pub fn isEmpty(self: PhysFrameRange2MiB) bool { if (self.start) |x| { return x.start_address.value >= self.end.start_address.value; } return true; } pub fn next(self: *PhysFrameRange2MiB) ?PhysFrame2MiB { if (self.start) |start| { if (start.start_address.value < self.end.start_address.value) { const frame = start; const opt_addr = x86_64.PhysAddr.init(start.start_address.value + PhysFrame2MiB.size.bytes()) catch null; if (opt_addr) |addr| { self.start = PhysFrame2MiB.containingAddress(addr); } else { self.start = null; } return frame; } } return null; } comptime { std.testing.refAllDecls(@This()); } }; /// A range of physical memory frames, exclusive the upper bound. Page size 1 GiB pub const PhysFrameRange1GiB = struct { /// The start of the range, inclusive. start: ?PhysFrame1GiB, /// The end of the range, exclusive. end: PhysFrame1GiB, /// Returns whether the range contains no frames. pub fn isEmpty(self: PhysFrameRange1GiB) bool { if (self.start) |x| { return x.start_address.value >= self.end.start_address.value; } return true; } pub fn next(self: *PhysFrameRange1GiB) ?PhysFrame1GiB { if (self.start) |start| { if (start.start_address.value < self.end.start_address.value) { const frame = start; const opt_addr = x86_64.PhysAddr.init(start.start_address.value + PhysFrame1GiB.size.bytes()) catch null; if (opt_addr) |addr| { self.start = PhysFrame1GiB.containingAddress(addr); } else { self.start = null; } return frame; } } return null; } comptime { std.testing.refAllDecls(@This()); } }; /// An range of physical memory frames, inclusive the upper bound. Page size 4 KiB pub const PhysFrameRangeInclusive = struct { /// The start of the range, inclusive. start: ?PhysFrame, /// The end of the range, inclusive. end: PhysFrame, /// Returns whether the range contains no frames. pub fn isEmpty(self: PhysFrameRangeInclusive) bool { if (self.start) |x| { return x.start_address.value > self.end.start_address.value; } return true; } pub fn next(self: *PhysFrameRangeInclusive) ?PhysFrame { if (self.start) |start| { if (start.start_address.value <= self.end.start_address.value) { const frame = start; const opt_addr = x86_64.PhysAddr.init(start.start_address.value + PhysFrame.size.bytes()) catch null; if (opt_addr) |addr| { self.start = PhysFrame.containingAddress(addr); } else { self.start = null; } return frame; } } return null; } comptime { std.testing.refAllDecls(@This()); } }; /// An range of physical memory frames, inclusive the upper bound. Page size 2 MiB pub const PhysFrameRange2MiBInclusive = struct { /// The start of the range, inclusive. start: ?PhysFrame2MiB, /// The end of the range, inclusive. end: PhysFrame2MiB, /// Returns whether the range contains no frames. pub fn isEmpty(self: PhysFrameRange2MiBInclusive) bool { if (self.start) |x| { return x.start_address.value > self.end.start_address.value; } return true; } pub fn next(self: *PhysFrameRange2MiBInclusive) ?PhysFrame2MiB { if (self.start) |start| { if (start.start_address.value <= self.end.start_address.value) { const frame = start; const opt_addr = x86_64.PhysAddr.init(start.start_address.value + PhysFrame2MiB.size.bytes()) catch null; if (opt_addr) |addr| { self.start = PhysFrame2MiB.containingAddress(addr); } else { self.start = null; } return frame; } } return null; } comptime { std.testing.refAllDecls(@This()); } }; /// An range of physical memory frames, inclusive the upper bound. Page size 1 GiB pub const PhysFrameRange1GiBInclusive = struct { /// The start of the range, inclusive. start: ?PhysFrame1GiB, /// The end of the range, inclusive. end: PhysFrame1GiB, /// Returns whether the range contains no frames. pub fn isEmpty(self: PhysFrameRange1GiBInclusive) bool { if (self.start) |x| { return x.start_address.value > self.end.start_address.value; } return true; } pub fn next(self: *PhysFrameRange1GiBInclusive) ?PhysFrame1GiB { if (self.start) |start| { if (start.start_address.value <= self.end.start_address.value) { const frame = start; const opt_addr = x86_64.PhysAddr.init(start.start_address.value + PhysFrame1GiB.size.bytes()) catch null; if (opt_addr) |addr| { self.start = PhysFrame1GiB.containingAddress(addr); } else { self.start = null; } return frame; } } return null; } comptime { std.testing.refAllDecls(@This()); } }; test "PhysFrameIterator" { var physAddrA = x86_64.PhysAddr.initPanic(0x000FFFFFFFFF0000); physAddrA = physAddrA.alignDown(x86_64.structures.paging.PageSize.Size4KiB.bytes()); var physAddrB = x86_64.PhysAddr.initPanic(0x000FFFFFFFFFFFFF); physAddrB = physAddrB.alignDown(x86_64.structures.paging.PageSize.Size4KiB.bytes()); const a = try PhysFrame.fromStartAddress(physAddrA); const b = try PhysFrame.fromStartAddress(physAddrB); var iterator = PhysFrameIterator.range(a, b); var inclusive_iterator = PhysFrameIterator.rangeInclusive(a, b); try std.testing.expect(!iterator.isEmpty()); try std.testing.expect(!inclusive_iterator.isEmpty()); var count: usize = 0; while (iterator.next()) |_| { count += 1; } try std.testing.expectEqual(@as(usize, 15), count); count = 0; while (inclusive_iterator.next()) |_| { count += 1; } try std.testing.expectEqual(@as(usize, 16), count); try std.testing.expect(iterator.isEmpty()); try std.testing.expect(inclusive_iterator.isEmpty()); } comptime { std.testing.refAllDecls(@This()); }
src/structures/paging/frame.zig
usingnamespace @import("c.zig"); var initialized: bool = false; var muted: bool = false; //al related data that we save to cleanup later var source: ALuint = undefined; var context: *ALCcontext = undefined; /// Initializes the audio system and opens the wave file. /// Note that it's currently only possible to have 1 audio file active. pub fn init(file_name: [*c]const u8, comptime buffer_size: comptime_int) !void { var device: *ALCdevice = undefined; var wave: drwav = undefined; if (drwav_init_file(&wave, file_name, null) == DRWAV_FALSE) { return error.FileRead; } // Caller defined buffer size var audio_buffer: [buffer_size]u8 = undefined; const actual_size = drwav_read_raw(&wave, buffer_size, &audio_buffer); defer _ = drwav_uninit(&wave); // Get default device if (alcOpenDevice("")) |dev| { device = dev; } else { return error.NoDevicesFound; } // Set the current context if (alcCreateContext(device, null)) |ctx| { context = ctx; if (alcMakeContextCurrent(context) == AL_FALSE) { return error.ContextFailed; } } // generate a source object and link to a new buffer we make var buffer: ALuint = undefined; alGenSources(1, &source); alGenBuffers(1, &buffer); alBufferData(buffer, AL_FORMAT_STEREO16, @ptrCast(*const c_void, &audio_buffer[0..actual_size]), @intCast(c_int, actual_size), @intCast(c_int, wave.sampleRate)); alSourcei(source, AL_BUFFER, @intCast(c_int, buffer)); initialized = true; // we already linked to our source, so cleanup this buffer alDeleteBuffers(1, &buffer); } /// Plays the audio file provided with the `init` function. pub fn play() void { if (!initialized or muted) { return; } alSourcePlay(source); } /// Cleans the audio data and frees its memory pub fn deinit() void { alDeleteSources(1, &source); const device = alcGetContextsDevice(context); _ = alcMakeContextCurrent(null); alcDestroyContext(context); _ = alcCloseDevice(device); } /// Muts or unmutes the audio pub fn muteOrUnmute() void { muted = !muted; }
src/audio.zig
const std = @import("std"); const core = @import("graph.zig"); const graph_type = core.Graph; const graph_err = core.GraphError; const print = std.debug.print; const testing = std.testing; const ArrayList = std.ArrayList; const AutoArrayHashMap = std.AutoArrayHashMap; const mem = std.mem; const testing_alloc = std.testing.allocator; pub fn WeightedGraph(comptime index_type: type, comptime weight_type: type, dir: bool) type { return struct { const Self = @This(); directed: bool = dir, graph: graph_type(index_type, dir), edge_weights: AutoArrayHashMap(index_type, weight_type), allocator: *mem.Allocator, pub fn init(alloc_in: *mem.Allocator) Self { return Self{ .graph = graph_type(index_type, dir).init(alloc_in), .edge_weights = AutoArrayHashMap(index_type, weight_type).init(alloc_in), .allocator = alloc_in }; } pub fn deinit(self: *Self) !void { try self.graph.deinit(); self.edge_weights.deinit(); } //Adds a node to the graph struct given an index of a node pub fn addNode(self: *Self, id: index_type) !void { return self.graph.addNode(id); } //Adds an edge given the nodes to connect between, and a weight. (Note: for directed graphs, the order of the nodes matter) pub fn addEdge(self: *Self, id: index_type, n1_id: index_type, n2_id: index_type, w: weight_type) !void { try self.graph.addEdge(id, n1_id, n2_id); try self.edge_weights.put(id, w); } //Given an node ID, removes all nodes, an automatically removes all edges connected to it pub fn removeNodeWithEdges(self: *Self, id: index_type) !ArrayList(index_type) { var removed_edges = try self.graph.removeNodeWithEdges(id); for (removed_edges.items) |edge| { _ = self.edge_weights.swapRemove(edge); } return removed_edges; } //Removes the edges between two nodes (Note: for directed graphs the order of nodes matter, only edges from n1_id to n2_id will be removed ) pub fn removeEdgesBetween(self: *Self, n1_id: index_type, n2_id: index_type) !ArrayList(index_type) { var edges_removed = try self.graph.removeEdgesBetween(n1_id, n2_id); for (edges_removed.items) |index| { _ = self.edge_weights.swapRemove(index); } return edges_removed; } //Removes the edge by its ID using swapRemove pub fn removeEdgeByID(self: *Self, id: index_type) !void { try self.graph.removeEdgeByID(id); _ = self.edge_weights.swapRemove(id); } //Gets the weight of an edge if it exists given the index of the edge pub fn getEdgeWeight(self: *Self, id: index_type) !weight_type { if (!self.edge_weights.contains(id)) { return graph_err.EdgesDoNotExist; } return self.edge_weights.get(id).?; } }; } test "nominal-addNode" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try testing.expect(weighted_graph.graph.graph.count() == 1); try weighted_graph.deinit(); } test "nominal-addEdge" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try weighted_graph.addNode(4); try weighted_graph.addEdge(1, 3, 4, 6); try testing.expect(weighted_graph.edge_weights.get(1).? == 6); try weighted_graph.deinit(); } test "offnominal-addNode" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try testing.expect(if (weighted_graph.addNode(3)) |_| unreachable else |err| err == graph_err.NodeAlreadyExists); try weighted_graph.deinit(); } test "nominal-removeNodeWithEdges" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try weighted_graph.addNode(4); try weighted_graph.addEdge(1, 3, 4, 6); var edges = try weighted_graph.removeNodeWithEdges(3); try testing.expect(weighted_graph.graph.graph.count() == 1); try testing.expect(weighted_graph.edge_weights.count() == 0); try testing.expect(edges.items.len == 1); edges.deinit(); try weighted_graph.deinit(); } test "offnominal-removeNodeWithEdges" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try testing.expect(if (weighted_graph.removeNodeWithEdges(2)) |_| unreachable else |err| err == graph_err.NodesDoNotExist); try weighted_graph.deinit(); } test "nominal-removeEdgeByID" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try weighted_graph.addNode(4); try weighted_graph.addEdge(1, 3, 4, 6); try weighted_graph.removeEdgeByID(1); try testing.expect(weighted_graph.edge_weights.count() == 0); try weighted_graph.deinit(); } test "offnominal-removeEdgeByID" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try weighted_graph.addNode(4); try weighted_graph.addEdge(1, 3, 4, 6); try testing.expect(if (weighted_graph.removeEdgeByID(2)) |_| unreachable else |err| err == graph_err.EdgesDoNotExist); try weighted_graph.deinit(); } test "nominal-removeEdgesBetween" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try weighted_graph.addNode(4); try weighted_graph.addEdge(1, 3, 4, 6); try weighted_graph.addEdge(2, 3, 4, 6); var edges = try weighted_graph.removeEdgesBetween(3, 4); try testing.expect(weighted_graph.edge_weights.count() == 0); try testing.expect(edges.items.len == 2); edges.deinit(); try weighted_graph.deinit(); } test "offnominal-removeEdgesBetween" { var weighted_graph = WeightedGraph(u32, u64, true).init(testing_alloc); try weighted_graph.addNode(3); try weighted_graph.addNode(4); try weighted_graph.addEdge(1, 3, 4, 6); try weighted_graph.addEdge(2, 3, 4, 6); try testing.expect(if (weighted_graph.removeEdgesBetween(4, 5)) |_| unreachable else |err| err == graph_err.NodesDoNotExist); try weighted_graph.deinit(); }
src/weighted_graph.zig
const std = @import("std"); const math = std.math; const Ip4Address = std.net.Ip4Address; fn permuteFwd(state: *[4]u8) void { state[0] +%= state[1]; state[2] +%= state[3]; state[1] = math.rotl(u8, state[1], 2) ^ state[0]; state[3] = math.rotl(u8, state[3], 5) ^ state[2]; state[0] = math.rotl(u8, state[0], 4) +% state[3]; state[2] +%= state[1]; state[1] = math.rotl(u8, state[1], 3) ^ state[2]; state[3] = math.rotl(u8, state[3], 7) ^ state[0]; state[2] = math.rotl(u8, state[2], 4); } fn permuteBwd(state: *[4]u8) void { state[2] = math.rotl(u8, state[2], 4); state[1] = math.rotl(u8, state[1] ^ state[2], 5); state[3] = math.rotl(u8, state[3] ^ state[0], 1); state[2] -%= state[1]; state[0] = math.rotl(u8, state[0] -% state[3], 4); state[1] = math.rotl(u8, state[1] ^ state[0], 6); state[3] = math.rotl(u8, state[3] ^ state[2], 3); state[0] -%= state[1]; state[2] -%= state[3]; } fn xor4(dst: *[4]u8, a: *const [4]u8, b: *const [4]u8) void { for (dst) |_, i| { dst[i] = a[i] ^ b[i]; } } pub fn encrypt_raw(key: *const [16]u8, ip: *const [4]u8) [4]u8 { var out: [4]u8 = undefined; xor4(&out, ip, key[0..4]); permuteFwd(&out); xor4(&out, &out, key[4..8]); permuteFwd(&out); xor4(&out, &out, key[8..12]); permuteFwd(&out); xor4(&out, &out, key[12..16]); return out; } pub fn decrypt_raw(key: *const [16]u8, ip: *const [4]u8) [4]u8 { var out: [4]u8 = undefined; xor4(&out, ip, key[12..16]); permuteBwd(&out); xor4(&out, &out, key[8..12]); permuteBwd(&out); xor4(&out, &out, key[4..8]); permuteBwd(&out); xor4(&out, &out, key[0..4]); return out; } pub fn encrypt(key: *const [16]u8, ip: Ip4Address) Ip4Address { const raw_ip = @ptrCast(*const [4]u8, &ip.sa.addr); return Ip4Address.init(encrypt_raw(key, raw_ip), 0); } pub fn decrypt(key: *const [16]u8, ip: Ip4Address) Ip4Address { const raw_ip = @ptrCast(*const [4]u8, &ip.sa.addr); return Ip4Address.init(decrypt_raw(key, raw_ip), 0); } test "ipcrypt" { const key = "some 16-byte key"; const TestVector = struct { in: Ip4Address, out: Ip4Address, }; const test_vectors = [_]TestVector{ .{ .in = try Ip4Address.parse("127.0.0.1", 0), .out = try Ip4Address.parse("172.16.31.10", 0), }, .{ .in = try Ip4Address.parse("8.8.8.8", 0), .out = try Ip4Address.parse("192.168.127.12", 0), }, .{ .in = try Ip4Address.parse("1.2.3.4", 0), .out = try Ip4Address.parse("172.16.31.10", 0), }, }; for (test_vectors) |tv| { const in_bytes = @ptrCast(*const [4]u8, &tv.in.sa.addr); const out_bytes = @ptrCast(*const [4]u8, &tv.out.sa.addr); const ip_enc = encrypt(key, tv.in); const enc_bytes = @ptrCast(*const [4]u8, &ip_enc.sa.addr); try std.testing.expect(std.mem.eql(u8, enc_bytes, out_bytes)); const ip_dec = decrypt(key, ip_enc); const dec_bytes = @ptrCast(*const [4]u8, &ip_dec.sa.addr); try std.testing.expect(std.mem.eql(u8, dec_bytes, in_bytes)); } }
src/ipcrypt.zig
const std = @import("std"); const core = @import("core/core.zig"); const glfw = core.glfw; const renderer = core.renderer; const gl = core.gl; const input = core.input; const window = core.window; const fs = core.fs; const c = core.c; const m = core.math; const utils = core.utils; pub const AssetManager = @import("assetmanager.zig").AssetManager; const asseterror = @import("assetmanager.zig").Error; const alog = std.log.scoped(.alka); pub const embed = struct { pub const default_shader = struct { pub const id = 0; pub const vertex_shader = @embedFile("../assets/embed/texture.vert"); pub const fragment_shader = @embedFile("../assets/embed/texture.frag"); }; pub const white_texture_id = 0; }; const perror = error{ InvalidBatch, InvalidMVP, EngineIsInitialized, EngineIsNotInitialized, FailedToFindPrivateBatch }; /// Error set pub const Error = error{ FailedToFindBatch, CustomBatchInUse, CustomShaderInUse } || perror || asseterror || core.Error; pub const max_quad = 1024 * 8; pub const Vertex2D = comptime renderer.VertexGeneric(true, m.Vec2f); pub const Batch2DQuad = comptime renderer.BatchGeneric(max_quad, 6, 4, Vertex2D); pub const Colour = renderer.Colour; // error: inferring error set of return type valid only for function definitions // var pupdateproc: ?fn (deltatime: f32) !void = null; // ^ pub const Callbacks = struct { update: ?fn (deltatime: f32) anyerror!void = null, fixed: ?fn (fixedtime: f32) anyerror!void = null, draw: ?fn () anyerror!void = null, resize: ?fn (w: i32, h: i32) void = null, close: ?fn () void = null, }; pub const PrivateBatchState = enum { unknown, empty, active, deactive }; pub const PrivateBatch = struct { state: PrivateBatchState = PrivateBatchState.unknown, mode: gl.DrawMode = undefined, shader: u32 = undefined, texture: renderer.Texture = undefined, cam2d: m.Camera2D = undefined, data: Batch2DQuad = undefined, drawfun: fn (corebatch: Batch2DQuad, mode: gl.DrawMode, shader: *u32, texture: *renderer.Texture, cam2d: *m.Camera2D) Error!void = undefined, }; pub const Batch = struct { id: i32 = -1, mode: gl.DrawMode = undefined, shader: u32 = undefined, texture: renderer.Texture = undefined, cam2d: *m.Camera2D = undefined, subcounter: *const u32 = 0, drawfun: fn (corebatch: Batch2DQuad, mode: gl.DrawMode, shader: *u32, texture: *renderer.Texture, cam2d: *m.Camera2D) Error!void = drawDefault, pub fn drawDefault(corebatch: Batch2DQuad, mode: gl.DrawMode, shader: *u32, texture: *renderer.Texture, cam2d: *m.Camera2D) Error!void { cam2d.attach(); defer cam2d.detach(); gl.shaderProgramUse(shader.*); defer gl.shaderProgramUse(0); gl.textureActive(.texture0); gl.textureBind(.t2D, texture.id); defer gl.textureBind(.t2D, 0); const mvploc = gl.shaderProgramGetUniformLocation(shader.*, "MVP"); if (mvploc == -1) return Error.InvalidMVP; gl.shaderProgramSetMat4x4f(mvploc, cam2d.view); try corebatch.draw(mode); } }; pub const Private = struct { pub const Temp = struct { shader: u32 = undefined, texture: renderer.Texture = undefined, cam2d: m.Camera2D = undefined, }; pub const Layer = struct { defaults: Temp = undefined, force_shader: ?u64 = null, force_batch: ?usize = null, batch_counter: usize = 0, batchs: []PrivateBatch = undefined, }; layers: utils.UniqueList(Layer) = undefined, defaults: Temp = undefined, force_camera2d: m.Camera2D = undefined, force_shader: ?u64 = null, force_batch: ?usize = null, batch_counter: usize = 0, batchs: []PrivateBatch = undefined, callbacks: Callbacks = Callbacks{}, alloc: *std.mem.Allocator = undefined, winrun: bool = false, targetfps: f64 = 0.0, win: window.Info = window.Info{}, input: input.Info = input.Info{}, frametime: window.FrameTime = window.FrameTime{}, fps: window.FpsCalculator = window.FpsCalculator{}, assetmanager: AssetManager = undefined, mousep: m.Vec2f = m.Vec2f{}, }; var p: *Private = undefined; pub fn setstruct(ps: *Private) void { p = ps; } pub fn createPrivateBatch() Error!void { var i: usize = 0; // NOTE: try to find empty batch before allocating one if (p.batch_counter == 0) { p.batchs = try p.alloc.alloc(PrivateBatch, 1); p.batch_counter += 1; } else { i = blk: { var j: usize = 0; var didbreak = false; while (j < p.batch_counter) : (j += 1) { if (p.batchs[j].state == PrivateBatchState.empty) { didbreak = true; break; } } if (!didbreak) { // to be safe j = p.batch_counter; p.batchs = try p.alloc.realloc(p.batchs, p.batch_counter + 1); p.batch_counter += 1; } break :blk j; }; } p.batchs[i].drawfun = Batch.drawDefault; p.batchs[i].cam2d = p.defaults.cam2d; p.batchs[i].shader = try p.assetmanager.getShader(embed.default_shader.id); p.batchs[i].texture = try p.assetmanager.getTexture(embed.white_texture_id); p.batchs[i].state = PrivateBatchState.empty; p.batchs[i].data.submission_counter = 0; p.batchs[i].data.submitfn = submitQuadFn; try p.batchs[i].data.create(p.batchs[i].shader, setShaderAttribs); } pub fn findPrivateBatch() Error!usize { var i: usize = 0; while (i < p.batch_counter) : (i += 1) { if (p.batchs[i].state == PrivateBatchState.empty) { return i; } } return Error.FailedToFindPrivateBatch; } pub fn destroyPrivateBatch(i: usize) void { p.batchs[i].data.destroy(); p.batchs[i].data.submission_counter = 0; p.batchs[i] = PrivateBatch{}; } pub fn drawPrivateBatch(i: usize) Error!void { var b = &p.batchs[i]; return b.drawfun(b.data, b.mode, &b.shader, &b.texture, &b.cam2d); } pub fn renderPrivateBatch(i: usize) Error!void { if (p.batchs[i].state == PrivateBatchState.active) { try drawPrivateBatch(i); } else if (p.batchs[i].data.submission_counter > 0) alog.debug("batch(id: {}) <render> operation cannot be done, state: {}", .{ i, p.batchs[i].state }); } pub fn cleanPrivateBatch(i: usize) void { p.batchs[i].data.cleanAll(); p.batchs[i].data.submission_counter = 0; p.batchs[i].cam2d = p.defaults.cam2d; p.batchs[i].state = PrivateBatchState.empty; } pub fn closeCallback(handle: ?*glfw.Window) void { p.winrun = false; if (p.callbacks.close) |fun| { fun(); } p.callbacks.close = null; } pub fn resizeCallback(handle: ?*glfw.Window, w: i32, h: i32) void { //gl.viewport(0, 0, w, h); //gl.ortho(0, @intToFloat(f32, p.win.size.width), @intToFloat(f32, p.win.size.height), 0, -1, 1); p.win.size.width = w; p.win.size.height = h; if (p.callbacks.resize) |fun| { fun(w, h); } } pub fn keyboardCallback(handle: ?*glfw.Window, key: i32, sc: i32, ac: i32, mods: i32) void { p.input.handleKeyboard(key, ac); } pub fn mousebuttonCallback(handle: ?*glfw.Window, key: i32, ac: i32, mods: i32) void { p.input.handleMouse(key, ac); } pub fn mousePosCallback(handle: ?*glfw.Window, x: f64, y: f64) void { p.mousep.x = @floatCast(f32, x); p.mousep.y = @floatCast(f32, y); } pub fn submitTextureQuad(i: usize, p0: m.Vec2f, p1: m.Vec2f, p2: m.Vec2f, p3: m.Vec2f, srect: m.Rectangle, colour: Colour) Error!void { var b = &p.batchs[i]; const w = @intToFloat(f32, b.texture.width); const h = @intToFloat(f32, b.texture.height); var psrect = srect; var flipx = false; if (psrect.size.x < 0) { flipx = true; psrect.size.x *= -1; } if (psrect.size.y < 0) { psrect.position.y -= psrect.size.y; } // top left const t0 = m.Vec2f{ .x = if (flipx) (psrect.position.x + psrect.size.x) / w else psrect.position.x / w, .y = psrect.position.y / h }; // top right const t1 = m.Vec2f{ .x = if (flipx) psrect.position.x / w else (psrect.position.x + psrect.size.x) / w, .y = psrect.position.y / h }; // bottom right const t2 = m.Vec2f{ .x = if (flipx) psrect.position.x / w else (psrect.position.x + psrect.size.x) / w, .y = (psrect.position.y + psrect.size.y) / h }; // bottom left const t3 = m.Vec2f{ .x = if (flipx) (psrect.position.x + psrect.size.x) / w else psrect.position.x / w, .y = (psrect.position.y + psrect.size.y) / h }; const vx = [Batch2DQuad.max_vertex_count]Vertex2D{ .{ .position = p0, .texcoord = t0, .colour = colour }, .{ .position = p1, .texcoord = t1, .colour = colour }, .{ .position = p2, .texcoord = t2, .colour = colour }, .{ .position = p3, .texcoord = t3, .colour = colour }, }; p.batchs[i].data.submitDrawable(vx) catch |err| { if (err == Error.ObjectOverflow) { try drawPrivateBatch(i); cleanPrivateBatch(i); try p.batchs[i].data.submitDrawable(vx); //alog.notice("batch(id: {}) flushed!", .{i}); } else return err; }; } pub fn submitFontPointQuad(i: usize, font_id: u64, codepoint: i32, position: m.Vec2f, psize: f32, colour: Colour) Error!void { var b = &p.batchs[i]; const font = try p.assetmanager.getFont(font_id); const index = @intCast(usize, font.glyphIndex(codepoint)); const scale_factor: f32 = psize / @intToFloat(f32, font.base_size); // zig fmt: off const rect = m.Rectangle{ .position = .{ .x = position.x + @intToFloat(f32, font.glyphs[index].offx) * scale_factor - @intToFloat(f32, font.glyph_padding) * scale_factor, .y = position.y + @intToFloat(f32, font.glyphs[index].offy) * scale_factor - @intToFloat(f32, font.glyph_padding) * scale_factor }, .size = .{ .x = (font.rects[index].size.x + 2 * @intToFloat(f32, font.glyph_padding)) * scale_factor, .y = (font.rects[index].size.y + 2 * @intToFloat(f32, font.glyph_padding)) * scale_factor } }; const src = m.Rectangle{ .position = m.Vec2f{ .x = font.rects[index].position.x - @intToFloat(f32, font.glyph_padding), .y = font.rects[index].position.y - @intToFloat(f32, font.glyph_padding), }, .size = m.Vec2f{ .x = font.rects[index].size.x + 2 * @intToFloat(f32, font.glyph_padding), .y = font.rects[index].size.y + 2 * @intToFloat(f32, font.glyph_padding), } }; // zig fmt: on const pos0 = m.Vec2f{ .x = rect.position.x, .y = rect.position.y }; const pos1 = m.Vec2f{ .x = rect.position.x + rect.size.x, .y = rect.position.y }; const pos2 = m.Vec2f{ .x = rect.position.x + rect.size.x, .y = rect.position.y + rect.size.y }; const pos3 = m.Vec2f{ .x = rect.position.x, .y = rect.position.y + rect.size.y }; return submitTextureQuad(i, pos0, pos1, pos2, pos3, src, colour); } fn setShaderAttribs() void { const stride = @sizeOf(Vertex2D); gl.shaderProgramSetVertexAttribArray(0, true); gl.shaderProgramSetVertexAttribArray(1, true); gl.shaderProgramSetVertexAttribArray(2, true); gl.shaderProgramSetVertexAttribPointer(0, 2, f32, false, stride, @intToPtr(?*const c_void, @byteOffsetOf(Vertex2D, "position"))); gl.shaderProgramSetVertexAttribPointer(1, 2, f32, false, stride, @intToPtr(?*const c_void, @byteOffsetOf(Vertex2D, "texcoord"))); gl.shaderProgramSetVertexAttribPointer(2, 4, f32, false, stride, @intToPtr(?*const c_void, @byteOffsetOf(Vertex2D, "colour"))); } fn submitQuadFn(self: *Batch2DQuad, vertex: [Batch2DQuad.max_vertex_count]Vertex2D) renderer.Error!void { try submitVerticesQuad(Batch2DQuad, self, vertex); try submitIndiciesQuad(Batch2DQuad, self); self.submission_counter += 1; } fn submitVerticesQuad(comptime typ: type, self: *typ, vertex: [typ.max_vertex_count]typ.Vertex) renderer.Error!void { try self.submitVertex(self.submission_counter, 0, vertex[0]); try self.submitVertex(self.submission_counter, 1, vertex[1]); try self.submitVertex(self.submission_counter, 2, vertex[2]); try self.submitVertex(self.submission_counter, 3, vertex[3]); } fn submitIndiciesQuad(comptime typ: type, self: *typ) renderer.Error!void { if (self.submission_counter == 0) { try self.submitIndex(self.submission_counter, 0, 0); try self.submitIndex(self.submission_counter, 1, 1); try self.submitIndex(self.submission_counter, 2, 2); try self.submitIndex(self.submission_counter, 3, 2); try self.submitIndex(self.submission_counter, 4, 3); try self.submitIndex(self.submission_counter, 5, 0); } else { const back = self.index_list[self.submission_counter - 1]; var i: u8 = 0; while (i < typ.max_index_count) : (i += 1) { try self.submitIndex(self.submission_counter, i, back[i] + 4); try self.submitIndex(self.submission_counter, i, back[i] + 4); try self.submitIndex(self.submission_counter, i, back[i] + 4); try self.submitIndex(self.submission_counter, i, back[i] + 4); try self.submitIndex(self.submission_counter, i, back[i] + 4); try self.submitIndex(self.submission_counter, i, back[i] + 4); } } }
src/private.zig
const builtin = @import("builtin"); const MultiBoot = packed struct { magic: i32, flags: i32, checksum: i32, }; const ALIGN = 1 << 0; const MEMINFO = 1 << 1; const MAGIC = 0x1BADB002; const FLAGS = ALIGN | MEMINFO; export var multiboot align(4) linksection(".multiboot") = MultiBoot{ .magic = MAGIC, .flags = FLAGS, .checksum = -(MAGIC + FLAGS), }; export var stack_bytes: [16 * 1024]u8 align(16) linksection(".bss") = undefined; const stack_bytes_slice = stack_bytes[0..]; export fn _start() callconv(.Naked) noreturn { @call(.{ .stack = stack_bytes_slice }, kmain, .{}); while (true) {} } pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { @setCold(true); terminal.write("KERNEL PANIC: "); terminal.write(msg); while (true) {} } fn kmain() void { terminal.initialize(); terminal.write("Hello, Kernel World from Zig 0.7.1!"); } // Hardware text mode color constants const VgaColor = u8; const VGA_COLOR_BLACK = 0; const VGA_COLOR_BLUE = 1; const VGA_COLOR_GREEN = 2; const VGA_COLOR_CYAN = 3; const VGA_COLOR_RED = 4; const VGA_COLOR_MAGENTA = 5; const VGA_COLOR_BROWN = 6; const VGA_COLOR_LIGHT_GREY = 7; const VGA_COLOR_DARK_GREY = 8; const VGA_COLOR_LIGHT_BLUE = 9; const VGA_COLOR_LIGHT_GREEN = 10; const VGA_COLOR_LIGHT_CYAN = 11; const VGA_COLOR_LIGHT_RED = 12; const VGA_COLOR_LIGHT_MAGENTA = 13; const VGA_COLOR_LIGHT_BROWN = 14; const VGA_COLOR_WHITE = 15; fn vga_entry_color(fg: VgaColor, bg: VgaColor) u8 { return fg | (bg << 4); } fn vga_entry(uc: u8, color: u8) u16 { var c: u16 = color; return uc | (c << 8); } const VGA_WIDTH = 80; const VGA_HEIGHT = 25; const terminal = struct { var row: usize = 0; var column: usize = 0; var color = vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK); const buffer = @intToPtr([*]volatile u16, 0xB8000); fn initialize() void { var y: usize = 0; while (y < VGA_HEIGHT) : (y += 1) { var x: usize = 0; while (x < VGA_WIDTH) : (x += 1) { putCharAt(' ', color, x, y); } } } fn setColor(new_color: u8) void { color = new_color; } fn putCharAt(c: u8, new_color: u8, x: usize, y: usize) void { const index = y * VGA_WIDTH + x; buffer[index] = vga_entry(c, new_color); } fn putChar(c: u8) void { putCharAt(c, color, column, row); column += 1; if (column == VGA_WIDTH) { column = 0; row += 1; if (row == VGA_HEIGHT) row = 0; } } fn write(data: []const u8) void { for (data) |c| putChar(c); } };
src/main.zig
const std = @import("std"); const Builder = @import("std").build.Builder; const c_flags = &[_][]const u8{ "-mcmodel=medany", "-mno-relax", }; const s_files = &[_][]const u8{ "kernel/entry.S", "kernel/swtch.S", "kernel/trampoline.S", "kernel/kernelvec.S", }; const kernel_c_files = &[_][]const u8{ "kernel/start.c", "kernel/console.c", "kernel/printf.c", "kernel/uart.c", "kernel/kalloc.c", "kernel/spinlock.c", "kernel/string.c", "kernel/main.c", "kernel/vm.c", "kernel/proc.c", "kernel/trap.c", "kernel/syscall.c", "kernel/sysproc.c", "kernel/bio.c", "kernel/fs.c", "kernel/log.c", "kernel/sleeplock.c", "kernel/file.c", "kernel/pipe.c", "kernel/exec.c", "kernel/sysfile.c", "kernel/plic.c", "kernel/virtio_disk.c", }; const uprogs = &[_][]const u8{ "cat", "echo", "forktest", "grep", "init", "kill", "ln", "ls", "mkdir", "rm", "sh", "stressfs", "usertests", "grind", "wc", "zombie", }; pub fn build(b: *Builder) void { // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const mode = b.standardReleaseOptions(); const target = std.zig.CrossTarget { .cpu_arch = std.Target.Cpu.Arch.riscv64, .os_tag = std.Target.Os.Tag.freestanding, .abi = std.Target.Abi.none, }; const kernel = b.addExecutable("kernel", "src/main.zig"); kernel.addIncludeDir("."); kernel.setLinkerScriptPath("kernel/kernel.ld"); for (s_files) |file| { kernel.addAssemblyFile(file); } for (kernel_c_files) |file| { kernel.addCSourceFile(file, c_flags); } kernel.setTarget(target); kernel.setBuildMode(mode); kernel.install(); const ulib = b.addStaticLibrary("ulib", "src/ulib.zig"); ulib.addIncludeDir("."); ulib.addCSourceFile("user/ulib.c", c_flags); ulib.addCSourceFile("user/printf.c", c_flags); ulib.addCSourceFile("user/umalloc.c", c_flags); ulib.setTarget(target); ulib.setBuildMode(mode); ulib.install(); const ulib_slim = b.addStaticLibrary("ulibslim", "src/ulib.zig"); ulib_slim.addIncludeDir("."); ulib_slim.addCSourceFile("user/ulib.c", c_flags); ulib_slim.setTarget(target); ulib_slim.setBuildMode(mode); ulib_slim.install(); const mkfs = b.addExecutable("mkfs", null); mkfs.addIncludeDir("."); mkfs.addCSourceFile("mkfs/mkfs.c", &[_][]const u8{}); mkfs.linkLibC(); mkfs.setBuildMode(mode); mkfs.install(); const fs = mkfs.run(); fs.step.dependOn(&mkfs.step); fs.addArg("fs.img"); b.getInstallStep().dependOn(&fs.step); inline for (uprogs) |uprog| { const c_file = "user/" ++ uprog ++ ".c"; const uprog_bin = b.addExecutable(uprog, "src/rt.zig"); uprog_bin.addIncludeDir("."); uprog_bin.addCSourceFile(c_file, c_flags); uprog_bin.linkLibrary(if (!std.mem.eql(u8, uprog, "forktest")) ulib else ulib_slim); uprog_bin.setTarget(target); uprog_bin.setBuildMode(mode); uprog_bin.install(); fs.addArtifactArg(uprog_bin); } }
build.zig
const c = @import("c.zig"); pub const WindowError = error { InitializationError }; const std = @import("std"); const zlm = @import("zlm"); const Vec2 = zlm.Vec2; // TODO: more inputs and a more efficient way to do them pub const Input = struct { pub const KEY_A = 0; pub const KEY_D = 0; pub const KEY_S = 0; pub const KEY_W = 0; pub const KEY_ESCAPE = 0; pub const KEY_UP = 0; pub const KEY_LEFT = 0; pub const KEY_RIGHT = 0; pub const KEY_DOWN = 0; pub const MouseInputMode = enum { Normal, Hidden, Grabbed }; pub const MouseButton = enum { Left, Middle, Right }; pub const Joystick = struct { id: u4, name: []const u8, /// This doesn't necessarily means the joystick *IS* a gamepad, this means it is registered in the DB. isGamepad: bool, pub const ButtonType = enum { A, B, X, Y, LeftBumper, RightBumper, Back, Start, Guide, LeftThumb, RightThumb, DPad_Up, DPad_Right, DPad_Down, DPad_Left }; pub fn getRawAxes(self: *const Joystick) []const f32 { var count: c_int = 0; const axes = c.glfwGetJoystickAxes(self.id, &count); return axes[0..@intCast(usize, count)]; } pub fn getRawButtons(self: *const Joystick) []bool { var count: c_int = 0; const cButtons = c.glfwGetJoystickButtons(self.id, &count); var cButtonsBool: [15]bool = undefined; var i: usize = 0; while (i < count) { cButtonsBool[i] = cButtons[i] == c.GLFW_PRESS; i += 1; } return cButtonsBool[0..@intCast(usize, count)]; } pub fn getAxes(self: *const Joystick) []const f32 { if (self.isGamepad) { var state: c.GLFWgamepadstate = undefined; _ = c.glfwGetGamepadState(self.id, &state); return state.axes[0..6]; } else { return self.getRawAxes(); } } pub fn isButtonDown(self: *const Joystick, btn: ButtonType) bool { const buttons = self.getButtons(); return buttons[@enumToInt(btn)]; } pub fn getButtons(self: *const Joystick) []bool { if (self.isGamepad) { var state: c.GLFWgamepadstate = undefined; _ = c.glfwGetGamepadState(self.id, &state); var buttons: [15]bool = undefined; for (state.buttons[0..15]) |value, i| { buttons[i] = value == c.GLFW_PRESS; } return buttons[0..]; } else { return self.getRawButtons(); } } }; fn init(self: *const Input) void { c.glfwSetInputMode(self.nativeId, c.GLFW_STICKY_MOUSE_BUTTONS, c.GLFW_TRUE); } /// Returns true if the key is currently being pressed. pub fn isKeyDown(self: *const Input, key: u32) bool { return false; } pub fn getJoystick(self: *const Input, id: u4) ?Joystick { return null; } pub fn isMouseButtonDown(self: *const Input, button: MouseButton) bool { return false; } pub fn getMousePosition(self: *const Input) Vec2 { return undefined; } /// Set the input mode of the mouse. /// This allows to grab, hide or reset to normal the cursor. pub fn setMouseInputMode(self: *const Input, mode: MouseInputMode) void { } pub fn getMouseInputMode(self: *const Input) MouseInputMode { return .Normal; } pub fn update(self: *Input) void { } }; pub const Window = struct { nativeDisplay: *c.Display, nativeId: c.Window, /// The input context of the window input: Input, glCtx: c.GLXContext, /// Create a new window /// By default, the window will be resizable, with empty title and a size of 800x600. pub fn create() !Window { if (!@import("builtin").single_threaded) { _ = c.XInitThreads(); } const dpy = c.XOpenDisplay(null) orelse return WindowError.InitializationError; const screen = c.DefaultScreen(dpy); const root = c.DefaultRootWindow(dpy); const window = try initGLX(dpy, root, screen); _ = c.XFlush(dpy); return Window { .nativeId = window, .nativeDisplay = dpy, .glCtx = undefined, .input = .{ } }; } // TODO: use EGL fn initGLX(dpy: *c.Display, root: c.Window, screen: c_int) !c.Window { var att = [_]c.GLint{c.GLX_RGBA, c.GLX_DEPTH_SIZE, 24, c.GLX_DOUBLEBUFFER, c.None}; const visual = c.glXChooseVisual(dpy, screen, &att[0]) orelse return WindowError.InitializationError; const colormap = c.XCreateColormap(dpy, root, visual.*.visual, c.AllocNone); var swa = c.XSetWindowAttributes { .background_pixmap = c.None, .background_pixel = 0, .border_pixmap = c.CopyFromParent, .border_pixel = 0, .bit_gravity = c.ForgetGravity, .win_gravity = c.NorthWestGravity, .backing_store = c.NotUseful, .backing_planes = 1, .backing_pixel = 0, .save_under = 0, .event_mask = c.ExposureMask | c.PointerMotionMask, .do_not_propagate_mask = 0, .override_redirect = 0, .colormap = colormap, .cursor = c.None }; const window = c.XCreateWindow(dpy, root, 0, 0, 800, 600, 0, visual.*.depth, c.InputOutput, visual.*.visual, c.CWColormap | c.CWEventMask, &swa); _ = c.XMapWindow(dpy, window); const ctx = c.glXCreateContext(dpy, visual, null, c.GL_TRUE); _ = c.glXMakeCurrent(dpy, window, ctx); return window; } pub fn setSize(self: *const Window, width: u32, height: u32) void { } pub fn setPosition(self: *const Window, x: i32, y: i32) void { _ = c.XMoveWindow(self.nativeDisplay, self.nativeId, @intCast(c_int, x), @intCast(c_int, y)); } pub fn setTitle(self: *const Window, title: [:0]const u8) void { _ = c.XStoreName(self.nativeDisplay, self.nativeId, title); } pub fn getPosition(self: *const Window) Vec2 { var wa: c.XWindowAttributes = undefined; _ = c.XGetWindowAttributes(self.nativeDisplay, self.nativeId, &wa); return Vec2.new(@intToFloat(f32, wa.x), @intToFloat(f32, wa.y)); } pub fn getSize(self: *const Window) Vec2 { var wa: c.XWindowAttributes = undefined; _ = c.XGetWindowAttributes(self.nativeDisplay, self.nativeId, &wa); return Vec2.new(@intToFloat(f32, wa.width), @intToFloat(f32, wa.height)); } pub fn getFramebufferSize(self: *const Window) Vec2 { var wa: c.XWindowAttributes = undefined; _ = c.XGetWindowAttributes(self.nativeDisplay, self.nativeId, &wa); return Vec2.new(@intToFloat(f32, wa.width), @intToFloat(f32, wa.height)); } /// Poll events, swap buffer and update input. /// Returns false if the window should be closed and true otherwises. pub fn update(self: *Window) bool { std.time.sleep(16*1000000); // TODO: vsync var pending = c.XPending(self.nativeDisplay); var event: c.XEvent = undefined; var i: c_int = 0; while (i < pending) { _ = c.XNextEvent(self.nativeDisplay, &event); i += 1; } c.glXSwapBuffers(self.nativeDisplay, self.nativeId); return true; } pub fn deinit(self: *Window) void { _ = c.glXMakeCurrent(self.nativeDisplay, c.None, null); _ = c.XDestroyWindow(self.nativeDisplay, self.nativeId); } }; test "" { comptime { std.meta.refAllDecls(Window); std.meta.refAllDecls(Input); } }
didot-x11/window.zig
const std = @import("std"); const expect = std.testing.expect; const test_allocator = std.testing.allocator; const Allocator = std.mem.Allocator; const Crabs = struct { const Self = @This(); allocator: Allocator, robots: []i64, pub fn load(allocator: Allocator, str: []const u8) !Self { var robots = std.ArrayList(i64).init(allocator); defer robots.deinit(); var iter = std.mem.tokenize(u8, str, ","); while (iter.next()) |num| { if (num.len != 0) { const trimmed = std.mem.trimRight(u8, num, "\n"); const value = try std.fmt.parseInt(i64, trimmed, 10); try robots.append(value); } } return Self{ .allocator = allocator, .robots = robots.toOwnedSlice() }; } pub fn deinit(self: *Self) void { self.allocator.free(self.robots); } pub fn cheapestAlignment(self: *Self) !i64 { std.sort.sort(i64, self.robots, {}, comptime std.sort.asc(i64)); const medianIdx = @divFloor(self.robots.len, 2); const median: i64 = self.robots[medianIdx]; var total: i64 = 0; for (self.robots) |r| { total += try std.math.absInt(r - median); } return total; } fn moveCost(dist: i64) i64 { return @divFloor((dist + 1) * dist, 2); } fn costAtPoint(locs: []i64, point: i64) !i64 { var total: i64 = 0; for (locs) |l| { total += moveCost(try std.math.absInt(l - point)); } return total; } pub fn followGradient(locs: []i64, currLoc: i64, cost: i64) !i64 { var costLeft: i64 = 0; if (currLoc <= 0) { costLeft = std.math.maxInt(i64); } else { costLeft = try costAtPoint(locs, currLoc - 1); } const costRight = try costAtPoint(locs, currLoc + 1); if (cost <= costLeft and cost <= costRight) { return cost; } if (costLeft < cost) { return followGradient(locs, currLoc - 1, costLeft); } else { return followGradient(locs, currLoc + 1, costRight); } } pub fn cheapestAlignmentWithCost(self: *Self) !i64 { std.sort.sort(i64, self.robots, {}, comptime std.sort.asc(i64)); const medianIdx = self.robots.len / 2; const median: i64 = self.robots[medianIdx]; const cost = try costAtPoint(self.robots, median); return followGradient(self.robots, median, cost); } }; pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); const str = @embedFile("../input.txt"); var c = try Crabs.load(allocator, str); defer c.deinit(); const stdout = std.io.getStdOut().writer(); const part1 = try c.cheapestAlignment(); try stdout.print("Part 1: {d}\n", .{part1}); const part2 = try c.cheapestAlignmentWithCost(); try stdout.print("Part 2: {d}\n", .{part2}); } test "part1 test" { const str = @embedFile("../test.txt"); var c = try Crabs.load(test_allocator, str); defer c.deinit(); const score = try c.cheapestAlignment(); std.debug.print("\nScore={d}\n", .{score}); try expect(37 == score); } test "part2 test" { const str = @embedFile("../test.txt"); var c = try Crabs.load(test_allocator, str); defer c.deinit(); const score = try c.cheapestAlignmentWithCost(); std.debug.print("\nScore={d}\n", .{score}); try expect(168 == score); }
day07/src/main.zig
pub const COMPRESS_ALGORITHM_INVALID = @as(u32, 0); pub const COMPRESS_ALGORITHM_NULL = @as(u32, 1); pub const COMPRESS_ALGORITHM_MAX = @as(u32, 6); pub const COMPRESS_RAW = @as(u32, 536870912); //-------------------------------------------------------------------------------- // Section: Types (6) //-------------------------------------------------------------------------------- pub const COMPRESS_ALGORITHM = enum(u32) { MSZIP = 2, XPRESS = 3, XPRESS_HUFF = 4, LZMS = 5, }; pub const COMPRESS_ALGORITHM_MSZIP = COMPRESS_ALGORITHM.MSZIP; pub const COMPRESS_ALGORITHM_XPRESS = COMPRESS_ALGORITHM.XPRESS; pub const COMPRESS_ALGORITHM_XPRESS_HUFF = COMPRESS_ALGORITHM.XPRESS_HUFF; pub const COMPRESS_ALGORITHM_LZMS = COMPRESS_ALGORITHM.LZMS; // TODO: this type has a FreeFunc 'CloseDecompressor', what can Zig do with this information? pub const COMPRESSOR_HANDLE = isize; pub const PFN_COMPRESS_ALLOCATE = fn( UserContext: ?*anyopaque, Size: usize, ) callconv(@import("std").os.windows.WINAPI) ?*anyopaque; pub const PFN_COMPRESS_FREE = fn( UserContext: ?*anyopaque, Memory: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) void; pub const COMPRESS_ALLOCATION_ROUTINES = extern struct { Allocate: ?PFN_COMPRESS_ALLOCATE, Free: ?PFN_COMPRESS_FREE, UserContext: ?*anyopaque, }; pub const COMPRESS_INFORMATION_CLASS = enum(i32) { INVALID = 0, BLOCK_SIZE = 1, LEVEL = 2, }; pub const COMPRESS_INFORMATION_CLASS_INVALID = COMPRESS_INFORMATION_CLASS.INVALID; pub const COMPRESS_INFORMATION_CLASS_BLOCK_SIZE = COMPRESS_INFORMATION_CLASS.BLOCK_SIZE; pub const COMPRESS_INFORMATION_CLASS_LEVEL = COMPRESS_INFORMATION_CLASS.LEVEL; //-------------------------------------------------------------------------------- // Section: Functions (12) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn CreateCompressor( Algorithm: COMPRESS_ALGORITHM, AllocationRoutines: ?*COMPRESS_ALLOCATION_ROUTINES, CompressorHandle: ?*isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn SetCompressorInformation( CompressorHandle: COMPRESSOR_HANDLE, CompressInformationClass: COMPRESS_INFORMATION_CLASS, // TODO: what to do with BytesParamIndex 3? CompressInformation: ?*const anyopaque, CompressInformationSize: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn QueryCompressorInformation( CompressorHandle: COMPRESSOR_HANDLE, CompressInformationClass: COMPRESS_INFORMATION_CLASS, // TODO: what to do with BytesParamIndex 3? CompressInformation: ?*anyopaque, CompressInformationSize: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn Compress( CompressorHandle: COMPRESSOR_HANDLE, // TODO: what to do with BytesParamIndex 2? UncompressedData: ?*const anyopaque, UncompressedDataSize: usize, // TODO: what to do with BytesParamIndex 4? CompressedBuffer: ?*anyopaque, CompressedBufferSize: usize, CompressedDataSize: ?*usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn ResetCompressor( CompressorHandle: COMPRESSOR_HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn CloseCompressor( CompressorHandle: COMPRESSOR_HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn CreateDecompressor( Algorithm: COMPRESS_ALGORITHM, AllocationRoutines: ?*COMPRESS_ALLOCATION_ROUTINES, DecompressorHandle: ?*isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn SetDecompressorInformation( DecompressorHandle: isize, CompressInformationClass: COMPRESS_INFORMATION_CLASS, // TODO: what to do with BytesParamIndex 3? CompressInformation: ?*const anyopaque, CompressInformationSize: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn QueryDecompressorInformation( DecompressorHandle: isize, CompressInformationClass: COMPRESS_INFORMATION_CLASS, // TODO: what to do with BytesParamIndex 3? CompressInformation: ?*anyopaque, CompressInformationSize: usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn Decompress( DecompressorHandle: isize, // TODO: what to do with BytesParamIndex 2? CompressedData: ?*const anyopaque, CompressedDataSize: usize, // TODO: what to do with BytesParamIndex 4? UncompressedBuffer: ?*anyopaque, UncompressedBufferSize: usize, UncompressedDataSize: ?*usize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn ResetDecompressor( DecompressorHandle: isize, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.0' pub extern "Cabinet" fn CloseDecompressor( DecompressorHandle: isize, ) 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 (1) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PFN_COMPRESS_ALLOCATE")) { _ = PFN_COMPRESS_ALLOCATE; } if (@hasDecl(@This(), "PFN_COMPRESS_FREE")) { _ = PFN_COMPRESS_FREE; } @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/storage/compression.zig
const std = @import("std"); const zwin32 = @import("../../libs/zwin32/build.zig"); const ztracy = @import("../../libs/ztracy/build.zig"); const zd3d12 = @import("../../libs/zd3d12/build.zig"); const zmesh = @import("../../libs/zmesh/build.zig"); const common = @import("../../libs/common/build.zig"); const Options = @import("../../build.zig").Options; const content_dir = "physically_based_rendering_content/"; pub fn build(b: *std.build.Builder, options: Options) *std.build.LibExeObjStep { const exe_options = b.addOptions(); exe_options.addOption(bool, "enable_pix", options.enable_pix); exe_options.addOption(bool, "enable_dx_debug", options.enable_dx_debug); exe_options.addOption(bool, "enable_dx_gpu_debug", options.enable_dx_gpu_debug); exe_options.addOption(bool, "enable_tracy", options.enable_tracy); exe_options.addOption(bool, "enable_d2d", false); exe_options.addOption([]const u8, "content_dir", content_dir); const exe = b.addExecutable( "physically_based_rendering", thisDir() ++ "/src/physically_based_rendering.zig", ); exe.setBuildMode(options.build_mode); exe.setTarget(options.target); exe.addOptions("build_options", exe_options); const dxc_step = buildShaders(b); const install_content_step = b.addInstallDirectory(.{ .source_dir = thisDir() ++ "/" ++ content_dir, .install_dir = .{ .custom = "" }, .install_subdir = "bin/" ++ content_dir, }); install_content_step.step.dependOn(dxc_step); exe.step.dependOn(&install_content_step.step); // This is needed to export symbols from an .exe file. // We export D3D12SDKVersion and D3D12SDKPath symbols which // is required by DirectX 12 Agility SDK. exe.rdynamic = true; exe.want_lto = false; const options_pkg = exe_options.getPackage("build_options"); exe.addPackage(ztracy.getPkg(b, options_pkg)); exe.addPackage(zd3d12.getPkg(b, options_pkg)); exe.addPackage(common.getPkg(b, options_pkg)); exe.addPackage(zmesh.pkg); exe.addPackage(zwin32.pkg); ztracy.link(exe, options.enable_tracy, .{}); zd3d12.link(exe); zmesh.link(exe); common.link(exe); return exe; } fn buildShaders(b: *std.build.Builder) *std.build.Step { const dxc_step = b.step("physically_based_rendering-dxc", "Build shaders for 'physically based rendering' demo"); var dxc_command = makeDxcCmd( "../../libs/common/src/hlsl/common.hlsl", "vsImGui", "imgui.vs.cso", "vs", "PSO__IMGUI", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "../../libs/common/src/hlsl/common.hlsl", "psImGui", "imgui.ps.cso", "ps", "PSO__IMGUI", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "../../libs/common/src/hlsl/common.hlsl", "csGenerateMipmaps", "generate_mipmaps.cs.cso", "cs", "PSO__GENERATE_MIPMAPS", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "vsMeshPbr", "mesh_pbr.vs.cso", "vs", "PSO__MESH_PBR", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "psMeshPbr", "mesh_pbr.ps.cso", "ps", "PSO__MESH_PBR", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "vsGenerateEnvTexture", "generate_env_texture.vs.cso", "vs", "PSO__GENERATE_ENV_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "psGenerateEnvTexture", "generate_env_texture.ps.cso", "ps", "PSO__GENERATE_ENV_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "vsSampleEnvTexture", "sample_env_texture.vs.cso", "vs", "PSO__SAMPLE_ENV_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "psSampleEnvTexture", "sample_env_texture.ps.cso", "ps", "PSO__SAMPLE_ENV_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "vsGenerateIrradianceTexture", "generate_irradiance_texture.vs.cso", "vs", "PSO__GENERATE_IRRADIANCE_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "psGenerateIrradianceTexture", "generate_irradiance_texture.ps.cso", "ps", "PSO__GENERATE_IRRADIANCE_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "vsGeneratePrefilteredEnvTexture", "generate_prefiltered_env_texture.vs.cso", "vs", "PSO__GENERATE_PREFILTERED_ENV_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "psGeneratePrefilteredEnvTexture", "generate_prefiltered_env_texture.ps.cso", "ps", "PSO__GENERATE_PREFILTERED_ENV_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); dxc_command = makeDxcCmd( "src/physically_based_rendering.hlsl", "csGenerateBrdfIntegrationTexture", "generate_brdf_integration_texture.cs.cso", "cs", "PSO__GENERATE_BRDF_INTEGRATION_TEXTURE", ); dxc_step.dependOn(&b.addSystemCommand(&dxc_command).step); return dxc_step; } fn makeDxcCmd( comptime input_path: []const u8, comptime entry_point: []const u8, comptime output_filename: []const u8, comptime profile: []const u8, comptime define: []const u8, ) [9][]const u8 { const shader_ver = "6_6"; const shader_dir = thisDir() ++ "/" ++ content_dir ++ "shaders/"; return [9][]const u8{ thisDir() ++ "/../../libs/zwin32/bin/x64/dxc.exe", thisDir() ++ "/" ++ input_path, "/E " ++ entry_point, "/Fo " ++ shader_dir ++ output_filename, "/T " ++ profile ++ "_" ++ shader_ver, if (define.len == 0) "" else "/D " ++ define, "/WX", "/Ges", "/O3", }; } fn thisDir() []const u8 { return std.fs.path.dirname(@src().file) orelse "."; }
samples/physically_based_rendering/build.zig
const std = @import("std"); const assert = std.debug.assert; usingnamespace @import("tigerbeetle.zig"); pub const Header = @import("vr.zig").Header; pub const Operation = @import("state_machine.zig").Operation; var accounts = [_]Account{ Account{ .id = 1, .custom = 0, .flags = .{}, .unit = 2, .debit_reserved = 0, .debit_accepted = 0, .credit_reserved = 0, .credit_accepted = 0, .debit_reserved_limit = 1000_000_000, .debit_accepted_limit = 1000_000_000, .credit_reserved_limit = 0, .credit_accepted_limit = 0, }, Account{ .id = 2, .custom = 0, .flags = .{}, .unit = 2, .debit_reserved = 0, .debit_accepted = 0, .credit_reserved = 0, .credit_accepted = 0, .debit_reserved_limit = 0, .debit_accepted_limit = 0, .credit_reserved_limit = 1000_000_000, .credit_accepted_limit = 1000_000_000, }, }; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); // Pre-allocate a million transfers: var transfers = try arena.allocator.alloc(Transfer, 1_000_000); for (transfers) |*transfer, index| { transfer.* = .{ .id = index, .debit_account_id = accounts[0].id, .credit_account_id = accounts[1].id, .custom_1 = 0, .custom_2 = 0, .custom_3 = 0, .flags = .{}, .amount = 1, .timeout = 0, }; } // Pre-allocate a million commits: var commits = try arena.allocator.alloc(Commit, 1_000_000); for (commits) |*commit, index| { commit.* = .{ .id = index, .custom_1 = 0, .custom_2 = 0, .custom_3 = 0, .flags = .{ .accept = true }, }; } var addr = try std.net.Address.parseIp4("127.0.0.1", config.port); std.debug.print("connecting to {}...\n", .{addr}); var connection = try std.net.tcpConnectToAddress(addr); const fd = connection.handle; defer std.os.close(fd); std.debug.print("connected to tigerbeetle\n", .{}); // Create our two accounts if necessary: std.debug.print("creating accounts...\n", .{}); try send(fd, .create_accounts, std.mem.asBytes(accounts[0..]), CreateAccountResults); // Start the benchmark: const start = std.time.milliTimestamp(); var max_create_transfers_latency: i64 = 0; var max_commit_transfers_latency: i64 = 0; var offset: u64 = 0; while (offset < transfers.len) { // Create a batch of 10,000 transfers: const ms1 = std.time.milliTimestamp(); var batch_transfers = transfers[offset..][0..10000]; try send( fd, .create_transfers, std.mem.asBytes(batch_transfers[0..]), CreateTransferResults, ); const ms2 = std.time.milliTimestamp(); var create_transfers_latency = ms2 - ms1; if (create_transfers_latency > max_create_transfers_latency) { max_create_transfers_latency = create_transfers_latency; } // Commit this batch: var batch_commits = commits[offset..][0..10000]; try send(fd, .commit_transfers, std.mem.asBytes(batch_commits[0..]), CommitTransferResults); const ms3 = std.time.milliTimestamp(); var commit_transfers_latency = ms3 - ms2; if (commit_transfers_latency > max_commit_transfers_latency) { max_commit_transfers_latency = commit_transfers_latency; } offset += batch_transfers.len; if (@mod(offset, 100000) == 0) { var space = if (offset == 1000000) "" else " "; std.debug.print("{s}{} transfers...\n", .{ space, offset }); } } const ms = std.time.milliTimestamp() - start; std.debug.print("=============================\n", .{}); std.debug.print("{} transfers per second\n\n", .{ @divFloor(@intCast(i64, transfers.len * 1000), ms), }); std.debug.print("create_transfers max p100 latency per 10,000 transfers = {}ms\n", .{ max_create_transfers_latency, }); std.debug.print("commit_transfers max p100 latency per 10,000 transfers = {}ms\n", .{ max_commit_transfers_latency, }); } const cluster_id: u128 = 746649394563965214; // a5ca1ab1ebee11e const client_id: u128 = 123; var request_number: u32 = 0; fn send(fd: std.os.fd_t, operation: Operation, body: []u8, comptime Result: anytype) !void { request_number += 1; var request = Header{ .cluster = cluster_id, .client = client_id, .view = 0, .request = request_number, .command = .request, .operation = operation, .size = @intCast(u32, @sizeOf(Header) + body.len), }; request.set_checksum_body(body[0..]); request.set_checksum(); const header = std.mem.asBytes(&request); assert((try std.os.sendto(fd, header[0..], 0, null, 0)) == header.len); if (body.len > 0) { assert((try std.os.sendto(fd, body[0..], 0, null, 0)) == body.len); } var recv: [1024 * 1024]u8 = undefined; var recv_size: u64 = 0; while (recv_size < @sizeOf(Header)) { var recv_bytes = try std.os.recvfrom(fd, recv[recv_size..], 0, null, null); if (recv_bytes == 0) @panic("server closed the connection (while waiting for header)"); recv_size += recv_bytes; } var response = std.mem.bytesAsValue(Header, recv[0..@sizeOf(Header)]); var print_response = response.size > @sizeOf(Header); if (print_response) std.debug.print("{}\n", .{response}); assert(response.valid_checksum()); while (recv_size < response.size) { var recv_bytes = try std.os.recvfrom(fd, recv[recv_size..], 0, null, null); if (recv_bytes == 0) @panic("server closed the connection (while waiting for body)"); recv_size += recv_bytes; } const response_body = recv[@sizeOf(Header)..response.size]; assert(response.valid_checksum_body(response_body)); if (print_response) { for (std.mem.bytesAsSlice(Result, response_body)) |result| { std.debug.print("{}\n", .{result}); } @panic("restart the cluster to do a 'clean slate' benchmark"); } }
src/benchmark.zig
// DO NOT MODIFY. This is not actually a source file; it is a textual representation of generated code. // Use only for debugging purposes. // Auto-generated constructor // Access: public Method <init> : V ( // (no arguments) ) { ALOAD 0 // Method descriptor: ()V INVOKESPECIAL java/lang/Object#<init> RETURN } // Access: private static Method registerClass72 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.BinaryLogicOperatorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass60 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.sql.ResultSet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass129 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.quarkus.resteasy.runtime.RolesFilterRegistrar" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass117 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.CompletionStageProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass105 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.jsonb.AbstractJsonBindingProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: public Method beforeAnalysis : V ( arg 1 = Lorg/graalvm/nativeimage/hosted/Feature$BeforeAnalysisAccess; ) { ** label1 ** label2 LDC (Type) Lorg/graalvm/nativeimage/impl/RuntimeClassInitializationSupport; // Method descriptor: (Ljava/lang/Class;)Ljava/lang/Object; INVOKESTATIC org/graalvm/nativeimage/ImageSingletons#lookup ASTORE 3 LDC (Type) Lio/quarkus/runner/AutoFeature; // Method descriptor: ()Ljava/lang/ClassLoader; INVOKEVIRTUAL java/lang/Class#getClassLoader ASTORE 2 ** label3 LDC (String) "io.quarkus.runtime.ExecutorRecorder" LDC (Boolean) false ALOAD 2 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 4 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 4 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#initializeAtRunTime ** label4 GOTO label5 ** label6 ASTORE 5 ALOAD 5 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label7 GOTO label5 // Try from label3 to label4 // Catch java/lang/Throwable by going to label6 ** label5 ** label8 LDC (String) "org.jboss.logmanager.formatters.TrueColorHolder" LDC (Boolean) false ALOAD 2 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 6 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 6 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#initializeAtRunTime ** label9 GOTO label10 ** label11 ASTORE 7 ALOAD 7 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label12 GOTO label10 // Try from label8 to label9 // Catch java/lang/Throwable by going to label11 ** label10 ** label13 LDC (String) "com.arjuna.ats.internal.jta.resources.arjunacore.CommitMarkableResourceRecord" LDC (Boolean) false ALOAD 2 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 8 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 8 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#initializeAtRunTime ** label14 GOTO label15 ** label16 ASTORE 9 ALOAD 9 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label17 GOTO label15 // Try from label13 to label14 // Catch java/lang/Throwable by going to label16 ** label15 ** label18 LDC (String) "io.undertow.server.protocol.ajp.AjpServerResponseConduit" LDC (Boolean) false ALOAD 2 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 10 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 10 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#initializeAtRunTime ** label19 GOTO label20 ** label21 ASTORE 11 ALOAD 11 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label22 GOTO label20 // Try from label18 to label19 // Catch java/lang/Throwable by going to label21 ** label20 ** label23 LDC (String) "io.undertow.server.protocol.ajp.AjpServerRequestConduit" LDC (Boolean) false ALOAD 2 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 12 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 12 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#initializeAtRunTime ** label24 GOTO label25 ** label26 ASTORE 13 ALOAD 13 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label27 GOTO label25 // Try from label23 to label24 // Catch java/lang/Throwable by going to label26 ** label25 ** label28 LDC (String) "io.quarkus.runtime.generated.RunTimeConfig" LDC (Boolean) false ALOAD 2 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 14 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 14 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#initializeAtRunTime ** label29 GOTO label30 ** label31 ASTORE 15 ALOAD 15 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label32 GOTO label30 // Try from label28 to label29 // Catch java/lang/Throwable by going to label31 ** label30 LDC (Type) Lio/quarkus/runner/AutoFeature; // Method descriptor: ()Ljava/lang/ClassLoader; INVOKEVIRTUAL java/lang/Class#getClassLoader ASTORE 16 ** label33 LDC (String) "org.wildfly.common.net.HostName" LDC (Boolean) false ALOAD 16 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 17 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 17 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#rerunInitialization ** label34 GOTO label35 ** label36 ASTORE 18 ALOAD 18 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label37 GOTO label35 // Try from label33 to label34 // Catch java/lang/Throwable by going to label36 ** label35 ** label38 LDC (String) "org.wildfly.common.os.Process" LDC (Boolean) false ALOAD 16 // Method descriptor: (Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 19 ALOAD 3 CHECKCAST org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport ALOAD 19 LDC (String) "Quarkus" // Method descriptor: (Ljava/lang/Class;Ljava/lang/String;)V INVOKEINTERFACE org/graalvm/nativeimage/impl/RuntimeClassInitializationSupport#rerunInitialization ** label39 GOTO label40 ** label41 ASTORE 20 ALOAD 20 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label42 GOTO label40 // Try from label38 to label39 // Catch java/lang/Throwable by going to label41 ** label40 LDC (String) "META-INF/build-config.properties" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (String) "META-INF/quarkus-default-config.properties" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (String) "META-INF/services/io.agroal.api.security.AgroalSecurityProvider" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (String) "import.sql" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (String) "import.sql" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (String) "META-INF/services/javax.ws.rs.client.ClientBuilder" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (String) "META-INF/services/org.jboss.logmanager.EmbeddedConfigurator" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (String) "META-INF/services/org.eclipse.yasson.spi.JsonbComponentInstanceCreator" // Method descriptor: (Ljava/lang/String;)V INVOKESTATIC io/quarkus/runtime/ResourceHelper#registerResources LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 21 ALOAD 21 LDC (Integer) 0 LDC (Type) Ljava/lang/String; AASTORE LDC (Type) Lcom/oracle/svm/core/jdk/LocalizationSupport; LDC (String) "addBundleToCache" ALOAD 21 // Method descriptor: (Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethod ASTORE 23 ALOAD 23 CHECKCAST java/lang/reflect/AccessibleObject LDC (Boolean) true // Method descriptor: (Z)V INVOKEVIRTUAL java/lang/reflect/AccessibleObject#setAccessible LDC (Type) Lcom/oracle/svm/core/jdk/LocalizationSupport; // Method descriptor: (Ljava/lang/Class;)Ljava/lang/Object; INVOKESTATIC org/graalvm/nativeimage/ImageSingletons#lookup ASTORE 22 ** label43 LDC (Integer) 1 ANEWARRAY java/lang/Object ASTORE 24 ALOAD 24 LDC (Integer) 0 LDC (String) "yasson-messages" AASTORE ALOAD 23 ALOAD 22 ALOAD 24 // Method descriptor: (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; INVOKEVIRTUAL java/lang/reflect/Method#invoke POP ** label44 GOTO label45 ** label46 POP ** label47 GOTO label45 // Try from label43 to label44 // Catch java/lang/Throwable by going to label46 ** label45 ** label48 LDC (Integer) 1 ANEWARRAY java/lang/Object ASTORE 25 ALOAD 25 LDC (Integer) 0 LDC (String) "messages" AASTORE ALOAD 23 ALOAD 22 ALOAD 25 // Method descriptor: (Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; INVOKEVIRTUAL java/lang/reflect/Method#invoke POP ** label49 GOTO label50 ** label51 POP ** label52 GOTO label50 // Try from label48 to label49 // Catch java/lang/Throwable by going to label51 ** label50 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass0 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass1 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass2 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass3 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass4 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass5 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass6 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass7 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass8 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass9 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass10 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass11 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass12 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass13 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass14 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass15 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass16 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass17 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass18 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass19 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass20 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass21 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass22 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass23 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass24 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass25 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass26 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass27 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass28 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass29 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass30 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass31 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass32 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass33 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass34 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass35 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass36 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass37 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass38 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass39 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass40 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass41 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass42 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass43 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass44 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass45 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass46 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass47 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass48 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass49 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass50 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass51 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass52 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass53 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass54 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass55 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass56 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass57 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass58 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass59 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass60 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass61 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass62 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass63 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass64 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass65 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass66 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass67 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass68 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass69 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass70 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass71 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass72 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass73 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass74 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass75 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass76 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass77 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass78 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass79 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass80 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass81 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass82 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass83 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass84 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass85 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass86 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass87 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass88 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass89 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass90 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass91 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass92 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass93 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass94 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass95 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass96 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass97 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass98 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass99 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass100 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass101 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass102 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass103 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass104 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass105 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass106 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass107 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass108 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass109 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass110 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass111 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass112 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass113 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass114 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass115 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass116 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass117 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass118 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass119 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass120 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass121 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass122 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass123 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass124 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass125 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass126 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass127 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass128 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass129 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass130 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass131 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass132 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass133 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass134 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass135 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass136 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass137 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass138 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass139 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass140 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass141 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass142 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass143 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass144 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass145 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass146 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass147 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass148 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass149 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass150 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass151 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass152 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass153 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass154 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass155 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass156 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass157 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass158 // Method descriptor: ()V INVOKESTATIC io/quarkus/runner/AutoFeature#registerClass159 ** label53 GOTO label54 ** label55 ASTORE 26 ALOAD 26 // Method descriptor: ()V INVOKEVIRTUAL java/lang/Throwable#printStackTrace ** label56 GOTO label54 // Try from label2 to label53 // Catch java/lang/Throwable by going to label55 ** label54 RETURN ** label57 } // Access: private static Method registerClass28 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.arjuna.ats.jta.UserTransaction" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass16 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.tuple.entity.PojoEntityTuplizer" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass104 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.pursuitbank.models.Location" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass68 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass56 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.agroal.api.security.AgroalDefaultSecurityProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass44 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.CastFunctionNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass156 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.quarkus.smallrye.health.runtime.SmallRyeReadinessServlet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass32 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.Node" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass144 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.eclipse.microprofile.health.Health" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass20 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.persister.entity.SingleTableEntityPersister" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass132 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.DataSourceProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass2 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.github.benmanes.caffeine.cache.PSA" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass96 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.LiteralNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass120 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.FileProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass84 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.DotNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass61 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "[Ljava.sql.ResultSet;" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass118 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.interceptors.ClientContentEncodingAnnotationFeature" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass106 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.pursuitbank.database.CustomerResource" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass29 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.arjuna.ats.jta.TransactionManager" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass17 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.tuple.component.PojoComponentTuplizer" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass69 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.arjuna.ats.internal.arjuna.coordinator.CheckedActionFactoryImple" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass1 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.github.benmanes.caffeine.cache.SSMSA" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass57 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.agroal.api.security.AgroalKerberosSecurityProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass45 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.MapKeyEntityFromElement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass157 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.quarkus.undertow.runtime.HttpSessionContext" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass33 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.SelectClause" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass145 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.eclipse.microprofile.config.inject.ConfigProperty" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass21 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.persister.entity.JoinedSubclassEntityPersister" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass133 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.FileRangeWriter" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass97 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.BinaryArithmeticOperatorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass121 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.context.ContextFeature" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass85 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.ResultVariableRefNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass73 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.CountNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass50 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.JavaConstantNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass90 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.SimpleCaseNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass119 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.jsonb.JsonBindingProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass107 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.openshift.booster.database.FruitResource" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass150 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "javax.enterprise.inject.Intercepted" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass18 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.persister.collection.OneToManyPersister" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass58 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "[Ljava.sql.Statement;" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass46 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.DeleteStatement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass158 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.quarkus.runtime.logging.InitialConfigurator" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass34 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.HqlSqlWalkerNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass146 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "javax.enterprise.inject.Any" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass22 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.persister.entity.UnionSubclassEntityPersister" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass134 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.InputStreamProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass4 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.github.benmanes.caffeine.cache.PSWMS" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass10 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.LinkedHashMap" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass98 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "antlr.CommonToken" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass122 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.interceptors.MessageSanitizerContainerResponseFilter" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass86 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.BetweenOperatorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass110 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.api.validation.ResteasyConstraintViolation" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass74 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.IsNullLogicOperatorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass62 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.ImpliedFromElement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass91 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.AbstractMapComponentNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass108 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.openshift.booster.http.GreetingEndpoint" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass151 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass19 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.persister.collection.BasicCollectionPersister" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass59 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.sql.Statement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass47 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.SqlNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass159 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.quarkus.jsonb.QuarkusJsonbComponentInstanceCreator" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass35 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.MethodNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass147 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "javax.inject.Named" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass23 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass135 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.jsonp.JsonValueProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass11 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.LinkedHashSet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass99 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.internal.CoreMessageLogger_$logger" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass123 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.MultiValuedParamConverterProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass87 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.AggregateNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass111 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.sse.SseEventOutputProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass75 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.IdentNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass63 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.IsNotNullLogicOperatorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass3 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.github.benmanes.caffeine.cache.PSW" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass51 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.SelectExpressionList" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass92 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.FromReferenceNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass7 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.HashMap" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass80 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.MapValueNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass109 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.api.validation.ViolationReport" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass149 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "javax.enterprise.context.Initialized" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass140 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "javax.enterprise.context.BeforeDestroyed" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass48 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.SearchedCaseNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass36 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.AbstractStatement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass148 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.eclipse.microprofile.health.Liveness" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass24 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.id.enhanced.SequenceStyleGenerator" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass136 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.microprofile.config.ServletConfigSource" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass12 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.TreeMap" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass124 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.jsonp.JsonArrayProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass88 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.QueryNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass112 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.jsonp.JsonObjectProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass76 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.ComponentJoin" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass100 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.openshift.booster.database.Fruit" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass64 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.InsertStatement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass52 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.SqlFragment" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass40 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.IntoClause" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass152 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.undertow.servlet.handlers.DefaultServlet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass93 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.OrderByClause" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass6 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.ArrayList" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass81 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.InLogicOperatorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass138 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.microprofile.config.FilterConfigSource" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass49 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.FromElement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass37 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.EntityJoinFromElement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass25 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass137 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.microprofile.config.ServletContextConfigSource" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass13 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.TreeSet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass125 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.ByteArrayProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass89 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.BooleanLiteralNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass113 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.DefaultTextPlain" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass77 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.ParameterNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass101 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.pursuitbank.models.Company" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass65 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.UnaryArithmeticNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass5 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.h2.Driver" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass53 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.MapKeyNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass41 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.AbstractRestrictableStatement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass153 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.undertow.server.protocol.http.HttpRequestParser$$generated" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass141 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "javax.enterprise.inject.Default" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass94 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.FromClause" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass9 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.LinkedList" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass82 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.IndexNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass70 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass139 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.openshift.booster.http.Greeting" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass127 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.jsonp.JsonStructureProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass38 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.UnaryLogicOperatorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass26 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass0 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.github.benmanes.caffeine.cache.SSA" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass14 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.eclipse.yasson.JsonBindingProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass126 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.StringTextStar" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass114 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.ReactiveStreamProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass78 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.AbstractSelectExpression" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass102 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.pursuitbank.models.Customer" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass66 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.CollectionFunction" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass54 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "[Lio.agroal.pool.ConnectionHandler;" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass42 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.UpdateStatement" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass154 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.quarkus.smallrye.health.runtime.SmallRyeHealthServlet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass30 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass142 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "javax.enterprise.context.Destroyed" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass130 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.ReaderProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass8 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "java.util.HashSet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass83 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.AbstractNullnessCheckNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass71 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass128 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.StreamingOutputProvider" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass116 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.interceptors.ServerContentEncodingAnnotationFeature" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass39 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.NullNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass27 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.type.EnumType" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass15 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.glassfish.json.JsonProviderImpl" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass115 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.interceptors.CacheControlFeature" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass79 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.MapEntryNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass103 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.pursuitbank.models.Offer" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields ASTORE 4 LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register LDC (Boolean) false ALOAD 4 // Method descriptor: (Z[Ljava/lang/reflect/Field;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass67 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "com.arjuna.ats.jta.common.JTAEnvironmentBean" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass55 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.agroal.pool.ConnectionHandler" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass43 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.SelectExpressionImpl" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass155 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "io.quarkus.smallrye.health.runtime.SmallRyeLivenessServlet" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass31 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.HqlToken" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass143 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.eclipse.microprofile.health.Readiness" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods ASTORE 3 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 3 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass131 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.jboss.resteasy.plugins.providers.sse.SseEventSinkInterceptor" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 } // Access: private static Method registerClass95 : V ( // (no arguments) ) { ** label1 ** label2 LDC (String) "org.hibernate.hql.internal.ast.tree.ConstructorNode" // Method descriptor: (Ljava/lang/String;)Ljava/lang/Class; INVOKESTATIC java/lang/Class#forName ASTORE 0 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Constructor; INVOKEVIRTUAL java/lang/Class#getDeclaredConstructors ASTORE 2 ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Method; INVOKEVIRTUAL java/lang/Class#getDeclaredMethods POP ALOAD 0 // Method descriptor: ()[Ljava/lang/reflect/Field; INVOKEVIRTUAL java/lang/Class#getDeclaredFields POP LDC (Integer) 1 ANEWARRAY java/lang/Class ASTORE 1 ALOAD 1 LDC (Integer) 0 ALOAD 0 AASTORE ALOAD 1 // Method descriptor: ([Ljava/lang/Class;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ALOAD 2 CHECKCAST [Ljava/lang/reflect/Executable; // Method descriptor: ([Ljava/lang/reflect/Executable;)V INVOKESTATIC org/graalvm/nativeimage/hosted/RuntimeReflection#register ** label3 GOTO label4 ** label5 POP ** label6 GOTO label4 // Try from label2 to label3 // Catch java/lang/Throwable by going to label5 ** label4 RETURN ** label7 }
target/generated-sources/gizmo/io/quarkus/runner/AutoFeature.zig
comptime { asm ( \\.section .text.start \\.globl _start \\_start: \\ .long __stack_start \\ .long ipl_main \\ .long nm_interrupt \\ .long hard_fault \\ .long irq4 \\ .long irq5 \\ .long irq6 \\ .long irq7 \\ .long irq8 \\ .long irq9 \\ .long irq10 \\ .long sv_call \\ .long irq12 \\ .long irq13 \\ .long pend_sv \\ .long sys_tick \\ .long irq16 \\ .long irq17 \\ .long irq18 \\ .long irq19 \\ .long irq20 \\ .long irq21 \\ .long irq22 \\ .long irq23 \\ .long irq24 \\ .long irq25 \\ .long irq26 \\ .long irq27 \\ .long irq28 \\ .long irq29 \\ .long irq30 \\ .long irq31 \\ .long irq32 \\ .long irq33 \\ .long irq34 \\ .long irq35 \\ .long irq36 \\ .long irq37 \\ .long irq38 \\ .long irq39 \\ .long irq40 \\ .long irq41 \\ .long irq42 \\ .long irq43 \\ .long irq44 \\ .long irq45 \\ .long irq46 \\ .long irq47 ); } extern var __bss_start: u8; extern var __bss_end: u8; export fn ipl_main() noreturn { // zero-fill bss section @memset(@ptrCast(*volatile [1]u8, &__bss_start), 0, @ptrToInt(&__bss_end) - @ptrToInt(&__bss_start)); // call the main routine @import("main.zig").hako_main(); // do infinite loop //while(true) {} } // default interrupt handler fn default_handler() noreturn { while(true) {} } // interrupt handlers export fn nm_interrupt() noreturn { default_handler(); } export fn hard_fault() noreturn { default_handler(); } export fn irq4() noreturn { default_handler(); } export fn irq5() noreturn { default_handler(); } export fn irq6() noreturn { default_handler(); } export fn irq7() noreturn { default_handler(); } export fn irq8() noreturn { default_handler(); } export fn irq9() noreturn { default_handler(); } export fn irq10() noreturn { default_handler(); } export fn sv_call() noreturn { default_handler(); } export fn irq12() noreturn { default_handler(); } export fn irq13() noreturn { default_handler(); } export fn pend_sv() noreturn { default_handler(); } export fn sys_tick() noreturn { default_handler(); } export fn irq16() noreturn { default_handler(); } export fn irq17() noreturn { default_handler(); } export fn irq18() noreturn { default_handler(); } export fn irq19() noreturn { default_handler(); } export fn irq20() noreturn { default_handler(); } export fn irq21() noreturn { default_handler(); } export fn irq22() noreturn { default_handler(); } export fn irq23() noreturn { default_handler(); } export fn irq24() noreturn { default_handler(); } export fn irq25() noreturn { default_handler(); } export fn irq26() noreturn { default_handler(); } export fn irq27() noreturn { default_handler(); } export fn irq28() noreturn { default_handler(); } export fn irq29() noreturn { default_handler(); } export fn irq30() noreturn { default_handler(); } export fn irq31() noreturn { default_handler(); } export fn irq32() noreturn { default_handler(); } export fn irq33() noreturn { default_handler(); } export fn irq34() noreturn { default_handler(); } export fn irq35() noreturn { default_handler(); } export fn irq36() noreturn { default_handler(); } export fn irq37() noreturn { default_handler(); } export fn irq38() noreturn { default_handler(); } export fn irq39() noreturn { default_handler(); } export fn irq40() noreturn { default_handler(); } export fn irq41() noreturn { default_handler(); } export fn irq42() noreturn { default_handler(); } export fn irq43() noreturn { default_handler(); } export fn irq44() noreturn { default_handler(); } export fn irq45() noreturn { default_handler(); } export fn irq46() noreturn { default_handler(); } export fn irq47() noreturn { default_handler(); }
src/ipl.zig
const std = @import("std"); const root = @import("root"); const mem = std.mem; const os = std.os; /// We use this as a layer of indirection because global const pointers cannot /// point to thread-local variables. pub var interface = std.rand.Random{ .fillFn = tlsCsprngFill }; const os_has_fork = switch (std.Target.current.os.tag) { .dragonfly, .freebsd, .ios, .kfreebsd, .linux, .macos, .netbsd, .openbsd, .solaris, .tvos, .watchos, .haiku, => true, else => false, }; const os_has_arc4random = std.builtin.link_libc and @hasDecl(std.c, "arc4random_buf"); const want_fork_safety = os_has_fork and !os_has_arc4random and (std.meta.globalOption("crypto_fork_safety", bool) orelse true); const maybe_have_wipe_on_fork = std.Target.current.os.isAtLeast(.linux, .{ .major = 4, .minor = 14, }) orelse true; const Context = struct { init_state: enum(u8) { uninitialized = 0, initialized, failed }, gimli: std.crypto.core.Gimli, }; var install_atfork_handler = std.once(struct { // Install the global handler only once. // The same handler is shared among threads and is inherinted by fork()-ed // processes. fn do() void { const r = std.c.pthread_atfork(null, null, childAtForkHandler); std.debug.assert(r == 0); } }.do); threadlocal var wipe_mem: []align(mem.page_size) u8 = &[_]u8{}; fn tlsCsprngFill(_: *const std.rand.Random, buffer: []u8) void { if (std.builtin.link_libc and @hasDecl(std.c, "arc4random_buf")) { // arc4random is already a thread-local CSPRNG. return std.c.arc4random_buf(buffer.ptr, buffer.len); } // Allow applications to decide they would prefer to have every call to // std.crypto.random always make an OS syscall, rather than rely on an // application implementation of a CSPRNG. if (comptime std.meta.globalOption("crypto_always_getrandom", bool) orelse false) { return fillWithOsEntropy(buffer); } if (wipe_mem.len == 0) { // Not initialized yet. if (want_fork_safety and maybe_have_wipe_on_fork) { // Allocate a per-process page, madvise operates with page // granularity. wipe_mem = os.mmap( null, @sizeOf(Context), os.PROT_READ | os.PROT_WRITE, os.MAP_PRIVATE | os.MAP_ANONYMOUS, -1, 0, ) catch { // Could not allocate memory for the local state, fall back to // the OS syscall. return fillWithOsEntropy(buffer); }; // The memory is already zero-initialized. } else { // Use a static thread-local buffer. const S = struct { threadlocal var buf: Context align(mem.page_size) = .{ .init_state = .uninitialized, .gimli = undefined, }; }; wipe_mem = mem.asBytes(&S.buf); } } const ctx = @ptrCast(*Context, wipe_mem.ptr); switch (ctx.init_state) { .uninitialized => { if (!want_fork_safety) { return initAndFill(buffer); } if (maybe_have_wipe_on_fork) wof: { // Qemu user-mode emulation ignores any valid/invalid madvise // hint and returns success. Check if this is the case by // passing bogus parameters, we expect EINVAL as result. if (os.madvise(wipe_mem.ptr, 0, 0xffffffff)) |_| { break :wof; } else |_| {} if (os.madvise(wipe_mem.ptr, wipe_mem.len, os.MADV_WIPEONFORK)) |_| { return initAndFill(buffer); } else |_| {} } if (std.Thread.use_pthreads) { return setupPthreadAtforkAndFill(buffer); } // Since we failed to set up fork safety, we fall back to always // calling getrandom every time. ctx.init_state = .failed; return fillWithOsEntropy(buffer); }, .initialized => { return fillWithCsprng(buffer); }, .failed => { if (want_fork_safety) { return fillWithOsEntropy(buffer); } else { unreachable; } }, } } fn setupPthreadAtforkAndFill(buffer: []u8) void { install_atfork_handler.call(); return initAndFill(buffer); } fn childAtForkHandler() callconv(.C) void { // The atfork handler is global, this function may be called after // fork()-ing threads that never initialized the CSPRNG context. if (wipe_mem.len == 0) return; std.crypto.utils.secureZero(u8, wipe_mem); } fn fillWithCsprng(buffer: []u8) void { const ctx = @ptrCast(*Context, wipe_mem.ptr); if (buffer.len != 0) { ctx.gimli.squeeze(buffer); } else { ctx.gimli.permute(); } mem.set(u8, ctx.gimli.toSlice()[0..std.crypto.core.Gimli.RATE], 0); } fn fillWithOsEntropy(buffer: []u8) void { os.getrandom(buffer) catch @panic("getrandom() failed to provide entropy"); } fn initAndFill(buffer: []u8) void { var seed: [std.crypto.core.Gimli.BLOCKBYTES]u8 = undefined; // Because we panic on getrandom() failing, we provide the opportunity // to override the default seed function. This also makes // `std.crypto.random` available on freestanding targets, provided that // the `cryptoRandomSeed` function is provided. if (@hasDecl(root, "cryptoRandomSeed")) { root.cryptoRandomSeed(&seed); } else { fillWithOsEntropy(&seed); } const ctx = @ptrCast(*Context, wipe_mem.ptr); ctx.gimli = std.crypto.core.Gimli.init(seed); // This is at the end so that accidental recursive dependencies result // in stack overflows instead of invalid random data. ctx.init_state = .initialized; return fillWithCsprng(buffer); }
lib/std/crypto/tlcsprng.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 int = i64; const util = @import("util.zig"); const gpa = util.gpa; const data = @embedFile("../data/day00.txt"); const Rec = struct { val: int, }; pub fn main() !void { var part1: int = 0; var part2: int = 0; var recs = blk: { var recs = List(Rec).init(gpa); var lines = tokenize(u8, data, "\r\n"); while (lines.next()) |line| { if (line.len == 0) { continue; } var parts = split(u8, line, " "); const dist_str = parts.next().?; assert(parts.next() == null); const dist = parseInt(int, dist_str, 10) catch unreachable; _ = dist; try recs.append(.{ .val = dist, }); } break :blk recs.toOwnedSlice(); }; _ = recs; //const items = util.parseLinesDelim(Rec, data, " ,:(){}<>[]!\r\n\t"); //_ = items; print("part1={}, part2={}\n", .{part1, part2}); } // 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 eql = std.mem.eql; const parseEnum = std.meta.stringToEnum; 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/template.zig
const Wwise = @import("../wwise.zig").Wwise; const ImGui = @import("../imgui.zig").ImGui; const DemoInterface = @import("demo_interface.zig").DemoInterface; const std = @import("std"); pub const SubtitleDemo = struct { subtitleText: [:0]const u8 = undefined, subtitleIndex: u32 = 0, subtitlePosition: u32 = 0, playingID: u32 = 0, allocator: std.mem.Allocator = undefined, isVisibleState: bool = false, bankID: u32 = 0, const Self = @This(); const DemoGameObjectID = 2; pub fn init(self: *Self, allocator: std.mem.Allocator) !void { self.allocator = allocator; self.playingID = 0; self.subtitleIndex = 0; self.subtitlePosition = 0; self.subtitleText = try self.allocator.dupeZ(u8, ""); self.bankID = try Wwise.loadBankByString("MarkerTest.bnk"); try Wwise.registerGameObj(DemoGameObjectID, "SubtitleDemo"); } pub fn deinit(self: *Self) void { _ = Wwise.unloadBankByID(self.bankID); Wwise.unregisterGameObj(DemoGameObjectID); self.allocator.free(self.subtitleText); self.allocator.destroy(self); } pub fn onUI(self: *Self) !void { if (ImGui.igBegin("Subtitle Demo", &self.isVisibleState, ImGui.ImGuiWindowFlags_AlwaysAutoResize)) { if (ImGui.igButton("Play", .{ .x = 120, .y = 0 })) { self.playingID = try Wwise.postEventWithCallback("Play_Markers_Test", DemoGameObjectID, Wwise.AkCallbackType.Marker | Wwise.AkCallbackType.EndOfEvent | Wwise.AkCallbackType.EnableGetSourcePlayPosition, WwiseSubtitleCallback, self); } if (!std.mem.eql(u8, self.subtitleText, "")) { const cuePosText = try std.fmt.allocPrintZ(self.allocator, "Cue #{}, Sample #{}", .{ self.subtitleIndex, self.subtitlePosition }); defer self.allocator.free(cuePosText); const playPosition = Wwise.getSourcePlayPosition(self.playingID, true) catch 0; const playPositionText = try std.fmt.allocPrintZ(self.allocator, "Time: {} ms", .{playPosition}); defer self.allocator.free(playPositionText); ImGui.igText(cuePosText); ImGui.igText(playPositionText); ImGui.igText(self.subtitleText); } ImGui.igEnd(); } if (!self.isVisibleState) { Wwise.stopAllOnGameObject(DemoGameObjectID); self.playingID = 0; } } pub fn isVisible(self: *Self) bool { return self.isVisibleState; } pub fn show(self: *Self) void { self.isVisibleState = true; } pub fn getInterface(self: *Self) DemoInterface { return DemoInterface{ .instance = @ptrCast(DemoInterface.InstanceType, self), .initFn = @ptrCast(DemoInterface.InitFn, init), .deinitFn = @ptrCast(DemoInterface.DeinitFn, deinit), .onUIFn = @ptrCast(DemoInterface.OnUIFn, onUI), .isVisibleFn = @ptrCast(DemoInterface.IsVisibleFn, isVisible), .showFn = @ptrCast(DemoInterface.ShowFn, show), }; } pub fn setSubtitleText(self: *Self, text: [:0]const u8) void { self.allocator.free(self.subtitleText); self.subtitleText = self.allocator.dupeZ(u8, text) catch unreachable; } fn WwiseSubtitleCallback(callbackType: u32, callbackInfo: [*c]Wwise.AkCallbackInfo) callconv(.C) void { if (callbackType == Wwise.AkCallbackType.Marker) { if (callbackInfo[0].pCookie) |cookie| { var subtitleDemo = @ptrCast(*SubtitleDemo, @alignCast(8, cookie)); var markerCallback = @ptrCast(*Wwise.AkMarkerCallbackInfo, callbackInfo); subtitleDemo.setSubtitleText(std.mem.span(markerCallback.strLabel)); subtitleDemo.subtitleIndex = markerCallback.uIdentifier; subtitleDemo.subtitlePosition = markerCallback.uPosition; } } else if (callbackType == Wwise.AkCallbackType.EndOfEvent) { if (callbackInfo[0].pCookie) |cookie| { var subtitleDemo = @ptrCast(*SubtitleDemo, @alignCast(8, cookie)); subtitleDemo.setSubtitleText(""); subtitleDemo.subtitleIndex = 0; subtitleDemo.subtitlePosition = 0; subtitleDemo.playingID = 0; } } } };
src/demos/subtitle_demo.zig
const std = @import("std"); const builtin = @import("builtin"); const warn = std.debug.print; const Allocator = std.mem.Allocator; const thread = @import("../thread.zig"); const config = @import("../config.zig"); const GUIError = error{ Init, Setup }; var vg: [*c]c.NVGcontext = undefined; const c = @cImport({ @cInclude("vulkan/vulkan.h"); @cInclude("GLFW/glfw3.h"); }); pub const Column = struct { // columnbox: [*c]c.uiControl, // config_window: [*c]c.GtkWidget, main: *config.ColumnInfo, }; var myActor: *thread.Actor = undefined; var mainWindow: *c.struct_GLFWwindow = undefined; pub fn libname() []const u8 { return "glfw"; } pub fn init(alloca: *Allocator, set: *config.Settings) !void { var tf = usize(1); if (tf != 1) return GUIError.Init; } pub fn gui_setup(actor: *thread.Actor) !void { var ver_cstr = c.glfwGetVersionString(); warn("GLFW init {} {}\n", std.cstr.toSliceConst(ver_cstr), if (c.glfwVulkanSupported() == c.GLFW_TRUE) "vulkan" else "novulkan"); _ = c.glfwSetErrorCallback(glfw_error); if (c.glfwInit() == c.GLFW_TRUE) { var title = "Zootdeck"; if (c.glfwCreateWindow(640, 380, title, null, null)) |window| { c.glfwMakeContextCurrent(window); mainWindow = window; vulkanInit(window); var width: c_int = 0; var height: c_int = 0; c.glfwGetFramebufferSize(window, &width, &height); warn("framebuf w {} h {}\n", width, height); } else { warn("GLFW create window fail\n"); return GUIError.Setup; } } else { warn("GLFW init not ok\n"); return GUIError.Setup; } } pub fn vulkanInit(window: *c.struct_GLFWwindow) void { var count: c_int = -1; warn("GLFS EXT GO\n"); var extensions = c.glfwGetRequiredInstanceExtensions(@ptrCast([*c]u32, &count)); if (count == 0) { var errcode = c.glfwGetError(null); if (errcode == c.GLFW_NOT_INITIALIZED) { warn("vulkan ERR! GLFW NOT INITIALIZED {}\n", errcode); } if (errcode == c.GLFW_PLATFORM_ERROR) { warn("vulkan ERR! GLFW PLATFORM ERROR {}\n", errcode); } var description: [*c]const u8 = undefined; _ = c.glfwGetError(&description); warn("*_ err {}\n", description); } else { warn("PRE EXT count {}\n", count); warn("vulkan extensions {}\n", extensions); warn("POST EXT\n"); } } fn glfw_error(code: c_int, description: [*c]const u8) callconv(.C) void { warn("**GLFW ErrorBack! {}\n", description); } pub fn mainloop() void { while (c.glfwWindowShouldClose(mainWindow) == 0) { c.glfwWaitEventsTimeout(1); c.glfwSwapBuffers(mainWindow); } } pub fn gui_end() void { c.glfwTerminate(); } pub fn schedule(funcMaybe: ?fn (*anyopaque) callconv(.C) c_int, param: *anyopaque) void { if (funcMaybe) |func| { warn("schedule FUNC {}\n", func); _ = func(@ptrCast(*anyopaque, &"w")); } } pub fn show_main_schedule(in: *anyopaque) callconv(.C) c_int { return 0; } pub fn add_column_schedule(in: *anyopaque) callconv(.C) c_int { warn("gl add column\n"); return 0; } pub fn column_remove_schedule(in: *anyopaque) callconv(.C) c_int { return 0; } pub fn column_config_oauth_url_schedule(in: *anyopaque) callconv(.C) c_int { return 0; } pub fn update_column_config_oauth_finalize_schedule(in: *anyopaque) callconv(.C) c_int { return 0; } pub fn update_column_ui_schedule(in: *anyopaque) callconv(.C) c_int { return 0; } pub fn update_column_netstatus_schedule(in: *anyopaque) callconv(.C) c_int { return 0; } pub fn update_column_toots_schedule(in: *anyopaque) callconv(.C) c_int { return 0; }
src/gui/glfw.zig
const std = @import("std"); const os = std.os; const mem = std.mem; const testing = std.testing; const assert = std.debug.assert; test "communication via dgram connection-less unix domain socket" { const socket = try os.socket( os.AF_UNIX, os.SOCK_DGRAM | os.SOCK_CLOEXEC, os.PF_UNIX, ); defer os.closeSocket(socket); const runtime_dir = try std.fmt.allocPrint(testing.allocator, "/var/run/user/1000", .{}); const subpath = "/kisa"; var path_builder = std.ArrayList(u8).fromOwnedSlice(testing.allocator, runtime_dir); defer path_builder.deinit(); try path_builder.appendSlice(subpath); std.fs.makeDirAbsolute(path_builder.items) catch |err| switch (err) { error.PathAlreadyExists => {}, else => return err, }; const filename = try std.fmt.allocPrint(testing.allocator, "{d}", .{os.linux.getpid()}); defer testing.allocator.free(filename); try path_builder.append('/'); try path_builder.appendSlice(filename); std.fs.deleteFileAbsolute(path_builder.items) catch |err| switch (err) { error.FileNotFound => {}, else => return err, }; const addr = try testing.allocator.create(os.sockaddr_un); defer testing.allocator.destroy(addr); addr.* = os.sockaddr_un{ .path = undefined }; mem.copy(u8, &addr.path, path_builder.items); addr.path[path_builder.items.len] = 0; // null-terminated string const sockaddr = @ptrCast(*os.sockaddr, addr); var addrlen: os.socklen_t = @sizeOf(@TypeOf(addr.*)); try os.bind(socket, sockaddr, addrlen); const pid = try os.fork(); if (pid == 0) { // Client const message = try std.fmt.allocPrint(testing.allocator, "hello from client!\n", .{}); defer testing.allocator.free(message); const bytes_sent = try os.sendto(socket, message, 0, sockaddr, addrlen); assert(message.len == bytes_sent); } else { // Server var buf: [256]u8 = undefined; const bytes_read = try os.recvfrom(socket, &buf, 0, null, null); std.debug.print("\nreceived on server: {s}\n", .{buf[0..bytes_read]}); } std.time.sleep(std.time.ns_per_ms * 200); }
poc/ipc_dgram_socket.zig
const Allocator = std.mem.Allocator; const Data = @import("../events/events.zig").Data; const Event = @import("../events/events.zig").Event; const Headers = @import("http").Headers; const Method = @import("http").Method; const Request = @import("../events/events.zig").Request; const State = @import("states.zig").State; const std = @import("std"); const SMError = @import("errors.zig").SMError; const Version = @import("http").Version; pub fn ClientSM(comptime Writer: type) type { return struct { const Self = @This(); allocator: Allocator, state: State, writer: Writer, const Error = SMError || Writer.Error; pub fn init(allocator: Allocator, writer: Writer) Self { return .{ .allocator = allocator, .state = State.Idle, .writer = writer }; } pub fn deinit(self: *Self) void { self.state = State.Idle; } pub fn send(self: *Self, event: Event) Error!void { switch (self.state) { .Idle => try self.sendRequest(event), .SendBody => try self.sendData(event), .Done, .Closed => try self.closeConnection(event), else => try self.triggerLocalProtocolError(), } } fn sendRequest(self: *Self, event: Event) Error!void { switch (event) { .Request => |request| { var result = try request.serialize(self.allocator); defer self.allocator.free(result); _ = try self.writer.write(result); self.state = .SendBody; }, else => try self.triggerLocalProtocolError(), } } fn sendData(self: *Self, event: Event) Error!void { switch (event) { .Data => |data| _ = try self.writer.write(data.bytes), .EndOfMessage => self.state = .Done, else => try self.triggerLocalProtocolError(), } } fn closeConnection(self: *Self, event: Event) SMError!void { switch (event) { .ConnectionClosed => self.state = .Closed, else => try self.triggerLocalProtocolError(), } } inline fn triggerLocalProtocolError(self: *Self) SMError!void { self.state = .Error; return error.LocalProtocolError; } }; } const expect = std.testing.expect; const expectError = std.testing.expectError; const TestClientSM = ClientSM(std.io.FixedBufferStream([]u8).Writer); test "Send - Can send a Request event when state is Idle" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); var headers = Headers.init(std.testing.allocator); _ = try headers.append("Host", "www.ziglang.org"); _ = try headers.append("GOTTA-GO", "FAST!"); defer headers.deinit(); var requestEvent = try Request.init(Method.Get, "/", Version.Http11, headers); try client.send(Event{ .Request = requestEvent }); var expected = "GET / HTTP/1.1\r\nHost: www.ziglang.org\r\nGOTTA-GO: FAST!\r\n\r\n"; try expect(std.mem.startsWith(u8, &buffer, expected)); try expect(client.state == .SendBody); } test "Send - Cannot send any other event when state is Idle" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); const failure = client.send(.EndOfMessage); try expect(client.state == .Error); try expectError(error.LocalProtocolError, failure); } test "Send - Can send a Data event when state is SendBody" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .SendBody; var data = Event{ .Data = Data{ .bytes = "It's raining outside, damned Brittany !" } }; try client.send(data); try expect(client.state == .SendBody); try expect(std.mem.startsWith(u8, &buffer, "It's raining outside, damned Brittany !")); } test "Send - Can send a EndOfMessage event when state is SendBody" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .SendBody; _ = try client.send(.EndOfMessage); try expect(client.state == .Done); } test "Send - Cannot send any other event when state is SendBody" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .SendBody; const failure = client.send(.ConnectionClosed); try expect(client.state == .Error); try expectError(error.LocalProtocolError, failure); } test "Send - Can send a ConnectionClosed event when state is Done" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .Done; _ = try client.send(.ConnectionClosed); try expect(client.state == .Closed); } test "Send - Cannot send any other event when state is Done" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .Done; const failure = client.send(.EndOfMessage); try expect(client.state == .Error); try expectError(error.LocalProtocolError, failure); } test "Send - Can send a ConnectionClosed event when state is Closed" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .Closed; _ = try client.send(.ConnectionClosed); try expect(client.state == .Closed); } test "Send - Cannot send any other event when state is Closed" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .Closed; const failure = client.send(.EndOfMessage); try expect(client.state == .Error); try expectError(error.LocalProtocolError, failure); } test "Send - Cannot send any event when state is Error" { var buffer: [100]u8 = undefined; var fixed_buffer = std.io.fixedBufferStream(&buffer); var client = TestClientSM.init(std.testing.allocator, fixed_buffer.writer()); client.state = .Error; const failure = client.send(.EndOfMessage); try expect(client.state == .Error); try expectError(error.LocalProtocolError, failure); }
src/state_machines/client.zig
const aoc = @import("../aoc.zig"); const std = @import("std"); const Validation = struct { const Validators = std.StringHashMap(aoc.Regex); validators: Validators, fn init(allocator: std.mem.Allocator) !Validation { var validation = Validation { .validators = Validators.init(allocator) }; return validation.addRegex("byr", "^(19[2-9][0-9]|200[0-2])$") .addRegex("iyr", "^20(1[0-9]|20)$") .addRegex("eyr", "^20(2[0-9]|30)$") .addRegex("hgt", "^((1[5-8][0-9]|19[0-3])cm|(59|6[0-9]|7[0-6])in)$") .addRegex("hcl", "^#[0-9a-f]{6}$") .addRegex("ecl", "^(amb|blu|brn|gry|grn|hzl|oth)$") .addRegex("pid", "^[0-9]{9}$"); } fn deinit(self: *Validation) void { var iter = self.validators.iterator(); while (iter.next()) |kv| { kv.value_ptr.deinit(); } self.validators.deinit(); } fn addRegex(self: *Validation, field: []const u8, pattern: [:0]const u8) Validation { self.validators.putNoClobber(field, aoc.Regex.compilez(pattern)) catch unreachable; return self.*; } fn validate(self: *const Validation, field: []const u8, value: []const u8) ?bool { const validator = self.validators.get(field) orelse return null; return validator.matches(value); } }; pub fn run(problem: *aoc.Problem) !aoc.Solution { var validation = try Validation.init(problem.allocator); defer validation.deinit(); var present: usize = 0; var valid: usize = 0; while (problem.group()) |group| { var fields_present: u8 = 0; var all_valid = true; var tokens = std.mem.tokenize(u8, group, ": \n"); while (tokens.next()) |field| { const value = tokens.next().?; if (validation.validate(field, value)) |validation_result| { fields_present += 1; all_valid = all_valid and validation_result; } } if (fields_present == 7) { present += 1; if (all_valid) { valid += 1; } } } return problem.solution(present, valid); }
src/main/zig/2020/day04.zig
pub extern fn sg_setup(desc: [*c]const sg_desc) void; pub extern fn sg_shutdown() void; pub extern fn sg_isvalid() bool; pub extern fn sg_reset_state_cache() void; pub extern fn sg_install_trace_hooks(trace_hooks: [*c]const sg_trace_hooks) sg_trace_hooks; pub extern fn sg_push_debug_group(name: [*c]const u8) void; pub extern fn sg_pop_debug_group() void; pub extern fn sg_make_buffer(desc: [*c]const sg_buffer_desc) sg_buffer; pub extern fn sg_make_image(desc: [*c]const sg_image_desc) sg_image; pub extern fn sg_make_shader(desc: [*c]const sg_shader_desc) sg_shader; pub extern fn sg_make_pipeline(desc: [*c]const sg_pipeline_desc) sg_pipeline; pub extern fn sg_make_pass(desc: [*c]const sg_pass_desc) sg_pass; pub extern fn sg_destroy_buffer(buf: sg_buffer) void; pub extern fn sg_destroy_image(img: sg_image) void; pub extern fn sg_destroy_shader(shd: sg_shader) void; pub extern fn sg_destroy_pipeline(pip: sg_pipeline) void; pub extern fn sg_destroy_pass(pass: sg_pass) void; pub extern fn sg_update_buffer(buf: sg_buffer, data: [*c]const sg_range) void; pub extern fn sg_update_image(img: sg_image, data: [*c]const sg_image_data) void; pub extern fn sg_append_buffer(buf: sg_buffer, data: [*c]const sg_range) c_int; pub extern fn sg_query_buffer_overflow(buf: sg_buffer) bool; pub extern fn sg_begin_default_pass(pass_action: [*c]const sg_pass_action, width: c_int, height: c_int) void; pub extern fn sg_begin_default_passf(pass_action: [*c]const sg_pass_action, width: f32, height: f32) void; pub extern fn sg_begin_pass(pass: sg_pass, pass_action: [*c]const sg_pass_action) void; pub extern fn sg_apply_viewport(x: c_int, y: c_int, width: c_int, height: c_int, origin_top_left: bool) void; pub extern fn sg_apply_viewportf(x: f32, y: f32, width: f32, height: f32, origin_top_left: bool) void; pub extern fn sg_apply_scissor_rect(x: c_int, y: c_int, width: c_int, height: c_int, origin_top_left: bool) void; pub extern fn sg_apply_scissor_rectf(x: f32, y: f32, width: f32, height: f32, origin_top_left: bool) void; pub extern fn sg_apply_pipeline(pip: sg_pipeline) void; pub extern fn sg_apply_bindings(bindings: [*c]const sg_bindings) void; pub extern fn sg_apply_uniforms(stage: sg_shader_stage, ub_index: c_int, data: [*c]const sg_range) void; pub extern fn sg_draw(base_element: c_int, num_elements: c_int, num_instances: c_int) void; pub extern fn sg_end_pass() void; pub extern fn sg_commit() void; pub extern fn sg_query_desc() sg_desc; pub extern fn sg_query_backend() sg_backend; pub extern fn sg_query_features() sg_features; pub extern fn sg_query_limits() sg_limits; pub extern fn sg_query_pixelformat(fmt: sg_pixel_format) sg_pixelformat_info; pub extern fn sg_query_buffer_state(buf: sg_buffer) sg_resource_state; pub extern fn sg_query_image_state(img: sg_image) sg_resource_state; pub extern fn sg_query_shader_state(shd: sg_shader) sg_resource_state; pub extern fn sg_query_pipeline_state(pip: sg_pipeline) sg_resource_state; pub extern fn sg_query_pass_state(pass: sg_pass) sg_resource_state; pub extern fn sg_query_buffer_info(buf: sg_buffer) sg_buffer_info; pub extern fn sg_query_image_info(img: sg_image) sg_image_info; pub extern fn sg_query_shader_info(shd: sg_shader) sg_shader_info; pub extern fn sg_query_pipeline_info(pip: sg_pipeline) sg_pipeline_info; pub extern fn sg_query_pass_info(pass: sg_pass) sg_pass_info; pub extern fn sg_query_buffer_defaults(desc: [*c]const sg_buffer_desc) sg_buffer_desc; pub extern fn sg_query_image_defaults(desc: [*c]const sg_image_desc) sg_image_desc; pub extern fn sg_query_shader_defaults(desc: [*c]const sg_shader_desc) sg_shader_desc; pub extern fn sg_query_pipeline_defaults(desc: [*c]const sg_pipeline_desc) sg_pipeline_desc; pub extern fn sg_query_pass_defaults(desc: [*c]const sg_pass_desc) sg_pass_desc; pub extern fn sg_alloc_buffer() sg_buffer; pub extern fn sg_alloc_image() sg_image; pub extern fn sg_alloc_shader() sg_shader; pub extern fn sg_alloc_pipeline() sg_pipeline; pub extern fn sg_alloc_pass() sg_pass; pub extern fn sg_dealloc_buffer(buf_id: sg_buffer) void; pub extern fn sg_dealloc_image(img_id: sg_image) void; pub extern fn sg_dealloc_shader(shd_id: sg_shader) void; pub extern fn sg_dealloc_pipeline(pip_id: sg_pipeline) void; pub extern fn sg_dealloc_pass(pass_id: sg_pass) void; pub extern fn sg_init_buffer(buf_id: sg_buffer, desc: [*c]const sg_buffer_desc) void; pub extern fn sg_init_image(img_id: sg_image, desc: [*c]const sg_image_desc) void; pub extern fn sg_init_shader(shd_id: sg_shader, desc: [*c]const sg_shader_desc) void; pub extern fn sg_init_pipeline(pip_id: sg_pipeline, desc: [*c]const sg_pipeline_desc) void; pub extern fn sg_init_pass(pass_id: sg_pass, desc: [*c]const sg_pass_desc) void; pub extern fn sg_uninit_buffer(buf_id: sg_buffer) bool; pub extern fn sg_uninit_image(img_id: sg_image) bool; pub extern fn sg_uninit_shader(shd_id: sg_shader) bool; pub extern fn sg_uninit_pipeline(pip_id: sg_pipeline) bool; pub extern fn sg_uninit_pass(pass_id: sg_pass) bool; pub extern fn sg_fail_buffer(buf_id: sg_buffer) void; pub extern fn sg_fail_image(img_id: sg_image) void; pub extern fn sg_fail_shader(shd_id: sg_shader) void; pub extern fn sg_fail_pipeline(pip_id: sg_pipeline) void; pub extern fn sg_fail_pass(pass_id: sg_pass) void; pub extern fn sg_setup_context() sg_context; pub extern fn sg_activate_context(ctx_id: sg_context) void; pub extern fn sg_discard_context(ctx_id: sg_context) void; pub extern fn sg_d3d11_device() ?*const c_void; pub extern fn sg_mtl_device() ?*const c_void; pub extern fn sg_mtl_render_command_encoder() ?*const c_void; pub const struct_sg_buffer = extern struct { id: u32, }; pub const sg_buffer = struct_sg_buffer; pub const struct_sg_image = extern struct { id: u32, }; pub const sg_image = struct_sg_image; pub const struct_sg_shader = extern struct { id: u32, }; pub const sg_shader = struct_sg_shader; pub const struct_sg_pipeline = extern struct { id: u32, }; pub const sg_pipeline = struct_sg_pipeline; pub const struct_sg_pass = extern struct { id: u32, }; pub const sg_pass = struct_sg_pass; pub const struct_sg_context = extern struct { id: u32, }; pub const sg_context = struct_sg_context; pub const struct_sg_range = extern struct { ptr: ?*const c_void, size: usize, }; pub const sg_range = struct_sg_range; const enum_unnamed_1 = enum(c_int) { SG_INVALID_ID = 0, SG_NUM_SHADER_STAGES = 2, SG_NUM_INFLIGHT_FRAMES = 2, SG_MAX_COLOR_ATTACHMENTS = 4, SG_MAX_SHADERSTAGE_BUFFERS = 8, SG_MAX_SHADERSTAGE_IMAGES = 12, SG_MAX_SHADERSTAGE_UBS = 4, SG_MAX_UB_MEMBERS = 16, SG_MAX_VERTEX_ATTRIBUTES = 16, SG_MAX_MIPMAPS = 16, SG_MAX_TEXTUREARRAY_LAYERS = 128, _, }; pub const SG_INVALID_ID = @enumToInt(enum_unnamed_1.SG_INVALID_ID); pub const SG_NUM_SHADER_STAGES = @enumToInt(enum_unnamed_1.SG_NUM_SHADER_STAGES); pub const SG_NUM_INFLIGHT_FRAMES = @enumToInt(enum_unnamed_1.SG_NUM_INFLIGHT_FRAMES); pub const SG_MAX_COLOR_ATTACHMENTS = @enumToInt(enum_unnamed_1.SG_MAX_COLOR_ATTACHMENTS); pub const SG_MAX_SHADERSTAGE_BUFFERS = @enumToInt(enum_unnamed_1.SG_MAX_SHADERSTAGE_BUFFERS); pub const SG_MAX_SHADERSTAGE_IMAGES = @enumToInt(enum_unnamed_1.SG_MAX_SHADERSTAGE_IMAGES); pub const SG_MAX_SHADERSTAGE_UBS = @enumToInt(enum_unnamed_1.SG_MAX_SHADERSTAGE_UBS); pub const SG_MAX_UB_MEMBERS = @enumToInt(enum_unnamed_1.SG_MAX_UB_MEMBERS); pub const SG_MAX_VERTEX_ATTRIBUTES = @enumToInt(enum_unnamed_1.SG_MAX_VERTEX_ATTRIBUTES); pub const SG_MAX_MIPMAPS = @enumToInt(enum_unnamed_1.SG_MAX_MIPMAPS); pub const SG_MAX_TEXTUREARRAY_LAYERS = @enumToInt(enum_unnamed_1.SG_MAX_TEXTUREARRAY_LAYERS); pub const struct_sg_color = extern struct { r: f32, g: f32, b: f32, a: f32, }; pub const sg_color = struct_sg_color; pub const enum_sg_backend = enum(c_int) { SG_BACKEND_GLCORE33, SG_BACKEND_GLES2, SG_BACKEND_GLES3, SG_BACKEND_D3D11, SG_BACKEND_METAL_IOS, SG_BACKEND_METAL_MACOS, SG_BACKEND_METAL_SIMULATOR, SG_BACKEND_WGPU, SG_BACKEND_DUMMY, _, }; pub const SG_BACKEND_GLCORE33 = @enumToInt(enum_sg_backend.SG_BACKEND_GLCORE33); pub const SG_BACKEND_GLES2 = @enumToInt(enum_sg_backend.SG_BACKEND_GLES2); pub const SG_BACKEND_GLES3 = @enumToInt(enum_sg_backend.SG_BACKEND_GLES3); pub const SG_BACKEND_D3D11 = @enumToInt(enum_sg_backend.SG_BACKEND_D3D11); pub const SG_BACKEND_METAL_IOS = @enumToInt(enum_sg_backend.SG_BACKEND_METAL_IOS); pub const SG_BACKEND_METAL_MACOS = @enumToInt(enum_sg_backend.SG_BACKEND_METAL_MACOS); pub const SG_BACKEND_METAL_SIMULATOR = @enumToInt(enum_sg_backend.SG_BACKEND_METAL_SIMULATOR); pub const SG_BACKEND_WGPU = @enumToInt(enum_sg_backend.SG_BACKEND_WGPU); pub const SG_BACKEND_DUMMY = @enumToInt(enum_sg_backend.SG_BACKEND_DUMMY); pub const sg_backend = enum_sg_backend; pub const enum_sg_pixel_format = enum(c_int) { _SG_PIXELFORMAT_DEFAULT = 0, SG_PIXELFORMAT_NONE = 1, SG_PIXELFORMAT_R8 = 2, SG_PIXELFORMAT_R8SN = 3, SG_PIXELFORMAT_R8UI = 4, SG_PIXELFORMAT_R8SI = 5, SG_PIXELFORMAT_R16 = 6, SG_PIXELFORMAT_R16SN = 7, SG_PIXELFORMAT_R16UI = 8, SG_PIXELFORMAT_R16SI = 9, SG_PIXELFORMAT_R16F = 10, SG_PIXELFORMAT_RG8 = 11, SG_PIXELFORMAT_RG8SN = 12, SG_PIXELFORMAT_RG8UI = 13, SG_PIXELFORMAT_RG8SI = 14, SG_PIXELFORMAT_R32UI = 15, SG_PIXELFORMAT_R32SI = 16, SG_PIXELFORMAT_R32F = 17, SG_PIXELFORMAT_RG16 = 18, SG_PIXELFORMAT_RG16SN = 19, SG_PIXELFORMAT_RG16UI = 20, SG_PIXELFORMAT_RG16SI = 21, SG_PIXELFORMAT_RG16F = 22, SG_PIXELFORMAT_RGBA8 = 23, SG_PIXELFORMAT_RGBA8SN = 24, SG_PIXELFORMAT_RGBA8UI = 25, SG_PIXELFORMAT_RGBA8SI = 26, SG_PIXELFORMAT_BGRA8 = 27, SG_PIXELFORMAT_RGB10A2 = 28, SG_PIXELFORMAT_RG11B10F = 29, SG_PIXELFORMAT_RG32UI = 30, SG_PIXELFORMAT_RG32SI = 31, SG_PIXELFORMAT_RG32F = 32, SG_PIXELFORMAT_RGBA16 = 33, SG_PIXELFORMAT_RGBA16SN = 34, SG_PIXELFORMAT_RGBA16UI = 35, SG_PIXELFORMAT_RGBA16SI = 36, SG_PIXELFORMAT_RGBA16F = 37, SG_PIXELFORMAT_RGBA32UI = 38, SG_PIXELFORMAT_RGBA32SI = 39, SG_PIXELFORMAT_RGBA32F = 40, SG_PIXELFORMAT_DEPTH = 41, SG_PIXELFORMAT_DEPTH_STENCIL = 42, SG_PIXELFORMAT_BC1_RGBA = 43, SG_PIXELFORMAT_BC2_RGBA = 44, SG_PIXELFORMAT_BC3_RGBA = 45, SG_PIXELFORMAT_BC4_R = 46, SG_PIXELFORMAT_BC4_RSN = 47, SG_PIXELFORMAT_BC5_RG = 48, SG_PIXELFORMAT_BC5_RGSN = 49, SG_PIXELFORMAT_BC6H_RGBF = 50, SG_PIXELFORMAT_BC6H_RGBUF = 51, SG_PIXELFORMAT_BC7_RGBA = 52, SG_PIXELFORMAT_PVRTC_RGB_2BPP = 53, SG_PIXELFORMAT_PVRTC_RGB_4BPP = 54, SG_PIXELFORMAT_PVRTC_RGBA_2BPP = 55, SG_PIXELFORMAT_PVRTC_RGBA_4BPP = 56, SG_PIXELFORMAT_ETC2_RGB8 = 57, SG_PIXELFORMAT_ETC2_RGB8A1 = 58, SG_PIXELFORMAT_ETC2_RGBA8 = 59, SG_PIXELFORMAT_ETC2_RG11 = 60, SG_PIXELFORMAT_ETC2_RG11SN = 61, _SG_PIXELFORMAT_NUM = 62, _SG_PIXELFORMAT_FORCE_U32 = 2147483647, _, }; pub const _SG_PIXELFORMAT_DEFAULT = @enumToInt(enum_sg_pixel_format._SG_PIXELFORMAT_DEFAULT); pub const SG_PIXELFORMAT_NONE = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_NONE); pub const SG_PIXELFORMAT_R8 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R8); pub const SG_PIXELFORMAT_R8SN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R8SN); pub const SG_PIXELFORMAT_R8UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R8UI); pub const SG_PIXELFORMAT_R8SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R8SI); pub const SG_PIXELFORMAT_R16 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R16); pub const SG_PIXELFORMAT_R16SN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R16SN); pub const SG_PIXELFORMAT_R16UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R16UI); pub const SG_PIXELFORMAT_R16SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R16SI); pub const SG_PIXELFORMAT_R16F = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R16F); pub const SG_PIXELFORMAT_RG8 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG8); pub const SG_PIXELFORMAT_RG8SN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG8SN); pub const SG_PIXELFORMAT_RG8UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG8UI); pub const SG_PIXELFORMAT_RG8SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG8SI); pub const SG_PIXELFORMAT_R32UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R32UI); pub const SG_PIXELFORMAT_R32SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R32SI); pub const SG_PIXELFORMAT_R32F = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_R32F); pub const SG_PIXELFORMAT_RG16 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG16); pub const SG_PIXELFORMAT_RG16SN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG16SN); pub const SG_PIXELFORMAT_RG16UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG16UI); pub const SG_PIXELFORMAT_RG16SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG16SI); pub const SG_PIXELFORMAT_RG16F = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG16F); pub const SG_PIXELFORMAT_RGBA8 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA8); pub const SG_PIXELFORMAT_RGBA8SN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA8SN); pub const SG_PIXELFORMAT_RGBA8UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA8UI); pub const SG_PIXELFORMAT_RGBA8SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA8SI); pub const SG_PIXELFORMAT_BGRA8 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BGRA8); pub const SG_PIXELFORMAT_RGB10A2 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGB10A2); pub const SG_PIXELFORMAT_RG11B10F = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG11B10F); pub const SG_PIXELFORMAT_RG32UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG32UI); pub const SG_PIXELFORMAT_RG32SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG32SI); pub const SG_PIXELFORMAT_RG32F = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RG32F); pub const SG_PIXELFORMAT_RGBA16 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA16); pub const SG_PIXELFORMAT_RGBA16SN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA16SN); pub const SG_PIXELFORMAT_RGBA16UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA16UI); pub const SG_PIXELFORMAT_RGBA16SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA16SI); pub const SG_PIXELFORMAT_RGBA16F = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA16F); pub const SG_PIXELFORMAT_RGBA32UI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA32UI); pub const SG_PIXELFORMAT_RGBA32SI = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA32SI); pub const SG_PIXELFORMAT_RGBA32F = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_RGBA32F); pub const SG_PIXELFORMAT_DEPTH = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_DEPTH); pub const SG_PIXELFORMAT_DEPTH_STENCIL = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_DEPTH_STENCIL); pub const SG_PIXELFORMAT_BC1_RGBA = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC1_RGBA); pub const SG_PIXELFORMAT_BC2_RGBA = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC2_RGBA); pub const SG_PIXELFORMAT_BC3_RGBA = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC3_RGBA); pub const SG_PIXELFORMAT_BC4_R = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC4_R); pub const SG_PIXELFORMAT_BC4_RSN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC4_RSN); pub const SG_PIXELFORMAT_BC5_RG = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC5_RG); pub const SG_PIXELFORMAT_BC5_RGSN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC5_RGSN); pub const SG_PIXELFORMAT_BC6H_RGBF = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC6H_RGBF); pub const SG_PIXELFORMAT_BC6H_RGBUF = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC6H_RGBUF); pub const SG_PIXELFORMAT_BC7_RGBA = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_BC7_RGBA); pub const SG_PIXELFORMAT_PVRTC_RGB_2BPP = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_PVRTC_RGB_2BPP); pub const SG_PIXELFORMAT_PVRTC_RGB_4BPP = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_PVRTC_RGB_4BPP); pub const SG_PIXELFORMAT_PVRTC_RGBA_2BPP = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_PVRTC_RGBA_2BPP); pub const SG_PIXELFORMAT_PVRTC_RGBA_4BPP = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_PVRTC_RGBA_4BPP); pub const SG_PIXELFORMAT_ETC2_RGB8 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_ETC2_RGB8); pub const SG_PIXELFORMAT_ETC2_RGB8A1 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_ETC2_RGB8A1); pub const SG_PIXELFORMAT_ETC2_RGBA8 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_ETC2_RGBA8); pub const SG_PIXELFORMAT_ETC2_RG11 = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_ETC2_RG11); pub const SG_PIXELFORMAT_ETC2_RG11SN = @enumToInt(enum_sg_pixel_format.SG_PIXELFORMAT_ETC2_RG11SN); pub const _SG_PIXELFORMAT_NUM = @enumToInt(enum_sg_pixel_format._SG_PIXELFORMAT_NUM); pub const _SG_PIXELFORMAT_FORCE_U32 = @enumToInt(enum_sg_pixel_format._SG_PIXELFORMAT_FORCE_U32); pub const sg_pixel_format = enum_sg_pixel_format; pub const struct_sg_pixelformat_info = extern struct { sample: bool, filter: bool, render: bool, blend: bool, msaa: bool, depth: bool, }; pub const sg_pixelformat_info = struct_sg_pixelformat_info; pub const struct_sg_features = extern struct { instancing: bool, origin_top_left: bool, multiple_render_targets: bool, msaa_render_targets: bool, imagetype_3d: bool, imagetype_array: bool, image_clamp_to_border: bool, mrt_independent_blend_state: bool, mrt_independent_write_mask: bool, }; pub const sg_features = struct_sg_features; pub const struct_sg_limits = extern struct { max_image_size_2d: c_int, max_image_size_cube: c_int, max_image_size_3d: c_int, max_image_size_array: c_int, max_image_array_layers: c_int, max_vertex_attrs: c_int, gl_max_vertex_uniform_vectors: c_int, }; pub const sg_limits = struct_sg_limits; pub const enum_sg_resource_state = enum(c_int) { SG_RESOURCESTATE_INITIAL = 0, SG_RESOURCESTATE_ALLOC = 1, SG_RESOURCESTATE_VALID = 2, SG_RESOURCESTATE_FAILED = 3, SG_RESOURCESTATE_INVALID = 4, _SG_RESOURCESTATE_FORCE_U32 = 2147483647, _, }; pub const SG_RESOURCESTATE_INITIAL = @enumToInt(enum_sg_resource_state.SG_RESOURCESTATE_INITIAL); pub const SG_RESOURCESTATE_ALLOC = @enumToInt(enum_sg_resource_state.SG_RESOURCESTATE_ALLOC); pub const SG_RESOURCESTATE_VALID = @enumToInt(enum_sg_resource_state.SG_RESOURCESTATE_VALID); pub const SG_RESOURCESTATE_FAILED = @enumToInt(enum_sg_resource_state.SG_RESOURCESTATE_FAILED); pub const SG_RESOURCESTATE_INVALID = @enumToInt(enum_sg_resource_state.SG_RESOURCESTATE_INVALID); pub const _SG_RESOURCESTATE_FORCE_U32 = @enumToInt(enum_sg_resource_state._SG_RESOURCESTATE_FORCE_U32); pub const sg_resource_state = enum_sg_resource_state; pub const enum_sg_usage = enum(c_int) { _SG_USAGE_DEFAULT = 0, SG_USAGE_IMMUTABLE = 1, SG_USAGE_DYNAMIC = 2, SG_USAGE_STREAM = 3, _SG_USAGE_NUM = 4, _SG_USAGE_FORCE_U32 = 2147483647, _, }; pub const _SG_USAGE_DEFAULT = @enumToInt(enum_sg_usage._SG_USAGE_DEFAULT); pub const SG_USAGE_IMMUTABLE = @enumToInt(enum_sg_usage.SG_USAGE_IMMUTABLE); pub const SG_USAGE_DYNAMIC = @enumToInt(enum_sg_usage.SG_USAGE_DYNAMIC); pub const SG_USAGE_STREAM = @enumToInt(enum_sg_usage.SG_USAGE_STREAM); pub const _SG_USAGE_NUM = @enumToInt(enum_sg_usage._SG_USAGE_NUM); pub const _SG_USAGE_FORCE_U32 = @enumToInt(enum_sg_usage._SG_USAGE_FORCE_U32); pub const sg_usage = enum_sg_usage; pub const enum_sg_buffer_type = enum(c_int) { _SG_BUFFERTYPE_DEFAULT = 0, SG_BUFFERTYPE_VERTEXBUFFER = 1, SG_BUFFERTYPE_INDEXBUFFER = 2, _SG_BUFFERTYPE_NUM = 3, _SG_BUFFERTYPE_FORCE_U32 = 2147483647, _, }; pub const _SG_BUFFERTYPE_DEFAULT = @enumToInt(enum_sg_buffer_type._SG_BUFFERTYPE_DEFAULT); pub const SG_BUFFERTYPE_VERTEXBUFFER = @enumToInt(enum_sg_buffer_type.SG_BUFFERTYPE_VERTEXBUFFER); pub const SG_BUFFERTYPE_INDEXBUFFER = @enumToInt(enum_sg_buffer_type.SG_BUFFERTYPE_INDEXBUFFER); pub const _SG_BUFFERTYPE_NUM = @enumToInt(enum_sg_buffer_type._SG_BUFFERTYPE_NUM); pub const _SG_BUFFERTYPE_FORCE_U32 = @enumToInt(enum_sg_buffer_type._SG_BUFFERTYPE_FORCE_U32); pub const sg_buffer_type = enum_sg_buffer_type; pub const enum_sg_index_type = enum(c_int) { _SG_INDEXTYPE_DEFAULT = 0, SG_INDEXTYPE_NONE = 1, SG_INDEXTYPE_UINT16 = 2, SG_INDEXTYPE_UINT32 = 3, _SG_INDEXTYPE_NUM = 4, _SG_INDEXTYPE_FORCE_U32 = 2147483647, _, }; pub const _SG_INDEXTYPE_DEFAULT = @enumToInt(enum_sg_index_type._SG_INDEXTYPE_DEFAULT); pub const SG_INDEXTYPE_NONE = @enumToInt(enum_sg_index_type.SG_INDEXTYPE_NONE); pub const SG_INDEXTYPE_UINT16 = @enumToInt(enum_sg_index_type.SG_INDEXTYPE_UINT16); pub const SG_INDEXTYPE_UINT32 = @enumToInt(enum_sg_index_type.SG_INDEXTYPE_UINT32); pub const _SG_INDEXTYPE_NUM = @enumToInt(enum_sg_index_type._SG_INDEXTYPE_NUM); pub const _SG_INDEXTYPE_FORCE_U32 = @enumToInt(enum_sg_index_type._SG_INDEXTYPE_FORCE_U32); pub const sg_index_type = enum_sg_index_type; pub const enum_sg_image_type = enum(c_int) { _SG_IMAGETYPE_DEFAULT = 0, SG_IMAGETYPE_2D = 1, SG_IMAGETYPE_CUBE = 2, SG_IMAGETYPE_3D = 3, SG_IMAGETYPE_ARRAY = 4, _SG_IMAGETYPE_NUM = 5, _SG_IMAGETYPE_FORCE_U32 = 2147483647, _, }; pub const _SG_IMAGETYPE_DEFAULT = @enumToInt(enum_sg_image_type._SG_IMAGETYPE_DEFAULT); pub const SG_IMAGETYPE_2D = @enumToInt(enum_sg_image_type.SG_IMAGETYPE_2D); pub const SG_IMAGETYPE_CUBE = @enumToInt(enum_sg_image_type.SG_IMAGETYPE_CUBE); pub const SG_IMAGETYPE_3D = @enumToInt(enum_sg_image_type.SG_IMAGETYPE_3D); pub const SG_IMAGETYPE_ARRAY = @enumToInt(enum_sg_image_type.SG_IMAGETYPE_ARRAY); pub const _SG_IMAGETYPE_NUM = @enumToInt(enum_sg_image_type._SG_IMAGETYPE_NUM); pub const _SG_IMAGETYPE_FORCE_U32 = @enumToInt(enum_sg_image_type._SG_IMAGETYPE_FORCE_U32); pub const sg_image_type = enum_sg_image_type; pub const enum_sg_sampler_type = enum(c_int) { _SG_SAMPLERTYPE_DEFAULT, SG_SAMPLERTYPE_FLOAT, SG_SAMPLERTYPE_SINT, SG_SAMPLERTYPE_UINT, _, }; pub const _SG_SAMPLERTYPE_DEFAULT = @enumToInt(enum_sg_sampler_type._SG_SAMPLERTYPE_DEFAULT); pub const SG_SAMPLERTYPE_FLOAT = @enumToInt(enum_sg_sampler_type.SG_SAMPLERTYPE_FLOAT); pub const SG_SAMPLERTYPE_SINT = @enumToInt(enum_sg_sampler_type.SG_SAMPLERTYPE_SINT); pub const SG_SAMPLERTYPE_UINT = @enumToInt(enum_sg_sampler_type.SG_SAMPLERTYPE_UINT); pub const sg_sampler_type = enum_sg_sampler_type; pub const enum_sg_cube_face = enum(c_int) { SG_CUBEFACE_POS_X = 0, SG_CUBEFACE_NEG_X = 1, SG_CUBEFACE_POS_Y = 2, SG_CUBEFACE_NEG_Y = 3, SG_CUBEFACE_POS_Z = 4, SG_CUBEFACE_NEG_Z = 5, SG_CUBEFACE_NUM = 6, _SG_CUBEFACE_FORCE_U32 = 2147483647, _, }; pub const SG_CUBEFACE_POS_X = @enumToInt(enum_sg_cube_face.SG_CUBEFACE_POS_X); pub const SG_CUBEFACE_NEG_X = @enumToInt(enum_sg_cube_face.SG_CUBEFACE_NEG_X); pub const SG_CUBEFACE_POS_Y = @enumToInt(enum_sg_cube_face.SG_CUBEFACE_POS_Y); pub const SG_CUBEFACE_NEG_Y = @enumToInt(enum_sg_cube_face.SG_CUBEFACE_NEG_Y); pub const SG_CUBEFACE_POS_Z = @enumToInt(enum_sg_cube_face.SG_CUBEFACE_POS_Z); pub const SG_CUBEFACE_NEG_Z = @enumToInt(enum_sg_cube_face.SG_CUBEFACE_NEG_Z); pub const SG_CUBEFACE_NUM = @enumToInt(enum_sg_cube_face.SG_CUBEFACE_NUM); pub const _SG_CUBEFACE_FORCE_U32 = @enumToInt(enum_sg_cube_face._SG_CUBEFACE_FORCE_U32); pub const sg_cube_face = enum_sg_cube_face; pub const enum_sg_shader_stage = enum(c_int) { SG_SHADERSTAGE_VS = 0, SG_SHADERSTAGE_FS = 1, _SG_SHADERSTAGE_FORCE_U32 = 2147483647, _, }; pub const SG_SHADERSTAGE_VS = @enumToInt(enum_sg_shader_stage.SG_SHADERSTAGE_VS); pub const SG_SHADERSTAGE_FS = @enumToInt(enum_sg_shader_stage.SG_SHADERSTAGE_FS); pub const _SG_SHADERSTAGE_FORCE_U32 = @enumToInt(enum_sg_shader_stage._SG_SHADERSTAGE_FORCE_U32); pub const sg_shader_stage = enum_sg_shader_stage; pub const enum_sg_primitive_type = enum(c_int) { _SG_PRIMITIVETYPE_DEFAULT = 0, SG_PRIMITIVETYPE_POINTS = 1, SG_PRIMITIVETYPE_LINES = 2, SG_PRIMITIVETYPE_LINE_STRIP = 3, SG_PRIMITIVETYPE_TRIANGLES = 4, SG_PRIMITIVETYPE_TRIANGLE_STRIP = 5, _SG_PRIMITIVETYPE_NUM = 6, _SG_PRIMITIVETYPE_FORCE_U32 = 2147483647, _, }; pub const _SG_PRIMITIVETYPE_DEFAULT = @enumToInt(enum_sg_primitive_type._SG_PRIMITIVETYPE_DEFAULT); pub const SG_PRIMITIVETYPE_POINTS = @enumToInt(enum_sg_primitive_type.SG_PRIMITIVETYPE_POINTS); pub const SG_PRIMITIVETYPE_LINES = @enumToInt(enum_sg_primitive_type.SG_PRIMITIVETYPE_LINES); pub const SG_PRIMITIVETYPE_LINE_STRIP = @enumToInt(enum_sg_primitive_type.SG_PRIMITIVETYPE_LINE_STRIP); pub const SG_PRIMITIVETYPE_TRIANGLES = @enumToInt(enum_sg_primitive_type.SG_PRIMITIVETYPE_TRIANGLES); pub const SG_PRIMITIVETYPE_TRIANGLE_STRIP = @enumToInt(enum_sg_primitive_type.SG_PRIMITIVETYPE_TRIANGLE_STRIP); pub const _SG_PRIMITIVETYPE_NUM = @enumToInt(enum_sg_primitive_type._SG_PRIMITIVETYPE_NUM); pub const _SG_PRIMITIVETYPE_FORCE_U32 = @enumToInt(enum_sg_primitive_type._SG_PRIMITIVETYPE_FORCE_U32); pub const sg_primitive_type = enum_sg_primitive_type; pub const enum_sg_filter = enum(c_int) { _SG_FILTER_DEFAULT = 0, SG_FILTER_NEAREST = 1, SG_FILTER_LINEAR = 2, SG_FILTER_NEAREST_MIPMAP_NEAREST = 3, SG_FILTER_NEAREST_MIPMAP_LINEAR = 4, SG_FILTER_LINEAR_MIPMAP_NEAREST = 5, SG_FILTER_LINEAR_MIPMAP_LINEAR = 6, _SG_FILTER_NUM = 7, _SG_FILTER_FORCE_U32 = 2147483647, _, }; pub const _SG_FILTER_DEFAULT = @enumToInt(enum_sg_filter._SG_FILTER_DEFAULT); pub const SG_FILTER_NEAREST = @enumToInt(enum_sg_filter.SG_FILTER_NEAREST); pub const SG_FILTER_LINEAR = @enumToInt(enum_sg_filter.SG_FILTER_LINEAR); pub const SG_FILTER_NEAREST_MIPMAP_NEAREST = @enumToInt(enum_sg_filter.SG_FILTER_NEAREST_MIPMAP_NEAREST); pub const SG_FILTER_NEAREST_MIPMAP_LINEAR = @enumToInt(enum_sg_filter.SG_FILTER_NEAREST_MIPMAP_LINEAR); pub const SG_FILTER_LINEAR_MIPMAP_NEAREST = @enumToInt(enum_sg_filter.SG_FILTER_LINEAR_MIPMAP_NEAREST); pub const SG_FILTER_LINEAR_MIPMAP_LINEAR = @enumToInt(enum_sg_filter.SG_FILTER_LINEAR_MIPMAP_LINEAR); pub const _SG_FILTER_NUM = @enumToInt(enum_sg_filter._SG_FILTER_NUM); pub const _SG_FILTER_FORCE_U32 = @enumToInt(enum_sg_filter._SG_FILTER_FORCE_U32); pub const sg_filter = enum_sg_filter; pub const enum_sg_wrap = enum(c_int) { _SG_WRAP_DEFAULT = 0, SG_WRAP_REPEAT = 1, SG_WRAP_CLAMP_TO_EDGE = 2, SG_WRAP_CLAMP_TO_BORDER = 3, SG_WRAP_MIRRORED_REPEAT = 4, _SG_WRAP_NUM = 5, _SG_WRAP_FORCE_U32 = 2147483647, _, }; pub const _SG_WRAP_DEFAULT = @enumToInt(enum_sg_wrap._SG_WRAP_DEFAULT); pub const SG_WRAP_REPEAT = @enumToInt(enum_sg_wrap.SG_WRAP_REPEAT); pub const SG_WRAP_CLAMP_TO_EDGE = @enumToInt(enum_sg_wrap.SG_WRAP_CLAMP_TO_EDGE); pub const SG_WRAP_CLAMP_TO_BORDER = @enumToInt(enum_sg_wrap.SG_WRAP_CLAMP_TO_BORDER); pub const SG_WRAP_MIRRORED_REPEAT = @enumToInt(enum_sg_wrap.SG_WRAP_MIRRORED_REPEAT); pub const _SG_WRAP_NUM = @enumToInt(enum_sg_wrap._SG_WRAP_NUM); pub const _SG_WRAP_FORCE_U32 = @enumToInt(enum_sg_wrap._SG_WRAP_FORCE_U32); pub const sg_wrap = enum_sg_wrap; pub const enum_sg_border_color = enum(c_int) { _SG_BORDERCOLOR_DEFAULT = 0, SG_BORDERCOLOR_TRANSPARENT_BLACK = 1, SG_BORDERCOLOR_OPAQUE_BLACK = 2, SG_BORDERCOLOR_OPAQUE_WHITE = 3, _SG_BORDERCOLOR_NUM = 4, _SG_BORDERCOLOR_FORCE_U32 = 2147483647, _, }; pub const _SG_BORDERCOLOR_DEFAULT = @enumToInt(enum_sg_border_color._SG_BORDERCOLOR_DEFAULT); pub const SG_BORDERCOLOR_TRANSPARENT_BLACK = @enumToInt(enum_sg_border_color.SG_BORDERCOLOR_TRANSPARENT_BLACK); pub const SG_BORDERCOLOR_OPAQUE_BLACK = @enumToInt(enum_sg_border_color.SG_BORDERCOLOR_OPAQUE_BLACK); pub const SG_BORDERCOLOR_OPAQUE_WHITE = @enumToInt(enum_sg_border_color.SG_BORDERCOLOR_OPAQUE_WHITE); pub const _SG_BORDERCOLOR_NUM = @enumToInt(enum_sg_border_color._SG_BORDERCOLOR_NUM); pub const _SG_BORDERCOLOR_FORCE_U32 = @enumToInt(enum_sg_border_color._SG_BORDERCOLOR_FORCE_U32); pub const sg_border_color = enum_sg_border_color; pub const enum_sg_vertex_format = enum(c_int) { SG_VERTEXFORMAT_INVALID = 0, SG_VERTEXFORMAT_FLOAT = 1, SG_VERTEXFORMAT_FLOAT2 = 2, SG_VERTEXFORMAT_FLOAT3 = 3, SG_VERTEXFORMAT_FLOAT4 = 4, SG_VERTEXFORMAT_BYTE4 = 5, SG_VERTEXFORMAT_BYTE4N = 6, SG_VERTEXFORMAT_UBYTE4 = 7, SG_VERTEXFORMAT_UBYTE4N = 8, SG_VERTEXFORMAT_SHORT2 = 9, SG_VERTEXFORMAT_SHORT2N = 10, SG_VERTEXFORMAT_USHORT2N = 11, SG_VERTEXFORMAT_SHORT4 = 12, SG_VERTEXFORMAT_SHORT4N = 13, SG_VERTEXFORMAT_USHORT4N = 14, SG_VERTEXFORMAT_UINT10_N2 = 15, _SG_VERTEXFORMAT_NUM = 16, _SG_VERTEXFORMAT_FORCE_U32 = 2147483647, _, }; pub const SG_VERTEXFORMAT_INVALID = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_INVALID); pub const SG_VERTEXFORMAT_FLOAT = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_FLOAT); pub const SG_VERTEXFORMAT_FLOAT2 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_FLOAT2); pub const SG_VERTEXFORMAT_FLOAT3 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_FLOAT3); pub const SG_VERTEXFORMAT_FLOAT4 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_FLOAT4); pub const SG_VERTEXFORMAT_BYTE4 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_BYTE4); pub const SG_VERTEXFORMAT_BYTE4N = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_BYTE4N); pub const SG_VERTEXFORMAT_UBYTE4 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_UBYTE4); pub const SG_VERTEXFORMAT_UBYTE4N = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_UBYTE4N); pub const SG_VERTEXFORMAT_SHORT2 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_SHORT2); pub const SG_VERTEXFORMAT_SHORT2N = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_SHORT2N); pub const SG_VERTEXFORMAT_USHORT2N = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_USHORT2N); pub const SG_VERTEXFORMAT_SHORT4 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_SHORT4); pub const SG_VERTEXFORMAT_SHORT4N = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_SHORT4N); pub const SG_VERTEXFORMAT_USHORT4N = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_USHORT4N); pub const SG_VERTEXFORMAT_UINT10_N2 = @enumToInt(enum_sg_vertex_format.SG_VERTEXFORMAT_UINT10_N2); pub const _SG_VERTEXFORMAT_NUM = @enumToInt(enum_sg_vertex_format._SG_VERTEXFORMAT_NUM); pub const _SG_VERTEXFORMAT_FORCE_U32 = @enumToInt(enum_sg_vertex_format._SG_VERTEXFORMAT_FORCE_U32); pub const sg_vertex_format = enum_sg_vertex_format; pub const enum_sg_vertex_step = enum(c_int) { _SG_VERTEXSTEP_DEFAULT = 0, SG_VERTEXSTEP_PER_VERTEX = 1, SG_VERTEXSTEP_PER_INSTANCE = 2, _SG_VERTEXSTEP_NUM = 3, _SG_VERTEXSTEP_FORCE_U32 = 2147483647, _, }; pub const _SG_VERTEXSTEP_DEFAULT = @enumToInt(enum_sg_vertex_step._SG_VERTEXSTEP_DEFAULT); pub const SG_VERTEXSTEP_PER_VERTEX = @enumToInt(enum_sg_vertex_step.SG_VERTEXSTEP_PER_VERTEX); pub const SG_VERTEXSTEP_PER_INSTANCE = @enumToInt(enum_sg_vertex_step.SG_VERTEXSTEP_PER_INSTANCE); pub const _SG_VERTEXSTEP_NUM = @enumToInt(enum_sg_vertex_step._SG_VERTEXSTEP_NUM); pub const _SG_VERTEXSTEP_FORCE_U32 = @enumToInt(enum_sg_vertex_step._SG_VERTEXSTEP_FORCE_U32); pub const sg_vertex_step = enum_sg_vertex_step; pub const enum_sg_uniform_type = enum(c_int) { SG_UNIFORMTYPE_INVALID = 0, SG_UNIFORMTYPE_FLOAT = 1, SG_UNIFORMTYPE_FLOAT2 = 2, SG_UNIFORMTYPE_FLOAT3 = 3, SG_UNIFORMTYPE_FLOAT4 = 4, SG_UNIFORMTYPE_MAT4 = 5, _SG_UNIFORMTYPE_NUM = 6, _SG_UNIFORMTYPE_FORCE_U32 = 2147483647, _, }; pub const SG_UNIFORMTYPE_INVALID = @enumToInt(enum_sg_uniform_type.SG_UNIFORMTYPE_INVALID); pub const SG_UNIFORMTYPE_FLOAT = @enumToInt(enum_sg_uniform_type.SG_UNIFORMTYPE_FLOAT); pub const SG_UNIFORMTYPE_FLOAT2 = @enumToInt(enum_sg_uniform_type.SG_UNIFORMTYPE_FLOAT2); pub const SG_UNIFORMTYPE_FLOAT3 = @enumToInt(enum_sg_uniform_type.SG_UNIFORMTYPE_FLOAT3); pub const SG_UNIFORMTYPE_FLOAT4 = @enumToInt(enum_sg_uniform_type.SG_UNIFORMTYPE_FLOAT4); pub const SG_UNIFORMTYPE_MAT4 = @enumToInt(enum_sg_uniform_type.SG_UNIFORMTYPE_MAT4); pub const _SG_UNIFORMTYPE_NUM = @enumToInt(enum_sg_uniform_type._SG_UNIFORMTYPE_NUM); pub const _SG_UNIFORMTYPE_FORCE_U32 = @enumToInt(enum_sg_uniform_type._SG_UNIFORMTYPE_FORCE_U32); pub const sg_uniform_type = enum_sg_uniform_type; pub const enum_sg_cull_mode = enum(c_int) { _SG_CULLMODE_DEFAULT = 0, SG_CULLMODE_NONE = 1, SG_CULLMODE_FRONT = 2, SG_CULLMODE_BACK = 3, _SG_CULLMODE_NUM = 4, _SG_CULLMODE_FORCE_U32 = 2147483647, _, }; pub const _SG_CULLMODE_DEFAULT = @enumToInt(enum_sg_cull_mode._SG_CULLMODE_DEFAULT); pub const SG_CULLMODE_NONE = @enumToInt(enum_sg_cull_mode.SG_CULLMODE_NONE); pub const SG_CULLMODE_FRONT = @enumToInt(enum_sg_cull_mode.SG_CULLMODE_FRONT); pub const SG_CULLMODE_BACK = @enumToInt(enum_sg_cull_mode.SG_CULLMODE_BACK); pub const _SG_CULLMODE_NUM = @enumToInt(enum_sg_cull_mode._SG_CULLMODE_NUM); pub const _SG_CULLMODE_FORCE_U32 = @enumToInt(enum_sg_cull_mode._SG_CULLMODE_FORCE_U32); pub const sg_cull_mode = enum_sg_cull_mode; pub const enum_sg_face_winding = enum(c_int) { _SG_FACEWINDING_DEFAULT = 0, SG_FACEWINDING_CCW = 1, SG_FACEWINDING_CW = 2, _SG_FACEWINDING_NUM = 3, _SG_FACEWINDING_FORCE_U32 = 2147483647, _, }; pub const _SG_FACEWINDING_DEFAULT = @enumToInt(enum_sg_face_winding._SG_FACEWINDING_DEFAULT); pub const SG_FACEWINDING_CCW = @enumToInt(enum_sg_face_winding.SG_FACEWINDING_CCW); pub const SG_FACEWINDING_CW = @enumToInt(enum_sg_face_winding.SG_FACEWINDING_CW); pub const _SG_FACEWINDING_NUM = @enumToInt(enum_sg_face_winding._SG_FACEWINDING_NUM); pub const _SG_FACEWINDING_FORCE_U32 = @enumToInt(enum_sg_face_winding._SG_FACEWINDING_FORCE_U32); pub const sg_face_winding = enum_sg_face_winding; pub const enum_sg_compare_func = enum(c_int) { _SG_COMPAREFUNC_DEFAULT = 0, SG_COMPAREFUNC_NEVER = 1, SG_COMPAREFUNC_LESS = 2, SG_COMPAREFUNC_EQUAL = 3, SG_COMPAREFUNC_LESS_EQUAL = 4, SG_COMPAREFUNC_GREATER = 5, SG_COMPAREFUNC_NOT_EQUAL = 6, SG_COMPAREFUNC_GREATER_EQUAL = 7, SG_COMPAREFUNC_ALWAYS = 8, _SG_COMPAREFUNC_NUM = 9, _SG_COMPAREFUNC_FORCE_U32 = 2147483647, _, }; pub const _SG_COMPAREFUNC_DEFAULT = @enumToInt(enum_sg_compare_func._SG_COMPAREFUNC_DEFAULT); pub const SG_COMPAREFUNC_NEVER = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_NEVER); pub const SG_COMPAREFUNC_LESS = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_LESS); pub const SG_COMPAREFUNC_EQUAL = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_EQUAL); pub const SG_COMPAREFUNC_LESS_EQUAL = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_LESS_EQUAL); pub const SG_COMPAREFUNC_GREATER = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_GREATER); pub const SG_COMPAREFUNC_NOT_EQUAL = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_NOT_EQUAL); pub const SG_COMPAREFUNC_GREATER_EQUAL = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_GREATER_EQUAL); pub const SG_COMPAREFUNC_ALWAYS = @enumToInt(enum_sg_compare_func.SG_COMPAREFUNC_ALWAYS); pub const _SG_COMPAREFUNC_NUM = @enumToInt(enum_sg_compare_func._SG_COMPAREFUNC_NUM); pub const _SG_COMPAREFUNC_FORCE_U32 = @enumToInt(enum_sg_compare_func._SG_COMPAREFUNC_FORCE_U32); pub const sg_compare_func = enum_sg_compare_func; pub const enum_sg_stencil_op = enum(c_int) { _SG_STENCILOP_DEFAULT = 0, SG_STENCILOP_KEEP = 1, SG_STENCILOP_ZERO = 2, SG_STENCILOP_REPLACE = 3, SG_STENCILOP_INCR_CLAMP = 4, SG_STENCILOP_DECR_CLAMP = 5, SG_STENCILOP_INVERT = 6, SG_STENCILOP_INCR_WRAP = 7, SG_STENCILOP_DECR_WRAP = 8, _SG_STENCILOP_NUM = 9, _SG_STENCILOP_FORCE_U32 = 2147483647, _, }; pub const _SG_STENCILOP_DEFAULT = @enumToInt(enum_sg_stencil_op._SG_STENCILOP_DEFAULT); pub const SG_STENCILOP_KEEP = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_KEEP); pub const SG_STENCILOP_ZERO = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_ZERO); pub const SG_STENCILOP_REPLACE = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_REPLACE); pub const SG_STENCILOP_INCR_CLAMP = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_INCR_CLAMP); pub const SG_STENCILOP_DECR_CLAMP = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_DECR_CLAMP); pub const SG_STENCILOP_INVERT = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_INVERT); pub const SG_STENCILOP_INCR_WRAP = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_INCR_WRAP); pub const SG_STENCILOP_DECR_WRAP = @enumToInt(enum_sg_stencil_op.SG_STENCILOP_DECR_WRAP); pub const _SG_STENCILOP_NUM = @enumToInt(enum_sg_stencil_op._SG_STENCILOP_NUM); pub const _SG_STENCILOP_FORCE_U32 = @enumToInt(enum_sg_stencil_op._SG_STENCILOP_FORCE_U32); pub const sg_stencil_op = enum_sg_stencil_op; pub const enum_sg_blend_factor = enum(c_int) { _SG_BLENDFACTOR_DEFAULT = 0, SG_BLENDFACTOR_ZERO = 1, SG_BLENDFACTOR_ONE = 2, SG_BLENDFACTOR_SRC_COLOR = 3, SG_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 4, SG_BLENDFACTOR_SRC_ALPHA = 5, SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 6, SG_BLENDFACTOR_DST_COLOR = 7, SG_BLENDFACTOR_ONE_MINUS_DST_COLOR = 8, SG_BLENDFACTOR_DST_ALPHA = 9, SG_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 10, SG_BLENDFACTOR_SRC_ALPHA_SATURATED = 11, SG_BLENDFACTOR_BLEND_COLOR = 12, SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR = 13, SG_BLENDFACTOR_BLEND_ALPHA = 14, SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA = 15, _SG_BLENDFACTOR_NUM = 16, _SG_BLENDFACTOR_FORCE_U32 = 2147483647, _, }; pub const _SG_BLENDFACTOR_DEFAULT = @enumToInt(enum_sg_blend_factor._SG_BLENDFACTOR_DEFAULT); pub const SG_BLENDFACTOR_ZERO = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ZERO); pub const SG_BLENDFACTOR_ONE = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ONE); pub const SG_BLENDFACTOR_SRC_COLOR = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_SRC_COLOR); pub const SG_BLENDFACTOR_ONE_MINUS_SRC_COLOR = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ONE_MINUS_SRC_COLOR); pub const SG_BLENDFACTOR_SRC_ALPHA = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_SRC_ALPHA); pub const SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA); pub const SG_BLENDFACTOR_DST_COLOR = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_DST_COLOR); pub const SG_BLENDFACTOR_ONE_MINUS_DST_COLOR = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ONE_MINUS_DST_COLOR); pub const SG_BLENDFACTOR_DST_ALPHA = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_DST_ALPHA); pub const SG_BLENDFACTOR_ONE_MINUS_DST_ALPHA = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ONE_MINUS_DST_ALPHA); pub const SG_BLENDFACTOR_SRC_ALPHA_SATURATED = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_SRC_ALPHA_SATURATED); pub const SG_BLENDFACTOR_BLEND_COLOR = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_BLEND_COLOR); pub const SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ONE_MINUS_BLEND_COLOR); pub const SG_BLENDFACTOR_BLEND_ALPHA = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_BLEND_ALPHA); pub const SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA = @enumToInt(enum_sg_blend_factor.SG_BLENDFACTOR_ONE_MINUS_BLEND_ALPHA); pub const _SG_BLENDFACTOR_NUM = @enumToInt(enum_sg_blend_factor._SG_BLENDFACTOR_NUM); pub const _SG_BLENDFACTOR_FORCE_U32 = @enumToInt(enum_sg_blend_factor._SG_BLENDFACTOR_FORCE_U32); pub const sg_blend_factor = enum_sg_blend_factor; pub const enum_sg_blend_op = enum(c_int) { _SG_BLENDOP_DEFAULT = 0, SG_BLENDOP_ADD = 1, SG_BLENDOP_SUBTRACT = 2, SG_BLENDOP_REVERSE_SUBTRACT = 3, _SG_BLENDOP_NUM = 4, _SG_BLENDOP_FORCE_U32 = 2147483647, _, }; pub const _SG_BLENDOP_DEFAULT = @enumToInt(enum_sg_blend_op._SG_BLENDOP_DEFAULT); pub const SG_BLENDOP_ADD = @enumToInt(enum_sg_blend_op.SG_BLENDOP_ADD); pub const SG_BLENDOP_SUBTRACT = @enumToInt(enum_sg_blend_op.SG_BLENDOP_SUBTRACT); pub const SG_BLENDOP_REVERSE_SUBTRACT = @enumToInt(enum_sg_blend_op.SG_BLENDOP_REVERSE_SUBTRACT); pub const _SG_BLENDOP_NUM = @enumToInt(enum_sg_blend_op._SG_BLENDOP_NUM); pub const _SG_BLENDOP_FORCE_U32 = @enumToInt(enum_sg_blend_op._SG_BLENDOP_FORCE_U32); pub const sg_blend_op = enum_sg_blend_op; pub const enum_sg_color_mask = enum(c_int) { _SG_COLORMASK_DEFAULT = 0, SG_COLORMASK_NONE = 16, SG_COLORMASK_R = 1, SG_COLORMASK_G = 2, SG_COLORMASK_RG = 3, SG_COLORMASK_B = 4, SG_COLORMASK_RB = 5, SG_COLORMASK_GB = 6, SG_COLORMASK_RGB = 7, SG_COLORMASK_A = 8, SG_COLORMASK_RA = 9, SG_COLORMASK_GA = 10, SG_COLORMASK_RGA = 11, SG_COLORMASK_BA = 12, SG_COLORMASK_RBA = 13, SG_COLORMASK_GBA = 14, SG_COLORMASK_RGBA = 15, _SG_COLORMASK_FORCE_U32 = 2147483647, _, }; pub const _SG_COLORMASK_DEFAULT = @enumToInt(enum_sg_color_mask._SG_COLORMASK_DEFAULT); pub const SG_COLORMASK_NONE = @enumToInt(enum_sg_color_mask.SG_COLORMASK_NONE); pub const SG_COLORMASK_R = @enumToInt(enum_sg_color_mask.SG_COLORMASK_R); pub const SG_COLORMASK_G = @enumToInt(enum_sg_color_mask.SG_COLORMASK_G); pub const SG_COLORMASK_RG = @enumToInt(enum_sg_color_mask.SG_COLORMASK_RG); pub const SG_COLORMASK_B = @enumToInt(enum_sg_color_mask.SG_COLORMASK_B); pub const SG_COLORMASK_RB = @enumToInt(enum_sg_color_mask.SG_COLORMASK_RB); pub const SG_COLORMASK_GB = @enumToInt(enum_sg_color_mask.SG_COLORMASK_GB); pub const SG_COLORMASK_RGB = @enumToInt(enum_sg_color_mask.SG_COLORMASK_RGB); pub const SG_COLORMASK_A = @enumToInt(enum_sg_color_mask.SG_COLORMASK_A); pub const SG_COLORMASK_RA = @enumToInt(enum_sg_color_mask.SG_COLORMASK_RA); pub const SG_COLORMASK_GA = @enumToInt(enum_sg_color_mask.SG_COLORMASK_GA); pub const SG_COLORMASK_RGA = @enumToInt(enum_sg_color_mask.SG_COLORMASK_RGA); pub const SG_COLORMASK_BA = @enumToInt(enum_sg_color_mask.SG_COLORMASK_BA); pub const SG_COLORMASK_RBA = @enumToInt(enum_sg_color_mask.SG_COLORMASK_RBA); pub const SG_COLORMASK_GBA = @enumToInt(enum_sg_color_mask.SG_COLORMASK_GBA); pub const SG_COLORMASK_RGBA = @enumToInt(enum_sg_color_mask.SG_COLORMASK_RGBA); pub const _SG_COLORMASK_FORCE_U32 = @enumToInt(enum_sg_color_mask._SG_COLORMASK_FORCE_U32); pub const sg_color_mask = enum_sg_color_mask; pub const enum_sg_action = enum(c_int) { _SG_ACTION_DEFAULT = 0, SG_ACTION_CLEAR = 1, SG_ACTION_LOAD = 2, SG_ACTION_DONTCARE = 3, _SG_ACTION_NUM = 4, _SG_ACTION_FORCE_U32 = 2147483647, _, }; pub const _SG_ACTION_DEFAULT = @enumToInt(enum_sg_action._SG_ACTION_DEFAULT); pub const SG_ACTION_CLEAR = @enumToInt(enum_sg_action.SG_ACTION_CLEAR); pub const SG_ACTION_LOAD = @enumToInt(enum_sg_action.SG_ACTION_LOAD); pub const SG_ACTION_DONTCARE = @enumToInt(enum_sg_action.SG_ACTION_DONTCARE); pub const _SG_ACTION_NUM = @enumToInt(enum_sg_action._SG_ACTION_NUM); pub const _SG_ACTION_FORCE_U32 = @enumToInt(enum_sg_action._SG_ACTION_FORCE_U32); pub const sg_action = enum_sg_action; pub const struct_sg_color_attachment_action = extern struct { action: sg_action, value: sg_color, }; pub const sg_color_attachment_action = struct_sg_color_attachment_action; pub const struct_sg_depth_attachment_action = extern struct { action: sg_action, value: f32, }; pub const sg_depth_attachment_action = struct_sg_depth_attachment_action; pub const struct_sg_stencil_attachment_action = extern struct { action: sg_action, value: u8, }; pub const sg_stencil_attachment_action = struct_sg_stencil_attachment_action; pub const struct_sg_pass_action = extern struct { _start_canary: u32, colors: [4]sg_color_attachment_action, depth: sg_depth_attachment_action, stencil: sg_stencil_attachment_action, _end_canary: u32, }; pub const sg_pass_action = struct_sg_pass_action; pub const struct_sg_bindings = extern struct { _start_canary: u32, vertex_buffers: [8]sg_buffer, vertex_buffer_offsets: [8]c_int, index_buffer: sg_buffer, index_buffer_offset: c_int, vs_images: [12]sg_image, fs_images: [12]sg_image, _end_canary: u32, }; pub const sg_bindings = struct_sg_bindings; pub const struct_sg_buffer_desc = extern struct { _start_canary: u32, size: usize, type: sg_buffer_type, usage: sg_usage, data: sg_range, label: [*c]const u8, gl_buffers: [2]u32, mtl_buffers: [2]?*const c_void, d3d11_buffer: ?*const c_void, wgpu_buffer: ?*const c_void, _end_canary: u32, }; pub const sg_buffer_desc = struct_sg_buffer_desc; pub const struct_sg_image_data = extern struct { subimage: [6][16]sg_range, }; pub const sg_image_data = struct_sg_image_data; pub const struct_sg_image_desc = extern struct { _start_canary: u32, type: sg_image_type, render_target: bool, width: c_int, height: c_int, num_slices: c_int, num_mipmaps: c_int, usage: sg_usage, pixel_format: sg_pixel_format, sample_count: c_int, min_filter: sg_filter, mag_filter: sg_filter, wrap_u: sg_wrap, wrap_v: sg_wrap, wrap_w: sg_wrap, border_color: sg_border_color, max_anisotropy: u32, min_lod: f32, max_lod: f32, data: sg_image_data, label: [*c]const u8, gl_textures: [2]u32, gl_texture_target: u32, mtl_textures: [2]?*const c_void, d3d11_texture: ?*const c_void, d3d11_shader_resource_view: ?*const c_void, wgpu_texture: ?*const c_void, _end_canary: u32, }; pub const sg_image_desc = struct_sg_image_desc; pub const struct_sg_shader_attr_desc = extern struct { name: [*c]const u8, sem_name: [*c]const u8, sem_index: c_int, }; pub const sg_shader_attr_desc = struct_sg_shader_attr_desc; pub const struct_sg_shader_uniform_desc = extern struct { name: [*c]const u8, type: sg_uniform_type, array_count: c_int, }; pub const sg_shader_uniform_desc = struct_sg_shader_uniform_desc; pub const struct_sg_shader_uniform_block_desc = extern struct { size: usize, uniforms: [16]sg_shader_uniform_desc, }; pub const sg_shader_uniform_block_desc = struct_sg_shader_uniform_block_desc; pub const struct_sg_shader_image_desc = extern struct { name: [*c]const u8, image_type: sg_image_type, sampler_type: sg_sampler_type, }; pub const sg_shader_image_desc = struct_sg_shader_image_desc; pub const struct_sg_shader_stage_desc = extern struct { source: [*c]const u8, bytecode: sg_range, entry: [*c]const u8, d3d11_target: [*c]const u8, uniform_blocks: [4]sg_shader_uniform_block_desc, images: [12]sg_shader_image_desc, }; pub const sg_shader_stage_desc = struct_sg_shader_stage_desc; pub const struct_sg_shader_desc = extern struct { _start_canary: u32, attrs: [16]sg_shader_attr_desc, vs: sg_shader_stage_desc, fs: sg_shader_stage_desc, label: [*c]const u8, _end_canary: u32, }; pub const sg_shader_desc = struct_sg_shader_desc; pub const struct_sg_buffer_layout_desc = extern struct { stride: c_int, step_func: sg_vertex_step, step_rate: c_int, }; pub const sg_buffer_layout_desc = struct_sg_buffer_layout_desc; pub const struct_sg_vertex_attr_desc = extern struct { buffer_index: c_int, offset: c_int, format: sg_vertex_format, }; pub const sg_vertex_attr_desc = struct_sg_vertex_attr_desc; pub const struct_sg_layout_desc = extern struct { buffers: [8]sg_buffer_layout_desc, attrs: [16]sg_vertex_attr_desc, }; pub const sg_layout_desc = struct_sg_layout_desc; pub const struct_sg_stencil_face_state = extern struct { compare: sg_compare_func, fail_op: sg_stencil_op, depth_fail_op: sg_stencil_op, pass_op: sg_stencil_op, }; pub const sg_stencil_face_state = struct_sg_stencil_face_state; pub const struct_sg_stencil_state = extern struct { enabled: bool, front: sg_stencil_face_state, back: sg_stencil_face_state, read_mask: u8, write_mask: u8, ref: u8, }; pub const sg_stencil_state = struct_sg_stencil_state; pub const struct_sg_depth_state = extern struct { pixel_format: sg_pixel_format, compare: sg_compare_func, write_enabled: bool, bias: f32, bias_slope_scale: f32, bias_clamp: f32, }; pub const sg_depth_state = struct_sg_depth_state; pub const struct_sg_blend_state = extern struct { enabled: bool, src_factor_rgb: sg_blend_factor, dst_factor_rgb: sg_blend_factor, op_rgb: sg_blend_op, src_factor_alpha: sg_blend_factor, dst_factor_alpha: sg_blend_factor, op_alpha: sg_blend_op, }; pub const sg_blend_state = struct_sg_blend_state; pub const struct_sg_color_state = extern struct { pixel_format: sg_pixel_format, write_mask: sg_color_mask, blend: sg_blend_state, }; pub const sg_color_state = struct_sg_color_state; pub const struct_sg_pipeline_desc = extern struct { _start_canary: u32, shader: sg_shader, layout: sg_layout_desc, depth: sg_depth_state, stencil: sg_stencil_state, color_count: c_int, colors: [4]sg_color_state, primitive_type: sg_primitive_type, index_type: sg_index_type, cull_mode: sg_cull_mode, face_winding: sg_face_winding, sample_count: c_int, blend_color: sg_color, alpha_to_coverage_enabled: bool, label: [*c]const u8, _end_canary: u32, }; pub const sg_pipeline_desc = struct_sg_pipeline_desc; pub const struct_sg_pass_attachment_desc = extern struct { image: sg_image, mip_level: c_int, slice: c_int, }; pub const sg_pass_attachment_desc = struct_sg_pass_attachment_desc; pub const struct_sg_pass_desc = extern struct { _start_canary: u32, color_attachments: [4]sg_pass_attachment_desc, depth_stencil_attachment: sg_pass_attachment_desc, label: [*c]const u8, _end_canary: u32, }; pub const sg_pass_desc = struct_sg_pass_desc; pub const struct_sg_trace_hooks = extern struct { user_data: ?*c_void, reset_state_cache: ?fn (?*c_void) callconv(.C) void, make_buffer: ?fn ([*c]const sg_buffer_desc, sg_buffer, ?*c_void) callconv(.C) void, make_image: ?fn ([*c]const sg_image_desc, sg_image, ?*c_void) callconv(.C) void, make_shader: ?fn ([*c]const sg_shader_desc, sg_shader, ?*c_void) callconv(.C) void, make_pipeline: ?fn ([*c]const sg_pipeline_desc, sg_pipeline, ?*c_void) callconv(.C) void, make_pass: ?fn ([*c]const sg_pass_desc, sg_pass, ?*c_void) callconv(.C) void, destroy_buffer: ?fn (sg_buffer, ?*c_void) callconv(.C) void, destroy_image: ?fn (sg_image, ?*c_void) callconv(.C) void, destroy_shader: ?fn (sg_shader, ?*c_void) callconv(.C) void, destroy_pipeline: ?fn (sg_pipeline, ?*c_void) callconv(.C) void, destroy_pass: ?fn (sg_pass, ?*c_void) callconv(.C) void, update_buffer: ?fn (sg_buffer, [*c]const sg_range, ?*c_void) callconv(.C) void, update_image: ?fn (sg_image, [*c]const sg_image_data, ?*c_void) callconv(.C) void, append_buffer: ?fn (sg_buffer, [*c]const sg_range, c_int, ?*c_void) callconv(.C) void, begin_default_pass: ?fn ([*c]const sg_pass_action, c_int, c_int, ?*c_void) callconv(.C) void, begin_pass: ?fn (sg_pass, [*c]const sg_pass_action, ?*c_void) callconv(.C) void, apply_viewport: ?fn (c_int, c_int, c_int, c_int, bool, ?*c_void) callconv(.C) void, apply_scissor_rect: ?fn (c_int, c_int, c_int, c_int, bool, ?*c_void) callconv(.C) void, apply_pipeline: ?fn (sg_pipeline, ?*c_void) callconv(.C) void, apply_bindings: ?fn ([*c]const sg_bindings, ?*c_void) callconv(.C) void, apply_uniforms: ?fn (sg_shader_stage, c_int, [*c]const sg_range, ?*c_void) callconv(.C) void, draw: ?fn (c_int, c_int, c_int, ?*c_void) callconv(.C) void, end_pass: ?fn (?*c_void) callconv(.C) void, commit: ?fn (?*c_void) callconv(.C) void, alloc_buffer: ?fn (sg_buffer, ?*c_void) callconv(.C) void, alloc_image: ?fn (sg_image, ?*c_void) callconv(.C) void, alloc_shader: ?fn (sg_shader, ?*c_void) callconv(.C) void, alloc_pipeline: ?fn (sg_pipeline, ?*c_void) callconv(.C) void, alloc_pass: ?fn (sg_pass, ?*c_void) callconv(.C) void, dealloc_buffer: ?fn (sg_buffer, ?*c_void) callconv(.C) void, dealloc_image: ?fn (sg_image, ?*c_void) callconv(.C) void, dealloc_shader: ?fn (sg_shader, ?*c_void) callconv(.C) void, dealloc_pipeline: ?fn (sg_pipeline, ?*c_void) callconv(.C) void, dealloc_pass: ?fn (sg_pass, ?*c_void) callconv(.C) void, init_buffer: ?fn (sg_buffer, [*c]const sg_buffer_desc, ?*c_void) callconv(.C) void, init_image: ?fn (sg_image, [*c]const sg_image_desc, ?*c_void) callconv(.C) void, init_shader: ?fn (sg_shader, [*c]const sg_shader_desc, ?*c_void) callconv(.C) void, init_pipeline: ?fn (sg_pipeline, [*c]const sg_pipeline_desc, ?*c_void) callconv(.C) void, init_pass: ?fn (sg_pass, [*c]const sg_pass_desc, ?*c_void) callconv(.C) void, uninit_buffer: ?fn (sg_buffer, ?*c_void) callconv(.C) void, uninit_image: ?fn (sg_image, ?*c_void) callconv(.C) void, uninit_shader: ?fn (sg_shader, ?*c_void) callconv(.C) void, uninit_pipeline: ?fn (sg_pipeline, ?*c_void) callconv(.C) void, uninit_pass: ?fn (sg_pass, ?*c_void) callconv(.C) void, fail_buffer: ?fn (sg_buffer, ?*c_void) callconv(.C) void, fail_image: ?fn (sg_image, ?*c_void) callconv(.C) void, fail_shader: ?fn (sg_shader, ?*c_void) callconv(.C) void, fail_pipeline: ?fn (sg_pipeline, ?*c_void) callconv(.C) void, fail_pass: ?fn (sg_pass, ?*c_void) callconv(.C) void, push_debug_group: ?fn ([*c]const u8, ?*c_void) callconv(.C) void, pop_debug_group: ?fn (?*c_void) callconv(.C) void, err_buffer_pool_exhausted: ?fn (?*c_void) callconv(.C) void, err_image_pool_exhausted: ?fn (?*c_void) callconv(.C) void, err_shader_pool_exhausted: ?fn (?*c_void) callconv(.C) void, err_pipeline_pool_exhausted: ?fn (?*c_void) callconv(.C) void, err_pass_pool_exhausted: ?fn (?*c_void) callconv(.C) void, err_context_mismatch: ?fn (?*c_void) callconv(.C) void, err_pass_invalid: ?fn (?*c_void) callconv(.C) void, err_draw_invalid: ?fn (?*c_void) callconv(.C) void, err_bindings_invalid: ?fn (?*c_void) callconv(.C) void, }; pub const sg_trace_hooks = struct_sg_trace_hooks; pub const struct_sg_slot_info = extern struct { state: sg_resource_state, res_id: u32, ctx_id: u32, }; pub const sg_slot_info = struct_sg_slot_info; pub const struct_sg_buffer_info = extern struct { slot: sg_slot_info, update_frame_index: u32, append_frame_index: u32, append_pos: c_int, append_overflow: bool, num_slots: c_int, active_slot: c_int, }; pub const sg_buffer_info = struct_sg_buffer_info; pub const struct_sg_image_info = extern struct { slot: sg_slot_info, upd_frame_index: u32, num_slots: c_int, active_slot: c_int, width: c_int, height: c_int, }; pub const sg_image_info = struct_sg_image_info; pub const struct_sg_shader_info = extern struct { slot: sg_slot_info, }; pub const sg_shader_info = struct_sg_shader_info; pub const struct_sg_pipeline_info = extern struct { slot: sg_slot_info, }; pub const sg_pipeline_info = struct_sg_pipeline_info; pub const struct_sg_pass_info = extern struct { slot: sg_slot_info, }; pub const sg_pass_info = struct_sg_pass_info; pub const struct_sg_gl_context_desc = extern struct { force_gles2: bool, }; pub const sg_gl_context_desc = struct_sg_gl_context_desc; pub const struct_sg_metal_context_desc = extern struct { device: ?*const c_void, renderpass_descriptor_cb: ?fn () callconv(.C) ?*const c_void, renderpass_descriptor_userdata_cb: ?fn (?*c_void) callconv(.C) ?*const c_void, drawable_cb: ?fn () callconv(.C) ?*const c_void, drawable_userdata_cb: ?fn (?*c_void) callconv(.C) ?*const c_void, user_data: ?*c_void, }; pub const sg_metal_context_desc = struct_sg_metal_context_desc; pub const struct_sg_d3d11_context_desc = extern struct { device: ?*const c_void, device_context: ?*const c_void, render_target_view_cb: ?fn () callconv(.C) ?*const c_void, render_target_view_userdata_cb: ?fn (?*c_void) callconv(.C) ?*const c_void, depth_stencil_view_cb: ?fn () callconv(.C) ?*const c_void, depth_stencil_view_userdata_cb: ?fn (?*c_void) callconv(.C) ?*const c_void, user_data: ?*c_void, }; pub const sg_d3d11_context_desc = struct_sg_d3d11_context_desc; pub const struct_sg_wgpu_context_desc = extern struct { device: ?*const c_void, render_view_cb: ?fn () callconv(.C) ?*const c_void, render_view_userdata_cb: ?fn (?*c_void) callconv(.C) ?*const c_void, resolve_view_cb: ?fn () callconv(.C) ?*const c_void, resolve_view_userdata_cb: ?fn (?*c_void) callconv(.C) ?*const c_void, depth_stencil_view_cb: ?fn () callconv(.C) ?*const c_void, depth_stencil_view_userdata_cb: ?fn (?*c_void) callconv(.C) ?*const c_void, user_data: ?*c_void, }; pub const sg_wgpu_context_desc = struct_sg_wgpu_context_desc; pub const struct_sg_context_desc = extern struct { color_format: sg_pixel_format, depth_format: sg_pixel_format, sample_count: c_int, gl: sg_gl_context_desc, metal: sg_metal_context_desc, d3d11: sg_d3d11_context_desc, wgpu: sg_wgpu_context_desc, }; pub const sg_context_desc = struct_sg_context_desc; pub const struct_sg_desc = extern struct { _start_canary: u32, buffer_pool_size: c_int, image_pool_size: c_int, shader_pool_size: c_int, pipeline_pool_size: c_int, pass_pool_size: c_int, context_pool_size: c_int, uniform_buffer_size: c_int, staging_buffer_size: c_int, sampler_cache_size: c_int, context: sg_context_desc, _end_canary: u32, }; pub const sg_desc = struct_sg_desc;
src/deps/sokol/sokol_gfx.zig
const zang = @import("zang"); const note_frequencies = @import("zang-12tet"); const common = @import("common.zig"); const c = @import("common/c.zig"); const PMOscInstrument = @import("modules.zig").PMOscInstrument; const FilteredSawtoothInstrument = @import("modules.zig").FilteredSawtoothInstrument; pub const AUDIO_FORMAT: zang.AudioFormat = .signed16_lsb; pub const AUDIO_SAMPLE_RATE = 48000; pub const AUDIO_BUFFER_SIZE = 1024; pub const DESCRIPTION = \\example_play \\ \\Play a simple monophonic synthesizer with the \\keyboard. \\ \\Press spacebar to create a low drone in another voice. ; const a4 = 440.0; pub const MainModule = struct { pub const num_outputs = 2; pub const num_temps = 3; pub const output_audio = common.AudioOut{ .mono = 0 }; pub const output_visualize = 0; pub const output_sync_oscilloscope = 1; key0: ?i32, iq0: zang.Notes(PMOscInstrument.Params).ImpulseQueue, idgen0: zang.IdGenerator, instr0: PMOscInstrument, trig0: zang.Trigger(PMOscInstrument.Params), iq1: zang.Notes(FilteredSawtoothInstrument.Params).ImpulseQueue, idgen1: zang.IdGenerator, instr1: FilteredSawtoothInstrument, trig1: zang.Trigger(FilteredSawtoothInstrument.Params), pub fn init() MainModule { return .{ .key0 = null, .iq0 = zang.Notes(PMOscInstrument.Params).ImpulseQueue.init(), .idgen0 = zang.IdGenerator.init(), .instr0 = PMOscInstrument.init(1.0), .trig0 = zang.Trigger(PMOscInstrument.Params).init(), .iq1 = zang.Notes(FilteredSawtoothInstrument.Params).ImpulseQueue.init(), .idgen1 = zang.IdGenerator.init(), .instr1 = FilteredSawtoothInstrument.init(), .trig1 = zang.Trigger(FilteredSawtoothInstrument.Params).init(), }; } pub fn paint( self: *MainModule, span: zang.Span, outputs: [num_outputs][]f32, temps: [num_temps][]f32, ) void { var ctr0 = self.trig0.counter(span, self.iq0.consume()); while (self.trig0.next(&ctr0)) |result| { self.instr0.paint( result.span, .{outputs[0]}, .{ temps[0], temps[1], temps[2] }, result.note_id_changed, result.params, ); zang.addScalarInto(result.span, outputs[1], result.params.freq); } var ctr1 = self.trig1.counter(span, self.iq1.consume()); while (self.trig1.next(&ctr1)) |result| { self.instr1.paint( result.span, .{outputs[0]}, .{ temps[0], temps[1], temps[2] }, result.note_id_changed, result.params, ); } } pub fn keyEvent(self: *MainModule, key: i32, down: bool, impulse_frame: usize) bool { if (key == c.SDLK_SPACE) { const freq = a4 * note_frequencies.c4 / 4.0; self.iq1.push(impulse_frame, self.idgen1.nextId(), .{ .sample_rate = AUDIO_SAMPLE_RATE, .freq = zang.constant(freq), .note_on = down, }); } else if (common.getKeyRelFreq(key)) |rel_freq| { if (down or (if (self.key0) |nh| nh == key else false)) { self.key0 = if (down) key else null; self.iq0.push(impulse_frame, self.idgen0.nextId(), .{ .sample_rate = AUDIO_SAMPLE_RATE, .freq = a4 * rel_freq, .note_on = down, }); } } return true; } };
examples/example_play.zig
const std = @import("std"); pub fn Fixbuf(comptime max_len: usize) type { return struct { const Self = @This(); data: [max_len]u8 = undefined, len: usize = 0, pub fn copyFrom(self: *@This(), data: []const u8) void { std.mem.copy(u8, &self.data, data); self.len = data.len; } pub fn slice(self: @This()) []const u8 { return self.data[0..self.len]; } pub fn append(self: *@This(), char: u8) !void { if (self.len >= max_len) { return error.NoSpaceLeft; } self.data[self.len] = char; self.len += 1; } pub fn last(self: @This()) ?u8 { if (self.len > 0) { return self.data[self.len - 1]; } else { return null; } } pub fn pop(self: *@This()) !u8 { return self.last() orelse error.Empty; } pub fn consumeJsonElement(elem: anytype) !Self { var result = Self{}; const string = try elem.stringBuffer(&result.data); result.len = string.len; return result; } }; } pub fn errSetContains(comptime ErrorSet: type, err: anyerror) bool { inline for (comptime std.meta.fields(ErrorSet)) |e| { if (err == @field(ErrorSet, e.name)) { return true; } } return false; } pub fn ReturnOf(comptime func: anytype) type { return switch (@typeInfo(@TypeOf(func))) { .Fn, .BoundFn => |fn_info| fn_info.return_type.?, else => unreachable, }; } pub fn ErrorOf(comptime func: anytype) type { const return_type = ReturnOf(func); return switch (@typeInfo(return_type)) { .ErrorUnion => |eu_info| eu_info.error_set, else => unreachable, }; } pub fn Mailbox(comptime T: type) type { return struct { const Self = @This(); value: ?T, mutex: std.Thread.Mutex, reset_event: std.Thread.ResetEvent, pub fn init(self: *Self) !void { try self.reset_event.init(); errdefer self.reset_event.deinit(); self.value = null; self.mutex = .{}; } pub fn deinit(self: *Self) void { self.reset_event.deinit(); } pub fn get(self: *Self) T { self.reset_event.wait(); const held = self.mutex.acquire(); defer held.release(); self.reset_event.reset(); defer self.value = null; return self.value.?; } pub fn getWithTimeout(self: *Self, timeout_ns: u64) ?T { _ = self.reset_event.timedWait(timeout_ns); const held = self.mutex.acquire(); defer held.release(); self.reset_event.reset(); defer self.value = null; return self.value; } pub fn putOverwrite(self: *Self, value: T) void { const held = self.mutex.acquire(); defer held.release(); self.value = value; self.reset_event.set(); } }; }
src/util.zig
const std = @import("std"); const Url = @import("../url.zig").Url; pub const TagList = std.ArrayList(Tag); const Real = f64; pub const TagType = enum { container, text }; pub const Color = packed struct { red: u8, green: u8, blue: u8, alpha: u8 = 255 }; pub const SizeUnit = union(enum) { /// Percent where 1 is 100% Percent: Real, Pixels: Real, ViewportWidth: Real, ViewportHeight: Real, Automatic: void, pub const Zero = SizeUnit { .Pixels = 0 }; pub fn get(self: *const SizeUnit, vw: Real, vh: Real) ?Real { return switch (self.*) { .Pixels => |pixels| pixels, .Percent => |percent| unreachable, // TODO .ViewportWidth => |vW| vw*vW, .ViewportHeight => |vH| vh*vH, .Automatic => null }; } }; pub const TextSize = union(enum) { Units: Real, Percent: Real, }; pub const Rectangle = struct { x: SizeUnit = SizeUnit.Zero, y: SizeUnit = SizeUnit.Zero, width: SizeUnit = SizeUnit.Zero, height: SizeUnit = SizeUnit.Zero }; pub const Style = struct { textColor: ?Color = null, width: SizeUnit = .Automatic, height: SizeUnit = .Automatic, margin: Rectangle = .{}, lineHeight: Real = 1.2, fontFace: [:0]const u8 = "Nunito", fontSize: Real = 16, }; pub const Tag = struct { parent: ?*Tag = null, allocator: ?*std.mem.Allocator, style: Style = .{}, href: ?Url = null, id: ?[]const u8 = null, elementType: []const u8, layoutX: f64 = 0, layoutY: f64 = 0, data: union(TagType) { text: [:0]const u8, /// List of childrens tags container: TagList }, pub fn getElementById(self: *const Tag, id: []const u8) ?*Tag { switch (self.data) { .container => |container| { for (container.items) |*tag| { if (std.mem.eql(u8, tag.id, id)) return tag; if (tag.getElementById(id)) |elem| { return elem; } } }, else => {} } } pub fn deinit(self: *const Tag) void { if (self.href) |href| href.deinit(); switch (self.data) { .text => |text| { if (self.allocator) |allocator| allocator.free(text); }, .container => |*tags| { for (tags.items) |*tag| { tag.deinit(); } tags.deinit(); } } } }; pub const Document = struct { tags: TagList, pub fn getElementById(self: *const Document, id: []const u8) ?*Tag { for (self.tags.items) |*tag| { if (std.mem.eql(u8, tag.id, id)) return tag; if (tag.getElementById(id)) |elem| { return elem; } } } pub fn deinit(self: *const Document) void { for (self.tags.items) |*tag| { tag.deinit(); } self.tags.deinit(); } };
zervo/markups/imr.zig
const std = @import("std"); const assert = std.debug.assert; const Allocator = std.mem.Allocator; const termios = @cImport(@cInclude("termios.h")); const Vec2 = @import("geometry.zig").Vec2; const World = @import("World.zig"); var old_settings_global: termios.struct_termios = undefined; var in_raw_mode_global: bool = false; fn enterRawMode() !void { assert(!in_raw_mode_global); var settings: termios.struct_termios = undefined; if (termios.tcgetattr(std.os.STDOUT_FILENO, &settings) < 0) return error.RawMode; old_settings_global = settings; termios.cfmakeraw(&settings); if (termios.tcsetattr(std.os.STDOUT_FILENO, termios.TCSANOW, &settings) < 0) return error.RawMode; in_raw_mode_global = true; } fn exitRawMode() void { assert(in_raw_mode_global); _ = termios.tcsetattr(std.os.STDOUT_FILENO, termios.TCSANOW, &old_settings_global); in_raw_mode_global = false; } const Reader = std.fs.File.Reader; const FileWriter = std.fs.File.Writer; const WriterBuffer = std.io.BufferedWriter(4096, FileWriter); const Writer = WriterBuffer.Writer; fn beginUI(w: FileWriter) !void { try enterRawMode(); errdefer exitRawMode(); try w.print("\x1b[?1049h" ++ "\x1b[?25l", .{}); // switch to alternate screen, hide the cursor } fn endUI(w: FileWriter) void { w.print("\x1b[?25h" ++ "\x1b[?1049l", .{}) catch {}; // show the cursor, switch to main screen exitRawMode(); // make sure to do this even if the write fails } fn moveCursorAbsolute(w: Writer, x: u16, y: u16) !void { try w.print("\x1b[{};{}H", .{ y + 1, x + 1 }); // CHA } fn moveCursor(w: Writer, old_x: u16, old_y: u16, new_x: u16, new_y: u16) !void { var dy = @as(i32, new_y) - @as(i32, old_y); var dx = @as(i32, new_x) - @as(i32, old_x); return if (dy < 0) moveCursorAbsolute(w, new_x, new_y) else if (dy == 0) if (dx < 0) w.print("\x1b[{}D", .{-dx}) // CUB else if (dx > 0) w.print("\x1b[{}C", .{dx}) // CUF else {} else if (dx == 0 and dy > 0) if (dy == 1) w.print("\n", .{}) else w.print("\x1b[{}B", .{dy}) // CUD else if (new_x == 0 and dy > 0) if (dy == 1) w.print("\r\n", .{}) else w.print("\x1b[{}E", .{dy}) // CNL else moveCursorAbsolute(w, new_x, new_y); } const Screen = struct { const Color = enum { default, black, white, dark_gray }; const Cell = struct { c: u16, fg: Color, bg: Color, fn eq(self: Cell, other: Cell) bool { return std.meta.eql(self, other); } fn charOfTile(t: World.TileKind) u16 { return switch (t) { .solid => '#', .empty => '.', }; } fn compute(world: World, at: Vec2) Cell { if (world.hasPlayerAt(at)) return .{ .c = '@', .fg = .black, .bg = .white }; const tile = world.mapTile(at).?.*; var c = charOfTile(tile.kind); var fg = Color.default; var bg = Color.default; if (tile.is_visible) switch (tile.kind) { .empty => {}, .solid => bg = .dark_gray, } else if (tile.is_visited) fg = .dark_gray else c = ' '; return .{ .c = c, .fg = fg, .bg = bg }; } }; width: u16, height: u16, cells: []Cell, cursor_x: u16, cursor_y: u16, cursor_fg: Color, cursor_bg: Color, wb: WriterBuffer, fn init(alloc: Allocator, wb: WriterBuffer, width: u16, height: u16) !Screen { assert(width > 0 and height > 0); try wb.unbuffered_writer.print("\x1b[H\x1b[J", .{}); // clear screen & move to top const n_cells = @as(usize, width) * @as(usize, height); const cells = try alloc.alloc(Cell, n_cells); std.mem.set(Cell, cells, .{ .c = ' ', .fg = .default, .bg = .default }); return Screen{ .width = width, .height = height, .cells = cells, .cursor_x = 0, .cursor_y = 0, .cursor_fg = .default, .cursor_bg = .default, .wb = wb, }; } fn deinit(self: Screen, alloc: Allocator) void { alloc.free(self.cells); } fn colorCode(ctx: enum(u8) { fg = 0, bg = 10 }, c: Color) u8 { return @enumToInt(ctx) + switch (c) { // zig fmt: off .default => @as(u8, 39), .black => 30, .white => 97, .dark_gray => 90, // zig fmt: on }; } fn update(self: *Screen, world: World) !void { const writer = self.wb.writer(); var cx = self.cursor_x; var cy = self.cursor_y; var fg = self.cursor_fg; var bg = self.cursor_bg; var cell_idx: usize = 0; var y: u16 = 0; while (y < self.height) : (y += 1) { var x: u16 = 0; while (x < self.width) : (x += 1) { const at = Vec2.new(@intCast(i16, x), @intCast(i16, y)); const cur_cell = Cell.compute(world, at); const old_cell = &self.cells[cell_idx]; cell_idx += 1; if (!old_cell.eq(cur_cell)) { try moveCursor(writer, cx, cy, x, y); if (fg != cur_cell.fg) try writer.print("\x1b[{}m", .{colorCode(.fg, cur_cell.fg)}); if (bg != cur_cell.bg) try writer.print("\x1b[{}m", .{colorCode(.bg, cur_cell.bg)}); fg = cur_cell.fg; bg = cur_cell.bg; try writer.print("{u}", .{cur_cell.c}); cx = x + 1; cy = y; old_cell.* = cur_cell; } } } self.cursor_x = cx; self.cursor_y = cy; self.cursor_fg = fg; self.cursor_bg = bg; try self.wb.flush(); } }; const Key = enum { ctrl_c, y, u, h, j, k, l, v, b, n, question_mark, other }; fn readKey(r: Reader) !Key { return switch (try r.readByte()) { '\x03' => Key.ctrl_c, 'y' => Key.y, 'u' => Key.u, 'h' => Key.h, 'j' => Key.j, 'k' => Key.k, 'l' => Key.l, 'v' => Key.v, 'b' => Key.b, 'n' => Key.n, '?' => Key.question_mark, else => Key.other, }; } fn runGame(alloc: Allocator, r: Reader, wb: WriterBuffer) !void { const width = 80; const height = 24; var world = try World.init(alloc, width, height); defer world.deinit(); var screen = try Screen.init(alloc, wb, width, height); defer screen.deinit(alloc); try world.recomputeVisibility(); while (true) { try screen.update(world); const k = try readKey(r); std.debug.print("got key: {}\n", .{k}); switch (k) { .ctrl_c => break, // zig fmt: off .y => try world.movePlayer(-1, -1), .u => try world.movePlayer( 1, -1), .h => try world.movePlayer(-1, 0), .j => try world.movePlayer( 0, 1), .k => try world.movePlayer( 0, -1), .l => try world.movePlayer( 1, 0), .b => try world.movePlayer(-1, 1), .n => try world.movePlayer( 1, 1), // zig fmt: on .v => try world.toggleOmniscience(), .question_mark => try world.jumpPlayer(), else => {}, } } } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); const stdin = std.io.getStdIn().reader(); var alloc = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = alloc.deinit(); try beginUI(stdout); defer endUI(stdout); var stdout_buf = std.io.bufferedWriter(stdout); try runGame(alloc.allocator(), stdin, stdout_buf); try stdout_buf.flush(); } test "compilation" { std.testing.refAllDecls(@This()); std.testing.refAllDecls(Screen); }
src/main.zig
const std = @import("std"); const sdl = @import("sdl"); const renderkit = @import("renderkit"); pub const WindowConfig = struct { title: [:0]const u8 = "Zig GameKit", // the window title as UTF-8 encoded string width: i32 = 800, // the preferred width of the window / canvas height: i32 = 600, // the preferred height of the window / canvas resizable: bool = true, // whether the window should be allowed to be resized fullscreen: bool = false, // whether the window should be created in fullscreen mode high_dpi: bool = false, // whether the backbuffer is full-resolution on HighDPI displays disable_vsync: bool = false, // whether vsync should be disabled }; pub const WindowMode = enum(u32) { windowed = 0, full_screen = 1, desktop = 4097, }; pub const Window = struct { sdl_window: *sdl.SDL_Window = undefined, gl_ctx: sdl.SDL_GLContext = undefined, id: u32 = 0, focused: bool = true, pub fn init(config: WindowConfig) !Window { var window = Window{}; _ = sdl.SDL_InitSubSystem(sdl.SDL_INIT_VIDEO); var flags: c_int = 0; if (config.resizable) flags |= sdl.SDL_WINDOW_RESIZABLE; if (config.high_dpi) flags |= sdl.SDL_WINDOW_ALLOW_HIGHDPI; if (config.fullscreen) flags |= sdl.SDL_WINDOW_FULLSCREEN_DESKTOP; window.createOpenGlWindow(config, flags); if (config.disable_vsync) _ = sdl.SDL_GL_SetSwapInterval(0); window.id = sdl.SDL_GetWindowID(window.sdl_window); return window; } pub fn deinit(self: Window) void { sdl.SDL_DestroyWindow(self.sdl_window); sdl.SDL_GL_DeleteContext(self.gl_ctx); } fn createOpenGlWindow(self: *Window, config: WindowConfig, flags: c_int) void { _ = sdl.SDL_GL_SetAttribute(.SDL_GL_CONTEXT_FLAGS, sdl.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); _ = sdl.SDL_GL_SetAttribute(.SDL_GL_CONTEXT_PROFILE_MASK, sdl.SDL_GL_CONTEXT_PROFILE_CORE); _ = sdl.SDL_GL_SetAttribute(.SDL_GL_CONTEXT_MAJOR_VERSION, 3); _ = sdl.SDL_GL_SetAttribute(.SDL_GL_CONTEXT_MINOR_VERSION, 3); _ = sdl.SDL_GL_SetAttribute(.SDL_GL_DOUBLEBUFFER, 1); _ = sdl.SDL_GL_SetAttribute(.SDL_GL_DEPTH_SIZE, 24); _ = sdl.SDL_GL_SetAttribute(.SDL_GL_STENCIL_SIZE, 8); var window_flags = flags | @enumToInt(sdl.SDL_WindowFlags.SDL_WINDOW_OPENGL); self.sdl_window = sdl.SDL_CreateWindow(config.title, sdl.SDL_WINDOWPOS_UNDEFINED, sdl.SDL_WINDOWPOS_UNDEFINED, config.width, config.height, @bitCast(u32, window_flags)) orelse { sdl.SDL_Log("Unable to create window: %s", sdl.SDL_GetError()); @panic("no window"); }; self.gl_ctx = sdl.SDL_GL_CreateContext(self.sdl_window); } pub fn handleEvent(self: *Window, event: *sdl.SDL_WindowEvent) void { switch (event.event) { sdl.SDL_WINDOWEVENT_SIZE_CHANGED => { std.log.warn("resize: {}x{}\n", .{ event.data1, event.data2 }); // TODO: make a resized event }, sdl.SDL_WINDOWEVENT_FOCUS_GAINED => self.focused = true, sdl.SDL_WINDOWEVENT_FOCUS_LOST => self.focused = false, else => {}, } } /// returns the drawable width / the window width. Used to scale mouse coords when the OS gives them to us in points. pub fn scale(self: Window) f32 { var wx = self.width(); const draw_size = self.drawableSize(); return @intToFloat(f32, draw_size.w) / @intToFloat(f32, wx); } pub fn width(self: Window) i32 { return self.size().w; } pub fn height(self: Window) i32 { return self.size().h; } pub fn drawableSize(self: Window) struct { w: c_int, h: c_int } { var w: c_int = 0; var h: c_int = 0; sdl.SDL_GL_GetDrawableSize(self.sdl_window, &w, &h); return .{ .w = w, .h = h }; } pub fn size(self: Window) struct { w: c_int, h: c_int } { var w: c_int = 0; var h: c_int = 0; sdl.SDL_GetWindowSize(self.sdl_window, &w, &h); return .{ .w = w, .h = h }; } pub fn setSize(self: Window, w: i32, h: i32) void { sdl.SDL_SetWindowSize(self.sdl_window, w, h); } pub fn position(self: Window) struct { x: c_int, y: c_int } { var x: c_int = 0; var y: c_int = 0; sdl.SDL_GetWindowPosition(self.sdl_window, x, y); return .{ .x = x, .y = y }; } pub fn setPosition(self: Window, x: i32, y: i32) struct { w: c_int, h: c_int } { sdl.SDL_SetWindowPosition(self.sdl_window, x, y); } pub fn setMode(self: Window, mode: WindowMode) void { sdl.SDL_SetWindowFullscreen(self.sdl_window, mode); } pub fn focused(self: Window) bool { return self.focused; } pub fn resizable(self: Window) bool { return (sdl.SDL_GetWindowFlags(self.sdl_window) & @intCast(u32, @enumToInt(sdl.SDL_WindowFlags.SDL_WINDOW_RESIZABLE))) != 0; } pub fn setResizable(self: Window, new_resizable: bool) void { sdl.SDL_SetWindowResizable(self.sdl_window, new_resizable); } };
gamekit/window.zig
const std = @import("../../std.zig"); const maxInt = std.math.maxInt; const linux = std.os.linux; const SYS = linux.SYS; const iovec = std.os.iovec; const iovec_const = std.os.iovec_const; const pid_t = linux.pid_t; const uid_t = linux.uid_t; const gid_t = linux.gid_t; const clock_t = linux.clock_t; const stack_t = linux.stack_t; const sigset_t = linux.sigset_t; const sockaddr = linux.sockaddr; const socklen_t = linux.socklen_t; const timespec = linux.timespec; pub fn syscall0(number: SYS) usize { return asm volatile ("syscall" : [ret] "={rax}" (-> usize), : [number] "{rax}" (@enumToInt(number)), : "rcx", "r11", "memory" ); } pub fn syscall1(number: SYS, arg1: usize) usize { return asm volatile ("syscall" : [ret] "={rax}" (-> usize), : [number] "{rax}" (@enumToInt(number)), [arg1] "{rdi}" (arg1), : "rcx", "r11", "memory" ); } pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { return asm volatile ("syscall" : [ret] "={rax}" (-> usize), : [number] "{rax}" (@enumToInt(number)), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), : "rcx", "r11", "memory" ); } pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { return asm volatile ("syscall" : [ret] "={rax}" (-> usize), : [number] "{rax}" (@enumToInt(number)), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), [arg3] "{rdx}" (arg3), : "rcx", "r11", "memory" ); } pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { return asm volatile ("syscall" : [ret] "={rax}" (-> usize), : [number] "{rax}" (@enumToInt(number)), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), [arg3] "{rdx}" (arg3), [arg4] "{r10}" (arg4), : "rcx", "r11", "memory" ); } pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { return asm volatile ("syscall" : [ret] "={rax}" (-> usize), : [number] "{rax}" (@enumToInt(number)), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), [arg3] "{rdx}" (arg3), [arg4] "{r10}" (arg4), [arg5] "{r8}" (arg5), : "rcx", "r11", "memory" ); } pub fn syscall6( number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize, arg6: usize, ) usize { return asm volatile ("syscall" : [ret] "={rax}" (-> usize), : [number] "{rax}" (@enumToInt(number)), [arg1] "{rdi}" (arg1), [arg2] "{rsi}" (arg2), [arg3] "{rdx}" (arg3), [arg4] "{r10}" (arg4), [arg5] "{r8}" (arg5), [arg6] "{r9}" (arg6), : "rcx", "r11", "memory" ); } /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; const CloneFn = switch (@import("builtin").zig_backend) { .stage1 => fn (arg: usize) callconv(.C) u8, else => *const fn (arg: usize) callconv(.C) u8, }; pub const restore = restore_rt; pub fn restore_rt() callconv(.Naked) void { return asm volatile ("syscall" : : [number] "{rax}" (@enumToInt(SYS.rt_sigreturn)), : "rcx", "r11", "memory" ); } pub const mode_t = usize; pub const time_t = isize; pub const nlink_t = usize; pub const blksize_t = isize; pub const blkcnt_t = isize; pub const O = struct { pub const CREAT = 0o100; pub const EXCL = 0o200; pub const NOCTTY = 0o400; pub const TRUNC = 0o1000; pub const APPEND = 0o2000; pub const NONBLOCK = 0o4000; pub const DSYNC = 0o10000; pub const SYNC = 0o4010000; pub const RSYNC = 0o4010000; pub const DIRECTORY = 0o200000; pub const NOFOLLOW = 0o400000; pub const CLOEXEC = 0o2000000; pub const ASYNC = 0o20000; pub const DIRECT = 0o40000; pub const LARGEFILE = 0; pub const NOATIME = 0o1000000; pub const PATH = 0o10000000; pub const TMPFILE = 0o20200000; pub const NDELAY = NONBLOCK; }; pub const F = struct { pub const DUPFD = 0; pub const GETFD = 1; pub const SETFD = 2; pub const GETFL = 3; pub const SETFL = 4; pub const GETLK = 5; pub const SETLK = 6; pub const SETLKW = 7; pub const SETOWN = 8; pub const GETOWN = 9; pub const SETSIG = 10; pub const GETSIG = 11; pub const SETOWN_EX = 15; pub const GETOWN_EX = 16; pub const GETOWNER_UIDS = 17; pub const RDLCK = 0; pub const WRLCK = 1; pub const UNLCK = 2; }; pub const MAP = struct { /// only give out 32bit addresses pub const @"32BIT" = 0x40; /// stack-like segment pub const GROWSDOWN = 0x0100; /// ETXTBSY pub const DENYWRITE = 0x0800; /// mark it as an executable pub const EXECUTABLE = 0x1000; /// pages are locked pub const LOCKED = 0x2000; /// don't check for reservations pub const NORESERVE = 0x4000; }; pub const VDSO = struct { pub const CGT_SYM = "__vdso_clock_gettime"; pub const CGT_VER = "LINUX_2.6"; pub const GETCPU_SYM = "__vdso_getcpu"; pub const GETCPU_VER = "LINUX_2.6"; }; pub const ARCH = struct { pub const SET_GS = 0x1001; pub const SET_FS = 0x1002; pub const GET_FS = 0x1003; pub const GET_GS = 0x1004; }; pub const REG = struct { pub const R8 = 0; pub const R9 = 1; pub const R10 = 2; pub const R11 = 3; pub const R12 = 4; pub const R13 = 5; pub const R14 = 6; pub const R15 = 7; pub const RDI = 8; pub const RSI = 9; pub const RBP = 10; pub const RBX = 11; pub const RDX = 12; pub const RAX = 13; pub const RCX = 14; pub const RSP = 15; pub const RIP = 16; pub const EFL = 17; pub const CSGSFS = 18; pub const ERR = 19; pub const TRAPNO = 20; pub const OLDMASK = 21; pub const CR2 = 22; }; pub const LOCK = struct { pub const SH = 1; pub const EX = 2; pub const NB = 4; pub const UN = 8; }; pub const Flock = extern struct { type: i16, whence: i16, start: off_t, len: off_t, pid: pid_t, }; pub const msghdr = extern struct { name: ?*sockaddr, namelen: socklen_t, iov: [*]iovec, iovlen: i32, __pad1: i32 = 0, control: ?*anyopaque, controllen: socklen_t, __pad2: socklen_t = 0, flags: i32, }; pub const msghdr_const = extern struct { name: ?*const sockaddr, namelen: socklen_t, iov: [*]iovec_const, iovlen: i32, __pad1: i32 = 0, control: ?*anyopaque, controllen: socklen_t, __pad2: socklen_t = 0, flags: i32, }; pub const off_t = i64; pub const ino_t = u64; pub const dev_t = u64; // The `stat` definition used by the Linux kernel. pub const Stat = extern struct { dev: dev_t, ino: ino_t, nlink: usize, mode: u32, uid: uid_t, gid: gid_t, __pad0: u32, rdev: dev_t, size: off_t, blksize: isize, blocks: i64, atim: timespec, mtim: timespec, ctim: timespec, __unused: [3]isize, pub fn atime(self: @This()) timespec { return self.atim; } pub fn mtime(self: @This()) timespec { return self.mtim; } pub fn ctime(self: @This()) timespec { return self.ctim; } }; pub const timeval = extern struct { tv_sec: isize, tv_usec: isize, }; pub const timezone = extern struct { tz_minuteswest: i32, tz_dsttime: i32, }; pub const Elf_Symndx = u32; pub const greg_t = usize; pub const gregset_t = [23]greg_t; pub const fpstate = extern struct { cwd: u16, swd: u16, ftw: u16, fop: u16, rip: usize, rdp: usize, mxcsr: u32, mxcr_mask: u32, st: [8]extern struct { significand: [4]u16, exponent: u16, padding: [3]u16 = undefined, }, xmm: [16]extern struct { element: [4]u32, }, padding: [24]u32 = undefined, }; pub const fpregset_t = *fpstate; pub const sigcontext = extern struct { r8: usize, r9: usize, r10: usize, r11: usize, r12: usize, r13: usize, r14: usize, r15: usize, rdi: usize, rsi: usize, rbp: usize, rbx: usize, rdx: usize, rax: usize, rcx: usize, rsp: usize, rip: usize, eflags: usize, cs: u16, gs: u16, fs: u16, pad0: u16 = undefined, err: usize, trapno: usize, oldmask: usize, cr2: usize, fpstate: *fpstate, reserved1: [8]usize = undefined, }; pub const mcontext_t = extern struct { gregs: gregset_t, fpregs: fpregset_t, reserved1: [8]usize = undefined, }; pub const ucontext_t = extern struct { flags: usize, link: ?*ucontext_t, stack: stack_t, mcontext: mcontext_t, sigmask: sigset_t, fpregs_mem: [64]usize, };
lib/std/os/linux/x86_64.zig
const std = @import("std"); const zig = std.zig; const fs = std.fs; const mem = std.mem; const Allocator = mem.Allocator; const Node = zig.ast.Node; const Tree = zig.ast.Tree; const TokenIndex = zig.ast.TokenIndex; const Options = @import("main.zig").Options; const rules = @import("rules.zig"); pub const Message = struct { msg: []const u8, span: struct { begin: TokenIndex, end: TokenIndex, }, pub fn fromToken(msg: []const u8, tok: TokenIndex) Message { return .{ .msg = msg, .span = .{ .begin = tok, .end = tok, }, }; } fn print(self: Message, path: []const u8, tree: *Tree, stream: var) !void { const RED = "\x1b[31;1m"; const BOLD = "\x1b[0;1m"; const RESET = "\x1b[0m"; const first_token = tree.tokens.at(self.span.begin); const last_token = tree.tokens.at(self.span.end); const loc = tree.tokenLocationPtr(0, first_token); const prefix = if (!std.fs.path.isAbsolute(path)) "./" else ""; try stream.print( BOLD ++ "{}{}:{}:{}: " ++ RED ++ "error: " ++ BOLD ++ "{}" ++ RESET ++ "\n{}\n", .{ prefix, path, loc.line + 1, loc.column + 1, self.msg, tree.source[loc.line_start..loc.line_end], }, ); try stream.writeByteNTimes(' ', loc.column); try stream.writeAll(RED); try stream.writeByteNTimes('~', last_token.end - first_token.start); try stream.writeAll(RESET ++ "\n"); } }; pub const Linter = struct { allocator: *Allocator, seen: PathMap, options: Options, errors: bool = false, const PathMap = std.StringHashMap(void); pub fn init(allocator: *Allocator, options: Options) Linter { return .{ .options = options, .allocator = allocator, .seen = PathMap.init(allocator), }; } pub fn deinit(self: *Linter) void { self.seen.deinit(); } pub const LintError = error{} || rules.ApplyError || std.os.WriteError || std.fs.Dir.OpenError; pub fn lintPath(self: *Linter, path: []const u8, stream: var) LintError!void { // TODO make this async when https://github.com/ziglang/zig/issues/3777 is fixed if (self.seen.contains(path)) return; try self.seen.putNoClobber(path, {}); const source_code = std.io.readFileAlloc(self.allocator, path) catch |err| switch (err) { error.IsDir, error.AccessDenied => { var dir = try fs.cwd().openDirList(path); defer dir.close(); var it = dir.iterate(); while (try it.next()) |entry| { if (entry.kind == .Directory or mem.endsWith(u8, entry.name, ".zig")) { const full_path = try fs.path.join( self.allocator, &[_][]const u8{ path, entry.name }, ); try self.lintPath(full_path, stream); } } return; }, else => { try stream.print("unable to open '{}': {}\n", .{ path, err }); self.errors = true; return; }, }; defer self.allocator.free(source_code); const tree = zig.parse(self.allocator, source_code) catch |err| { try stream.print("error parsing file '{}': {}\n", .{ path, err }); self.errors = true; return; }; defer tree.deinit(); var error_it = tree.errors.iterator(0); if (tree.errors.len != 0) { self.errors = true; @panic("TODO print errors"); } try self.lintNode(path, tree, &tree.root_node.base, stream); } fn lintNode(self: *Linter, path: []const u8, tree: *Tree, node: *Node, stream: var) LintError!void { const node_rules = rules.byId(node.id); for (node_rules) |rule| { if (try rule.apply(self, tree, node)) |some| { self.errors = true; try some.print(path, tree, stream); } } var i: usize = 0; while (node.iterate(i)) |child| : (i += 1) { try self.lintNode(path, tree, child, stream); } } };
src/linter.zig
usingnamespace @import("root").preamble; const log = lib.output.log.scoped(.{ .prefix = "PS2", .filter = .info, }).write; const apic = @import("apic.zig"); const ports = @import("ports.zig"); const eoi = @import("apic.zig").eoi; const interrupts = @import("interrupts.zig"); const kb = lib.input.keyboard; const Extendedness = enum { Extended, NotExtended, }; pub var kb_interrupt_vector: u8 = undefined; pub var kb_interrupt_gsi: ?u32 = null; pub var mouse_interrupt_vector: u8 = undefined; pub var mouse_interrupt_gsi: ?u32 = null; const scancode_extended = 0xE0; var keyboard_buffer_data: [8]u8 = undefined; var keyboard_buffer_elements: usize = 0; fn keyboardBuffer() []const u8 { return keyboard_buffer_data[0..keyboard_buffer_elements]; } fn standardKey(ext: Extendedness, keycode: u8) void { defer keyboard_buffer_elements = 0; const loc = keyLocation(ext, keycode & 0x7F) catch return; kb_state.event(if (keycode & 0x80 != 0) .release else .press, loc) catch return; } fn finishSequence(offset: usize, seq: []const u8) bool { const buf = keyboardBuffer()[offset..]; if (buf.len < seq.len) return false; if (std.mem.eql(u8, buf, seq)) { keyboard_buffer_elements = 0; return true; } // We don't have array printing yet... //log(.emerg, "Unexpected scancode sequence: {arr}, expected {arr}", .{ buf, seq }); @panic("Unexpected scancode sequence!"); } fn kbEvent() void { switch (keyboardBuffer()[0]) { 0xE1 => { if (finishSequence(1, "\x1D\x45\xE1\x9D\xC5")) { kb_state.event(.press, .pause_break) catch return; // There is no event for releasing this key, // so we just gotta pretend it's released instantly kb_state.event(.release, .pause_break) catch return; } }, scancode_extended => { if (keyboardBuffer().len < 2) return; switch (keyboardBuffer()[1]) { 0x2A => { if (finishSequence(2, &[_]u8{ scancode_extended, 0x37 })) { kb_state.event(.press, .print_screen) catch return; } }, 0xB7 => { if (finishSequence(2, &[_]u8{ scancode_extended, 0xAA })) { kb_state.event(.release, .print_screen) catch return; } }, else => { standardKey(.Extended, keyboardBuffer()[1]); }, } }, else => { standardKey(.NotExtended, keyboardBuffer()[0]); }, } } var kb_state: kb.state.KeyboardState = .{}; fn kbHandler(_: *os.platform.InterruptFrame) void { keyboard_buffer_data[keyboard_buffer_elements] = ports.inb(0x60); keyboard_buffer_elements += 1; kbEvent(); eoi(); } fn keyLocation(ext: Extendedness, scancode: u8) !kb.keys.Location { switch (ext) { .NotExtended => { return switch (scancode) { 0x01 => .escape, 0x02 => .number_key1, 0x03 => .number_key2, 0x04 => .number_key3, 0x05 => .number_key4, 0x06 => .number_key5, 0x07 => .number_key6, 0x08 => .number_key7, 0x09 => .number_key8, 0x0A => .number_key9, 0x0B => .number_key0, 0x0C => .right_of0, 0x0D => .left_of_backspace, 0x0E => .backspace, 0x0F => .tab, 0x10 => .line1_1, 0x11 => .line1_2, 0x12 => .line1_3, 0x13 => .line1_4, 0x14 => .line1_5, 0x15 => .line1_6, 0x16 => .line1_7, 0x17 => .line1_8, 0x18 => .line1_9, 0x19 => .line1_10, 0x1A => .line1_11, 0x1B => .line1_12, 0x1C => .enter, 0x1D => .left_ctrl, 0x1E => .line2_1, 0x1F => .line2_2, 0x20 => .line2_3, 0x21 => .line2_4, 0x22 => .line2_5, 0x23 => .line2_6, 0x24 => .line2_7, 0x25 => .line2_8, 0x26 => .line2_9, 0x27 => .line2_10, 0x28 => .line2_11, 0x29 => .left_of1, 0x2A => .left_shift, 0x2B => .line2_12, 0x2C => .line3_1, 0x2D => .line3_2, 0x2E => .line3_3, 0x2F => .line3_4, 0x30 => .line3_5, 0x31 => .line3_6, 0x32 => .line3_7, 0x33 => .line3_8, 0x34 => .line3_9, 0x35 => .line3_10, 0x36 => .right_shift, 0x37 => .numpad_mul, 0x38 => .left_alt, 0x39 => .spacebar, 0x3A => .capslock, 0x3B => .f1, 0x3C => .f2, 0x3D => .f3, 0x3E => .f4, 0x3F => .f5, 0x40 => .f6, 0x41 => .f7, 0x42 => .f8, 0x43 => .f9, 0x44 => .f10, 0x45 => .numlock, 0x46 => .scroll_lock, 0x47 => .numpad7, 0x48 => .numpad8, 0x49 => .numpad9, 0x4A => .numpad_sub, 0x4B => .numpad4, 0x4C => .numpad5, 0x4D => .numpad6, 0x4E => .numpad_add, 0x4F => .numpad1, 0x50 => .numpad2, 0x51 => .numpad3, 0x52 => .numpad0, 0x53 => .numpad_point, 0x56 => .right_of_left_shift, 0x57 => .f11, 0x58 => .f12, else => { log(.err, "Unhandled scancode 0x{X}", .{scancode}); return error.UnknownScancode; }, }; }, .Extended => { return switch (scancode) { 0x10 => .media_rewind, 0x19 => .media_forward, 0x20 => .media_mute, 0x1C => .numpad_enter, 0x1D => .right_ctrl, 0x22 => .media_pause_play, 0x24 => .media_stop, 0x2E => .media_volume_down, 0x30 => .media_volume_up, 0x35 => .numpad_div, 0x38 => .right_alt, 0x47 => .home, 0x48 => .arrow_up, 0x49 => .page_up, 0x4B => .arrow_left, 0x4D => .arrow_right, 0x4F => .end, 0x50 => .arrow_down, 0x51 => .page_down, 0x52 => .insert, 0x53 => .delete, 0x5B => .left_super, 0x5C => .right_super, 0x5D => .option_key, else => { log(.err, "Unhandled extended scancode 0x{X}", .{scancode}); return error.UnknownScancode; }, }; }, } } var mouse_buffer_data: [8]u8 = undefined; var mouse_buffer_elements: usize = 0; fn mouseEvent() void { if (mouse_buffer_elements == 3) { mouse_buffer_elements = 0; } } fn mouseHandler(_: *os.platform.InterruptFrame) void { mouse_buffer_data[mouse_buffer_elements] = ports.inb(0x60); mouse_buffer_elements += 1; mouseEvent(); eoi(); } fn canWrite() bool { return (ports.inb(0x64) & 2) == 0; } fn canRead() bool { return (ports.inb(0x64) & 1) != 0; } const max_readwrite_attempts = 10000; const max_resend_attempts = 100; fn write(port: u16, value: u8) !void { var counter: usize = 0; while (counter < max_readwrite_attempts) : (counter += 1) { if (canWrite()) { return ports.outb(port, value); } } log(.warn, "Timeout while writing to port 0x{X}!", .{port}); return error.Timeout; } fn read() !u8 { var counter: usize = 0; while (counter < max_readwrite_attempts) : (counter += 1) { if (canRead()) { return ports.inb(0x60); } } log(.warn, "Timeout while reading!", .{}); return error.Timeout; } fn getConfigByte() !u8 { try write(0x64, 0x20); return read(); } fn writeConfigByte(config_byte_value: u8) !void { try write(0x64, 0x60); try write(0x60, config_byte_value); } fn disableSecondaryPort() !void { try write(0x64, 0xA7); } fn enableSecondaryPort() !void { try write(0x64, 0xA8); } fn testSecondaryPort() !bool { try write(0x64, 0xA9); return portTest(); } fn controllerSelfTest() !bool { try write(0x64, 0xAA); return 0x55 == try read(); } fn testPrimaryPort() !bool { try write(0x64, 0xAB); return portTest(); } fn disablePrimaryPort() !void { try write(0x64, 0xAD); } fn enablePrimaryPort() !void { try write(0x64, 0xAE); } const Device = enum { primary, secondary, }; fn sendCommand(device: Device, command: u8) !void { var resends: usize = 0; while (resends < max_resend_attempts) : (resends += 1) { if (device == .secondary) { try write(0x64, 0xD4); } try write(0x60, command); awaitAck() catch |err| { switch (err) { error.Resend => { log(.debug, "Device requested command resend", .{}); continue; }, else => return err, } }; return; } return error.TooManyResends; } fn portTest() !bool { switch (try read()) { 0x00 => return true, // Success 0x01 => log(.err, "Port test failed: Clock line stuck low", .{}), 0x02 => log(.err, "Port test failed: Clock line stuck high", .{}), 0x03 => log(.err, "Port test failed: Data line stuck low", .{}), 0x04 => log(.err, "Port test failed: Data line stuck high", .{}), else => |result| log(.err, "Port test failed: Unknown reason (0x{X})", .{result}), } return false; } fn awaitAck() !void { while (true) { const v = read() catch |err| { log(.err, "ACK read failed: {e}!", .{err}); return err; }; switch (v) { // ACK 0xFA => return, // Resend 0xFE => return error.Resend, else => log(.err, "Got a different value: 0x{X}", .{v}), } } } fn finalizeDevice(device: Device) !void { log(.debug, "Enabling interrupts", .{}); var shift: u1 = 0; if (device == .secondary) shift = 1; try writeConfigByte((@as(u2, 1) << shift) | try getConfigByte()); log(.debug, "Enabling scanning", .{}); try sendCommand(device, 0xF4); } fn initKeyboard(irq: u8, device: Device) !bool { if (comptime (!config.kernel.x86_64.ps2.keyboard.enable)) return false; if (kb_interrupt_gsi) |_| return false; kb_interrupt_vector = interrupts.allocate_vector(); interrupts.add_handler(kb_interrupt_vector, kbHandler, true, 0, 1); kb_interrupt_gsi = apic.route_irq(0, irq, kb_interrupt_vector); try finalizeDevice(device); return true; } fn initMouse(irq: u8, device: Device) !bool { if (comptime (!config.kernel.x86_64.ps2.mouse.enable)) return false; if (mouse_interrupt_gsi) |_| return false; mouse_interrupt_vector = interrupts.allocate_vector(); interrupts.add_handler(mouse_interrupt_vector, mouseHandler, true, 0, 1); mouse_interrupt_gsi = apic.route_irq(0, irq, mouse_interrupt_vector); try finalizeDevice(device); return true; } fn initDevice(irq: u8, device: Device) !bool { log(.debug, "Resetting device", .{}); try sendCommand(device, 0xFF); if (0xAA != try read()) { log(.err, "Device reset failed", .{}); return error.DeviceResetFailed; } log(.debug, "Disabling scanning on device", .{}); try sendCommand(device, 0xF5); log(.debug, "Identifying device", .{}); try sendCommand(device, 0xF2); const first = read() catch |err| { switch (err) { error.Timeout => { log(.notice, "No identity byte, assuming keyboard", .{}); return initKeyboard(irq, device); }, else => return err, } }; switch (first) { 0x00 => { log(.info, "PS2: Standard mouse", .{}); return initMouse(irq, device); }, 0x03 => { log(.info, "Scrollwheel mouse", .{}); return initMouse(irq, device); }, 0x04 => { log(.info, "5-button mouse", .{}); return initMouse(irq, device); }, 0xAB => { switch (try read()) { 0x41, 0xC1 => { log(.info, "MF2 keyboard with translation", .{}); return initKeyboard(irq, device); }, 0x83 => { log(.info, "MF2 keyboard", .{}); return initKeyboard(irq, device); }, else => |wtf| { log(.warn, "Identify: Unknown byte after 0xAB: 0x{X}", .{wtf}); }, } }, else => { log(.warn, "Identify: Unknown first byte: 0x{X}", .{first}); }, } return false; } pub fn initController() !void { if (comptime (!(config.kernel.x86_64.ps2.mouse.enable or config.kernel.x86_64.ps2.keyboard.enable))) return; log(.debug, "Disabling primary port", .{}); try disablePrimaryPort(); log(.debug, "Disabling secondary port", .{}); try disableSecondaryPort(); log(.debug, "Draining buffer", .{}); // Drain buffer _ = ports.inb(0x60); log(.debug, "Setting up controller", .{}); // Disable interrupts, enable translation const init_config_byte = (1 << 6) | (~@as(u8, 3) & try getConfigByte()); try writeConfigByte(init_config_byte); if (!try controllerSelfTest()) { log(.warn, "Controller self-test failed!", .{}); return error.FailedSelfTest; } log(.debug, "Controller self-test succeeded", .{}); // Sometimes the config value gets reset by the self-test, so we set it again try writeConfigByte(init_config_byte); var dual_channel = ((1 << 5) & init_config_byte) != 0; if (dual_channel) { // This may be a dual channel device if the secondary clock was // disabled from disabling the secondary device try enableSecondaryPort(); dual_channel = ((1 << 5) & try getConfigByte()) == 0; try disableSecondaryPort(); if (!dual_channel) { log(.debug, "Not dual channel, determined late", .{}); } } else { log(.debug, "Not dual channel, determined early", .{}); } log(.info, "Detecting active ports, dual_channel = {b}", .{dual_channel}); try enablePrimaryPort(); if (testPrimaryPort() catch false) { log(.debug, "Initializing primary port", .{}); try enablePrimaryPort(); if (!(initDevice(1, .primary) catch false)) { try disablePrimaryPort(); log(.warn, "Primary device init failed, disabled port", .{}); } } if (dual_channel and testSecondaryPort() catch false) { log(.debug, "Initializing secondary port", .{}); try enableSecondaryPort(); if (!(initDevice(12, .secondary) catch false)) { try disableSecondaryPort(); log(.warn, "Secondary device init failed, disabled port", .{}); } } } pub fn init() void { initController() catch |err| { log(.crit, "Error while initializing: {e}", .{err}); if (@errorReturnTrace()) |trace| { os.kernel.debug.dumpStackTrace(trace); } else { log(.crit, "No error trace.", .{}); } }; }
subprojects/flork/src/platform/x86_64/ps2.zig
const std = @import("std"); const mem = std.mem; pub const Token = struct { id: Id, start: usize, end: usize, pub const Id = enum { invalid, identifier, string_literal, integer_literal, float_literal, char_literal, colon, comma, line_comment, line_break, period, slash, eof, }; }; pub const Tokenizer = struct { buffer: []const u8, index: usize, pending_invalid_token: ?Token, pub fn init(buffer: []const u8) Tokenizer { // Skip the UTF-8 BOM if present return Tokenizer{ .buffer = buffer, .index = if (mem.startsWith(u8, buffer, "\xEF\xBB\xBF")) 3 else 0, .pending_invalid_token = null, }; } const State = enum { start, char_literal, char_literal_backslash, char_literal_end, char_literal_hex_escape, char_literal_unicode, char_literal_unicode_escape, char_literal_unicode_escape_saw_u, char_literal_unicode_invalid, float_exponent_number, float_exponent_number_hex, float_exponent_unsigned, float_exponent_unsigned_hex, float_fraction, float_fraction_hex, identifier, integer_literal, integer_literal_with_radix, integer_literal_with_radix_hex, line_comment, number_dot, number_dot_hex, slash, string_literal, string_literal_backslash, zero, line_break, }; pub fn next(self: *Tokenizer) Token { if (self.pending_invalid_token) |token| { self.pending_invalid_token = null; return token; } const start_index = self.index; var state: State = .start; var result = Token{ .id = .eof, .start = self.index, .end = undefined, }; var seen_escape_digits: usize = undefined; var remaining_code_units: usize = undefined; while (self.index < self.buffer.len) : (self.index += 1) { const c = self.buffer[self.index]; switch (state) { .start => switch (c) { ' ', '\t', '\r' => { result.start = self.index + 1; }, '\n' => { result.id = .line_break; state = .line_break; }, '"' => { state = .string_literal; result.id = .string_literal; }, '\'' => { state = .char_literal; }, 'a'...'z', 'A'...'Z', '_' => { state = .identifier; result.id = .identifier; }, ',' => { result.id = .comma; self.index += 1; break; }, ':' => { result.id = .colon; self.index += 1; break; }, '.' => { result.id = .period; self.index += 1; break; }, '/' => { state = .slash; }, '0' => { state = .zero; result.id = .integer_literal; }, '1'...'9' => { state = .integer_literal; result.id = .integer_literal; }, else => { result.id = .invalid; self.index += 1; break; }, }, .line_break => switch (c) { '\n', '\r' => {}, else => break, }, .identifier => switch (c) { 'a'...'z', 'A'...'Z', '_', '0'...'9' => {}, else => break, }, .string_literal => switch (c) { '\\' => { state = .string_literal_backslash; }, '"' => { self.index += 1; break; }, '\n', '\r' => break, // Look for this error later. else => self.checkLiteralCharacter(), }, .string_literal_backslash => switch (c) { '\n', '\r' => break, // Look for this error later. else => { state = .string_literal; }, }, .char_literal => switch (c) { '\\' => { state = .char_literal_backslash; }, '\'', 0x80...0xbf, 0xf8...0xff => { result.id = .invalid; break; }, 0xc0...0xdf => { // 110xxxxx remaining_code_units = 1; state = .char_literal_unicode; }, 0xe0...0xef => { // 1110xxxx remaining_code_units = 2; state = .char_literal_unicode; }, 0xf0...0xf7 => { // 11110xxx remaining_code_units = 3; state = .char_literal_unicode; }, else => { state = .char_literal_end; }, }, .char_literal_backslash => switch (c) { '\n' => { result.id = .invalid; break; }, 'x' => { state = .char_literal_hex_escape; seen_escape_digits = 0; }, 'u' => { state = .char_literal_unicode_escape_saw_u; }, else => { state = .char_literal_end; }, }, .char_literal_hex_escape => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => { seen_escape_digits += 1; if (seen_escape_digits == 2) { state = .char_literal_end; } }, else => { result.id = .invalid; break; }, }, .char_literal_unicode_escape_saw_u => switch (c) { '{' => { state = .char_literal_unicode_escape; seen_escape_digits = 0; }, else => { result.id = .invalid; state = .char_literal_unicode_invalid; }, }, .char_literal_unicode_escape => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => { seen_escape_digits += 1; }, '}' => { if (seen_escape_digits == 0) { result.id = .invalid; state = .char_literal_unicode_invalid; } else { state = .char_literal_end; } }, else => { result.id = .invalid; state = .char_literal_unicode_invalid; }, }, .char_literal_unicode_invalid => switch (c) { // Keep consuming characters until an obvious stopping point. // This consolidates e.g. `u{0ab1Q}` into a single invalid token // instead of creating the tokens `u{0ab1`, `Q`, `}` '0'...'9', 'a'...'z', 'A'...'Z', '}' => {}, else => break, }, .char_literal_end => switch (c) { '\'' => { result.id = .char_literal; self.index += 1; break; }, else => { result.id = .invalid; break; }, }, .char_literal_unicode => switch (c) { 0x80...0xbf => { remaining_code_units -= 1; if (remaining_code_units == 0) { state = .char_literal_end; } }, else => { result.id = .invalid; break; }, }, .slash => switch (c) { '/' => { state = .line_comment; result.id = .line_comment; }, else => { result.id = .slash; break; }, }, .line_comment => switch (c) { '\n' => break, else => self.checkLiteralCharacter(), }, .zero => switch (c) { 'b', 'o' => { state = .integer_literal_with_radix; }, 'x' => { state = .integer_literal_with_radix_hex; }, else => { // reinterpret as a normal number self.index -= 1; state = .integer_literal; }, }, .integer_literal => switch (c) { '.' => { state = .number_dot; }, 'p', 'P', 'e', 'E' => { state = .float_exponent_unsigned; }, '0'...'9' => {}, else => break, }, .integer_literal_with_radix => switch (c) { '.' => { state = .number_dot; }, '0'...'9' => {}, else => break, }, .integer_literal_with_radix_hex => switch (c) { '.' => { state = .number_dot_hex; }, 'p', 'P' => { state = .float_exponent_unsigned_hex; }, '0'...'9', 'a'...'f', 'A'...'F' => {}, else => break, }, .number_dot => switch (c) { '.' => { self.index -= 1; state = .start; break; }, else => { self.index -= 1; result.id = .float_literal; state = .float_fraction; }, }, .number_dot_hex => switch (c) { '.' => { self.index -= 1; state = .start; break; }, else => { self.index -= 1; result.id = .float_literal; state = .float_fraction_hex; }, }, .float_fraction => switch (c) { 'e', 'E' => { state = .float_exponent_unsigned; }, '0'...'9' => {}, else => break, }, .float_fraction_hex => switch (c) { 'p', 'P' => { state = .float_exponent_unsigned_hex; }, '0'...'9', 'a'...'f', 'A'...'F' => {}, else => break, }, .float_exponent_unsigned => switch (c) { '+', '-' => { state = .float_exponent_number; }, else => { // reinterpret as a normal exponent number self.index -= 1; state = .float_exponent_number; }, }, .float_exponent_unsigned_hex => switch (c) { '+', '-' => { state = .float_exponent_number_hex; }, else => { // reinterpret as a normal exponent number self.index -= 1; state = .float_exponent_number_hex; }, }, .float_exponent_number => switch (c) { '0'...'9' => {}, else => break, }, .float_exponent_number_hex => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => {}, else => break, }, } } else if (self.index == self.buffer.len) { switch (state) { .start, .integer_literal, .integer_literal_with_radix, .integer_literal_with_radix_hex, .float_fraction, .float_fraction_hex, .float_exponent_number, .float_exponent_number_hex, .line_break, .string_literal, // find this error later => {}, .identifier => {}, .line_comment => { result.id = Token.Id.line_comment; }, .number_dot, .number_dot_hex, .float_exponent_unsigned, .float_exponent_unsigned_hex, .char_literal, .char_literal_backslash, .char_literal_hex_escape, .char_literal_unicode_escape_saw_u, .char_literal_unicode_escape, .char_literal_unicode_invalid, .char_literal_end, .char_literal_unicode, .string_literal_backslash, => { result.id = .invalid; }, .slash => { result.id = .slash; }, .zero => { result.id = .integer_literal; }, } } if (result.id == .eof) { if (self.pending_invalid_token) |token| { self.pending_invalid_token = null; return token; } } result.end = self.index; return result; } fn checkLiteralCharacter(self: *Tokenizer) void { if (self.pending_invalid_token != null) return; const invalid_length = self.getInvalidCharacterLength(); if (invalid_length == 0) return; self.pending_invalid_token = Token{ .id = .invalid, .start = self.index, .end = self.index + invalid_length, }; } fn getInvalidCharacterLength(self: *Tokenizer) u3 { const c0 = self.buffer[self.index]; if (c0 < 0x80) { if (c0 < 0x20 or c0 == 0x7f) { // ascii control codes are never allowed // (note that \n was checked before we got here) return 1; } // looks fine to me. return 0; } else { // check utf8-encoded character. const length = std.unicode.utf8ByteSequenceLength(c0) catch return 1; if (self.index + length > self.buffer.len) { return @intCast(u3, self.buffer.len - self.index); } const bytes = self.buffer[self.index .. self.index + length]; switch (length) { 2 => { const value = std.unicode.utf8Decode2(bytes) catch return length; if (value == 0x85) return length; // U+0085 (NEL) }, 3 => { const value = std.unicode.utf8Decode3(bytes) catch return length; if (value == 0x2028) return length; // U+2028 (LS) if (value == 0x2029) return length; // U+2029 (PS) }, 4 => { _ = std.unicode.utf8Decode4(bytes) catch return length; }, else => unreachable, } self.index += length - 1; return 0; } } }; test "tokenizer - char literal with hex escape" { testTokenize( \\'\x1b' , [_]Token.Id{.char_literal}); testTokenize( \\'\x1' , [_]Token.Id{ .invalid, .invalid }); } test "tokenizer - char literal with unicode escapes" { // Valid unicode escapes testTokenize( \\'\u{3}' , [_]Token.Id{.char_literal}); testTokenize( \\'\u{01}' , [_]Token.Id{.char_literal}); testTokenize( \\'\u{2a}' , [_]Token.Id{.char_literal}); testTokenize( \\'\u{3f9}' , [_]Token.Id{.char_literal}); testTokenize( \\'\u{6E09aBc1523}' , [_]Token.Id{.char_literal}); testTokenize( \\"\u{440}" , [_]Token.Id{.string_literal}); // Invalid unicode escapes testTokenize( \\'\u' , [_]Token.Id{.invalid}); testTokenize( \\'\u{{' , [_]Token.Id{ .invalid, .invalid }); testTokenize( \\'\u{}' , [_]Token.Id{ .invalid, .invalid }); testTokenize( \\'\u{s}' , [_]Token.Id{ .invalid, .invalid }); testTokenize( \\'\u{2z}' , [_]Token.Id{ .invalid, .invalid }); testTokenize( \\'\u{4a' , [_]Token.Id{.invalid}); // Test old-style unicode literals testTokenize( \\'\u0333' , [_]Token.Id{ .invalid, .invalid }); testTokenize( \\'\U0333' , [_]Token.Id{ .invalid, .integer_literal, .invalid }); } test "tokenizer - char literal with unicode code point" { testTokenize( \\'💩' , [_]Token.Id{.char_literal}); } test "tokenizer - line comment followed by identifier" { testTokenize( \\ Unexpected, \\ // another \\ Another, , [_]Token.Id{ .identifier, .comma, .line_comment, .identifier, .comma, }); } test "tokenizer - UTF-8 BOM is recognized and skipped" { testTokenize("\xEF\xBB\xBFa.\n", [_]Token.Id{ .identifier, .period, }); } fn testTokenize(source: []const u8, expected_tokens: []const Token.Id) void { var tokenizer = Tokenizer.init(source); for (expected_tokens) |expected_token_id| { const token = tokenizer.next(); if (token.id != expected_token_id) { std.debug.panic("expected {}, found {}\n", @tagName(expected_token_id), @tagName(token.id)); } } const last_token = tokenizer.next(); std.testing.expect(last_token.id == .eof); }
src/tokenize.zig
const std = @import("std"); const util = @import("util.zig"); const data = @embedFile("../data/day20.txt"); const Input = struct { enhancement: [512]u8 = undefined, image: [100][100]u8 = undefined, dim: usize, pub fn init(input_text: []const u8, allocator: std.mem.Allocator) !@This() { _ = allocator; var self = Input{ .dim = 0 }; errdefer self.deinit(); var lines = std.mem.tokenize(u8, input_text, "\r\n"); const first_line = lines.next().?; assert(first_line.len == 512); std.mem.copy(u8, self.enhancement[0..], first_line); var y: usize = 0; while (lines.next()) |line| : (y += 1) { if (y == 0) { self.dim = line.len; } else { assert(line.len == self.dim); } std.mem.copy(u8, self.image[y][0..], line); } return self; } pub fn deinit(self: @This()) void { _ = self; } }; const Coord2 = struct { x: i64, y: i64, }; const PixelMap = struct { pixels: std.AutoHashMap(Coord2, bool), enhancement: [512]u8 = undefined, min: Coord2, max: Coord2, pub fn init(input: Input, allocator: std.mem.Allocator) !@This() { var self = PixelMap{ .pixels = std.AutoHashMap(Coord2, bool).init(allocator), .min = Coord2{ .x = 0, .y = 0 }, .max = Coord2{ .x = @intCast(i64, input.dim), .y = @intCast(i64, input.dim) }, }; std.mem.copy(u8, self.enhancement[0..], input.enhancement[0..]); try self.pixels.ensureTotalCapacity(1000 * 1000); var y: usize = 0; while (y < input.dim) : (y += 1) { var x: usize = 0; while (x < input.dim) : (x += 1) { if (input.image[y][x] == '#') { try self.pixels.putNoClobber(Coord2{ .x = @intCast(i64, x), .y = @intCast(i64, y) }, true); } } } return self; } pub fn deinit(self: *@This()) void { self.pixels.deinit(); } const OFFSETS = [9]Coord2{ Coord2{ .x = -1, .y = -1 }, Coord2{ .x = 0, .y = -1 }, Coord2{ .x = 1, .y = -1 }, Coord2{ .x = -1, .y = 0 }, Coord2{ .x = 0, .y = 0 }, Coord2{ .x = 1, .y = 0 }, Coord2{ .x = -1, .y = 1 }, Coord2{ .x = 0, .y = 1 }, Coord2{ .x = 1, .y = 1 }, }; pub fn enhance2(self: *@This()) !void { var tmp_pixels = std.AutoHashMap(Coord2, bool).init(self.pixels.allocator); defer tmp_pixels.deinit(); try tmp_pixels.ensureTotalCapacity(2 * self.pixels.count()); // ping var y: i64 = self.min.y - 3; while (y <= self.max.y + 3) : (y += 1) { var x: i64 = self.min.x - 3; while (x <= self.max.x + 3) : (x += 1) { const c = Coord2{ .x = x, .y = y }; var idx: u9 = 0; for (OFFSETS) |offset| { idx *= 2; const p = Coord2{ .x = c.x + offset.x, .y = c.y + offset.y }; idx += if (self.pixels.contains(p)) @as(u9, 1) else @as(u9, 0); } if (self.enhancement[idx] == '#') { try tmp_pixels.putNoClobber(c, true); } } } // pong self.pixels.clearRetainingCapacity(); try self.pixels.ensureTotalCapacity(2 * tmp_pixels.count()); var new_min = Coord2{ .x = std.math.maxInt(i64), .y = std.math.maxInt(i64) }; var new_max = Coord2{ .x = std.math.minInt(i64), .y = std.math.minInt(i64) }; y = self.min.y - 2; while (y <= self.max.y + 1) : (y += 1) { var x: i64 = self.min.x - 2; while (x <= self.max.x + 1) : (x += 1) { const c = Coord2{ .x = x, .y = y }; var idx: u9 = 0; for (OFFSETS) |offset| { idx *= 2; const p = Coord2{ .x = c.x + offset.x, .y = c.y + offset.y }; idx += if (tmp_pixels.contains(p)) @as(u9, 1) else @as(u9, 0); } if (self.enhancement[idx] == '#') { try self.pixels.putNoClobber(c, true); new_min.x = std.math.min(new_min.x, c.x); new_min.y = std.math.min(new_min.y, c.y); new_max.x = std.math.max(new_max.x, c.x + 1); new_max.y = std.math.max(new_max.y, c.y + 1); } } } self.min = new_min; self.max = new_max; } }; fn part1(input: Input) i64 { var pixel_map = PixelMap.init(input, std.testing.allocator) catch unreachable; defer pixel_map.deinit(); pixel_map.enhance2() catch unreachable; var count: i64 = 0; var py: i64 = pixel_map.min.y; while (py < pixel_map.max.y) : (py += 1) { var px: i64 = pixel_map.min.x; while (px < pixel_map.max.x) : (px += 1) { const c = Coord2{ .x = px, .y = py }; if (pixel_map.pixels.contains(c)) { count += 1; } } } return count; } fn part2(input: Input) i64 { var pixel_map = PixelMap.init(input, std.testing.allocator) catch unreachable; defer pixel_map.deinit(); var i: i64 = 0; while (i < 25) : (i += 1) { print("{d} ", .{i + 1}); pixel_map.enhance2() catch unreachable; } print("\n", .{}); var count: i64 = 0; var py: i64 = pixel_map.min.y; while (py < pixel_map.max.y) : (py += 1) { var px: i64 = pixel_map.min.x; while (px < pixel_map.max.x) : (px += 1) { const c = Coord2{ .x = px, .y = py }; if (pixel_map.pixels.contains(c)) { count += 1; } } } return count; } const test_data = \\..#.#..#####.#.#.#.###.##.....###.##.#..###.####..#####..#....#..#..##..###..######.###...####..#..#####..##..#.#####...##.#.#..#.##..#.#......#.###.######.###.####...#.##.##..#..#..#####.....#.#....###..#.##......#.....#..#..#..##..#...##.######.####.####.#.#...#.......#..#.#.#...####.##.#......#..#...##.#.##..#...##.#.##..###.#......#.#.......#.#.#.####.###.##...#.....####.#..#..#.##.#....##..#.####....##...##..#...#......#.#.......#.......##..####..#...#.#.#...##..#.#..###..#####........#..####......#..# \\ \\#..#. \\#.... \\##..# \\..#.. \\..### ; const part1_test_solution: ?i64 = 35; const part1_solution: ?i64 = 5573; const part2_test_solution: ?i64 = 3351; const part2_solution: ?i64 = 20097; // 20582 is too high // Just boilerplate below here, nothing to see fn testPart1() !void { var test_input = try Input.init(test_data, std.testing.allocator); defer test_input.deinit(); if (part1_test_solution) |solution| { try std.testing.expectEqual(solution, part1(test_input)); } var timer = try std.time.Timer.start(); var input = try Input.init(data, std.testing.allocator); defer input.deinit(); if (part1_solution) |solution| { try std.testing.expectEqual(solution, part1(input)); print("part1 took {d:9.3}ms\n", .{@intToFloat(f64, timer.lap()) / 1000000.0}); } } fn testPart2() !void { var test_input = try Input.init(test_data, std.testing.allocator); defer test_input.deinit(); if (part2_test_solution) |solution| { try std.testing.expectEqual(solution, part2(test_input)); } var timer = try std.time.Timer.start(); var input = try Input.init(data, std.testing.allocator); defer input.deinit(); if (part2_solution) |solution| { try std.testing.expectEqual(solution, part2(input)); print("part2 took {d:9.3}ms\n", .{@intToFloat(f64, timer.lap()) / 1000000.0}); } } pub fn main() !void { try testPart1(); try testPart2(); } test "part1" { try testPart1(); } test "part2" { try testPart2(); } // Useful stdlib functions const tokenize = std.mem.tokenize; const split = std.mem.split; const parseInt = std.fmt.parseInt; const min = std.math.min; const max = std.math.max; const print = std.debug.print; const expect = std.testing.expect; const assert = std.debug.assert;
src/day20.zig
const std = @import("std"); const math = std.math; /// A radian-to-degree converter specialized for longitude values. /// If the resulting degree value would be greater than 180 degrees, /// 360 degrees will be subtracted - meaning that this function returns /// values in a range of [-180, 180] degrees. const rad_to_deg_constant = 180.0 / math.pi; const deg_to_rad_constant = math.pi / 180.0; pub const Point = packed struct { x: f32, y: f32, pub fn getDist(self: Point, other: Point) f32 { return std.math.sqrt(std.math.pow(f32, self.x - other.x, 2.0) + std.math.pow(f32, self.y - other.y, 2.0)); } }; pub const Line = struct { a: Point, b: Point, pub fn getSlope(self: Line) f32 { return (self.b.y - self.a.y) / (self.b.x - self.a.x); } pub fn getYIntercept(self: Line) f32 { return self.a.y - (self.getSlope() * self.a.x); } /// Return `true` if the given point lies on the line defined by the points `a` and `b`. pub fn containsPoint(self: Line, p: Point) bool { return floatEq((self.b.x - self.a.x) * (p.y - self.a.y), (p.x - self.a.x) * (self.b.y - self.a.y), 0.005); } /// Return `true` if the given point lies on the line segment defined by the points /// `a` and `b`. pub fn segmentContainsPoint(self: Line, point: Point) bool { if (!self.containsPoint(point)) return false; const min_x = math.min(self.a.x, self.b.x); const max_x = math.max(self.a.x, self.b.x); if (point.x < min_x or point.x > max_x) return false; const min_y = math.min(self.a.y, self.b.y); const max_y = math.max(self.a.y, self.b.y); if (point.y < min_y or point.y > max_y) return false; return true; } /// Find the point of intersection between two lines. The two lines extend /// into infinity. pub fn intersection(self: Line, other: Line) ?Point { const self_slope = self.getSlope(); const other_slope = other.getSlope(); if (floatEq(self_slope, other_slope, 0.005)) { return null; } const a = self.a.y - (self_slope * self.a.x); const b = other.a.y - (other_slope * other.a.x); const x = (a - b) / (other_slope - self_slope); const y = ((self_slope * (a - b)) / (other_slope - self_slope)) + a; return Point{ .x = x, .y = y }; } /// Find the point of intersection within the segments defined by the two lines. /// The segments have ends at points `a` and `b` for each line. pub fn segmentIntersection(self: Line, other: Line) ?Point { const inter_point = self.intersection(other); if (inter_point) |point| { if (self.segmentContainsPoint(point) and other.segmentContainsPoint(point)) { return point; } } return null; } }; pub fn radToDegLong(radian: anytype) @TypeOf(radian) { const deg = radToDeg(radian); if (deg > 180.0) { return deg - 360.0; } else if (deg < -180.0) { return deg + 360.0; } else { return deg; } } /// A standard radian-to-degree conversion function. pub fn radToDeg(radian: anytype) @TypeOf(radian) { return radian * rad_to_deg_constant; } /// A standard degree-to-radian conversion function. pub fn degToRad(degrees: anytype) @TypeOf(degrees) { return degrees * deg_to_rad_constant; } pub fn degToRadLong(degrees: anytype) @TypeOf(degrees) { const norm_deg = if (degrees < 0) degrees + 360 else degrees; return degToRad(norm_deg); } pub const OperationError = error{NaN}; /// Safely perform acos on a value without worrying about the value being outside of the range [-1.0, 1.0]. The value /// will be clamped to either end depending on whether it's too high or too low. pub fn boundedACos(x: anytype) OperationError!@TypeOf(x) { const T = @TypeOf(x); const value = switch (T) { f32, f64 => math.acos(x), f128, comptime_float => return math.acos(@floatCast(f64, x)), else => @compileError("boundedACos not implemented for type " ++ @typeName(T)), }; return if (std.math.isNan(value)) error.NaN else value; } pub fn boundedASin(x: anytype) OperationError!@TypeOf(x) { const T = @TypeOf(x); const value = switch (T) { f32, f64 => math.asin(x), f128, comptime_float => math.asin(@floatCast(f64, x)), else => @compileError("boundedACos not implemented for type " ++ @typeName(T)), }; return if (std.math.isNan(value)) error.NaN else value; } fn FloatModResult(comptime input_type: type) type { return switch (@typeInfo(input_type)) { .ComptimeFloat => f128, .Float => input_type, else => @compileError("floatMod is not implemented for type " ++ @typeName(input_type)) }; } pub fn floatMod(num: anytype, denom: @TypeOf(num)) FloatModResult(@TypeOf(num)) { const T = @TypeOf(num); // comptime_float is not compatable with math.fabs, so cast to f128 before using const numerator = if (T == comptime_float) @floatCast(f128, num) else num; const denominator = if (T == comptime_float) @floatCast(f128, denom) else denom; const div = math.floor(math.absFloat(numerator / denominator)); const whole_part = math.absFloat(denominator) * div; return if (num < 0) num + whole_part else num - whole_part; } pub fn floatEq(a: anytype, b: @TypeOf(a), epsilon: f32) bool { return -epsilon <= a - b and a - b <= epsilon; } test "degree to radian conversion" { const epsilon = 0.001; const degree = 45.0; const radian = degToRad(degree); std.testing.expectWithinEpsilon(math.pi / 4.0, radian, epsilon); } test "radian to degree conversion" { const epsilon = 0.001; const degree = comptime radToDeg(math.pi / 4.0); std.testing.expectWithinEpsilon(45.0, degree, epsilon); } test "custom float modulus" { const margin = 0.0001; std.testing.expectEqual(1.0, comptime floatMod(4.0, 1.5)); std.testing.expectWithinMargin(1.3467, comptime floatMod(74.17405, 14.56547), margin); std.testing.expectWithinMargin(1.3467, comptime floatMod(74.17405, -14.56547), margin); std.testing.expectWithinMargin(-1.3467, comptime floatMod(-74.17405, -14.56547), margin); std.testing.expectWithinMargin(-1.3467, comptime floatMod(-74.17405, 14.56547), margin); } test "longitude back and forth conversion - negative" { const epsilon = 0.001; const degLong = -75.0; const radLong = comptime degToRad(degLong); const backDegLong = comptime radToDegLong(radLong); std.testing.expectWithinEpsilon(-degLong, -backDegLong, epsilon); } test "line intersection" { const line_a = Line{ .a = Point{ .x = 234, .y = 129 }, .b = Point{ .x = 345, .y = 430 } }; const line_b = Line{ .a = Point{ .x = 293, .y = 185 }, .b = Point{ .x = 481, .y = 512 } }; const inter_point = line_a.intersection(line_b); std.testing.expectWithinMargin(@as(f32, 186.05), inter_point.?.x, 0.01); std.testing.expectWithinMargin(@as(f32, -1.02), inter_point.?.y, 0.01); std.testing.expect(line_a.containsPoint(inter_point.?)); std.testing.expect(line_b.containsPoint(inter_point.?)); const seg_inter = line_a.segmentIntersection(line_b); std.testing.expect(seg_inter == null); } test "segment intersect" { const line_a = Line{ .a = Point{ .x = 234, .y = 129 }, .b = Point{ .x = 345, .y = 430 } }; const line_b = Line{ .a = Point{ .x = 241, .y = 201 }, .b = Point{ .x = 299, .y = 105 } }; const inter_point = line_a.intersection(line_b); std.testing.expectWithinMargin(@as(f32, 253.14), inter_point.?.x, 0.01); std.testing.expectWithinMargin(@as(f32, 180.9), inter_point.?.y, 0.01); const seg_inter_point = line_a.segmentIntersection(line_b); std.testing.expectWithinMargin(@as(f32, 253.14), seg_inter_point.?.x, 0.01); std.testing.expectWithinMargin(@as(f32, 180.9), seg_inter_point.?.y, 0.01); }
night-math/src/math_utils.zig
const clap = @import("clap"); const format = @import("format"); const std = @import("std"); const ston = @import("ston"); const util = @import("util"); const debug = std.debug; const fmt = std.fmt; const fs = std.fs; const heap = std.heap; const io = std.io; const log = std.log; const mem = std.mem; const os = std.os; const rand = std.rand; const testing = std.testing; const Program = @This(); allocator: mem.Allocator, seed: u64, preference: Preference, pokemons: Pokemons = Pokemons{}, moves: Moves = Moves{}, tms: Machines = Machines{}, hms: Machines = Machines{}, const Preference = enum { random, stab, }; pub const main = util.generateMain(Program); pub const version = "0.0.0"; pub const description = \\Randomizes the moves Pokémons can learn. \\ ; pub const params = &[_]clap.Param(clap.Help){ clap.parseParam("-h, --help Display this help text and exit. ") catch unreachable, clap.parseParam("-p, --preference <random|stab> Which moves the randomizer should prefer picking (preference is 90% for stab and 10% otherwise). (default: random)") catch unreachable, clap.parseParam("-s, --seed <INT> The seed to use for random numbers. A random seed will be picked if this is not specified. ") catch unreachable, clap.parseParam("-v, --version Output version information and exit. ") catch unreachable, }; pub fn init(allocator: mem.Allocator, args: anytype) !Program { const seed = try util.getSeed(args); const pref = if (args.option("--preference")) |pref| if (mem.eql(u8, pref, "random")) Preference.random else if (mem.eql(u8, pref, "stab")) Preference.stab else { log.err("--preference does not support '{s}'", .{pref}); return error.InvalidArgument; } else Preference.random; return Program{ .allocator = allocator, .seed = seed, .preference = pref, }; } pub fn run( program: *Program, comptime Reader: type, comptime Writer: type, stdio: util.CustomStdIoStreams(Reader, Writer), ) anyerror!void { try format.io(program.allocator, stdio.in, stdio.out, program, useGame); try program.randomize(); try program.output(stdio.out); } fn output(program: *Program, writer: anytype) !void { for (program.pokemons.values()) |pokemon, i| { const species = program.pokemons.keys()[i]; try ston.serialize(writer, .{ .pokemons = ston.index(species, .{ .tms = pokemon.tms, .hms = pokemon.hms, }) }); } } fn useGame(program: *Program, parsed: format.Game) !void { const allocator = program.allocator; switch (parsed) { .pokemons => |pokemons| { const pokemon = (try program.pokemons.getOrPutValue(allocator, pokemons.index, .{})) .value_ptr; switch (pokemons.value) { .tms => |tms| _ = try pokemon.tms.put(allocator, tms.index, tms.value), .hms => |hms| _ = try pokemon.hms.put(allocator, hms.index, hms.value), .types => |types| { _ = try pokemon.types.put(allocator, types.value, {}); return error.DidNotConsumeData; }, .stats, .catch_rate, .base_exp_yield, .ev_yield, .items, .gender_ratio, .egg_cycles, .base_friendship, .growth_rate, .egg_groups, .abilities, .color, .evos, .moves, .name, .pokedex_entry, => return error.DidNotConsumeData, } return; }, .moves => |moves| { const move = (try program.moves.getOrPutValue(allocator, moves.index, .{})).value_ptr; switch (moves.value) { .power => |power| move.power = power, .type => |_type| move.type = _type, .name, .description, .effect, .accuracy, .pp, .target, .priority, .category, => {}, } return error.DidNotConsumeData; }, .tms => |tms| { _ = try program.tms.put(allocator, tms.index, tms.value); return error.DidNotConsumeData; }, .hms => |hms| { _ = try program.hms.put(allocator, hms.index, hms.value); return error.DidNotConsumeData; }, else => return error.DidNotConsumeData, } unreachable; } fn randomize(program: *Program) !void { const random = rand.DefaultPrng.init(program.seed).random(); for (program.pokemons.values()) |pokemon| { try randomizeMachinesLearned(program, pokemon, random, program.tms, pokemon.tms); try randomizeMachinesLearned(program, pokemon, random, program.hms, pokemon.hms); } } fn randomizeMachinesLearned( program: *Program, pokemon: Pokemon, random: rand.Random, machines: Machines, learned: MachinesLearned, ) !void { for (learned.values()) |*is_learned, i| { switch (program.preference) { .random => is_learned.* = random.boolean(), .stab => { const low_chance = 0.1; const chance: f64 = blk: { const tm_index = learned.keys()[i]; const index = machines.get(tm_index) orelse break :blk low_chance; const move = program.moves.get(index) orelse break :blk low_chance; const move_type = move.type orelse break :blk low_chance; if (pokemon.types.get(move_type) == null) break :blk low_chance; // Yay the move is stab. Give it a higher chance. break :blk @as(f64, 1.0 - low_chance); }; is_learned.* = random.float(f64) < chance; }, } } } const MachinesLearned = std.AutoArrayHashMapUnmanaged(u8, bool); const Machines = std.AutoArrayHashMapUnmanaged(u16, u16); const Moves = std.AutoArrayHashMapUnmanaged(u16, Move); const Pokemons = std.AutoArrayHashMapUnmanaged(u16, Pokemon); const Set = std.AutoArrayHashMapUnmanaged(u16, void); const Pokemon = struct { types: Set = Set{}, tms: MachinesLearned = MachinesLearned{}, hms: MachinesLearned = MachinesLearned{}, }; const LvlUpMove = struct { level: ?u16 = null, id: ?usize = null, }; const Move = struct { power: ?u8 = null, type: ?u16 = null, }; test "tm35-rand-learned-moves" { const result_prefix = \\.moves[0].power=10 \\.moves[0].type=0 \\.moves[1].power=30 \\.moves[1].type=12 \\.moves[2].power=30 \\.moves[2].type=16 \\.moves[3].power=30 \\.moves[3].type=10 \\.moves[4].power=50 \\.moves[4].type=0 \\.moves[5].power=70 \\.moves[5].type=0 \\.tms[0]=0 \\.tms[1]=2 \\.tms[2]=4 \\.hms[0]=1 \\.hms[1]=3 \\.hms[2]=5 \\.pokemons[0].types[0]=0 \\ ; const test_string = result_prefix ++ \\.pokemons[0].tms[0]=false \\.pokemons[0].tms[1]=false \\.pokemons[0].tms[2]=false \\.pokemons[0].hms[0]=false \\.pokemons[0].hms[1]=false \\.pokemons[0].hms[2]=false \\ ; try util.testing.testProgram(Program, &[_][]const u8{"--seed=0"}, test_string, result_prefix ++ \\.pokemons[0].tms[0]=true \\.pokemons[0].tms[1]=true \\.pokemons[0].tms[2]=false \\.pokemons[0].hms[0]=false \\.pokemons[0].hms[1]=false \\.pokemons[0].hms[2]=false \\ ); try util.testing.testProgram(Program, &[_][]const u8{ "--seed=0", "--preference=stab" }, test_string, result_prefix ++ \\.pokemons[0].tms[0]=true \\.pokemons[0].tms[1]=false \\.pokemons[0].tms[2]=true \\.pokemons[0].hms[0]=true \\.pokemons[0].hms[1]=false \\.pokemons[0].hms[2]=true \\ ); }
src/randomizers/tm35-rand-learned-moves.zig
const c = @import("c.zig"); const builtin = @import("builtin"); const debug = @import("std").debug; const math = @import("std").math; pub const ClientApi = enum { Unknown, OpenGL, Vulkan, }; // Data var g_Window: ?*c.GLFWwindow = null; var g_ClientApi: ClientApi = .Unknown; var g_Time: f64 = 0.0; var g_MouseJustPressed = [_]bool{false} ** 5; var g_MouseCursors = [_]?*c.GLFWcursor{null} ** c.ImGuiMouseCursor_COUNT; var g_WantUpdateMonitors = true; // Chain GLFW callbacks for main viewport: // our callbacks will call the user's previously installed callbacks, if any. var g_PrevUserCallbackMousebutton: c.GLFWmousebuttonfun = null; var g_PrevUserCallbackScroll: c.GLFWscrollfun = null; var g_PrevUserCallbackKey: c.GLFWkeyfun = null; var g_PrevUserCallbackChar: c.GLFWcharfun = null; pub fn Init(window: *c.GLFWwindow, install_callbacks: bool, client_api: ClientApi) void { g_Window = window; g_Time = 0.0; // Setup back-end capabilities flags const io = c.igGetIO(); io.*.BackendFlags |= c.ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional) io.*.BackendFlags |= c.ImGuiBackendFlags_HasSetMousePos; // We can honor io.WantSetMousePos requests (optional, rarely used) if (false) io.*.BackendFlags |= c.ImGuiBackendFlags_PlatformHasViewports; // We can create multi-viewports on the Platform side (optional) if (false and @hasField(c, "GLFW_HAS_GLFW_HOVERED") and builtin.os == builtin.Os.windows) { io.*.BackendFlags |= ImGuiBackendFlags_HasMouseHoveredViewport; // We can set io.MouseHoveredViewport correctly (optional, not easy) } io.*.BackendPlatformName = "imgui_impl_glfw.zig"; // Keyboard mapping. ImGui will use those indices to peek into the io.KeysDown[] array. io.*.KeyMap[c.ImGuiKey_Tab] = c.GLFW_KEY_TAB; io.*.KeyMap[c.ImGuiKey_LeftArrow] = c.GLFW_KEY_LEFT; io.*.KeyMap[c.ImGuiKey_RightArrow] = c.GLFW_KEY_RIGHT; io.*.KeyMap[c.ImGuiKey_UpArrow] = c.GLFW_KEY_UP; io.*.KeyMap[c.ImGuiKey_DownArrow] = c.GLFW_KEY_DOWN; io.*.KeyMap[c.ImGuiKey_PageUp] = c.GLFW_KEY_PAGE_UP; io.*.KeyMap[c.ImGuiKey_PageDown] = c.GLFW_KEY_PAGE_DOWN; io.*.KeyMap[c.ImGuiKey_Home] = c.GLFW_KEY_HOME; io.*.KeyMap[c.ImGuiKey_End] = c.GLFW_KEY_END; io.*.KeyMap[c.ImGuiKey_Insert] = c.GLFW_KEY_INSERT; io.*.KeyMap[c.ImGuiKey_Delete] = c.GLFW_KEY_DELETE; io.*.KeyMap[c.ImGuiKey_Backspace] = c.GLFW_KEY_BACKSPACE; io.*.KeyMap[c.ImGuiKey_Space] = c.GLFW_KEY_SPACE; io.*.KeyMap[c.ImGuiKey_Enter] = c.GLFW_KEY_ENTER; io.*.KeyMap[c.ImGuiKey_Escape] = c.GLFW_KEY_ESCAPE; io.*.KeyMap[c.ImGuiKey_KeyPadEnter] = c.GLFW_KEY_KP_ENTER; io.*.KeyMap[c.ImGuiKey_A] = c.GLFW_KEY_A; io.*.KeyMap[c.ImGuiKey_C] = c.GLFW_KEY_C; io.*.KeyMap[c.ImGuiKey_V] = c.GLFW_KEY_V; io.*.KeyMap[c.ImGuiKey_X] = c.GLFW_KEY_X; io.*.KeyMap[c.ImGuiKey_Y] = c.GLFW_KEY_Y; io.*.KeyMap[c.ImGuiKey_Z] = c.GLFW_KEY_Z; // @TODO: Clipboard // io.SetClipboardTextFn = ImGui_ImplGlfw_SetClipboardText; // io.GetClipboardTextFn = ImGui_ImplGlfw_GetClipboardText; io.*.ClipboardUserData = g_Window; g_MouseCursors[c.ImGuiMouseCursor_Arrow] = c.glfwCreateStandardCursor(c.GLFW_ARROW_CURSOR); g_MouseCursors[c.ImGuiMouseCursor_TextInput] = c.glfwCreateStandardCursor(c.GLFW_IBEAM_CURSOR); g_MouseCursors[c.ImGuiMouseCursor_ResizeAll] = c.glfwCreateStandardCursor(c.GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this. g_MouseCursors[c.ImGuiMouseCursor_ResizeNS] = c.glfwCreateStandardCursor(c.GLFW_VRESIZE_CURSOR); g_MouseCursors[c.ImGuiMouseCursor_ResizeEW] = c.glfwCreateStandardCursor(c.GLFW_HRESIZE_CURSOR); g_MouseCursors[c.ImGuiMouseCursor_ResizeNESW] = c.glfwCreateStandardCursor(c.GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this. g_MouseCursors[c.ImGuiMouseCursor_ResizeNWSE] = c.glfwCreateStandardCursor(c.GLFW_ARROW_CURSOR); // FIXME: GLFW doesn't have this. g_MouseCursors[c.ImGuiMouseCursor_Hand] = c.glfwCreateStandardCursor(c.GLFW_HAND_CURSOR); // Chain GLFW callbacks: our callbacks will call the user's previously installed callbacks, if any. g_PrevUserCallbackMousebutton = null; g_PrevUserCallbackScroll = null; g_PrevUserCallbackKey = null; g_PrevUserCallbackChar = null; if (install_callbacks) { g_PrevUserCallbackMousebutton = c.glfwSetMouseButtonCallback(window, Callback_MouseButton); g_PrevUserCallbackScroll = c.glfwSetScrollCallback(window, Callback_Scroll); g_PrevUserCallbackKey = c.glfwSetKeyCallback(window, Callback_Key); g_PrevUserCallbackChar = c.glfwSetCharCallback(window, Callback_Char); } // Our mouse update function expect PlatformHandle to be filled for the main viewport const main_viewport = c.igGetMainViewport(); main_viewport.*.PlatformHandle = g_Window; // if (builtin.os == builtin.Os.windows) // main_viewport.*.PlatformHandleRaw = c.glfwGetWin32Window(g_Window); // @TODO: Platform Interface (Viewport) if (io.*.ConfigFlags & c.ImGuiConfigFlags_ViewportsEnable != 0) unreachable; // ImGui_ImplGlfw_InitPlatformInterface(); g_ClientApi = client_api; } pub fn Shutdown() void { // @TODO: Platform Interface (Viewport) // ImGui_ImplGlfw_ShutdownPlatformInterface(); for (g_MouseCursors) |*cursor| { c.glfwDestroyCursor(cursor.*); cursor.* = null; } g_ClientApi = .Unknown; } pub fn NewFrame() void { const io = c.igGetIO(); debug.assert(c.ImFontAtlas_IsBuilt(io.*.Fonts)); var w: c_int = undefined; var h: c_int = undefined; var display_w: c_int = undefined; var display_h: c_int = undefined; c.glfwGetWindowSize(g_Window, &w, &h); c.glfwGetFramebufferSize(g_Window, &display_w, &display_h); io.*.DisplaySize = c.ImVec2{ .x = @intToFloat(f32, w), .y = @intToFloat(f32, h) }; if (w > 0 and h > 0) io.*.DisplayFramebufferScale = c.ImVec2{ .x = @intToFloat(f32, display_w) / @intToFloat(f32, w), .y = @intToFloat(f32, display_h) / @intToFloat(f32, h), }; if (g_WantUpdateMonitors) UpdateMonitors(); // Setup time step const current_time = c.glfwGetTime(); io.*.DeltaTime = if (g_Time > 0.0) @floatCast(f32, current_time - g_Time) else 1.0 / 60.0; g_Time = current_time; UpdateMousePosAndButtons(); UpdateMouseCursor(); UpdateGamepads(); } fn UpdateMonitors() void { const platform_io = c.igGetPlatformIO(); var monitors_count: c_int = 0; const glfw_monitors = c.glfwGetMonitors(&monitors_count)[0..@intCast(usize, monitors_count)]; c.ImVector_ImGuiPlatformMonitor_Resize(&platform_io.*.Monitors, monitors_count); for (glfw_monitors) |glfw_monitor, n| { var monitor = &platform_io.*.Monitors.Data[n]; var x: c_int = undefined; var y: c_int = undefined; c.glfwGetMonitorPos(glfw_monitor, &x, &y); const vid_mode = c.glfwGetVideoMode(glfw_monitor); // glfw_monitors[n]); monitor.*.MainPos = c.ImVec2{ .x = @intToFloat(f32, x), .y = @intToFloat(f32, y) }; monitor.*.MainSize = c.ImVec2{ .x = @intToFloat(f32, vid_mode.*.width), .y = @intToFloat(f32, vid_mode.*.height), }; if (false and c.GLFW_HAS_MONITOR_WORK_AREA) { var w: c_int = undefined; var h: c_int = undefined; c.glfwGetMonitorWorkarea(glfw_monitor, &x, &y, &w, &h); monitor.*.WorkPos = ImVec2{ .x = @intToFloat(f32, x), .y = @intToFloat(f32, y) }; monitor.*.WorkSize = ImVec2{ .x = @intToFloat(f32, w), .y = @intToFloat(f32, h) }; } if (false and c.GLFW_HAS_PER_MONITOR_DPI) { // Warning: the validity of monitor DPI information on Windows depends on the application DPI awareness settings, // which generally needs to be set in the manifest or at runtime. var x_scale: f32 = undefined; var y_scale: f32 = undefined; c.glfwGetMonitorContentScale(glfw_monitor, &x_scale, &y_scale); monitor.*.DpiScale = x_scale; } } g_WantUpdateMonitors = false; } fn UpdateMousePosAndButtons() void { // Update buttons const io = c.igGetIO(); for (io.*.MouseDown) |*isDown, i| { // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. isDown.* = g_MouseJustPressed[i] or c.glfwGetMouseButton(g_Window, @intCast(c_int, i)) != 0; g_MouseJustPressed[i] = false; } // Update mouse position const mouse_pos_backup = io.*.MousePos; io.*.MousePos = c.ImVec2{ .x = math.f32_min, .y = math.f32_min }; io.*.MouseHoveredViewport = 0; const platform_io = c.igGetPlatformIO(); var n: usize = 0; while (n < @intCast(usize, platform_io.*.Viewports.Size)) : (n += 1) { const viewport = platform_io.*.Viewports.Data[n]; const window = @ptrCast(*c.GLFWwindow, viewport.*.PlatformHandle); const focused = c.glfwGetWindowAttrib(window, c.GLFW_FOCUSED) != 0; if (focused) { if (io.*.WantSetMousePos) { c.glfwSetCursorPos(window, mouse_pos_backup.x - viewport.*.Pos.x, mouse_pos_backup.y - viewport.*.Pos.y); } else { var mouse_x: f64 = undefined; var mouse_y: f64 = undefined; c.glfwGetCursorPos(window, &mouse_x, &mouse_y); if (io.*.ConfigFlags & c.ImGuiConfigFlags_ViewportsEnable != 0) { // Multi-viewport mode: mouse position in OS absolute coordinates (io.MousePos is (0,0) when the mouse is on the upper-left of the primary monitor) var window_x: c_int = undefined; var window_y: c_int = undefined; c.glfwGetWindowPos(window, &window_x, &window_y); io.*.MousePos = c.ImVec2{ .x = @floatCast(f32, mouse_x) + @intToFloat(f32, window_x), .y = @floatCast(f32, mouse_y) + @intToFloat(f32, window_y), }; } else { // Single viewport mode: mouse position in client window coordinates (io.MousePos is (0,0) when the mouse is on the upper-left corner of the app window) io.*.MousePos = c.ImVec2{ .x = @floatCast(f32, mouse_x), .y = @floatCast(f32, mouse_y) }; } } for (io.*.MouseDown) |*isDown, i| isDown.* = isDown.* or c.glfwGetMouseButton(window, @intCast(c_int, i)) != 0; } } } fn UpdateMouseCursor() void { const io = c.igGetIO(); if (io.*.ConfigFlags & c.ImGuiConfigFlags_NoMouseCursorChange != 0 or c.glfwGetInputMode(g_Window, c.GLFW_CURSOR) == c.GLFW_CURSOR_DISABLED) return; const imgui_cursor = c.igGetMouseCursor(); const platform_io = c.igGetPlatformIO(); var n: usize = 0; while (n < @intCast(usize, platform_io.*.Viewports.Size)) : (n += 1) { const window = @ptrCast(*c.GLFWwindow, platform_io.*.Viewports.Data[n].*.PlatformHandle); if (imgui_cursor == c.ImGuiMouseCursor_None or io.*.MouseDrawCursor) { // Hide OS mouse cursor if imgui is drawing it or if it wants no cursor c.glfwSetInputMode(window, c.GLFW_CURSOR, c.GLFW_CURSOR_HIDDEN); } else { // Show OS mouse cursor // FIXME-PLATFORM: Unfocused windows seems to fail changing the mouse cursor with GLFW 3.2, but 3.3 works here. c.glfwSetCursor(window, if (g_MouseCursors[@intCast(usize, imgui_cursor)]) |cursor| cursor else g_MouseCursors[c.ImGuiMouseCursor_Arrow]); c.glfwSetInputMode(window, c.GLFW_CURSOR, c.GLFW_CURSOR_NORMAL); } } } fn UpdateGamepads() void { // @TODO } // GLFW Callbacks export fn Callback_MouseButton(window: ?*c.GLFWwindow, button: c_int, action: c_int, mods: c_int) void { if (g_PrevUserCallbackMousebutton) |prev| { prev(window, button, action, mods); } if (button < 0) return; const button_u = @intCast(usize, button); if (action == c.GLFW_PRESS and button_u < g_MouseJustPressed.len) g_MouseJustPressed[button_u] = true; } export fn Callback_Scroll(window: ?*c.GLFWwindow, dx: f64, dy: f64) void { if (g_PrevUserCallbackScroll) |prev| { prev(window, dx, dy); } const io = c.igGetIO(); io.*.MouseWheelH += @floatCast(f32, dx); io.*.MouseWheel += @floatCast(f32, dy); } export fn Callback_Key(window: ?*c.GLFWwindow, key: c_int, scancode: c_int, action: c_int, modifiers: c_int) void { if (g_PrevUserCallbackKey) |prev| { prev(window, key, scancode, action, modifiers); } if (key < 0) unreachable; const key_u = @intCast(usize, key); const io = c.igGetIO(); if (action == c.GLFW_PRESS) io.*.KeysDown[key_u] = true; if (action == c.GLFW_RELEASE) io.*.KeysDown[key_u] = false; // Modifiers are not reliable across systems io.*.KeyCtrl = io.*.KeysDown[c.GLFW_KEY_LEFT_CONTROL] or io.*.KeysDown[c.GLFW_KEY_RIGHT_CONTROL]; io.*.KeyShift = io.*.KeysDown[c.GLFW_KEY_LEFT_SHIFT] or io.*.KeysDown[c.GLFW_KEY_RIGHT_SHIFT]; io.*.KeyAlt = io.*.KeysDown[c.GLFW_KEY_LEFT_ALT] or io.*.KeysDown[c.GLFW_KEY_RIGHT_ALT]; io.*.KeySuper = io.*.KeysDown[c.GLFW_KEY_LEFT_SUPER] or io.*.KeysDown[c.GLFW_KEY_RIGHT_SUPER]; } export fn Callback_Char(window: ?*c.GLFWwindow, char: c_uint) void { if (g_PrevUserCallbackChar) |prev| { prev(window, char); } const io = c.igGetIO(); c.ImGuiIO_AddInputCharacter(io, char); }
examples/imgui-dice-roller/src/glfw_impl.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const crc32 = std.hash.crc; const mem = std.mem; const testing = std.testing; const tagLiteral = 0x00; const tagCopy1 = 0x01; const tagCopy2 = 0x02; const tagCopy4 = 0x03; const checksumSize = 4; const chunkHeaderSize = 4; const magicBody = "sNaPpY"; const magicChunk = "\xff\x06\x00\x00" ++ magicBody; const maxBlockSize = 65536; const maxEncodedLenOfMaxBlockSize = 76490; const inputMargin = 16 - 1; const minNonLiteralBlockSize = 1 + 1 + inputMargin; const obufHeaderLen = magicChunk.len + checksumSize + chunkHeaderSize; const obufLen = obufHeaderLen + maxEncodedLenOfMaxBlockSize; const chunkTypeCompressedData = 0x00; const chunkTypeUncompressedData = 0x01; const chunkTypePadding = 0xfe; const chunkTypeStreamIdentifier = 0xff; // Various errors that may occur while decoding. const SnappyError = error{ Corrupt, TooLarge, Unsupported, }; // Perform the CRC hash per the snappy documentation. We must use wrapping addition since this is // the default behavior in other languages. fn crc(b: []const u8) u32 { const c = crc32.Crc32SmallWithPoly(.Castagnoli); const hash = c.hash(b); return @as(u32, hash >> 15 | hash << 17) +% 0xa282ead8; } // Represents a variable length integer that we read from a byte stream along with how many bytes // were read to decode it. const Varint = struct { value: u64, bytesRead: usize, }; // https://golang.org/pkg/encoding/binary/#Uvarint fn uvarint(buf: []const u8) Varint { var x: u64 = 0; var s: u6 = 0; // We can shift a maximum of 2^6 (64) times. for (buf) |b, i| { if (b < 0x80) { if (i > 9 or i == 9 and b > 1) { return Varint{ .value = 0, .bytesRead = -%i + 1, }; } return Varint{ .value = x | (@as(u64, b) << s), .bytesRead = i + 1, }; } x |= (@as(u64, b & 0x7f) << s); s += 7; } return Varint{ .value = 0, .bytesRead = 0, }; } // https://golang.org/pkg/encoding/binary/#PutUvarint fn putUvarint(buf: []u8, x: u64) usize { var i: usize = 0; var mutX = x; while (mutX >= 0x80) { buf[i] = @truncate(u8, mutX) | 0x80; mutX >>= 7; i += 1; } buf[i] = @truncate(u8, mutX); return i + 1; } // This type represents the size of the snappy block and the header length. const SnappyBlock = struct { blockLen: u64, headerLen: usize, }; // Return the length of the decoded block and the number of bytes that the header occupied. fn decodedLen(src: []const u8) !SnappyBlock { const varint = uvarint(src); if (varint.bytesRead <= 0 or varint.value > 0xffffffff) { return SnappyError.Corrupt; } const wordSize = 32 << (-1 >> 32 & 1); if (wordSize == 32 and varint.value > 0x7fffffff) { return SnappyError.TooLarge; } return SnappyBlock{ .blockLen = varint.value, .headerLen = varint.bytesRead, }; } // The block format decoding implementation. fn runDecode(dst: []u8, src: []const u8) u8 { var d: usize = 0; var s: usize = 0; var offset: isize = 0; var length: isize = 0; while (s < src.len) { switch (src[s] & 0x03) { tagLiteral => { var x = @as(u32, src[s] >> 2); switch (x) { 0...59 => s += 1, 60 => { s += 2; if (s > src.len) { return 1; } x = @as(u32, src[s - 1]); }, 61 => { s += 3; if (s > src.len) { return 1; } x = @as(u32, src[s - 2]) | @as(u32, src[s - 1]) << 8; }, 62 => { s += 4; if (s > src.len) { return 1; } x = @as(u32, src[s - 3]) | @as(u32, src[s - 2]) << 8 | @as(u32, src[s - 1]) << 16; }, 63 => { s += 5; if (s > src.len) { return 1; } x = @as(u32, src[s - 4]) | @as(u32, src[s - 3]) << 8 | @as(u32, src[s - 2]) << 16 | @as(u32, src[s - 1]) << 24; }, // Should be unreachable. else => { return 1; }, } length = @as(isize, x) + 1; if (length <= 0) { return 1; } if (length > dst.len - d or length > src.len - s) { return 1; } mem.copy(u8, dst[d..], src[s .. s + @intCast(usize, length)]); const l = @intCast(usize, length); d += l; s += l; continue; }, tagCopy1 => { s += 2; if (s > src.len) { return 1; } length = 4 + (@as(isize, src[s - 2]) >> 2 & 0x7); offset = @as(isize, (@as(u32, src[s - 2]) & 0xe0) << 3 | @as(u32, src[s - 1])); }, tagCopy2 => { s += 3; if (s > src.len) { return 1; } length = 1 + (@as(isize, src[s - 3]) >> 2); offset = @as(isize, @as(u32, src[s - 2]) | @as(u32, src[s - 1]) << 8); }, tagCopy4 => { s += 5; if (s > src.len) { return 1; } length = 1 + (@as(isize, src[s - 5]) >> 2); offset = @as(isize, @as(u32, src[s - 4]) | @as(u32, src[s - 3]) << 8 | @as(u32, src[s - 2]) << 16 | @as(u32, src[s - 1]) << 24); }, // Should be unreachable. else => { return 1; }, } if (offset <= 0 or d < offset or length > dst.len - d) { return 1; } if (offset >= length) { const upper_bound = d - @intCast(usize, offset) + @intCast(usize, length); mem.copy(u8, dst[d .. d + @intCast(usize, length)], dst[d - @intCast(usize, offset) .. upper_bound]); d += @intCast(usize, length); continue; } var a = dst[d .. d + @intCast(usize, length)]; var b = dst[d - @intCast(usize, offset) ..]; var aLen = a.len; b = b[0..aLen]; for (a) |_, i| { a[i] = b[i]; } d += @intCast(usize, length); } if (d != dst.len) { return 1; } return 0; } /// Given a chosen allocator and the source input, decode it using the snappy block format. The /// returned slice must be freed. pub fn decode(allocator: *Allocator, src: []const u8) ![]u8 { const block = try decodedLen(src); var dst = try allocator.alloc(u8, block.blockLen); errdefer allocator.free(dst); // Skip past how many bytes we read to get the length. var s = src[block.headerLen..]; if (runDecode(dst, s) != 0) { return SnappyError.Corrupt; } return dst; } // TODO: Split up encode and decode into separate files once I better understand modules. fn emitLiteral(dst: []u8, lit: []const u8) usize { var i: usize = 0; const n = @intCast(usize, lit.len - 1); switch (n) { 0...59 => { dst[0] = @intCast(u8, n) << 2 | tagLiteral; i = 1; }, 60...255 => { dst[0] = 60 << 2 | tagLiteral; dst[1] = @intCast(u8, n); i = 2; }, else => { dst[0] = 61 << 2 | tagLiteral; dst[1] = @intCast(u8, n); dst[2] = @intCast(u8, n >> 8); i = 3; }, } mem.copy(u8, dst[i..], lit); return i + std.math.min(dst.len, lit.len); } fn load32(b: []u8, i: isize) u32 { const j = @intCast(usize, i); const v = b[j .. j + 4]; return @intCast(u32, v[0]) | @intCast(u32, v[1]) << 8 | @intCast(u32, v[2]) << 16 | @intCast(u32, v[3]) << 24; } fn load64(b: []u8, i: isize) u64 { const j = @intCast(usize, i); const v = b[j .. j + 8]; return @intCast(u64, v[0]) | @intCast(u64, v[1]) << 8 | @intCast(u64, v[2]) << 16 | @intCast(u64, v[3]) << 24 | @intCast(u64, v[4]) << 32 | @intCast(u64, v[5]) << 40 | @intCast(u64, v[6]) << 48 | @intCast(u64, v[7]) << 56; } fn snappyHash(u: u32, shift: u32) u32 { const s = @intCast(u5, shift); return (u *% 0x1e35a7bd) >> s; } fn emitCopy(dst: []u8, offset: isize, length: isize) usize { var i: usize = 0; var l: isize = length; while (l >= 68) { dst[i + 0] = 63 << 2 | tagCopy2; dst[i + 1] = @truncate(u8, @intCast(usize, offset)); dst[i + 2] = @truncate(u8, @intCast(usize, offset >> 8)); i += 3; l -= 64; } if (l > 64) { dst[i + 0] = 59 << 2 | tagCopy2; dst[i + 1] = @truncate(u8, @intCast(usize, offset)); dst[i + 2] = @truncate(u8, @intCast(usize, offset >> 8)); //mem.copy(u8, dst, &mem.toBytes(offset)); i += 3; l -= 60; } if (l >= 12 or offset >= 2048) { dst[i + 0] = (@intCast(u8, l) -% 1) << 2 | tagCopy2; dst[i + 1] = @truncate(u8, @intCast(usize, offset)); dst[i + 2] = @truncate(u8, @intCast(usize, offset >> 8)); return i + 3; } dst[i + 0] = @truncate(u8, @intCast(usize, offset >> 8)) << 5 | (@intCast(u8, l) -% 4) << 2 | tagCopy1; dst[i + 1] = @truncate(u8, @intCast(usize, offset)); return i + 2; } fn encodeBlock(dst: []u8, src: []u8) usize { const maxTableSize = 1 << 14; const tableMask = maxTableSize - 1; var d: usize = 0; var shift: u32 = 24; var tableSize: isize = 1 << 8; while (tableSize < maxTableSize and tableSize < src.len) { tableSize *= 2; shift -= 1; } var table = mem.zeroes([maxTableSize]u16); var sLimit = src.len - inputMargin; var nextEmit: usize = 0; var s: usize = 1; var nextHash = snappyHash(load32(src, @intCast(isize, s)), shift); outer: while (true) { var skip: isize = 32; var nextS = s; var candidate: isize = 0; inner: while (true) { s = nextS; var bytesBetweenHashLookups = skip >> 5; nextS = s + @intCast(usize, bytesBetweenHashLookups); skip += bytesBetweenHashLookups; if (nextS > sLimit) { break :outer; } candidate = @intCast(isize, table[nextHash & tableMask]); table[nextHash & tableMask] = @intCast(u16, s); nextHash = snappyHash(load32(src, @intCast(isize, nextS)), shift); if (load32(src, @intCast(isize, s)) == load32(src, candidate)) { break :inner; } } d += emitLiteral(dst[d..], src[nextEmit..s]); while (true) { var base = s; s += 4; var i = @intCast(usize, candidate + 4); while (s < src.len and src[i] == src[s]) { i += 1; s += 1; } d += emitCopy(dst[d..], @intCast(isize, base - @intCast(usize, candidate)), @intCast(isize, s - base)); nextEmit = s; if (s >= sLimit) { break :outer; } var x = load64(src, @intCast(isize, s - 1)); var prevHash = snappyHash(@truncate(u32, x >> 0), shift); table[prevHash & tableMask] = @intCast(u16, s - 1); var currHash = snappyHash(@truncate(u32, x >> 8), shift); candidate = @intCast(isize, table[currHash & tableMask]); table[currHash & tableMask] = @intCast(u16, s); if (@truncate(u32, x >> 8) != load32(src, candidate)) { nextHash = snappyHash(@truncate(u32, x >> 16), shift); s += 1; break; } } } if (nextEmit < src.len) { d += emitLiteral(dst[d..], src[nextEmit..]); } return d; } /// Encode returns the encoded form of the source input. The returned slice must be freed. pub fn encode(allocator: *Allocator, src: []u8) ![]u8 { var mutSrc = src; const encodedLen = maxEncodedLen(mutSrc.len); if (encodedLen < 0) { return SnappyError.TooLarge; } var dst = try allocator.alloc(u8, @intCast(usize, encodedLen)); errdefer allocator.free(dst); var d = putUvarint(dst, @intCast(u64, mutSrc.len)); while (mutSrc.len > 0) { var p = try allocator.alloc(u8, mutSrc.len); mem.copy(u8, p, mutSrc); var empty = [_]u8{}; mutSrc = empty[0..]; if (p.len > maxBlockSize) { mutSrc = p[maxBlockSize..]; p = p[0..maxBlockSize]; } if (p.len < minNonLiteralBlockSize) { d += emitLiteral(dst[d..], p); } else { d += encodeBlock(dst[d..], p); } allocator.free(p); } return dst[0..d]; } /// Return the maximum length of a snappy block, given the uncompressed length. pub fn maxEncodedLen(srcLen: usize) isize { var n = @intCast(u64, srcLen); if (n > 0xffffffff) { return -1; } n = 32 + n + n / 6; if (n > 0xffffffff) { return -1; } return @intCast(isize, n); } test "snappy crc" { try testing.expect(crc("snappy") == 0x293d0c23); } test "decoding variable integers" { // Taken from the block format description. const case1 = uvarint(&[_]u8{0x40}); try testing.expect(case1.value == 64); try testing.expect(case1.bytesRead == 1); const case2 = uvarint(&[_]u8{ 0xfe, 0xff, 0x7f }); try testing.expect(case2.value == 2097150); try testing.expect(case2.bytesRead == 3); } test "simple decode" { // TODO: Use the testing allocator? const allocator = std.heap.page_allocator; const decoded = try decode(allocator, "\x19\x1coh snap,\x05\x06,py is cool!\x0a"); defer allocator.free(decoded); try testing.expectEqualSlices(u8, decoded, "oh snap, snappy is cool!\n"); }
snappy.zig
const getty = @import("../../../lib.zig"); const std = @import("std"); pub fn Visitor(comptime Array: type) type { return struct { const Self = @This(); pub usingnamespace getty.de.Visitor( Self, Value, undefined, undefined, undefined, undefined, undefined, undefined, visitSeq, visitString, undefined, undefined, ); const Value = Array; fn visitSeq(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, seq: anytype) Deserializer.Error!Value { var array: Value = undefined; var seen: usize = 0; errdefer { if (allocator) |alloc| { if (array.len > 0) { var i: usize = 0; while (i < seen) : (i += 1) { getty.de.free(alloc, array[i]); } } } } switch (array.len) { 0 => array = .{}, else => for (array) |*elem| { if (try seq.nextElement(allocator, Child)) |value| { elem.* = value; seen += 1; } else { // End of sequence was reached early. return error.InvalidLength; } }, } // Expected end of sequence, but found an element. if ((try seq.nextElement(allocator, Child)) != null) { return error.InvalidLength; } return array; } fn visitString(_: Self, allocator: ?std.mem.Allocator, comptime Deserializer: type, input: anytype) Deserializer.Error!Value { defer getty.de.free(allocator.?, input); if (Child == u8) { var string: Value = undefined; if (input.len == string.len) { std.mem.copy(u8, &string, input); return string; } } return error.InvalidType; } const Child = std.meta.Child(Value); }; }
src/de/impl/visitor/array.zig
const std = @import("std"); const zloppy = @import("zloppy.zig"); // zig fmt: off const test_cases_off = [_]TestCase{ .{ .input = \\fn foo(bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , .expected = \\fn foo(bar: bool) void {} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ // existing comment \\ _ = bar; // XXX ZLOPPY unused var bar \\ // existing comment2 \\} \\ , .expected = \\fn foo(bar: bool) void { \\ // existing comment \\ // existing comment2 \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ return; \\ // existing comment \\ // _ = bar; // XXX ZLOPPY unreachable code \\ //// existing comment2 // XXX ZLOPPY unreachable code \\} \\ , .expected = \\fn foo(bar: bool) void { \\ return; \\ // existing comment \\ _ = bar; \\ // existing comment2 \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ return; \\ // existing comment \\ // _ = bar; // XXX ZLOPPY unreachable code \\ //// existing comment2 // XXX ZLOPPY unreachable code \\ // _ = 42; // XXX ZLOPPY unreachable code \\} \\ , .expected = \\fn foo(bar: bool) void { \\ return; \\ // existing comment \\ _ = bar; \\ // existing comment2 \\ _ = 42; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ return; \\ //while (true) { // XXX ZLOPPY unreachable code \\ //_ = bar; // XXX ZLOPPY unreachable code \\ //if (42 > 0) { // XXX ZLOPPY unreachable code \\ //_ = 1; // XXX ZLOPPY unreachable code \\ //} // XXX ZLOPPY unreachable code \\ //} // XXX ZLOPPY unreachable code \\} \\ , .expected = \\fn foo(bar: bool) void { \\ return; \\ while (true) { \\ _ = bar; \\ if (42 > 0) { \\ _ = 1; \\ } \\ } \\} \\ , }, .{ .input = \\fn foo(bar: bool) u32 { \\ while (true) { \\ _ = bar; \\ if (42 > 0) { \\ return 0; \\ //_ = 1; // XXX ZLOPPY unreachable code \\ } \\ _ = 42; \\ return if (bar) 42 else 1 + 2 + 3; \\ //_ = true; // XXX ZLOPPY unreachable code \\ //{ // XXX ZLOPPY unreachable code \\ //// some comment // XXX ZLOPPY unreachable code \\ //} // XXX ZLOPPY unreachable code \\ } \\} \\ , .expected = \\fn foo(bar: bool) u32 { \\ while (true) { \\ _ = bar; \\ if (42 > 0) { \\ return 0; \\ _ = 1; \\ } \\ _ = 42; \\ return if (bar) 42 else 1 + 2 + 3; \\ _ = true; \\ { \\ // some comment \\ } \\ } \\} \\ , }, }; // zig fmt: on // zig fmt: off const test_cases_on = [_]TestCase{ .{ .input = \\ , .expected = \\ , }, .{ .input = \\fn foo() void {} \\ , .expected = \\fn foo() void {} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\} \\ , .expected = \\fn foo(bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , }, .{ .input = \\fn foo(bar: bool, baz: u32) void { \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool, baz: u32) void { \\ _ = baz; // XXX ZLOPPY unused var baz \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ // existing comment \\ // existing comment2 \\} \\ , .expected = \\fn foo(bar: bool) void { \\ // existing comment \\ // existing comment2 \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , }, .{ .input = \\fn foo(bar: bool, baz: u32) void { \\ // existing comment \\ // existing comment2 \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool, baz: u32) void { \\ // existing comment \\ // existing comment2 \\ _ = baz; // XXX ZLOPPY unused var baz \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = 42; \\} \\ , .expected = \\fn foo() void { \\ const bar = 42; \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = 42; \\ _ = bar; \\} \\ , .expected = \\fn foo() void { \\ const bar = 42; \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ const baz = bar; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ const baz = bar; \\ _ = baz; // XXX ZLOPPY unused var baz \\} \\ , }, .{ .input = \\fn foo(bar: fn () void) void { \\ bar(); \\} \\ , .expected = \\fn foo(bar: fn () void) void { \\ bar(); \\} \\ , }, .{ .input = \\fn foo(bar: *u32) void { \\ bar.* = 0; \\} \\ , .expected = \\fn foo(bar: *u32) void { \\ bar.* = 0; \\} \\ , }, .{ .input = \\fn foo(comptime bar: bool) void { \\} \\ , .expected = \\fn foo(comptime bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ std.debug.print("bar={}\n", .{bar}); \\} \\ , .expected = \\fn foo(bar: bool) void { \\ std.debug.print("bar={}\n", .{bar}); \\} \\ , }, .{ .input = \\fn foo(bar: bool, baz: bool, quux: bool) void { \\ std.debug.print("quux={}\n", .{quux}); \\} \\ , .expected = \\fn foo(bar: bool, baz: bool, quux: bool) void { \\ _ = baz; // XXX ZLOPPY unused var baz \\ _ = bar; // XXX ZLOPPY unused var bar \\ std.debug.print("quux={}\n", .{quux}); \\} \\ , }, .{ .input = \\fn foo(un: bool, deux: bool, trois: bool, quatre: bool) void { \\ std.debug.print("quatre={}\n", .{quatre}); \\} \\ , .expected = \\fn foo(un: bool, deux: bool, trois: bool, quatre: bool) void { \\ _ = trois; // XXX ZLOPPY unused var trois \\ _ = deux; // XXX ZLOPPY unused var deux \\ _ = un; // XXX ZLOPPY unused var un \\ std.debug.print("quatre={}\n", .{quatre}); \\} \\ , }, .{ .input = \\fn foo(un: bool, deux: bool, trois: bool, quatre: bool, cinq: bool) void { \\ std.debug.print("quatre={}\n", .{quatre}); \\} \\ , .expected = \\fn foo(un: bool, deux: bool, trois: bool, quatre: bool, cinq: bool) void { \\ _ = cinq; // XXX ZLOPPY unused var cinq \\ _ = trois; // XXX ZLOPPY unused var trois \\ _ = deux; // XXX ZLOPPY unused var deux \\ _ = un; // XXX ZLOPPY unused var un \\ std.debug.print("quatre={}\n", .{quatre}); \\} \\ , }, .{ .input = \\fn foo(bar: bool) callconv(.C) void { \\} \\ , .expected = \\fn foo(bar: bool) callconv(.C) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , }, .{ .input = \\fn foo(bar: bool, baz: bool) callconv(.C) void { \\} \\ , .expected = \\fn foo(bar: bool, baz: bool) callconv(.C) void { \\ _ = baz; // XXX ZLOPPY unused var baz \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , }, .{ .input = \\fn foo() usize { \\ const bar = 42; \\ return bar; \\} \\ , .expected = \\fn foo() usize { \\ const bar = 42; \\ return bar; \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = 42; \\ if (bar == 0) {} \\} \\ , .expected = \\fn foo() void { \\ const bar = 42; \\ if (bar == 0) {} \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = 42; \\ if (true) { \\ _ = bar; \\ } \\} \\ , .expected = \\fn foo() void { \\ const bar = 42; \\ if (true) { \\ _ = bar; \\ } \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ const baz = if (bar) 1 else 0; \\ _ = baz; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ const baz = if (bar) 1 else 0; \\ _ = baz; \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = 42; \\ const baz = [1]usize{bar}; \\} \\ , .expected = \\fn foo() void { \\ const bar = 42; \\ const baz = [1]usize{bar}; \\ _ = baz; // XXX ZLOPPY unused var baz \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = 42; \\ const baz = [_]usize{ 1, 2, 3, bar }; \\} \\ , .expected = \\fn foo() void { \\ const bar = 42; \\ const baz = [_]usize{ 1, 2, 3, bar }; \\ _ = baz; // XXX ZLOPPY unused var baz \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = [_]usize{ 1, 2, 3, 4 }; \\ for (bar) |quux| { \\ _ = quux; \\ } \\} \\ , .expected = \\fn foo() void { \\ const bar = [_]usize{ 1, 2, 3, 4 }; \\ for (bar) |quux| { \\ _ = quux; \\ } \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar = [_]usize{ 1, 2, 3, 4 }; \\ for (bar) |quux| { \\ } \\} \\ , .expected = \\fn foo() void { \\ const bar = [_]usize{ 1, 2, 3, 4 }; \\ for (bar) |quux| { \\ _ = quux; // XXX ZLOPPY unused var quux \\ } \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ switch (bar) {} \\} \\ , .expected = \\fn foo(bar: bool) void { \\ switch (bar) {} \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ switch (42) { \\ else => { \\ _ = bar; \\ }, \\ } \\} \\ , .expected = \\fn foo(bar: bool) void { \\ switch (42) { \\ else => { \\ _ = bar; \\ }, \\ } \\} \\ , }, .{ .input = \\fn foo() void { \\ const bar: union(enum) { val: bool } = .{ .val = true }; \\ switch (bar) { \\ .val => |quux| { \\ }, \\ } \\} \\ , .expected = \\fn foo() void { \\ const bar: union(enum) { val: bool } = .{ .val = true }; \\ switch (bar) { \\ .val => |quux| { \\ _ = quux; // XXX ZLOPPY unused var quux \\ }, \\ } \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ while (bar) {} \\} \\ , .expected = \\fn foo(bar: bool) void { \\ while (bar) {} \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ while (true) { \\ _ = bar; \\ } \\} \\ , .expected = \\fn foo(bar: bool) void { \\ while (true) { \\ _ = bar; \\ } \\} \\ , }, .{ .input = \\fn foo(bar: u8) void { \\ while (bar < 16) : (bar += 1) {} \\} \\ , .expected = \\fn foo(bar: u8) void { \\ while (bar < 16) : (bar += 1) {} \\} \\ , }, .{ .input = \\fn foo(bar: ?bool) void { \\ while (bar) |quux| { \\ } \\} \\ , .expected = \\fn foo(bar: ?bool) void { \\ while (bar) |quux| { \\ _ = quux; // XXX ZLOPPY unused var quux \\ } \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ while (true) { \\ _ = bar; \\ } else {} \\} \\ , .expected = \\fn foo(bar: bool) void { \\ while (true) { \\ _ = bar; \\ } else {} \\} \\ , }, .{ .input = \\fn foo(bar: usize) void { \\ const quux = [_]u32{ 0, 1, 2, 3, 4 }; \\ _ = quux[bar..]; \\} \\ , .expected = \\fn foo(bar: usize) void { \\ const quux = [_]u32{ 0, 1, 2, 3, 4 }; \\ _ = quux[bar..]; \\} \\ , }, .{ .input = \\fn foo(bar: usize) void { \\ const quux = [_]u32{ 0, 1, 2, 3, 4 }; \\ _ = quux[bar..3]; \\} \\ , .expected = \\fn foo(bar: usize) void { \\ const quux = [_]u32{ 0, 1, 2, 3, 4 }; \\ _ = quux[bar..3]; \\} \\ , }, .{ .input = \\fn foo(bar: usize) void { \\ const quux = [_]u32{ 0, 1, 2, 3, 4 }; \\ _ = quux[bar..3 :0]; \\} \\ , .expected = \\fn foo(bar: usize) void { \\ const quux = [_]u32{ 0, 1, 2, 3, 4 }; \\ _ = quux[bar..3 :0]; \\} \\ , }, .{ .input = \\fn foo(comptime bar: usize) type { \\ return struct { \\ quux: [bar]u32, \\ }; \\} \\ , .expected = \\fn foo(comptime bar: usize) type { \\ return struct { \\ quux: [bar]u32, \\ }; \\} \\ , }, .{ .input = \\fn foo() type { \\ return struct { \\ const bar = 42; \\ quux: bool = true, \\ }; \\} \\ , .expected = \\fn foo() type { \\ return struct { \\ const bar = 42; \\ quux: bool = true, \\ }; \\} \\ , }, .{ .input = \\fn foo() void { \\ return; \\} \\ , .expected = \\fn foo() void { \\ return; \\} \\ , }, .{ .input = \\fn foo() void { \\ return; \\ _ = 42; \\} \\ , .expected = \\fn foo() void { \\ return; \\ //_ = 42; // XXX ZLOPPY unreachable code \\} \\ , }, .{ .input = \\fn foo() void { \\ return; \\ // some comment \\ _ = 42; \\} \\ , .expected = \\fn foo() void { \\ return; \\ // some comment \\ //_ = 42; // XXX ZLOPPY unreachable code \\} \\ , }, .{ .input = \\fn foo() void { \\ return; \\ _ = 42; \\ while (true) { \\ // some comment \\ _ = true; \\ } \\} \\ , .expected = \\fn foo() void { \\ return; \\ //_ = 42; // XXX ZLOPPY unreachable code \\ //while (true) { // XXX ZLOPPY unreachable code \\ //// some comment // XXX ZLOPPY unreachable code \\ //_ = true; // XXX ZLOPPY unreachable code \\ //} // XXX ZLOPPY unreachable code \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ return; \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\ return; \\ //_ = bar; // XXX ZLOPPY unreachable code \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\ //_ = bar; // XXX ZLOPPY unreachable code \\} \\ , .expected = \\fn foo(bar: bool) void { \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ if (true) \\ return; \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ if (true) \\ return; \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ if (true) { \\ return; \\ } \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ if (true) { \\ return; \\ } \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ while (true) \\ return; \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ while (true) \\ return; \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ for ([_]u8{ 1, 2, 3 }) |baz| \\ _ = 42; \\ _ = bar; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ for ([_]u8{ 1, 2, 3 }) |baz| { \\ _ = baz; // XXX ZLOPPY unused var baz \\ _ = 42; \\ } \\ _ = bar; \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ switch (bar) { \\ .foo, .bar => return, \\ .baz => {}, \\ } \\} \\ , .expected = \\fn foo(bar: bool) void { \\ switch (bar) { \\ .foo, .bar => return, \\ .baz => {}, \\ } \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ { \\ _ = 42; \\ } \\ const baz = 0; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\ { \\ _ = 42; \\ } \\ const baz = 0; \\ _ = baz; // XXX ZLOPPY unused var baz \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ { \\ _ = 42; \\ } \\ return; \\ _ = "unreachable"; \\} \\ , .expected = \\fn foo(bar: bool) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\ { \\ _ = 42; \\ } \\ return; \\ //_ = "unreachable"; // XXX ZLOPPY unreachable code \\} \\ , }, .{ .input = \\fn foo() void { \\ { \\ return; \\ //_ = "unreachable"; // XXX ZLOPPY unreachable code \\ } \\ const bar = "unused"; \\} \\ \\fn bar(quux: bool) void {} \\ , .expected = \\fn foo() void { \\ { \\ return; \\ //_ = "unreachable"; // XXX ZLOPPY unreachable code \\ } \\ const bar = "unused"; \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ \\fn bar(quux: bool) void { \\ _ = quux; // XXX ZLOPPY unused var quux \\} \\ , }, .{ .input = \\fn foo() void { \\ _ = 42 orelse return; \\ _ = "reachable code"; \\} \\ , .expected = \\fn foo() void { \\ _ = 42 orelse return; \\ _ = "reachable code"; \\} \\ , }, .{ .input = \\fn foo() void { \\ _ = 42 catch return; \\ _ = "reachable code"; \\} \\ , .expected = \\fn foo() void { \\ _ = 42 catch return; \\ _ = "reachable code"; \\} \\ , }, .{ .input = \\fn foo(_: bool) void {} \\ , .expected = \\fn foo(_: bool) void {} \\ , }, .{ .input = \\fn foo(comptime Bar: type) void { \\ const quux: std.ArrayList(Bar) = undefined; \\} \\ , .expected = \\fn foo(comptime Bar: type) void { \\ const quux: std.ArrayList(Bar) = undefined; \\ _ = quux; // XXX ZLOPPY unused var quux \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ comptime { \\ _ = bar; \\ } \\} \\ , .expected = \\fn foo(bar: bool) void { \\ comptime { \\ _ = bar; \\ } \\} \\ , }, .{ .input = \\fn foo(bar: bool) void { \\ nosuspend { \\ _ = bar; \\ } \\} \\ , .expected = \\fn foo(bar: bool) void { \\ nosuspend { \\ _ = bar; \\ } \\} \\ , }, .{ .input = \\fn foo(bar: u8) void { \\ var res: u8 = undefined; \\ @mulWithOverflow(u8, bar, 8, &res); \\} \\ , .expected = \\fn foo(bar: u8) void { \\ var res: u8 = undefined; \\ @mulWithOverflow(u8, bar, 8, &res); \\} \\ , }, .{ .input = \\fn foo(comptime T: type, bar: T) void { \\} \\ , .expected = \\fn foo(comptime T: type, bar: T) void { \\ _ = bar; // XXX ZLOPPY unused var bar \\} \\ , }, .{ .input = \\fn drc(comptime second: bool, comptime rc: u8, t: BlockVec, tx: BlockVec) BlockVec { \\ var s: BlockVec = undefined; \\ var ts: BlockVec = undefined; \\ return asm ( \\ \\ vaeskeygenassist %[rc], %[t], %[s] \\ \\ vpslldq $4, %[tx], %[ts] \\ \\ vpxor %[ts], %[tx], %[r] \\ \\ vpslldq $8, %[r], %[ts] \\ \\ vpxor %[ts], %[r], %[r] \\ \\ vpshufd %[mask], %[s], %[ts] \\ \\ vpxor %[ts], %[r], %[r] \\ : [r] "=&x" (-> BlockVec), \\ [s] "=&x" (s), \\ [ts] "=&x" (ts), \\ : [rc] "n" (rc), \\ [t] "x" (t), \\ [tx] "x" (tx), \\ [mask] "n" (@as(u8, if (second) 0xaa else 0xff)), \\ ); \\} \\ , .expected = \\fn drc(comptime second: bool, comptime rc: u8, t: BlockVec, tx: BlockVec) BlockVec { \\ var s: BlockVec = undefined; \\ var ts: BlockVec = undefined; \\ return asm ( \\ \\ vaeskeygenassist %[rc], %[t], %[s] \\ \\ vpslldq $4, %[tx], %[ts] \\ \\ vpxor %[ts], %[tx], %[r] \\ \\ vpslldq $8, %[r], %[ts] \\ \\ vpxor %[ts], %[r], %[r] \\ \\ vpshufd %[mask], %[s], %[ts] \\ \\ vpxor %[ts], %[r], %[r] \\ : [r] "=&x" (-> BlockVec), \\ [s] "=&x" (s), \\ [ts] "=&x" (ts), \\ : [rc] "n" (rc), \\ [t] "x" (t), \\ [tx] "x" (tx), \\ [mask] "n" (@as(u8, if (second) 0xaa else 0xff)), \\ ); \\} \\ , }, .{ .input = \\fn foo(comptime T: type) error.OutOfMemory!T {} \\ , .expected = \\fn foo(comptime T: type) error.OutOfMemory!T {} \\ , }, .{ .input = \\fn Foo(comptime T: type) type { \\ return struct { \\ pub usingnamespace T; \\ }; \\} \\ , .expected = \\fn Foo(comptime T: type) type { \\ return struct { \\ pub usingnamespace T; \\ }; \\} \\ , }, .{ .input = \\fn foo(comptime s: u8) [4:s]u8 {} \\ , .expected = \\fn foo(comptime s: u8) [4:s]u8 {} \\ , }, .{ .input = \\fn foo(comptime s: u8) [:s]align(42) u8 {} \\ , .expected = \\fn foo(comptime s: u8) [:s]align(42) u8 {} \\ , }, .{ .input = \\fn foo() void { \\ for ([_]u8{ 1, 2, 3 }) |i| { \\ continue; \\ _ = i; \\ } \\} \\ , .expected = \\fn foo() void { \\ for ([_]u8{ 1, 2, 3 }) |i| { \\ _ = i; // XXX ZLOPPY unused var i \\ continue; \\ //_ = i; // XXX ZLOPPY unreachable code \\ } \\} \\ , }, .{ .input = \\fn foo() void { \\ for ([_]u8{ 1, 2, 3 }) |i| { \\ break; \\ _ = i; \\ } \\} \\ , .expected = \\fn foo() void { \\ for ([_]u8{ 1, 2, 3 }) |i| { \\ _ = i; // XXX ZLOPPY unused var i \\ break; \\ //_ = i; // XXX ZLOPPY unreachable code \\ } \\} \\ , }, }; // zig fmt: on fn applyOn(input: [:0]u8, expected: []const u8) ![]u8 { _ = try zloppy.cleanSource("<test input>", input); var tree = try std.zig.parse(std.testing.allocator, input); defer tree.deinit(std.testing.allocator); try std.testing.expect(tree.errors.len == 0); var patches = try zloppy.genPatches(std.testing.allocator, tree); defer patches.deinit(); var out_buffer = std.ArrayList(u8).init(std.testing.allocator); defer out_buffer.deinit(); try @import("render.zig").renderTreeWithPatches(&out_buffer, tree, &patches); try std.testing.expectEqualStrings(expected, out_buffer.items); try out_buffer.append(0); return out_buffer.toOwnedSlice(); } fn applyOff(input: [:0]u8, expected: []const u8) ![]u8 { _ = try zloppy.cleanSource("<test input>", input); var tree = try std.zig.parse(std.testing.allocator, input); defer tree.deinit(std.testing.allocator); try std.testing.expect(tree.errors.len == 0); var out_buffer = std.ArrayList(u8).init(std.testing.allocator); defer out_buffer.deinit(); try tree.renderToArrayList(&out_buffer); try std.testing.expectEqualStrings(expected, out_buffer.items); try out_buffer.append(0); return out_buffer.toOwnedSlice(); } fn applyFn(fun: anytype, count: u8, input: [:0]const u8, expected: [:0]const u8) !void { var last_output = try std.testing.allocator.dupe(u8, input[0 .. input.len + 1]); var i: u8 = 0; while (i < count) : (i += 1) { var output = try fun(last_output[0 .. last_output.len - 1 :0], expected); std.testing.allocator.free(last_output); last_output = output; } std.testing.allocator.free(last_output); } test "zloppy off" { for (test_cases_off) |t| { try applyFn(applyOff, 2, t.input, t.expected); } } test "zloppy on" { for (test_cases_on) |t| { try applyFn(applyOn, 2, t.input, t.expected); } } const TestCase = struct { input: [:0]const u8, expected: [:0]const u8, };
src/test.zig
const std = @import("std"); const expect = std.testing.expect; const test_allocator = std.testing.allocator; const Allocator = std.mem.Allocator; const Point = struct { const Self = @This(); x: u64, y: u64, pub fn parse(str: []const u8) !Self { var numIter = std.mem.tokenize(u8, str, ","); const x = try std.fmt.parseInt(u64, numIter.next().?, 10); const y = try std.fmt.parseInt(u64, numIter.next().?, 10); return Self{ .x = x, .y = y }; } }; const Map = struct { const Self = @This(); allocator: Allocator, map: std.AutoHashMap(u64, u64), pub fn load(allocator: Allocator, str: []const u8, diagonals: bool) !Self { var map = std.AutoHashMap(u64, u64).init(allocator); var iter = std.mem.split(u8, str, "\n"); while (iter.next()) |line| { if (line.len != 0) { var pointIter = std.mem.split(u8, line, " -> "); var p1 = try Point.parse(pointIter.next().?); var p2 = try Point.parse(pointIter.next().?); if (p1.x == p2.x) { try insertVertical(&map, p1, p2); } else if (p1.y == p2.y) { try insertHorizontal(&map, p1, p2); } else if (diagonals) { var left = p1; var right = p2; if (p2.x < p1.x) { left = p2; right = p1; } if (left.y < right.y) { try insertDownDiagonal(&map, left, right); } else { try insertUpDiagonal(&map, left, right); } } } } return Self{ .allocator = allocator, .map = map }; } pub fn deinit(self: *Self) void { self.map.deinit(); } fn insertPoint(map: *std.AutoHashMap(u64, u64), p: u64) !void { var curr = map.get(p) orelse 0; try map.put(p, curr + 1); } fn insertUpDiagonal(map: *std.AutoHashMap(u64, u64), p1: Point, p2: Point) anyerror!void { var y = p1.y; var x = p1.x; while (x <= p2.x) { try insertPoint(map, offset(y, x)); x += 1; if (y > 0) { y -= 1; } } } fn insertDownDiagonal(map: *std.AutoHashMap(u64, u64), p1: Point, p2: Point) anyerror!void { var y = p1.y; var x = p1.x; while (x <= p2.x) { try insertPoint(map, offset(y, x)); x += 1; y += 1; } } fn insertHorizontal(map: *std.AutoHashMap(u64, u64), p1: Point, p2: Point) anyerror!void { if (p1.x > p2.x) { try insertHorizontal(map, p2, p1); return; } const y = p1.y; var x = p1.x; while (x <= p2.x) : (x += 1) { try insertPoint(map, offset(y, x)); } } fn insertVertical(map: *std.AutoHashMap(u64, u64), p1: Point, p2: Point) anyerror!void { if (p1.y > p2.y) { try insertVertical(map, p2, p1); return; } const x = p1.x; var y = p1.y; while (y <= p2.y) : (y += 1) { try insertPoint(map, offset(y, x)); } } pub fn twoOverlaps(self: *Self) !u64 { var total: u64 = 0; var iterator = self.map.iterator(); while (iterator.next()) |entry| { if (entry.value_ptr.* >= 2) { total += 1; } } return total; } fn offset(colIdx: u64, rowIdx: u64) u64 { return ((rowIdx * 1000) + colIdx); } }; pub fn main() anyerror!void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); const str = @embedFile("../input.txt"); var m = try Map.load(allocator, str, false); defer m.deinit(); const stdout = std.io.getStdOut().writer(); const part1 = try m.twoOverlaps(); try stdout.print("Part 1: {d}\n", .{part1}); var m2 = try Map.load(allocator, str, true); defer m2.deinit(); const part2 = try m2.twoOverlaps(); try stdout.print("Part 2: {d}\n", .{part2}); } test "part1 test" { const str = @embedFile("../test.txt"); var m = try Map.load(test_allocator, str, false); defer m.deinit(); const score = try m.twoOverlaps(); try expect(5 == score); } test "part2 test" { const str = @embedFile("../test.txt"); var m = try Map.load(test_allocator, str, true); defer m.deinit(); const score = try m.twoOverlaps(); try expect(12 == score); }
day05/src/main.zig
pub const std = @import("std"); pub const math = @import("../math/math.zig"); pub const sdf = @import("sdf.zig"); pub const SdfInfo = @import("sdf_info.zig").SdfInfo; pub const IterationContext = @import("iteration_context.zig").IterationContext; pub const EnterInfo = IterationContext.EnterInfo; pub fn combinatorExitCommand(comptime command: []const u8, enter_stack: usize, enter_index: usize, ctxt: *IterationContext) []const u8 { const define_command: []const u8 = "float " ++ command; const add_command: []const u8 = "{s}\n" ++ command; const broken_stack: []const u8 = "float d{d} = 1e10;"; var res: []const u8 = undefined; if (enter_stack + 1 >= ctxt.value_indexes.items.len) { res = std.fmt.allocPrint(ctxt.allocator, broken_stack, .{enter_index}) catch unreachable; } else if (enter_stack + 2 >= ctxt.value_indexes.items.len) { res = std.fmt.allocPrint(ctxt.allocator, "float d{d} = d{d};", .{ enter_index, ctxt.value_indexes.items[enter_stack + 1].index }) catch unreachable; } else { res = std.fmt.allocPrint(ctxt.allocator, define_command, .{ enter_index, ctxt.value_indexes.items[enter_stack + 1].index, ctxt.value_indexes.items[enter_stack + 2].index, }) catch unreachable; for (ctxt.value_indexes.items[enter_stack + 3 ..]) |item| { var temp: []const u8 = std.fmt.allocPrint(ctxt.allocator, add_command, .{ res, enter_index, enter_index, item.index, }) catch unreachable; ctxt.allocator.free(res); res = temp; } } return res; } pub fn smoothCombinatorExitCommand(comptime command: []const u8, enter_stack: usize, enter_index: usize, ctxt: *IterationContext, smoothness: f32) []const u8 { const define_command: []const u8 = "float " ++ command; const add_command: []const u8 = "{s}\n" ++ command; const broken_stack: []const u8 = "float d{d} = 1e10;"; var res: []const u8 = undefined; if (enter_stack + 2 >= ctxt.value_indexes.items.len) { res = std.fmt.allocPrint(ctxt.allocator, broken_stack, .{enter_index}) catch unreachable; } else { res = std.fmt.allocPrint(ctxt.allocator, define_command, .{ enter_index, ctxt.value_indexes.items[enter_stack + 1].index, ctxt.value_indexes.items[enter_stack + 2].index, smoothness, }) catch unreachable; for (ctxt.value_indexes.items[enter_stack + 3 ..]) |item| { var temp: []const u8 = std.fmt.allocPrint(ctxt.allocator, add_command, .{ res, enter_index, enter_index, item.index, smoothness, }) catch unreachable; ctxt.allocator.free(res); res = temp; } } return res; } pub fn surfaceEnterCommand(comptime DataT: type) sdf.EnterCommandFn { const s = struct { fn f(ctxt: *IterationContext, iter: usize, mat_offset: usize, buffer: *[]u8) []const u8 { const data: *DataT = @ptrCast(*DataT, @alignCast(@alignOf(DataT), buffer.ptr)); ctxt.pushEnterInfo(iter); ctxt.pushStackInfo(iter, @intCast(i32, data.mat + mat_offset)); return std.fmt.allocPrint(ctxt.allocator, "", .{}) catch unreachable; } }; return s.f; } pub fn surfaceExitCommand( comptime DataT: type, exitCommandFn: fn (data: *DataT, enter_index: usize, cur_point_name: []const u8, allocator: std.mem.Allocator) []const u8, ) sdf.ExitCommandFn { const s = struct { fn f(ctxt: *IterationContext, iter: usize, buffer: *[]u8) []const u8 { _ = iter; const data: *DataT = @ptrCast(*DataT, @alignCast(@alignOf(DataT), buffer.ptr)); const ei: EnterInfo = ctxt.lastEnterInfo(); const res: []const u8 = exitCommandFn(data, ei.enter_index, ctxt.cur_point_name, ctxt.allocator); ctxt.dropPreviousValueIndexes(ei.enter_stack); return res; } }; return s.f; } pub fn surfaceMatCheckCommand(comptime DataT: type) sdf.AppendMatCheckFn { const s = struct { fn f(ctxt: *IterationContext, exit_command: []const u8, buffer: *[]u8, mat_offset: usize, allocator: std.mem.Allocator) []const u8 { const data: *DataT = @ptrCast(*DataT, @alignCast(@alignOf(DataT), buffer.ptr)); const ei: EnterInfo = ctxt.popEnterInfo(); const formatMat: []const u8 = "{s}if(d{d}<MAP_EPS)return matToColor({d}.,l,n,v);"; return std.fmt.allocPrint(allocator, formatMat, .{ exit_command, ei.enter_index, data.mat + mat_offset, }) catch unreachable; } }; return s.f; }
src/sdf/sdf_util.zig
//-------------------------------------------------------------------------------- // Section: Types (1) //-------------------------------------------------------------------------------- pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE = enum(u32) { NEAREST_NEIGHBOR = 0, LINEAR = 1, CUBIC = 2, MULTI_SAMPLE_LINEAR = 3, ANISOTROPIC = 4, HIGH_QUALITY_CUBIC = 5, FORCE_DWORD = 4294967295, }; pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_NEAREST_NEIGHBOR = D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE.NEAREST_NEIGHBOR; pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_LINEAR = D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE.LINEAR; pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_CUBIC = D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE.CUBIC; pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR = D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE.MULTI_SAMPLE_LINEAR; pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_ANISOTROPIC = D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE.ANISOTROPIC; pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE.HIGH_QUALITY_CUBIC; pub const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE_FORCE_DWORD = D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE.FORCE_DWORD; //-------------------------------------------------------------------------------- // 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 (0) //-------------------------------------------------------------------------------- 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; } } } //-------------------------------------------------------------------------------- // Section: SubModules (20) //-------------------------------------------------------------------------------- pub const composition_swapchain = @import("graphics/composition_swapchain.zig"); pub const direct2d = @import("graphics/direct2d.zig"); pub const direct3d = @import("graphics/direct3d.zig"); pub const direct3d10 = @import("graphics/direct3d10.zig"); pub const direct3d11 = @import("graphics/direct3d11.zig"); pub const direct3d11on12 = @import("graphics/direct3d11on12.zig"); pub const direct3d12 = @import("graphics/direct3d12.zig"); pub const direct3d9 = @import("graphics/direct3d9.zig"); pub const direct_composition = @import("graphics/direct_composition.zig"); pub const direct_draw = @import("graphics/direct_draw.zig"); pub const direct_manipulation = @import("graphics/direct_manipulation.zig"); pub const direct_write = @import("graphics/direct_write.zig"); pub const dwm = @import("graphics/dwm.zig"); pub const dxcore = @import("graphics/dxcore.zig"); pub const dxgi = @import("graphics/dxgi.zig"); pub const gdi = @import("graphics/gdi.zig"); pub const hlsl = @import("graphics/hlsl.zig"); pub const imaging = @import("graphics/imaging.zig"); pub const open_gl = @import("graphics/open_gl.zig"); pub const printing = @import("graphics/printing.zig");
win32/graphics.zig
const std = @import("std"); const ArrayList = std.ArrayList; const Allocator = std.mem.Allocator; /// Chart building block characters const Font = struct { blankspace: u8, horizontal: []const u8, vertical: []const u8, top_left: []const u8, mid_left: []const u8, low_left: []const u8, top_center: []const u8, mid_center: []const u8, low_center: []const u8, top_right: []const u8, mid_right: []const u8, low_right: []const u8 }; /// The basic chart font const BASE_FONT = Font { .blankspace = ' ', .horizontal = "─", .vertical = "│", .top_left = "┌", .mid_left = "├", .low_left = "└", .top_center = "┬", .mid_center = "┼", .low_center = "┴", .top_right = "┐", .mid_right = "┤", .low_right = "┘" }; /// Bold chart font const BOLD_FONT = Font { .blankspace = ' ', .horizontal = "━", .vertical = "┃", .top_left = "┏", .mid_left = "┡", .low_left = "┗", .top_center = "┳", .mid_center = "╇", .low_center = "┻", .top_right = "┓", .mid_right = "┩", .low_right = "┛" }; pub fn genChart(allocator: *const Allocator, input: *[][][]const u8, widths: *[]const u8, include_header: bool) ![]const u8 { var output = ArrayList(u8).init(allocator.*); // Capacity: widths.*.len * input.*[0].len try genTop(widths, include_header, &output); try output.append('\n'); for (input.*) |in, i| { try genRow(&in, widths, i == 0 and include_header, &output); try output.append('\n'); if (i != input.len - 1) { try genSeparator(widths, i == 0 and include_header, &output); try output.append('\n'); } } try genBottom(widths, include_header and input.len == 0, &output); try output.append('\n'); return output.toOwnedSlice(); } fn genTop(widths: *[]const u8, bold: bool, output: *ArrayList(u8)) !void { const font = if (bold) BOLD_FONT else BASE_FONT; // Create the row try output.appendSlice(font.top_left); for (widths.*) |col| { var i: usize = 0; while (i < col) { try output.appendSlice(font.horizontal); i += 1; } try output.appendSlice(font.top_center); } _ = output.shrinkAndFree(output.items.len - font.top_center.len); try output.appendSlice(font.top_right); } fn genBottom(widths: *[]const u8, bold: bool, output: *ArrayList(u8)) !void { const font = if (bold) BOLD_FONT else BASE_FONT; // Create the row try output.appendSlice(font.low_left); for (widths.*) |col| { var i: usize = 0; while (i < col) { try output.appendSlice(font.horizontal); i += 1; } try output.appendSlice(font.low_center); } _ = output.shrinkAndFree(output.items.len - font.low_center.len); try output.appendSlice(font.low_right); } fn genSeparator(widths: *[]const u8, bold: bool, output: *ArrayList(u8)) !void { const font = if (bold) BOLD_FONT else BASE_FONT; // Create the row try output.appendSlice(font.mid_left); for (widths.*) |col| { var i: usize = 0; while (i < col) { try output.appendSlice(font.horizontal); i += 1; } try output.appendSlice(font.mid_center); } _ = output.shrinkAndFree(output.items.len - font.mid_center.len); try output.appendSlice(font.mid_right); } fn genRow(input: *const [][]const u8, widths: *[]const u8, bold: bool, output: *ArrayList(u8)) !void { const EMPTY: []const u8 = ""; const font = if (bold) BOLD_FONT else BASE_FONT; // Create the row try output.appendSlice(font.vertical); for (widths.*) |_, i| { try genCell(if (i < input.*.len) &input.*[i] else &EMPTY, widths.*[i], output); try output.appendSlice(font.vertical); } _ = output.shrinkAndFree(output.items.len - font.vertical.len); try output.appendSlice(font.vertical); } fn genCell(input: *const []const u8, col: usize, output: *ArrayList(u8)) !void { const pads = col - input.len; const half_pads = pads / 2; var i: usize = 0; while (i < half_pads) { try output.append(BASE_FONT.blankspace); i += 1; } i = 0; try output.appendSlice(input.*); while (i < (half_pads + (pads % 2)) ) { try output.append(BASE_FONT.blankspace); i += 1; } }
src-zig/chart.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const fmt = std.fmt; const testing = std.testing; const heap = std.heap; const meta = std.meta; const ArrayList = std.ArrayList; pub const Request = struct { const Self = @This(); request_line: RequestLine, headers: ArrayList(Header), body: []const u8, request_text: []const u8, allocator: *mem.Allocator, /// The caller is responsible for calling `result.deinit()`, which frees all the allocated /// structures. pub fn fromSlice(allocator: *mem.Allocator, slice: []const u8) !Self { var request_text = try allocator.dupe(u8, slice); errdefer allocator.free(request_text); var it = mem.split(request_text, "\n"); const request_line_slice = it.next() orelse unreachable; const request_line = try RequestLine.fromSlice(allocator, request_line_slice); var header_list = ArrayList(Header).init(allocator); errdefer header_list.deinit(); var line = it.next(); while (line != null and !mem.eql(u8, line.?, "\r")) : (line = it.next()) { try header_list.append(try Header.fromSlice(line.?)); } const body = it.rest(); return Self{ .request_line = request_line, .headers = header_list, .body = body, .allocator = allocator, .request_text = request_text, }; } pub fn deinit(self: Self) void { self.allocator.free(self.body); self.headers.deinit(); self.allocator.free(request_text); } }; pub const RequestLine = struct { const Self = @This(); method: Method, resource: []const u8, version: Version, pub fn fromSlice(allocator: *mem.Allocator, slice: []const u8) !Self { var it = mem.split(mem.trimRight(u8, slice, "\r\n"), " "); const maybe_method_slice = it.next(); if (maybe_method_slice == null) return error.NoMethodGiven; const method = try Method.fromSlice(maybe_method_slice.?); const maybe_resource_slice = it.next(); if (maybe_resource_slice == null) return error.NoResourceGiven; const resource_slice = maybe_resource_slice.?; const resource = mem.trim(u8, try allocator.dupe(u8, resource_slice), "/"); const maybe_version_slice = it.next(); if (maybe_version_slice == null) return error.NoVersionGiven; const version = try Version.fromSlice(maybe_version_slice.?); return Self{ .method = method, .resource = resource, .version = version, }; } }; pub const Header = union(enum) { const Self = @This(); accept_encoding: []const u8, access_control_allow_credentials: bool, access_control_allow_headers: []const u8, access_control_allow_methods: []const u8, access_control_allow_origin: []const u8, access_control_max_age: u64, access_control_request_method: Method, cache_control: CacheControl, connection: ConnectionStatus, content_size: usize, cookie: []const u8, cross_origin_resource_policy: CrossOriginResourcePolicy, device_memory: f32, early_data: u32, etag: ETag, host: []const u8, origin: ?Origin, referrer: []const u8, upgrade_insecure_requests: u32, user_agent: []const u8, if_none_match: []const u8, // I want to have something better here, ideally a slice of slices but I can't very well // construct an array and return a slice to it in the parsing as it'll go out of scope. // I need to come up with something neat here. x_forwarded_for: []const u8, unknown: void, pub fn fromSlice(slice: []const u8) !Header { var maybe_colon_index = mem.indexOf(u8, slice, ":"); if (maybe_colon_index) |colon_index| { var name_buffer: [2048]u8 = undefined; var header_name = name_buffer[0..colon_index]; _ = lowerCase(slice[0..colon_index], header_name); const header_value = mem.trim(u8, slice[(colon_index + 1)..], " \r\n"); if (mem.eql(u8, header_name, "content-size")) { const content_size = try fmt.parseUnsigned(usize, header_value, 10); return Header{ .content_size = content_size }; } else if (mem.eql(u8, header_name, "accept-encoding")) { const encodings = header_value; return Header{ .accept_encoding = encodings }; } else if (mem.eql(u8, header_name, "connection")) { const connection_status = try ConnectionStatus.fromSlice(header_value); return Header{ .connection = connection_status }; } else if (mem.eql(u8, header_name, "host")) { const host = header_value; return Header{ .host = host }; } else if (mem.eql(u8, header_name, "user-agent")) { const user_agent = header_value; return Header{ .user_agent = user_agent }; } else if (mem.eql(u8, header_name, "cache-control")) { const cache_control = try CacheControl.fromSlice(header_value); return Header{ .cache_control = cache_control }; } else if (mem.eql(u8, header_name, "etag")) { const etag = try ETag.fromSlice(header_value); return Header{ .etag = etag }; } else if (mem.eql(u8, header_name, "if-none-match")) { const if_none_match = header_value; return Header{ .if_none_match = if_none_match }; } else if (mem.eql(u8, header_name, "referer")) { const referrer = header_value; return Header{ .referrer = referrer }; } else if (mem.eql(u8, header_name, "x-forwarded-for")) { const forwards = header_value; return Header{ .x_forwarded_for = forwards }; } else if (mem.eql(u8, header_name, "access-control-max-age")) { const max_age = try fmt.parseUnsigned(u64, header_value, 10); return Header{ .access_control_max_age = max_age }; } else if (mem.eql(u8, header_name, "device-memory")) { const memory = try fmt.parseFloat(f32, header_value); return Header{ .device_memory = memory }; } else if (mem.eql(u8, header_name, "cross-origin-resource-policy")) { const resource_policy = try CrossOriginResourcePolicy.fromSlice(header_value); return Header{ .cross_origin_resource_policy = resource_policy }; } else if (mem.eql(u8, header_name, "access-control-allow-headers")) { const allowed_headers = header_value; return Header{ .access_control_allow_headers = allowed_headers }; } else if (mem.eql(u8, header_name, "access-control-request-method")) { const method = try Method.fromSlice(header_value); return Header{ .access_control_request_method = method }; } else if (mem.eql(u8, header_name, "access-control-allow-methods")) { const methods = header_value; return Header{ .access_control_allow_methods = methods }; } else if (mem.eql(u8, header_name, "access-control-allow-origin")) { const origin = header_value; return Header{ .access_control_allow_origin = origin }; } else if (mem.eql(u8, header_name, "cookie")) { const cookie_string = header_value; return Header{ .cookie = cookie_string }; } else if (mem.eql(u8, header_name, "upgrade-insecure-requests")) { const requests = try fmt.parseUnsigned(u32, header_value, 10); return Header{ .upgrade_insecure_requests = requests }; } else if (mem.eql(u8, header_name, "access-control-allow-credentials")) { const allow = if (mem.eql(u8, header_value, "true")) true else if (mem.eql(u8, header_value, "false")) false else return error.UnableToParseAllowCredentials; return Header{ .access_control_allow_credentials = allow }; } else if (mem.eql(u8, header_name, "early-data")) { const early = try fmt.parseUnsigned(u32, header_value, 10); return Header{ .early_data = early }; } else if (mem.eql(u8, header_name, "origin")) { const origin = try Origin.fromSlice(header_value); return Header{ .origin = origin }; } else { return Header.unknown; } } else { return error.UnableToFindHeaderSeparator; } } }; pub const CustomHeader = struct { name: []const u8, value: []const u8, }; pub const ETag = union(enum) { normal: []const u8, weak: []const u8, pub fn fromSlice(slice: []const u8) !ETag { var it = mem.split(slice, "\""); if (it.next()) |part1| { if (mem.eql(u8, part1, "W/")) { if (it.next()) |etag| { return ETag{ .weak = etag }; } else { return error.UnableToParseWeakETagValue; } } else { if (it.next()) |etag| { return ETag{ .normal = etag }; } else { return error.UnableToParseNormalETagValue; } } } return error.UnableToParseETag; } }; pub const CrossOriginResourcePolicy = enum { same_site, same_origin, cross_origin, pub fn fromSlice(slice: []const u8) !CrossOriginResourcePolicy { if (mem.eql(u8, slice, "same-site")) { return .same_site; } else if (mem.eql(u8, slice, "same-origin")) { return .same_origin; } else if (mem.eql(u8, slice, "cross-origin")) { return .cross_origin; } else { return error.UnableToParseCrossOriginResourcePolicy; } } }; pub const CacheControl = union(enum) { no_cache: void, no_store: void, no_transform: void, only_if_cached: void, max_age: u64, max_stale: ?u64, min_fresh: u64, pub fn fromSlice(slice: []const u8) !CacheControl { if (mem.eql(u8, slice, "no-cache")) { return .no_cache; } else if (mem.eql(u8, slice, "no-store")) { return .no_store; } else if (mem.eql(u8, slice, "no-transform")) { return .no_transform; } else if (mem.eql(u8, slice, "only-if-cached")) { return .only_if_cached; } else { if (mem.indexOf(u8, slice, "=")) |equal_index| { // check for things here that require equal const control_type = slice[0..equal_index]; if (mem.eql(u8, control_type, "max-age")) { const trimmed = mem.trim(u8, slice[(equal_index + 1)..], " "); const value = try fmt.parseUnsigned(u64, trimmed, 10); return CacheControl{ .max_age = value }; } else if (mem.eql(u8, control_type, "min-fresh")) { const trimmed = mem.trim(u8, slice[(equal_index + 1)..], " "); const value = try fmt.parseUnsigned(u64, trimmed, 10); return CacheControl{ .min_fresh = value }; } else if (mem.eql(u8, control_type, "max-stale")) { const trimmed = mem.trim(u8, slice[(equal_index + 1)..], " "); const value = try fmt.parseUnsigned(u64, trimmed, 10); return CacheControl{ .max_stale = value }; } } else if (mem.eql(u8, slice, "max-stale")) { return CacheControl{ .max_stale = null }; } else { return error.UnableToParseCacheControlValue; } } return error.UnableToParseCacheControlHeader; } }; pub const Encoding = enum(u8) { gzip, compress, deflate, brotli, identity, anything, pub fn fromSlice(slice: []const u8) !Encoding { if (mem.eql(u8, slice, "gzip")) { return .gzip; } else if (mem.eql(u8, slice, "compress")) { return .compress; } else if (mem.eql(u8, slice, "deflate")) { return .deflate; } else if (mem.eql(u8, slice, "br")) { return .brotli; } else if (mem.eql(u8, slice, "identity")) { return .identity; } else if (mem.eql(u8, slice, "*")) { return .anything; } else { return error.UnableToParseDecoding; } } }; pub const Origin = struct { scheme: Scheme, hostname: []const u8, port: ?u16, pub fn fromSlice(slice: []const u8) !?Origin { if (mem.eql(u8, slice, "null")) { return null; } else if (mem.indexOf(u8, slice, "://")) |scheme_delimiter_index| { const scheme = try Scheme.fromSlice(slice[0..scheme_delimiter_index]); const rest = slice[(scheme_delimiter_index + 3)..]; if (mem.indexOf(u8, rest, ":")) |port_index| { const hostname = rest[0..port_index]; const port = try fmt.parseUnsigned(u16, rest[(port_index + 1)..], 10); return Origin{ .scheme = scheme, .hostname = hostname, .port = port }; } else { const port = null; const hostname = rest[0..]; return Origin{ .scheme = scheme, .hostname = hostname, .port = port }; } } else { return error.UnableToParseOriginScheme; } } }; pub const Scheme = enum(u8) { https, http, pub fn fromSlice(slice: []const u8) !Scheme { if (mem.eql(u8, slice, "https")) { return .https; } else if (mem.eql(u8, slice, "http")) { return .http; } else { return error.UnableToParseScheme; } } }; pub const ConnectionStatus = enum(u8) { close, keep_alive, pub fn fromSlice(slice: []const u8) !ConnectionStatus { if (mem.eql(u8, slice, "close")) { return .close; } else if (mem.eql(u8, slice, "keep-alive")) { return .keep_alive; } else { return error.UnableToParseConnectionStatus; } } }; pub const Method = enum(u8) { get, head, put, post, delete, patch, options, connect, trace, pub fn fromSlice(slice: []const u8) !Method { if (mem.eql(u8, slice, "GET")) return .get; if (mem.eql(u8, slice, "HEAD")) return .head; if (mem.eql(u8, slice, "PUT")) return .put; if (mem.eql(u8, slice, "POST")) return .post; if (mem.eql(u8, slice, "DELETE")) return .delete; if (mem.eql(u8, slice, "PATCH")) return .patch; if (mem.eql(u8, slice, "OPTIONS")) return .options; if (mem.eql(u8, slice, "CONNECT")) return .connect; if (mem.eql(u8, slice, "TRACE")) return .trace; return error.UnableToParseMethod; } pub fn toSlice(self: Method) []const u8 { return switch (self) { .get => "GET", .head => "HEAD", .put => "PUT", .post => "POST", .delete => "DELETE", .patch => "PATCH", .options => "OPTIONS", .connect => "CONNECT", .trace => "TRACE", }; } }; pub const Version = enum(u8) { http11, http10, pub fn fromSlice(slice: []const u8) !Version { if (mem.startsWith(u8, slice, "HTTP/1.1")) return Version.http11 else if (mem.startsWith(u8, slice, "HTTP/1.0")) return Version.http10; debug.print("version slice={}\n", .{slice}); return error.UnableToParseVersion; } }; test "parses basic request lines" { const request_line_string1 = "GET /sub-path/interesting_document.html HTTP/1.1\r\n"; const request_line1 = try RequestLine.fromSlice(request_line_string1[0..]); testing.expectEqual(request_line1.method, .get); testing.expectEqualStrings(request_line1.resourceSlice(), "/sub-path/interesting_document.html"); testing.expectEqual(request_line1.version, .http11); const request_line_string2 = "POST /interesting_document HTTP/1.1\r\n"; const request_line2 = try RequestLine.fromSlice(request_line_string2[0..]); testing.expectEqual(request_line2.method, .post); testing.expectEqualStrings(request_line2.resourceSlice(), "/interesting_document"); testing.expectEqual(request_line2.version, .http11); const request_line_string3 = "HEAD /interesting_document HTTP/1.1\r\n"; const request_line3 = try RequestLine.fromSlice(request_line_string3[0..]); testing.expectEqual(request_line3.method, .head); testing.expectEqualStrings(request_line3.resourceSlice(), "/interesting_document"); testing.expectEqual(request_line3.version, .http11); const request_line_string4 = "PUT / HTTP/1.1\r\n"; const request_line4 = try RequestLine.fromSlice(request_line_string4[0..]); testing.expectEqual(request_line4.method, .put); testing.expectEqualStrings(request_line4.resourceSlice(), "/"); testing.expectEqual(request_line4.version, .http11); const request_line_string5 = "PATCH / HTTP/1.1\r\n"; const request_line5 = try RequestLine.fromSlice(request_line_string5[0..]); testing.expectEqual(request_line5.method, .patch); testing.expectEqualStrings(request_line5.resourceSlice(), "/"); testing.expectEqual(request_line5.version, .http11); const request_line_string6 = "OPTIONS / HTTP/1.1\r\n"; const request_line6 = try RequestLine.fromSlice(request_line_string6[0..]); testing.expectEqual(request_line6.method, .options); testing.expectEqualStrings(request_line6.resourceSlice(), "/"); testing.expectEqual(request_line6.version, .http11); const request_line_string7 = "DELETE / HTTP/1.1\r\n"; const request_line7 = try RequestLine.fromSlice(request_line_string7[0..]); testing.expectEqual(request_line7.method, .delete); testing.expectEqualStrings(request_line7.resourceSlice(), "/"); testing.expectEqual(request_line7.version, .http11); const request_line_string8 = "CONNECT / HTTP/1.1\r\n"; const request_line8 = try RequestLine.fromSlice(request_line_string8[0..]); testing.expectEqual(request_line8.method, .connect); testing.expectEqualStrings(request_line8.resourceSlice(), "/"); testing.expectEqual(request_line8.version, .http11); const request_line_string9 = "TRACE / HTTP/1.1\r\n"; const request_line9 = try RequestLine.fromSlice(request_line_string9[0..]); testing.expectEqual(request_line9.method, .trace); testing.expectEqualStrings(request_line9.resourceSlice(), "/"); testing.expectEqual(request_line9.version, .http11); } test "parses basic headers" { const encodings = "gzip, deflate, br"; const header_string1 = "Accept-Encoding: " ++ encodings ++ "\r\n"; const header1 = try Header.fromSlice(header_string1); testing.expectEqual(meta.activeTag(header1), .accept_encoding); testing.expectEqualStrings(header1.accept_encoding, encodings); const header_string2 = "Content-Size: 1337\r\n"; const header2 = try Header.fromSlice(header_string2); testing.expectEqual(meta.activeTag(header2), .content_size); testing.expectEqual(header2.content_size, 1337); const header_string3 = "Some-Custom-Header: Some-Custom-Value\r\n"; const header3 = try Header.fromSlice(header_string3); testing.expectEqual(meta.activeTag(header3), .custom); testing.expectEqualStrings(header3.custom.name, "some-custom-header"); testing.expectEqualStrings(header3.custom.value, "Some-Custom-Value"); const header_string4 = "Content-Size: 42\r\n"; const header4 = try Header.fromSlice(header_string4); testing.expectEqual(meta.activeTag(header4), .content_size); testing.expectEqual(header4.content_size, 42); const header_string5 = "Connection: keep-alive\r\n"; const header5 = try Header.fromSlice(header_string5); testing.expectEqual(meta.activeTag(header5), .connection); testing.expectEqual(header5.connection, .keep_alive); const header_string6 = "Connection: close\r\n"; const header6 = try Header.fromSlice(header_string6); testing.expectEqual(meta.activeTag(header6), .connection); testing.expectEqual(header6.connection, .close); const header_string7 = "Host: example-host.com\r\n"; const header7 = try Header.fromSlice(header_string7); testing.expectEqual(meta.activeTag(header7), .host); testing.expectEqualStrings(header7.host, "example-host.com"); const user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0"; const header_string8 = "User-Agent: " ++ user_agent ++ "\r\n"; const header8 = try Header.fromSlice(header_string8); testing.expectEqual(meta.activeTag(header8), .user_agent); testing.expectEqualStrings(header8.user_agent, user_agent); const header_string9 = "Cache-Control: max-age= 1337\r\n"; const header9 = try Header.fromSlice(header_string9); testing.expectEqual(meta.activeTag(header9), .cache_control); testing.expectEqual(meta.activeTag(header9.cache_control), .max_age); testing.expectEqual(header9.cache_control.max_age, 1337); const header_string10 = "Cache-Control: min-fresh= 42 \r\n"; const header10 = try Header.fromSlice(header_string10); testing.expectEqual(meta.activeTag(header10), .cache_control); testing.expectEqual(meta.activeTag(header10.cache_control), .min_fresh); testing.expectEqual(header10.cache_control.min_fresh, 42); const header_string11 = "Cache-Control: max-stale= 42 \r\n"; const header11 = try Header.fromSlice(header_string11); testing.expectEqual(meta.activeTag(header11), .cache_control); testing.expectEqual(meta.activeTag(header11.cache_control), .max_stale); testing.expectEqual(header11.cache_control.max_stale, 42); const header_string12 = "Cache-Control: max-stale\r\n"; const header12 = try Header.fromSlice(header_string12); testing.expectEqual(meta.activeTag(header12), .cache_control); testing.expectEqual(meta.activeTag(header12.cache_control), .max_stale); testing.expectEqual(header12.cache_control.max_stale, null); const header_string13 = "Cache-Control: no-cache\r\n"; const header13 = try Header.fromSlice(header_string13); testing.expectEqual(meta.activeTag(header13), .cache_control); testing.expectEqual(meta.activeTag(header13.cache_control), .no_cache); const header_string14 = "Cache-Control: no-transform\r\n"; const header14 = try Header.fromSlice(header_string14); testing.expectEqual(meta.activeTag(header14), .cache_control); testing.expectEqual(meta.activeTag(header14.cache_control), .no_transform); const header_string15 = "Cache-Control: only-if-cached\r\n"; const header15 = try Header.fromSlice(header_string15); testing.expectEqual(meta.activeTag(header15), .cache_control); testing.expectEqual(meta.activeTag(header15.cache_control), .only_if_cached); const header_string16 = "Cache-Control: no-store\r\n"; const header16 = try Header.fromSlice(header_string16); testing.expectEqual(meta.activeTag(header16), .cache_control); testing.expectEqual(meta.activeTag(header16.cache_control), .no_store); const header_string17 = "ETag: \"1234567890\"\r\n"; const header17 = try Header.fromSlice(header_string17); testing.expectEqual(meta.activeTag(header17), .etag); testing.expectEqual(meta.activeTag(header17.etag), .normal); testing.expectEqualStrings(header17.etag.normal, "1234567890"); const header_string18 = "ETag: W/\"1234567890\"\r\n"; const header18 = try Header.fromSlice(header_string18); testing.expectEqual(meta.activeTag(header18), .etag); testing.expectEqual(meta.activeTag(header18.etag), .weak); testing.expectEqualStrings(header18.etag.weak, "1234567890"); const header_string19 = "Referer: https://developer.mozilla.org/testpage.html\r\n"; const header19 = try Header.fromSlice(header_string19); testing.expectEqual(meta.activeTag(header19), .referer); testing.expectEqualStrings(header19.referer, "https://developer.mozilla.org/testpage.html"); const ips = "203.0.113.195, 192.168.127.12, 172.16.31.10"; const header_string20 = "X-Forwarded-For: " ++ ips ++ "\r\n"; const header20 = try Header.fromSlice(header_string20); testing.expectEqual(meta.activeTag(header20), .x_forwarded_for); testing.expectEqualStrings(header20.x_forwarded_for, ips); const header_string21 = "Access-Control-Max-Age: 42\r\n"; const header21 = try Header.fromSlice(header_string21); testing.expectEqual(meta.activeTag(header21), .access_control_max_age); testing.expectEqual(header21.access_control_max_age, 42); const header_string22 = "Device-Memory: 0.25\r\n"; const header22 = try Header.fromSlice(header_string22); testing.expectEqual(meta.activeTag(header22), .device_memory); testing.expectEqual(header22.device_memory, 0.25); const header_string23 = "Cross-Origin-Resource-Policy: same-site\r\n"; const header23 = try Header.fromSlice(header_string23); testing.expectEqual(meta.activeTag(header23), .cross_origin_resource_policy); testing.expectEqual(header23.cross_origin_resource_policy, .same_site); const header_string24 = "Cross-Origin-Resource-Policy: same-origin\r\n"; const header24 = try Header.fromSlice(header_string24); testing.expectEqual(meta.activeTag(header24), .cross_origin_resource_policy); testing.expectEqual(header24.cross_origin_resource_policy, .same_origin); const header_string25 = "Cross-Origin-Resource-Policy: cross-origin\r\n"; const header25 = try Header.fromSlice(header_string25); testing.expectEqual(meta.activeTag(header25), .cross_origin_resource_policy); testing.expectEqual(header25.cross_origin_resource_policy, .cross_origin); const headers = "X-Custom-Header, Upgrade-Insecure-Requests"; const header_string26 = "Access-Control-Allow-Headers: " ++ headers ++ "\r\n"; const header26 = try Header.fromSlice(header_string26); testing.expectEqual(meta.activeTag(header26), .access_control_allow_headers); testing.expectEqualStrings(header26.access_control_allow_headers, headers); const header_string27 = "Access-Control-Request-Method: POST\r\n"; const header27 = try Header.fromSlice(header_string27); testing.expectEqual(meta.activeTag(header27), .access_control_request_method); testing.expectEqual(header27.access_control_request_method, .post); const header_string28 = "Access-Control-Allow-Methods: POST, GET, OPTIONS\r\n"; const header28 = try Header.fromSlice(header_string28); testing.expectEqual(meta.activeTag(header28), .access_control_allow_methods); testing.expectEqualStrings(header28.access_control_allow_methods, "POST, GET, OPTIONS"); const header_string29 = "Access-Control-Allow-Origin: https://developer.mozilla.org\r\n"; const header29 = try Header.fromSlice(header_string29); testing.expectEqual(meta.activeTag(header29), .access_control_allow_origin); testing.expectEqualStrings(header29.access_control_allow_origin, "https://developer.mozilla.org"); const cookies = "PHPSESSID=298zf09hf012fh2; csrftoken=<PASSWORD>; _gat=1"; const header_string30 = "Cookie: " ++ cookies ++ "\r\n"; const header30 = try Header.fromSlice(header_string30); testing.expectEqual(meta.activeTag(header30), .cookie); testing.expectEqualStrings(header30.cookie, cookies); const header_string31 = "Upgrade-Insecure-Requests: 1\r\n"; const header31 = try Header.fromSlice(header_string31); testing.expectEqual(meta.activeTag(header31), .upgrade_insecure_requests); testing.expectEqual(header31.upgrade_insecure_requests, 1); const header_string32 = "Access-Control-Allow-Credentials: true\r\n"; const header32 = try Header.fromSlice(header_string32); testing.expectEqual(meta.activeTag(header32), .access_control_allow_credentials); testing.expectEqual(header32.access_control_allow_credentials, true); const header_string33 = "Access-Control-Allow-Credentials: false\r\n"; const header33 = try Header.fromSlice(header_string33); testing.expectEqual(meta.activeTag(header33), .access_control_allow_credentials); testing.expectEqual(header33.access_control_allow_credentials, false); const header_string34 = "Early-Data: 1\r\n"; const header34 = try Header.fromSlice(header_string34); testing.expectEqual(meta.activeTag(header34), .early_data); testing.expectEqual(header34.early_data, 1); const header_string35 = "Origin: https://somedomain.com:8080\r\n"; const header35 = try Header.fromSlice(header_string35); testing.expectEqual(meta.activeTag(header35), .origin); testing.expectEqual(header35.origin.?.scheme, .https); testing.expectEqualStrings(header35.origin.?.hostname, "somedomain.com"); testing.expectEqual(header35.origin.?.port, 8080); const header_string36 = "Origin: null\r\n"; const header36 = try Header.fromSlice(header_string36); testing.expectEqual(meta.activeTag(header36), .origin); testing.expectEqual(header36.origin, null); } const MAX_RESOURCE_LENGTH = 2048; fn lowerCase(slice: []const u8, buffer: []u8) []const u8 { for (slice) |c, i| { if (c >= 'A' and c <= 'Z') buffer[i] = c + 32 else buffer[i] = c; } return buffer[0..slice.len]; }
src/parsing.zig
const std = @import("std"); pub use std.os.windows; pub const ATOM = u16; pub const LONG_PTR = usize; pub const HWND = HANDLE; pub const HICON = HANDLE; pub const HCURSOR = HANDLE; pub const HBRUSH = HANDLE; pub const HMENU = HANDLE; pub const HDC = HANDLE; pub const HDROP = HANDLE; pub const LPARAM = LONG_PTR; pub const WPARAM = LONG_PTR; pub const LRESULT = LONG_PTR; pub const MAKEINTRESOURCE = [*]WCHAR; pub const CS_VREDRAW = 1; pub const CS_HREDRAW = 2; pub const CS_OWNDC = 32; pub const WM_DESTROY = 2; pub const WM_SIZE = 5; pub const WM_CLOSE = 16; pub const WM_QUIT = 18; pub const WM_KEYDOWN = 256; pub const WM_KEYUP = 257; pub const WM_CHAR = 258; pub const WM_SYSCHAR = 262; pub const WM_SYSKEYDOWN = 260; pub const WM_SYSKEYUP = 261; pub const WM_MOUSEMOVE = 512; pub const WM_LBUTTONDOWN = 513; pub const WM_LBUTTONUP = 514; pub const WM_RBUTTONDOWN = 516; pub const WM_RBUTTONUP = 517; pub const WM_MBUTTONDOWN = 519; pub const WM_MBUTTONUP = 520; pub const WM_MOUSEWHEEL = 522; pub const WM_MOUSEHWHEEL = 526; pub const WM_DROPFILES = 563; pub const WM_MOUSELEAVE = 675; pub const IDC_ARROW = @intToPtr(MAKEINTRESOURCE, 32512); pub const IDI_WINLOGO = @intToPtr(MAKEINTRESOURCE, 32517); pub const CW_USEDEFAULT = -1; pub const WS_CAPTION = 0x00C00000; pub const WS_OVERLAPPEDWINDOW = 0x00CF0000; pub const WS_MAXIMIZEBOX = 0x00010000; pub const WS_POPUP = 0x80000000; pub const WS_SYSMENU = 0x00080000; pub const WS_THICKFRAME = 0x00040000; pub const WS_CLIPCHILDREN = 0x02000000; pub const WS_CLIPSIBLINGS = 0x04000000; pub const WS_EX_ACCEPTFILES = 0x00000010; pub const WS_EX_APPWINDOW = 0x00040000; pub const WS_EX_WINDOWEDGE = 0x00000100; pub const SW_NORMAL = 1; pub const SWP_NOSIZE = 0x0001; pub const SWP_SHOWWINDOW = 0x0040; pub const PM_REMOVE = 1; pub const VK_ESCAPE = 27; pub const GWLP_USERDATA = -21; pub const BI_BITFIELDS = 3; pub const DIB_RGB_COLORS = 0; pub const SRCCOPY = 0x00CC0020; pub const PFD_DOUBLEBUFFER = 0x00000001; pub const PFD_DRAW_TO_WINDOW = 0x00000004; pub const PFD_SUPPORT_OPENGL = 0x00000020; pub const PFD_TYPE_RGBA = 0; pub const PFD_MAIN_PLANE = 0; pub const DM_PELSWIDTH = 0x00080000; pub const DM_PELSHEIGHT = 0x00100000; pub const DM_BITSPERPEL = 0x00040000; pub const CDS_FULLSCREEN = 4; pub const SIZE_MINIMIZED = 1; pub const SIZE_MAXIMIZED = 2; pub const TME_LEAVE = 2; pub const WNDPROC = stdcallcc fn (HWND, UINT, WPARAM, LPARAM) LRESULT; pub const WNDCLASSEX = extern struct { cbSize: UINT, style: UINT, lpfnWndProc: ?WNDPROC, cbClsExtra: c_int, cbWndExtra: c_int, hInstance: HMODULE, hIcon: ?HICON, hCursor: ?HCURSOR, hbrBackground: ?HBRUSH, lpszMenuName: ?[*]const WCHAR, lpszClassName: [*]const WCHAR, hIconSm: ?HICON, }; pub const RECT = extern struct { left: LONG, top: LONG, right: LONG, bottom: LONG, }; pub const POINT = extern struct { x: LONG, y: LONG, }; pub const MSG = extern struct { hWnd: HWND, message: UINT, wParam: WPARAM, lParam: LPARAM, time: DWORD, pt: POINT, }; // pub const BITMAPINFOHEADER = extern struct { // biSize: DWORD, // biWidth: LONG, // biHeight: LONG, // biPlanes: WORD, // biBitCount: WORD, // biCompression: DWORD, // biSizeImage: DWORD, // biXPelsPerMeter: LONG, // biYPelsPerMeter: LONG, // biClrUsed: DWORD, // biClrImportant: DWORD, // }; // pub const RGBQUAD = extern struct { // rgbBlue: BYTE, // rgbGreen: BYTE, // rgbRed: BYTE, // rgbReserved: BYTE, // }; // pub const BITMAPINFO = extern struct { // bmiHeader: BITMAPINFOHEADER, // bmiColors: [3]RGBQUAD, // }; pub const DEVMODEW = extern struct { dmDeviceName: [32]WCHAR, dmSpecVersion: WORD, dmDriverVersion: WORD, dmSize: WORD, dmDriverExtra: WORD, dmFields: DWORD, dmOrientation: c_short, dmPaperSize: c_short, dmPaperLength: c_short, dmPaperWidth: c_short, dmScale: c_short, dmCopies: c_short, dmDefaultSource: c_short, dmPrintQuality: c_short, dmColor: c_short, dmDuplex: c_short, dmYResolution: c_short, dmTTOption: c_short, dmCollate: c_short, dmFormName: [32]WCHAR, dmLogPixels: WORD, dmBitsPerPel: DWORD, dmPelsWidth: DWORD, dmPelsHeight: DWORD, dmDisplayFlags: DWORD, dmDisplayFrequency: DWORD, dmICMMethod: DWORD, dmICMIntent: DWORD, dmMediaType: DWORD, dmDitherType: DWORD, dmReserved1: DWORD, dmReserved2: DWORD, dmPanningWidth: DWORD, dmPanningHeight: DWORD, }; pub const TRACKMOUSEEVENT = extern struct { cbSize: DWORD, dwFlags: DWORD, hwndTrack: HWND, dwHoverTime: DWORD, }; pub extern "user32" stdcallcc fn LoadCursorW(hInstance: ?HINSTANCE, lpCursorName: LPCWSTR) ?HCURSOR; pub extern "user32" stdcallcc fn LoadIconW(hInstance: ?HINSTANCE, lpIconName: LPCWSTR) ?HICON; pub extern "user32" stdcallcc fn RegisterClassExW(lpWndClassEx: *const WNDCLASSEX) ATOM; pub extern "user32" stdcallcc fn UnregisterClassW(lpClassName: LPCWSTR, hInstance: HMODULE) BOOL; pub extern "user32" stdcallcc fn AdjustWindowRect(lpRect: *RECT, dwStyle: DWORD, bMenu: BOOL) BOOL; pub extern "user32" stdcallcc fn GetClientRect(wnd: HWND, lpRect: *RECT) BOOL; pub extern "user32" stdcallcc fn CreateWindowExW(dwExStyle: DWORD, lpClassName: LPCWSTR, lpWindowName: LPCWSTR, dwStyle: DWORD, X: c_int, Y: c_int, nWidth: c_int, nHeight: c_int, hWndParent: ?HWND, menu: ?HMENU, hInstance: ?HMODULE, lpParam: ?LPVOID) ?HWND; pub extern "user32" stdcallcc fn DestroyWindow(wnd: HWND) BOOL; pub extern "user32" stdcallcc fn ShowWindow(wnd: HWND, nCmdShow: c_int) BOOL; pub extern "user32" stdcallcc fn GetDC(wnd: HWND) ?HDC; pub extern "user32" stdcallcc fn ReleaseDC(wnd: HWND, hDC: HDC) c_int; pub extern "user32" stdcallcc fn PeekMessageW(lpMsg: *MSG, wnd: HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) BOOL; pub extern "user32" stdcallcc fn SendMessageW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT; pub extern "user32" stdcallcc fn TranslateMessage(lpMsg: *MSG) BOOL; pub extern "user32" stdcallcc fn DispatchMessageW(lpMsg: *MSG) LONG; pub extern "user32" stdcallcc fn DefWindowProcW(wnd: HWND, msg: UINT, wp: WPARAM, lp: LPARAM) LRESULT; pub extern "user32" stdcallcc fn GetWindowLongPtrW(hWnd: HWND, nIndex: c_int) LONG_PTR; pub extern "user32" stdcallcc fn SetWindowLongPtrW(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) LONG_PTR; pub extern "user32" stdcallcc fn SetWindowTextW(hWnd: HWND, lpString: LPCWSTR) BOOL; // pub extern "user32" stdcallcc fn SetWindowPos(hWnd: HWND, hWndInsertAfter: ?HWND, // X: c_int, Y: c_int, cx: c_int, cy: c_int, uFlags: UINT) BOOL; // pub extern "user32" stdcallcc fn GetForegroundWindow() ?HWND; // pub extern "user32" stdcallcc fn ValidateRect(hWnd: HWND, lpRect: ?*const RECT) BOOL; // pub extern "user32" stdcallcc fn InvalidateRect(hWnd: HWND, lpRect: ?*const RECT, bErase: BOOL) BOOL; pub extern "user32" stdcallcc fn ChangeDisplaySettingsW(lpDevMode: ?*DEVMODEW, dwFlags: DWORD) LONG; pub extern "user32" stdcallcc fn ShowCursor(bShow: BOOL) c_int; pub extern "user32" stdcallcc fn AdjustWindowRectEx(lpRect: *RECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD) BOOL; pub extern "user32" stdcallcc fn TrackMouseEvent(lpEventTrack: *TRACKMOUSEEVENT) BOOL; pub extern "shell32" stdcallcc fn DragQueryFileW(hDrop: HDROP, iFile: UINT, lpszFile: ?LPCWSTR, cch: UINT) UINT; pub extern "shell32" stdcallcc fn DragFinish(hDrop: HDROP) void; pub extern "user32" stdcallcc fn GetCursorPos(lpPoint: *POINT) BOOL; pub extern "user32" stdcallcc fn ScreenToClient(hWndl: HWND, lpPoint: *POINT) BOOL; pub inline fn LOWORD(l: DWORD) WORD { return @intCast(WORD, (l & 0xffff)); } pub inline fn HIWORD(l: DWORD) WORD { return @intCast(WORD, ((l >> 16) & 0xffff)); } pub inline fn LOBYTE(l: WORD) BYTE { return @intCast(BYTE, (l & 0xff)); } pub inline fn HIBYTE(l: WORD) BYTE { return @intCast(BYTE, ((l >> 8) & 0xff)); } pub inline fn GET_X_LPARAM(lp: LPARAM) c_int { return @intCast(c_int, @truncate(c_ushort, LOWORD(@intCast(DWORD, lp)))); } pub inline fn GET_Y_LPARAM(lp: LPARAM) c_int { return @intCast(c_int, @truncate(c_ushort, HIWORD(@intCast(DWORD, lp)))); }
src/app/windows/native.zig
const std = @import("std"); const Square = struct { opened: bool, mine: bool, flagged: bool, }; pub const SquareInfo = struct { opened: bool, mine: bool, flagged: bool, n_mines_around: u8, }; pub const GameStatus = enum { PLAY, WIN, LOSE }; pub const Game = struct { allocator: *std.mem.Allocator, map: [][]Square, width: u8, height: u8, nmines: u16, status: GameStatus, mines_added: bool, rnd: *std.rand.Random, pub fn init(allocator: *std.mem.Allocator, width: u8, height: u8, nmines: u16, rnd: *std.rand.Random) !Game { // in the beginning, there are width*height squares, but the mines are // added when the user has already opened one of them, otherwise the // first square that the user opens could be a mine std.debug.assert(@intCast(u16, width)*@intCast(u16, height) - 1 >= nmines); const map = try allocator.alloc([]Square, height); var nalloced: u8 = 0; errdefer { var i: u8 = 0; while (i < nalloced) : (i += 1) { allocator.free(map[i]); } allocator.free(map); } for (map) |*row| { row.* = try allocator.alloc(Square, width); nalloced += 1; for (row.*) |*square| { square.* = Square{ .opened = false, .mine = false, .flagged = false }; } } return Game{ .allocator = allocator, .map = map, .width = width, .height = height, .nmines = nmines, .status = GameStatus.PLAY, .mines_added = false, .rnd = rnd, }; } pub fn deinit(self: Game) void { for (self.map) |arr| { self.allocator.free(arr); } self.allocator.free(self.map); } const NeighborArray = [8][2]u8; fn getNeighbors(self: Game, x: u8, y: u8, res: [][2]u8) [][2]u8 { const neighbors = [_][2]i16{ [2]i16{@intCast(i16, x)-1, @intCast(i16, y)-1}, [2]i16{@intCast(i16, x)-1, @intCast(i16, y) }, [2]i16{@intCast(i16, x)-1, @intCast(i16, y)+1}, [2]i16{@intCast(i16, x), @intCast(i16, y)+1}, [2]i16{@intCast(i16, x)+1, @intCast(i16, y)+1}, [2]i16{@intCast(i16, x)+1, @intCast(i16, y) }, [2]i16{@intCast(i16, x)+1, @intCast(i16, y)-1}, [2]i16{@intCast(i16, x), @intCast(i16, y)-1}, }; var i: u8 = 0; for (neighbors) |neighbor| { const nx_signed = neighbor[0]; const ny_signed = neighbor[1]; if (0 <= nx_signed and nx_signed < @intCast(i16, self.width) and 0 <= ny_signed and ny_signed < @intCast(i16, self.height)) { res[i] = [2]u8{ @intCast(u8, nx_signed), @intCast(u8, ny_signed) }; i += 1; } } return res[0..i]; } fn countNeighborMines(self: Game, x: u8, y: u8) u8 { var neighbors: NeighborArray = undefined; var res: u8 = 0; for (self.getNeighbors(x, y, neighbors[0..])) |neighbor| { const nx = neighbor[0]; const ny = neighbor[1]; if (self.map[ny][nx].mine) { res += 1; } } return res; } pub fn getSquareInfo(self: Game, x: u8, y: u8) SquareInfo { return SquareInfo{ .opened = self.map[y][x].opened, .mine = self.map[y][x].mine, .flagged = self.map[y][x].flagged, .n_mines_around = self.countNeighborMines(x, y), }; } pub fn debugDump(self: Game) void { // M = showing mine, m = hidden mine, S = showing safe, s = hidden safe var y: u8 = 0; while (y < self.height) : (y += 1) { std.debug.warn("|"); var x: u8 = 0; while (x < self.width) : (x += 1) { if (self.map[y][x].opened) { if (self.map[y][x].mine) { std.debug.warn("M"); } else { std.debug.warn("S"); } } else { if (self.map[y][x].mine) { std.debug.warn("m"); } else { std.debug.warn("s"); } } if (self.map[y][x].mine) { std.debug.warn(" "); } else { std.debug.warn("{}", self.countNeighborMines(x, y)); } std.debug.warn("|"); } std.debug.warn("\n"); } std.debug.warn("status = {}\n", self.status); } fn openRecurser(self: *Game, x: u8, y: u8) void { if (self.map[y][x].opened) { return; } self.map[y][x].opened = true; if (!self.mines_added) { self.addMines(); self.mines_added = true; } if (self.map[y][x].mine) { self.status = GameStatus.LOSE; } else if (self.countNeighborMines(x, y) == 0) { var neighbors: NeighborArray = undefined; for (self.getNeighbors(x, y, neighbors[0..])) |neighbor| { const nx = neighbor[0]; const ny = neighbor[1]; self.openRecurser(nx, ny); } } } pub fn open(self: *Game, x: u8, y: u8) void { if (self.status != GameStatus.PLAY or self.map[y][x].flagged) { return; } self.openRecurser(x, y); switch (self.status) { GameStatus.PLAY => {}, GameStatus.LOSE => return, GameStatus.WIN => unreachable, // openRecurser shouldn't set this status } // try to find a non-mine, non-opened square // player won if there are none var xx: u8 = 0; while (xx < self.width) : (xx += 1) { var yy: u8 = 0; while (yy < self.height) : (yy += 1) { if (!self.map[yy][xx].opened and !self.map[yy][xx].mine) { return; } } } self.status = GameStatus.WIN; } fn addMines(self: *Game) void { var mined: u16 = 0; while (mined < self.nmines) { const x = self.rnd.uintLessThan(u8, self.width); const y = self.rnd.uintLessThan(u8, self.height); const square = &self.map[y][x]; if (!square.opened and !square.mine) { square.mine = true; std.debug.assert(self.map[y][x].mine); mined += 1; } } } pub fn openAroundIfSafe(self: *Game, x: u8, y: u8) void { if (self.status != GameStatus.PLAY or !self.map[y][x].opened) { return; } var arr: NeighborArray = undefined; var neighbor_mines: u8 = 0; var neighbor_flags: u8 = 0; for (self.getNeighbors(x, y, arr[0..])) |neighbor| { const nx = neighbor[0]; const ny = neighbor[1]; if (self.map[ny][nx].mine) { neighbor_mines += 1; } if (self.map[ny][nx].flagged) { neighbor_flags += 1; } } if (neighbor_mines != neighbor_flags) { return; } for (self.getNeighbors(x, y, arr[0..])) |neighbor| { const nx = neighbor[0]; const ny = neighbor[1]; self.open(nx, ny); } } pub fn openAroundEverythingSafe(self: *Game) void { var x: u8 = 0; while (x < self.width) : (x += 1) { var y: u8 = 0; while (y < self.height) : (y += 1) { self.openAroundIfSafe(x, y); } } } pub fn toggleFlag(self: *Game, x: u8, y: u8) void { if (self.status != GameStatus.PLAY or self.map[y][x].opened) { return; } self.map[y][x].flagged = !self.map[y][x].flagged; } }; test "init deinit open getSquareInfo" { const allocator = std.debug.global_allocator; const expect = std.testing.expect; var default_prng = std.rand.Xoroshiro128.init(42); const rnd = &default_prng.random; var game = try Game.init(allocator, 10, 20, 5, rnd); defer game.deinit(); expect(!game.getSquareInfo(1, 2).opened); game.open(1, 2); //game.debugDump(); expect(game.getSquareInfo(1, 2).opened); expect(game.getSquareInfo(1, 2).n_mines_around == 0); expect(game.getSquareInfo(9, 2).opened); expect(game.getSquareInfo(9, 2).n_mines_around == 0); expect(game.getSquareInfo(9, 3).opened); expect(game.getSquareInfo(9, 3).n_mines_around == 1); }
src/core.zig
const std = @import("std"); const assert = std.debug.assert; const zp = @import("../../zplay.zig"); const stb_image = zp.deps.stb.image; const Texture = zp.graphics.common.Texture; const Self = @This(); pub const Error = error{ LoadImageError, }; /// gpu texture tex: *Texture, /// format of image format: Texture.ImageFormat = undefined, /// init cube texture from pixel data pub fn init( allocator: std.mem.Allocator, right_pixel_data: []const u8, left_pixel_data: []const u8, top_pixel_data: []const u8, bottom_pixel_data: []const u8, front_pixel_data: []const u8, back_pixel_data: []const u8, format: Texture.ImageFormat, size: u32, ) !Self { var tex = try Texture.init(allocator, .texture_cube_map); var tex_format: Texture.TextureFormat = switch (format) { .rgb => .rgb, .rgba => .rgba, else => unreachable, }; tex.setWrappingMode(.s, .clamp_to_edge); tex.setWrappingMode(.t, .clamp_to_edge); tex.setWrappingMode(.r, .clamp_to_edge); tex.setFilteringMode(.minifying, .linear); tex.setFilteringMode(.magnifying, .linear); tex.updateImageData( .texture_cube_map_positive_x, 0, tex_format, size, size, null, format, u8, right_pixel_data.ptr, false, ); tex.updateImageData( .texture_cube_map_negative_x, 0, tex_format, size, size, null, format, u8, left_pixel_data.ptr, false, ); tex.updateImageData( .texture_cube_map_positive_y, 0, tex_format, size, size, null, format, u8, top_pixel_data.ptr, false, ); tex.updateImageData( .texture_cube_map_negative_y, 0, tex_format, size, size, null, format, u8, bottom_pixel_data.ptr, false, ); tex.updateImageData( .texture_cube_map_positive_z, 0, tex_format, size, size, null, format, u8, front_pixel_data.ptr, false, ); tex.updateImageData( .texture_cube_map_negative_z, 0, tex_format, size, size, null, format, u8, back_pixel_data.ptr, false, ); return Self{ .tex = tex, .format = format, }; } pub fn deinit(self: Self) void { self.tex.deinit(); } /// create cubemap with path to image files pub fn fromFilePath( allocator: std.mem.Allocator, right_file_path: [:0]const u8, left_file_path: [:0]const u8, top_file_path: [:0]const u8, bottom_file_path: [:0]const u8, front_file_path: [:0]const u8, back_file_path: [:0]const u8, ) !Self { var width: c_int = undefined; var height: c_int = undefined; var channels: c_int = undefined; var width1: c_int = undefined; var height1: c_int = undefined; var channels1: c_int = undefined; // right side var right_image_data = stb_image.stbi_load( right_file_path.ptr, &width, &height, &channels, 0, ); if (right_image_data == null) { return error.LoadImageError; } assert(width == height); defer stb_image.stbi_image_free(right_image_data); // left side var left_image_data = stb_image.stbi_load( left_file_path.ptr, &width1, &height1, &channels1, 0, ); if (left_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(left_image_data); // top side var top_image_data = stb_image.stbi_load( top_file_path.ptr, &width1, &height1, &channels1, 0, ); if (top_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(top_image_data); // bottom side var bottom_image_data = stb_image.stbi_load( bottom_file_path.ptr, &width1, &height1, &channels1, 0, ); if (bottom_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(bottom_image_data); // front side var front_image_data = stb_image.stbi_load( front_file_path.ptr, &width1, &height1, &channels1, 0, ); if (front_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(front_image_data); // back side var back_image_data = stb_image.stbi_load( back_file_path.ptr, &width1, &height1, &channels1, 0, ); if (back_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(back_image_data); var size = @intCast(u32, width * height * channels); return Self.init( allocator, right_image_data[0..size], left_image_data[0..size], top_image_data[0..size], bottom_image_data[0..size], front_image_data[0..size], back_image_data[0..size], switch (channels) { 3 => .rgb, 4 => .rgba, else => unreachable, }, @intCast(u32, width), ); } /// create cubemap with given files' data buffer pub fn fromFileData( allocator: std.mem.Allocator, right_data: []const u8, left_data: []const u8, top_data: []const u8, bottom_data: []const u8, front_data: []const u8, back_data: []const u8, ) !Self { var width: c_int = undefined; var height: c_int = undefined; var channels: c_int = undefined; var width1: c_int = undefined; var height1: c_int = undefined; var channels1: c_int = undefined; // right side var right_image_data = stb_image.stbi_load_from_memory( right_data.ptr, @intCast(c_int, right_data.len), &width, &height, &channels, 0, ); assert(width == height); if (right_image_data == null) { return error.LoadImageError; } defer stb_image.stbi_image_free(right_image_data); // left side var left_image_data = stb_image.stbi_load_from_memory( left_data.ptr, @intCast(c_int, left_data.len), &width1, &height1, &channels1, 0, ); if (left_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(left_image_data); // top side var top_image_data = stb_image.stbi_load_from_memory( top_data.ptr, @intCast(c_int, top_data.len), &width1, &height1, &channels1, 0, ); if (top_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(top_image_data); // bottom side var bottom_image_data = stb_image.stbi_load_from_memory( bottom_data.ptr, @intCast(c_int, bottom_data.len), &width1, &height1, &channels1, 0, ); if (bottom_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(bottom_image_data); // front side var front_image_data = stb_image.stbi_load_from_memory( front_data.ptr, @intCast(c_int, front_data.len), &width1, &height1, &channels1, 0, ); if (front_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(front_image_data); // back side var back_image_data = stb_image.stbi_load_from_memory( back_data.ptr, @intCast(c_int, back_data.len), &width1, &height1, &channels1, 0, ); if (back_image_data == null) { return error.LoadImageError; } assert(width1 == width); assert(height1 == height); assert(channels1 == channels); defer stb_image.stbi_image_free(back_image_data); var size = @intCast(u32, width * height * channels); return Self.init( allocator, right_image_data[0..size], left_image_data[0..size], top_image_data[0..size], bottom_image_data[0..size], front_image_data[0..size], back_image_data[0..size], switch (channels) { 3 => .rgb, 4 => .rgba, else => unreachable, }, @intCast(u32, width), ); }
src/graphics/texture/TextureCube.zig
const std = @import("std"); const webgpu = @import("../../webgpu.zig"); const dummy = @import("./dummy.zig"); pub const CommandBuffer = struct { const vtable = webgpu.CommandBuffer.VTable{ .destroy_fn = destroy, }; super: webgpu.CommandBuffer, pub fn create(device: *dummy.Device, descriptor: webgpu.CommandBufferDescriptor) !*CommandBuffer { _ = descriptor; var command_buffer = try device.allocator.create(CommandBuffer); errdefer device.allocator.destroy(command_buffer); command_buffer.super = .{ .__vtable = &vtable, .device = &device.super, }; return command_buffer; } fn destroy(super: *webgpu.CommandBuffer) void { var command_buffer = @fieldParentPtr(CommandBuffer, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); device.allocator.destroy(command_buffer); } }; pub const CommandEncoder = struct { const vtable = webgpu.CommandEncoder.VTable{ .destroy_fn = destroy, .begin_compute_pass_fn = beginComputePass, .begin_render_pass_fn = beginRenderPass, .clear_buffer_fn = clearBuffer, .copy_buffer_to_buffer_fn = copyBufferToBuffer, .copy_buffer_to_texture_fn = copyBufferToTexture, .copy_texture_to_buffer_fn = copyTextureToBuffer, .copy_texture_to_texture_fn = copyTextureToTexture, .finish_fn = finish, .insert_debug_marker_fn = insertDebugMarker, .pop_debug_group_fn = popDebugGroup, .push_debug_group_fn = pushDebugGroup, .resolve_query_set_fn = resolveQuerySet, .write_timestamp_fn = writeTimestamp, }; super: webgpu.CommandEncoder, pub fn create(device: *dummy.Device, descriptor: webgpu.CommandEncoderDescriptor) webgpu.Device.CreateCommandEncoderError!*CommandEncoder { _ = descriptor; var command_encoder = try device.allocator.create(CommandEncoder); errdefer device.allocator.destroy(command_encoder); command_encoder.super = .{ .__vtable = &vtable, .device = &device.super, }; return command_encoder; } fn destroy(super: *webgpu.CommandEncoder) void { var command_encoder = @fieldParentPtr(CommandEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); device.allocator.destroy(command_encoder); } fn beginComputePass(super: *webgpu.CommandEncoder, descriptor: webgpu.ComputePassDescriptor) webgpu.CommandEncoder.BeginComputePassError!*webgpu.ComputePassEncoder { _ = @fieldParentPtr(CommandEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); var compute_pass_encoder = try ComputePassEncoder.create(device, descriptor); return &compute_pass_encoder.super; } fn beginRenderPass(super: *webgpu.CommandEncoder, descriptor: webgpu.RenderPassDescriptor) webgpu.CommandEncoder.BeginRenderPassError!*webgpu.RenderPassEncoder { _ = @fieldParentPtr(CommandEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); var render_pass_encoder = try RenderPassEncoder.create(device, descriptor); return &render_pass_encoder.super; } fn clearBuffer(super: *webgpu.CommandEncoder, buffer: *webgpu.Buffer, offset: usize, size: usize) webgpu.CommandEncoder.ClearBufferError!void { _ = super; var data = try buffer.getMappedRange(offset, size); std.mem.set(u8, data, 0); } fn copyBufferToBuffer(super: *webgpu.CommandEncoder, source: *webgpu.Buffer, source_offset: usize, destination: *webgpu.Buffer, destination_offset: usize, size: usize) webgpu.CommandEncoder.CopyBufferToBufferError!void { _ = super; var source_data = try source.getMappedRange(source_offset, size); var destination_data = try destination.getMappedRange(destination_offset, size); std.mem.copy(u8, destination_data, source_data); } fn copyBufferToTexture(super: *webgpu.CommandEncoder, source: webgpu.ImageCopyBuffer, destination: webgpu.ImageCopyTexture, copy_size: webgpu.Extend3D) webgpu.CommandEncoder.CopyBufferToTextureError!void { _ = super; _ = source; _ = destination; _ = copy_size; } fn copyTextureToBuffer(super: *webgpu.CommandEncoder, source: webgpu.ImageCopyTexture, destination: webgpu.ImageCopyBuffer, copy_size: webgpu.Extend3D) webgpu.CommandEncoder.CopyTextureToBufferError!void { _ = super; _ = source; _ = destination; _ = copy_size; } fn copyTextureToTexture(super: *webgpu.CommandEncoder, source: webgpu.ImageCopyTexture, destination: webgpu.ImageCopyTexture, copy_size: webgpu.Extend3D) webgpu.CommandEncoder.CopyTextureToTextureError!void { _ = super; _ = source; _ = destination; _ = copy_size; } fn finish(super: *webgpu.CommandEncoder, descriptor: webgpu.CommandBufferDescriptor) webgpu.CommandEncoder.FinishError!*webgpu.CommandBuffer { _ = @fieldParentPtr(CommandEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); var command_buffer = try CommandBuffer.create(device, descriptor); return &command_buffer.super; } fn insertDebugMarker(super: *webgpu.CommandEncoder, marker_label: [:0]const u8) void { _ = super; _ = marker_label; } fn popDebugGroup(super: *webgpu.CommandEncoder) void { _ = super; } fn pushDebugGroup(super: *webgpu.CommandEncoder, group_label: [:0]const u8) void { _ = super; _ = group_label; } fn resolveQuerySet(super: *webgpu.CommandEncoder, query_set: *webgpu.QuerySet, first_query: u32, query_count: u32, destination: *webgpu.Buffer, destination_offset: u64) webgpu.CommandEncoder.ResolveQuerySetError!void { _ = super; _ = query_set; _ = first_query; _ = query_count; _ = destination; _ = destination_offset; } fn writeTimestamp(super: *webgpu.CommandEncoder, query_set: *webgpu.QuerySet, query_index: u32) webgpu.CommandEncoder.WriteTimestampError!void { _ = super; _ = query_set; _ = query_index; } }; pub const ComputePassEncoder = struct { const vtable = webgpu.ComputePassEncoder.VTable{ .destroy_fn = destroy, .begin_pipeline_statistics_query_fn = beginPipelineStatisticsQuery, .dispatch_fn = dispatch, .dispatch_indirect_fn = dispatchIndirect, .end_pass_fn = endPass, .end_pipeline_statistics_query_fn = endPipelineStatisticsQuery, .insert_debug_marker_fn = insertDebugMarker, .pop_debug_group_fn = popDebugGroup, .push_debug_group_fn = pushDebugGroup, .set_bind_group_fn = setBindGroup, .set_pipeline_fn = setPipeline, }; super: webgpu.ComputePassEncoder, pub fn create(device: *dummy.Device, descriptor: webgpu.ComputePassDescriptor) webgpu.CommandEncoder.BeginComputePassError!*ComputePassEncoder { _ = descriptor; var compute_pass_encoder = try device.allocator.create(ComputePassEncoder); errdefer device.allocator.destroy(compute_pass_encoder); compute_pass_encoder.super = .{ .__vtable = &vtable, .device = &device.super, }; return compute_pass_encoder; } fn destroy(super: *webgpu.ComputePassEncoder) void { var compute_pass_encoder = @fieldParentPtr(ComputePassEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); device.allocator.destroy(compute_pass_encoder); } fn beginPipelineStatisticsQuery(super: *webgpu.ComputePassEncoder, query_set: *webgpu.QuerySet, query_index: u32) webgpu.ComputePassEncoder.BeginPipelineStatisticsQueryError!void { _ = super; _ = query_set; _ = query_index; } fn dispatch(super: *webgpu.ComputePassEncoder, x: u32, y: u32, z: u32) webgpu.ComputePassEncoder.DispatchError!void { _ = super; _ = x; _ = y; _ = z; } fn dispatchIndirect(super: *webgpu.ComputePassEncoder, indirect_buffer: *webgpu.Buffer, indirect_offset: u64) webgpu.ComputePassEncoder.DispatchIndirectError!void { _ = super; _ = indirect_buffer; _ = indirect_offset; } fn endPass(super: *webgpu.ComputePassEncoder) webgpu.ComputePassEncoder.EndPassError!void { _ = super; } fn endPipelineStatisticsQuery(super: *webgpu.ComputePassEncoder) webgpu.ComputePassEncoder.EndPipelineStatisticsQueryError!void { _ = super; } fn insertDebugMarker(super: *webgpu.ComputePassEncoder, marker_label: [:0]const u8) void { _ = super; _ = marker_label; } fn popDebugGroup(super: *webgpu.ComputePassEncoder) void { _ = super; } fn pushDebugGroup(super: *webgpu.ComputePassEncoder, group_label: [:0]const u8) void { _ = super; _ = group_label; } fn setBindGroup(super: *webgpu.ComputePassEncoder, group_index: u32, group: *webgpu.BindGroup, dynamic_offets: []const u32) webgpu.ComputePassEncoder.SetBindGroupError!void { _ = super; _ = group_index; _ = group; _ = dynamic_offets; } fn setPipeline(super: *webgpu.ComputePassEncoder, pipeline: *webgpu.ComputePipeline) webgpu.ComputePassEncoder.SetPipelineError!void { _ = super; _ = pipeline; } }; pub const RenderBundle = struct { const vtable = webgpu.RenderBundle.VTable{ .destroy_fn = destroy, }; super: webgpu.RenderBundle, pub fn create(device: *dummy.Device) !*RenderBundle { var render_bundle = try device.allocator.create(RenderBundle); errdefer device.allocator.destroy(render_bundle); render_bundle.super = .{ .__vtable = &vtable, .device = &device.super, }; return render_bundle; } fn destroy(super: *webgpu.RenderBundle) void { var render_bundle = @fieldParentPtr(RenderBundle, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); device.allocator.destroy(render_bundle); } }; pub const RenderBundleEncoder = struct { const vtable = webgpu.RenderBundleEncoder.VTable{ .destroy_fn = destroy, .draw_fn = draw, .draw_indexed_fn = drawIndexed, .draw_indexed_indirect_fn = drawIndexedIndirect, .draw_indirect_fn = drawIndirect, .finish_fn = finish, .insert_debug_marker_fn = insertDebugMarker, .pop_debug_group_fn = popDebugGroup, .push_debug_group_fn = pushDebugGroup, .set_bind_group_fn = setBindGroup, .set_index_buffer_fn = setIndexBuffer, .set_pipeline_fn = setPipeline, .set_vertex_buffer_fn = setVertexBuffer, }; super: webgpu.RenderBundleEncoder, pub fn create(device: *dummy.Device, descriptor: webgpu.RenderBundleEncoderDescriptor) webgpu.CommandEncoder.BeginComputePassError!*RenderBundleEncoder { _ = descriptor; var compute_pass_encoder = try device.allocator.create(RenderBundleEncoder); errdefer device.allocator.destroy(compute_pass_encoder); compute_pass_encoder.super = .{ .__vtable = &vtable, .device = &device.super, }; return compute_pass_encoder; } fn destroy(super: *webgpu.RenderBundleEncoder) void { var render_bundle_encoder = @fieldParentPtr(RenderBundleEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); device.allocator.destroy(render_bundle_encoder); } fn draw(super: *webgpu.RenderBundleEncoder, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32) void { _ = super; _ = vertex_count; _ = instance_count; _ = first_vertex; _ = first_instance; } fn drawIndexed(super: *webgpu.RenderBundleEncoder, index_count: u32, instance_count: u32, first_index: u32, base_vertex: u32, first_instance: u32) void { _ = super; _ = index_count; _ = instance_count; _ = first_index; _ = base_vertex; _ = first_instance; } fn drawIndexedIndirect(super: *webgpu.RenderBundleEncoder, indirect_buffer: *webgpu.Buffer, indirect_offset: u64) void { _ = super; _ = indirect_buffer; _ = indirect_offset; } fn drawIndirect(super: *webgpu.RenderBundleEncoder, indirect_buffer: *webgpu.Buffer, indirect_offset: u64) void { _ = super; _ = indirect_buffer; _ = indirect_offset; } fn finish(super: *webgpu.RenderBundleEncoder) webgpu.RenderBundleEncoder.FinishError!*webgpu.RenderBundle { _ = @fieldParentPtr(RenderBundleEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); var render_bundle = try RenderBundle.create(device); return &render_bundle.super; } fn beginPipelineStatisticsQuery(super: *webgpu.RenderBundleEncoder, query_set: *webgpu.QuerySet, query_index: u32) webgpu.RenderBundleEncoder.BeginPipelineStatisticsQueryError!void { _ = super; _ = query_set; _ = query_index; } fn dispatch(super: *webgpu.RenderBundleEncoder, x: u32, y: u32, z: u32) webgpu.RenderBundleEncoder.DispatchError!void { _ = super; _ = x; _ = y; _ = z; } fn dispatchIndirect(super: *webgpu.RenderBundleEncoder, indirect_buffer: *webgpu.Buffer, indirect_offset: u64) webgpu.RenderBundleEncoder.DispatchIndirectError!void { _ = super; _ = indirect_buffer; _ = indirect_offset; } fn endPass(super: *RenderBundleEncoder) webgpu.RenderBundleEncoder.EndPassError!void { _ = super; } fn endPipelineStatisticsQuery(super: *webgpu.RenderBundleEncoder) webgpu.RenderBundleEncoder.EndPipelineStatisticsQueryError!void { _ = super; } fn insertDebugMarker(super: *webgpu.RenderBundleEncoder, marker_label: [:0]const u8) void { _ = super; _ = marker_label; } fn popDebugGroup(super: *webgpu.RenderBundleEncoder) void { _ = super; } fn pushDebugGroup(super: *webgpu.RenderBundleEncoder, group_label: [:0]const u8) void { _ = super; _ = group_label; } fn setBindGroup(super: *webgpu.RenderBundleEncoder, group_index: u32, group: *webgpu.BindGroup, dynamic_offets: []const u32) void { _ = super; _ = group_index; _ = group; _ = dynamic_offets; } fn setIndexBuffer(super: *webgpu.RenderBundleEncoder, buffer: *webgpu.Buffer, format: webgpu.IndexFormat, offset: u64, size: u64) void { _ = super; _ = buffer; _ = format; _ = offset; _ = size; } fn setPipeline(super: *webgpu.RenderBundleEncoder, pipeline: *webgpu.RenderPipeline) void { _ = super; _ = pipeline; } fn setVertexBuffer(super: *webgpu.RenderBundleEncoder, slot: u32, buffer: *webgpu.Buffer, offset: u64, size: u64) void { _ = super; _ = slot; _ = buffer; _ = offset; _ = size; } }; pub const RenderPassEncoder = struct { const vtable = webgpu.RenderPassEncoder.VTable{ .destroy_fn = destroy, .begin_occlusion_query_fn = beginOcclusionQuery, .begin_pipeline_statistics_query_fn = beginPipelineStatisticsQuery, .draw_fn = draw, .draw_indexed_fn = drawIndexed, .draw_indexed_indirect_fn = drawIndexedIndirect, .draw_indirect_fn = drawIndirect, .end_occlusion_query_fn = endOcclusionQuery, .end_pipeline_statistics_query_fn = endPipelineStatisticsQuery, .execute_bundles_fn = executeBundles, .insert_debug_marker_fn = insertDebugMarker, .pop_debug_group_fn = popDebugGroup, .push_debug_group_fn = pushDebugGroup, .set_bind_group_fn = setBindGroup, .set_blend_constant_fn = setBlendConstant, .set_index_buffer_fn = setIndexBuffer, .set_pipeline_fn = setPipeline, .set_scissor_rect_fn = setScissorRect, .set_stencil_reference_fn = setStencilReference, .set_vertex_buffer_fn = setVertexBuffer, .set_viewport_fn = setViewport, }; super: webgpu.RenderPassEncoder, pub fn create(device: *dummy.Device, descriptor: webgpu.RenderPassDescriptor) webgpu.CommandEncoder.BeginRenderPassError!*RenderPassEncoder { _ = descriptor; var render_pass_encoder = try device.allocator.create(RenderPassEncoder); errdefer device.allocator.destroy(render_pass_encoder); render_pass_encoder.super = .{ .__vtable = &vtable, .device = &device.super, }; return render_pass_encoder; } fn destroy(super: *webgpu.RenderPassEncoder) void { var render_pass_encoder = @fieldParentPtr(RenderPassEncoder, "super", super); var device = @fieldParentPtr(dummy.Device, "super", super.device); device.allocator.destroy(render_pass_encoder); } fn beginOcclusionQuery(super: *webgpu.RenderPassEncoder, query_index: u32) void { _ = super; _ = query_index; } fn beginPipelineStatisticsQuery(super: *webgpu.RenderPassEncoder, query_set: *webgpu.QuerySet, query_index: u32) void { _ = super; _ = query_set; _ = query_index; } fn draw(super: *webgpu.RenderPassEncoder, vertex_count: u32, instance_count: u32, first_vertex: u32, first_instance: u32) void { _ = super; _ = vertex_count; _ = instance_count; _ = first_vertex; _ = first_instance; } fn drawIndexed(super: *webgpu.RenderPassEncoder, index_count: u32, instance_count: u32, first_index: u32, base_vertex: u32, first_instance: u32) void { _ = super; _ = index_count; _ = instance_count; _ = first_index; _ = base_vertex; _ = first_instance; } fn drawIndexedIndirect(super: *webgpu.RenderPassEncoder, indirect_buffer: *webgpu.Buffer, indirect_offset: u64) void { _ = super; _ = indirect_buffer; _ = indirect_offset; } fn drawIndirect(super: *webgpu.RenderPassEncoder, indirect_buffer: *webgpu.Buffer, indirect_offset: u64) void { _ = super; _ = indirect_buffer; _ = indirect_offset; } fn endOcclusionQuery(super: *webgpu.RenderPassEncoder) void { _ = super; } fn endPipelineStatisticsQuery(super: *webgpu.RenderPassEncoder) void { _ = super; } fn executeBundles(super: *webgpu.RenderPassEncoder, bundles: []*webgpu.RenderBundle) void { _ = super; _ = bundles; } fn insertDebugMarker(super: *webgpu.RenderPassEncoder, marker_label: [:0]const u8) void { _ = super; _ = marker_label; } fn popDebugGroup(super: *webgpu.RenderPassEncoder) void { _ = super; } fn pushDebugGroup(super: *webgpu.RenderPassEncoder, group_label: [:0]const u8) void { _ = super; _ = group_label; } fn setBindGroup(super: *webgpu.RenderPassEncoder, group_index: u32, group: *webgpu.BindGroup, dynamic_offsets: []const u32) void { _ = super; _ = group_index; _ = group; _ = dynamic_offsets; } fn setBlendConstant(super: *webgpu.RenderPassEncoder, color: webgpu.Color) void { _ = super; _ = color; } fn setIndexBuffer(super: *webgpu.RenderPassEncoder, buffer: *webgpu.Buffer, format: webgpu.IndexFormat, offset: u64, size: u64) void { _ = super; _ = buffer; _ = format; _ = offset; _ = size; } fn setPipeline(super: *webgpu.RenderPassEncoder, pipeline: *webgpu.RenderPipeline) void { _ = super; _ = pipeline; } fn setScissorRect(super: *webgpu.RenderPassEncoder, x: u32, y: u32, width: u32, height: u32) void { _ = super; _ = x; _ = y; _ = width; _ = height; } fn setStencilReference(super: *webgpu.RenderPassEncoder, reference: u32) void { _ = super; _ = reference; } fn setVertexBuffer(super: *webgpu.RenderPassEncoder, slot: u32, buffer: *webgpu.Buffer, offset: u64, size: u64) void { _ = super; _ = slot; _ = buffer; _ = offset; _ = size; } fn setViewport(super: *webgpu.RenderPassEncoder, x: f32, y: f32, width: f32, height: f32, min_depth: f32, max_depth: f32) void { _ = super; _ = x; _ = y; _ = width; _ = height; _ = min_depth; _ = max_depth; } };
src/backends/dummy/command.zig
const std = @import("std"); const crypto = std.crypto; const fmt = std.fmt; const testing = std.testing; pub const Error = error{InvalidUUID}; pub const UUID = struct { bytes: [16]u8, pub fn init() UUID { var uuid = UUID{ .bytes = undefined }; crypto.random.bytes(&uuid.bytes); // Version 4 uuid.bytes[6] = (uuid.bytes[6] & 0x0f) | 0x40; // Variant 1 uuid.bytes[8] = (uuid.bytes[8] & 0x3f) | 0x80; return uuid; } // Indices in the UUID string representation for each byte. const encoded_pos = [16]u8{ 0, 2, 4, 6, 9, 11, 14, 16, 19, 21, 24, 26, 28, 30, 32, 34 }; // Hex to nibble mapping. const hex_to_nibble = [256]u8{ 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, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 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, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 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, 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, 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, 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, 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, 0xff, 0xff, 0xff, }; pub fn format( self: UUID, comptime layout: []const u8, options: fmt.FormatOptions, writer: anytype, ) !void { _ = options; // currently unused if (layout.len != 0 and layout[0] != 's') @compileError("Unsupported format specifier for UUID type: '" ++ layout ++ "'."); var buf: [36]u8 = undefined; const hex = "0123456789abcdef"; buf[8] = '-'; buf[13] = '-'; buf[18] = '-'; buf[23] = '-'; inline for (encoded_pos) |i, j| { buf[i + 0] = hex[self.bytes[j] >> 4]; buf[i + 1] = hex[self.bytes[j] & 0x0f]; } try fmt.format(writer, "{s}", .{buf}); } pub fn parse(buf: []const u8) Error!UUID { var uuid = UUID{ .bytes = undefined }; if (buf.len != 36 or buf[8] != '-' or buf[13] != '-' or buf[18] != '-' or buf[23] != '-') return Error.InvalidUUID; inline for (encoded_pos) |i, j| { const hi = hex_to_nibble[buf[i + 0]]; const lo = hex_to_nibble[buf[i + 1]]; if (hi == 0xff or lo == 0xff) { return Error.InvalidUUID; } uuid.bytes[j] = hi << 4 | lo; } return uuid; } }; // Zero UUID pub const zero: UUID = .{ .bytes = .{0} ** 16 }; // Convenience function to return a new v4 UUID. pub fn newV4() UUID { return UUID.init(); } test "parse and format" { const uuids = [_][]const u8{ "d0cd8041-0504-40cb-ac8e-d05960d205ec", "3df6f0e4-f9b1-4e34-ad70-33206069b995", "f982cf56-c4ab-4229-b23c-d17377d000be", "6b9f53be-cf46-40e8-8627-6b60dc33def8", "c282ec76-ac18-4d4a-8a29-3b94f5c74813", "00000000-0000-0000-0000-000000000000", }; for (uuids) |uuid| { try testing.expectFmt(uuid, "{}", .{try UUID.parse(uuid)}); } } test "invalid UUID" { const uuids = [_][]const u8{ "3df6f0e4-f9b1-4e34-ad70-33206069b99", // too short "3df6f0e4-f9b1-4e34-ad70-33206069b9912", // too long "3df6f0e4-f9b1-4e34-ad70_33206069b9912", // missing or invalid group separator "zdf6f0e4-f9b1-4e34-ad70-33206069b995", // invalid character }; for (uuids) |uuid| { try testing.expectError(Error.InvalidUUID, UUID.parse(uuid)); } }
uuid.zig
const std = @import("std"); const u = @import("util.zig"); const CodePoint = struct { bytes: u.Txt, offset: usize, scalar: u21, pub fn end(self: CodePoint) usize { return self.offset + self.bytes.len; } }; bytes: u.Txt, i: usize = 0, cur: ?CodePoint, const Self = @This(); const eofBytes = &[_]u8{}; pub inline fn init(bytes: u.Bin) !Self { return unsafeInit(try u.toTxt(bytes)); } pub fn unsafeInit(str: u.Txt) Self { var self = Self{ .cur = null, .bytes = str }; self.skip(); return self; } pub fn next(self: *Self) ?CodePoint { if (self.i >= self.bytes.len) { self.cur = null; return null; } var cp = CodePoint{ .bytes = undefined, .offset = self.i, .scalar = undefined, }; const cp_len = std.unicode.utf8ByteSequenceLength(self.bytes[self.i]) catch unreachable; self.i += cp_len; cp.bytes = self.bytes[self.i - cp_len .. self.i]; cp.scalar = std.unicode.utf8Decode(cp.bytes) catch unreachable; self.cur = cp; return self.cur; } pub fn skip(self: *Self) void { _ = self.next(); } pub fn peek(self: Self) CodePoint { return if (self.cur) |c| c else CodePoint{ .scalar = 0, .offset = self.bytes.len, .bytes = eofBytes }; } pub fn eol(self: Self) bool { return self.cur != null and self.cur.?.scalar == '\n'; } pub fn eof(self: Self) bool { return self.cur == null; } pub fn readWhile(self: *Self, comptime pred: fn (u21) bool) u.Txt { if (self.cur) |p| { while (self.cur != null and pred(self.cur.?.scalar)) { self.skip(); } return if (self.cur) |q| self.bytes[p.offset..q.offset] else self.bytes[p.offset..]; } else return eofBytes; } pub fn isSpace(cp: u21) bool { if (cp < 0x9 or cp > 0x3000) return false; return switch (cp) { 0x9...0xd => true, 0x20 => true, 0x85 => true, 0xa0 => true, 0x1680 => true, 0x2000...0x200a => true, 0x2028 => true, 0x2029 => true, 0x202f => true, 0x205f => true, 0x3000 => true, else => false, }; } pub fn indexOfCodePoint(str: u.Txt, scalar: u21) ?usize { var iter = @This(){ .cur = null, .bytes = str }; while (iter.next()) |cp| { if (cp.scalar == scalar) return cp.offset; } return null; }
src/TextIterator.zig
const std = @import("index.zig"); const builtin = @import("builtin"); const io = std.io; const mem = std.mem; const debug = std.debug; const assert = debug.assert; const warn = std.debug.warn; const ArrayList = std.ArrayList; const HashMap = std.HashMap; const Allocator = mem.Allocator; const os = std.os; const StdIo = os.ChildProcess.StdIo; const Term = os.ChildProcess.Term; const BufSet = std.BufSet; const BufMap = std.BufMap; const fmt_lib = std.fmt; pub const Builder = struct { uninstall_tls: TopLevelStep, install_tls: TopLevelStep, have_uninstall_step: bool, have_install_step: bool, allocator: *Allocator, lib_paths: ArrayList([]const u8), include_paths: ArrayList([]const u8), rpaths: ArrayList([]const u8), user_input_options: UserInputOptionsMap, available_options_map: AvailableOptionsMap, available_options_list: ArrayList(AvailableOption), verbose: bool, verbose_tokenize: bool, verbose_ast: bool, verbose_link: bool, verbose_ir: bool, verbose_llvm_ir: bool, verbose_cimport: bool, invalid_user_input: bool, zig_exe: []const u8, default_step: *Step, env_map: *BufMap, top_level_steps: ArrayList(*TopLevelStep), prefix: []const u8, search_prefixes: ArrayList([]const u8), lib_dir: []const u8, exe_dir: []const u8, installed_files: ArrayList([]const u8), build_root: []const u8, cache_root: []const u8, release_mode: ?builtin.Mode, pub const CStd = enum { C89, C99, C11, }; const UserInputOptionsMap = HashMap([]const u8, UserInputOption, mem.hash_slice_u8, mem.eql_slice_u8); const AvailableOptionsMap = HashMap([]const u8, AvailableOption, mem.hash_slice_u8, mem.eql_slice_u8); const AvailableOption = struct { name: []const u8, type_id: TypeId, description: []const u8, }; const UserInputOption = struct { name: []const u8, value: UserValue, used: bool, }; const UserValue = union(enum) { Flag: void, Scalar: []const u8, List: ArrayList([]const u8), }; const TypeId = enum { Bool, Int, Float, String, List, }; const TopLevelStep = struct { step: Step, description: []const u8, }; pub fn init(allocator: *Allocator, zig_exe: []const u8, build_root: []const u8, cache_root: []const u8) Builder { const env_map = allocator.createOne(BufMap) catch unreachable; env_map.* = os.getEnvMap(allocator) catch unreachable; var self = Builder{ .zig_exe = zig_exe, .build_root = build_root, .cache_root = os.path.relative(allocator, build_root, cache_root) catch unreachable, .verbose = false, .verbose_tokenize = false, .verbose_ast = false, .verbose_link = false, .verbose_ir = false, .verbose_llvm_ir = false, .verbose_cimport = false, .invalid_user_input = false, .allocator = allocator, .lib_paths = ArrayList([]const u8).init(allocator), .include_paths = ArrayList([]const u8).init(allocator), .rpaths = ArrayList([]const u8).init(allocator), .user_input_options = UserInputOptionsMap.init(allocator), .available_options_map = AvailableOptionsMap.init(allocator), .available_options_list = ArrayList(AvailableOption).init(allocator), .top_level_steps = ArrayList(*TopLevelStep).init(allocator), .default_step = undefined, .env_map = env_map, .prefix = undefined, .search_prefixes = ArrayList([]const u8).init(allocator), .lib_dir = undefined, .exe_dir = undefined, .installed_files = ArrayList([]const u8).init(allocator), .uninstall_tls = TopLevelStep{ .step = Step.init("uninstall", allocator, makeUninstall), .description = "Remove build artifacts from prefix path", }, .have_uninstall_step = false, .install_tls = TopLevelStep{ .step = Step.initNoOp("install", allocator), .description = "Copy build artifacts to prefix path", }, .have_install_step = false, .release_mode = null, }; self.processNixOSEnvVars(); self.default_step = self.step("default", "Build the project"); return self; } pub fn deinit(self: *Builder) void { self.lib_paths.deinit(); self.include_paths.deinit(); self.rpaths.deinit(); self.env_map.deinit(); self.top_level_steps.deinit(); } pub fn setInstallPrefix(self: *Builder, maybe_prefix: ?[]const u8) void { self.prefix = maybe_prefix orelse "/usr/local"; // TODO better default self.lib_dir = os.path.join(self.allocator, self.prefix, "lib") catch unreachable; self.exe_dir = os.path.join(self.allocator, self.prefix, "bin") catch unreachable; } pub fn addExecutable(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep { return LibExeObjStep.createExecutable(self, name, root_src, false); } pub fn addStaticExecutable(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep { return LibExeObjStep.createExecutable(self, name, root_src, true); } pub fn addObject(self: *Builder, name: []const u8, root_src: []const u8) *LibExeObjStep { return LibExeObjStep.createObject(self, name, root_src); } pub fn addSharedLibrary(self: *Builder, name: []const u8, root_src: ?[]const u8, ver: Version) *LibExeObjStep { return LibExeObjStep.createSharedLibrary(self, name, root_src, ver); } pub fn addStaticLibrary(self: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep { return LibExeObjStep.createStaticLibrary(self, name, root_src); } pub fn addTest(self: *Builder, root_src: []const u8) *TestStep { const test_step = self.allocator.create(TestStep.init(self, root_src)) catch unreachable; return test_step; } pub fn addAssemble(self: *Builder, name: []const u8, src: []const u8) *LibExeObjStep { const obj_step = LibExeObjStep.createObject(self, name, null); obj_step.addAssemblyFile(src); return obj_step; } pub fn addCStaticLibrary(self: *Builder, name: []const u8) *LibExeObjStep { return LibExeObjStep.createCStaticLibrary(self, name); } pub fn addCSharedLibrary(self: *Builder, name: []const u8, ver: Version) *LibExeObjStep { return LibExeObjStep.createCSharedLibrary(self, name, ver); } pub fn addCExecutable(self: *Builder, name: []const u8) *LibExeObjStep { return LibExeObjStep.createCExecutable(self, name); } pub fn addCObject(self: *Builder, name: []const u8, src: []const u8) *LibExeObjStep { return LibExeObjStep.createCObject(self, name, src); } /// ::argv is copied. pub fn addCommand(self: *Builder, cwd: ?[]const u8, env_map: *const BufMap, argv: []const []const u8) *CommandStep { return CommandStep.create(self, cwd, env_map, argv); } pub fn addWriteFile(self: *Builder, file_path: []const u8, data: []const u8) *WriteFileStep { const write_file_step = self.allocator.create(WriteFileStep.init(self, file_path, data)) catch unreachable; return write_file_step; } pub fn addLog(self: *Builder, comptime format: []const u8, args: ...) *LogStep { const data = self.fmt(format, args); const log_step = self.allocator.create(LogStep.init(self, data)) catch unreachable; return log_step; } pub fn addRemoveDirTree(self: *Builder, dir_path: []const u8) *RemoveDirStep { const remove_dir_step = self.allocator.create(RemoveDirStep.init(self, dir_path)) catch unreachable; return remove_dir_step; } pub fn version(self: *const Builder, major: u32, minor: u32, patch: u32) Version { return Version{ .major = major, .minor = minor, .patch = patch, }; } pub fn addCIncludePath(self: *Builder, path: []const u8) void { self.include_paths.append(path) catch unreachable; } pub fn addRPath(self: *Builder, path: []const u8) void { self.rpaths.append(path) catch unreachable; } pub fn addLibPath(self: *Builder, path: []const u8) void { self.lib_paths.append(path) catch unreachable; } pub fn make(self: *Builder, step_names: []const []const u8) !void { try self.makePath(self.cache_root); var wanted_steps = ArrayList(*Step).init(self.allocator); defer wanted_steps.deinit(); if (step_names.len == 0) { try wanted_steps.append(self.default_step); } else { for (step_names) |step_name| { const s = try self.getTopLevelStepByName(step_name); try wanted_steps.append(s); } } for (wanted_steps.toSliceConst()) |s| { try self.makeOneStep(s); } } pub fn getInstallStep(self: *Builder) *Step { if (self.have_install_step) return &self.install_tls.step; self.top_level_steps.append(&self.install_tls) catch unreachable; self.have_install_step = true; return &self.install_tls.step; } pub fn getUninstallStep(self: *Builder) *Step { if (self.have_uninstall_step) return &self.uninstall_tls.step; self.top_level_steps.append(&self.uninstall_tls) catch unreachable; self.have_uninstall_step = true; return &self.uninstall_tls.step; } fn makeUninstall(uninstall_step: *Step) anyerror!void { const uninstall_tls = @fieldParentPtr(TopLevelStep, "step", uninstall_step); const self = @fieldParentPtr(Builder, "uninstall_tls", uninstall_tls); for (self.installed_files.toSliceConst()) |installed_file| { if (self.verbose) { warn("rm {}\n", installed_file); } _ = os.deleteFile(installed_file); } // TODO remove empty directories } fn makeOneStep(self: *Builder, s: *Step) anyerror!void { if (s.loop_flag) { warn("Dependency loop detected:\n {}\n", s.name); return error.DependencyLoopDetected; } s.loop_flag = true; for (s.dependencies.toSlice()) |dep| { self.makeOneStep(dep) catch |err| { if (err == error.DependencyLoopDetected) { warn(" {}\n", s.name); } return err; }; } s.loop_flag = false; try s.make(); } fn getTopLevelStepByName(self: *Builder, name: []const u8) !*Step { for (self.top_level_steps.toSliceConst()) |top_level_step| { if (mem.eql(u8, top_level_step.step.name, name)) { return &top_level_step.step; } } warn("Cannot run step '{}' because it does not exist\n", name); return error.InvalidStepName; } fn processNixOSEnvVars(self: *Builder) void { if (os.getEnvVarOwned(self.allocator, "NIX_CFLAGS_COMPILE")) |nix_cflags_compile| { var it = mem.split(nix_cflags_compile, " "); while (true) { const word = it.next() orelse break; if (mem.eql(u8, word, "-isystem")) { const include_path = it.next() orelse { warn("Expected argument after -isystem in NIX_CFLAGS_COMPILE\n"); break; }; self.addCIncludePath(include_path); } else { warn("Unrecognized C flag from NIX_CFLAGS_COMPILE: {}\n", word); break; } } } else |err| { assert(err == error.EnvironmentVariableNotFound); } if (os.getEnvVarOwned(self.allocator, "NIX_LDFLAGS")) |nix_ldflags| { var it = mem.split(nix_ldflags, " "); while (true) { const word = it.next() orelse break; if (mem.eql(u8, word, "-rpath")) { const rpath = it.next() orelse { warn("Expected argument after -rpath in NIX_LDFLAGS\n"); break; }; self.addRPath(rpath); } else if (word.len > 2 and word[0] == '-' and word[1] == 'L') { const lib_path = word[2..]; self.addLibPath(lib_path); } else { warn("Unrecognized C flag from NIX_LDFLAGS: {}\n", word); break; } } } else |err| { assert(err == error.EnvironmentVariableNotFound); } } pub fn option(self: *Builder, comptime T: type, name: []const u8, description: []const u8) ?T { const type_id = comptime typeToEnum(T); const available_option = AvailableOption{ .name = name, .type_id = type_id, .description = description, }; if ((self.available_options_map.put(name, available_option) catch unreachable) != null) { debug.panic("Option '{}' declared twice", name); } self.available_options_list.append(available_option) catch unreachable; const entry = self.user_input_options.get(name) orelse return null; entry.value.used = true; switch (type_id) { TypeId.Bool => switch (entry.value.value) { UserValue.Flag => return true, UserValue.Scalar => |s| { if (mem.eql(u8, s, "true")) { return true; } else if (mem.eql(u8, s, "false")) { return false; } else { warn("Expected -D{} to be a boolean, but received '{}'\n", name, s); self.markInvalidUserInput(); return null; } }, UserValue.List => { warn("Expected -D{} to be a boolean, but received a list.\n", name); self.markInvalidUserInput(); return null; }, }, TypeId.Int => debug.panic("TODO integer options to build script"), TypeId.Float => debug.panic("TODO float options to build script"), TypeId.String => switch (entry.value.value) { UserValue.Flag => { warn("Expected -D{} to be a string, but received a boolean.\n", name); self.markInvalidUserInput(); return null; }, UserValue.List => { warn("Expected -D{} to be a string, but received a list.\n", name); self.markInvalidUserInput(); return null; }, UserValue.Scalar => |s| return s, }, TypeId.List => debug.panic("TODO list options to build script"), } } pub fn step(self: *Builder, name: []const u8, description: []const u8) *Step { const step_info = self.allocator.create(TopLevelStep{ .step = Step.initNoOp(name, self.allocator), .description = description, }) catch unreachable; self.top_level_steps.append(step_info) catch unreachable; return &step_info.step; } pub fn standardReleaseOptions(self: *Builder) builtin.Mode { if (self.release_mode) |mode| return mode; const release_safe = self.option(bool, "release-safe", "optimizations on and safety on") orelse false; const release_fast = self.option(bool, "release-fast", "optimizations on and safety off") orelse false; const release_small = self.option(bool, "release-small", "size optimizations on and safety off") orelse false; const mode = if (release_safe and !release_fast and !release_small) builtin.Mode.ReleaseSafe else if (release_fast and !release_safe and !release_small) builtin.Mode.ReleaseFast else if (release_small and !release_fast and !release_safe) builtin.Mode.ReleaseSmall else if (!release_fast and !release_safe and !release_small) builtin.Mode.Debug else x: { warn("Multiple release modes (of -Drelease-safe, -Drelease-fast and -Drelease-small)"); self.markInvalidUserInput(); break :x builtin.Mode.Debug; }; self.release_mode = mode; return mode; } pub fn addUserInputOption(self: *Builder, name: []const u8, value: []const u8) !bool { const gop = try self.user_input_options.getOrPut(name); if (!gop.found_existing) { gop.kv.value = UserInputOption{ .name = name, .value = UserValue{ .Scalar = value }, .used = false, }; return false; } // option already exists switch (gop.kv.value.value) { UserValue.Scalar => |s| { // turn it into a list var list = ArrayList([]const u8).init(self.allocator); list.append(s) catch unreachable; list.append(value) catch unreachable; _ = self.user_input_options.put(name, UserInputOption{ .name = name, .value = UserValue{ .List = list }, .used = false, }) catch unreachable; }, UserValue.List => |*list| { // append to the list list.append(value) catch unreachable; _ = self.user_input_options.put(name, UserInputOption{ .name = name, .value = UserValue{ .List = list.* }, .used = false, }) catch unreachable; }, UserValue.Flag => { warn("Option '-D{}={}' conflicts with flag '-D{}'.\n", name, value, name); return true; }, } return false; } pub fn addUserInputFlag(self: *Builder, name: []const u8) !bool { const gop = try self.user_input_options.getOrPut(name); if (!gop.found_existing) { gop.kv.value = UserInputOption{ .name = name, .value = UserValue{ .Flag = {} }, .used = false, }; return false; } // option already exists switch (gop.kv.value.value) { UserValue.Scalar => |s| { warn("Flag '-D{}' conflicts with option '-D{}={}'.\n", name, name, s); return true; }, UserValue.List => { warn("Flag '-D{}' conflicts with multiple options of the same name.\n", name); return true; }, UserValue.Flag => {}, } return false; } fn typeToEnum(comptime T: type) TypeId { return switch (@typeId(T)) { builtin.TypeId.Int => TypeId.Int, builtin.TypeId.Float => TypeId.Float, builtin.TypeId.Bool => TypeId.Bool, else => switch (T) { []const u8 => TypeId.String, []const []const u8 => TypeId.List, else => @compileError("Unsupported type: " ++ @typeName(T)), }, }; } fn markInvalidUserInput(self: *Builder) void { self.invalid_user_input = true; } pub fn typeIdName(id: TypeId) []const u8 { return switch (id) { TypeId.Bool => "bool", TypeId.Int => "int", TypeId.Float => "float", TypeId.String => "string", TypeId.List => "list", }; } pub fn validateUserInputDidItFail(self: *Builder) bool { // make sure all args are used var it = self.user_input_options.iterator(); while (true) { const entry = it.next() orelse break; if (!entry.value.used) { warn("Invalid option: -D{}\n\n", entry.key); self.markInvalidUserInput(); } } return self.invalid_user_input; } fn spawnChild(self: *Builder, argv: []const []const u8) !void { return self.spawnChildEnvMap(null, self.env_map, argv); } fn printCmd(cwd: ?[]const u8, argv: []const []const u8) void { if (cwd) |yes_cwd| warn("cd {} && ", yes_cwd); for (argv) |arg| { warn("{} ", arg); } warn("\n"); } fn spawnChildEnvMap(self: *Builder, cwd: ?[]const u8, env_map: *const BufMap, argv: []const []const u8) !void { if (self.verbose) { printCmd(cwd, argv); } const child = os.ChildProcess.init(argv, self.allocator) catch unreachable; defer child.deinit(); child.cwd = cwd; child.env_map = env_map; const term = child.spawnAndWait() catch |err| { warn("Unable to spawn {}: {}\n", argv[0], @errorName(err)); return err; }; switch (term) { Term.Exited => |code| { if (code != 0) { warn("The following command exited with error code {}:\n", code); printCmd(cwd, argv); return error.UncleanExit; } }, else => { warn("The following command terminated unexpectedly:\n"); printCmd(cwd, argv); return error.UncleanExit; }, } } pub fn makePath(self: *Builder, path: []const u8) !void { os.makePath(self.allocator, self.pathFromRoot(path)) catch |err| { warn("Unable to create path {}: {}\n", path, @errorName(err)); return err; }; } pub fn installArtifact(self: *Builder, artifact: *LibExeObjStep) void { self.getInstallStep().dependOn(&self.addInstallArtifact(artifact).step); } pub fn addInstallArtifact(self: *Builder, artifact: *LibExeObjStep) *InstallArtifactStep { return InstallArtifactStep.create(self, artifact); } ///::dest_rel_path is relative to prefix path or it can be an absolute path pub fn installFile(self: *Builder, src_path: []const u8, dest_rel_path: []const u8) void { self.getInstallStep().dependOn(&self.addInstallFile(src_path, dest_rel_path).step); } ///::dest_rel_path is relative to prefix path or it can be an absolute path pub fn addInstallFile(self: *Builder, src_path: []const u8, dest_rel_path: []const u8) *InstallFileStep { const full_dest_path = os.path.resolve(self.allocator, self.prefix, dest_rel_path) catch unreachable; self.pushInstalledFile(full_dest_path); const install_step = self.allocator.create(InstallFileStep.init(self, src_path, full_dest_path)) catch unreachable; return install_step; } pub fn pushInstalledFile(self: *Builder, full_path: []const u8) void { _ = self.getUninstallStep(); self.installed_files.append(full_path) catch unreachable; } fn copyFile(self: *Builder, source_path: []const u8, dest_path: []const u8) !void { return self.copyFileMode(source_path, dest_path, os.File.default_mode); } fn copyFileMode(self: *Builder, source_path: []const u8, dest_path: []const u8, mode: os.File.Mode) !void { if (self.verbose) { warn("cp {} {}\n", source_path, dest_path); } const dirname = os.path.dirname(dest_path) orelse "."; const abs_source_path = self.pathFromRoot(source_path); os.makePath(self.allocator, dirname) catch |err| { warn("Unable to create path {}: {}\n", dirname, @errorName(err)); return err; }; os.copyFileMode(abs_source_path, dest_path, mode) catch |err| { warn("Unable to copy {} to {}: {}\n", abs_source_path, dest_path, @errorName(err)); return err; }; } fn pathFromRoot(self: *Builder, rel_path: []const u8) []u8 { return os.path.resolve(self.allocator, self.build_root, rel_path) catch unreachable; } pub fn fmt(self: *Builder, comptime format: []const u8, args: ...) []u8 { return fmt_lib.allocPrint(self.allocator, format, args) catch unreachable; } fn getCCExe(self: *Builder) []const u8 { if (builtin.environ == builtin.Environ.msvc) { return "cl.exe"; } else { return os.getEnvVarOwned(self.allocator, "CC") catch |err| if (err == error.EnvironmentVariableNotFound) ([]const u8)("cc") else debug.panic("Unable to get environment variable: {}", err); } } pub fn findProgram(self: *Builder, names: []const []const u8, paths: []const []const u8) ![]const u8 { // TODO report error for ambiguous situations const exe_extension = (Target{ .Native = {} }).exeFileExt(); for (self.search_prefixes.toSliceConst()) |search_prefix| { for (names) |name| { if (os.path.isAbsolute(name)) { return name; } const full_path = try os.path.join(self.allocator, search_prefix, "bin", self.fmt("{}{}", name, exe_extension)); if (os.path.real(self.allocator, full_path)) |real_path| { return real_path; } else |_| { continue; } } } if (self.env_map.get("PATH")) |PATH| { for (names) |name| { if (os.path.isAbsolute(name)) { return name; } var it = mem.split(PATH, []u8{os.path.delimiter}); while (it.next()) |path| { const full_path = try os.path.join(self.allocator, path, self.fmt("{}{}", name, exe_extension)); if (os.path.real(self.allocator, full_path)) |real_path| { return real_path; } else |_| { continue; } } } } for (names) |name| { if (os.path.isAbsolute(name)) { return name; } for (paths) |path| { const full_path = try os.path.join(self.allocator, path, self.fmt("{}{}", name, exe_extension)); if (os.path.real(self.allocator, full_path)) |real_path| { return real_path; } else |_| { continue; } } } return error.FileNotFound; } pub fn exec(self: *Builder, argv: []const []const u8) ![]u8 { const max_output_size = 100 * 1024; const result = try os.ChildProcess.exec(self.allocator, argv, null, null, max_output_size); switch (result.term) { os.ChildProcess.Term.Exited => |code| { if (code != 0) { warn("The following command exited with error code {}:\n", code); printCmd(null, argv); warn("stderr:{}\n", result.stderr); std.debug.panic("command failed"); } return result.stdout; }, else => { warn("The following command terminated unexpectedly:\n"); printCmd(null, argv); warn("stderr:{}\n", result.stderr); std.debug.panic("command failed"); }, } } pub fn addSearchPrefix(self: *Builder, search_prefix: []const u8) void { self.search_prefixes.append(search_prefix) catch unreachable; } }; const Version = struct { major: u32, minor: u32, patch: u32, }; const CrossTarget = struct { arch: builtin.Arch, os: builtin.Os, environ: builtin.Environ, }; pub const Target = union(enum) { Native: void, Cross: CrossTarget, pub fn oFileExt(self: *const Target) []const u8 { const environ = switch (self.*) { Target.Native => builtin.environ, Target.Cross => |t| t.environ, }; return switch (environ) { builtin.Environ.msvc => ".obj", else => ".o", }; } pub fn exeFileExt(self: *const Target) []const u8 { return switch (self.getOs()) { builtin.Os.windows => ".exe", else => "", }; } pub fn libFileExt(self: *const Target) []const u8 { return switch (self.getOs()) { builtin.Os.windows => ".lib", else => ".a", }; } pub fn getOs(self: *const Target) builtin.Os { return switch (self.*) { Target.Native => builtin.os, Target.Cross => |t| t.os, }; } pub fn isDarwin(self: *const Target) bool { return switch (self.getOs()) { builtin.Os.ios, builtin.Os.macosx => true, else => false, }; } pub fn isWindows(self: *const Target) bool { return switch (self.getOs()) { builtin.Os.windows => true, else => false, }; } pub fn isFreeBSD(self: *const Target) bool { return switch (self.getOs()) { builtin.Os.freebsd => true, else => false, }; } pub fn wantSharedLibSymLinks(self: *const Target) bool { return !self.isWindows(); } }; const Pkg = struct { name: []const u8, path: []const u8, }; pub const LibExeObjStep = struct { step: Step, builder: *Builder, name: []const u8, target: Target, link_libs: BufSet, linker_script: ?[]const u8, out_filename: []const u8, output_path: ?[]const u8, static: bool, version: Version, object_files: ArrayList([]const u8), build_mode: builtin.Mode, kind: Kind, major_only_filename: []const u8, name_only_filename: []const u8, strip: bool, full_path_libs: ArrayList([]const u8), need_flat_namespace_hack: bool, is_zig: bool, cflags: ArrayList([]const u8), include_dirs: ArrayList([]const u8), lib_paths: ArrayList([]const u8), disable_libc: bool, frameworks: BufSet, verbose_link: bool, no_rosegment: bool, c_std: Builder.CStd, // zig only stuff root_src: ?[]const u8, output_h_path: ?[]const u8, out_h_filename: []const u8, assembly_files: ArrayList([]const u8), packages: ArrayList(Pkg), build_options_contents: std.Buffer, system_linker_hack: bool, // C only stuff source_files: ArrayList([]const u8), object_src: []const u8, const Kind = enum { Exe, Lib, Obj, }; pub fn createSharedLibrary(builder: *Builder, name: []const u8, root_src: ?[]const u8, ver: Version) *LibExeObjStep { const self = builder.allocator.create(initExtraArgs(builder, name, root_src, Kind.Lib, false, ver)) catch unreachable; return self; } pub fn createCSharedLibrary(builder: *Builder, name: []const u8, version: Version) *LibExeObjStep { const self = builder.allocator.create(initC(builder, name, Kind.Lib, version, false)) catch unreachable; return self; } pub fn createStaticLibrary(builder: *Builder, name: []const u8, root_src: ?[]const u8) *LibExeObjStep { const self = builder.allocator.create(initExtraArgs(builder, name, root_src, Kind.Lib, true, builder.version(0, 0, 0))) catch unreachable; return self; } pub fn createCStaticLibrary(builder: *Builder, name: []const u8) *LibExeObjStep { const self = builder.allocator.create(initC(builder, name, Kind.Lib, builder.version(0, 0, 0), true)) catch unreachable; return self; } pub fn createObject(builder: *Builder, name: []const u8, root_src: []const u8) *LibExeObjStep { const self = builder.allocator.create(initExtraArgs(builder, name, root_src, Kind.Obj, false, builder.version(0, 0, 0))) catch unreachable; return self; } pub fn createCObject(builder: *Builder, name: []const u8, src: []const u8) *LibExeObjStep { const self = builder.allocator.create(initC(builder, name, Kind.Obj, builder.version(0, 0, 0), false)) catch unreachable; self.object_src = src; return self; } pub fn createExecutable(builder: *Builder, name: []const u8, root_src: ?[]const u8, static: bool) *LibExeObjStep { const self = builder.allocator.create(initExtraArgs(builder, name, root_src, Kind.Exe, static, builder.version(0, 0, 0))) catch unreachable; return self; } pub fn createCExecutable(builder: *Builder, name: []const u8) *LibExeObjStep { const self = builder.allocator.create(initC(builder, name, Kind.Exe, builder.version(0, 0, 0), false)) catch unreachable; return self; } fn initExtraArgs(builder: *Builder, name: []const u8, root_src: ?[]const u8, kind: Kind, static: bool, ver: Version) LibExeObjStep { var self = LibExeObjStep{ .no_rosegment = false, .strip = false, .builder = builder, .verbose_link = false, .build_mode = builtin.Mode.Debug, .static = static, .kind = kind, .root_src = root_src, .name = name, .target = Target.Native, .linker_script = null, .link_libs = BufSet.init(builder.allocator), .frameworks = BufSet.init(builder.allocator), .step = Step.init(name, builder.allocator, make), .output_path = null, .output_h_path = null, .version = ver, .out_filename = undefined, .out_h_filename = builder.fmt("{}.h", name), .major_only_filename = undefined, .name_only_filename = undefined, .object_files = ArrayList([]const u8).init(builder.allocator), .assembly_files = ArrayList([]const u8).init(builder.allocator), .packages = ArrayList(Pkg).init(builder.allocator), .is_zig = true, .full_path_libs = ArrayList([]const u8).init(builder.allocator), .need_flat_namespace_hack = false, .cflags = ArrayList([]const u8).init(builder.allocator), .source_files = undefined, .include_dirs = ArrayList([]const u8).init(builder.allocator), .lib_paths = ArrayList([]const u8).init(builder.allocator), .object_src = undefined, .disable_libc = true, .build_options_contents = std.Buffer.initSize(builder.allocator, 0) catch unreachable, .c_std = Builder.CStd.C99, .system_linker_hack = false, }; self.computeOutFileNames(); return self; } fn initC(builder: *Builder, name: []const u8, kind: Kind, version: Version, static: bool) LibExeObjStep { var self = LibExeObjStep{ .no_rosegment = false, .builder = builder, .name = name, .kind = kind, .version = version, .static = static, .target = Target.Native, .cflags = ArrayList([]const u8).init(builder.allocator), .source_files = ArrayList([]const u8).init(builder.allocator), .object_files = ArrayList([]const u8).init(builder.allocator), .step = Step.init(name, builder.allocator, make), .link_libs = BufSet.init(builder.allocator), .frameworks = BufSet.init(builder.allocator), .full_path_libs = ArrayList([]const u8).init(builder.allocator), .include_dirs = ArrayList([]const u8).init(builder.allocator), .lib_paths = ArrayList([]const u8).init(builder.allocator), .output_path = null, .out_filename = undefined, .major_only_filename = undefined, .name_only_filename = undefined, .object_src = undefined, .build_mode = builtin.Mode.Debug, .strip = false, .need_flat_namespace_hack = false, .disable_libc = false, .is_zig = false, .linker_script = null, .c_std = Builder.CStd.C99, .system_linker_hack = false, .root_src = undefined, .verbose_link = false, .output_h_path = undefined, .out_h_filename = undefined, .assembly_files = undefined, .packages = undefined, .build_options_contents = undefined, }; self.computeOutFileNames(); return self; } pub fn setNoRoSegment(self: *LibExeObjStep, value: bool) void { self.no_rosegment = value; } fn computeOutFileNames(self: *LibExeObjStep) void { switch (self.kind) { Kind.Obj => { self.out_filename = self.builder.fmt("{}{}", self.name, self.target.oFileExt()); }, Kind.Exe => { self.out_filename = self.builder.fmt("{}{}", self.name, self.target.exeFileExt()); }, Kind.Lib => { if (self.static) { self.out_filename = self.builder.fmt("lib{}.a", self.name); } else { switch (self.target.getOs()) { builtin.Os.ios, builtin.Os.macosx => { self.out_filename = self.builder.fmt("lib{}.{d}.{d}.{d}.dylib", self.name, self.version.major, self.version.minor, self.version.patch); self.major_only_filename = self.builder.fmt("lib{}.{d}.dylib", self.name, self.version.major); self.name_only_filename = self.builder.fmt("lib{}.dylib", self.name); }, builtin.Os.windows => { self.out_filename = self.builder.fmt("{}.dll", self.name); }, else => { self.out_filename = self.builder.fmt("lib{}.so.{d}.{d}.{d}", self.name, self.version.major, self.version.minor, self.version.patch); self.major_only_filename = self.builder.fmt("lib{}.so.{d}", self.name, self.version.major); self.name_only_filename = self.builder.fmt("lib{}.so", self.name); }, } } }, } } pub fn setTarget(self: *LibExeObjStep, target_arch: builtin.Arch, target_os: builtin.Os, target_environ: builtin.Environ) void { self.target = Target{ .Cross = CrossTarget{ .arch = target_arch, .os = target_os, .environ = target_environ, }, }; self.computeOutFileNames(); } // TODO respect this in the C args pub fn setLinkerScriptPath(self: *LibExeObjStep, path: []const u8) void { self.linker_script = path; } pub fn linkFramework(self: *LibExeObjStep, framework_name: []const u8) void { assert(self.target.isDarwin()); self.frameworks.put(framework_name) catch unreachable; } pub fn linkLibrary(self: *LibExeObjStep, lib: *LibExeObjStep) void { assert(self.kind != Kind.Obj); assert(lib.kind == Kind.Lib); self.step.dependOn(&lib.step); self.full_path_libs.append(lib.getOutputPath()) catch unreachable; // TODO should be some kind of isolated directory that only has this header in it self.include_dirs.append(self.builder.cache_root) catch unreachable; self.need_flat_namespace_hack = true; // inherit the object's frameworks if (self.target.isDarwin() and lib.static) { var it = lib.frameworks.iterator(); while (it.next()) |entry| { self.frameworks.put(entry.key) catch unreachable; } } } pub fn linkSystemLibrary(self: *LibExeObjStep, name: []const u8) void { assert(self.kind != Kind.Obj); self.link_libs.put(name) catch unreachable; } pub fn addSourceFile(self: *LibExeObjStep, file: []const u8) void { assert(self.kind != Kind.Obj); assert(!self.is_zig); self.source_files.append(file) catch unreachable; } pub fn setVerboseLink(self: *LibExeObjStep, value: bool) void { self.verbose_link = value; } pub fn setBuildMode(self: *LibExeObjStep, mode: builtin.Mode) void { self.build_mode = mode; } pub fn setOutputPath(self: *LibExeObjStep, file_path: []const u8) void { self.output_path = file_path; // catch a common mistake if (mem.eql(u8, self.builder.pathFromRoot(file_path), self.builder.pathFromRoot("."))) { debug.panic("setOutputPath wants a file path, not a directory\n"); } } pub fn getOutputPath(self: *LibExeObjStep) []const u8 { return if (self.output_path) |output_path| output_path else os.path.join(self.builder.allocator, self.builder.cache_root, self.out_filename) catch unreachable; } pub fn setOutputHPath(self: *LibExeObjStep, file_path: []const u8) void { self.output_h_path = file_path; // catch a common mistake if (mem.eql(u8, self.builder.pathFromRoot(file_path), self.builder.pathFromRoot("."))) { debug.panic("setOutputHPath wants a file path, not a directory\n"); } } pub fn getOutputHPath(self: *LibExeObjStep) []const u8 { return if (self.output_h_path) |output_h_path| output_h_path else os.path.join(self.builder.allocator, self.builder.cache_root, self.out_h_filename) catch unreachable; } pub fn addAssemblyFile(self: *LibExeObjStep, path: []const u8) void { self.assembly_files.append(path) catch unreachable; } pub fn addObjectFile(self: *LibExeObjStep, path: []const u8) void { assert(self.kind != Kind.Obj); self.object_files.append(path) catch unreachable; } pub fn addObject(self: *LibExeObjStep, obj: *LibExeObjStep) void { assert(obj.kind == Kind.Obj); assert(self.kind != Kind.Obj); self.step.dependOn(&obj.step); self.object_files.append(obj.getOutputPath()) catch unreachable; // TODO make this lazy instead of stateful if (!obj.disable_libc) { self.disable_libc = false; } // TODO should be some kind of isolated directory that only has this header in it self.include_dirs.append(self.builder.cache_root) catch unreachable; } pub fn addBuildOption(self: *LibExeObjStep, comptime T: type, name: []const u8, value: T) void { assert(self.is_zig); const out = &std.io.BufferOutStream.init(&self.build_options_contents).stream; out.print("pub const {} = {};\n", name, value) catch unreachable; } pub fn addIncludeDir(self: *LibExeObjStep, path: []const u8) void { self.include_dirs.append(path) catch unreachable; } pub fn addLibPath(self: *LibExeObjStep, path: []const u8) void { self.lib_paths.append(path) catch unreachable; } pub fn addPackagePath(self: *LibExeObjStep, name: []const u8, pkg_index_path: []const u8) void { assert(self.is_zig); self.packages.append(Pkg{ .name = name, .path = pkg_index_path, }) catch unreachable; } pub fn addCompileFlags(self: *LibExeObjStep, flags: []const []const u8) void { for (flags) |flag| { self.cflags.append(flag) catch unreachable; } } pub fn setNoStdLib(self: *LibExeObjStep, disable: bool) void { assert(!self.is_zig); self.disable_libc = disable; } pub fn enableSystemLinkerHack(self: *LibExeObjStep) void { self.system_linker_hack = true; } fn make(step: *Step) !void { const self = @fieldParentPtr(LibExeObjStep, "step", step); return if (self.is_zig) self.makeZig() else self.makeC(); } fn makeZig(self: *LibExeObjStep) !void { const builder = self.builder; assert(self.is_zig); if (self.root_src == null and self.object_files.len == 0 and self.assembly_files.len == 0) { warn("{}: linker needs 1 or more objects to link\n", self.step.name); return error.NeedAnObject; } var zig_args = ArrayList([]const u8).init(builder.allocator); defer zig_args.deinit(); zig_args.append(builder.zig_exe) catch unreachable; const cmd = switch (self.kind) { Kind.Lib => "build-lib", Kind.Exe => "build-exe", Kind.Obj => "build-obj", }; zig_args.append(cmd) catch unreachable; if (self.root_src) |root_src| { zig_args.append(builder.pathFromRoot(root_src)) catch unreachable; } if (self.build_options_contents.len() > 0) { const build_options_file = try os.path.join(builder.allocator, builder.cache_root, builder.fmt("{}_build_options.zig", self.name)); try std.io.writeFile(build_options_file, self.build_options_contents.toSliceConst()); try zig_args.append("--pkg-begin"); try zig_args.append("build_options"); try zig_args.append(builder.pathFromRoot(build_options_file)); try zig_args.append("--pkg-end"); } for (self.object_files.toSliceConst()) |object_file| { zig_args.append("--object") catch unreachable; zig_args.append(builder.pathFromRoot(object_file)) catch unreachable; } for (self.assembly_files.toSliceConst()) |asm_file| { zig_args.append("--assembly") catch unreachable; zig_args.append(builder.pathFromRoot(asm_file)) catch unreachable; } if (builder.verbose_tokenize) zig_args.append("--verbose-tokenize") catch unreachable; if (builder.verbose_ast) zig_args.append("--verbose-ast") catch unreachable; if (builder.verbose_cimport) zig_args.append("--verbose-cimport") catch unreachable; if (builder.verbose_ir) zig_args.append("--verbose-ir") catch unreachable; if (builder.verbose_llvm_ir) zig_args.append("--verbose-llvm-ir") catch unreachable; if (builder.verbose_link or self.verbose_link) zig_args.append("--verbose-link") catch unreachable; if (self.strip) { zig_args.append("--strip") catch unreachable; } switch (self.build_mode) { builtin.Mode.Debug => {}, builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable, builtin.Mode.ReleaseFast => zig_args.append("--release-fast") catch unreachable, builtin.Mode.ReleaseSmall => zig_args.append("--release-small") catch unreachable, } zig_args.append("--cache-dir") catch unreachable; zig_args.append(builder.pathFromRoot(builder.cache_root)) catch unreachable; const output_path = builder.pathFromRoot(self.getOutputPath()); zig_args.append("--output") catch unreachable; zig_args.append(output_path) catch unreachable; if (self.kind != Kind.Exe) { const output_h_path = self.getOutputHPath(); zig_args.append("--output-h") catch unreachable; zig_args.append(builder.pathFromRoot(output_h_path)) catch unreachable; } zig_args.append("--name") catch unreachable; zig_args.append(self.name) catch unreachable; if (self.kind == Kind.Lib and !self.static) { zig_args.append("--ver-major") catch unreachable; zig_args.append(builder.fmt("{}", self.version.major)) catch unreachable; zig_args.append("--ver-minor") catch unreachable; zig_args.append(builder.fmt("{}", self.version.minor)) catch unreachable; zig_args.append("--ver-patch") catch unreachable; zig_args.append(builder.fmt("{}", self.version.patch)) catch unreachable; } if (self.kind == Kind.Exe and self.static) { zig_args.append("--static") catch unreachable; } switch (self.target) { Target.Native => {}, Target.Cross => |cross_target| { zig_args.append("--target-arch") catch unreachable; zig_args.append(@tagName(cross_target.arch)) catch unreachable; zig_args.append("--target-os") catch unreachable; zig_args.append(@tagName(cross_target.os)) catch unreachable; zig_args.append("--target-environ") catch unreachable; zig_args.append(@tagName(cross_target.environ)) catch unreachable; }, } if (self.linker_script) |linker_script| { zig_args.append("--linker-script") catch unreachable; zig_args.append(linker_script) catch unreachable; } { var it = self.link_libs.iterator(); while (true) { const entry = it.next() orelse break; zig_args.append("--library") catch unreachable; zig_args.append(entry.key) catch unreachable; } } if (!self.disable_libc) { zig_args.append("--library") catch unreachable; zig_args.append("c") catch unreachable; } for (self.packages.toSliceConst()) |pkg| { zig_args.append("--pkg-begin") catch unreachable; zig_args.append(pkg.name) catch unreachable; zig_args.append(builder.pathFromRoot(pkg.path)) catch unreachable; zig_args.append("--pkg-end") catch unreachable; } for (self.include_dirs.toSliceConst()) |include_path| { zig_args.append("-isystem") catch unreachable; zig_args.append(self.builder.pathFromRoot(include_path)) catch unreachable; } for (builder.include_paths.toSliceConst()) |include_path| { zig_args.append("-isystem") catch unreachable; zig_args.append(builder.pathFromRoot(include_path)) catch unreachable; } for (builder.rpaths.toSliceConst()) |rpath| { zig_args.append("-rpath") catch unreachable; zig_args.append(rpath) catch unreachable; } for (self.lib_paths.toSliceConst()) |lib_path| { zig_args.append("--library-path") catch unreachable; zig_args.append(lib_path) catch unreachable; } for (builder.lib_paths.toSliceConst()) |lib_path| { zig_args.append("--library-path") catch unreachable; zig_args.append(lib_path) catch unreachable; } for (self.full_path_libs.toSliceConst()) |full_path_lib| { zig_args.append("--library") catch unreachable; zig_args.append(builder.pathFromRoot(full_path_lib)) catch unreachable; } if (self.target.isDarwin()) { var it = self.frameworks.iterator(); while (it.next()) |entry| { zig_args.append("-framework") catch unreachable; zig_args.append(entry.key) catch unreachable; } } if (self.no_rosegment) { try zig_args.append("--no-rosegment"); } if (self.system_linker_hack) { try zig_args.append("--system-linker-hack"); } try builder.spawnChild(zig_args.toSliceConst()); if (self.kind == Kind.Lib and !self.static and self.target.wantSharedLibSymLinks()) { try doAtomicSymLinks(builder.allocator, output_path, self.major_only_filename, self.name_only_filename); } } fn appendCompileFlags(self: *LibExeObjStep, args: *ArrayList([]const u8)) void { if (!self.strip) { args.append("-g") catch unreachable; } switch (self.build_mode) { builtin.Mode.Debug => { if (self.disable_libc) { args.append("-fno-stack-protector") catch unreachable; } else { args.append("-fstack-protector-strong") catch unreachable; args.append("--param") catch unreachable; args.append("ssp-buffer-size=4") catch unreachable; } }, builtin.Mode.ReleaseSafe => { args.append("-O2") catch unreachable; if (self.disable_libc) { args.append("-fno-stack-protector") catch unreachable; } else { args.append("-D_FORTIFY_SOURCE=2") catch unreachable; args.append("-fstack-protector-strong") catch unreachable; args.append("--param") catch unreachable; args.append("ssp-buffer-size=4") catch unreachable; } }, builtin.Mode.ReleaseFast, builtin.Mode.ReleaseSmall => { args.append("-O2") catch unreachable; args.append("-fno-stack-protector") catch unreachable; }, } for (self.include_dirs.toSliceConst()) |dir| { args.append("-I") catch unreachable; args.append(self.builder.pathFromRoot(dir)) catch unreachable; } for (self.cflags.toSliceConst()) |cflag| { args.append(cflag) catch unreachable; } if (self.disable_libc) { args.append("-nostdlib") catch unreachable; } } fn makeC(self: *LibExeObjStep) !void { const builder = self.builder; const cc = builder.getCCExe(); assert(!self.is_zig); var cc_args = ArrayList([]const u8).init(builder.allocator); defer cc_args.deinit(); cc_args.append(cc) catch unreachable; const is_darwin = self.target.isDarwin(); const c_std_arg = switch (self.c_std) { Builder.CStd.C89 => "-std=c89", Builder.CStd.C99 => "-std=c99", Builder.CStd.C11 => "-std=c11", }; try cc_args.append(c_std_arg); switch (self.kind) { Kind.Obj => { cc_args.append("-c") catch unreachable; cc_args.append(builder.pathFromRoot(self.object_src)) catch unreachable; const output_path = builder.pathFromRoot(self.getOutputPath()); cc_args.append("-o") catch unreachable; cc_args.append(output_path) catch unreachable; self.appendCompileFlags(&cc_args); try builder.spawnChild(cc_args.toSliceConst()); }, Kind.Lib => { for (self.source_files.toSliceConst()) |source_file| { cc_args.resize(0) catch unreachable; cc_args.append(cc) catch unreachable; if (!self.static) { cc_args.append("-fPIC") catch unreachable; } const abs_source_file = builder.pathFromRoot(source_file); cc_args.append("-c") catch unreachable; cc_args.append(abs_source_file) catch unreachable; const cache_o_src = os.path.join(builder.allocator, builder.cache_root, source_file) catch unreachable; if (os.path.dirname(cache_o_src)) |cache_o_dir| { try builder.makePath(cache_o_dir); } const cache_o_file = builder.fmt("{}{}", cache_o_src, self.target.oFileExt()); cc_args.append("-o") catch unreachable; cc_args.append(builder.pathFromRoot(cache_o_file)) catch unreachable; self.appendCompileFlags(&cc_args); try builder.spawnChild(cc_args.toSliceConst()); self.object_files.append(cache_o_file) catch unreachable; } if (self.static) { // ar cc_args.resize(0) catch unreachable; cc_args.append("ar") catch unreachable; cc_args.append("qc") catch unreachable; const output_path = builder.pathFromRoot(self.getOutputPath()); cc_args.append(output_path) catch unreachable; for (self.object_files.toSliceConst()) |object_file| { cc_args.append(builder.pathFromRoot(object_file)) catch unreachable; } try builder.spawnChild(cc_args.toSliceConst()); // ranlib cc_args.resize(0) catch unreachable; cc_args.append("ranlib") catch unreachable; cc_args.append(output_path) catch unreachable; try builder.spawnChild(cc_args.toSliceConst()); } else { cc_args.resize(0) catch unreachable; cc_args.append(cc) catch unreachable; if (is_darwin) { cc_args.append("-dynamiclib") catch unreachable; cc_args.append("-Wl,-headerpad_max_install_names") catch unreachable; cc_args.append("-compatibility_version") catch unreachable; cc_args.append(builder.fmt("{}.0.0", self.version.major)) catch unreachable; cc_args.append("-current_version") catch unreachable; cc_args.append(builder.fmt("{}.{}.{}", self.version.major, self.version.minor, self.version.patch)) catch unreachable; const install_name = builder.pathFromRoot(os.path.join(builder.allocator, builder.cache_root, self.major_only_filename) catch unreachable); cc_args.append("-install_name") catch unreachable; cc_args.append(install_name) catch unreachable; } else { cc_args.append("-fPIC") catch unreachable; cc_args.append("-shared") catch unreachable; const soname_arg = builder.fmt("-Wl,-soname,lib{}.so.{d}", self.name, self.version.major); defer builder.allocator.free(soname_arg); cc_args.append(soname_arg) catch unreachable; } const output_path = builder.pathFromRoot(self.getOutputPath()); cc_args.append("-o") catch unreachable; cc_args.append(output_path) catch unreachable; for (self.object_files.toSliceConst()) |object_file| { cc_args.append(builder.pathFromRoot(object_file)) catch unreachable; } if (!is_darwin) { const rpath_arg = builder.fmt("-Wl,-rpath,{}", try os.path.realAlloc( builder.allocator, builder.pathFromRoot(builder.cache_root), )); defer builder.allocator.free(rpath_arg); try cc_args.append(rpath_arg); try cc_args.append("-rdynamic"); } for (self.full_path_libs.toSliceConst()) |full_path_lib| { cc_args.append(builder.pathFromRoot(full_path_lib)) catch unreachable; } { var it = self.link_libs.iterator(); while (it.next()) |entry| { cc_args.append(builder.fmt("-l{}", entry.key)) catch unreachable; } } if (is_darwin and !self.static) { var it = self.frameworks.iterator(); while (it.next()) |entry| { cc_args.append("-framework") catch unreachable; cc_args.append(entry.key) catch unreachable; } } try builder.spawnChild(cc_args.toSliceConst()); if (self.target.wantSharedLibSymLinks()) { try doAtomicSymLinks(builder.allocator, output_path, self.major_only_filename, self.name_only_filename); } } }, Kind.Exe => { for (self.source_files.toSliceConst()) |source_file| { cc_args.resize(0) catch unreachable; cc_args.append(cc) catch unreachable; const abs_source_file = builder.pathFromRoot(source_file); cc_args.append("-c") catch unreachable; cc_args.append(abs_source_file) catch unreachable; const cache_o_src = os.path.join(builder.allocator, builder.cache_root, source_file) catch unreachable; if (os.path.dirname(cache_o_src)) |cache_o_dir| { try builder.makePath(cache_o_dir); } const cache_o_file = builder.fmt("{}{}", cache_o_src, self.target.oFileExt()); cc_args.append("-o") catch unreachable; cc_args.append(builder.pathFromRoot(cache_o_file)) catch unreachable; for (self.cflags.toSliceConst()) |cflag| { cc_args.append(cflag) catch unreachable; } for (self.include_dirs.toSliceConst()) |dir| { cc_args.append("-I") catch unreachable; cc_args.append(builder.pathFromRoot(dir)) catch unreachable; } try builder.spawnChild(cc_args.toSliceConst()); self.object_files.append(cache_o_file) catch unreachable; } cc_args.resize(0) catch unreachable; cc_args.append(cc) catch unreachable; for (self.object_files.toSliceConst()) |object_file| { cc_args.append(builder.pathFromRoot(object_file)) catch unreachable; } const output_path = builder.pathFromRoot(self.getOutputPath()); cc_args.append("-o") catch unreachable; cc_args.append(output_path) catch unreachable; const rpath_arg = builder.fmt("-Wl,-rpath,{}", try os.path.realAlloc( builder.allocator, builder.pathFromRoot(builder.cache_root), )); defer builder.allocator.free(rpath_arg); try cc_args.append(rpath_arg); try cc_args.append("-rdynamic"); { var it = self.link_libs.iterator(); while (it.next()) |entry| { cc_args.append(builder.fmt("-l{}", entry.key)) catch unreachable; } } if (is_darwin) { if (self.need_flat_namespace_hack) { cc_args.append("-Wl,-flat_namespace") catch unreachable; } cc_args.append("-Wl,-search_paths_first") catch unreachable; } for (self.full_path_libs.toSliceConst()) |full_path_lib| { cc_args.append(builder.pathFromRoot(full_path_lib)) catch unreachable; } if (is_darwin) { var it = self.frameworks.iterator(); while (it.next()) |entry| { cc_args.append("-framework") catch unreachable; cc_args.append(entry.key) catch unreachable; } } try builder.spawnChild(cc_args.toSliceConst()); }, } } }; pub const TestStep = struct { step: Step, builder: *Builder, root_src: []const u8, build_mode: builtin.Mode, verbose: bool, link_libs: BufSet, name_prefix: []const u8, filter: ?[]const u8, target: Target, exec_cmd_args: ?[]const ?[]const u8, include_dirs: ArrayList([]const u8), lib_paths: ArrayList([]const u8), packages: ArrayList(Pkg), object_files: ArrayList([]const u8), no_rosegment: bool, output_path: ?[]const u8, system_linker_hack: bool, pub fn init(builder: *Builder, root_src: []const u8) TestStep { const step_name = builder.fmt("test {}", root_src); return TestStep{ .step = Step.init(step_name, builder.allocator, make), .builder = builder, .root_src = root_src, .build_mode = builtin.Mode.Debug, .verbose = false, .name_prefix = "", .filter = null, .link_libs = BufSet.init(builder.allocator), .target = Target{ .Native = {} }, .exec_cmd_args = null, .include_dirs = ArrayList([]const u8).init(builder.allocator), .lib_paths = ArrayList([]const u8).init(builder.allocator), .packages = ArrayList(Pkg).init(builder.allocator), .object_files = ArrayList([]const u8).init(builder.allocator), .no_rosegment = false, .output_path = null, .system_linker_hack = false, }; } pub fn setNoRoSegment(self: *TestStep, value: bool) void { self.no_rosegment = value; } pub fn addLibPath(self: *TestStep, path: []const u8) void { self.lib_paths.append(path) catch unreachable; } pub fn addPackagePath(self: *TestStep, name: []const u8, pkg_index_path: []const u8) void { self.packages.append(Pkg{ .name = name, .path = pkg_index_path, }) catch unreachable; } pub fn setVerbose(self: *TestStep, value: bool) void { self.verbose = value; } pub fn addIncludeDir(self: *TestStep, path: []const u8) void { self.include_dirs.append(path) catch unreachable; } pub fn setBuildMode(self: *TestStep, mode: builtin.Mode) void { self.build_mode = mode; } pub fn setOutputPath(self: *TestStep, file_path: []const u8) void { self.output_path = file_path; // catch a common mistake if (mem.eql(u8, self.builder.pathFromRoot(file_path), self.builder.pathFromRoot("."))) { debug.panic("setOutputPath wants a file path, not a directory\n"); } } pub fn getOutputPath(self: *TestStep) []const u8 { if (self.output_path) |output_path| { return output_path; } else { const basename = self.builder.fmt("test{}", self.target.exeFileExt()); return os.path.join(self.builder.allocator, self.builder.cache_root, basename) catch unreachable; } } pub fn linkSystemLibrary(self: *TestStep, name: []const u8) void { self.link_libs.put(name) catch unreachable; } pub fn setNamePrefix(self: *TestStep, text: []const u8) void { self.name_prefix = text; } pub fn setFilter(self: *TestStep, text: ?[]const u8) void { self.filter = text; } pub fn addObject(self: *TestStep, obj: *LibExeObjStep) void { assert(obj.kind == LibExeObjStep.Kind.Obj); self.step.dependOn(&obj.step); self.object_files.append(obj.getOutputPath()) catch unreachable; // TODO should be some kind of isolated directory that only has this header in it self.include_dirs.append(self.builder.cache_root) catch unreachable; } pub fn addObjectFile(self: *TestStep, path: []const u8) void { self.object_files.append(path) catch unreachable; } pub fn setTarget(self: *TestStep, target_arch: builtin.Arch, target_os: builtin.Os, target_environ: builtin.Environ) void { self.target = Target{ .Cross = CrossTarget{ .arch = target_arch, .os = target_os, .environ = target_environ, }, }; } pub fn setExecCmd(self: *TestStep, args: []const ?[]const u8) void { self.exec_cmd_args = args; } pub fn enableSystemLinkerHack(self: *TestStep) void { self.system_linker_hack = true; } fn make(step: *Step) !void { const self = @fieldParentPtr(TestStep, "step", step); const builder = self.builder; var zig_args = ArrayList([]const u8).init(builder.allocator); defer zig_args.deinit(); try zig_args.append(builder.zig_exe); try zig_args.append("test"); try zig_args.append(builder.pathFromRoot(self.root_src)); if (self.verbose) { try zig_args.append("--verbose"); } switch (self.build_mode) { builtin.Mode.Debug => {}, builtin.Mode.ReleaseSafe => try zig_args.append("--release-safe"), builtin.Mode.ReleaseFast => try zig_args.append("--release-fast"), builtin.Mode.ReleaseSmall => try zig_args.append("--release-small"), } const output_path = builder.pathFromRoot(self.getOutputPath()); try zig_args.append("--output"); try zig_args.append(output_path); switch (self.target) { Target.Native => {}, Target.Cross => |cross_target| { try zig_args.append("--target-arch"); try zig_args.append(@tagName(cross_target.arch)); try zig_args.append("--target-os"); try zig_args.append(@tagName(cross_target.os)); try zig_args.append("--target-environ"); try zig_args.append(@tagName(cross_target.environ)); }, } if (self.filter) |filter| { try zig_args.append("--test-filter"); try zig_args.append(filter); } if (self.name_prefix.len != 0) { try zig_args.append("--test-name-prefix"); try zig_args.append(self.name_prefix); } for (self.object_files.toSliceConst()) |object_file| { try zig_args.append("--object"); try zig_args.append(builder.pathFromRoot(object_file)); } { var it = self.link_libs.iterator(); while (true) { const entry = it.next() orelse break; try zig_args.append("--library"); try zig_args.append(entry.key); } } if (self.exec_cmd_args) |exec_cmd_args| { for (exec_cmd_args) |cmd_arg| { if (cmd_arg) |arg| { try zig_args.append("--test-cmd"); try zig_args.append(arg); } else { try zig_args.append("--test-cmd-bin"); } } } for (self.include_dirs.toSliceConst()) |include_path| { try zig_args.append("-isystem"); try zig_args.append(builder.pathFromRoot(include_path)); } for (builder.include_paths.toSliceConst()) |include_path| { try zig_args.append("-isystem"); try zig_args.append(builder.pathFromRoot(include_path)); } for (builder.rpaths.toSliceConst()) |rpath| { try zig_args.append("-rpath"); try zig_args.append(rpath); } for (self.lib_paths.toSliceConst()) |lib_path| { try zig_args.append("--library-path"); try zig_args.append(lib_path); } for (builder.lib_paths.toSliceConst()) |lib_path| { try zig_args.append("--library-path"); try zig_args.append(lib_path); } for (self.packages.toSliceConst()) |pkg| { zig_args.append("--pkg-begin") catch unreachable; zig_args.append(pkg.name) catch unreachable; zig_args.append(builder.pathFromRoot(pkg.path)) catch unreachable; zig_args.append("--pkg-end") catch unreachable; } if (self.no_rosegment) { try zig_args.append("--no-rosegment"); } if (self.system_linker_hack) { try zig_args.append("--system-linker-hack"); } try builder.spawnChild(zig_args.toSliceConst()); } }; pub const CommandStep = struct { step: Step, builder: *Builder, argv: [][]const u8, cwd: ?[]const u8, env_map: *const BufMap, /// ::argv is copied. pub fn create(builder: *Builder, cwd: ?[]const u8, env_map: *const BufMap, argv: []const []const u8) *CommandStep { const self = builder.allocator.create(CommandStep{ .builder = builder, .step = Step.init(argv[0], builder.allocator, make), .argv = builder.allocator.alloc([]u8, argv.len) catch unreachable, .cwd = cwd, .env_map = env_map, }) catch unreachable; mem.copy([]const u8, self.argv, argv); self.step.name = self.argv[0]; return self; } fn make(step: *Step) !void { const self = @fieldParentPtr(CommandStep, "step", step); const cwd = if (self.cwd) |cwd| self.builder.pathFromRoot(cwd) else self.builder.build_root; return self.builder.spawnChildEnvMap(cwd, self.env_map, self.argv); } }; const InstallArtifactStep = struct { step: Step, builder: *Builder, artifact: *LibExeObjStep, dest_file: []const u8, const Self = @This(); pub fn create(builder: *Builder, artifact: *LibExeObjStep) *Self { const dest_dir = switch (artifact.kind) { LibExeObjStep.Kind.Obj => unreachable, LibExeObjStep.Kind.Exe => builder.exe_dir, LibExeObjStep.Kind.Lib => builder.lib_dir, }; const self = builder.allocator.create(Self{ .builder = builder, .step = Step.init(builder.fmt("install {}", artifact.step.name), builder.allocator, make), .artifact = artifact, .dest_file = os.path.join(builder.allocator, dest_dir, artifact.out_filename) catch unreachable, }) catch unreachable; self.step.dependOn(&artifact.step); builder.pushInstalledFile(self.dest_file); if (self.artifact.kind == LibExeObjStep.Kind.Lib and !self.artifact.static) { builder.pushInstalledFile(os.path.join(builder.allocator, builder.lib_dir, artifact.major_only_filename) catch unreachable); builder.pushInstalledFile(os.path.join(builder.allocator, builder.lib_dir, artifact.name_only_filename) catch unreachable); } return self; } fn make(step: *Step) !void { const self = @fieldParentPtr(Self, "step", step); const builder = self.builder; const mode = switch (builtin.os) { builtin.Os.windows => {}, else => switch (self.artifact.kind) { LibExeObjStep.Kind.Obj => unreachable, LibExeObjStep.Kind.Exe => u32(0o755), LibExeObjStep.Kind.Lib => if (self.artifact.static) u32(0o666) else u32(0o755), }, }; try builder.copyFileMode(self.artifact.getOutputPath(), self.dest_file, mode); if (self.artifact.kind == LibExeObjStep.Kind.Lib and !self.artifact.static) { try doAtomicSymLinks(builder.allocator, self.dest_file, self.artifact.major_only_filename, self.artifact.name_only_filename); } } }; pub const InstallFileStep = struct { step: Step, builder: *Builder, src_path: []const u8, dest_path: []const u8, pub fn init(builder: *Builder, src_path: []const u8, dest_path: []const u8) InstallFileStep { return InstallFileStep{ .builder = builder, .step = Step.init(builder.fmt("install {}", src_path), builder.allocator, make), .src_path = src_path, .dest_path = dest_path, }; } fn make(step: *Step) !void { const self = @fieldParentPtr(InstallFileStep, "step", step); try self.builder.copyFile(self.src_path, self.dest_path); } }; pub const WriteFileStep = struct { step: Step, builder: *Builder, file_path: []const u8, data: []const u8, pub fn init(builder: *Builder, file_path: []const u8, data: []const u8) WriteFileStep { return WriteFileStep{ .builder = builder, .step = Step.init(builder.fmt("writefile {}", file_path), builder.allocator, make), .file_path = file_path, .data = data, }; } fn make(step: *Step) !void { const self = @fieldParentPtr(WriteFileStep, "step", step); const full_path = self.builder.pathFromRoot(self.file_path); const full_path_dir = os.path.dirname(full_path) orelse "."; os.makePath(self.builder.allocator, full_path_dir) catch |err| { warn("unable to make path {}: {}\n", full_path_dir, @errorName(err)); return err; }; io.writeFile(full_path, self.data) catch |err| { warn("unable to write {}: {}\n", full_path, @errorName(err)); return err; }; } }; pub const LogStep = struct { step: Step, builder: *Builder, data: []const u8, pub fn init(builder: *Builder, data: []const u8) LogStep { return LogStep{ .builder = builder, .step = Step.init(builder.fmt("log {}", data), builder.allocator, make), .data = data, }; } fn make(step: *Step) anyerror!void { const self = @fieldParentPtr(LogStep, "step", step); warn("{}", self.data); } }; pub const RemoveDirStep = struct { step: Step, builder: *Builder, dir_path: []const u8, pub fn init(builder: *Builder, dir_path: []const u8) RemoveDirStep { return RemoveDirStep{ .builder = builder, .step = Step.init(builder.fmt("RemoveDir {}", dir_path), builder.allocator, make), .dir_path = dir_path, }; } fn make(step: *Step) !void { const self = @fieldParentPtr(RemoveDirStep, "step", step); const full_path = self.builder.pathFromRoot(self.dir_path); os.deleteTree(self.builder.allocator, full_path) catch |err| { warn("Unable to remove {}: {}\n", full_path, @errorName(err)); return err; }; } }; pub const Step = struct { name: []const u8, makeFn: fn (self: *Step) anyerror!void, dependencies: ArrayList(*Step), loop_flag: bool, done_flag: bool, pub fn init(name: []const u8, allocator: *Allocator, makeFn: fn (*Step) anyerror!void) Step { return Step{ .name = name, .makeFn = makeFn, .dependencies = ArrayList(*Step).init(allocator), .loop_flag = false, .done_flag = false, }; } pub fn initNoOp(name: []const u8, allocator: *Allocator) Step { return init(name, allocator, makeNoOp); } pub fn make(self: *Step) !void { if (self.done_flag) return; try self.makeFn(self); self.done_flag = true; } pub fn dependOn(self: *Step, other: *Step) void { self.dependencies.append(other) catch unreachable; } fn makeNoOp(self: *Step) anyerror!void {} }; fn doAtomicSymLinks(allocator: *Allocator, output_path: []const u8, filename_major_only: []const u8, filename_name_only: []const u8) !void { const out_dir = os.path.dirname(output_path) orelse "."; const out_basename = os.path.basename(output_path); // sym link for libfoo.so.1 to libfoo.so.1.2.3 const major_only_path = os.path.join(allocator, out_dir, filename_major_only) catch unreachable; os.atomicSymLink(allocator, out_basename, major_only_path) catch |err| { warn("Unable to symlink {} -> {}\n", major_only_path, out_basename); return err; }; // sym link for libfoo.so to libfoo.so.1 const name_only_path = os.path.join(allocator, out_dir, filename_name_only) catch unreachable; os.atomicSymLink(allocator, filename_major_only, name_only_path) catch |err| { warn("Unable to symlink {} -> {}\n", name_only_path, filename_major_only); return err; }; }
std/build.zig