code
stringlengths
38
801k
repo_path
stringlengths
6
263
const std = @import("std"); const Cpu = @import("../Cpu.zig"); const util = @import("../util.zig"); pub const impl = @import("impl.zig"); const Reg8 = Cpu.Reg8; const Reg16 = Cpu.Reg16; const Flags = Cpu.Flags; const Op = @This(); id: Id, length: u8, arg0: Arg, arg1: Arg, durations: [2]u8, /// Positional argument types: /// * rb β€” register byte /// * rw β€” register word /// * ib β€” immediate byte /// * iw β€” immediate word /// * RB β€” register byte dereference /// * RW β€” register word dereference /// * IB β€” immediate byte dereference /// * IW β€” immediate word dereference /// /// * tf β€” true/false /// * zc β€” Z/C flag condition /// * mo β€” CPU mode pub const Id = enum(u8) { ILLEGAL___, nop_______, int__tf___, sys__mo___, ccf_______, scf_______, jp___IW___, jp___RW___, jp___zc_IW, jr___IB___, jr___zc_IB, ret_______, reti______, ret__zc___, call_IW___, call_zc_IW, rst__ib___, ld___IW_rb, ld___IW_rw, ld___RB_rb, ld___RW_ib, ld___RW_rb, ld___rb_IW, ld___rb_RB, ld___rb_RW, ld___rb_ib, ld___rb_rb, ld___rw_iw, ld___rw_rw, ldd__RW_rb, ldd__rb_RW, ldh__IB_rb, ldh__rb_IB, ldi__RW_rb, ldi__rb_RW, ldhl_rw_ib, add__rb_RW, add__rb_ib, add__rb_rb, add__rw_ib, add__rw_rw, sub__rb_RW, sub__rb_ib, sub__rb_rb, adc__rb_RW, adc__rb_ib, adc__rb_rb, sbc__rb_RW, sbc__rb_ib, sbc__rb_rb, and__rb_RW, and__rb_ib, and__rb_rb, or___rb_RW, or___rb_ib, or___rb_rb, xor__rb_RW, xor__rb_ib, xor__rb_rb, cp___rb_RW, cp___rb_ib, cp___rb_rb, cpl__rb___, daa__rb___, dec__RW___, dec__rb___, dec__rw___, inc__RW___, inc__rb___, inc__rw___, pop__rw___, push_rw___, rla__rb___, rlca_rb___, rra__rb___, rrca_rb___, // -- CB rlc__rb___, rlc__RW___, rrc__rb___, rrc__RW___, rl___rb___, rl___RW___, rr___rb___, rr___RW___, sla__rb___, sla__RW___, sra__rb___, sra__RW___, swap_rb___, swap_RW___, srl__rb___, srl__RW___, bit__bt_rb, bit__bt_RW, res__bt_rb, res__bt_RW, set__bt_rb, set__bt_RW, }; pub const Arg = union { __: void, ib: u8, iw: u16, rb: Reg8, rw: Reg16, bt: u3, tf: bool, zc: ZC, mo: Cpu.Mode, }; pub const ZC = enum(u16) { nz = 0x0_80, z = 0x80_80, nc = 0x0_10, c = 0x10_10, pub fn check(self: ZC, cpu: Cpu) bool { // return switch (self) { // .nz => !Cpu.reg.flags.Z, // .z => Cpu.reg.flags.Z, // .nc => !Cpu.reg.flags.C, // .c => Cpu.reg.flags.C, // }; const compare = @enumToInt(self) >> 8; const mask = 0xff & @enumToInt(self); return mask & @bitCast(u8, cpu.reg.flags) == compare; } }; pub fn decode(bytes: [3]u8) Op { const ib = bytes[1]; const iw = @as(u16, bytes[2]) << 8 | bytes[1]; return switch (bytes[0]) { 0x00 => Op._____(.nop_______), 0x01 => Op.rw_iw(.ld___rw_iw, .BC, iw), 0x02 => Op.rw_rb(.ld___RW_rb, .BC, .A), 0x03 => Op.rw___(.inc__rw___, .BC), 0x04 => Op.rb___(.inc__rb___, .B), 0x05 => Op.rb___(.dec__rb___, .B), 0x06 => Op.rb_ib(.ld___rb_ib, .B, ib), 0x07 => Op.rb___(.rlca_rb___, .A), 0x08 => Op.iw_rw(.ld___IW_rw, iw, .SP), 0x09 => Op.rw_rw(.add__rw_rw, .HL, .BC), 0x0A => Op.rb_rw(.ld___rb_RW, .A, .BC), 0x0B => Op.rw___(.dec__rw___, .BC), 0x0C => Op.rb___(.inc__rb___, .C), 0x0D => Op.rb___(.dec__rb___, .C), 0x0E => Op.rb_ib(.ld___rb_ib, .C, ib), 0x0F => Op.rb___(.rrca_rb___, .A), 0x10 => Op.mo___(.sys__mo___, .stop), 0x11 => Op.rw_iw(.ld___rw_iw, .DE, iw), 0x12 => Op.rw_rb(.ld___RW_rb, .DE, .A), 0x13 => Op.rw___(.inc__rw___, .DE), 0x14 => Op.rb___(.inc__rb___, .D), 0x15 => Op.rb___(.dec__rb___, .D), 0x16 => Op.rb_ib(.ld___rb_ib, .D, ib), 0x17 => Op.rb___(.rla__rb___, .A), 0x18 => Op.ib___(.jr___IB___, ib), 0x19 => Op.rw_rw(.add__rw_rw, .HL, .DE), 0x1A => Op.rb_rw(.ld___rb_RW, .A, .DE), 0x1B => Op.rw___(.dec__rw___, .DE), 0x1C => Op.rb___(.inc__rb___, .E), 0x1D => Op.rb___(.dec__rb___, .E), 0x1E => Op.rb_ib(.ld___rb_ib, .E, ib), 0x1F => Op.rb___(.rra__rb___, .A), 0x20 => Op.zc_ib(.jr___zc_IB, .nz, ib), 0x21 => Op.rw_iw(.ld___rw_iw, .HL, iw), 0x22 => Op.rw_rb(.ldi__RW_rb, .HL, .A), 0x23 => Op.rw___(.inc__rw___, .HL), 0x24 => Op.rb___(.inc__rb___, .H), 0x25 => Op.rb___(.dec__rb___, .H), 0x26 => Op.rb_ib(.ld___rb_ib, .H, ib), 0x27 => Op.rb___(.daa__rb___, .A), 0x28 => Op.zc_ib(.jr___zc_IB, .z, ib), 0x29 => Op.rw_rw(.add__rw_rw, .HL, .HL), 0x2A => Op.rb_rw(.ldi__rb_RW, .A, .HL), 0x2B => Op.rw___(.dec__rw___, .HL), 0x2C => Op.rb___(.inc__rb___, .L), 0x2D => Op.rb___(.dec__rb___, .L), 0x2E => Op.rb_ib(.ld___rb_ib, .L, ib), 0x2F => Op.rb___(.cpl__rb___, .A), 0x30 => Op.zc_ib(.jr___zc_IB, .nc, ib), 0x31 => Op.rw_iw(.ld___rw_iw, .SP, iw), 0x32 => Op.rw_rb(.ldd__RW_rb, .HL, .A), 0x33 => Op.rw___(.inc__rw___, .SP), 0x34 => Op.rw___(.inc__RW___, .HL), 0x35 => Op.rw___(.dec__RW___, .HL), 0x36 => Op.rw_ib(.ld___RW_ib, .HL, ib), 0x37 => Op._____(.scf_______), 0x38 => Op.zc_ib(.jr___zc_IB, .c, ib), 0x39 => Op.rw_rw(.add__rw_rw, .HL, .SP), 0x3A => Op.rb_rw(.ldd__rb_RW, .A, .HL), 0x3B => Op.rw___(.dec__rw___, .SP), 0x3C => Op.rb___(.inc__rb___, .A), 0x3D => Op.rb___(.dec__rb___, .A), 0x3E => Op.rb_ib(.ld___rb_ib, .A, ib), 0x3F => Op._____(.ccf_______), 0x40 => Op.rb_rb(.ld___rb_rb, .B, .B), 0x41 => Op.rb_rb(.ld___rb_rb, .B, .C), 0x42 => Op.rb_rb(.ld___rb_rb, .B, .D), 0x43 => Op.rb_rb(.ld___rb_rb, .B, .E), 0x44 => Op.rb_rb(.ld___rb_rb, .B, .H), 0x45 => Op.rb_rb(.ld___rb_rb, .B, .L), 0x46 => Op.rb_rw(.ld___rb_RW, .B, .HL), 0x47 => Op.rb_rb(.ld___rb_rb, .B, .A), 0x48 => Op.rb_rb(.ld___rb_rb, .C, .B), 0x49 => Op.rb_rb(.ld___rb_rb, .C, .C), 0x4A => Op.rb_rb(.ld___rb_rb, .C, .D), 0x4B => Op.rb_rb(.ld___rb_rb, .C, .E), 0x4C => Op.rb_rb(.ld___rb_rb, .C, .H), 0x4D => Op.rb_rb(.ld___rb_rb, .C, .L), 0x4E => Op.rb_rw(.ld___rb_RW, .C, .HL), 0x4F => Op.rb_rb(.ld___rb_rb, .C, .A), 0x50 => Op.rb_rb(.ld___rb_rb, .D, .B), 0x51 => Op.rb_rb(.ld___rb_rb, .D, .C), 0x52 => Op.rb_rb(.ld___rb_rb, .D, .D), 0x53 => Op.rb_rb(.ld___rb_rb, .D, .E), 0x54 => Op.rb_rb(.ld___rb_rb, .D, .H), 0x55 => Op.rb_rb(.ld___rb_rb, .D, .L), 0x56 => Op.rb_rw(.ld___rb_RW, .D, .HL), 0x57 => Op.rb_rb(.ld___rb_rb, .D, .A), 0x58 => Op.rb_rb(.ld___rb_rb, .E, .B), 0x59 => Op.rb_rb(.ld___rb_rb, .E, .C), 0x5A => Op.rb_rb(.ld___rb_rb, .E, .D), 0x5B => Op.rb_rb(.ld___rb_rb, .E, .E), 0x5C => Op.rb_rb(.ld___rb_rb, .E, .H), 0x5D => Op.rb_rb(.ld___rb_rb, .E, .L), 0x5E => Op.rb_rw(.ld___rb_RW, .E, .HL), 0x5F => Op.rb_rb(.ld___rb_rb, .E, .A), 0x60 => Op.rb_rb(.ld___rb_rb, .H, .B), 0x61 => Op.rb_rb(.ld___rb_rb, .H, .C), 0x62 => Op.rb_rb(.ld___rb_rb, .H, .D), 0x63 => Op.rb_rb(.ld___rb_rb, .H, .E), 0x64 => Op.rb_rb(.ld___rb_rb, .H, .H), 0x65 => Op.rb_rb(.ld___rb_rb, .H, .L), 0x66 => Op.rb_rw(.ld___rb_RW, .H, .HL), 0x67 => Op.rb_rb(.ld___rb_rb, .H, .A), 0x68 => Op.rb_rb(.ld___rb_rb, .L, .B), 0x69 => Op.rb_rb(.ld___rb_rb, .L, .C), 0x6A => Op.rb_rb(.ld___rb_rb, .L, .D), 0x6B => Op.rb_rb(.ld___rb_rb, .L, .E), 0x6C => Op.rb_rb(.ld___rb_rb, .L, .H), 0x6D => Op.rb_rb(.ld___rb_rb, .L, .L), 0x6E => Op.rb_rw(.ld___rb_RW, .L, .HL), 0x6F => Op.rb_rb(.ld___rb_rb, .L, .A), 0x70 => Op.rw_rb(.ld___RW_rb, .HL, .B), 0x71 => Op.rw_rb(.ld___RW_rb, .HL, .C), 0x72 => Op.rw_rb(.ld___RW_rb, .HL, .D), 0x73 => Op.rw_rb(.ld___RW_rb, .HL, .E), 0x74 => Op.rw_rb(.ld___RW_rb, .HL, .H), 0x75 => Op.rw_rb(.ld___RW_rb, .HL, .L), 0x76 => Op.mo___(.sys__mo___, .halt), 0x77 => Op.rw_rb(.ld___RW_rb, .HL, .A), 0x78 => Op.rb_rb(.ld___rb_rb, .A, .B), 0x79 => Op.rb_rb(.ld___rb_rb, .A, .C), 0x7A => Op.rb_rb(.ld___rb_rb, .A, .D), 0x7B => Op.rb_rb(.ld___rb_rb, .A, .E), 0x7C => Op.rb_rb(.ld___rb_rb, .A, .H), 0x7D => Op.rb_rb(.ld___rb_rb, .A, .L), 0x7E => Op.rb_rw(.ld___rb_RW, .A, .HL), 0x7F => Op.rb_rb(.ld___rb_rb, .A, .A), 0x80 => Op.rb_rb(.add__rb_rb, .A, .B), 0x81 => Op.rb_rb(.add__rb_rb, .A, .C), 0x82 => Op.rb_rb(.add__rb_rb, .A, .D), 0x83 => Op.rb_rb(.add__rb_rb, .A, .E), 0x84 => Op.rb_rb(.add__rb_rb, .A, .H), 0x85 => Op.rb_rb(.add__rb_rb, .A, .L), 0x86 => Op.rb_rw(.add__rb_RW, .A, .HL), 0x87 => Op.rb_rb(.add__rb_rb, .A, .A), 0x88 => Op.rb_rb(.adc__rb_rb, .A, .B), 0x89 => Op.rb_rb(.adc__rb_rb, .A, .C), 0x8A => Op.rb_rb(.adc__rb_rb, .A, .D), 0x8B => Op.rb_rb(.adc__rb_rb, .A, .E), 0x8C => Op.rb_rb(.adc__rb_rb, .A, .H), 0x8D => Op.rb_rb(.adc__rb_rb, .A, .L), 0x8E => Op.rb_rw(.adc__rb_RW, .A, .HL), 0x8F => Op.rb_rb(.adc__rb_rb, .A, .A), 0x90 => Op.rb_rb(.sub__rb_rb, .A, .B), 0x91 => Op.rb_rb(.sub__rb_rb, .A, .C), 0x92 => Op.rb_rb(.sub__rb_rb, .A, .D), 0x93 => Op.rb_rb(.sub__rb_rb, .A, .E), 0x94 => Op.rb_rb(.sub__rb_rb, .A, .H), 0x95 => Op.rb_rb(.sub__rb_rb, .A, .L), 0x96 => Op.rb_rw(.sub__rb_RW, .A, .HL), 0x97 => Op.rb_rb(.sub__rb_rb, .A, .A), 0x98 => Op.rb_rb(.sbc__rb_rb, .A, .B), 0x99 => Op.rb_rb(.sbc__rb_rb, .A, .C), 0x9A => Op.rb_rb(.sbc__rb_rb, .A, .D), 0x9B => Op.rb_rb(.sbc__rb_rb, .A, .E), 0x9C => Op.rb_rb(.sbc__rb_rb, .A, .H), 0x9D => Op.rb_rb(.sbc__rb_rb, .A, .L), 0x9E => Op.rb_rw(.sbc__rb_RW, .A, .HL), 0x9F => Op.rb_rb(.sbc__rb_rb, .A, .A), 0xA0 => Op.rb_rb(.and__rb_rb, .A, .B), 0xA1 => Op.rb_rb(.and__rb_rb, .A, .C), 0xA2 => Op.rb_rb(.and__rb_rb, .A, .D), 0xA3 => Op.rb_rb(.and__rb_rb, .A, .E), 0xA4 => Op.rb_rb(.and__rb_rb, .A, .H), 0xA5 => Op.rb_rb(.and__rb_rb, .A, .L), 0xA6 => Op.rb_rw(.and__rb_RW, .A, .HL), 0xA7 => Op.rb_rb(.and__rb_rb, .A, .A), 0xA8 => Op.rb_rb(.xor__rb_rb, .A, .B), 0xA9 => Op.rb_rb(.xor__rb_rb, .A, .C), 0xAA => Op.rb_rb(.xor__rb_rb, .A, .D), 0xAB => Op.rb_rb(.xor__rb_rb, .A, .E), 0xAC => Op.rb_rb(.xor__rb_rb, .A, .H), 0xAD => Op.rb_rb(.xor__rb_rb, .A, .L), 0xAE => Op.rb_rw(.xor__rb_RW, .A, .HL), 0xAF => Op.rb_rb(.xor__rb_rb, .A, .A), 0xB0 => Op.rb_rb(.or___rb_rb, .A, .B), 0xB1 => Op.rb_rb(.or___rb_rb, .A, .C), 0xB2 => Op.rb_rb(.or___rb_rb, .A, .D), 0xB3 => Op.rb_rb(.or___rb_rb, .A, .E), 0xB4 => Op.rb_rb(.or___rb_rb, .A, .H), 0xB5 => Op.rb_rb(.or___rb_rb, .A, .L), 0xB6 => Op.rb_rw(.or___rb_RW, .A, .HL), 0xB7 => Op.rb_rb(.or___rb_rb, .A, .A), 0xB8 => Op.rb_rb(.cp___rb_rb, .A, .B), 0xB9 => Op.rb_rb(.cp___rb_rb, .A, .C), 0xBA => Op.rb_rb(.cp___rb_rb, .A, .D), 0xBB => Op.rb_rb(.cp___rb_rb, .A, .E), 0xBC => Op.rb_rb(.cp___rb_rb, .A, .H), 0xBD => Op.rb_rb(.cp___rb_rb, .A, .L), 0xBE => Op.rb_rw(.cp___rb_RW, .A, .HL), 0xBF => Op.rb_rb(.cp___rb_rb, .A, .A), 0xC0 => Op.zc___(.ret__zc___, .nz), 0xC1 => Op.rw___(.pop__rw___, .BC), 0xC2 => Op.zc_iw(.jp___zc_IW, .nz, iw), 0xC3 => Op.iw___(.jp___IW___, iw), 0xC4 => Op.zc_iw(.call_zc_IW, .nz, iw), 0xC5 => Op.rw___(.push_rw___, .BC), 0xC6 => Op.rb_ib(.add__rb_ib, .A, ib), 0xC7 => Op.ib___(.rst__ib___, 0x00), 0xC8 => Op.zc___(.ret__zc___, .z), 0xC9 => Op._____(.ret_______), 0xCA => Op.zc_iw(.jp___zc_IW, .z, iw), 0xCB => decodeCB(ib), 0xCC => Op.zc_iw(.call_zc_IW, .z, iw), 0xCD => Op.iw___(.call_IW___, iw), 0xCE => Op.rb_ib(.adc__rb_ib, .A, ib), 0xCF => Op.ib___(.rst__ib___, 0x08), 0xD0 => Op.zc___(.ret__zc___, .nc), 0xD1 => Op.rw___(.pop__rw___, .DE), 0xD2 => Op.zc_iw(.jp___zc_IW, .nc, iw), 0xD3 => Op._____(.ILLEGAL___), 0xD4 => Op.zc_iw(.call_zc_IW, .nc, iw), 0xD5 => Op.rw___(.push_rw___, .DE), 0xD6 => Op.rb_ib(.sub__rb_ib, .A, ib), 0xD7 => Op.ib___(.rst__ib___, 0x10), 0xD8 => Op.zc___(.ret__zc___, .c), 0xD9 => Op._____(.reti______), 0xDA => Op.zc_iw(.jp___zc_IW, .c, iw), 0xDB => Op._____(.ILLEGAL___), 0xDC => Op.zc_iw(.call_zc_IW, .c, iw), 0xDD => Op._____(.ILLEGAL___), 0xDE => Op.rb_ib(.sbc__rb_ib, .A, ib), 0xDF => Op.ib___(.rst__ib___, 0x18), 0xE0 => Op.ib_rb(.ldh__IB_rb, ib, .A), 0xE1 => Op.rw___(.pop__rw___, .HL), 0xE2 => Op.rb_rb(.ld___RB_rb, .C, .A), 0xE3 => Op._____(.ILLEGAL___), 0xE4 => Op._____(.ILLEGAL___), 0xE5 => Op.rw___(.push_rw___, .HL), 0xE6 => Op.rb_ib(.and__rb_ib, .A, ib), 0xE7 => Op.ib___(.rst__ib___, 0x20), 0xE8 => Op.rw_ib(.add__rw_ib, .SP, ib), 0xE9 => Op.rw___(.jp___RW___, .HL), 0xEA => Op.iw_rb(.ld___IW_rb, iw, .A), 0xEB => Op._____(.ILLEGAL___), 0xEC => Op._____(.ILLEGAL___), 0xED => Op._____(.ILLEGAL___), 0xEE => Op.rb_ib(.xor__rb_ib, .A, ib), 0xEF => Op.ib___(.rst__ib___, 0x28), 0xF0 => Op.rb_ib(.ldh__rb_IB, .A, ib), 0xF1 => Op.rw___(.pop__rw___, .AF), 0xF2 => Op.rb_rb(.ld___rb_RB, .A, .C), 0xF3 => Op.tf___(.int__tf___, false), 0xF4 => Op._____(.ILLEGAL___), 0xF5 => Op.rw___(.push_rw___, .AF), 0xF6 => Op.rb_ib(.or___rb_ib, .A, ib), 0xF7 => Op.ib___(.rst__ib___, 0x30), 0xF8 => Op.rw_ib(.ldhl_rw_ib, .SP, ib), 0xF9 => Op.rw_rw(.ld___rw_rw, .SP, .HL), 0xFA => Op.rb_iw(.ld___rb_IW, .A, iw), 0xFB => Op.tf___(.int__tf___, true), 0xFC => Op._____(.ILLEGAL___), 0xFD => Op._____(.ILLEGAL___), 0xFE => Op.rb_ib(.cp___rb_ib, .A, ib), 0xFF => Op.ib___(.rst__ib___, 0x38), }; } pub fn decodeCB(next: u8) Op { const suffix = @truncate(u3, next); const prefix = next - suffix; const bit = @truncate(u3, next >> 3); const reg: Reg8 = switch (suffix) { 0x0 => .B, 0x1 => .C, 0x2 => .D, 0x3 => .E, 0x4 => .H, 0x5 => .L, 0x6 => { return switch (prefix) { 0x00...0x07 => Op.rw___(.rlc__RW___, .HL), 0x08...0x0F => Op.rw___(.rrc__RW___, .HL), 0x10...0x17 => Op.rw___(.rl___RW___, .HL), 0x18...0x1F => Op.rw___(.rr___RW___, .HL), 0x20...0x27 => Op.rw___(.sla__RW___, .HL), 0x28...0x2F => Op.rw___(.sra__RW___, .HL), 0x30...0x37 => Op.rw___(.swap_RW___, .HL), 0x38...0x3F => Op.rw___(.srl__RW___, .HL), 0x40...0x7F => Op.bt_rw(.bit__bt_RW, bit, .HL), 0x80...0xBF => Op.bt_rw(.res__bt_RW, bit, .HL), 0xC0...0xFF => Op.bt_rw(.set__bt_RW, bit, .HL), }; }, 0x7 => .A, }; return switch (prefix) { 0x00...0x07 => Op.rb___(.rlc__rb___, reg), 0x08...0x0F => Op.rb___(.rrc__rb___, reg), 0x10...0x17 => Op.rb___(.rl___rb___, reg), 0x18...0x1F => Op.rb___(.rr___rb___, reg), 0x20...0x27 => Op.rb___(.sla__rb___, reg), 0x28...0x2F => Op.rb___(.sra__rb___, reg), 0x30...0x37 => Op.rb___(.swap_rb___, reg), 0x38...0x3F => Op.rb___(.srl__rb___, reg), 0x40...0x7F => Op.bt_rb(.bit__bt_rb, bit, reg), 0x80...0xBF => Op.bt_rb(.res__bt_rb, bit, reg), 0xC0...0xFF => Op.bt_rb(.set__bt_rb, bit, reg), }; } test "decode sanity" { var i: usize = 0; while (i < 256) : (i += 1) { const bytes = [_]u8{ @truncate(u8, i), 0, 0 }; const op = decode(bytes); std.testing.expect(op.length > 0); std.testing.expect(op.durations[0] > 0); std.testing.expect(op.durations[1] > 0); std.testing.expect(op.durations[0] <= op.durations[1]); std.testing.expect(op.durations[0] % 4 == 0); std.testing.expect(op.durations[1] % 4 == 0); } } pub fn disassemble(op: Op, buffer: []u8) ![]u8 { var stream = std.io.fixedBufferStream(buffer); const os = stream.writer(); if (@call(.{ .modifier = .never_inline }, disassembleSpecial, .{op})) |special| { std.mem.copy(u8, buffer[0..16], special); return buffer[0..special.len]; } const enum_name = @tagName(op.id); for (enum_name) |letter| { if (letter == '_') break; _ = try os.write(&[1]u8{letter}); } try disassembleArg(os, enum_name[5..7], op.arg0); try disassembleArg(os, enum_name[8..10], op.arg1); return util.makeUpper(stream.getWritten()); } fn disassembleSpecial(op: Op) ?[]const u8 { return switch (op.id) { .ILLEGAL___ => "", .sys__mo___ => switch (op.arg0.mo) { .halt => "HALT", .stop => "STOP", else => unreachable, }, .int__tf___ => switch (op.arg0.tf) { true => "EI", false => "DI", }, else => null, }; } fn disassembleArg(writer: anytype, name: *const [2]u8, arg: Op.Arg) !void { if (std.mem.eql(u8, "__", name)) return; _ = try writer.write(" "); if (std.ascii.isUpper(name[0])) { _ = try writer.write("("); } const swh = util.Swhash(2); switch (swh.match(name)) { swh.case("zc") => _ = try writer.write(@tagName(arg.zc)), swh.case("bt") => _ = try writer.write(&[1]u8{'0' + @as(u8, arg.bt)}), swh.case("ib"), swh.case("IB") => try printHexes(writer, 2, arg.ib), swh.case("iw"), swh.case("IW") => try printHexes(writer, 4, arg.iw), swh.case("rb"), swh.case("RB") => _ = try writer.write(@tagName(arg.rb)), swh.case("rw"), swh.case("RW") => _ = try writer.write(@tagName(arg.rw)), else => unreachable, } if (std.ascii.isUpper(name[0])) { _ = try writer.write(")"); } } fn printHexes(writer: anytype, length: u3, val: u16) !void { @setCold(true); _ = try writer.write("$"); var i: u4 = length; while (i > 0) { i -= 1; const digit_num: u8 = @truncate(u4, val >> (4 * i)); _ = try writer.write(&[1]u8{ if (digit_num < 10) '0' + digit_num else 'A' + digit_num - 10, }); } } // -- init helpers fn init(comptime id: Id, arg0: Arg, arg1: Arg) Op { const func = @field(Op.impl, @tagName(id)); const ResultMeta = @typeInfo(@TypeOf(func)).Fn.return_type.?; return .{ .id = id, .arg0 = arg0, .arg1 = arg1, .length = ResultMeta.length, .durations = ResultMeta.durations, }; } pub fn _____(comptime id: Id) Op { return init(id, .{ .__ = {} }, .{ .__ = {} }); } pub fn tf___(comptime id: Id, arg0: bool) Op { return init(id, .{ .tf = arg0 }, .{ .__ = {} }); } pub fn mo___(comptime id: Id, arg0: Cpu.Mode) Op { return init(id, .{ .mo = arg0 }, .{ .__ = {} }); } pub fn ib___(comptime id: Id, arg0: u8) Op { return init(id, .{ .ib = arg0 }, .{ .__ = {} }); } pub fn iw___(comptime id: Id, arg0: u16) Op { return init(id, .{ .iw = arg0 }, .{ .__ = {} }); } pub fn rb___(comptime id: Id, arg0: Reg8) Op { return init(id, .{ .rb = arg0 }, .{ .__ = {} }); } pub fn rw___(comptime id: Id, arg0: Reg16) Op { return init(id, .{ .rw = arg0 }, .{ .__ = {} }); } pub fn zc___(comptime id: Id, arg0: ZC) Op { return init(id, .{ .zc = arg0 }, .{ .__ = {} }); } pub fn zc_ib(comptime id: Id, arg0: ZC, arg1: u8) Op { return init(id, .{ .zc = arg0 }, .{ .ib = arg1 }); } pub fn zc_iw(comptime id: Id, arg0: ZC, arg1: u16) Op { return init(id, .{ .zc = arg0 }, .{ .iw = arg1 }); } pub fn ib_rb(comptime id: Id, arg0: u8, arg1: Reg8) Op { return init(id, .{ .ib = arg0 }, .{ .rb = arg1 }); } pub fn iw_ib(comptime id: Id, arg0: u16, arg1: u8) Op { return init(id, .{ .iw = arg0 }, .{ .ib = arg1 }); } pub fn iw_rb(comptime id: Id, arg0: u16, arg1: Reg8) Op { return init(id, .{ .iw = arg0 }, .{ .rb = arg1 }); } pub fn iw_rw(comptime id: Id, arg0: u16, arg1: Reg16) Op { return init(id, .{ .iw = arg0 }, .{ .rw = arg1 }); } pub fn rb_ib(comptime id: Id, arg0: Reg8, arg1: u8) Op { return init(id, .{ .rb = arg0 }, .{ .ib = arg1 }); } pub fn rb_iw(comptime id: Id, arg0: Reg8, arg1: u16) Op { return init(id, .{ .rb = arg0 }, .{ .iw = arg1 }); } pub fn rb_rb(comptime id: Id, arg0: Reg8, arg1: Reg8) Op { return init(id, .{ .rb = arg0 }, .{ .rb = arg1 }); } pub fn rb_rw(comptime id: Id, arg0: Reg8, arg1: Reg16) Op { return init(id, .{ .rb = arg0 }, .{ .rw = arg1 }); } pub fn rw_ib(comptime id: Id, arg0: Reg16, arg1: u8) Op { return init(id, .{ .rw = arg0 }, .{ .ib = arg1 }); } pub fn rw_iw(comptime id: Id, arg0: Reg16, arg1: u16) Op { return init(id, .{ .rw = arg0 }, .{ .iw = arg1 }); } pub fn rw_rb(comptime id: Id, arg0: Reg16, arg1: Reg8) Op { return init(id, .{ .rw = arg0 }, .{ .rb = arg1 }); } pub fn rw_rw(comptime id: Id, arg0: Reg16, arg1: Reg16) Op { return init(id, .{ .rw = arg0 }, .{ .rw = arg1 }); } pub fn bt_rb(comptime id: Id, arg0: u3, arg1: Reg8) Op { return init(id, .{ .bt = arg0 }, .{ .rb = arg1 }); } pub fn bt_rw(comptime id: Id, arg0: u3, arg1: Reg16) Op { return init(id, .{ .bt = arg0 }, .{ .rw = arg1 }); }
src/Cpu/Op.zig
const c = @cImport({ @cInclude("cfl_draw.h"); }); const Font = @import("enums.zig").Font; const FrameType = @import("enums.zig").FrameType; const Cursor = @import("enums.zig").Cursor; pub const LineStyle = enum(i32) { /// Solid line Solid = 0, /// Dash Dash, /// Dot Dot, /// Dash dot DashDot, /// Dash dot dot DashDotDot, /// Cap flat CapFlat = 100, /// Cap round CapRound = 200, /// Cap square CapSquare = 300, /// Join miter JoinMiter = 1000, /// Join round JoinRound = 2000, /// Join bevel JoinBevel = 3000, }; /// Opaque type around Fl_Region pub const Region = ?*c_void; /// Opaque type around Fl_Offscreen pub const Offscreen = struct { inner: ?*c_void, pub fn new(w: i32, h: i32) Offscreen { return Offscreen{ .inner = c.Fl_create_offscreen(w, h) }; } /// Begins drawing in the offscreen pub fn begin(self: *const Offscreen) void { c.Fl_begin_offscreen(self.inner); } /// Ends drawing in the offscreen pub fn end() void { c.Fl_end_offscreen(); } /// Copies the offscreen pub fn copy(self: *const Offscreen, x: i32, y: i32, w: i32, h: i32, srcx: i32, srcy: i32) void { c.Fl_copy_offscreen(x, y, w, h, self.inner, srcx, srcy); } /// Rescales the offscreen pub fn rescale(self: *Offscreen) void { c.Fl_rescale_offscreen(self.inner); } pub fn delete(self: *Offscreen) void { c.Fl_delete_offscreen(self._inner); } }; /// Shows a color map pub fn show_colormap(old_color: u32) u32 { c.Fl_show_colormap(old_color); } /// Sets the color using rgb values pub fn set_color_rgb(r: u8, g: u8, b: u8) void { c.Fl_set_color_rgb(r, g, b); } /// Gets the last used color pub fn get_color() u32 { return c.Fl_get_color(); } /// Draws a line pub fn draw_line(x1: i32, y1: i32, x2: i32, y2: i32) void { c.Fl_line(x1, y1, x2, y2); } /// Draws a point pub fn draw_point(x: i32, y: i32) void { c.Fl_point(x, y); } /// Draws a rectangle pub fn draw_rect(x: i32, y: i32, w: i32, h: i32) void { c.Fl_rect(x, y, w, h); } /// Draws a rectangle with border color pub fn draw_rect_with_color(x: i32, y: i32, w: i32, h: i32, color: u32) void { c.Fl_rect_with_color(x, y, w, h, color); } /// Draws a non-filled 3-sided polygon pub fn draw_loop(x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32) void { c.Fl_loop(x1, y1, x2, y2, x3, y3); } /// Draws a filled rectangle pub fn draw_rect_fill(x: i32, y: i32, w: i32, h: i32, color: u32) void { c.Fl_rectf_with_color(x, y, w, h, color); } /// Draws a focus rectangle pub fn draw_focus_rect(x: i32, y: i32, w: i32, h: i32) void { c.Fl_focus_rect(x, y, w, h); } /// Sets the drawing color pub fn set_draw_rgb_color(r: u8, g: u8, b: u8) void { c.Fl_set_color_rgb(r, g, b); } /// Sets the drawing color pub fn set_draw_color(color: u32) void { c.Fl_set_color_int(color); } /// Draws a circle pub fn draw_circle(x: f64, y: f64, r: f64) void { c.Fl_circle(x, y, r); } /// Draws an arc pub fn draw_arc(x: i32, y: i32, w: i32, h: i32, a: f64, b: f64) void { c.Fl_arc(x, y, w, h, a, b); } /// Draws an arc pub fn draw_arc2(x: f64, y: f64, r: f64, start: f64, end: f64) void { c.Fl_arc2(x, y, r, start, end); } /// Draws a filled pie pub fn draw_pie(x: i32, y: i32, w: i32, h: i32, a: f64, b: f64) void { c.Fl_pie(x, y, w, h, a, b); } /// Sets the line style pub fn set_line_style(style: LineStyle, thickness: i32) void { c.Fl_line_style( style, thickness, null, ); } /// Limits drawing to a region pub fn push_clip(x: i32, y: i32, w: i32, h: i32) void { c.Fl_push_clip(x, y, w, h); } /// Puts the drawing back pub fn pop_clip() void { c.Fl_pop_clip(); } /// Sets the clip region pub fn set_clip_region(r: Region) void { c.Fl_set_clip_region(r); } /// Gets the clip region pub fn clip_region() Region { return c.Fl_clip_region(); } /// Pushes an empty clip region onto the stack so nothing will be clipped pub fn push_no_clip() void { c.Fl_push_no_clip(); } /// Returns whether the rectangle intersect with the current clip region pub fn not_clipped(x: i32, y: i32, w: i32, h: i32) bool { return c.Fl_not_clipped(x, y, w, h) != 0; } /// Restores the clip region pub fn restore_clip() void { c.Fl_restore_clip(); } /// Transforms coordinate using the current transformation matrix pub fn transform_x(x: f64, y: f64) f64 { return c.Fl_transform_x(x, y); } /// Transforms coordinate using the current transformation matrix pub fn transform_y(x: f64, y: f64) f64 { return c.Fl_transform_y(x, y); } /// Transforms distance using current transformation matrix pub fn transform_dx(x: f64, y: f64) f64 { return c.Fl_transform_dx(x, y); } /// Transforms distance using current transformation matrix pub fn transform_dy(x: f64, y: f64) f64 { return c.Fl_transform_dy(x, y); } /// Adds coordinate pair to the vertex list without further transformations pub fn transformed_vertex(xf: f64, yf: f64) void { c.Fl_transformed_vertex(xf, yf); } /// Draws a filled rectangle pub fn draw_rectf(x: i32, y: i32, w: i32, h: i32) void { c.Fl_rectf(x, y, w, h); } /// Draws a filled rectangle with specified RGB color pub fn draw_rectf_with_rgb( x: i32, y: i32, w: i32, h: i32, color_r: u8, color_g: u8, color_b: u8, ) void { c.Fl_rectf_with_rgb(x, y, w, h, color_r, color_g, color_b); } /// Fills a 3-sided polygon. The polygon must be convex pub fn draw_polygon(x: i32, y: i32, x1: i32, y1: i32, x2: i32, y2: i32) void { c.Fl_polygon(x, y, x1, y1, x2, y2); } /// Draws a horizontal line from (x,y) to (x1,y) pub fn draw_xyline(x: i32, y: i32, x1: i32) void { c.Fl_xyline(x, y, x1); } /// Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2) pub fn draw_xyline2(x: i32, y: i32, x1: i32, y2: i32) void { c.Fl_xyline2(x, y, x1, y2); } /// Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2) /// and then another horizontal from (x1,y2) to (x3,y2) pub fn draw_xyline3(x: i32, y: i32, x1: i32, y2: i32, x3: i32) void { c.Fl_xyline3(x, y, x1, y2, x3); } /// Draws a vertical line from (x,y) to (x,y1) pub fn draw_yxline(x: i32, y: i32, y1: i32) void { c.Fl_yxline(x, y, y1); } /// Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1) pub fn draw_yxline2(x: i32, y: i32, y1: i32, x2: i32) void { c.Fl_yxline2(x, y, y1, x2); } /// Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1) /// to (x2,y1), then another vertical from (x2,y1) to (x2,y3) pub fn draw_yxline3(x: i32, y: i32, y1: i32, x2: i32, y3: i32) void { c.Fl_yxline3(x, y, y1, x2, y3); } /// Saves the current transformation matrix on the stack pub fn push_matrix() void { c.Fl_push_matrix(); } /// Pops the current transformation matrix from the stack pub fn pop_matrix() void { c.Fl_pop_matrix(); } /// Concatenates scaling transformation onto the current one pub fn scale_xy(x: f64, y: f64) void { c.Fl_scale(x, y); } /// Concatenates scaling transformation onto the current one pub fn scale_x(x: f64) void { c.Fl_scale2(x); } /// Concatenates translation transformation onto the current one pub fn translate(x: f64, y: f64) void { c.Fl_translate(x, y); } /// Concatenates rotation transformation onto the current one pub fn rotate(d: f64) void { c.Fl_rotate(d); } /// Concatenates another transformation onto the current one pub fn mult_matrix(val_a: f64, val_b: f64, val_c: f64, val_d: f64, x: f64, y: f64) void { c.Fl_mult_matrix(val_a, val_b, val_c, val_d, x, y); } /// Starts drawing a list of points. Points are added to the list with fl_vertex() pub fn begin_points() void { c.Fl_begin_points(); } /// Starts drawing a list of lines pub fn begin_line() void { c.Fl_begin_line(); } /// Starts drawing a closed sequence of lines pub fn begin_loop() void { c.Fl_begin_loop(); } /// Starts drawing a convex filled polygon pub fn begin_polygon() void { c.Fl_begin_polygon(); } /// Adds a single vertex to the current path pub fn vertex(x: f64, y: f64) void { c.Fl_vertex(x, y); } /// Ends list of points, and draws pub fn end_points() void { c.Fl_end_points(); } /// Ends list of lines, and draws pub fn end_line() void { c.Fl_end_line(); } /// Ends closed sequence of lines, and draws pub fn end_loop() void { c.Fl_end_loop(); } /// Ends closed sequence of lines, and draws pub fn end_polygon() void { c.Fl_end_polygon(); } /// Starts drawing a complex filled polygon pub fn begin_complex_polygon() void { c.Fl_begin_complex_polygon(); } /// Call gap() to separate loops of the path pub fn gap() void { c.Fl_gap(); } /// Ends complex filled polygon, and draws pub fn end_complex_polygon() void { c.Fl_end_complex_polygon(); } /// Sets the current font, which is then used in various drawing routines pub fn set_font(face: Font, fsize: u32) void { c.Fl_set_draw_font(@enumToInt(face), fsize); } /// Gets the current font, which is used in various drawing routines pub fn font() Font { return c.Fl_font(); } /// Gets the current font size, which is used in various drawing routines pub fn size() u32 { return c.Fl_size(); } /// Returns the recommended minimum line spacing for the current font pub fn height() i32 { return c.Fl_height(); } /// Sets the line spacing for the current font pub fn set_height(f: Font, sz: u32) void { c.Fl_set_height(@enumToInt(f), sz); } /// Returns the recommended distance above the bottom of a height() tall box to /// draw the text at so it looks centered vertically in that box pub fn descent() i32 { return c.Fl_descent(); } pub fn width(txt: [*c]const u8) f64 { return c.Fl_width(txt); } /// Returns the typographical width of a sequence of n characters pub fn width2(txt: [*c]const u8, n: i32) f64 { return c.Fl_width2(txt, n); } /// Returns the typographical width of a single character pub fn char_width(val: u8) f64 { return c.Fl_width3(val); } /// Converts text from Windows/X11 latin1 character set to local encoding pub fn latin1_to_local(txt: [*c]const u8, n: i32) [*c]const u8 { return c.Fl_latin1_to_local(txt, n); } /// Converts text from local encoding to Windowx/X11 latin1 character set pub fn local_to_latin1(txt: [*c]const u8, n: i32) [*c]const u8 { return c.Fl_local_to_latin1(txt, n); } /// Draws a string starting at the given x, y location pub fn draw_text(txt: [*c]const u8, x: i32, y: i32) void { c.Fl_draw(txt, x, y); } /// Draws a string starting at the given x, y location with width and height and alignment pub fn draw_text2(string: [*c]const u8, x: i32, y: i32, w: i32, h: i32, al: i32) void { c.Fl_draw_text2(string, x, y, w, h, al); } /// Draws a string starting at the given x, y location, rotated to an angle pub fn draw_text_angled(angle: i32, txt: [*c]const u8, x: i32, y: i32) void { c.Fl_draw2(angle, txt, x, y); } /// Draws a frame with text pub fn draw_frame(string: [*c]const u8, x: i32, y: i32, w: i32, h: i32) void { c.Fl_frame(string, x, y, w, h); } /// Draws a frame with text. /// Differs from frame() by the order of the line segments pub fn draw_frame2(string: [*c]const u8, x: i32, y: i32, w: i32, h: i32) void { c.Fl_frame2(string, x, y, w, h); } /// Draws a box given the box type, size, position and color pub fn draw_box(box_type: FrameType, x: i32, y: i32, w: i32, h: i32, color: u32) void { c.Fl_draw_box(box_type, x, y, w, h, color); } /// Checks whether platform supports true alpha blending for RGBA images pub fn can_do_alpha_blending() bool { return c.Fl_can_do_alpha_blending() != 0; } /// Get a human-readable string from a shortcut value pub fn shortcut_label(shortcut: i32) [*c]const u8 { return c.Fl_shortcut_label(shortcut); } /// Draws a selection rectangle, erasing a previous one by XOR'ing it first. pub fn overlay_rect(x: i32, y: i32, w: i32, h: i32) void { c.Fl_overlay_rect(x, y, w, h); } /// Erase a selection rectangle without drawing a new one pub fn overlay_clear() void { c.Fl_overlay_clear(); } /// Sets the cursor style pub fn set_cursor(cursor: Cursor) void { c.Fl_set_cursor(@enumToInt(cursor)); } /// Sets the cursor style pub fn set_cursor_with_color(cursor: Cursor, fg: u32, bg: u32) void { c.Fl_set_cursor2(@enumToInt(cursor), @enumToInt(fg), @enumToInt(bg)); } test "" { @import("std").testing.refAllDecls(@This()); }
src/draw.zig
const std = @import("std"); usingnamespace @import("raylib"); const max_lights = 4; pub const Light = struct { type: LightType, position: Vector3, target: Vector3, color: Color, enabled: bool, // Shader locations enabledLoc: i32, typeLoc: i32, posLoc: i32, targetLoc: i32, colorLoc: i32, }; // Light type pub const LightType = enum { directional, point }; var lightsCount: u32 = 0; fn getShaderLoc(shader: Shader, name: []const u8) !i32 { // TODO: Below code doesn't look good to me, // it assumes a specific shader naming and structure // Probably this implementation could be improved // (note from original C implementation, I don't have a better idea) var buf: [32]u8 = undefined; const key = try std.fmt.bufPrintZ(buf[0..], "lights[{}].{s}", .{ lightsCount, name }); return GetShaderLocation(shader, key); } // Create a light and get shader locations pub fn CreateLight(typ: LightType, position: Vector3, target: Vector3, color: Color, shader: Shader) !Light { if (lightsCount >= max_lights) { return error.TooManyLights; } const light = Light{ .enabled = true, .type = typ, .position = position, .target = target, .color = color, .enabledLoc = try getShaderLoc(shader, "enabled"), .typeLoc = try getShaderLoc(shader, "type"), .posLoc = try getShaderLoc(shader, "position"), .targetLoc = try getShaderLoc(shader, "target"), .colorLoc = try getShaderLoc(shader, "color"), }; UpdateLightValues(shader, light); lightsCount += 1; return light; } // Send light properties to shader // NOTE: Light shader locations should be available pub fn UpdateLightValues(shader: Shader, light: Light) void { // Send to shader light enabled state and type SetShaderValue(shader, light.enabledLoc, &light.enabled, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_INT)); SetShaderValue(shader, light.typeLoc, &light.type, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_INT)); // Send to shader light position values const position = [3]f32{ light.position.x, light.position.y, light.position.z }; SetShaderValue(shader, light.posLoc, &position, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC3)); // Send to shader light target position values const target = [3]f32{ light.target.x, light.target.y, light.target.z }; SetShaderValue(shader, light.targetLoc, &target, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC3)); // Send to shader light color values const color = [4]f32{ @intToFloat(f32, light.color.r) / 255.0, @intToFloat(f32, light.color.g) / 255.0, @intToFloat(f32, light.color.b) / 255.0, @intToFloat(f32, light.color.a) / 255.0, }; SetShaderValue(shader, light.colorLoc, &color, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC4)); }
examples/shaders/rlights.zig
const std = @import("std"); const stdx = @import("../stdx/lib.zig"); const graphics = @import("../graphics/lib.zig"); const platform = @import("../platform/lib.zig"); const GraphicsBackend = @import("../platform/backend.zig").GraphicsBackend; const zig_v8_pkg = @import("../build.zig").zig_v8_pkg; const uv = @import("../lib/uv/lib.zig"); const h2o = @import("../lib/h2o/lib.zig"); const curl = @import("../lib/curl/lib.zig"); const ssl = @import("../lib/openssl/lib.zig"); const maudio = @import("../lib/miniaudio/lib.zig"); const sdl = @import("../lib/sdl/lib.zig"); pub const pkg = std.build.Pkg{ .name = "runtime", .source = .{ .path = srcPath() ++ "/runtime.zig" }, }; pub const Options = struct { graphics_backend: GraphicsBackend, link_lyon: bool = false, link_tess2: bool = false, add_dep_pkgs: bool = true, }; pub fn addPackage(step: *std.build.LibExeObjStep, opts: Options) void { const b = step.builder; var new_pkg = pkg; const build_options = b.addOptions(); build_options.addOption(GraphicsBackend, "GraphicsBackend", opts.graphics_backend); build_options.addOption(bool, "has_lyon", opts.link_lyon); build_options.addOption(bool, "has_tess2", opts.link_tess2); const build_options_pkg = build_options.getPackage("build_options"); const platform_opts: platform.Options = .{ .graphics_backend = opts.graphics_backend, .add_dep_pkgs = opts.add_dep_pkgs, }; const platform_pkg = platform.getPackage(b, platform_opts); const graphics_opts: graphics.Options = .{ .graphics_backend = opts.graphics_backend, .add_dep_pkgs = opts.add_dep_pkgs, }; const graphics_pkg = graphics.getPackage(b, graphics_opts); var h2o_pkg = h2o.pkg; h2o_pkg.dependencies = &.{ uv.pkg, ssl.pkg }; new_pkg.dependencies = b.allocator.dupe(std.build.Pkg, &.{ zig_v8_pkg, build_options_pkg, stdx.pkg, graphics_pkg, uv.pkg, h2o_pkg, curl.pkg, maudio.pkg, ssl.pkg, platform_pkg, sdl.pkg, }) catch @panic("error"); step.addPackage(new_pkg); } fn srcPath() []const u8 { return std.fs.path.dirname(@src().file) orelse unreachable; }
runtime/lib.zig
const std = @import("std"); const string = []const u8; const range = @import("range").range; const input = @embedFile("../input/day05.txt"); pub fn main() !void { // part 1 { var iter = std.mem.split(u8, input, "\n"); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const alloc = &arena.allocator; var point_list = std.ArrayList([2][2]u32).init(alloc); defer point_list.deinit(); const W = 1000; var plot = std.mem.zeroes([W][W]u32); while (iter.next()) |line| { if (line.len == 0) continue; var line_iter = std.mem.split(u8, line, ","); const x1 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); line_iter.delimiter = " "; const y1 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); line_iter.index = line_iter.index.? + 3; line_iter.delimiter = ","; const x2 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); const y2 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); // skip diagonals if (x1 != x2 and y1 != y2) continue; // // mark points in `plot` if (y1 == y2 and x2 > x1) { // line goes to right var i: usize = x1; while (i <= x2) : (i += 1) { plot[y1][i] += 1; } } if (y1 == y2 and x1 > x2) { // line goes to the left var i: usize = x1; while (i >= x2) : (i -= 1) { plot[y1][i] += 1; } } if (x1 == x2) { // line goes down if (y2 > y1) { var i: usize = y1; while (i <= y2) : (i += 1) { plot[i][x1] += 1; } } // line goes up if (y1 > y2) { var i: usize = y1; while (i >= y2) : (i -= 1) { plot[i][x1] += 1; } } } } // find points in `plot` where its been marked more than once var count: u32 = 0; for (range(W)) |_, col| { for (range(W)) |_, row| { if (plot[col][row] > 1) { count += 1; } } } std.debug.print("{d}\n", .{count}); } // part 2 { var iter = std.mem.split(u8, input, "\n"); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const alloc = &arena.allocator; var point_list = std.ArrayList([2][2]u32).init(alloc); defer point_list.deinit(); const W = 1000; var plot = std.mem.zeroes([W][W]u32); while (iter.next()) |line| { if (line.len == 0) continue; var line_iter = std.mem.split(u8, line, ","); const x1 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); line_iter.delimiter = " "; const y1 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); line_iter.index = line_iter.index.? + 3; line_iter.delimiter = ","; const x2 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); const y2 = std.fmt.parseUnsigned(u32, line_iter.next().?, 10) catch @panic(""); // // mark points in `plot` // line goes horizontal to right if (y1 == y2 and x2 > x1) { var i: usize = x1; while (i <= x2) : (i += 1) plot[y1][i] += 1; } // line goes horizontal to the left if (y1 == y2 and x1 > x2) { var i: usize = x1; while (i >= x2) : (i -= 1) plot[y1][i] += 1; } // line goes vertical down if (x1 == x2 and y2 > y1) { var i: usize = y1; while (i <= y2) : (i += 1) plot[i][x1] += 1; } // line goes vertical up if (x1 == x2 and y1 > y2) { var i: usize = y1; while (i >= y2) : (i -= 1) plot[i][x1] += 1; } // line goes diag TLBR // 1,1 -> 3,3 if (x2 > x1 and y2 > y1) { var i: usize = 0; while (i <= x2 - x1) : (i += 1) plot[y1 + i][x1 + i] += 1; } // line goes diag BRTL // 9,9 -> 0,0 if (x1 > x2 and y1 > y2) { var i: usize = 0; while (i <= x1 - x2) : (i += 1) plot[y1 - i][x1 - i] += 1; } // line goes diag TRBL // 8,1 -> 1,8 if (x1 > x2 and y2 > y1) { var i: usize = 0; while (i <= x1 - x2) : (i += 1) plot[i + y1][x1 - i] += 1; } // line goes diag BLTR // 5,5 -> 8,2 if (x2 > x1 and y1 > y2) { var i: usize = 0; while (i <= x2 - x1) : (i += 1) plot[y1 - i][x1 + i] += 1; } } // find points in `plot` where its been marked more than once var count: u32 = 0; for (range(W)) |_, col| { for (range(W)) |_, row| { if (plot[col][row] > 1) { count += 1; } } } std.debug.print("{d}\n", .{count}); } }
src/day05.zig
const std = @import("std"); const mem = std.mem; const OtherAlphabetic = @This(); allocator: *mem.Allocator, array: []bool, lo: u21 = 837, hi: u21 = 127369, pub fn init(allocator: *mem.Allocator) !OtherAlphabetic { var instance = OtherAlphabetic{ .allocator = allocator, .array = try allocator.alloc(bool, 126533), }; mem.set(bool, instance.array, false); var index: u21 = 0; instance.array[0] = true; index = 619; while (index <= 632) : (index += 1) { instance.array[index] = true; } instance.array[634] = true; index = 636; while (index <= 637) : (index += 1) { instance.array[index] = true; } index = 639; while (index <= 640) : (index += 1) { instance.array[index] = true; } instance.array[642] = true; index = 715; while (index <= 725) : (index += 1) { instance.array[index] = true; } index = 774; while (index <= 786) : (index += 1) { instance.array[index] = true; } index = 788; while (index <= 794) : (index += 1) { instance.array[index] = true; } instance.array[811] = true; index = 913; while (index <= 919) : (index += 1) { instance.array[index] = true; } index = 924; while (index <= 927) : (index += 1) { instance.array[index] = true; } index = 930; while (index <= 931) : (index += 1) { instance.array[index] = true; } instance.array[936] = true; instance.array[972] = true; index = 1003; while (index <= 1018) : (index += 1) { instance.array[index] = true; } index = 1121; while (index <= 1131) : (index += 1) { instance.array[index] = true; } index = 1233; while (index <= 1234) : (index += 1) { instance.array[index] = true; } index = 1238; while (index <= 1246) : (index += 1) { instance.array[index] = true; } index = 1248; while (index <= 1250) : (index += 1) { instance.array[index] = true; } index = 1252; while (index <= 1255) : (index += 1) { instance.array[index] = true; } index = 1423; while (index <= 1434) : (index += 1) { instance.array[index] = true; } index = 1438; while (index <= 1444) : (index += 1) { instance.array[index] = true; } index = 1451; while (index <= 1469) : (index += 1) { instance.array[index] = true; } instance.array[1470] = true; instance.array[1525] = true; instance.array[1526] = true; index = 1529; while (index <= 1531) : (index += 1) { instance.array[index] = true; } index = 1532; while (index <= 1539) : (index += 1) { instance.array[index] = true; } index = 1540; while (index <= 1543) : (index += 1) { instance.array[index] = true; } index = 1545; while (index <= 1546) : (index += 1) { instance.array[index] = true; } index = 1552; while (index <= 1554) : (index += 1) { instance.array[index] = true; } index = 1565; while (index <= 1566) : (index += 1) { instance.array[index] = true; } instance.array[1596] = true; index = 1597; while (index <= 1598) : (index += 1) { instance.array[index] = true; } index = 1657; while (index <= 1659) : (index += 1) { instance.array[index] = true; } index = 1660; while (index <= 1663) : (index += 1) { instance.array[index] = true; } index = 1666; while (index <= 1667) : (index += 1) { instance.array[index] = true; } index = 1670; while (index <= 1671) : (index += 1) { instance.array[index] = true; } instance.array[1682] = true; index = 1693; while (index <= 1694) : (index += 1) { instance.array[index] = true; } index = 1724; while (index <= 1725) : (index += 1) { instance.array[index] = true; } instance.array[1726] = true; index = 1785; while (index <= 1787) : (index += 1) { instance.array[index] = true; } index = 1788; while (index <= 1789) : (index += 1) { instance.array[index] = true; } index = 1794; while (index <= 1795) : (index += 1) { instance.array[index] = true; } index = 1798; while (index <= 1799) : (index += 1) { instance.array[index] = true; } instance.array[1804] = true; index = 1835; while (index <= 1836) : (index += 1) { instance.array[index] = true; } instance.array[1840] = true; index = 1852; while (index <= 1853) : (index += 1) { instance.array[index] = true; } instance.array[1854] = true; index = 1913; while (index <= 1915) : (index += 1) { instance.array[index] = true; } index = 1916; while (index <= 1920) : (index += 1) { instance.array[index] = true; } index = 1922; while (index <= 1923) : (index += 1) { instance.array[index] = true; } instance.array[1924] = true; index = 1926; while (index <= 1927) : (index += 1) { instance.array[index] = true; } index = 1949; while (index <= 1950) : (index += 1) { instance.array[index] = true; } index = 1973; while (index <= 1975) : (index += 1) { instance.array[index] = true; } instance.array[1980] = true; index = 1981; while (index <= 1982) : (index += 1) { instance.array[index] = true; } instance.array[2041] = true; instance.array[2042] = true; instance.array[2043] = true; index = 2044; while (index <= 2047) : (index += 1) { instance.array[index] = true; } index = 2050; while (index <= 2051) : (index += 1) { instance.array[index] = true; } index = 2054; while (index <= 2055) : (index += 1) { instance.array[index] = true; } instance.array[2065] = true; instance.array[2066] = true; index = 2077; while (index <= 2078) : (index += 1) { instance.array[index] = true; } instance.array[2109] = true; index = 2169; while (index <= 2170) : (index += 1) { instance.array[index] = true; } instance.array[2171] = true; index = 2172; while (index <= 2173) : (index += 1) { instance.array[index] = true; } index = 2177; while (index <= 2179) : (index += 1) { instance.array[index] = true; } index = 2181; while (index <= 2183) : (index += 1) { instance.array[index] = true; } instance.array[2194] = true; instance.array[2235] = true; index = 2236; while (index <= 2238) : (index += 1) { instance.array[index] = true; } index = 2297; while (index <= 2299) : (index += 1) { instance.array[index] = true; } index = 2300; while (index <= 2303) : (index += 1) { instance.array[index] = true; } index = 2305; while (index <= 2307) : (index += 1) { instance.array[index] = true; } index = 2309; while (index <= 2311) : (index += 1) { instance.array[index] = true; } index = 2320; while (index <= 2321) : (index += 1) { instance.array[index] = true; } index = 2333; while (index <= 2334) : (index += 1) { instance.array[index] = true; } instance.array[2364] = true; index = 2365; while (index <= 2366) : (index += 1) { instance.array[index] = true; } instance.array[2425] = true; instance.array[2426] = true; index = 2427; while (index <= 2431) : (index += 1) { instance.array[index] = true; } instance.array[2433] = true; index = 2434; while (index <= 2435) : (index += 1) { instance.array[index] = true; } index = 2437; while (index <= 2438) : (index += 1) { instance.array[index] = true; } instance.array[2439] = true; index = 2448; while (index <= 2449) : (index += 1) { instance.array[index] = true; } index = 2461; while (index <= 2462) : (index += 1) { instance.array[index] = true; } index = 2491; while (index <= 2492) : (index += 1) { instance.array[index] = true; } index = 2493; while (index <= 2494) : (index += 1) { instance.array[index] = true; } index = 2553; while (index <= 2555) : (index += 1) { instance.array[index] = true; } index = 2556; while (index <= 2559) : (index += 1) { instance.array[index] = true; } index = 2561; while (index <= 2563) : (index += 1) { instance.array[index] = true; } index = 2565; while (index <= 2567) : (index += 1) { instance.array[index] = true; } instance.array[2578] = true; index = 2589; while (index <= 2590) : (index += 1) { instance.array[index] = true; } instance.array[2620] = true; index = 2621; while (index <= 2622) : (index += 1) { instance.array[index] = true; } index = 2698; while (index <= 2700) : (index += 1) { instance.array[index] = true; } index = 2701; while (index <= 2703) : (index += 1) { instance.array[index] = true; } instance.array[2705] = true; index = 2707; while (index <= 2714) : (index += 1) { instance.array[index] = true; } index = 2733; while (index <= 2734) : (index += 1) { instance.array[index] = true; } instance.array[2796] = true; index = 2799; while (index <= 2805) : (index += 1) { instance.array[index] = true; } instance.array[2824] = true; instance.array[2924] = true; index = 2927; while (index <= 2932) : (index += 1) { instance.array[index] = true; } index = 2934; while (index <= 2935) : (index += 1) { instance.array[index] = true; } instance.array[2952] = true; index = 3116; while (index <= 3129) : (index += 1) { instance.array[index] = true; } instance.array[3130] = true; index = 3131; while (index <= 3132) : (index += 1) { instance.array[index] = true; } index = 3144; while (index <= 3154) : (index += 1) { instance.array[index] = true; } index = 3156; while (index <= 3191) : (index += 1) { instance.array[index] = true; } index = 3302; while (index <= 3303) : (index += 1) { instance.array[index] = true; } index = 3304; while (index <= 3307) : (index += 1) { instance.array[index] = true; } instance.array[3308] = true; index = 3309; while (index <= 3313) : (index += 1) { instance.array[index] = true; } instance.array[3315] = true; index = 3318; while (index <= 3319) : (index += 1) { instance.array[index] = true; } index = 3320; while (index <= 3321) : (index += 1) { instance.array[index] = true; } index = 3345; while (index <= 3346) : (index += 1) { instance.array[index] = true; } index = 3347; while (index <= 3348) : (index += 1) { instance.array[index] = true; } index = 3353; while (index <= 3355) : (index += 1) { instance.array[index] = true; } index = 3357; while (index <= 3359) : (index += 1) { instance.array[index] = true; } index = 3362; while (index <= 3368) : (index += 1) { instance.array[index] = true; } index = 3372; while (index <= 3375) : (index += 1) { instance.array[index] = true; } instance.array[3389] = true; index = 3390; while (index <= 3391) : (index += 1) { instance.array[index] = true; } index = 3392; while (index <= 3393) : (index += 1) { instance.array[index] = true; } index = 3394; while (index <= 3399) : (index += 1) { instance.array[index] = true; } instance.array[3400] = true; instance.array[3402] = true; index = 3413; while (index <= 3415) : (index += 1) { instance.array[index] = true; } instance.array[3416] = true; index = 5069; while (index <= 5070) : (index += 1) { instance.array[index] = true; } index = 5101; while (index <= 5102) : (index += 1) { instance.array[index] = true; } index = 5133; while (index <= 5134) : (index += 1) { instance.array[index] = true; } index = 5165; while (index <= 5166) : (index += 1) { instance.array[index] = true; } instance.array[5233] = true; index = 5234; while (index <= 5240) : (index += 1) { instance.array[index] = true; } index = 5241; while (index <= 5248) : (index += 1) { instance.array[index] = true; } instance.array[5249] = true; index = 5250; while (index <= 5251) : (index += 1) { instance.array[index] = true; } index = 5440; while (index <= 5441) : (index += 1) { instance.array[index] = true; } instance.array[5476] = true; index = 5595; while (index <= 5597) : (index += 1) { instance.array[index] = true; } index = 5598; while (index <= 5601) : (index += 1) { instance.array[index] = true; } index = 5602; while (index <= 5603) : (index += 1) { instance.array[index] = true; } index = 5604; while (index <= 5606) : (index += 1) { instance.array[index] = true; } index = 5611; while (index <= 5612) : (index += 1) { instance.array[index] = true; } instance.array[5613] = true; index = 5614; while (index <= 5619) : (index += 1) { instance.array[index] = true; } index = 5842; while (index <= 5843) : (index += 1) { instance.array[index] = true; } index = 5844; while (index <= 5845) : (index += 1) { instance.array[index] = true; } instance.array[5846] = true; instance.array[5904] = true; instance.array[5905] = true; instance.array[5906] = true; index = 5907; while (index <= 5913) : (index += 1) { instance.array[index] = true; } instance.array[5916] = true; instance.array[5917] = true; index = 5918; while (index <= 5919) : (index += 1) { instance.array[index] = true; } index = 5920; while (index <= 5927) : (index += 1) { instance.array[index] = true; } index = 5928; while (index <= 5933) : (index += 1) { instance.array[index] = true; } index = 5934; while (index <= 5935) : (index += 1) { instance.array[index] = true; } index = 6010; while (index <= 6011) : (index += 1) { instance.array[index] = true; } index = 6075; while (index <= 6078) : (index += 1) { instance.array[index] = true; } instance.array[6079] = true; instance.array[6128] = true; index = 6129; while (index <= 6133) : (index += 1) { instance.array[index] = true; } instance.array[6134] = true; instance.array[6135] = true; index = 6136; while (index <= 6140) : (index += 1) { instance.array[index] = true; } instance.array[6141] = true; instance.array[6142] = true; index = 6203; while (index <= 6204) : (index += 1) { instance.array[index] = true; } instance.array[6205] = true; instance.array[6236] = true; index = 6237; while (index <= 6240) : (index += 1) { instance.array[index] = true; } index = 6241; while (index <= 6242) : (index += 1) { instance.array[index] = true; } index = 6243; while (index <= 6244) : (index += 1) { instance.array[index] = true; } index = 6247; while (index <= 6248) : (index += 1) { instance.array[index] = true; } instance.array[6306] = true; index = 6307; while (index <= 6308) : (index += 1) { instance.array[index] = true; } index = 6309; while (index <= 6311) : (index += 1) { instance.array[index] = true; } instance.array[6312] = true; instance.array[6313] = true; index = 6314; while (index <= 6316) : (index += 1) { instance.array[index] = true; } index = 6367; while (index <= 6374) : (index += 1) { instance.array[index] = true; } index = 6375; while (index <= 6382) : (index += 1) { instance.array[index] = true; } index = 6383; while (index <= 6384) : (index += 1) { instance.array[index] = true; } instance.array[6385] = true; index = 6818; while (index <= 6831) : (index += 1) { instance.array[index] = true; } index = 8561; while (index <= 8612) : (index += 1) { instance.array[index] = true; } index = 10907; while (index <= 10938) : (index += 1) { instance.array[index] = true; } index = 41775; while (index <= 41782) : (index += 1) { instance.array[index] = true; } index = 41817; while (index <= 41818) : (index += 1) { instance.array[index] = true; } instance.array[42173] = true; instance.array[42182] = true; index = 42206; while (index <= 42207) : (index += 1) { instance.array[index] = true; } index = 42208; while (index <= 42209) : (index += 1) { instance.array[index] = true; } instance.array[42210] = true; index = 42299; while (index <= 42300) : (index += 1) { instance.array[index] = true; } index = 42351; while (index <= 42366) : (index += 1) { instance.array[index] = true; } instance.array[42368] = true; instance.array[42426] = true; index = 42465; while (index <= 42469) : (index += 1) { instance.array[index] = true; } index = 42498; while (index <= 42508) : (index += 1) { instance.array[index] = true; } instance.array[42509] = true; index = 42555; while (index <= 42557) : (index += 1) { instance.array[index] = true; } instance.array[42558] = true; index = 42607; while (index <= 42608) : (index += 1) { instance.array[index] = true; } index = 42609; while (index <= 42612) : (index += 1) { instance.array[index] = true; } index = 42613; while (index <= 42614) : (index += 1) { instance.array[index] = true; } index = 42615; while (index <= 42616) : (index += 1) { instance.array[index] = true; } index = 42617; while (index <= 42618) : (index += 1) { instance.array[index] = true; } instance.array[42656] = true; index = 42724; while (index <= 42729) : (index += 1) { instance.array[index] = true; } index = 42730; while (index <= 42731) : (index += 1) { instance.array[index] = true; } index = 42732; while (index <= 42733) : (index += 1) { instance.array[index] = true; } index = 42734; while (index <= 42735) : (index += 1) { instance.array[index] = true; } index = 42736; while (index <= 42737) : (index += 1) { instance.array[index] = true; } instance.array[42750] = true; instance.array[42759] = true; instance.array[42760] = true; instance.array[42806] = true; instance.array[42807] = true; instance.array[42808] = true; instance.array[42859] = true; index = 42861; while (index <= 42863) : (index += 1) { instance.array[index] = true; } index = 42866; while (index <= 42867) : (index += 1) { instance.array[index] = true; } instance.array[42873] = true; instance.array[42918] = true; index = 42919; while (index <= 42920) : (index += 1) { instance.array[index] = true; } index = 42921; while (index <= 42922) : (index += 1) { instance.array[index] = true; } instance.array[42928] = true; index = 43166; while (index <= 43167) : (index += 1) { instance.array[index] = true; } instance.array[43168] = true; index = 43169; while (index <= 43170) : (index += 1) { instance.array[index] = true; } instance.array[43171] = true; index = 43172; while (index <= 43173) : (index += 1) { instance.array[index] = true; } instance.array[63449] = true; index = 65585; while (index <= 65589) : (index += 1) { instance.array[index] = true; } index = 67260; while (index <= 67262) : (index += 1) { instance.array[index] = true; } index = 67264; while (index <= 67265) : (index += 1) { instance.array[index] = true; } index = 67271; while (index <= 67274) : (index += 1) { instance.array[index] = true; } index = 68063; while (index <= 68066) : (index += 1) { instance.array[index] = true; } index = 68454; while (index <= 68455) : (index += 1) { instance.array[index] = true; } instance.array[68795] = true; instance.array[68796] = true; instance.array[68797] = true; index = 68851; while (index <= 68864) : (index += 1) { instance.array[index] = true; } instance.array[68925] = true; index = 68971; while (index <= 68973) : (index += 1) { instance.array[index] = true; } index = 68974; while (index <= 68977) : (index += 1) { instance.array[index] = true; } index = 68978; while (index <= 68979) : (index += 1) { instance.array[index] = true; } index = 69051; while (index <= 69053) : (index += 1) { instance.array[index] = true; } index = 69090; while (index <= 69094) : (index += 1) { instance.array[index] = true; } instance.array[69095] = true; index = 69096; while (index <= 69101) : (index += 1) { instance.array[index] = true; } index = 69120; while (index <= 69121) : (index += 1) { instance.array[index] = true; } index = 69179; while (index <= 69180) : (index += 1) { instance.array[index] = true; } instance.array[69181] = true; index = 69230; while (index <= 69232) : (index += 1) { instance.array[index] = true; } index = 69233; while (index <= 69241) : (index += 1) { instance.array[index] = true; } instance.array[69242] = true; instance.array[69257] = true; instance.array[69258] = true; index = 69351; while (index <= 69353) : (index += 1) { instance.array[index] = true; } index = 69354; while (index <= 69356) : (index += 1) { instance.array[index] = true; } index = 69357; while (index <= 69358) : (index += 1) { instance.array[index] = true; } instance.array[69359] = true; instance.array[69362] = true; instance.array[69369] = true; instance.array[69530] = true; index = 69531; while (index <= 69533) : (index += 1) { instance.array[index] = true; } index = 69534; while (index <= 69539) : (index += 1) { instance.array[index] = true; } index = 69563; while (index <= 69564) : (index += 1) { instance.array[index] = true; } index = 69565; while (index <= 69566) : (index += 1) { instance.array[index] = true; } index = 69625; while (index <= 69626) : (index += 1) { instance.array[index] = true; } instance.array[69627] = true; index = 69628; while (index <= 69631) : (index += 1) { instance.array[index] = true; } index = 69634; while (index <= 69635) : (index += 1) { instance.array[index] = true; } index = 69638; while (index <= 69639) : (index += 1) { instance.array[index] = true; } instance.array[69650] = true; index = 69661; while (index <= 69662) : (index += 1) { instance.array[index] = true; } index = 69872; while (index <= 69874) : (index += 1) { instance.array[index] = true; } index = 69875; while (index <= 69882) : (index += 1) { instance.array[index] = true; } index = 69883; while (index <= 69884) : (index += 1) { instance.array[index] = true; } index = 69886; while (index <= 69887) : (index += 1) { instance.array[index] = true; } instance.array[69888] = true; index = 69995; while (index <= 69997) : (index += 1) { instance.array[index] = true; } index = 69998; while (index <= 70003) : (index += 1) { instance.array[index] = true; } instance.array[70004] = true; instance.array[70005] = true; index = 70006; while (index <= 70009) : (index += 1) { instance.array[index] = true; } index = 70010; while (index <= 70011) : (index += 1) { instance.array[index] = true; } instance.array[70012] = true; index = 70250; while (index <= 70252) : (index += 1) { instance.array[index] = true; } index = 70253; while (index <= 70256) : (index += 1) { instance.array[index] = true; } index = 70259; while (index <= 70262) : (index += 1) { instance.array[index] = true; } index = 70263; while (index <= 70264) : (index += 1) { instance.array[index] = true; } instance.array[70265] = true; index = 70295; while (index <= 70296) : (index += 1) { instance.array[index] = true; } index = 70379; while (index <= 70381) : (index += 1) { instance.array[index] = true; } index = 70382; while (index <= 70389) : (index += 1) { instance.array[index] = true; } index = 70390; while (index <= 70391) : (index += 1) { instance.array[index] = true; } instance.array[70392] = true; instance.array[70393] = true; instance.array[70395] = true; instance.array[70502] = true; instance.array[70503] = true; instance.array[70504] = true; index = 70505; while (index <= 70506) : (index += 1) { instance.array[index] = true; } index = 70507; while (index <= 70512) : (index += 1) { instance.array[index] = true; } index = 70616; while (index <= 70618) : (index += 1) { instance.array[index] = true; } index = 70619; while (index <= 70620) : (index += 1) { instance.array[index] = true; } index = 70621; while (index <= 70624) : (index += 1) { instance.array[index] = true; } instance.array[70625] = true; index = 70626; while (index <= 70629) : (index += 1) { instance.array[index] = true; } index = 70887; while (index <= 70889) : (index += 1) { instance.array[index] = true; } index = 70890; while (index <= 70898) : (index += 1) { instance.array[index] = true; } instance.array[70899] = true; index = 71147; while (index <= 71152) : (index += 1) { instance.array[index] = true; } index = 71154; while (index <= 71155) : (index += 1) { instance.array[index] = true; } index = 71158; while (index <= 71159) : (index += 1) { instance.array[index] = true; } instance.array[71163] = true; instance.array[71165] = true; index = 71308; while (index <= 71310) : (index += 1) { instance.array[index] = true; } index = 71311; while (index <= 71314) : (index += 1) { instance.array[index] = true; } index = 71317; while (index <= 71318) : (index += 1) { instance.array[index] = true; } index = 71319; while (index <= 71322) : (index += 1) { instance.array[index] = true; } instance.array[71327] = true; index = 71356; while (index <= 71365) : (index += 1) { instance.array[index] = true; } index = 71408; while (index <= 71411) : (index += 1) { instance.array[index] = true; } instance.array[71412] = true; index = 71414; while (index <= 71417) : (index += 1) { instance.array[index] = true; } index = 71436; while (index <= 71441) : (index += 1) { instance.array[index] = true; } index = 71442; while (index <= 71443) : (index += 1) { instance.array[index] = true; } index = 71444; while (index <= 71446) : (index += 1) { instance.array[index] = true; } index = 71493; while (index <= 71505) : (index += 1) { instance.array[index] = true; } instance.array[71506] = true; instance.array[71914] = true; index = 71915; while (index <= 71921) : (index += 1) { instance.array[index] = true; } index = 71923; while (index <= 71928) : (index += 1) { instance.array[index] = true; } instance.array[71929] = true; index = 72013; while (index <= 72034) : (index += 1) { instance.array[index] = true; } instance.array[72036] = true; index = 72037; while (index <= 72043) : (index += 1) { instance.array[index] = true; } instance.array[72044] = true; index = 72045; while (index <= 72046) : (index += 1) { instance.array[index] = true; } instance.array[72047] = true; index = 72048; while (index <= 72049) : (index += 1) { instance.array[index] = true; } index = 72172; while (index <= 72177) : (index += 1) { instance.array[index] = true; } instance.array[72181] = true; index = 72183; while (index <= 72184) : (index += 1) { instance.array[index] = true; } index = 72186; while (index <= 72188) : (index += 1) { instance.array[index] = true; } instance.array[72190] = true; instance.array[72194] = true; index = 72261; while (index <= 72265) : (index += 1) { instance.array[index] = true; } index = 72267; while (index <= 72268) : (index += 1) { instance.array[index] = true; } index = 72270; while (index <= 72271) : (index += 1) { instance.array[index] = true; } instance.array[72272] = true; instance.array[72273] = true; index = 72622; while (index <= 72623) : (index += 1) { instance.array[index] = true; } index = 72624; while (index <= 72625) : (index += 1) { instance.array[index] = true; } instance.array[93194] = true; index = 93196; while (index <= 93250) : (index += 1) { instance.array[index] = true; } index = 93258; while (index <= 93261) : (index += 1) { instance.array[index] = true; } index = 93355; while (index <= 93356) : (index += 1) { instance.array[index] = true; } instance.array[112985] = true; index = 122043; while (index <= 122049) : (index += 1) { instance.array[index] = true; } index = 122051; while (index <= 122067) : (index += 1) { instance.array[index] = true; } index = 122070; while (index <= 122076) : (index += 1) { instance.array[index] = true; } index = 122078; while (index <= 122079) : (index += 1) { instance.array[index] = true; } index = 122081; while (index <= 122085) : (index += 1) { instance.array[index] = true; } instance.array[124418] = true; index = 126443; while (index <= 126468) : (index += 1) { instance.array[index] = true; } index = 126475; while (index <= 126500) : (index += 1) { instance.array[index] = true; } index = 126507; while (index <= 126532) : (index += 1) { instance.array[index] = true; } // Placeholder: 0. Struct name, 1. Code point kind return instance; } pub fn deinit(self: *OtherAlphabetic) void { self.allocator.free(self.array); } // isOtherAlphabetic checks if cp is of the kind Other_Alphabetic. pub fn isOtherAlphabetic(self: OtherAlphabetic, cp: u21) bool { if (cp < self.lo or cp > self.hi) return false; const index = cp - self.lo; return if (index >= self.array.len) false else self.array[index]; }
src/components/autogen/PropList/OtherAlphabetic.zig
const util = @import("../sdf_util.zig"); pub const info: util.SdfInfo = .{ .name = "Capped Cone", .data_size = @sizeOf(Data), .function_definition = function_definition, .enter_command_fn = util.surfaceEnterCommand(Data), .exit_command_fn = util.surfaceExitCommand(Data, exitCommand), .append_mat_check_fn = util.surfaceMatCheckCommand(Data), .sphere_bound_fn = sphereBound, }; pub const Data = struct { start: util.math.vec3, end: util.math.vec3, start_radius: f32, end_radius: f32, mat: usize, }; const function_definition: []const u8 = \\float sdCappedCone(vec3 p, vec3 a, vec3 b, float ra, float rb){ \\ float rba = rb - ra; \\ float baba = dot(b-a,b-a); \\ float papa = dot(p-a,p-a); \\ float paba = dot(p-a,b-a)/baba; \\ float x = sqrt(papa - paba*paba*baba); \\ float cax = max(0.,x-((paba<.5)?ra:rb)); \\ float cay = abs(paba-.5)-.5; \\ float k = rba*rba + baba; \\ float f = clamp((rba*(x-ra)+paba*baba)/k,0.,1.); \\ float cbx = x-ra-f*rba; \\ float cby = paba - f; \\ float s = (cbx < 0. && cay < 0.) ? -1. : 1.; \\ return s * sqrt(min(cax*cax + cay*cay*baba, cbx*cbx + cby*cby*baba)); \\} \\ ; fn exitCommand(data: *Data, enter_index: usize, cur_point_name: []const u8, allocator: util.std.mem.Allocator) []const u8 { const format: []const u8 = "float d{d} = sdCappedCone({s}, vec3({d:.5},{d:.5},{d:.5}),vec3({d:.5},{d:.5},{d:.5}),{d:.5},{d:.5});"; return util.std.fmt.allocPrint(allocator, format, .{ enter_index, cur_point_name, data.start[0], data.start[1], data.start[2], data.end[0], data.end[1], data.end[2], data.start_radius, data.end_radius, }) catch unreachable; } fn sphereBound(buffer: *[]u8, bound: *util.math.sphereBound, children: []util.math.sphereBound) void { _ = children; const data: *Data = @ptrCast(*Data, @alignCast(@alignOf(Data), buffer.ptr)); bound.* = util.math.SphereBound.merge( .{ .pos = data.start, .r = data.start_radius, }, .{ .pos = data.end, .r = data.end_radius, }, ); }
src/sdf/surfaces/capped_cone.zig
const builtin = @import("builtin"); const utils = @import("utils"); const kernel = @import("root").kernel; const print = kernel.print; const platform = @import("platform.zig"); const kernel_to_virtual = platform.kernel_to_virtual; const TaskStateSegment = packed struct { link: u16 = 0, zero1: u16 = 0, esp0: u32 = 0, ss0: u16 = 0, zero2: u16 = 0, esp1: u32 = 0, ss1: u16 = 0, zero3: u16 = 0, esp2: u32 = 0, ss2: u16 = 0, zero4: u16 = 0, cr3: u32 = 0, eip: u32 = 0, eflags: u32 = 0, eax: u32 = 0, ecx: u32 = 0, edx: u32 = 0, ebx: u32 = 0, esp: u32 = 0, ebp: u32 = 0, esi: u32 = 0, edi: u32 = 0, es: u16 = 0, zero5: u16 = 0, cs: u16 = 0, zero6: u16 = 0, ss: u16 = 0, zero7: u16 = 0, ds: u16 = 0, zero8: u16 = 0, fs: u16 = 0, zero9: u16 = 0, gs: u16 = 0, zero10: u16 = 0, ldt_selector: u16 = 0, zero11: u16 = 0, trap: bool = false, zero12: u15 = 0, io_map: u16 = 0, }; var task_state_segment = TaskStateSegment{}; pub fn set_interrupt_handler_stack(esp: u32) void { task_state_segment.esp0 = esp; task_state_segment.ss0 = kernel_data_selector; } const Access = packed struct { accessed: bool = false, /// Readable Flag for Code Selectors, Writable Bit for Data Selectors rw: bool = true, /// Direction/Conforming Flag /// For data selectors sets the direction of segment growth. I don't think /// I care about that. For code selectors true means code in this segment /// can be executed by lower rings. dc: bool = false, /// True for Code Selectors, False for Data Selectors executable: bool = false, /// True for Code and Data Segments no_system_segment: bool = true, /// 0 (User) through 3 (Kernel) ring_level: u2 = 0, valid: bool = true, }; const Flags = packed struct { always_zero: u2 = 0, /// Protected Mode (32 bits) segment if true pm: bool = true, /// Limit is bytes if this is true, else limit is in pages. granularity: bool = true, }; const Entry = packed struct { limit_0_15: u16, base_0_15: u16, base_16_23: u8, access: Access, // TODO: Zig Bug? // Highest 4 bits of limit and flags. Was going to have this be two 4 bit // fields, but that wasn't the same thing as this for some reason... limit_16_19: u8, base_24_31: u8, }; var table: [6]Entry = undefined; pub var names: [table.len][]const u8 = undefined; pub fn get_name(index: u32) []const u8 { return if (index < names.len) names[index] else "Selector index is out of range"; } fn set(name: []const u8, index: u8, base: u32, limit: u32, access: Access, flags: Flags) u16 { names[index] = name; print.debug_format(" - [{}]: \"{}\" ", .{index, name}); if (access.valid) { print.debug_format("\n - starts at {:a}, size is {:x} {}, {} Ring {} ", .{ base, limit, if (flags.granularity) @as([]const u8, "b") else @as([]const u8, "pages"), if (flags.pm) @as([]const u8, "32b") else @as([]const u8, "16b"), @intCast(usize, access.ring_level)}); if (access.no_system_segment) { if (access.executable) { print.debug_format( "Code Segment\n" ++ " - Can{} be read by lower rings.\n" ++ " - Can{} be executed by lower rings\n", .{ if (access.rw) @as([]const u8, "") else @as([]const u8, " NOT"), if (access.dc) @as([]const u8, "") else @as([]const u8, " NOT")}); } else { print.debug_format( "Data Segment\n" ++ " - Can{} be written to by lower rings.\n" ++ " - Grows {}.\n", .{ if (access.rw) @as([]const u8, "") else @as([]const u8, " NOT"), if (access.dc) @as([]const u8, "down") else @as([]const u8, "up")}); } } else { print.debug_string("System Segment\n"); } if (access.accessed) { print.debug_string(" - Accessed\n"); } } else { print.debug_char('\n'); } table[index].limit_0_15 = @intCast(u16, limit & 0xffff); table[index].base_0_15 = @intCast(u16, base & 0xffff); table[index].base_16_23 = @intCast(u8, (base >> 16) & 0xff); table[index].access = access; table[index].limit_16_19 = @intCast(u8, (limit >> 16) & 0xf) | (@intCast(u8, @bitCast(u4, flags)) << 4); table[index].base_24_31 = @intCast(u8, (base >> 24) & 0xff); return (index << 3) | access.ring_level; } fn set_null_entry(index: u8) void { _ = set("Null", index, 0, 0, utils.zero_init(Access), utils.zero_init(Flags)); names[index] = "Null"; } const Pointer = packed struct { limit: u16, base: u32, }; extern fn gdt_load(pointer: *const Pointer) void; comptime { asm ( \\ .section .text \\ .global gdt_load \\ .type gdt_load, @function \\ gdt_load: \\ movl 4(%esp), %eax \\ lgdt (%eax) \\ movw (kernel_data_selector), %ax \\ movw %ax, %ds \\ movw %ax, %es \\ movw %ax, %fs \\ movw %ax, %gs \\ movw %ax, %ss \\ pushl (kernel_code_selector) \\ push $.gdt_complete_load \\ ljmp *(%esp) \\ .gdt_complete_load: \\ movw (tss_selector), %ax \\ ltr %ax \\ add $8, %esp \\ ret ); } pub var kernel_code_selector: u16 = 0; pub var kernel_data_selector: u16 = 0; pub var user_code_selector: u16 = 0; pub var user_data_selector: u16 = 0; export var tss_selector: u16 = 0; pub fn init() void { print.debug_string(" - Filling the Global Descriptor Table (GDT)\n"); set_null_entry(0); const flags = Flags{}; kernel_code_selector = set("Kernel Code", 1, 0, 0xFFFFFFFF, Access{.ring_level = 0, .executable = true}, flags); kernel_data_selector = set("Kernel Data", 2, 0, 0xFFFFFFFF, Access{.ring_level = 0}, flags); user_code_selector = set("User Code", 3, 0, kernel_to_virtual(0) - 1, Access{.ring_level = 3, .executable = true}, flags); user_data_selector = set("User Data", 4, 0, kernel_to_virtual(0) - 1, Access{.ring_level = 3}, flags); tss_selector = set("Task State", 5, @ptrToInt(&task_state_segment), @sizeOf(TaskStateSegment) - 1, // TODO: Make This Explicit @bitCast(Access, @as(u8, 0xe9)), @bitCast(Flags, @as(u4, 0))); const pointer = Pointer { .limit = @intCast(u16, @sizeOf(@TypeOf(table)) - 1), .base = @intCast(u32, @ptrToInt(&table)), }; gdt_load(&pointer); }
kernel/platform/segments.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "XINERAMA", .global_id = 0 }; /// @brief ScreenInfo pub const ScreenInfo = struct { @"x_org": i16, @"y_org": i16, @"width": u16, @"height": u16, }; /// @brief QueryVersioncookie pub const QueryVersioncookie = struct { sequence: c_uint, }; /// @brief QueryVersionRequest pub const QueryVersionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 0, @"length": u16, @"major": u8, @"minor": u8, }; /// @brief QueryVersionReply pub const QueryVersionReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"major": u16, @"minor": u16, }; /// @brief GetStatecookie pub const GetStatecookie = struct { sequence: c_uint, }; /// @brief GetStateRequest pub const GetStateRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 1, @"length": u16, @"window": xcb.WINDOW, }; /// @brief GetStateReply pub const GetStateReply = struct { @"response_type": u8, @"state": u8, @"sequence": u16, @"length": u32, @"window": xcb.WINDOW, }; /// @brief GetScreenCountcookie pub const GetScreenCountcookie = struct { sequence: c_uint, }; /// @brief GetScreenCountRequest pub const GetScreenCountRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 2, @"length": u16, @"window": xcb.WINDOW, }; /// @brief GetScreenCountReply pub const GetScreenCountReply = struct { @"response_type": u8, @"screen_count": u8, @"sequence": u16, @"length": u32, @"window": xcb.WINDOW, }; /// @brief GetScreenSizecookie pub const GetScreenSizecookie = struct { sequence: c_uint, }; /// @brief GetScreenSizeRequest pub const GetScreenSizeRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 3, @"length": u16, @"window": xcb.WINDOW, @"screen": u32, }; /// @brief GetScreenSizeReply pub const GetScreenSizeReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"width": u32, @"height": u32, @"window": xcb.WINDOW, @"screen": u32, }; /// @brief IsActivecookie pub const IsActivecookie = struct { sequence: c_uint, }; /// @brief IsActiveRequest pub const IsActiveRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 4, @"length": u16, }; /// @brief IsActiveReply pub const IsActiveReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"state": u32, }; /// @brief QueryScreenscookie pub const QueryScreenscookie = struct { sequence: c_uint, }; /// @brief QueryScreensRequest pub const QueryScreensRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 5, @"length": u16, }; /// @brief QueryScreensReply pub const QueryScreensReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"number": u32, @"pad1": [20]u8, @"screen_info": []xcb.xinerama.ScreenInfo, }; test "" { @import("std").testing.refAllDecls(@This()); }
src/auto/xinerama.zig
const xcb = @import("../xcb.zig"); pub const id = xcb.Extension{ .name = "DRI3", .global_id = 0 }; /// @brief QueryVersioncookie pub const QueryVersioncookie = struct { sequence: c_uint, }; /// @brief QueryVersionRequest pub const QueryVersionRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 0, @"length": u16, @"major_version": u32, @"minor_version": u32, }; /// @brief QueryVersionReply pub const QueryVersionReply = struct { @"response_type": u8, @"pad0": u8, @"sequence": u16, @"length": u32, @"major_version": u32, @"minor_version": u32, }; /// @brief Opencookie pub const Opencookie = struct { sequence: c_uint, }; /// @brief OpenRequest pub const OpenRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 1, @"length": u16, @"drawable": xcb.DRAWABLE, @"provider": u32, }; /// @brief OpenReply pub const OpenReply = struct { @"response_type": u8, @"nfd": u8, @"sequence": u16, @"length": u32, @"pad0": [24]u8, }; /// @brief PixmapFromBufferRequest pub const PixmapFromBufferRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 2, @"length": u16, @"pixmap": xcb.PIXMAP, @"drawable": xcb.DRAWABLE, @"size": u32, @"width": u16, @"height": u16, @"stride": u16, @"depth": u8, @"bpp": u8, }; /// @brief BufferFromPixmapcookie pub const BufferFromPixmapcookie = struct { sequence: c_uint, }; /// @brief BufferFromPixmapRequest pub const BufferFromPixmapRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 3, @"length": u16, @"pixmap": xcb.PIXMAP, }; /// @brief BufferFromPixmapReply pub const BufferFromPixmapReply = struct { @"response_type": u8, @"nfd": u8, @"sequence": u16, @"length": u32, @"size": u32, @"width": u16, @"height": u16, @"stride": u16, @"depth": u8, @"bpp": u8, @"pad0": [12]u8, }; /// @brief FenceFromFDRequest pub const FenceFromFDRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 4, @"length": u16, @"drawable": xcb.DRAWABLE, @"fence": u32, @"initially_triggered": u8, @"pad0": [3]u8, }; /// @brief FDFromFencecookie pub const FDFromFencecookie = struct { sequence: c_uint, }; /// @brief FDFromFenceRequest pub const FDFromFenceRequest = struct { @"major_opcode": u8, @"minor_opcode": u8 = 5, @"length": u16, @"drawable": xcb.DRAWABLE, @"fence": u32, }; /// @brief FDFromFenceReply pub const FDFromFenceReply = struct { @"response_type": u8, @"nfd": u8, @"sequence": u16, @"length": u32, @"pad0": [24]u8, }; test "" { @import("std").testing.refAllDecls(@This()); }
src/auto/dri3.zig
const std = @import("std"); const Queue = std.atomic.Queue; const warn = std.debug.warn; test "print_data" { const S = struct.{ const Self = @This(); b1: u1, i: u8, ai: []u8, /// Custom format routine for S pub fn format(self: *const Self, comptime fmt: []const u8, context: var, comptime FmtError: type, output: fn (@typeOf(context), []const u8) FmtError!void ) FmtError!void { try std.fmt.format(context, FmtError, output, "{{"); try std.fmt.format(context, FmtError, output, ".b1={} .i={} .ai={{", self.b1, self.i); for (self.ai) |v| { try std.fmt.format(context, FmtError, output, "{x},", v); } try std.fmt.format(context, FmtError, output, "}}"); try std.fmt.format(context, FmtError, output, "}}"); } }; var a = "abcdef"; warn("&a={*} a={}\n", &a, a); var s = S.{.b1=1, .i=123, .ai=a[0..2]}; warn("s = S {*}\n", &s); warn("s = S {}\n", &s); warn("s.b1={}\n", s.b1); warn("s.i={}\n", s.i); warn("s.ai={}\n", s.ai); warn("&s.ai={*} &a={*}\n", &s.ai, &a); warn("&s.ai[0]={*}\n", &s.ai[0]); warn("s.ai[0]={c}\n", s.ai[0]); warn("s.ai[1]={x}\n", s.ai[1]); const Q = Queue(u32); var q = Q.init(); q.dump(); var da = std.heap.DirectAllocator.init(); defer da.deinit(); var allocator = &da.allocator; var node: *Q.Node = try allocator.create(Q.Node.{ .data=1, .next=undefined, .prev=undefined, }); defer allocator.destroy(node); q.put(node); q.dump(); var node0 = Q.Node.{ .data = 123, .next = undefined, .prev = undefined, }; q.put(&node0); q.dump(); var node1 = Q.Node.{ .data = 456, .next = undefined, .prev = undefined, }; q.put(&node1); q.dump(); var b = []Q.Node.{ Q.Node.{ .data = 789, .next = undefined, .prev = undefined }, Q.Node.{ .data = 012, .next = undefined, .prev = undefined }, }; q.put(&b[0]); q.dump(); q.put(&b[1]); q.dump(); }
print-data/print_data.zig
const std = @import("std"); const iup = @import("iup.zig"); const fmt = std.fmt; const MainLoop = iup.MainLoop; const Dialog = iup.Dialog; const Button = iup.Button; const MessageDlg = iup.MessageDlg; const Multiline = iup.Multiline; const Label = iup.Label; const Text = iup.Text; const VBox = iup.VBox; const HBox = iup.HBox; const Menu = iup.Menu; const SubMenu = iup.SubMenu; const Separator = iup.Separator; const Fill = iup.Fill; const Item = iup.Item; const FileDlg = iup.FileDlg; const Toggle = iup.Toggle; const Tabs = iup.Tabs; const Frame = iup.Frame; const Radio = iup.Radio; const ScreenSize = iup.ScreenSize; const Image = iup.Image; const ImageRgb = iup.ImageRgb; const ImageRgba = iup.ImageRgba; var allocator: std.mem.Allocator = undefined; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); allocator = gpa.allocator(); try MainLoop.open(); defer MainLoop.close(); var dlg = try create_dialog(); defer dlg.deinit(); try dlg.showXY(.Center, .Center); try MainLoop.beginLoop(); } fn create_dialog() !*Dialog { var img_x = try images.getX(); var img_cursor = try images.getCursor(); var str_size = try fmt.allocPrintZ(allocator, "\"X\" image width = {}; \"X\" image height = {}", .{ img_x.getWidth(), img_x.getHeight() }); defer allocator.free(str_size); return try (Dialog.init() .setTitle("IUPforZig - Images") .setSize(.Third, .Quarter) .setCursor(img_cursor) .setChildren( .{ VBox.init() .setChildren( .{ VBox.init() .setMargin(2, 2) .setChildren( .{ HBox.init() .setGap(5) .setChildren( .{ Frame.init() .setSize(60, 60) .setTitle("button") .setChildren( .{ Button.init() .setImage(img_x), }, ), Frame.init() .setSize(60, 60) .setTitle("label") .setChildren( .{ Label.init() .setImage(img_x), }, ), Frame.init() .setSize(60, 60) .setTitle("toggle") .setChildren( .{ Toggle.init() .setImage(img_x), }, ), Frame.init() .setSize(60, 60) .setTitle("radio") .setChildren( .{ Radio.init() .setChildren( .{ VBox.init() .setChildren( .{ Toggle.init() .setImage(img_x), Toggle.init() .setImage(img_x), }, ), }, ), }, ), }, ), Fill.init(), HBox.init() .setChildren( .{ Fill.init(), Label.init().setTitle(str_size), Fill.init(), }, ), }, ), }, ), }, ) .unwrap()); } const images = struct { const pixelmap_x = [_]u8{ // zig fmt: off 1,2,3,3,3,3,3,3,3,2,1, 2,1,2,3,3,3,3,3,2,1,2, 3,2,1,2,3,3,3,2,1,2,3, 3,3,2,1,2,3,2,1,2,3,3, 3,3,3,2,1,2,1,2,3,3,3, 3,3,3,3,2,1,2,3,3,3,3, 3,3,3,2,1,2,1,2,3,3,3, 3,3,2,1,2,3,2,1,2,3,3, 3,2,1,2,3,3,3,2,1,2,3, 2,1,2,3,3,3,3,3,2,1,2, 1,2,3,3,3,3,3,3,3,2,1 }; // zig fmt: on const pixelmap_cursor = [_]u8{ // zig fmt: off 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,2,2,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,1,1,2,0,0,2,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,2,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, }; // zig fmt: on pub fn getX() !*Image { return try (Image.init(11, 11, pixelmap_x[0..]) .setHandle("img_x") .setColors(1, .{ .r = 0, .g = 1, .b = 0 }) .setColors(2, .{ .r = 255, .g = 0, .b = 0 }) .setColors(3, .{ .r = 255, .g = 255, .b = 0 }) .unwrap()); } pub fn getCursor() !*Image { return try (Image.init(32, 32, pixelmap_cursor[0..]) .setHandle("img_cursor ") .setHotspot(21, 10) .setColors(1, .{ .r = 255, .g = 0, .b = 0 }) .setColors(2, .{ .r = 128, .g = 0, .b = 0 }) .unwrap()); } };
src/image_example.zig
const std = @import("std"); const assert = std.debug.assert; const math = std.math; const log = std.log.scoped(.packet_simulator); pub const PacketSimulatorOptions = struct { /// Mean for the exponential distribution used to calculate forward delay. one_way_delay_mean: u64, one_way_delay_min: u64, packet_loss_probability: u8, packet_replay_probability: u8, seed: u64, replica_count: u8, client_count: u8, node_count: u8, /// How the partitions should be generated partition_mode: PartitionMode, /// Probability per tick that a partition will occur partition_probability: u8, /// Probability per tick that a partition will resolve unpartition_probability: u8, /// Minimum time a partition lasts partition_stability: u32, /// Minimum time the cluster is fully connected until it is partitioned again unpartition_stability: u32, /// The maximum number of in-flight packets a path can have before packets are randomly dropped. path_maximum_capacity: u8, /// Mean for the exponential distribution used to calculate how long a path is clogged for. path_clog_duration_mean: u64, path_clog_probability: u8, }; pub const Path = struct { source: u8, target: u8, }; /// Determines how the partitions are created. Partitions /// are two-way, i.e. if i cannot communicate with j, then /// j cannot communicate with i. /// /// Only replicas are partitioned. There will always be exactly two partitions. pub const PartitionMode = enum { /// Draws the size of the partition uniformly at random from (1, n-1). /// Replicas are randomly assigned a partition. uniform_size, /// Assigns each node to a partition uniformly at random. This biases towards /// equal-size partitions. uniform_partition, /// Isolates exactly one replica. isolate_single, /// User-defined partitioning algorithm. custom, }; /// A fully connected network of nodes used for testing. Simulates the fault model: /// Packets may be dropped. /// Packets may be delayed. /// Packets may be replayed. pub const PacketStatistics = enum(u8) { dropped_due_to_partition, dropped_due_to_congestion, dropped, replay, }; pub fn PacketSimulator(comptime Packet: type) type { return struct { const Self = @This(); const Data = struct { expiry: u64, callback: fn (packet: Packet, path: Path) void, packet: Packet, }; /// A send and receive path between each node in the network. We use the `path` function to /// index it. paths: []std.PriorityQueue(Data, void, Self.order_packets), /// We can arbitrary clog a path until a tick. path_clogged_till: []u64, ticks: u64 = 0, options: PacketSimulatorOptions, prng: std.rand.DefaultPrng, stats: [@typeInfo(PacketStatistics).Enum.fields.len]u32 = [_]u32{0} ** @typeInfo(PacketStatistics).Enum.fields.len, is_partitioned: bool, partition: []bool, replicas: []u8, stability: u32, pub fn init(allocator: std.mem.Allocator, options: PacketSimulatorOptions) !Self { assert(options.one_way_delay_mean >= options.one_way_delay_min); var self = Self{ .paths = try allocator.alloc( std.PriorityQueue(Data, void, Self.order_packets), @as(usize, options.node_count) * options.node_count, ), .path_clogged_till = try allocator.alloc( u64, @as(usize, options.node_count) * options.node_count, ), .options = options, .prng = std.rand.DefaultPrng.init(options.seed), .is_partitioned = false, .stability = options.unpartition_stability, .partition = try allocator.alloc(bool, @as(usize, options.replica_count)), .replicas = try allocator.alloc(u8, @as(usize, options.replica_count)), }; for (self.replicas) |_, i| { self.replicas[i] = @intCast(u8, i); } for (self.paths) |*queue| { queue.* = std.PriorityQueue(Data, void, Self.order_packets).init(allocator, {}); try queue.ensureTotalCapacity(options.path_maximum_capacity); } for (self.path_clogged_till) |*clogged_till| { clogged_till.* = 0; } return self; } pub fn deinit(self: *Self, allocator: std.mem.Allocator) void { for (self.paths) |*queue| { while (queue.popOrNull()) |*data| data.packet.deinit(); queue.deinit(); } allocator.free(self.paths); } fn order_packets(context: void, a: Data, b: Data) math.Order { _ = context; return math.order(a.expiry, b.expiry); } fn should_drop(self: *Self) bool { return self.prng.random().uintAtMost(u8, 100) < self.options.packet_loss_probability; } fn path_index(self: *Self, path: Path) usize { assert(path.source < self.options.node_count and path.target < self.options.node_count); return @as(usize, path.source) * self.options.node_count + path.target; } pub fn path_queue(self: *Self, path: Path) *std.PriorityQueue(Data, void, Self.order_packets) { return &self.paths[self.path_index(path)]; } fn is_clogged(self: *Self, path: Path) bool { return self.path_clogged_till[self.path_index(path)] > self.ticks; } fn should_clog(self: *Self, path: Path) bool { _ = path; return self.prng.random().uintAtMost(u8, 100) < self.options.path_clog_probability; } fn clog_for(self: *Self, path: Path, ticks: u64) void { const clog_expiry = &self.path_clogged_till[self.path_index(path)]; clog_expiry.* = self.ticks + ticks; log.debug("Path path.source={} path.target={} clogged for ticks={}", .{ path.source, path.target, ticks, }); } fn should_replay(self: *Self) bool { return self.prng.random().uintAtMost(u8, 100) < self.options.packet_replay_probability; } fn should_partition(self: *Self) bool { return self.prng.random().uintAtMost(u8, 100) < self.options.partition_probability; } fn should_unpartition(self: *Self) bool { return self.prng.random().uintAtMost(u8, 100) < self.options.unpartition_probability; } /// Return a value produced using an exponential distribution with /// the minimum and mean specified in self.options fn one_way_delay(self: *Self) u64 { const min = self.options.one_way_delay_min; const mean = self.options.one_way_delay_mean; return min + @floatToInt(u64, @intToFloat(f64, mean - min) * self.prng.random().floatExp(f64)); } /// Partitions the network. Guaranteed to isolate at least one replica. fn partition_network( self: *Self, ) void { assert(self.options.replica_count > 1); self.is_partitioned = true; self.stability = self.options.partition_stability; switch (self.options.partition_mode) { .uniform_size => { // Exclude cases sz == 0 and sz == replica_count const sz = 1 + self.prng.random().uintAtMost(u8, self.options.replica_count - 2); self.prng.random().shuffle(u8, self.replicas); for (self.replicas) |r, i| { self.partition[r] = i < sz; } }, .uniform_partition => { var only_same = true; self.partition[0] = self.prng.random().uintLessThan(u8, 2) == 1; var i: usize = 1; while (i < self.options.replica_count) : (i += 1) { self.partition[i] = self.prng.random().uintLessThan(u8, 2) == 1; only_same = only_same and (self.partition[i - 1] == self.partition[i]); } if (only_same) { const n = self.prng.random().uintLessThan(u8, self.options.replica_count); self.partition[n] = true; } }, .isolate_single => { for (self.replicas) |_, i| { self.partition[i] = false; } const n = self.prng.random().uintLessThan(u8, self.options.replica_count); self.partition[n] = true; }, // Put your own partitioning logic here. .custom => unreachable, } } fn unpartition_network( self: *Self, ) void { self.is_partitioned = false; self.stability = self.options.unpartition_stability; for (self.replicas) |_, i| { self.partition[i] = false; } } fn replicas_are_in_different_partitions(self: *Self, from: u8, to: u8) bool { return from < self.options.replica_count and to < self.options.replica_count and self.partition[from] != self.partition[to]; } pub fn tick(self: *Self) void { self.ticks += 1; if (self.stability > 0) { self.stability -= 1; } else { if (self.is_partitioned) { if (self.should_unpartition()) { self.unpartition_network(); log.err("unpartitioned network: partition={d}", .{self.partition}); } } else { if (self.options.replica_count > 1 and self.should_partition()) { self.partition_network(); log.err("partitioned network: partition={d}", .{self.partition}); } } } var from: u8 = 0; while (from < self.options.node_count) : (from += 1) { var to: u8 = 0; while (to < self.options.node_count) : (to += 1) { const path = .{ .source = from, .target = to }; if (self.is_clogged(path)) continue; const queue = self.path_queue(path); while (queue.peek()) |*data| { if (data.expiry > self.ticks) break; _ = queue.remove(); if (self.is_partitioned and self.replicas_are_in_different_partitions(from, to)) { self.stats[@enumToInt(PacketStatistics.dropped_due_to_partition)] += 1; log.err("dropped packet (different partitions): from={} to={}", .{ from, to }); data.packet.deinit(path); continue; } if (self.should_drop()) { self.stats[@enumToInt(PacketStatistics.dropped)] += 1; log.err("dropped packet from={} to={}.", .{ from, to }); data.packet.deinit(path); continue; } if (self.should_replay()) { self.submit_packet(data.packet, data.callback, path); log.debug("replayed packet from={} to={}", .{ from, to }); self.stats[@enumToInt(PacketStatistics.replay)] += 1; data.callback(data.packet, path); } else { log.debug("delivering packet from={} to={}", .{ from, to }); data.callback(data.packet, path); data.packet.deinit(path); } } const reverse_path: Path = .{ .source = to, .target = from }; if (self.should_clog(reverse_path)) { log.debug("reverse path clogged", .{}); const mean = @intToFloat(f64, self.options.path_clog_duration_mean); const ticks = @floatToInt(u64, mean * self.prng.random().floatExp(f64)); self.clog_for(reverse_path, ticks); } } } } pub fn submit_packet( self: *Self, packet: Packet, callback: fn (packet: Packet, path: Path) void, path: Path, ) void { const queue = self.path_queue(path); var queue_length = queue.count(); if (queue_length + 1 > queue.capacity()) { const index = self.prng.random().uintLessThanBiased(u64, queue_length); const data = queue.removeIndex(index); data.packet.deinit(path); log.err("submit_packet: {} reached capacity, dropped packet={}", .{ path, index, }); } queue.add(.{ .expiry = self.ticks + self.one_way_delay(), .packet = packet, .callback = callback, }) catch unreachable; } }; }
src/test/packet_simulator.zig
const std = @import("std"); const epoll = @import("epoll.zig"); const WlContext = @import("wl/context.zig").Context; const prot = @import("protocols.zig"); const shm_pool = @import("shm_pool.zig"); const shm_buffer = @import("shm_buffer.zig"); const window = @import("window.zig"); const region = @import("region.zig"); const positioner = @import("positioner.zig"); const buffer = @import("buffer.zig"); const Dispatchable = epoll.Dispatchable; const Stalloc = @import("stalloc.zig").Stalloc; pub var CLIENTS: Stalloc(void, Client, 256) = undefined; pub const Context = WlContext(*Client); pub const Object = WlContext(*Client).Object; pub const Client = struct { connection: std.net.StreamServer.Connection, dispatchable: Dispatchable, context: WlContext(*Self), serial: u32 = 0, server_id: u32 = 0, wl_display: Object, wl_registry_id: ?u32, wl_data_device_manager_id: ?u32, wl_keyboard_id: ?u32, wl_output_id: ?u32, wl_pointer_id: ?u32, wl_seat_id: ?u32, wl_compositor_id: ?u32, wl_subcompositor_id: ?u32, wl_shm_id: ?u32, xdg_wm_base_id: ?u32, fw_control_id: ?u32, zwp_linux_dmabuf_id: ?u32, const Self = @This(); pub fn deinit(self: *Self) !void { var freed_index = CLIENTS.deinit(self); self.context.deinit(); self.wl_registry_id = null; self.wl_data_device_manager_id = null; self.wl_keyboard_id = null; self.wl_output_id = null; self.wl_pointer_id = null; self.wl_seat_id = null; self.wl_compositor_id = null; self.wl_subcompositor_id = null; self.wl_shm_id = null; self.xdg_wm_base_id = null; self.fw_control_id = null; self.zwp_linux_dmabuf_id = null; shm_pool.releaseShmPools(self); try buffer.releaseBuffers(self); try window.releaseWindows(self); try region.releaseRegions(self); try positioner.releasePositioners(self); epoll.removeFd(self.connection.stream.handle) catch |err| { std.debug.warn("Client not removed from epoll: {}\n", .{self.getIndexOf()}); }; std.os.close(self.connection.stream.handle); } pub fn nextSerial(self: *Self) u32 { self.serial += 1; return self.serial; } pub fn nextServerId(self: *Self) u32 { self.server_id += 1; return self.server_id; } pub fn getIndexOf(self: *Self) usize { return CLIENTS.getIndexOf(self); } }; pub fn newClient(conn: std.net.StreamServer.Connection) !*Client { var client: *Client = try CLIENTS.new(undefined); client.dispatchable.impl = dispatch; client.connection = conn; client.context.init(conn.stream.handle, client); client.server_id = 0xff000000 - 1; client.wl_display = prot.new_wl_display(1, &client.context, 0); try client.context.register(client.wl_display); try epoll.addFd(conn.stream.handle, &client.dispatchable); return client; } fn dispatch(dispatchable: *Dispatchable, event_type: usize) anyerror!void { var client = @fieldParentPtr(Client, "dispatchable", dispatchable); if (event_type & std.os.linux.EPOLLHUP > 0) { std.debug.warn("client {}: hung up.\n", .{client.getIndexOf()}); try client.deinit(); std.debug.warn("client {}: freed.\n", .{client.getIndexOf()}); return; } client.context.dispatch() catch |err| { if (err == error.ClientSigbusd) { std.debug.warn("client {} sigbus'd\n", .{client.getIndexOf()}); try client.deinit(); } else { if (std.builtin.mode == std.builtin.Mode.Debug) { std.debug.warn("DEBUG: client[{}] error: {}\n", .{ client.getIndexOf(), err }); return err; } else { std.debug.warn("RELEASE: client[{}] error: {}\n", .{ client.getIndexOf(), err }); try client.deinit(); } } }; }
src/client.zig
const std = @import("std"); const log = std.log.scoped(.@"brucelib.platform.linux"); const common = @import("common.zig"); const InitFn = common.InitFn; const DeinitFn = common.DeinitFn; const FrameFn = common.FrameFn; const AudioPlaybackFn = common.AudioPlaybackFn; const FrameInput = common.FrameInput; const AudioPlaybackStream = common.AudioPlaybackStream; const KeyEvent = common.KeyEvent; const MouseButton = common.MouseButton; const MouseButtonEvent = common.MouseButtonEvent; const Key = common.Key; const num_keys = std.meta.fields(Key).len; const AlsaPlaybackInterface = @import("linux/AlsaPlaybackInterface.zig"); const AudioPlaybackInterface = AlsaPlaybackInterface; const GraphicsAPI = enum { opengl, }; var target_framerate: u32 = undefined; var window_width: u16 = undefined; var window_height: u16 = undefined; var window_closed = false; var quit = false; var audio_playback = struct { user_cb: ?fn (AudioPlaybackStream) anyerror!u32 = null, interface: AudioPlaybackInterface = undefined, thread: std.Thread = undefined, }{}; pub fn getOpenGlProcAddress(_: ?*const anyopaque, entry_point: [:0]const u8) ?*const anyopaque { return X11.glXGetProcAddress(?*const anyopaque, entry_point.ptr) catch null; } pub fn getSampleRate() u32 { return audio_playback.interface.sample_rate; } pub fn run(args: struct { graphics_api: GraphicsAPI = .opengl, requested_framerate: u16 = 0, title: []const u8 = "", window_size: struct { width: u16, height: u16, } = .{ .width = 854, .height = 480, }, init_fn: InitFn, deinit_fn: DeinitFn, frame_fn: FrameFn, audio_playback: ?struct { request_sample_rate: u32 = 48000, callback: AudioPlaybackFn = null, }, }) !void { var timer = try std.time.Timer.start(); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); var allocator = gpa.allocator(); // TODO(hazeycode): get monitor refresh and shoot for that, downgrade if we miss alot target_framerate = if (args.requested_framerate == 0) 60 else args.requested_framerate; window_width = args.window_size.width; window_height = args.window_size.height; var windowing = try X11.init(.{ .graphics_api = args.graphics_api, .window_title = args.title, }); defer windowing.deinit(); const audio_enabled = (args.audio_playback != null); if (audio_enabled) { audio_playback.user_cb = args.audio_playback.?.callback; const buffer_size_frames = std.math.ceilPowerOfTwoAssert( u32, 3 * args.audio_playback.?.request_sample_rate / target_framerate, ); audio_playback.interface = try AudioPlaybackInterface.init( args.audio_playback.?.request_sample_rate, buffer_size_frames, ); log.info( \\Initilised audio playback (ALSA): \\ {} channels \\ {} Hz \\ {} bits per sample , .{ audio_playback.interface.num_channels, audio_playback.interface.sample_rate, audio_playback.interface.bits_per_sample, }, ); } defer { if (audio_enabled) { audio_playback.interface.deinit(); } } try args.init_fn(allocator); defer args.deinit_fn(allocator); if (audio_enabled) { audio_playback.thread = try std.Thread.spawn(.{}, audioThread, .{allocator}); audio_playback.thread.detach(); } var frame_timer = try std.time.Timer.start(); var prev_cpu_frame_elapsed: u64 = 0; while (true) { const prev_frame_elapsed = frame_timer.lap(); const start_cpu_time = timer.read(); var frame_mem_arena = std.heap.ArenaAllocator.init(allocator); defer frame_mem_arena.deinit(); const arena_allocator = frame_mem_arena.allocator(); var key_events = std.ArrayList(KeyEvent).init(arena_allocator); var mouse_button_events = std.ArrayList(MouseButtonEvent).init(arena_allocator); try windowing.processEvents( &key_events, &mouse_button_events, ); const mouse_pos = windowing.getMousePos(); const target_frame_dt = @floatToInt(u64, (1 / @intToFloat(f64, target_framerate) * 1e9)); quit = !(try args.frame_fn(.{ .frame_arena_allocator = arena_allocator, .quit_requested = window_closed, .target_frame_dt = target_frame_dt, .prev_frame_elapsed = prev_frame_elapsed, .user_input = .{ .key_events = key_events.items, .mouse_button_events = mouse_button_events.items, .mouse_position = .{ .x = mouse_pos.x, .y = mouse_pos.y, }, }, .window_size = .{ .width = window_width, .height = window_height, }, .debug_stats = .{ .prev_cpu_frame_elapsed = prev_cpu_frame_elapsed, }, })); prev_cpu_frame_elapsed = timer.read() - start_cpu_time; const remaining_frame_time = @intCast(i128, target_frame_dt - 100000) - frame_timer.read(); if (remaining_frame_time > 0) { std.time.sleep(@intCast(u64, remaining_frame_time)); } windowing.swapBuffers(); if (quit) break; } } fn audioThread(allocator: std.mem.Allocator) !void { var buffer = try allocator.alloc( f32, audio_playback.interface.buffer_frames * audio_playback.interface.num_channels, ); defer allocator.free(buffer); var read_cur: usize = 0; var write_cur: usize = 0; var samples_queued: usize = 0; std.mem.set(f32, buffer, 0); { // write a couple of frames of silence const samples_silence = 2 * audio_playback.interface.sample_rate / target_framerate; std.debug.assert(samples_silence < buffer.len); _ = audio_playback.interface.writeSamples(buffer[0..(0 + samples_silence)]); } try audio_playback.interface.prepare(); while (quit == false) { if (samples_queued > 0) { var end = read_cur + samples_queued; if (end > buffer.len) { end = buffer.len; } if (end > read_cur) { const samples = buffer[read_cur..end]; read_cur = (read_cur + samples.len) % buffer.len; samples_queued -= samples.len; if (audio_playback.interface.writeSamples(samples) == false) { try audio_playback.interface.prepare(); continue; } } } const max_samples = 3 * audio_playback.interface.sample_rate / target_framerate; std.debug.assert(max_samples < buffer.len); if (samples_queued < max_samples) { const end = if ((buffer.len - write_cur) > max_samples) write_cur + max_samples else buffer.len; const num_frames = try audio_playback.user_cb.?(.{ .sample_rate = audio_playback.interface.sample_rate, .channels = audio_playback.interface.num_channels, .sample_buf = buffer[write_cur..end], .max_frames = @intCast(u32, end - write_cur) / audio_playback.interface.num_channels, }); const num_samples = num_frames * audio_playback.interface.num_channels; samples_queued += num_samples; write_cur = (write_cur + num_samples) % buffer.len; } std.time.sleep(0); } } const X11 = struct { // TODO(hazeycode): ziggified x11 wrapper + cleanup following usage const c = struct { pub usingnamespace @import("linux/X11/Xlib-xcb.zig"); pub usingnamespace @import("linux/X11/XKBlib.zig"); pub usingnamespace @import("linux/X11/glx.zig"); }; graphics_api: GraphicsAPI, display: *c.Display, connection: *c.xcb_connection_t, atom_protocols: *c.xcb_intern_atom_reply_t, atom_delete_window: *c.xcb_intern_atom_reply_t, window: u32, key_states: [num_keys]bool = .{false} ** num_keys, key_repeats: [num_keys]u32 = .{0} ** num_keys, fn init(args: struct { graphics_api: GraphicsAPI, window_title: []const u8, }) !X11 { c.XrmInitialize(); const display = c.XOpenDisplay(@intToPtr(?*const u8, 0)) orelse return error.XOpenDisplayFailed; _ = c.XkbSetDetectableAutoRepeat(display, c.True, null); const connection = c.XGetXCBConnection(display) orelse return error.XGetXCBConnectionFailed; errdefer c.xcb_disconnect(connection); c.XSetEventQueueOwner(display, c.XEventQueueOwner.XCBOwnsEventQueue); const default_screen_num = c.XDefaultScreen(display); var screen: ?*c.xcb_screen_t = null; { var iter = c.xcb_setup_roots_iterator(c.xcb_get_setup(connection)); var screen_num: u32 = 0; while (iter.rem > 0) : ({ c.xcb_screen_next(&iter); screen_num += 1; }) { if (screen_num == default_screen_num) screen = iter.data; } } if (screen == null) return error.FailedToFindXCBScreen; const screen_root = screen.?.*.root; const atom_protocols = c.xcb_intern_atom_reply( connection, c.xcb_intern_atom(connection, 1, 12, "WM_PROTOCOLS"), 0, ); errdefer _ = c.XFree(atom_protocols); const atom_delete_window = c.xcb_intern_atom_reply( connection, c.xcb_intern_atom(connection, 0, 16, "WM_DELETE_WINDOW"), 0, ); errdefer _ = c.XFree(atom_delete_window); var visual_info: *c.XVisualInfo = undefined; var glx_fb_config: c.GLXFBConfig = undefined; switch (args.graphics_api) { .opengl => { // query opengl version var glx_ver_min: c_int = undefined; var glx_ver_maj: c_int = undefined; if (c.glXQueryVersion(display, &glx_ver_maj, &glx_ver_min) == 0) return error.FailedToQueryGLXVersion; log.info("GLX version {}.{}", .{ glx_ver_maj, glx_ver_min }); // query framebuffer configurations that match visual_attribs const attrib_list = [_]c_int{ c.GLX_X_RENDERABLE, c.True, c.GLX_DRAWABLE_TYPE, c.GLX_WINDOW_BIT, c.GLX_RENDER_TYPE, c.GLX_RGBA_BIT, c.GLX_X_VISUAL_TYPE, c.GLX_TRUE_COLOR, c.GLX_RED_SIZE, 8, c.GLX_GREEN_SIZE, 8, c.GLX_BLUE_SIZE, 8, c.GLX_ALPHA_SIZE, 8, c.GLX_DEPTH_SIZE, 24, c.GLX_STENCIL_SIZE, 8, c.GLX_DOUBLEBUFFER, c.True, c.GLX_SAMPLE_BUFFERS, 1, c.GLX_SAMPLES, 4, c.None, }; var num_glx_fb_configs: c_int = 0; const glx_fb_configs = c.glXChooseFBConfig( display, default_screen_num, &attrib_list, &num_glx_fb_configs, ); if (glx_fb_configs == null) return error.FailedToQueryFramebufferConfigs; if (num_glx_fb_configs == 0) return error.NoCompatibleFramebufferConfigsFound; // defer _ = c.XFree(glx_fb_configs); // use the first config and get visual info glx_fb_config = glx_fb_configs[0]; visual_info = c.glXGetVisualFromFBConfig(display, glx_fb_config) orelse return error.FailedToGetVisualFromFBConfig; }, } const visual_id = @intCast(u32, c.XVisualIDFromVisual(visual_info.visual)); // create colormap const colour_map = c.xcb_generate_id(connection); _ = c.xcb_create_colormap(connection, c.XCB_COLORMAP_ALLOC_NONE, colour_map, screen_root, visual_id); // create xcb window const window = c.xcb_generate_id(connection); if (c.xcb_request_check( connection, c.xcb_create_window_checked( connection, c.XCB_COPY_FROM_PARENT, window, screen_root, 0, 0, window_width, window_height, 0, c.XCB_WINDOW_CLASS_INPUT_OUTPUT, visual_id, c.XCB_CW_EVENT_MASK | c.XCB_CW_COLORMAP, &[_]u32{ c.XCB_EVENT_MASK_EXPOSURE | c.XCB_EVENT_MASK_STRUCTURE_NOTIFY | c.XCB_EVENT_MASK_KEY_PRESS | c.XCB_EVENT_MASK_KEY_RELEASE | c.XCB_EVENT_MASK_BUTTON_PRESS | c.XCB_EVENT_MASK_BUTTON_RELEASE, colour_map, 0, }, ), ) != null) return error.FailedToCreateWindow; // hook up close button event _ = c.xcb_change_property( connection, c.XCB_PROP_MODE_REPLACE, window, atom_protocols.*.atom, 4, 32, 1, &(atom_delete_window.*.atom), ); if (args.window_title.len > 0) { _ = c.xcb_change_property( connection, c.XCB_PROP_MODE_REPLACE, window, c.XCB_ATOM_WM_NAME, c.XCB_ATOM_STRING, 8, @intCast(u32, args.window_title.len), &args.window_title[0], ); } _ = c.xcb_map_window(connection, window); _ = c.xcb_flush(connection); switch (args.graphics_api) { .opengl => { // load glXCreateContextAttribsARB fn ptr const glXGetProcAddressARBFn = fn ( ?*c.Display, c.GLXFBConfig, c.GLXContext, c.Bool, [*]const c_int, ) callconv(.C) c.GLXContext; const glXCreateContextAttribsARB = try glXGetProcAddressARB( glXGetProcAddressARBFn, "glXCreateContextAttribsARB", ); // create context and set it as current const attribs = [_]c_int{ c.GLX_CONTEXT_MAJOR_VERSION_ARB, 4, c.GLX_CONTEXT_MINOR_VERSION_ARB, 4, c.GLX_CONTEXT_PROFILE_MASK_ARB, c.GLX_CONTEXT_CORE_PROFILE_BIT_ARB, }; const context = glXCreateContextAttribsARB(display, glx_fb_config, null, c.True, &attribs); if (context == null) return error.FailedToCreateGLXContext; if (c.glXMakeCurrent(display, window, context) != c.True) return error.FailedToMakeGLXContextCurrent; log.info("OpenGL version {s}", .{c.glGetString(c.GL_VERSION)}); }, } return X11{ .graphics_api = args.graphics_api, .display = display, .connection = connection, .atom_protocols = atom_protocols, .atom_delete_window = atom_delete_window, .window = window, }; } fn glXGetProcAddress(comptime T: type, sym_name: [*c]const u8) !T { const fn_ptr = c.glXGetProcAddress(sym_name) orelse return error.glXGetProcAddress; return @ptrCast(T, fn_ptr); } fn glXGetProcAddressARB(comptime T: type, sym_name: [*c]const u8) !T { const fn_ptr = c.glXGetProcAddressARB(sym_name) orelse return error.glXGetProcAddressARB; return @ptrCast(T, fn_ptr); } fn deinit(self: *X11) void { switch (self.graphics_api) { .opengl => { const context = c.glXGetCurrentContext(); _ = c.glXMakeCurrent(self.display, 0, null); c.glXDestroyContext(self.display, context); }, } _ = c.XFree(self.atom_delete_window); _ = c.XFree(self.atom_protocols); c.xcb_disconnect(self.connection); } fn swapBuffers(self: *X11) void { c.glXSwapBuffers(self.display, self.window); } fn getMousePos(self: *X11) struct { x: i32, y: i32 } { var root: c.Window = undefined; var child: c.Window = undefined; var root_x: i32 = 0; var root_y: i32 = 0; var win_x: i32 = 0; var win_y: i32 = 0; var mask: u32 = 0; _ = c.XQueryPointer( self.display, self.window, &root, &child, &root_x, &root_y, &win_x, &win_y, &mask, ); return .{ .x = win_x, .y = win_y, }; } fn processEvents( self: *X11, key_events: anytype, mouse_button_events: anytype, ) !void { var xcb_event = c.xcb_poll_for_event(self.connection); while (@ptrToInt(xcb_event) > 0) : (xcb_event = c.xcb_poll_for_event(self.connection)) { defer _ = c.XFree(xcb_event); switch (xcb_event.*.response_type & ~@as(u32, 0x80)) { c.XCB_EXPOSE => { _ = c.xcb_flush(self.connection); }, c.XCB_CLIENT_MESSAGE => { const xcb_client_message_event = @ptrCast(*c.xcb_client_message_event_t, xcb_event); if (xcb_client_message_event.data.data32[0] == self.atom_delete_window.*.atom) { window_closed = true; } }, c.XCB_CONFIGURE_NOTIFY => { const xcb_config_event = @ptrCast(*c.xcb_configure_notify_event_t, xcb_event); if (xcb_config_event.width != window_width or xcb_config_event.height != window_height) { window_width = xcb_config_event.width; window_height = xcb_config_event.height; } }, c.XCB_KEY_PRESS => { const xcb_key_press_event = @ptrCast(*c.xcb_key_press_event_t, xcb_event); if (translateKey(self.display, xcb_key_press_event.detail)) |key| { const repeat = self.key_states[@enumToInt(key)]; if (repeat == false) { self.key_repeats[@enumToInt(key)] += 1; try key_events.append(.{ .action = .press, .key = key, }); } else { self.key_repeats[@enumToInt(key)] = 1; try key_events.append(.{ .action = .{ .repeat = self.key_repeats[@enumToInt(key)] }, .key = key, }); } self.key_states[@enumToInt(key)] = true; } }, c.XCB_KEY_RELEASE => { const xcb_key_release_event = @ptrCast(*c.xcb_key_release_event_t, xcb_event); if (translateKey(self.display, xcb_key_release_event.detail)) |key| { try key_events.append(.{ .action = .release, .key = key, }); self.key_repeats[@enumToInt(key)] = 0; self.key_states[@enumToInt(key)] = false; } }, c.XCB_BUTTON_PRESS => { const xcb_button_press_event = @ptrCast(*c.xcb_button_press_event_t, xcb_event); try mouse_button_events.append(.{ .action = .press, .button = @intToEnum(MouseButton, xcb_button_press_event.detail), .x = xcb_button_press_event.event_x, .y = xcb_button_press_event.event_y, }); }, c.XCB_BUTTON_RELEASE => { const xcb_button_release_event = @ptrCast(*c.xcb_button_release_event_t, xcb_event); try mouse_button_events.append(.{ .action = .release, .button = @intToEnum(MouseButton, xcb_button_release_event.detail), .x = xcb_button_release_event.event_x, .y = xcb_button_release_event.event_y, }); }, else => {}, } } } fn translateKey(display: *c.Display, keycode: u8) ?Key { // TODO(hazeycode): measure and consider cacheing this in a LUT for performance var keysyms_per_keycode: c_int = 0; const keysyms = c.XGetKeyboardMapping(display, keycode, 1, &keysyms_per_keycode); const keysym = keysyms[0]; _ = c.XFree(keysyms); return switch (keysym) { c.XK_Escape => .escape, c.XK_Tab => .tab, c.XK_Shift_L => .shift_left, c.XK_Shift_R => .shift_right, c.XK_Control_L => .ctrl_left, c.XK_Control_R => .ctrl_right, c.XK_Meta_L, c.XK_Alt_L => .alt_left, c.XK_Mode_switch, c.XK_ISO_Level3_Shift, c.XK_Meta_R, c.XK_Alt_R => .alt_right, c.XK_Super_L => .super_left, c.XK_Super_R => .super_right, c.XK_Menu => .menu, c.XK_Num_Lock => .numlock, c.XK_Caps_Lock => .capslock, c.XK_Print => .printscreen, c.XK_Scroll_Lock => .scrolllock, c.XK_Pause => .pause, c.XK_Delete => .delete, c.XK_BackSpace => .backspace, c.XK_Return => .enter, c.XK_Home => .home, c.XK_End => .end, c.XK_Page_Up => .pageup, c.XK_Page_Down => .pagedown, c.XK_Insert => .insert, c.XK_Left => .left, c.XK_Right => .right, c.XK_Down => .down, c.XK_Up => .up, c.XK_F1 => .f1, c.XK_F2 => .f2, c.XK_F3 => .f3, c.XK_F4 => .f4, c.XK_F5 => .f5, c.XK_F6 => .f6, c.XK_F7 => .f7, c.XK_F8 => .f8, c.XK_F9 => .f9, c.XK_F10 => .f10, c.XK_F11 => .f11, c.XK_F12 => .f12, c.XK_F13 => .f13, c.XK_F14 => .f14, c.XK_F15 => .f15, c.XK_F16 => .f16, c.XK_F17 => .f17, c.XK_F18 => .f18, c.XK_F19 => .f19, c.XK_F20 => .f20, c.XK_F21 => .f21, c.XK_F22 => .f22, c.XK_F23 => .f23, c.XK_F24 => .f24, c.XK_F25 => .f25, c.XK_KP_Divide => .keypad_divide, c.XK_KP_Multiply => .keypad_multiply, c.XK_KP_Subtract => .keypad_subtract, c.XK_KP_Add => .keypad_add, c.XK_KP_Insert => .keypad_0, c.XK_KP_End => .keypad_1, c.XK_KP_Down => .keypad_2, c.XK_KP_Page_Down => .keypad_3, c.XK_KP_Left => .keypad_4, c.XK_KP_Begin => .keypad_5, c.XK_KP_Right => .keypad_6, c.XK_KP_Home => .keypad_7, c.XK_KP_Up => .keypad_8, c.XK_KP_Page_Up => .keypad_9, c.XK_KP_Delete => .keypad_decimal, c.XK_KP_Equal => .keypad_equal, c.XK_KP_Enter => .keypad_enter, c.XK_a => .a, c.XK_b => .b, c.XK_c => .c, c.XK_d => .d, c.XK_e => .e, c.XK_f => .f, c.XK_g => .g, c.XK_h => .h, c.XK_i => .i, c.XK_j => .j, c.XK_k => .k, c.XK_l => .l, c.XK_m => .m, c.XK_n => .n, c.XK_o => .o, c.XK_p => .p, c.XK_q => .q, c.XK_r => .r, c.XK_s => .s, c.XK_t => .t, c.XK_u => .u, c.XK_v => .v, c.XK_w => .w, c.XK_x => .x, c.XK_y => .y, c.XK_z => .z, c.XK_1 => .one, c.XK_2 => .two, c.XK_3 => .three, c.XK_4 => .four, c.XK_5 => .five, c.XK_6 => .six, c.XK_7 => .seven, c.XK_8 => .eight, c.XK_9 => .nine, c.XK_0 => .zero, c.XK_space => .space, c.XK_minus => .minus, c.XK_equal => .equal, c.XK_bracketleft => .bracket_left, c.XK_bracketright => .bracket_right, c.XK_backslash => .backslash, c.XK_semicolon => .semicolon, c.XK_apostrophe => .apostrophe, c.XK_grave => .grave_accent, c.XK_comma => .comma, c.XK_period => .period, c.XK_slash => .slash, c.XK_less => .world1, else => .unknown, }; } };
modules/platform/src/linux.zig
const std = @import("std"); const builtin = @import("builtin"); const LE = extern enum(i32) { Less = -1, Equal = 0, Greater = 1, Unordered = 1, }; const GE = extern enum(i32) { Less = -1, Equal = 0, Greater = 1, Unordered = -1, }; pub fn cmp(comptime T: type, comptime RT: type, a: T, b: T) RT { @setRuntimeSafety(builtin.is_test); const bits = @typeInfo(T).Float.bits; const srep_t = std.meta.Int(.signed, bits); const rep_t = std.meta.Int(.unsigned, bits); const significandBits = std.math.floatMantissaBits(T); const exponentBits = std.math.floatExponentBits(T); const signBit = (@as(rep_t, 1) << (significandBits + exponentBits)); const absMask = signBit - 1; const infRep = @bitCast(rep_t, std.math.inf(T)); const aInt = @bitCast(srep_t, a); const bInt = @bitCast(srep_t, b); const aAbs = @bitCast(rep_t, aInt) & absMask; const bAbs = @bitCast(rep_t, bInt) & absMask; // If either a or b is NaN, they are unordered. if (aAbs > infRep or bAbs > infRep) return .Unordered; // If a and b are both zeros, they are equal. if ((aAbs | bAbs) == 0) return .Equal; // If at least one of a and b is positive, we get the same result comparing // a and b as signed integers as we would with a fp_ting-point compare. if ((aInt & bInt) >= 0) { if (aInt < bInt) { return .Less; } else if (aInt == bInt) { return .Equal; } else return .Greater; } // Otherwise, both are negative, so we need to flip the sense of the // comparison to get the correct result. (This assumes a twos- or ones- // complement integer representation; if integers are represented in a // sign-magnitude representation, then this flip is incorrect). else { if (aInt > bInt) { return .Less; } else if (aInt == bInt) { return .Equal; } else return .Greater; } } pub fn unordcmp(comptime T: type, a: T, b: T) i32 { @setRuntimeSafety(builtin.is_test); const rep_t = std.meta.Int(.unsigned, @typeInfo(T).Float.bits); const significandBits = std.math.floatMantissaBits(T); const exponentBits = std.math.floatExponentBits(T); const signBit = (@as(rep_t, 1) << (significandBits + exponentBits)); const absMask = signBit - 1; const infRep = @bitCast(rep_t, std.math.inf(T)); const aAbs: rep_t = @bitCast(rep_t, a) & absMask; const bAbs: rep_t = @bitCast(rep_t, b) & absMask; return @boolToInt(aAbs > infRep or bAbs > infRep); } // Comparison between f32 pub fn __lesf2(a: f32, b: f32) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @bitCast(i32, @call(.{ .modifier = .always_inline }, cmp, .{ f32, LE, a, b })); } pub fn __gesf2(a: f32, b: f32) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @bitCast(i32, @call(.{ .modifier = .always_inline }, cmp, .{ f32, GE, a, b })); } pub fn __eqsf2(a: f32, b: f32) callconv(.C) i32 { return __lesf2(a, b); } pub fn __ltsf2(a: f32, b: f32) callconv(.C) i32 { return __lesf2(a, b); } pub fn __nesf2(a: f32, b: f32) callconv(.C) i32 { return __lesf2(a, b); } pub fn __gtsf2(a: f32, b: f32) callconv(.C) i32 { return __gesf2(a, b); } // Comparison between f64 pub fn __ledf2(a: f64, b: f64) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @bitCast(i32, @call(.{ .modifier = .always_inline }, cmp, .{ f64, LE, a, b })); } pub fn __gedf2(a: f64, b: f64) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @bitCast(i32, @call(.{ .modifier = .always_inline }, cmp, .{ f64, GE, a, b })); } pub fn __eqdf2(a: f64, b: f64) callconv(.C) i32 { return __ledf2(a, b); } pub fn __ltdf2(a: f64, b: f64) callconv(.C) i32 { return __ledf2(a, b); } pub fn __nedf2(a: f64, b: f64) callconv(.C) i32 { return __ledf2(a, b); } pub fn __gtdf2(a: f64, b: f64) callconv(.C) i32 { return __gedf2(a, b); } // Comparison between f128 pub fn __letf2(a: f128, b: f128) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @bitCast(i32, @call(.{ .modifier = .always_inline }, cmp, .{ f128, LE, a, b })); } pub fn __getf2(a: f128, b: f128) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @bitCast(i32, @call(.{ .modifier = .always_inline }, cmp, .{ f128, GE, a, b })); } pub fn __eqtf2(a: f128, b: f128) callconv(.C) i32 { return __letf2(a, b); } pub fn __lttf2(a: f128, b: f128) callconv(.C) i32 { return __letf2(a, b); } pub fn __netf2(a: f128, b: f128) callconv(.C) i32 { return __letf2(a, b); } pub fn __gttf2(a: f128, b: f128) callconv(.C) i32 { return __getf2(a, b); } // Unordered comparison between f32/f64/f128 pub fn __unordsf2(a: f32, b: f32) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @call(.{ .modifier = .always_inline }, unordcmp, .{ f32, a, b }); } pub fn __unorddf2(a: f64, b: f64) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @call(.{ .modifier = .always_inline }, unordcmp, .{ f64, a, b }); } pub fn __unordtf2(a: f128, b: f128) callconv(.C) i32 { @setRuntimeSafety(builtin.is_test); return @call(.{ .modifier = .always_inline }, unordcmp, .{ f128, a, b }); } // ARM EABI intrinsics pub fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __eqsf2, .{ a, b }) == 0); } pub fn __aeabi_fcmplt(a: f32, b: f32) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __ltsf2, .{ a, b }) < 0); } pub fn __aeabi_fcmple(a: f32, b: f32) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __lesf2, .{ a, b }) <= 0); } pub fn __aeabi_fcmpge(a: f32, b: f32) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __gesf2, .{ a, b }) >= 0); } pub fn __aeabi_fcmpgt(a: f32, b: f32) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __gtsf2, .{ a, b }) > 0); } pub fn __aeabi_fcmpun(a: f32, b: f32) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @call(.{ .modifier = .always_inline }, __unordsf2, .{ a, b }); } pub fn __aeabi_dcmpeq(a: f64, b: f64) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __eqdf2, .{ a, b }) == 0); } pub fn __aeabi_dcmplt(a: f64, b: f64) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __ltdf2, .{ a, b }) < 0); } pub fn __aeabi_dcmple(a: f64, b: f64) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __ledf2, .{ a, b }) <= 0); } pub fn __aeabi_dcmpge(a: f64, b: f64) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __gedf2, .{ a, b }) >= 0); } pub fn __aeabi_dcmpgt(a: f64, b: f64) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @boolToInt(@call(.{ .modifier = .always_inline }, __gtdf2, .{ a, b }) > 0); } pub fn __aeabi_dcmpun(a: f64, b: f64) callconv(.AAPCS) i32 { @setRuntimeSafety(false); return @call(.{ .modifier = .always_inline }, __unorddf2, .{ a, b }); } test "comparesf2" { _ = @import("comparesf2_test.zig"); } test "comparedf2" { _ = @import("comparedf2_test.zig"); }
lib/std/special/compiler_rt/compareXf2.zig
//! Thread-local cryptographically secure pseudo-random number generator. //! This file has public declarations that are intended to be used internally //! by the standard library; this namespace is not intended to be exposed //! directly to standard library users. const std = @import("std"); const root = @import("root"); const mem = std.mem; /// 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, => 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 WipeMe = struct { init_state: enum { uninitialized, initialized, failed }, gimli: std.crypto.core.Gimli, }; const wipe_align = if (maybe_have_wipe_on_fork) mem.page_size else @alignOf(WipeMe); threadlocal var wipe_me: WipeMe align(wipe_align) = .{ .gimli = undefined, .init_state = .uninitialized, }; 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); } switch (wipe_me.init_state) { .uninitialized => { if (want_fork_safety) { if (maybe_have_wipe_on_fork) { if (std.os.madvise( @ptrCast([*]align(mem.page_size) u8, &wipe_me), @sizeOf(@TypeOf(wipe_me)), std.os.MADV_WIPEONFORK, )) |_| { return initAndFill(buffer); } else |_| if (std.Thread.use_pthreads) { return setupPthreadAtforkAndFill(buffer); } else { // Since we failed to set up fork safety, we fall back to always // calling getrandom every time. wipe_me.init_state = .failed; return fillWithOsEntropy(buffer); } } else if (std.Thread.use_pthreads) { return setupPthreadAtforkAndFill(buffer); } else { // We have no mechanism to provide fork safety, but we want fork safety, // so we fall back to calling getrandom every time. wipe_me.init_state = .failed; return fillWithOsEntropy(buffer); } } else { return initAndFill(buffer); } }, .initialized => { return fillWithCsprng(buffer); }, .failed => { if (want_fork_safety) { return fillWithOsEntropy(buffer); } else { unreachable; } }, } } fn setupPthreadAtforkAndFill(buffer: []u8) void { const failed = std.c.pthread_atfork(null, null, childAtForkHandler) != 0; if (failed) { wipe_me.init_state = .failed; return fillWithOsEntropy(buffer); } else { return initAndFill(buffer); } } fn childAtForkHandler() callconv(.C) void { const wipe_slice = @ptrCast([*]u8, &wipe_me)[0..@sizeOf(@TypeOf(wipe_me))]; std.crypto.utils.secureZero(u8, wipe_slice); } fn fillWithCsprng(buffer: []u8) void { if (buffer.len != 0) { wipe_me.gimli.squeeze(buffer); } else { wipe_me.gimli.permute(); } mem.set(u8, wipe_me.gimli.toSlice()[0..std.crypto.core.Gimli.RATE], 0); } fn fillWithOsEntropy(buffer: []u8) void { std.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); } wipe_me.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. wipe_me.init_state = .initialized; return fillWithCsprng(buffer); }
lib/std/crypto/tlcsprng.zig
const std = @import("std"); const debug = std.debug; const assert = debug.assert; const testing = std.testing; const mem = std.mem; const maxInt = std.math.maxInt; const StringEscapes = union(enum) { None, Some: struct { size_diff: isize, }, }; /// A single token slice into the parent string. /// /// Use `token.slice()` on the input at the current position to get the current slice. pub const Token = union(enum) { ObjectBegin, ObjectEnd, ArrayBegin, ArrayEnd, String: struct { /// How many bytes the token is. count: usize, /// Whether string contains an escape sequence and cannot be zero-copied escapes: StringEscapes, pub fn decodedLength(self: @This()) usize { return self.count +% switch (self.escapes) { .None => 0, .Some => |s| @bitCast(usize, s.size_diff), }; } /// Slice into the underlying input string. pub fn slice(self: @This(), input: []const u8, i: usize) []const u8 { return input[i - self.count .. i]; } }, Number: struct { /// How many bytes the token is. count: usize, /// Whether number is simple and can be represented by an integer (i.e. no `.` or `e`) is_integer: bool, /// Slice into the underlying input string. pub fn slice(self: @This(), input: []const u8, i: usize) []const u8 { return input[i - self.count .. i]; } }, True, False, Null, }; /// A small streaming JSON parser. This accepts input one byte at a time and returns tokens as /// they are encountered. No copies or allocations are performed during parsing and the entire /// parsing state requires ~40-50 bytes of stack space. /// /// Conforms strictly to RFC8259. /// /// For a non-byte based wrapper, consider using TokenStream instead. pub const StreamingParser = struct { // Current state state: State, // How many bytes we have counted for the current token count: usize, // What state to follow after parsing a string (either property or value string) after_string_state: State, // What state to follow after parsing a value (either top-level or value end) after_value_state: State, // If we stopped now, would the complete parsed string to now be a valid json string complete: bool, // Current token flags to pass through to the next generated, see Token. string_escapes: StringEscapes, // When in .String states, was the previous character a high surrogate? string_last_was_high_surrogate: bool, // Used inside of StringEscapeHexUnicode* states string_unicode_codepoint: u21, // The first byte needs to be stored to validate 3- and 4-byte sequences. sequence_first_byte: u8 = undefined, // When in .Number states, is the number a (still) valid integer? number_is_integer: bool, // Bit-stack for nested object/map literals (max 127 nestings). stack: u128, stack_used: u7, const object_bit = 0; const array_bit = 1; const max_stack_size = maxInt(u7); pub fn init() StreamingParser { var p: StreamingParser = undefined; p.reset(); return p; } pub fn reset(p: *StreamingParser) void { p.state = .TopLevelBegin; p.count = 0; // Set before ever read in main transition function p.after_string_state = undefined; p.after_value_state = .ValueEnd; // handle end of values normally p.stack = 0; p.stack_used = 0; p.complete = false; p.string_escapes = undefined; p.string_last_was_high_surrogate = undefined; p.string_unicode_codepoint = undefined; p.number_is_integer = undefined; } pub const State = enum { // These must be first with these explicit values as we rely on them for indexing the // bit-stack directly and avoiding a branch. ObjectSeparator = 0, ValueEnd = 1, TopLevelBegin, TopLevelEnd, ValueBegin, ValueBeginNoClosing, String, StringUtf8Byte2Of2, StringUtf8Byte2Of3, StringUtf8Byte3Of3, StringUtf8Byte2Of4, StringUtf8Byte3Of4, StringUtf8Byte4Of4, StringEscapeCharacter, StringEscapeHexUnicode4, StringEscapeHexUnicode3, StringEscapeHexUnicode2, StringEscapeHexUnicode1, Number, NumberMaybeDotOrExponent, NumberMaybeDigitOrDotOrExponent, NumberFractionalRequired, NumberFractional, NumberMaybeExponent, NumberExponent, NumberExponentDigitsRequired, NumberExponentDigits, TrueLiteral1, TrueLiteral2, TrueLiteral3, FalseLiteral1, FalseLiteral2, FalseLiteral3, FalseLiteral4, NullLiteral1, NullLiteral2, NullLiteral3, // Only call this function to generate array/object final state. pub fn fromInt(x: anytype) State { debug.assert(x == 0 or x == 1); const T = std.meta.Tag(State); return @intToEnum(State, @intCast(T, x)); } }; pub const Error = error{ InvalidTopLevel, TooManyNestedItems, TooManyClosingItems, InvalidValueBegin, InvalidValueEnd, UnbalancedBrackets, UnbalancedBraces, UnexpectedClosingBracket, UnexpectedClosingBrace, InvalidNumber, InvalidSeparator, InvalidLiteral, InvalidEscapeCharacter, InvalidUnicodeHexSymbol, InvalidUtf8Byte, InvalidTopLevelTrailing, InvalidControlCharacter, }; /// Give another byte to the parser and obtain any new tokens. This may (rarely) return two /// tokens. token2 is always null if token1 is null. /// /// There is currently no error recovery on a bad stream. pub fn feed(p: *StreamingParser, c: u8, token1: *?Token, token2: *?Token) Error!void { token1.* = null; token2.* = null; p.count += 1; // unlikely if (try p.transition(c, token1)) { _ = try p.transition(c, token2); } } // Perform a single transition on the state machine and return any possible token. fn transition(p: *StreamingParser, c: u8, token: *?Token) Error!bool { switch (p.state) { .TopLevelBegin => switch (c) { '{' => { p.stack <<= 1; p.stack |= object_bit; p.stack_used += 1; p.state = .ValueBegin; p.after_string_state = .ObjectSeparator; token.* = Token.ObjectBegin; }, '[' => { p.stack <<= 1; p.stack |= array_bit; p.stack_used += 1; p.state = .ValueBegin; p.after_string_state = .ValueEnd; token.* = Token.ArrayBegin; }, '-' => { p.number_is_integer = true; p.state = .Number; p.after_value_state = .TopLevelEnd; p.count = 0; }, '0' => { p.number_is_integer = true; p.state = .NumberMaybeDotOrExponent; p.after_value_state = .TopLevelEnd; p.count = 0; }, '1'...'9' => { p.number_is_integer = true; p.state = .NumberMaybeDigitOrDotOrExponent; p.after_value_state = .TopLevelEnd; p.count = 0; }, '"' => { p.state = .String; p.after_value_state = .TopLevelEnd; // We don't actually need the following since after_value_state should override. p.after_string_state = .ValueEnd; p.string_escapes = .None; p.string_last_was_high_surrogate = false; p.count = 0; }, 't' => { p.state = .TrueLiteral1; p.after_value_state = .TopLevelEnd; p.count = 0; }, 'f' => { p.state = .FalseLiteral1; p.after_value_state = .TopLevelEnd; p.count = 0; }, 'n' => { p.state = .NullLiteral1; p.after_value_state = .TopLevelEnd; p.count = 0; }, 0x09, 0x0A, 0x0D, 0x20 => { // whitespace }, else => { return error.InvalidTopLevel; }, }, .TopLevelEnd => switch (c) { 0x09, 0x0A, 0x0D, 0x20 => { // whitespace }, else => { return error.InvalidTopLevelTrailing; }, }, .ValueBegin => switch (c) { // NOTE: These are shared in ValueEnd as well, think we can reorder states to // be a bit clearer and avoid this duplication. '}' => { // unlikely if (p.stack & 1 != object_bit) { return error.UnexpectedClosingBracket; } if (p.stack_used == 0) { return error.TooManyClosingItems; } p.state = .ValueBegin; p.after_string_state = State.fromInt(p.stack & 1); p.stack >>= 1; p.stack_used -= 1; switch (p.stack_used) { 0 => { p.complete = true; p.state = .TopLevelEnd; }, else => { p.state = .ValueEnd; }, } token.* = Token.ObjectEnd; }, ']' => { if (p.stack & 1 != array_bit) { return error.UnexpectedClosingBrace; } if (p.stack_used == 0) { return error.TooManyClosingItems; } p.state = .ValueBegin; p.after_string_state = State.fromInt(p.stack & 1); p.stack >>= 1; p.stack_used -= 1; switch (p.stack_used) { 0 => { p.complete = true; p.state = .TopLevelEnd; }, else => { p.state = .ValueEnd; }, } token.* = Token.ArrayEnd; }, '{' => { if (p.stack_used == max_stack_size) { return error.TooManyNestedItems; } p.stack <<= 1; p.stack |= object_bit; p.stack_used += 1; p.state = .ValueBegin; p.after_string_state = .ObjectSeparator; token.* = Token.ObjectBegin; }, '[' => { if (p.stack_used == max_stack_size) { return error.TooManyNestedItems; } p.stack <<= 1; p.stack |= array_bit; p.stack_used += 1; p.state = .ValueBegin; p.after_string_state = .ValueEnd; token.* = Token.ArrayBegin; }, '-' => { p.number_is_integer = true; p.state = .Number; p.count = 0; }, '0' => { p.number_is_integer = true; p.state = .NumberMaybeDotOrExponent; p.count = 0; }, '1'...'9' => { p.number_is_integer = true; p.state = .NumberMaybeDigitOrDotOrExponent; p.count = 0; }, '"' => { p.state = .String; p.string_escapes = .None; p.string_last_was_high_surrogate = false; p.count = 0; }, 't' => { p.state = .TrueLiteral1; p.count = 0; }, 'f' => { p.state = .FalseLiteral1; p.count = 0; }, 'n' => { p.state = .NullLiteral1; p.count = 0; }, 0x09, 0x0A, 0x0D, 0x20 => { // whitespace }, else => { return error.InvalidValueBegin; }, }, // TODO: A bit of duplication here and in the following state, redo. .ValueBeginNoClosing => switch (c) { '{' => { if (p.stack_used == max_stack_size) { return error.TooManyNestedItems; } p.stack <<= 1; p.stack |= object_bit; p.stack_used += 1; p.state = .ValueBegin; p.after_string_state = .ObjectSeparator; token.* = Token.ObjectBegin; }, '[' => { if (p.stack_used == max_stack_size) { return error.TooManyNestedItems; } p.stack <<= 1; p.stack |= array_bit; p.stack_used += 1; p.state = .ValueBegin; p.after_string_state = .ValueEnd; token.* = Token.ArrayBegin; }, '-' => { p.number_is_integer = true; p.state = .Number; p.count = 0; }, '0' => { p.number_is_integer = true; p.state = .NumberMaybeDotOrExponent; p.count = 0; }, '1'...'9' => { p.number_is_integer = true; p.state = .NumberMaybeDigitOrDotOrExponent; p.count = 0; }, '"' => { p.state = .String; p.string_escapes = .None; p.string_last_was_high_surrogate = false; p.count = 0; }, 't' => { p.state = .TrueLiteral1; p.count = 0; }, 'f' => { p.state = .FalseLiteral1; p.count = 0; }, 'n' => { p.state = .NullLiteral1; p.count = 0; }, 0x09, 0x0A, 0x0D, 0x20 => { // whitespace }, else => { return error.InvalidValueBegin; }, }, .ValueEnd => switch (c) { ',' => { p.after_string_state = State.fromInt(p.stack & 1); p.state = .ValueBeginNoClosing; }, ']' => { if (p.stack_used == 0) { return error.UnbalancedBrackets; } p.state = .ValueEnd; p.after_string_state = State.fromInt(p.stack & 1); p.stack >>= 1; p.stack_used -= 1; if (p.stack_used == 0) { p.complete = true; p.state = .TopLevelEnd; } token.* = Token.ArrayEnd; }, '}' => { if (p.stack_used == 0) { return error.UnbalancedBraces; } p.state = .ValueEnd; p.after_string_state = State.fromInt(p.stack & 1); p.stack >>= 1; p.stack_used -= 1; if (p.stack_used == 0) { p.complete = true; p.state = .TopLevelEnd; } token.* = Token.ObjectEnd; }, 0x09, 0x0A, 0x0D, 0x20 => { // whitespace }, else => { return error.InvalidValueEnd; }, }, .ObjectSeparator => switch (c) { ':' => { p.state = .ValueBegin; p.after_string_state = .ValueEnd; }, 0x09, 0x0A, 0x0D, 0x20 => { // whitespace }, else => { return error.InvalidSeparator; }, }, .String => switch (c) { 0x00...0x1F => { return error.InvalidControlCharacter; }, '"' => { p.state = p.after_string_state; if (p.after_value_state == .TopLevelEnd) { p.state = .TopLevelEnd; p.complete = true; } token.* = .{ .String = .{ .count = p.count - 1, .escapes = p.string_escapes, }, }; p.string_escapes = undefined; p.string_last_was_high_surrogate = undefined; }, '\\' => { p.state = .StringEscapeCharacter; switch (p.string_escapes) { .None => { p.string_escapes = .{ .Some = .{ .size_diff = 0 } }; }, .Some => {}, } }, 0x20, 0x21, 0x23...0x5B, 0x5D...0x7F => { // non-control ascii p.string_last_was_high_surrogate = false; }, 0xC2...0xDF => { p.state = .StringUtf8Byte2Of2; }, 0xE0...0xEF => { p.state = .StringUtf8Byte2Of3; p.sequence_first_byte = c; }, 0xF0...0xF4 => { p.state = .StringUtf8Byte2Of4; p.sequence_first_byte = c; }, else => { return error.InvalidUtf8Byte; }, }, .StringUtf8Byte2Of2 => switch (c >> 6) { 0b10 => p.state = .String, else => return error.InvalidUtf8Byte, }, .StringUtf8Byte2Of3 => { switch (p.sequence_first_byte) { 0xE0 => switch (c) { 0xA0...0xBF => {}, else => return error.InvalidUtf8Byte, }, 0xE1...0xEF => switch (c) { 0x80...0xBF => {}, else => return error.InvalidUtf8Byte, }, else => return error.InvalidUtf8Byte, } p.state = .StringUtf8Byte3Of3; }, .StringUtf8Byte3Of3 => switch (c) { 0x80...0xBF => p.state = .String, else => return error.InvalidUtf8Byte, }, .StringUtf8Byte2Of4 => { switch (p.sequence_first_byte) { 0xF0 => switch (c) { 0x90...0xBF => {}, else => return error.InvalidUtf8Byte, }, 0xF1...0xF3 => switch (c) { 0x80...0xBF => {}, else => return error.InvalidUtf8Byte, }, 0xF4 => switch (c) { 0x80...0x8F => {}, else => return error.InvalidUtf8Byte, }, else => return error.InvalidUtf8Byte, } p.state = .StringUtf8Byte3Of4; }, .StringUtf8Byte3Of4 => switch (c) { 0x80...0xBF => p.state = .StringUtf8Byte4Of4, else => return error.InvalidUtf8Byte, }, .StringUtf8Byte4Of4 => switch (c) { 0x80...0xBF => p.state = .String, else => return error.InvalidUtf8Byte, }, .StringEscapeCharacter => switch (c) { // NOTE: '/' is allowed as an escaped character but it also is allowed // as unescaped according to the RFC. There is a reported errata which suggests // removing the non-escaped variant but it makes more sense to simply disallow // it as an escape code here. // // The current JSONTestSuite tests rely on both of this behaviour being present // however, so we default to the status quo where both are accepted until this // is further clarified. '"', '\\', '/', 'b', 'f', 'n', 'r', 't' => { p.string_escapes.Some.size_diff -= 1; p.state = .String; p.string_last_was_high_surrogate = false; }, 'u' => { p.state = .StringEscapeHexUnicode4; }, else => { return error.InvalidEscapeCharacter; }, }, .StringEscapeHexUnicode4 => { var codepoint: u21 = undefined; switch (c) { else => return error.InvalidUnicodeHexSymbol, '0'...'9' => { codepoint = c - '0'; }, 'A'...'F' => { codepoint = c - 'A' + 10; }, 'a'...'f' => { codepoint = c - 'a' + 10; }, } p.state = .StringEscapeHexUnicode3; p.string_unicode_codepoint = codepoint << 12; }, .StringEscapeHexUnicode3 => { var codepoint: u21 = undefined; switch (c) { else => return error.InvalidUnicodeHexSymbol, '0'...'9' => { codepoint = c - '0'; }, 'A'...'F' => { codepoint = c - 'A' + 10; }, 'a'...'f' => { codepoint = c - 'a' + 10; }, } p.state = .StringEscapeHexUnicode2; p.string_unicode_codepoint |= codepoint << 8; }, .StringEscapeHexUnicode2 => { var codepoint: u21 = undefined; switch (c) { else => return error.InvalidUnicodeHexSymbol, '0'...'9' => { codepoint = c - '0'; }, 'A'...'F' => { codepoint = c - 'A' + 10; }, 'a'...'f' => { codepoint = c - 'a' + 10; }, } p.state = .StringEscapeHexUnicode1; p.string_unicode_codepoint |= codepoint << 4; }, .StringEscapeHexUnicode1 => { var codepoint: u21 = undefined; switch (c) { else => return error.InvalidUnicodeHexSymbol, '0'...'9' => { codepoint = c - '0'; }, 'A'...'F' => { codepoint = c - 'A' + 10; }, 'a'...'f' => { codepoint = c - 'a' + 10; }, } p.state = .String; p.string_unicode_codepoint |= codepoint; if (p.string_unicode_codepoint < 0xD800 or p.string_unicode_codepoint >= 0xE000) { // not part of surrogate pair p.string_escapes.Some.size_diff -= @as(isize, 6 - (std.unicode.utf8CodepointSequenceLength(p.string_unicode_codepoint) catch unreachable)); p.string_last_was_high_surrogate = false; } else if (p.string_unicode_codepoint < 0xDC00) { // 'high' surrogate // takes 3 bytes to encode a half surrogate pair into wtf8 p.string_escapes.Some.size_diff -= 6 - 3; p.string_last_was_high_surrogate = true; } else { // 'low' surrogate p.string_escapes.Some.size_diff -= 6; if (p.string_last_was_high_surrogate) { // takes 4 bytes to encode a full surrogate pair into utf8 // 3 bytes are already reserved by high surrogate p.string_escapes.Some.size_diff -= -1; } else { // takes 3 bytes to encode a half surrogate pair into wtf8 p.string_escapes.Some.size_diff -= -3; } p.string_last_was_high_surrogate = false; } p.string_unicode_codepoint = undefined; }, .Number => { p.complete = p.after_value_state == .TopLevelEnd; switch (c) { '0' => { p.state = .NumberMaybeDotOrExponent; }, '1'...'9' => { p.state = .NumberMaybeDigitOrDotOrExponent; }, else => { return error.InvalidNumber; }, } }, .NumberMaybeDotOrExponent => { p.complete = p.after_value_state == .TopLevelEnd; switch (c) { '.' => { p.number_is_integer = false; p.state = .NumberFractionalRequired; }, 'e', 'E' => { p.number_is_integer = false; p.state = .NumberExponent; }, else => { p.state = p.after_value_state; token.* = .{ .Number = .{ .count = p.count, .is_integer = p.number_is_integer, }, }; p.number_is_integer = undefined; return true; }, } }, .NumberMaybeDigitOrDotOrExponent => { p.complete = p.after_value_state == .TopLevelEnd; switch (c) { '.' => { p.number_is_integer = false; p.state = .NumberFractionalRequired; }, 'e', 'E' => { p.number_is_integer = false; p.state = .NumberExponent; }, '0'...'9' => { // another digit }, else => { p.state = p.after_value_state; token.* = .{ .Number = .{ .count = p.count, .is_integer = p.number_is_integer, }, }; return true; }, } }, .NumberFractionalRequired => { p.complete = p.after_value_state == .TopLevelEnd; switch (c) { '0'...'9' => { p.state = .NumberFractional; }, else => { return error.InvalidNumber; }, } }, .NumberFractional => { p.complete = p.after_value_state == .TopLevelEnd; switch (c) { '0'...'9' => { // another digit }, 'e', 'E' => { p.number_is_integer = false; p.state = .NumberExponent; }, else => { p.state = p.after_value_state; token.* = .{ .Number = .{ .count = p.count, .is_integer = p.number_is_integer, }, }; return true; }, } }, .NumberMaybeExponent => { p.complete = p.after_value_state == .TopLevelEnd; switch (c) { 'e', 'E' => { p.number_is_integer = false; p.state = .NumberExponent; }, else => { p.state = p.after_value_state; token.* = .{ .Number = .{ .count = p.count, .is_integer = p.number_is_integer, }, }; return true; }, } }, .NumberExponent => switch (c) { '-', '+' => { p.complete = false; p.state = .NumberExponentDigitsRequired; }, '0'...'9' => { p.complete = p.after_value_state == .TopLevelEnd; p.state = .NumberExponentDigits; }, else => { return error.InvalidNumber; }, }, .NumberExponentDigitsRequired => switch (c) { '0'...'9' => { p.complete = p.after_value_state == .TopLevelEnd; p.state = .NumberExponentDigits; }, else => { return error.InvalidNumber; }, }, .NumberExponentDigits => { p.complete = p.after_value_state == .TopLevelEnd; switch (c) { '0'...'9' => { // another digit }, else => { p.state = p.after_value_state; token.* = .{ .Number = .{ .count = p.count, .is_integer = p.number_is_integer, }, }; return true; }, } }, .TrueLiteral1 => switch (c) { 'r' => p.state = .TrueLiteral2, else => return error.InvalidLiteral, }, .TrueLiteral2 => switch (c) { 'u' => p.state = .TrueLiteral3, else => return error.InvalidLiteral, }, .TrueLiteral3 => switch (c) { 'e' => { p.state = p.after_value_state; p.complete = p.state == .TopLevelEnd; token.* = Token.True; }, else => { return error.InvalidLiteral; }, }, .FalseLiteral1 => switch (c) { 'a' => p.state = .FalseLiteral2, else => return error.InvalidLiteral, }, .FalseLiteral2 => switch (c) { 'l' => p.state = .FalseLiteral3, else => return error.InvalidLiteral, }, .FalseLiteral3 => switch (c) { 's' => p.state = .FalseLiteral4, else => return error.InvalidLiteral, }, .FalseLiteral4 => switch (c) { 'e' => { p.state = p.after_value_state; p.complete = p.state == .TopLevelEnd; token.* = Token.False; }, else => { return error.InvalidLiteral; }, }, .NullLiteral1 => switch (c) { 'u' => p.state = .NullLiteral2, else => return error.InvalidLiteral, }, .NullLiteral2 => switch (c) { 'l' => p.state = .NullLiteral3, else => return error.InvalidLiteral, }, .NullLiteral3 => switch (c) { 'l' => { p.state = p.after_value_state; p.complete = p.state == .TopLevelEnd; token.* = Token.Null; }, else => { return error.InvalidLiteral; }, }, } return false; } };
src/json/std.zig
const std = @import("std"); pub fn __truncsfhf2(a: f32) callconv(.C) u16 { return @bitCast(u16, @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f16, f32, a })); } pub fn __truncdfhf2(a: f64) callconv(.C) u16 { return @bitCast(u16, @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f16, f64, a })); } pub fn __trunctfsf2(a: f128) callconv(.C) f32 { return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f32, f128, a }); } pub fn __trunctfdf2(a: f128) callconv(.C) f64 { return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f64, f128, a }); } pub fn __truncdfsf2(a: f64) callconv(.C) f32 { return @call(.{ .modifier = .always_inline }, truncXfYf2, .{ f32, f64, a }); } pub fn __aeabi_d2f(a: f64) callconv(.AAPCS) f32 { @setRuntimeSafety(false); return @call(.{ .modifier = .always_inline }, __truncdfsf2, .{a}); } pub fn __aeabi_d2h(a: f64) callconv(.AAPCS) u16 { @setRuntimeSafety(false); return @call(.{ .modifier = .always_inline }, __truncdfhf2, .{a}); } pub fn __aeabi_f2h(a: f32) callconv(.AAPCS) u16 { @setRuntimeSafety(false); return @call(.{ .modifier = .always_inline }, __truncsfhf2, .{a}); } fn truncXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { const src_rep_t = std.meta.Int(false, @typeInfo(src_t).Float.bits); const dst_rep_t = std.meta.Int(false, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t); const dstSigBits = std.math.floatMantissaBits(dst_t); const SrcShift = std.math.Log2Int(src_rep_t); const DstShift = std.math.Log2Int(dst_rep_t); // Various constants whose values follow from the type parameters. // Any reasonable optimizer will fold and propagate all of these. const srcBits = src_t.bit_count; const srcExpBits = srcBits - srcSigBits - 1; const srcInfExp = (1 << srcExpBits) - 1; const srcExpBias = srcInfExp >> 1; const srcMinNormal = 1 << srcSigBits; const srcSignificandMask = srcMinNormal - 1; const srcInfinity = srcInfExp << srcSigBits; const srcSignMask = 1 << (srcSigBits + srcExpBits); const srcAbsMask = srcSignMask - 1; const roundMask = (1 << (srcSigBits - dstSigBits)) - 1; const halfway = 1 << (srcSigBits - dstSigBits - 1); const srcQNaN = 1 << (srcSigBits - 1); const srcNaNCode = srcQNaN - 1; const dstBits = dst_t.bit_count; const dstExpBits = dstBits - dstSigBits - 1; const dstInfExp = (1 << dstExpBits) - 1; const dstExpBias = dstInfExp >> 1; const underflowExponent = srcExpBias + 1 - dstExpBias; const overflowExponent = srcExpBias + dstInfExp - dstExpBias; const underflow = underflowExponent << srcSigBits; const overflow = overflowExponent << srcSigBits; const dstQNaN = 1 << (dstSigBits - 1); const dstNaNCode = dstQNaN - 1; // Break a into a sign and representation of the absolute value const aRep: src_rep_t = @bitCast(src_rep_t, a); const aAbs: src_rep_t = aRep & srcAbsMask; const sign: src_rep_t = aRep & srcSignMask; var absResult: dst_rep_t = undefined; if (aAbs -% underflow < aAbs -% overflow) { // The exponent of a is within the range of normal numbers in the // destination format. We can convert by simply right-shifting with // rounding and adjusting the exponent. absResult = @truncate(dst_rep_t, aAbs >> (srcSigBits - dstSigBits)); absResult -%= @as(dst_rep_t, srcExpBias - dstExpBias) << dstSigBits; const roundBits: src_rep_t = aAbs & roundMask; if (roundBits > halfway) { // Round to nearest absResult += 1; } else if (roundBits == halfway) { // Ties to even absResult += absResult & 1; } } else if (aAbs > srcInfinity) { // a is NaN. // Conjure the result by beginning with infinity, setting the qNaN // bit and inserting the (truncated) trailing NaN field. absResult = @intCast(dst_rep_t, dstInfExp) << dstSigBits; absResult |= dstQNaN; absResult |= @intCast(dst_rep_t, ((aAbs & srcNaNCode) >> (srcSigBits - dstSigBits)) & dstNaNCode); } else if (aAbs >= overflow) { // a overflows to infinity. absResult = @intCast(dst_rep_t, dstInfExp) << dstSigBits; } else { // a underflows on conversion to the destination type or is an exact // zero. The result may be a denormal or zero. Extract the exponent // to get the shift amount for the denormalization. const aExp = @intCast(u32, aAbs >> srcSigBits); const shift = @intCast(u32, srcExpBias - dstExpBias - aExp + 1); const significand: src_rep_t = (aRep & srcSignificandMask) | srcMinNormal; // Right shift by the denormalization amount with sticky. if (shift > srcSigBits) { absResult = 0; } else { const sticky: src_rep_t = significand << @intCast(SrcShift, srcBits - shift); const denormalizedSignificand: src_rep_t = significand >> @intCast(SrcShift, shift) | sticky; absResult = @intCast(dst_rep_t, denormalizedSignificand >> (srcSigBits - dstSigBits)); const roundBits: src_rep_t = denormalizedSignificand & roundMask; if (roundBits > halfway) { // Round to nearest absResult += 1; } else if (roundBits == halfway) { // Ties to even absResult += absResult & 1; } } } const result: dst_rep_t align(@alignOf(dst_t)) = absResult | @truncate(dst_rep_t, sign >> @intCast(SrcShift, srcBits - dstBits)); return @bitCast(dst_t, result); } test "import truncXfYf2" { _ = @import("truncXfYf2_test.zig"); }
lib/std/special/compiler_rt/truncXfYf2.zig
const std = @import("std"); pub const pkg = std.build.Pkg{ .name = "zmesh", .path = .{ .path = thisDir() ++ "/src/main.zig" }, }; pub fn build(b: *std.build.Builder) void { const build_mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); const tests = buildTests(b, build_mode, target); const test_step = b.step("test", "Run zmesh tests"); test_step.dependOn(&tests.step); } pub fn buildTests( b: *std.build.Builder, build_mode: std.builtin.Mode, target: std.zig.CrossTarget, ) *std.build.LibExeObjStep { const tests = b.addTest(thisDir() ++ "/src/main.zig"); tests.setBuildMode(build_mode); tests.setTarget(target); link(tests); return tests; } fn buildLibrary(exe: *std.build.LibExeObjStep) *std.build.LibExeObjStep { const lib = exe.builder.addStaticLibrary("zmesh", thisDir() ++ "/src/main.zig"); lib.setBuildMode(exe.build_mode); lib.setTarget(exe.target); lib.linkSystemLibrary("c"); lib.linkSystemLibrary("c++"); lib.addIncludeDir(thisDir() ++ "/libs/par_shapes"); lib.addCSourceFile( thisDir() ++ "/libs/par_shapes/par_shapes.c", &.{ "-std=c99", "-fno-sanitize=undefined" }, ); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/clusterizer.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/indexgenerator.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/vcacheoptimizer.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/vcacheanalyzer.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/vfetchoptimizer.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/vfetchanalyzer.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/overdrawoptimizer.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/overdrawanalyzer.cpp", &.{""}); lib.addCSourceFile(thisDir() ++ "/libs/meshoptimizer/allocator.cpp", &.{""}); lib.addIncludeDir(thisDir() ++ "/libs/cgltf"); lib.addCSourceFile(thisDir() ++ "/libs/cgltf/cgltf.c", &.{"-std=c99"}); return lib; } pub fn link(exe: *std.build.LibExeObjStep) void { const lib = buildLibrary(exe); exe.linkLibrary(lib); exe.addIncludeDir(thisDir() ++ "/libs/cgltf"); } fn thisDir() []const u8 { comptime { return std.fs.path.dirname(@src().file) orelse "."; } }
modules/graphics/vendored/zmesh/build.zig
pub const DIRECTINPUT_VERSION = @as(u32, 2048); pub const JOY_HW_NONE = @as(u32, 0); pub const JOY_HW_CUSTOM = @as(u32, 1); pub const JOY_HW_2A_2B_GENERIC = @as(u32, 2); pub const JOY_HW_2A_4B_GENERIC = @as(u32, 3); pub const JOY_HW_2B_GAMEPAD = @as(u32, 4); pub const JOY_HW_2B_FLIGHTYOKE = @as(u32, 5); pub const JOY_HW_2B_FLIGHTYOKETHROTTLE = @as(u32, 6); pub const JOY_HW_3A_2B_GENERIC = @as(u32, 7); pub const JOY_HW_3A_4B_GENERIC = @as(u32, 8); pub const JOY_HW_4B_GAMEPAD = @as(u32, 9); pub const JOY_HW_4B_FLIGHTYOKE = @as(u32, 10); pub const JOY_HW_4B_FLIGHTYOKETHROTTLE = @as(u32, 11); pub const JOY_HW_TWO_2A_2B_WITH_Y = @as(u32, 12); pub const JOY_HW_LASTENTRY = @as(u32, 13); pub const JOY_ISCAL_XY = @as(i32, 1); pub const JOY_ISCAL_Z = @as(i32, 2); pub const JOY_ISCAL_R = @as(i32, 4); pub const JOY_ISCAL_U = @as(i32, 8); pub const JOY_ISCAL_V = @as(i32, 16); pub const JOY_ISCAL_POV = @as(i32, 32); pub const JOY_POV_NUMDIRS = @as(u32, 4); pub const JOY_POVVAL_FORWARD = @as(u32, 0); pub const JOY_POVVAL_BACKWARD = @as(u32, 1); pub const JOY_POVVAL_LEFT = @as(u32, 2); pub const JOY_POVVAL_RIGHT = @as(u32, 3); pub const JOY_HWS_HASZ = @as(i32, 1); pub const JOY_HWS_HASPOV = @as(i32, 2); pub const JOY_HWS_POVISBUTTONCOMBOS = @as(i32, 4); pub const JOY_HWS_POVISPOLL = @as(i32, 8); pub const JOY_HWS_ISYOKE = @as(i32, 16); pub const JOY_HWS_ISGAMEPAD = @as(i32, 32); pub const JOY_HWS_ISCARCTRL = @as(i32, 64); pub const JOY_HWS_XISJ1Y = @as(i32, 128); pub const JOY_HWS_XISJ2X = @as(i32, 256); pub const JOY_HWS_XISJ2Y = @as(i32, 512); pub const JOY_HWS_YISJ1X = @as(i32, 1024); pub const JOY_HWS_YISJ2X = @as(i32, 2048); pub const JOY_HWS_YISJ2Y = @as(i32, 4096); pub const JOY_HWS_ZISJ1X = @as(i32, 8192); pub const JOY_HWS_ZISJ1Y = @as(i32, 16384); pub const JOY_HWS_ZISJ2X = @as(i32, 32768); pub const JOY_HWS_POVISJ1X = @as(i32, 65536); pub const JOY_HWS_POVISJ1Y = @as(i32, 131072); pub const JOY_HWS_POVISJ2X = @as(i32, 262144); pub const JOY_HWS_HASR = @as(i32, 524288); pub const JOY_HWS_RISJ1X = @as(i32, 1048576); pub const JOY_HWS_RISJ1Y = @as(i32, 2097152); pub const JOY_HWS_RISJ2Y = @as(i32, 4194304); pub const JOY_HWS_HASU = @as(i32, 8388608); pub const JOY_HWS_HASV = @as(i32, 16777216); pub const JOY_US_HASRUDDER = @as(i32, 1); pub const JOY_US_PRESENT = @as(i32, 2); pub const JOY_US_ISOEM = @as(i32, 4); pub const JOY_US_RESERVED = @as(i32, -2147483648); pub const JOYTYPE_ZEROGAMEENUMOEMDATA = @as(i32, 1); pub const JOYTYPE_NOAUTODETECTGAMEPORT = @as(i32, 2); pub const JOYTYPE_NOHIDDIRECT = @as(i32, 4); pub const JOYTYPE_ANALOGCOMPAT = @as(i32, 8); pub const JOYTYPE_DEFAULTPROPSHEET = @as(i32, -2147483648); pub const JOYTYPE_DEVICEHIDE = @as(i32, 65536); pub const JOYTYPE_MOUSEHIDE = @as(i32, 131072); pub const JOYTYPE_KEYBHIDE = @as(i32, 262144); pub const JOYTYPE_GAMEHIDE = @as(i32, 524288); pub const JOYTYPE_HIDEACTIVE = @as(i32, 1048576); pub const JOYTYPE_INFOMASK = @as(i32, 14680064); pub const JOYTYPE_INFODEFAULT = @as(i32, 0); pub const JOYTYPE_INFOYYPEDALS = @as(i32, 2097152); pub const JOYTYPE_INFOZYPEDALS = @as(i32, 4194304); pub const JOYTYPE_INFOYRPEDALS = @as(i32, 6291456); pub const JOYTYPE_INFOZRPEDALS = @as(i32, 8388608); pub const JOYTYPE_INFOZISSLIDER = @as(i32, 2097152); pub const JOYTYPE_INFOZISZ = @as(i32, 4194304); pub const JOYTYPE_ENABLEINPUTREPORT = @as(i32, 16777216); pub const MAX_JOYSTRING = @as(u32, 256); pub const MAX_JOYSTICKOEMVXDNAME = @as(u32, 260); pub const DITC_REGHWSETTINGS = @as(u32, 1); pub const DITC_CLSIDCONFIG = @as(u32, 2); pub const DITC_DISPLAYNAME = @as(u32, 4); pub const DITC_CALLOUT = @as(u32, 8); pub const DITC_HARDWAREID = @as(u32, 16); pub const DITC_FLAGS1 = @as(u32, 32); pub const DITC_FLAGS2 = @as(u32, 64); pub const DITC_MAPFILE = @as(u32, 128); pub const DIJC_GUIDINSTANCE = @as(u32, 1); pub const DIJC_REGHWCONFIGTYPE = @as(u32, 2); pub const DIJC_GAIN = @as(u32, 4); pub const DIJC_CALLOUT = @as(u32, 8); pub const DIJC_WDMGAMEPORT = @as(u32, 16); pub const DIJU_USERVALUES = @as(u32, 1); pub const DIJU_GLOBALDRIVER = @as(u32, 2); pub const DIJU_GAMEPORTEMULATOR = @as(u32, 4); pub const GUID_KeyboardClass = Guid.initString("4d36e96b-e325-11ce-bfc1-08002be10318"); pub const GUID_MediaClass = Guid.initString("4d36e96c-e325-11ce-bfc1-08002be10318"); pub const GUID_MouseClass = Guid.initString("4d36e96f-e325-11ce-bfc1-08002be10318"); pub const GUID_HIDClass = Guid.initString("745a17a0-74d3-11d0-b6fe-00a0c90f57da"); pub const DIMSGWP_NEWAPPSTART = @as(u32, 1); pub const DIMSGWP_DX8APPSTART = @as(u32, 2); pub const DIMSGWP_DX8MAPPERAPPSTART = @as(u32, 3); pub const DIAPPIDFLAG_NOTIME = @as(u32, 1); pub const DIAPPIDFLAG_NOSIZE = @as(u32, 2); pub const DIERR_NOMOREITEMS = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024637)); pub const DIERR_DRIVERFIRST = @as(i32, -2147220736); pub const DIERR_DRIVERLAST = @as(i32, -2147220481); pub const DIERR_INVALIDCLASSINSTALLER = @as(i32, -2147220480); pub const DIERR_CANCELLED = @as(i32, -2147220479); pub const DIERR_BADINF = @as(i32, -2147220478); pub const DIDIFT_DELETE = @as(u32, 16777216); pub const GUID_DEVINTERFACE_HID = Guid.initString("4d1e55b2-f16f-11cf-88cb-001111000030"); pub const GUID_HID_INTERFACE_NOTIFY = Guid.initString("2c4e2e88-25e6-4c33-882f-3d82e6073681"); pub const GUID_HID_INTERFACE_HIDPARSE = Guid.initString("f5c315a5-69ac-4bc2-9279-d0b64576f44b"); pub const DEVPKEY_DeviceInterface_HID_UsagePage = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 2 }; pub const DEVPKEY_DeviceInterface_HID_UsageId = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 3 }; pub const DEVPKEY_DeviceInterface_HID_IsReadOnly = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 4 }; pub const DEVPKEY_DeviceInterface_HID_VendorId = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 5 }; pub const DEVPKEY_DeviceInterface_HID_ProductId = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 6 }; pub const DEVPKEY_DeviceInterface_HID_VersionNumber = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 7 }; pub const DEVPKEY_DeviceInterface_HID_BackgroundAccess = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 8 }; pub const DEVPKEY_DeviceInterface_HID_WakeScreenOnInputCapable = PROPERTYKEY { .fmtid = Guid.initString("cbf38310-4a17-4310-a1eb-247f0b67593b"), .pid = 9 }; pub const HID_REVISION = @as(u32, 1); pub const HID_USAGE_PAGE_UNDEFINED = @as(u16, 0); pub const HID_USAGE_PAGE_GENERIC = @as(u16, 1); pub const HID_USAGE_PAGE_SIMULATION = @as(u16, 2); pub const HID_USAGE_PAGE_VR = @as(u16, 3); pub const HID_USAGE_PAGE_SPORT = @as(u16, 4); pub const HID_USAGE_PAGE_GAME = @as(u16, 5); pub const HID_USAGE_PAGE_GENERIC_DEVICE = @as(u16, 6); pub const HID_USAGE_PAGE_KEYBOARD = @as(u16, 7); pub const HID_USAGE_PAGE_LED = @as(u16, 8); pub const HID_USAGE_PAGE_BUTTON = @as(u16, 9); pub const HID_USAGE_PAGE_ORDINAL = @as(u16, 10); pub const HID_USAGE_PAGE_TELEPHONY = @as(u16, 11); pub const HID_USAGE_PAGE_CONSUMER = @as(u16, 12); pub const HID_USAGE_PAGE_DIGITIZER = @as(u16, 13); pub const HID_USAGE_PAGE_HAPTICS = @as(u16, 14); pub const HID_USAGE_PAGE_PID = @as(u16, 15); pub const HID_USAGE_PAGE_UNICODE = @as(u16, 16); pub const HID_USAGE_PAGE_ALPHANUMERIC = @as(u16, 20); pub const HID_USAGE_PAGE_SENSOR = @as(u16, 32); pub const HID_USAGE_PAGE_LIGHTING_ILLUMINATION = @as(u16, 89); pub const HID_USAGE_PAGE_BARCODE_SCANNER = @as(u16, 140); pub const HID_USAGE_PAGE_WEIGHING_DEVICE = @as(u16, 141); pub const HID_USAGE_PAGE_MAGNETIC_STRIPE_READER = @as(u16, 142); pub const HID_USAGE_PAGE_CAMERA_CONTROL = @as(u16, 144); pub const HID_USAGE_PAGE_ARCADE = @as(u16, 145); pub const HID_USAGE_PAGE_MICROSOFT_BLUETOOTH_HANDSFREE = @as(u16, 65523); pub const HID_USAGE_PAGE_VENDOR_DEFINED_BEGIN = @as(u16, 65280); pub const HID_USAGE_PAGE_VENDOR_DEFINED_END = @as(u16, 65535); pub const HID_USAGE_GENERIC_POINTER = @as(u16, 1); pub const HID_USAGE_GENERIC_MOUSE = @as(u16, 2); pub const HID_USAGE_GENERIC_JOYSTICK = @as(u16, 4); pub const HID_USAGE_GENERIC_GAMEPAD = @as(u16, 5); pub const HID_USAGE_GENERIC_KEYBOARD = @as(u16, 6); pub const HID_USAGE_GENERIC_KEYPAD = @as(u16, 7); pub const HID_USAGE_GENERIC_MULTI_AXIS_CONTROLLER = @as(u16, 8); pub const HID_USAGE_GENERIC_TABLET_PC_SYSTEM_CTL = @as(u16, 9); pub const HID_USAGE_GENERIC_PORTABLE_DEVICE_CONTROL = @as(u16, 13); pub const HID_USAGE_GENERIC_INTERACTIVE_CONTROL = @as(u16, 14); pub const HID_USAGE_GENERIC_COUNTED_BUFFER = @as(u16, 58); pub const HID_USAGE_GENERIC_SYSTEM_CTL = @as(u16, 128); pub const HID_USAGE_GENERIC_X = @as(u16, 48); pub const HID_USAGE_GENERIC_Y = @as(u16, 49); pub const HID_USAGE_GENERIC_Z = @as(u16, 50); pub const HID_USAGE_GENERIC_RX = @as(u16, 51); pub const HID_USAGE_GENERIC_RY = @as(u16, 52); pub const HID_USAGE_GENERIC_RZ = @as(u16, 53); pub const HID_USAGE_GENERIC_SLIDER = @as(u16, 54); pub const HID_USAGE_GENERIC_DIAL = @as(u16, 55); pub const HID_USAGE_GENERIC_WHEEL = @as(u16, 56); pub const HID_USAGE_GENERIC_HATSWITCH = @as(u16, 57); pub const HID_USAGE_GENERIC_BYTE_COUNT = @as(u16, 59); pub const HID_USAGE_GENERIC_MOTION_WAKEUP = @as(u16, 60); pub const HID_USAGE_GENERIC_START = @as(u16, 61); pub const HID_USAGE_GENERIC_SELECT = @as(u16, 62); pub const HID_USAGE_GENERIC_VX = @as(u16, 64); pub const HID_USAGE_GENERIC_VY = @as(u16, 65); pub const HID_USAGE_GENERIC_VZ = @as(u16, 66); pub const HID_USAGE_GENERIC_VBRX = @as(u16, 67); pub const HID_USAGE_GENERIC_VBRY = @as(u16, 68); pub const HID_USAGE_GENERIC_VBRZ = @as(u16, 69); pub const HID_USAGE_GENERIC_VNO = @as(u16, 70); pub const HID_USAGE_GENERIC_FEATURE_NOTIFICATION = @as(u16, 71); pub const HID_USAGE_GENERIC_RESOLUTION_MULTIPLIER = @as(u16, 72); pub const HID_USAGE_GENERIC_SYSCTL_POWER = @as(u16, 129); pub const HID_USAGE_GENERIC_SYSCTL_SLEEP = @as(u16, 130); pub const HID_USAGE_GENERIC_SYSCTL_WAKE = @as(u16, 131); pub const HID_USAGE_GENERIC_SYSCTL_CONTEXT_MENU = @as(u16, 132); pub const HID_USAGE_GENERIC_SYSCTL_MAIN_MENU = @as(u16, 133); pub const HID_USAGE_GENERIC_SYSCTL_APP_MENU = @as(u16, 134); pub const HID_USAGE_GENERIC_SYSCTL_HELP_MENU = @as(u16, 135); pub const HID_USAGE_GENERIC_SYSCTL_MENU_EXIT = @as(u16, 136); pub const HID_USAGE_GENERIC_SYSCTL_MENU_SELECT = @as(u16, 137); pub const HID_USAGE_GENERIC_SYSCTL_MENU_RIGHT = @as(u16, 138); pub const HID_USAGE_GENERIC_SYSCTL_MENU_LEFT = @as(u16, 139); pub const HID_USAGE_GENERIC_SYSCTL_MENU_UP = @as(u16, 140); pub const HID_USAGE_GENERIC_SYSCTL_MENU_DOWN = @as(u16, 141); pub const HID_USAGE_GENERIC_SYSCTL_COLD_RESTART = @as(u16, 142); pub const HID_USAGE_GENERIC_SYSCTL_WARM_RESTART = @as(u16, 143); pub const HID_USAGE_GENERIC_DPAD_UP = @as(u16, 144); pub const HID_USAGE_GENERIC_DPAD_DOWN = @as(u16, 145); pub const HID_USAGE_GENERIC_DPAD_RIGHT = @as(u16, 146); pub const HID_USAGE_GENERIC_DPAD_LEFT = @as(u16, 147); pub const HID_USAGE_GENERIC_SYSCTL_FN = @as(u16, 151); pub const HID_USAGE_GENERIC_SYSCTL_FN_LOCK = @as(u16, 152); pub const HID_USAGE_GENERIC_SYSCTL_FN_LOCK_INDICATOR = @as(u16, 153); pub const HID_USAGE_GENERIC_SYSCTL_DISMISS_NOTIFICATION = @as(u16, 154); pub const HID_USAGE_GENERIC_SYSCTL_DOCK = @as(u16, 160); pub const HID_USAGE_GENERIC_SYSCTL_UNDOCK = @as(u16, 161); pub const HID_USAGE_GENERIC_SYSCTL_SETUP = @as(u16, 162); pub const HID_USAGE_GENERIC_SYSCTL_SYS_BREAK = @as(u16, 163); pub const HID_USAGE_GENERIC_SYSCTL_SYS_DBG_BREAK = @as(u16, 164); pub const HID_USAGE_GENERIC_SYSCTL_APP_BREAK = @as(u16, 165); pub const HID_USAGE_GENERIC_SYSCTL_APP_DBG_BREAK = @as(u16, 166); pub const HID_USAGE_GENERIC_SYSCTL_MUTE = @as(u16, 167); pub const HID_USAGE_GENERIC_SYSCTL_HIBERNATE = @as(u16, 168); pub const HID_USAGE_GENERIC_SYSCTL_DISP_INVERT = @as(u16, 176); pub const HID_USAGE_GENERIC_SYSCTL_DISP_INTERNAL = @as(u16, 177); pub const HID_USAGE_GENERIC_SYSCTL_DISP_EXTERNAL = @as(u16, 178); pub const HID_USAGE_GENERIC_SYSCTL_DISP_BOTH = @as(u16, 179); pub const HID_USAGE_GENERIC_SYSCTL_DISP_DUAL = @as(u16, 180); pub const HID_USAGE_GENERIC_SYSCTL_DISP_TOGGLE = @as(u16, 181); pub const HID_USAGE_GENERIC_SYSCTL_DISP_SWAP = @as(u16, 182); pub const HID_USAGE_GENERIC_SYSCTL_DISP_AUTOSCALE = @as(u16, 183); pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_BUTTON = @as(u16, 201); pub const HID_USAGE_GENERIC_SYSTEM_DISPLAY_ROTATION_LOCK_SLIDER_SWITCH = @as(u16, 202); pub const HID_USAGE_GENERIC_CONTROL_ENABLE = @as(u16, 203); pub const HID_USAGE_SIMULATION_FLIGHT_SIMULATION_DEVICE = @as(u16, 1); pub const HID_USAGE_SIMULATION_AUTOMOBILE_SIMULATION_DEVICE = @as(u16, 2); pub const HID_USAGE_SIMULATION_TANK_SIMULATION_DEVICE = @as(u16, 3); pub const HID_USAGE_SIMULATION_SPACESHIP_SIMULATION_DEVICE = @as(u16, 4); pub const HID_USAGE_SIMULATION_SUBMARINE_SIMULATION_DEVICE = @as(u16, 5); pub const HID_USAGE_SIMULATION_SAILING_SIMULATION_DEVICE = @as(u16, 6); pub const HID_USAGE_SIMULATION_MOTORCYCLE_SIMULATION_DEVICE = @as(u16, 7); pub const HID_USAGE_SIMULATION_SPORTS_SIMULATION_DEVICE = @as(u16, 8); pub const HID_USAGE_SIMULATION_AIRPLANE_SIMULATION_DEVICE = @as(u16, 9); pub const HID_USAGE_SIMULATION_HELICOPTER_SIMULATION_DEVICE = @as(u16, 10); pub const HID_USAGE_SIMULATION_MAGIC_CARPET_SIMULATION_DEVICE = @as(u16, 11); pub const HID_USAGE_SIMULATION_BICYCLE_SIMULATION_DEVICE = @as(u16, 12); pub const HID_USAGE_SIMULATION_FLIGHT_CONTROL_STICK = @as(u16, 32); pub const HID_USAGE_SIMULATION_FLIGHT_STICK = @as(u16, 33); pub const HID_USAGE_SIMULATION_CYCLIC_CONTROL = @as(u16, 34); pub const HID_USAGE_SIMULATION_CYCLIC_TRIM = @as(u16, 35); pub const HID_USAGE_SIMULATION_FLIGHT_YOKE = @as(u16, 36); pub const HID_USAGE_SIMULATION_TRACK_CONTROL = @as(u16, 37); pub const HID_USAGE_SIMULATION_AILERON = @as(u16, 176); pub const HID_USAGE_SIMULATION_AILERON_TRIM = @as(u16, 177); pub const HID_USAGE_SIMULATION_ANTI_TORQUE_CONTROL = @as(u16, 178); pub const HID_USAGE_SIMULATION_AUTOPIOLOT_ENABLE = @as(u16, 179); pub const HID_USAGE_SIMULATION_CHAFF_RELEASE = @as(u16, 180); pub const HID_USAGE_SIMULATION_COLLECTIVE_CONTROL = @as(u16, 181); pub const HID_USAGE_SIMULATION_DIVE_BRAKE = @as(u16, 182); pub const HID_USAGE_SIMULATION_ELECTRONIC_COUNTERMEASURES = @as(u16, 183); pub const HID_USAGE_SIMULATION_ELEVATOR = @as(u16, 184); pub const HID_USAGE_SIMULATION_ELEVATOR_TRIM = @as(u16, 185); pub const HID_USAGE_SIMULATION_RUDDER = @as(u16, 186); pub const HID_USAGE_SIMULATION_THROTTLE = @as(u16, 187); pub const HID_USAGE_SIMULATION_FLIGHT_COMMUNICATIONS = @as(u16, 188); pub const HID_USAGE_SIMULATION_FLARE_RELEASE = @as(u16, 189); pub const HID_USAGE_SIMULATION_LANDING_GEAR = @as(u16, 190); pub const HID_USAGE_SIMULATION_TOE_BRAKE = @as(u16, 191); pub const HID_USAGE_SIMULATION_TRIGGER = @as(u16, 192); pub const HID_USAGE_SIMULATION_WEAPONS_ARM = @as(u16, 193); pub const HID_USAGE_SIMULATION_WEAPONS_SELECT = @as(u16, 194); pub const HID_USAGE_SIMULATION_WING_FLAPS = @as(u16, 195); pub const HID_USAGE_SIMULATION_ACCELLERATOR = @as(u16, 196); pub const HID_USAGE_SIMULATION_BRAKE = @as(u16, 197); pub const HID_USAGE_SIMULATION_CLUTCH = @as(u16, 198); pub const HID_USAGE_SIMULATION_SHIFTER = @as(u16, 199); pub const HID_USAGE_SIMULATION_STEERING = @as(u16, 200); pub const HID_USAGE_SIMULATION_TURRET_DIRECTION = @as(u16, 201); pub const HID_USAGE_SIMULATION_BARREL_ELEVATION = @as(u16, 202); pub const HID_USAGE_SIMULATION_DIVE_PLANE = @as(u16, 203); pub const HID_USAGE_SIMULATION_BALLAST = @as(u16, 204); pub const HID_USAGE_SIMULATION_BICYCLE_CRANK = @as(u16, 205); pub const HID_USAGE_SIMULATION_HANDLE_BARS = @as(u16, 206); pub const HID_USAGE_SIMULATION_FRONT_BRAKE = @as(u16, 207); pub const HID_USAGE_SIMULATION_REAR_BRAKE = @as(u16, 208); pub const HID_USAGE_VR_BELT = @as(u16, 1); pub const HID_USAGE_VR_BODY_SUIT = @as(u16, 2); pub const HID_USAGE_VR_FLEXOR = @as(u16, 3); pub const HID_USAGE_VR_GLOVE = @as(u16, 4); pub const HID_USAGE_VR_HEAD_TRACKER = @as(u16, 5); pub const HID_USAGE_VR_HEAD_MOUNTED_DISPLAY = @as(u16, 6); pub const HID_USAGE_VR_HAND_TRACKER = @as(u16, 7); pub const HID_USAGE_VR_OCULOMETER = @as(u16, 8); pub const HID_USAGE_VR_VEST = @as(u16, 9); pub const HID_USAGE_VR_ANIMATRONIC_DEVICE = @as(u16, 10); pub const HID_USAGE_VR_STEREO_ENABLE = @as(u16, 32); pub const HID_USAGE_VR_DISPLAY_ENABLE = @as(u16, 33); pub const HID_USAGE_SPORT_BASEBALL_BAT = @as(u16, 1); pub const HID_USAGE_SPORT_GOLF_CLUB = @as(u16, 2); pub const HID_USAGE_SPORT_ROWING_MACHINE = @as(u16, 3); pub const HID_USAGE_SPORT_TREADMILL = @as(u16, 4); pub const HID_USAGE_SPORT_STICK_TYPE = @as(u16, 56); pub const HID_USAGE_SPORT_OAR = @as(u16, 48); pub const HID_USAGE_SPORT_SLOPE = @as(u16, 49); pub const HID_USAGE_SPORT_RATE = @as(u16, 50); pub const HID_USAGE_SPORT_STICK_SPEED = @as(u16, 51); pub const HID_USAGE_SPORT_STICK_FACE_ANGLE = @as(u16, 52); pub const HID_USAGE_SPORT_HEEL_TOE = @as(u16, 53); pub const HID_USAGE_SPORT_FOLLOW_THROUGH = @as(u16, 54); pub const HID_USAGE_SPORT_TEMPO = @as(u16, 55); pub const HID_USAGE_SPORT_HEIGHT = @as(u16, 57); pub const HID_USAGE_SPORT_PUTTER = @as(u16, 80); pub const HID_USAGE_SPORT_1_IRON = @as(u16, 81); pub const HID_USAGE_SPORT_2_IRON = @as(u16, 82); pub const HID_USAGE_SPORT_3_IRON = @as(u16, 83); pub const HID_USAGE_SPORT_4_IRON = @as(u16, 84); pub const HID_USAGE_SPORT_5_IRON = @as(u16, 85); pub const HID_USAGE_SPORT_6_IRON = @as(u16, 86); pub const HID_USAGE_SPORT_7_IRON = @as(u16, 87); pub const HID_USAGE_SPORT_8_IRON = @as(u16, 88); pub const HID_USAGE_SPORT_9_IRON = @as(u16, 89); pub const HID_USAGE_SPORT_10_IRON = @as(u16, 90); pub const HID_USAGE_SPORT_11_IRON = @as(u16, 91); pub const HID_USAGE_SPORT_SAND_WEDGE = @as(u16, 92); pub const HID_USAGE_SPORT_LOFT_WEDGE = @as(u16, 93); pub const HID_USAGE_SPORT_POWER_WEDGE = @as(u16, 94); pub const HID_USAGE_SPORT_1_WOOD = @as(u16, 95); pub const HID_USAGE_SPORT_3_WOOD = @as(u16, 96); pub const HID_USAGE_SPORT_5_WOOD = @as(u16, 97); pub const HID_USAGE_SPORT_7_WOOD = @as(u16, 98); pub const HID_USAGE_SPORT_9_WOOD = @as(u16, 99); pub const HID_USAGE_GAME_3D_GAME_CONTROLLER = @as(u16, 1); pub const HID_USAGE_GAME_PINBALL_DEVICE = @as(u16, 2); pub const HID_USAGE_GAME_GUN_DEVICE = @as(u16, 3); pub const HID_USAGE_GAME_POINT_OF_VIEW = @as(u16, 32); pub const HID_USAGE_GAME_GUN_SELECTOR = @as(u16, 50); pub const HID_USAGE_GAME_GAMEPAD_FIRE_JUMP = @as(u16, 55); pub const HID_USAGE_GAME_GAMEPAD_TRIGGER = @as(u16, 57); pub const HID_USAGE_GAME_TURN_RIGHT_LEFT = @as(u16, 33); pub const HID_USAGE_GAME_PITCH_FORWARD_BACK = @as(u16, 34); pub const HID_USAGE_GAME_ROLL_RIGHT_LEFT = @as(u16, 35); pub const HID_USAGE_GAME_MOVE_RIGHT_LEFT = @as(u16, 36); pub const HID_USAGE_GAME_MOVE_FORWARD_BACK = @as(u16, 37); pub const HID_USAGE_GAME_MOVE_UP_DOWN = @as(u16, 38); pub const HID_USAGE_GAME_LEAN_RIGHT_LEFT = @as(u16, 39); pub const HID_USAGE_GAME_LEAN_FORWARD_BACK = @as(u16, 40); pub const HID_USAGE_GAME_POV_HEIGHT = @as(u16, 41); pub const HID_USAGE_GAME_FLIPPER = @as(u16, 42); pub const HID_USAGE_GAME_SECONDARY_FLIPPER = @as(u16, 43); pub const HID_USAGE_GAME_BUMP = @as(u16, 44); pub const HID_USAGE_GAME_NEW_GAME = @as(u16, 45); pub const HID_USAGE_GAME_SHOOT_BALL = @as(u16, 46); pub const HID_USAGE_GAME_PLAYER = @as(u16, 47); pub const HID_USAGE_GAME_GUN_BOLT = @as(u16, 48); pub const HID_USAGE_GAME_GUN_CLIP = @as(u16, 49); pub const HID_USAGE_GAME_GUN_SINGLE_SHOT = @as(u16, 51); pub const HID_USAGE_GAME_GUN_BURST = @as(u16, 52); pub const HID_USAGE_GAME_GUN_AUTOMATIC = @as(u16, 53); pub const HID_USAGE_GAME_GUN_SAFETY = @as(u16, 54); pub const HID_USAGE_GENERIC_DEVICE_BATTERY_STRENGTH = @as(u16, 32); pub const HID_USAGE_GENERIC_DEVICE_WIRELESS_CHANNEL = @as(u16, 33); pub const HID_USAGE_GENERIC_DEVICE_WIRELESS_ID = @as(u16, 34); pub const HID_USAGE_GENERIC_DEVICE_DISCOVER_WIRELESS_CONTROL = @as(u16, 35); pub const HID_USAGE_GENERIC_DEVICE_SECURITY_CODE_CHAR_ENTERED = @as(u16, 36); pub const HID_USAGE_GENERIC_DEVICE_SECURITY_CODE_CHAR_ERASED = @as(u16, 37); pub const HID_USAGE_GENERIC_DEVICE_SECURITY_CODE_CLEARED = @as(u16, 38); pub const HID_USAGE_KEYBOARD_NOEVENT = @as(u16, 0); pub const HID_USAGE_KEYBOARD_ROLLOVER = @as(u16, 1); pub const HID_USAGE_KEYBOARD_POSTFAIL = @as(u16, 2); pub const HID_USAGE_KEYBOARD_UNDEFINED = @as(u16, 3); pub const HID_USAGE_KEYBOARD_aA = @as(u16, 4); pub const HID_USAGE_KEYBOARD_zZ = @as(u16, 29); pub const HID_USAGE_KEYBOARD_ONE = @as(u16, 30); pub const HID_USAGE_KEYBOARD_ZERO = @as(u16, 39); pub const HID_USAGE_KEYBOARD_LCTRL = @as(u16, 224); pub const HID_USAGE_KEYBOARD_LSHFT = @as(u16, 225); pub const HID_USAGE_KEYBOARD_LALT = @as(u16, 226); pub const HID_USAGE_KEYBOARD_LGUI = @as(u16, 227); pub const HID_USAGE_KEYBOARD_RCTRL = @as(u16, 228); pub const HID_USAGE_KEYBOARD_RSHFT = @as(u16, 229); pub const HID_USAGE_KEYBOARD_RALT = @as(u16, 230); pub const HID_USAGE_KEYBOARD_RGUI = @as(u16, 231); pub const HID_USAGE_KEYBOARD_SCROLL_LOCK = @as(u16, 71); pub const HID_USAGE_KEYBOARD_NUM_LOCK = @as(u16, 83); pub const HID_USAGE_KEYBOARD_CAPS_LOCK = @as(u16, 57); pub const HID_USAGE_KEYBOARD_F1 = @as(u16, 58); pub const HID_USAGE_KEYBOARD_F2 = @as(u16, 59); pub const HID_USAGE_KEYBOARD_F3 = @as(u16, 60); pub const HID_USAGE_KEYBOARD_F4 = @as(u16, 61); pub const HID_USAGE_KEYBOARD_F5 = @as(u16, 62); pub const HID_USAGE_KEYBOARD_F6 = @as(u16, 63); pub const HID_USAGE_KEYBOARD_F7 = @as(u16, 64); pub const HID_USAGE_KEYBOARD_F8 = @as(u16, 65); pub const HID_USAGE_KEYBOARD_F9 = @as(u16, 66); pub const HID_USAGE_KEYBOARD_F10 = @as(u16, 67); pub const HID_USAGE_KEYBOARD_F11 = @as(u16, 68); pub const HID_USAGE_KEYBOARD_F12 = @as(u16, 69); pub const HID_USAGE_KEYBOARD_F13 = @as(u16, 104); pub const HID_USAGE_KEYBOARD_F14 = @as(u16, 105); pub const HID_USAGE_KEYBOARD_F15 = @as(u16, 106); pub const HID_USAGE_KEYBOARD_F16 = @as(u16, 107); pub const HID_USAGE_KEYBOARD_F17 = @as(u16, 108); pub const HID_USAGE_KEYBOARD_F18 = @as(u16, 109); pub const HID_USAGE_KEYBOARD_F19 = @as(u16, 110); pub const HID_USAGE_KEYBOARD_F20 = @as(u16, 111); pub const HID_USAGE_KEYBOARD_F21 = @as(u16, 112); pub const HID_USAGE_KEYBOARD_F22 = @as(u16, 113); pub const HID_USAGE_KEYBOARD_F23 = @as(u16, 114); pub const HID_USAGE_KEYBOARD_F24 = @as(u16, 115); pub const HID_USAGE_KEYBOARD_RETURN = @as(u16, 40); pub const HID_USAGE_KEYBOARD_ESCAPE = @as(u16, 41); pub const HID_USAGE_KEYBOARD_DELETE = @as(u16, 42); pub const HID_USAGE_KEYBOARD_PRINT_SCREEN = @as(u16, 70); pub const HID_USAGE_KEYBOARD_DELETE_FORWARD = @as(u16, 76); pub const HID_USAGE_LED_NUM_LOCK = @as(u16, 1); pub const HID_USAGE_LED_CAPS_LOCK = @as(u16, 2); pub const HID_USAGE_LED_SCROLL_LOCK = @as(u16, 3); pub const HID_USAGE_LED_COMPOSE = @as(u16, 4); pub const HID_USAGE_LED_KANA = @as(u16, 5); pub const HID_USAGE_LED_POWER = @as(u16, 6); pub const HID_USAGE_LED_SHIFT = @as(u16, 7); pub const HID_USAGE_LED_DO_NOT_DISTURB = @as(u16, 8); pub const HID_USAGE_LED_MUTE = @as(u16, 9); pub const HID_USAGE_LED_TONE_ENABLE = @as(u16, 10); pub const HID_USAGE_LED_HIGH_CUT_FILTER = @as(u16, 11); pub const HID_USAGE_LED_LOW_CUT_FILTER = @as(u16, 12); pub const HID_USAGE_LED_EQUALIZER_ENABLE = @as(u16, 13); pub const HID_USAGE_LED_SOUND_FIELD_ON = @as(u16, 14); pub const HID_USAGE_LED_SURROUND_FIELD_ON = @as(u16, 15); pub const HID_USAGE_LED_REPEAT = @as(u16, 16); pub const HID_USAGE_LED_STEREO = @as(u16, 17); pub const HID_USAGE_LED_SAMPLING_RATE_DETECT = @as(u16, 18); pub const HID_USAGE_LED_SPINNING = @as(u16, 19); pub const HID_USAGE_LED_CAV = @as(u16, 20); pub const HID_USAGE_LED_CLV = @as(u16, 21); pub const HID_USAGE_LED_RECORDING_FORMAT_DET = @as(u16, 22); pub const HID_USAGE_LED_OFF_HOOK = @as(u16, 23); pub const HID_USAGE_LED_RING = @as(u16, 24); pub const HID_USAGE_LED_MESSAGE_WAITING = @as(u16, 25); pub const HID_USAGE_LED_DATA_MODE = @as(u16, 26); pub const HID_USAGE_LED_BATTERY_OPERATION = @as(u16, 27); pub const HID_USAGE_LED_BATTERY_OK = @as(u16, 28); pub const HID_USAGE_LED_BATTERY_LOW = @as(u16, 29); pub const HID_USAGE_LED_SPEAKER = @as(u16, 30); pub const HID_USAGE_LED_HEAD_SET = @as(u16, 31); pub const HID_USAGE_LED_HOLD = @as(u16, 32); pub const HID_USAGE_LED_MICROPHONE = @as(u16, 33); pub const HID_USAGE_LED_COVERAGE = @as(u16, 34); pub const HID_USAGE_LED_NIGHT_MODE = @as(u16, 35); pub const HID_USAGE_LED_SEND_CALLS = @as(u16, 36); pub const HID_USAGE_LED_CALL_PICKUP = @as(u16, 37); pub const HID_USAGE_LED_CONFERENCE = @as(u16, 38); pub const HID_USAGE_LED_STAND_BY = @as(u16, 39); pub const HID_USAGE_LED_CAMERA_ON = @as(u16, 40); pub const HID_USAGE_LED_CAMERA_OFF = @as(u16, 41); pub const HID_USAGE_LED_ON_LINE = @as(u16, 42); pub const HID_USAGE_LED_OFF_LINE = @as(u16, 43); pub const HID_USAGE_LED_BUSY = @as(u16, 44); pub const HID_USAGE_LED_READY = @as(u16, 45); pub const HID_USAGE_LED_PAPER_OUT = @as(u16, 46); pub const HID_USAGE_LED_PAPER_JAM = @as(u16, 47); pub const HID_USAGE_LED_REMOTE = @as(u16, 48); pub const HID_USAGE_LED_FORWARD = @as(u16, 49); pub const HID_USAGE_LED_REVERSE = @as(u16, 50); pub const HID_USAGE_LED_STOP = @as(u16, 51); pub const HID_USAGE_LED_REWIND = @as(u16, 52); pub const HID_USAGE_LED_FAST_FORWARD = @as(u16, 53); pub const HID_USAGE_LED_PLAY = @as(u16, 54); pub const HID_USAGE_LED_PAUSE = @as(u16, 55); pub const HID_USAGE_LED_RECORD = @as(u16, 56); pub const HID_USAGE_LED_ERROR = @as(u16, 57); pub const HID_USAGE_LED_SELECTED_INDICATOR = @as(u16, 58); pub const HID_USAGE_LED_IN_USE_INDICATOR = @as(u16, 59); pub const HID_USAGE_LED_MULTI_MODE_INDICATOR = @as(u16, 60); pub const HID_USAGE_LED_INDICATOR_ON = @as(u16, 61); pub const HID_USAGE_LED_INDICATOR_FLASH = @as(u16, 62); pub const HID_USAGE_LED_INDICATOR_SLOW_BLINK = @as(u16, 63); pub const HID_USAGE_LED_INDICATOR_FAST_BLINK = @as(u16, 64); pub const HID_USAGE_LED_INDICATOR_OFF = @as(u16, 65); pub const HID_USAGE_LED_FLASH_ON_TIME = @as(u16, 66); pub const HID_USAGE_LED_SLOW_BLINK_ON_TIME = @as(u16, 67); pub const HID_USAGE_LED_SLOW_BLINK_OFF_TIME = @as(u16, 68); pub const HID_USAGE_LED_FAST_BLINK_ON_TIME = @as(u16, 69); pub const HID_USAGE_LED_FAST_BLINK_OFF_TIME = @as(u16, 70); pub const HID_USAGE_LED_INDICATOR_COLOR = @as(u16, 71); pub const HID_USAGE_LED_RED = @as(u16, 72); pub const HID_USAGE_LED_GREEN = @as(u16, 73); pub const HID_USAGE_LED_AMBER = @as(u16, 74); pub const HID_USAGE_LED_GENERIC_INDICATOR = @as(u16, 75); pub const HID_USAGE_LED_SYSTEM_SUSPEND = @as(u16, 76); pub const HID_USAGE_LED_EXTERNAL_POWER = @as(u16, 77); pub const HID_USAGE_TELEPHONY_PHONE = @as(u16, 1); pub const HID_USAGE_TELEPHONY_ANSWERING_MACHINE = @as(u16, 2); pub const HID_USAGE_TELEPHONY_MESSAGE_CONTROLS = @as(u16, 3); pub const HID_USAGE_TELEPHONY_HANDSET = @as(u16, 4); pub const HID_USAGE_TELEPHONY_HEADSET = @as(u16, 5); pub const HID_USAGE_TELEPHONY_KEYPAD = @as(u16, 6); pub const HID_USAGE_TELEPHONY_PROGRAMMABLE_BUTTON = @as(u16, 7); pub const HID_USAGE_TELEPHONY_REDIAL = @as(u16, 36); pub const HID_USAGE_TELEPHONY_TRANSFER = @as(u16, 37); pub const HID_USAGE_TELEPHONY_DROP = @as(u16, 38); pub const HID_USAGE_TELEPHONY_LINE = @as(u16, 42); pub const HID_USAGE_TELEPHONY_RING_ENABLE = @as(u16, 45); pub const HID_USAGE_TELEPHONY_SEND = @as(u16, 49); pub const HID_USAGE_TELEPHONY_KEYPAD_0 = @as(u16, 176); pub const HID_USAGE_TELEPHONY_KEYPAD_D = @as(u16, 191); pub const HID_USAGE_TELEPHONY_HOST_AVAILABLE = @as(u16, 241); pub const HID_USAGE_CONSUMERCTRL = @as(u16, 1); pub const HID_USAGE_CONSUMER_CHANNEL_INCREMENT = @as(u16, 156); pub const HID_USAGE_CONSUMER_CHANNEL_DECREMENT = @as(u16, 157); pub const HID_USAGE_CONSUMER_PLAY = @as(u16, 176); pub const HID_USAGE_CONSUMER_PAUSE = @as(u16, 177); pub const HID_USAGE_CONSUMER_RECORD = @as(u16, 178); pub const HID_USAGE_CONSUMER_FAST_FORWARD = @as(u16, 179); pub const HID_USAGE_CONSUMER_REWIND = @as(u16, 180); pub const HID_USAGE_CONSUMER_SCAN_NEXT_TRACK = @as(u16, 181); pub const HID_USAGE_CONSUMER_SCAN_PREV_TRACK = @as(u16, 182); pub const HID_USAGE_CONSUMER_STOP = @as(u16, 183); pub const HID_USAGE_CONSUMER_PLAY_PAUSE = @as(u16, 205); pub const HID_USAGE_CONSUMER_GAMEDVR_OPEN_GAMEBAR = @as(u16, 208); pub const HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_RECORD = @as(u16, 209); pub const HID_USAGE_CONSUMER_GAMEDVR_RECORD_CLIP = @as(u16, 210); pub const HID_USAGE_CONSUMER_GAMEDVR_SCREENSHOT = @as(u16, 211); pub const HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_INDICATOR = @as(u16, 212); pub const HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_MICROPHONE = @as(u16, 213); pub const HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_CAMERA = @as(u16, 214); pub const HID_USAGE_CONSUMER_GAMEDVR_TOGGLE_BROADCAST = @as(u16, 215); pub const HID_USAGE_CONSUMER_VOLUME = @as(u16, 224); pub const HID_USAGE_CONSUMER_BALANCE = @as(u16, 225); pub const HID_USAGE_CONSUMER_MUTE = @as(u16, 226); pub const HID_USAGE_CONSUMER_BASS = @as(u16, 227); pub const HID_USAGE_CONSUMER_TREBLE = @as(u16, 228); pub const HID_USAGE_CONSUMER_BASS_BOOST = @as(u16, 229); pub const HID_USAGE_CONSUMER_SURROUND_MODE = @as(u16, 230); pub const HID_USAGE_CONSUMER_LOUDNESS = @as(u16, 231); pub const HID_USAGE_CONSUMER_MPX = @as(u16, 232); pub const HID_USAGE_CONSUMER_VOLUME_INCREMENT = @as(u16, 233); pub const HID_USAGE_CONSUMER_VOLUME_DECREMENT = @as(u16, 234); pub const HID_USAGE_CONSUMER_BASS_INCREMENT = @as(u16, 338); pub const HID_USAGE_CONSUMER_BASS_DECREMENT = @as(u16, 339); pub const HID_USAGE_CONSUMER_TREBLE_INCREMENT = @as(u16, 340); pub const HID_USAGE_CONSUMER_TREBLE_DECREMENT = @as(u16, 341); pub const HID_USAGE_CONSUMER_AL_CONFIGURATION = @as(u16, 387); pub const HID_USAGE_CONSUMER_AL_EMAIL = @as(u16, 394); pub const HID_USAGE_CONSUMER_AL_CALCULATOR = @as(u16, 402); pub const HID_USAGE_CONSUMER_AL_BROWSER = @as(u16, 404); pub const HID_USAGE_CONSUMER_AL_SEARCH = @as(u16, 454); pub const HID_USAGE_CONSUMER_AC_SEARCH = @as(u16, 545); pub const HID_USAGE_CONSUMER_AC_GOTO = @as(u16, 546); pub const HID_USAGE_CONSUMER_AC_HOME = @as(u16, 547); pub const HID_USAGE_CONSUMER_AC_BACK = @as(u16, 548); pub const HID_USAGE_CONSUMER_AC_FORWARD = @as(u16, 549); pub const HID_USAGE_CONSUMER_AC_STOP = @as(u16, 550); pub const HID_USAGE_CONSUMER_AC_REFRESH = @as(u16, 551); pub const HID_USAGE_CONSUMER_AC_PREVIOUS = @as(u16, 552); pub const HID_USAGE_CONSUMER_AC_NEXT = @as(u16, 553); pub const HID_USAGE_CONSUMER_AC_BOOKMARKS = @as(u16, 554); pub const HID_USAGE_CONSUMER_AC_PAN = @as(u16, 568); pub const HID_USAGE_CONSUMER_EXTENDED_KEYBOARD_ATTRIBUTES_COLLECTION = @as(u16, 704); pub const HID_USAGE_CONSUMER_KEYBOARD_FORM_FACTOR = @as(u16, 705); pub const HID_USAGE_CONSUMER_KEYBOARD_KEY_TYPE = @as(u16, 706); pub const HID_USAGE_CONSUMER_KEYBOARD_PHYSICAL_LAYOUT = @as(u16, 707); pub const HID_USAGE_CONSUMER_VENDOR_SPECIFIC_KEYBOARD_PHYSICAL_LAYOUT = @as(u16, 708); pub const HID_USAGE_CONSUMER_KEYBOARD_IETF_LANGUAGE_TAG_INDEX = @as(u16, 709); pub const HID_USAGE_CONSUMER_IMPLEMENTED_KEYBOARD_INPUT_ASSIST_CONTROLS = @as(u16, 710); pub const HID_USAGE_DIGITIZER_DIGITIZER = @as(u16, 1); pub const HID_USAGE_DIGITIZER_PEN = @as(u16, 2); pub const HID_USAGE_DIGITIZER_LIGHT_PEN = @as(u16, 3); pub const HID_USAGE_DIGITIZER_TOUCH_SCREEN = @as(u16, 4); pub const HID_USAGE_DIGITIZER_TOUCH_PAD = @as(u16, 5); pub const HID_USAGE_DIGITIZER_WHITE_BOARD = @as(u16, 6); pub const HID_USAGE_DIGITIZER_COORD_MEASURING = @as(u16, 7); pub const HID_USAGE_DIGITIZER_3D_DIGITIZER = @as(u16, 8); pub const HID_USAGE_DIGITIZER_STEREO_PLOTTER = @as(u16, 9); pub const HID_USAGE_DIGITIZER_ARTICULATED_ARM = @as(u16, 10); pub const HID_USAGE_DIGITIZER_ARMATURE = @as(u16, 11); pub const HID_USAGE_DIGITIZER_MULTI_POINT = @as(u16, 12); pub const HID_USAGE_DIGITIZER_FREE_SPACE_WAND = @as(u16, 13); pub const HID_USAGE_DIGITIZER_HEAT_MAP = @as(u16, 15); pub const HID_USAGE_DIGITIZER_STYLUS = @as(u16, 32); pub const HID_USAGE_DIGITIZER_PUCK = @as(u16, 33); pub const HID_USAGE_DIGITIZER_FINGER = @as(u16, 34); pub const HID_USAGE_DIGITIZER_TABLET_FUNC_KEYS = @as(u16, 57); pub const HID_USAGE_DIGITIZER_PROG_CHANGE_KEYS = @as(u16, 58); pub const HID_USAGE_DIGITIZER_TIP_PRESSURE = @as(u16, 48); pub const HID_USAGE_DIGITIZER_BARREL_PRESSURE = @as(u16, 49); pub const HID_USAGE_DIGITIZER_IN_RANGE = @as(u16, 50); pub const HID_USAGE_DIGITIZER_TOUCH = @as(u16, 51); pub const HID_USAGE_DIGITIZER_UNTOUCH = @as(u16, 52); pub const HID_USAGE_DIGITIZER_TAP = @as(u16, 53); pub const HID_USAGE_DIGITIZER_QUALITY = @as(u16, 54); pub const HID_USAGE_DIGITIZER_DATA_VALID = @as(u16, 55); pub const HID_USAGE_DIGITIZER_TRANSDUCER_INDEX = @as(u16, 56); pub const HID_USAGE_DIGITIZER_BATTERY_STRENGTH = @as(u16, 59); pub const HID_USAGE_DIGITIZER_INVERT = @as(u16, 60); pub const HID_USAGE_DIGITIZER_X_TILT = @as(u16, 61); pub const HID_USAGE_DIGITIZER_Y_TILT = @as(u16, 62); pub const HID_USAGE_DIGITIZER_AZIMUTH = @as(u16, 63); pub const HID_USAGE_DIGITIZER_ALTITUDE = @as(u16, 64); pub const HID_USAGE_DIGITIZER_TWIST = @as(u16, 65); pub const HID_USAGE_DIGITIZER_TIP_SWITCH = @as(u16, 66); pub const HID_USAGE_DIGITIZER_SECONDARY_TIP_SWITCH = @as(u16, 67); pub const HID_USAGE_DIGITIZER_BARREL_SWITCH = @as(u16, 68); pub const HID_USAGE_DIGITIZER_ERASER = @as(u16, 69); pub const HID_USAGE_DIGITIZER_TABLET_PICK = @as(u16, 70); pub const HID_USAGE_DIGITIZER_TRANSDUCER_SERIAL = @as(u16, 91); pub const HID_USAGE_DIGITIZER_HEAT_MAP_PROTOCOL_VENDOR_ID = @as(u16, 106); pub const HID_USAGE_DIGITIZER_HEAT_MAP_PROTOCOL_VERSION = @as(u16, 107); pub const HID_USAGE_DIGITIZER_HEAT_MAP_FRAME_DATA = @as(u16, 108); pub const HID_USAGE_DIGITIZER_TRANSDUCER_VENDOR = @as(u16, 145); pub const HID_USAGE_DIGITIZER_TRANSDUCER_PRODUCT = @as(u16, 146); pub const HID_USAGE_DIGITIZER_TRANSDUCER_CONNECTED = @as(u16, 162); pub const HID_USAGE_HAPTICS_SIMPLE_CONTROLLER = @as(u16, 1); pub const HID_USAGE_HAPTICS_WAVEFORM_LIST = @as(u16, 16); pub const HID_USAGE_HAPTICS_DURATION_LIST = @as(u16, 17); pub const HID_USAGE_HAPTICS_AUTO_TRIGGER = @as(u16, 32); pub const HID_USAGE_HAPTICS_MANUAL_TRIGGER = @as(u16, 33); pub const HID_USAGE_HAPTICS_AUTO_ASSOCIATED_CONTROL = @as(u16, 34); pub const HID_USAGE_HAPTICS_INTENSITY = @as(u16, 35); pub const HID_USAGE_HAPTICS_REPEAT_COUNT = @as(u16, 36); pub const HID_USAGE_HAPTICS_RETRIGGER_PERIOD = @as(u16, 37); pub const HID_USAGE_HAPTICS_WAVEFORM_VENDOR_PAGE = @as(u16, 38); pub const HID_USAGE_HAPTICS_WAVEFORM_VENDOR_ID = @as(u16, 39); pub const HID_USAGE_HAPTICS_WAVEFORM_CUTOFF_TIME = @as(u16, 40); pub const HID_USAGE_HAPTICS_WAVEFORM_BEGIN = @as(u16, 4096); pub const HID_USAGE_HAPTICS_WAVEFORM_STOP = @as(u16, 4097); pub const HID_USAGE_HAPTICS_WAVEFORM_NULL = @as(u16, 4098); pub const HID_USAGE_HAPTICS_WAVEFORM_CLICK = @as(u16, 4099); pub const HID_USAGE_HAPTICS_WAVEFORM_BUZZ = @as(u16, 4100); pub const HID_USAGE_HAPTICS_WAVEFORM_RUMBLE = @as(u16, 4101); pub const HID_USAGE_HAPTICS_WAVEFORM_PRESS = @as(u16, 4102); pub const HID_USAGE_HAPTICS_WAVEFORM_RELEASE = @as(u16, 4103); pub const HID_USAGE_HAPTICS_WAVEFORM_END = @as(u16, 8191); pub const HID_USAGE_HAPTICS_WAVEFORM_VENDOR_BEGIN = @as(u16, 8192); pub const HID_USAGE_HAPTICS_WAVEFORM_VENDOR_END = @as(u16, 12287); pub const HID_USAGE_ALPHANUMERIC_ALPHANUMERIC_DISPLAY = @as(u16, 1); pub const HID_USAGE_ALPHANUMERIC_BITMAPPED_DISPLAY = @as(u16, 2); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_ATTRIBUTES_REPORT = @as(u16, 32); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_CONTROL_REPORT = @as(u16, 36); pub const HID_USAGE_ALPHANUMERIC_CHARACTER_REPORT = @as(u16, 43); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_STATUS = @as(u16, 45); pub const HID_USAGE_ALPHANUMERIC_CURSOR_POSITION_REPORT = @as(u16, 50); pub const HID_USAGE_ALPHANUMERIC_FONT_REPORT = @as(u16, 59); pub const HID_USAGE_ALPHANUMERIC_FONT_DATA = @as(u16, 60); pub const HID_USAGE_ALPHANUMERIC_CHARACTER_ATTRIBUTE = @as(u16, 72); pub const HID_USAGE_ALPHANUMERIC_PALETTE_REPORT = @as(u16, 133); pub const HID_USAGE_ALPHANUMERIC_PALETTE_DATA = @as(u16, 136); pub const HID_USAGE_ALPHANUMERIC_BLIT_REPORT = @as(u16, 138); pub const HID_USAGE_ALPHANUMERIC_BLIT_DATA = @as(u16, 143); pub const HID_USAGE_ALPHANUMERIC_SOFT_BUTTON = @as(u16, 144); pub const HID_USAGE_ALPHANUMERIC_ASCII_CHARACTER_SET = @as(u16, 33); pub const HID_USAGE_ALPHANUMERIC_DATA_READ_BACK = @as(u16, 34); pub const HID_USAGE_ALPHANUMERIC_FONT_READ_BACK = @as(u16, 35); pub const HID_USAGE_ALPHANUMERIC_CLEAR_DISPLAY = @as(u16, 37); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_ENABLE = @as(u16, 38); pub const HID_USAGE_ALPHANUMERIC_SCREEN_SAVER_DELAY = @as(u16, 39); pub const HID_USAGE_ALPHANUMERIC_SCREEN_SAVER_ENABLE = @as(u16, 40); pub const HID_USAGE_ALPHANUMERIC_VERTICAL_SCROLL = @as(u16, 41); pub const HID_USAGE_ALPHANUMERIC_HORIZONTAL_SCROLL = @as(u16, 42); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_DATA = @as(u16, 44); pub const HID_USAGE_ALPHANUMERIC_STATUS_NOT_READY = @as(u16, 46); pub const HID_USAGE_ALPHANUMERIC_STATUS_READY = @as(u16, 47); pub const HID_USAGE_ALPHANUMERIC_ERR_NOT_A_LOADABLE_CHARACTER = @as(u16, 48); pub const HID_USAGE_ALPHANUMERIC_ERR_FONT_DATA_CANNOT_BE_READ = @as(u16, 49); pub const HID_USAGE_ALPHANUMERIC_ROW = @as(u16, 51); pub const HID_USAGE_ALPHANUMERIC_COLUMN = @as(u16, 52); pub const HID_USAGE_ALPHANUMERIC_ROWS = @as(u16, 53); pub const HID_USAGE_ALPHANUMERIC_COLUMNS = @as(u16, 54); pub const HID_USAGE_ALPHANUMERIC_CURSOR_PIXEL_POSITIONING = @as(u16, 55); pub const HID_USAGE_ALPHANUMERIC_CURSOR_MODE = @as(u16, 56); pub const HID_USAGE_ALPHANUMERIC_CURSOR_ENABLE = @as(u16, 57); pub const HID_USAGE_ALPHANUMERIC_CURSOR_BLINK = @as(u16, 58); pub const HID_USAGE_ALPHANUMERIC_CHAR_WIDTH = @as(u16, 61); pub const HID_USAGE_ALPHANUMERIC_CHAR_HEIGHT = @as(u16, 62); pub const HID_USAGE_ALPHANUMERIC_CHAR_SPACING_HORIZONTAL = @as(u16, 63); pub const HID_USAGE_ALPHANUMERIC_CHAR_SPACING_VERTICAL = @as(u16, 64); pub const HID_USAGE_ALPHANUMERIC_UNICODE_CHAR_SET = @as(u16, 65); pub const HID_USAGE_ALPHANUMERIC_FONT_7_SEGMENT = @as(u16, 66); pub const HID_USAGE_ALPHANUMERIC_7_SEGMENT_DIRECT_MAP = @as(u16, 67); pub const HID_USAGE_ALPHANUMERIC_FONT_14_SEGMENT = @as(u16, 68); pub const HID_USAGE_ALPHANUMERIC_14_SEGMENT_DIRECT_MAP = @as(u16, 69); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_BRIGHTNESS = @as(u16, 70); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_CONTRAST = @as(u16, 71); pub const HID_USAGE_ALPHANUMERIC_ATTRIBUTE_READBACK = @as(u16, 73); pub const HID_USAGE_ALPHANUMERIC_ATTRIBUTE_DATA = @as(u16, 74); pub const HID_USAGE_ALPHANUMERIC_CHAR_ATTR_ENHANCE = @as(u16, 75); pub const HID_USAGE_ALPHANUMERIC_CHAR_ATTR_UNDERLINE = @as(u16, 76); pub const HID_USAGE_ALPHANUMERIC_CHAR_ATTR_BLINK = @as(u16, 77); pub const HID_USAGE_ALPHANUMERIC_BITMAP_SIZE_X = @as(u16, 128); pub const HID_USAGE_ALPHANUMERIC_BITMAP_SIZE_Y = @as(u16, 129); pub const HID_USAGE_ALPHANUMERIC_BIT_DEPTH_FORMAT = @as(u16, 131); pub const HID_USAGE_ALPHANUMERIC_DISPLAY_ORIENTATION = @as(u16, 132); pub const HID_USAGE_ALPHANUMERIC_PALETTE_DATA_SIZE = @as(u16, 134); pub const HID_USAGE_ALPHANUMERIC_PALETTE_DATA_OFFSET = @as(u16, 135); pub const HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_X1 = @as(u16, 139); pub const HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_Y1 = @as(u16, 140); pub const HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_X2 = @as(u16, 141); pub const HID_USAGE_ALPHANUMERIC_BLIT_RECTANGLE_Y2 = @as(u16, 142); pub const HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_ID = @as(u16, 145); pub const HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_SIDE = @as(u16, 146); pub const HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_OFFSET1 = @as(u16, 147); pub const HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_OFFSET2 = @as(u16, 148); pub const HID_USAGE_ALPHANUMERIC_SOFT_BUTTON_REPORT = @as(u16, 149); pub const HID_USAGE_LAMPARRAY = @as(u16, 1); pub const HID_USAGE_LAMPARRAY_ATTRBIUTES_REPORT = @as(u16, 2); pub const HID_USAGE_LAMPARRAY_LAMP_COUNT = @as(u16, 3); pub const HID_USAGE_LAMPARRAY_BOUNDING_BOX_WIDTH_IN_MICROMETERS = @as(u16, 4); pub const HID_USAGE_LAMPARRAY_BOUNDING_BOX_HEIGHT_IN_MICROMETERS = @as(u16, 5); pub const HID_USAGE_LAMPARRAY_BOUNDING_BOX_DEPTH_IN_MICROMETERS = @as(u16, 6); pub const HID_USAGE_LAMPARRAY_KIND = @as(u16, 7); pub const HID_USAGE_LAMPARRAY_MIN_UPDATE_INTERVAL_IN_MICROSECONDS = @as(u16, 8); pub const HID_USAGE_LAMPARRAY_LAMP_ATTRIBUTES_REQUEST_REPORT = @as(u16, 32); pub const HID_USAGE_LAMPARRAY_LAMP_ID = @as(u16, 33); pub const HID_USAGE_LAMPARRAY_LAMP_ATTRIBUTES_RESPONSE_REPORT = @as(u16, 34); pub const HID_USAGE_LAMPARRAY_POSITION_X_IN_MICROMETERS = @as(u16, 35); pub const HID_USAGE_LAMPARRAY_POSITION_Y_IN_MICROMETERS = @as(u16, 36); pub const HID_USAGE_LAMPARRAY_POSITION_Z_IN_MICROMETERS = @as(u16, 37); pub const HID_USAGE_LAMPARRAY_LAMP_PURPOSES = @as(u16, 38); pub const HID_USAGE_LAMPARRAY_UPDATE_LATENCY_IN_MICROSECONDS = @as(u16, 39); pub const HID_USAGE_LAMPARRAY_RED_LEVEL_COUNT = @as(u16, 40); pub const HID_USAGE_LAMPARRAY_GREEN_LEVEL_COUNT = @as(u16, 41); pub const HID_USAGE_LAMPARRAY_BLUE_LEVEL_COUNT = @as(u16, 42); pub const HID_USAGE_LAMPARRAY_INTENSITY_LEVEL_COUNT = @as(u16, 43); pub const HID_USAGE_LAMPARRAY_IS_PROGRAMMABLE = @as(u16, 44); pub const HID_USAGE_LAMPARRAY_INPUT_BINDING = @as(u16, 45); pub const HID_USAGE_LAMPARRAY_LAMP_MULTI_UPDATE_REPORT = @as(u16, 80); pub const HID_USAGE_LAMPARRAY_LAMP_RED_UPDATE_CHANNEL = @as(u16, 81); pub const HID_USAGE_LAMPARRAY_LAMP_GREEN_UPDATE_CHANNEL = @as(u16, 82); pub const HID_USAGE_LAMPARRAY_LAMP_BLUE_UPDATE_CHANNEL = @as(u16, 83); pub const HID_USAGE_LAMPARRAY_LAMP_INTENSITY_UPDATE_CHANNEL = @as(u16, 84); pub const HID_USAGE_LAMPARRAY_LAMP_UPDATE_FLAGS = @as(u16, 85); pub const HID_USAGE_LAMPARRAY_LAMP_RANGE_UPDATE_REPORT = @as(u16, 96); pub const HID_USAGE_LAMPARRAY_LAMP_ID_START = @as(u16, 97); pub const HID_USAGE_LAMPARRAY_LAMP_ID_END = @as(u16, 98); pub const HID_USAGE_LAMPARRAY_CONTROL_REPORT = @as(u16, 112); pub const HID_USAGE_LAMPARRAY_AUTONOMOUS_MODE = @as(u16, 113); pub const HID_USAGE_CAMERA_AUTO_FOCUS = @as(u16, 32); pub const HID_USAGE_CAMERA_SHUTTER = @as(u16, 33); pub const HID_USAGE_MS_BTH_HF_DIALNUMBER = @as(u16, 33); pub const HID_USAGE_MS_BTH_HF_DIALMEMORY = @as(u16, 34); pub const IOCTL_KEYBOARD_QUERY_ATTRIBUTES = @as(u32, 720896); pub const IOCTL_KEYBOARD_SET_TYPEMATIC = @as(u32, 720900); pub const IOCTL_KEYBOARD_SET_INDICATORS = @as(u32, 720904); pub const IOCTL_KEYBOARD_QUERY_TYPEMATIC = @as(u32, 720928); pub const IOCTL_KEYBOARD_QUERY_INDICATORS = @as(u32, 720960); pub const IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION = @as(u32, 721024); pub const IOCTL_KEYBOARD_INSERT_DATA = @as(u32, 721152); pub const IOCTL_KEYBOARD_QUERY_EXTENDED_ATTRIBUTES = @as(u32, 721408); pub const IOCTL_KEYBOARD_QUERY_IME_STATUS = @as(u32, 724992); pub const IOCTL_KEYBOARD_SET_IME_STATUS = @as(u32, 724996); pub const GUID_DEVINTERFACE_KEYBOARD = Guid.initString("<KEY>"); pub const KEYBOARD_OVERRUN_MAKE_CODE = @as(u32, 255); pub const KEY_MAKE = @as(u32, 0); pub const KEY_BREAK = @as(u32, 1); pub const KEY_E0 = @as(u32, 2); pub const KEY_E1 = @as(u32, 4); pub const KEY_TERMSRV_SET_LED = @as(u32, 8); pub const KEY_TERMSRV_SHADOW = @as(u32, 16); pub const KEY_TERMSRV_VKPACKET = @as(u32, 32); pub const KEY_RIM_VKEY = @as(u32, 64); pub const KEY_FROM_KEYBOARD_OVERRIDER = @as(u32, 128); pub const KEY_UNICODE_SEQUENCE_ITEM = @as(u32, 256); pub const KEY_UNICODE_SEQUENCE_END = @as(u32, 512); pub const KEYBOARD_EXTENDED_ATTRIBUTES_STRUCT_VERSION_1 = @as(u32, 1); pub const KEYBOARD_LED_INJECTED = @as(u32, 32768); pub const KEYBOARD_SHADOW = @as(u32, 16384); pub const KEYBOARD_KANA_LOCK_ON = @as(u32, 8); pub const KEYBOARD_CAPS_LOCK_ON = @as(u32, 4); pub const KEYBOARD_NUM_LOCK_ON = @as(u32, 2); pub const KEYBOARD_SCROLL_LOCK_ON = @as(u32, 1); pub const KEYBOARD_ERROR_VALUE_BASE = @as(u32, 10000); pub const IOCTL_MOUSE_QUERY_ATTRIBUTES = @as(u32, 983040); pub const IOCTL_MOUSE_INSERT_DATA = @as(u32, 983044); pub const GUID_DEVINTERFACE_MOUSE = Guid.initString("378de44c-56ef-11d1-bc8c-00a0c91405dd"); pub const MOUSE_LEFT_BUTTON_DOWN = @as(u32, 1); pub const MOUSE_LEFT_BUTTON_UP = @as(u32, 2); pub const MOUSE_RIGHT_BUTTON_DOWN = @as(u32, 4); pub const MOUSE_RIGHT_BUTTON_UP = @as(u32, 8); pub const MOUSE_MIDDLE_BUTTON_DOWN = @as(u32, 16); pub const MOUSE_MIDDLE_BUTTON_UP = @as(u32, 32); pub const MOUSE_BUTTON_1_DOWN = @as(u32, 1); pub const MOUSE_BUTTON_1_UP = @as(u32, 2); pub const MOUSE_BUTTON_2_DOWN = @as(u32, 4); pub const MOUSE_BUTTON_2_UP = @as(u32, 8); pub const MOUSE_BUTTON_3_DOWN = @as(u32, 16); pub const MOUSE_BUTTON_3_UP = @as(u32, 32); pub const MOUSE_BUTTON_4_DOWN = @as(u32, 64); pub const MOUSE_BUTTON_4_UP = @as(u32, 128); pub const MOUSE_BUTTON_5_DOWN = @as(u32, 256); pub const MOUSE_BUTTON_5_UP = @as(u32, 512); pub const MOUSE_WHEEL = @as(u32, 1024); pub const MOUSE_HWHEEL = @as(u32, 2048); pub const MOUSE_MOVE_RELATIVE = @as(u32, 0); pub const MOUSE_MOVE_ABSOLUTE = @as(u32, 1); pub const MOUSE_VIRTUAL_DESKTOP = @as(u32, 2); pub const MOUSE_ATTRIBUTES_CHANGED = @as(u32, 4); pub const MOUSE_MOVE_NOCOALESCE = @as(u32, 8); pub const MOUSE_TERMSRV_SRC_SHADOW = @as(u32, 256); pub const MOUSE_INPORT_HARDWARE = @as(u32, 1); pub const MOUSE_I8042_HARDWARE = @as(u32, 2); pub const MOUSE_SERIAL_HARDWARE = @as(u32, 4); pub const BALLPOINT_I8042_HARDWARE = @as(u32, 8); pub const BALLPOINT_SERIAL_HARDWARE = @as(u32, 16); pub const WHEELMOUSE_I8042_HARDWARE = @as(u32, 32); pub const WHEELMOUSE_SERIAL_HARDWARE = @as(u32, 64); pub const MOUSE_HID_HARDWARE = @as(u32, 128); pub const WHEELMOUSE_HID_HARDWARE = @as(u32, 256); pub const HORIZONTAL_WHEEL_PRESENT = @as(u32, 32768); pub const MOUSE_ERROR_VALUE_BASE = @as(u32, 20000); pub const DIRECTINPUT_HEADER_VERSION = @as(u32, 2048); pub const CLSID_DirectInput = Guid.initString("25e609e0-b259-11cf-bfc7-444553540000"); pub const CLSID_DirectInputDevice = Guid.initString("25e609e1-b259-11cf-bfc7-444553540000"); pub const CLSID_DirectInput8 = Guid.initString("25e609e4-b259-11cf-bfc7-444553540000"); pub const CLSID_DirectInputDevice8 = Guid.initString("25e609e5-b259-11cf-bfc7-444553540000"); pub const GUID_XAxis = Guid.initString("a36d02e0-c9f3-11cf-bfc7-444553540000"); pub const GUID_YAxis = Guid.initString("a36d02e1-c9f3-11cf-bfc7-444553540000"); pub const GUID_ZAxis = Guid.initString("a36d02e2-c9f3-11cf-bfc7-444553540000"); pub const GUID_RxAxis = Guid.initString("a36d02f4-c9f3-11cf-bfc7-444553540000"); pub const GUID_RyAxis = Guid.initString("a36d02f5-c9f3-11cf-bfc7-444553540000"); pub const GUID_RzAxis = Guid.initString("a36d02e3-c9f3-11cf-bfc7-444553540000"); pub const GUID_Slider = Guid.initString("a36d02e4-c9f3-11cf-bfc7-444553540000"); pub const GUID_Button = Guid.initString("a36d02f0-c9f3-11cf-bfc7-444553540000"); pub const GUID_Key = Guid.initString("<KEY>"); pub const GUID_POV = Guid.initString("a36d02f2-c9f3-11cf-bfc7-444553540000"); pub const GUID_Unknown = Guid.initString("a36d02f3-c9f3-11cf-bfc7-444553540000"); pub const GUID_SysMouse = Guid.initString("6f1d2b60-d5a0-11cf-bfc7-444553540000"); pub const GUID_SysKeyboard = Guid.initString("6f1d2b61-d5a0-11cf-bfc7-444553540000"); pub const GUID_Joystick = Guid.initString("6f1d2b70-d5a0-11cf-bfc7-444553540000"); pub const GUID_SysMouseEm = Guid.initString("6f1d2b80-d5a0-11cf-bfc7-444553540000"); pub const GUID_SysMouseEm2 = Guid.initString("6f1d2b81-d5a0-11cf-bfc7-444553540000"); pub const GUID_SysKeyboardEm = Guid.initString("6f1d2b82-d5a0-11cf-bfc7-444553540000"); pub const GUID_SysKeyboardEm2 = Guid.initString("6f1d2b83-d5a0-11cf-bfc7-444553540000"); pub const GUID_ConstantForce = Guid.initString("13541c20-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_RampForce = Guid.initString("13541c21-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_Square = Guid.initString("13541c22-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_Sine = Guid.initString("13541c23-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_Triangle = Guid.initString("13541c24-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_SawtoothUp = Guid.initString("13541c25-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_SawtoothDown = Guid.initString("13541c26-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_Spring = Guid.initString("13541c27-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_Damper = Guid.initString("13541c28-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_Inertia = Guid.initString("13541c29-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_Friction = Guid.initString("13541c2a-8e33-11d0-9ad0-00a0c9a06e35"); pub const GUID_CustomForce = Guid.initString("13541c2b-8e33-11d0-9ad0-00a0c9a06e35"); pub const DIEFT_ALL = @as(u32, 0); pub const DIEFT_CONSTANTFORCE = @as(u32, 1); pub const DIEFT_RAMPFORCE = @as(u32, 2); pub const DIEFT_PERIODIC = @as(u32, 3); pub const DIEFT_CONDITION = @as(u32, 4); pub const DIEFT_CUSTOMFORCE = @as(u32, 5); pub const DIEFT_HARDWARE = @as(u32, 255); pub const DIEFT_FFATTACK = @as(u32, 512); pub const DIEFT_FFFADE = @as(u32, 1024); pub const DIEFT_SATURATION = @as(u32, 2048); pub const DIEFT_POSNEGCOEFFICIENTS = @as(u32, 4096); pub const DIEFT_POSNEGSATURATION = @as(u32, 8192); pub const DIEFT_DEADBAND = @as(u32, 16384); pub const DIEFT_STARTDELAY = @as(u32, 32768); pub const DI_DEGREES = @as(u32, 100); pub const DI_FFNOMINALMAX = @as(u32, 10000); pub const DI_SECONDS = @as(u32, 1000000); pub const DIEFF_OBJECTIDS = @as(u32, 1); pub const DIEFF_OBJECTOFFSETS = @as(u32, 2); pub const DIEFF_CARTESIAN = @as(u32, 16); pub const DIEFF_POLAR = @as(u32, 32); pub const DIEFF_SPHERICAL = @as(u32, 64); pub const DIEP_DURATION = @as(u32, 1); pub const DIEP_SAMPLEPERIOD = @as(u32, 2); pub const DIEP_GAIN = @as(u32, 4); pub const DIEP_TRIGGERBUTTON = @as(u32, 8); pub const DIEP_TRIGGERREPEATINTERVAL = @as(u32, 16); pub const DIEP_AXES = @as(u32, 32); pub const DIEP_DIRECTION = @as(u32, 64); pub const DIEP_ENVELOPE = @as(u32, 128); pub const DIEP_TYPESPECIFICPARAMS = @as(u32, 256); pub const DIEP_STARTDELAY = @as(u32, 512); pub const DIEP_ALLPARAMS_DX5 = @as(u32, 511); pub const DIEP_ALLPARAMS = @as(u32, 1023); pub const DIEP_START = @as(u32, 536870912); pub const DIEP_NORESTART = @as(u32, 1073741824); pub const DIEP_NODOWNLOAD = @as(u32, 2147483648); pub const DIEB_NOTRIGGER = @as(u32, 4294967295); pub const DIES_SOLO = @as(u32, 1); pub const DIES_NODOWNLOAD = @as(u32, 2147483648); pub const DIEGES_PLAYING = @as(u32, 1); pub const DIEGES_EMULATED = @as(u32, 2); pub const DIDEVTYPE_DEVICE = @as(u32, 1); pub const DIDEVTYPE_MOUSE = @as(u32, 2); pub const DIDEVTYPE_KEYBOARD = @as(u32, 3); pub const DIDEVTYPE_JOYSTICK = @as(u32, 4); pub const DI8DEVCLASS_ALL = @as(u32, 0); pub const DI8DEVCLASS_DEVICE = @as(u32, 1); pub const DI8DEVCLASS_POINTER = @as(u32, 2); pub const DI8DEVCLASS_KEYBOARD = @as(u32, 3); pub const DI8DEVCLASS_GAMECTRL = @as(u32, 4); pub const DI8DEVTYPE_DEVICE = @as(u32, 17); pub const DI8DEVTYPE_MOUSE = @as(u32, 18); pub const DI8DEVTYPE_KEYBOARD = @as(u32, 19); pub const DI8DEVTYPE_JOYSTICK = @as(u32, 20); pub const DI8DEVTYPE_GAMEPAD = @as(u32, 21); pub const DI8DEVTYPE_DRIVING = @as(u32, 22); pub const DI8DEVTYPE_FLIGHT = @as(u32, 23); pub const DI8DEVTYPE_1STPERSON = @as(u32, 24); pub const DI8DEVTYPE_DEVICECTRL = @as(u32, 25); pub const DI8DEVTYPE_SCREENPOINTER = @as(u32, 26); pub const DI8DEVTYPE_REMOTE = @as(u32, 27); pub const DI8DEVTYPE_SUPPLEMENTAL = @as(u32, 28); pub const DIDEVTYPE_HID = @as(u32, 65536); pub const DIDEVTYPEMOUSE_UNKNOWN = @as(u32, 1); pub const DIDEVTYPEMOUSE_TRADITIONAL = @as(u32, 2); pub const DIDEVTYPEMOUSE_FINGERSTICK = @as(u32, 3); pub const DIDEVTYPEMOUSE_TOUCHPAD = @as(u32, 4); pub const DIDEVTYPEMOUSE_TRACKBALL = @as(u32, 5); pub const DIDEVTYPEKEYBOARD_UNKNOWN = @as(u32, 0); pub const DIDEVTYPEKEYBOARD_PCXT = @as(u32, 1); pub const DIDEVTYPEKEYBOARD_OLIVETTI = @as(u32, 2); pub const DIDEVTYPEKEYBOARD_PCAT = @as(u32, 3); pub const DIDEVTYPEKEYBOARD_PCENH = @as(u32, 4); pub const DIDEVTYPEKEYBOARD_NOKIA1050 = @as(u32, 5); pub const DIDEVTYPEKEYBOARD_NOKIA9140 = @as(u32, 6); pub const DIDEVTYPEKEYBOARD_NEC98 = @as(u32, 7); pub const DIDEVTYPEKEYBOARD_NEC98LAPTOP = @as(u32, 8); pub const DIDEVTYPEKEYBOARD_NEC98106 = @as(u32, 9); pub const DIDEVTYPEKEYBOARD_JAPAN106 = @as(u32, 10); pub const DIDEVTYPEKEYBOARD_JAPANAX = @as(u32, 11); pub const DIDEVTYPEKEYBOARD_J3100 = @as(u32, 12); pub const DIDEVTYPEJOYSTICK_UNKNOWN = @as(u32, 1); pub const DIDEVTYPEJOYSTICK_TRADITIONAL = @as(u32, 2); pub const DIDEVTYPEJOYSTICK_FLIGHTSTICK = @as(u32, 3); pub const DIDEVTYPEJOYSTICK_GAMEPAD = @as(u32, 4); pub const DIDEVTYPEJOYSTICK_RUDDER = @as(u32, 5); pub const DIDEVTYPEJOYSTICK_WHEEL = @as(u32, 6); pub const DIDEVTYPEJOYSTICK_HEADTRACKER = @as(u32, 7); pub const DI8DEVTYPEMOUSE_UNKNOWN = @as(u32, 1); pub const DI8DEVTYPEMOUSE_TRADITIONAL = @as(u32, 2); pub const DI8DEVTYPEMOUSE_FINGERSTICK = @as(u32, 3); pub const DI8DEVTYPEMOUSE_TOUCHPAD = @as(u32, 4); pub const DI8DEVTYPEMOUSE_TRACKBALL = @as(u32, 5); pub const DI8DEVTYPEMOUSE_ABSOLUTE = @as(u32, 6); pub const DI8DEVTYPEKEYBOARD_UNKNOWN = @as(u32, 0); pub const DI8DEVTYPEKEYBOARD_PCXT = @as(u32, 1); pub const DI8DEVTYPEKEYBOARD_OLIVETTI = @as(u32, 2); pub const DI8DEVTYPEKEYBOARD_PCAT = @as(u32, 3); pub const DI8DEVTYPEKEYBOARD_PCENH = @as(u32, 4); pub const DI8DEVTYPEKEYBOARD_NOKIA1050 = @as(u32, 5); pub const DI8DEVTYPEKEYBOARD_NOKIA9140 = @as(u32, 6); pub const DI8DEVTYPEKEYBOARD_NEC98 = @as(u32, 7); pub const DI8DEVTYPEKEYBOARD_NEC98LAPTOP = @as(u32, 8); pub const DI8DEVTYPEKEYBOARD_NEC98106 = @as(u32, 9); pub const DI8DEVTYPEKEYBOARD_JAPAN106 = @as(u32, 10); pub const DI8DEVTYPEKEYBOARD_JAPANAX = @as(u32, 11); pub const DI8DEVTYPEKEYBOARD_J3100 = @as(u32, 12); pub const DI8DEVTYPE_LIMITEDGAMESUBTYPE = @as(u32, 1); pub const DI8DEVTYPEJOYSTICK_LIMITED = @as(u32, 1); pub const DI8DEVTYPEJOYSTICK_STANDARD = @as(u32, 2); pub const DI8DEVTYPEGAMEPAD_LIMITED = @as(u32, 1); pub const DI8DEVTYPEGAMEPAD_STANDARD = @as(u32, 2); pub const DI8DEVTYPEGAMEPAD_TILT = @as(u32, 3); pub const DI8DEVTYPEDRIVING_LIMITED = @as(u32, 1); pub const DI8DEVTYPEDRIVING_COMBINEDPEDALS = @as(u32, 2); pub const DI8DEVTYPEDRIVING_DUALPEDALS = @as(u32, 3); pub const DI8DEVTYPEDRIVING_THREEPEDALS = @as(u32, 4); pub const DI8DEVTYPEDRIVING_HANDHELD = @as(u32, 5); pub const DI8DEVTYPEFLIGHT_LIMITED = @as(u32, 1); pub const DI8DEVTYPEFLIGHT_STICK = @as(u32, 2); pub const DI8DEVTYPEFLIGHT_YOKE = @as(u32, 3); pub const DI8DEVTYPEFLIGHT_RC = @as(u32, 4); pub const DI8DEVTYPE1STPERSON_LIMITED = @as(u32, 1); pub const DI8DEVTYPE1STPERSON_UNKNOWN = @as(u32, 2); pub const DI8DEVTYPE1STPERSON_SIXDOF = @as(u32, 3); pub const DI8DEVTYPE1STPERSON_SHOOTER = @as(u32, 4); pub const DI8DEVTYPESCREENPTR_UNKNOWN = @as(u32, 2); pub const DI8DEVTYPESCREENPTR_LIGHTGUN = @as(u32, 3); pub const DI8DEVTYPESCREENPTR_LIGHTPEN = @as(u32, 4); pub const DI8DEVTYPESCREENPTR_TOUCH = @as(u32, 5); pub const DI8DEVTYPEREMOTE_UNKNOWN = @as(u32, 2); pub const DI8DEVTYPEDEVICECTRL_UNKNOWN = @as(u32, 2); pub const DI8DEVTYPEDEVICECTRL_COMMSSELECTION = @as(u32, 3); pub const DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED = @as(u32, 4); pub const DI8DEVTYPESUPPLEMENTAL_UNKNOWN = @as(u32, 2); pub const DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER = @as(u32, 3); pub const DI8DEVTYPESUPPLEMENTAL_HEADTRACKER = @as(u32, 4); pub const DI8DEVTYPESUPPLEMENTAL_HANDTRACKER = @as(u32, 5); pub const DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE = @as(u32, 6); pub const DI8DEVTYPESUPPLEMENTAL_SHIFTER = @as(u32, 7); pub const DI8DEVTYPESUPPLEMENTAL_THROTTLE = @as(u32, 8); pub const DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE = @as(u32, 9); pub const DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS = @as(u32, 10); pub const DI8DEVTYPESUPPLEMENTAL_DUALPEDALS = @as(u32, 11); pub const DI8DEVTYPESUPPLEMENTAL_THREEPEDALS = @as(u32, 12); pub const DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS = @as(u32, 13); pub const DIDC_ATTACHED = @as(u32, 1); pub const DIDC_POLLEDDEVICE = @as(u32, 2); pub const DIDC_EMULATED = @as(u32, 4); pub const DIDC_POLLEDDATAFORMAT = @as(u32, 8); pub const DIDC_FORCEFEEDBACK = @as(u32, 256); pub const DIDC_FFATTACK = @as(u32, 512); pub const DIDC_FFFADE = @as(u32, 1024); pub const DIDC_SATURATION = @as(u32, 2048); pub const DIDC_POSNEGCOEFFICIENTS = @as(u32, 4096); pub const DIDC_POSNEGSATURATION = @as(u32, 8192); pub const DIDC_DEADBAND = @as(u32, 16384); pub const DIDC_STARTDELAY = @as(u32, 32768); pub const DIDC_ALIAS = @as(u32, 65536); pub const DIDC_PHANTOM = @as(u32, 131072); pub const DIDC_HIDDEN = @as(u32, 262144); pub const DIDFT_ALL = @as(u32, 0); pub const DIDFT_RELAXIS = @as(u32, 1); pub const DIDFT_ABSAXIS = @as(u32, 2); pub const DIDFT_AXIS = @as(u32, 3); pub const DIDFT_PSHBUTTON = @as(u32, 4); pub const DIDFT_TGLBUTTON = @as(u32, 8); pub const DIDFT_BUTTON = @as(u32, 12); pub const DIDFT_POV = @as(u32, 16); pub const DIDFT_COLLECTION = @as(u32, 64); pub const DIDFT_NODATA = @as(u32, 128); pub const DIDFT_ANYINSTANCE = @as(u32, 16776960); pub const DIDFT_INSTANCEMASK = @as(u32, 16776960); pub const DIDFT_FFACTUATOR = @as(u32, 16777216); pub const DIDFT_FFEFFECTTRIGGER = @as(u32, 33554432); pub const DIDFT_OUTPUT = @as(u32, 268435456); pub const DIDFT_VENDORDEFINED = @as(u32, 67108864); pub const DIDFT_ALIAS = @as(u32, 134217728); pub const DIDFT_NOCOLLECTION = @as(u32, 16776960); pub const DIDF_ABSAXIS = @as(u32, 1); pub const DIDF_RELAXIS = @as(u32, 2); pub const DIA_FORCEFEEDBACK = @as(u32, 1); pub const DIA_APPMAPPED = @as(u32, 2); pub const DIA_APPNOMAP = @as(u32, 4); pub const DIA_NORANGE = @as(u32, 8); pub const DIA_APPFIXED = @as(u32, 16); pub const DIAH_UNMAPPED = @as(u32, 0); pub const DIAH_USERCONFIG = @as(u32, 1); pub const DIAH_APPREQUESTED = @as(u32, 2); pub const DIAH_HWAPP = @as(u32, 4); pub const DIAH_HWDEFAULT = @as(u32, 8); pub const DIAH_DEFAULT = @as(u32, 32); pub const DIAH_ERROR = @as(u32, 2147483648); pub const DIAFTS_NEWDEVICELOW = @as(u32, 4294967295); pub const DIAFTS_NEWDEVICEHIGH = @as(u32, 4294967295); pub const DIAFTS_UNUSEDDEVICELOW = @as(u32, 0); pub const DIAFTS_UNUSEDDEVICEHIGH = @as(u32, 0); pub const DIDBAM_DEFAULT = @as(u32, 0); pub const DIDBAM_PRESERVE = @as(u32, 1); pub const DIDBAM_INITIALIZE = @as(u32, 2); pub const DIDBAM_HWDEFAULTS = @as(u32, 4); pub const DIDSAM_DEFAULT = @as(u32, 0); pub const DIDSAM_NOUSER = @as(u32, 1); pub const DIDSAM_FORCESAVE = @as(u32, 2); pub const DICD_DEFAULT = @as(u32, 0); pub const DICD_EDIT = @as(u32, 1); pub const DIDIFT_CONFIGURATION = @as(u32, 1); pub const DIDIFT_OVERLAY = @as(u32, 2); pub const DIDAL_CENTERED = @as(u32, 0); pub const DIDAL_LEFTALIGNED = @as(u32, 1); pub const DIDAL_RIGHTALIGNED = @as(u32, 2); pub const DIDAL_MIDDLE = @as(u32, 0); pub const DIDAL_TOPALIGNED = @as(u32, 4); pub const DIDAL_BOTTOMALIGNED = @as(u32, 8); pub const DIDOI_FFACTUATOR = @as(u32, 1); pub const DIDOI_FFEFFECTTRIGGER = @as(u32, 2); pub const DIDOI_POLLED = @as(u32, 32768); pub const DIDOI_ASPECTPOSITION = @as(u32, 256); pub const DIDOI_ASPECTVELOCITY = @as(u32, 512); pub const DIDOI_ASPECTACCEL = @as(u32, 768); pub const DIDOI_ASPECTFORCE = @as(u32, 1024); pub const DIDOI_ASPECTMASK = @as(u32, 3840); pub const DIDOI_GUIDISUSAGE = @as(u32, 65536); pub const DIPH_DEVICE = @as(u32, 0); pub const DIPH_BYOFFSET = @as(u32, 1); pub const DIPH_BYID = @as(u32, 2); pub const DIPH_BYUSAGE = @as(u32, 3); pub const MAXCPOINTSNUM = @as(u32, 8); pub const DIPROPAXISMODE_ABS = @as(u32, 0); pub const DIPROPAXISMODE_REL = @as(u32, 1); pub const DIPROPAUTOCENTER_OFF = @as(u32, 0); pub const DIPROPAUTOCENTER_ON = @as(u32, 1); pub const DIPROPCALIBRATIONMODE_COOKED = @as(u32, 0); pub const DIPROPCALIBRATIONMODE_RAW = @as(u32, 1); pub const DIGDD_PEEK = @as(u32, 1); pub const DISCL_EXCLUSIVE = @as(u32, 1); pub const DISCL_NONEXCLUSIVE = @as(u32, 2); pub const DISCL_FOREGROUND = @as(u32, 4); pub const DISCL_BACKGROUND = @as(u32, 8); pub const DISCL_NOWINKEY = @as(u32, 16); pub const DISFFC_RESET = @as(u32, 1); pub const DISFFC_STOPALL = @as(u32, 2); pub const DISFFC_PAUSE = @as(u32, 4); pub const DISFFC_CONTINUE = @as(u32, 8); pub const DISFFC_SETACTUATORSON = @as(u32, 16); pub const DISFFC_SETACTUATORSOFF = @as(u32, 32); pub const DIGFFS_EMPTY = @as(u32, 1); pub const DIGFFS_STOPPED = @as(u32, 2); pub const DIGFFS_PAUSED = @as(u32, 4); pub const DIGFFS_ACTUATORSON = @as(u32, 16); pub const DIGFFS_ACTUATORSOFF = @as(u32, 32); pub const DIGFFS_POWERON = @as(u32, 64); pub const DIGFFS_POWEROFF = @as(u32, 128); pub const DIGFFS_SAFETYSWITCHON = @as(u32, 256); pub const DIGFFS_SAFETYSWITCHOFF = @as(u32, 512); pub const DIGFFS_USERFFSWITCHON = @as(u32, 1024); pub const DIGFFS_USERFFSWITCHOFF = @as(u32, 2048); pub const DIGFFS_DEVICELOST = @as(u32, 2147483648); pub const DISDD_CONTINUE = @as(u32, 1); pub const DIFEF_DEFAULT = @as(u32, 0); pub const DIFEF_INCLUDENONSTANDARD = @as(u32, 1); pub const DIFEF_MODIFYIFNEEDED = @as(u32, 16); pub const DIK_ESCAPE = @as(u32, 1); pub const DIK_1 = @as(u32, 2); pub const DIK_2 = @as(u32, 3); pub const DIK_3 = @as(u32, 4); pub const DIK_4 = @as(u32, 5); pub const DIK_5 = @as(u32, 6); pub const DIK_6 = @as(u32, 7); pub const DIK_7 = @as(u32, 8); pub const DIK_8 = @as(u32, 9); pub const DIK_9 = @as(u32, 10); pub const DIK_0 = @as(u32, 11); pub const DIK_MINUS = @as(u32, 12); pub const DIK_EQUALS = @as(u32, 13); pub const DIK_BACK = @as(u32, 14); pub const DIK_TAB = @as(u32, 15); pub const DIK_Q = @as(u32, 16); pub const DIK_W = @as(u32, 17); pub const DIK_E = @as(u32, 18); pub const DIK_R = @as(u32, 19); pub const DIK_T = @as(u32, 20); pub const DIK_Y = @as(u32, 21); pub const DIK_U = @as(u32, 22); pub const DIK_I = @as(u32, 23); pub const DIK_O = @as(u32, 24); pub const DIK_P = @as(u32, 25); pub const DIK_LBRACKET = @as(u32, 26); pub const DIK_RBRACKET = @as(u32, 27); pub const DIK_RETURN = @as(u32, 28); pub const DIK_LCONTROL = @as(u32, 29); pub const DIK_A = @as(u32, 30); pub const DIK_S = @as(u32, 31); pub const DIK_D = @as(u32, 32); pub const DIK_F = @as(u32, 33); pub const DIK_G = @as(u32, 34); pub const DIK_H = @as(u32, 35); pub const DIK_J = @as(u32, 36); pub const DIK_K = @as(u32, 37); pub const DIK_L = @as(u32, 38); pub const DIK_SEMICOLON = @as(u32, 39); pub const DIK_APOSTROPHE = @as(u32, 40); pub const DIK_GRAVE = @as(u32, 41); pub const DIK_LSHIFT = @as(u32, 42); pub const DIK_BACKSLASH = @as(u32, 43); pub const DIK_Z = @as(u32, 44); pub const DIK_X = @as(u32, 45); pub const DIK_C = @as(u32, 46); pub const DIK_V = @as(u32, 47); pub const DIK_B = @as(u32, 48); pub const DIK_N = @as(u32, 49); pub const DIK_M = @as(u32, 50); pub const DIK_COMMA = @as(u32, 51); pub const DIK_PERIOD = @as(u32, 52); pub const DIK_SLASH = @as(u32, 53); pub const DIK_RSHIFT = @as(u32, 54); pub const DIK_MULTIPLY = @as(u32, 55); pub const DIK_LMENU = @as(u32, 56); pub const DIK_SPACE = @as(u32, 57); pub const DIK_CAPITAL = @as(u32, 58); pub const DIK_F1 = @as(u32, 59); pub const DIK_F2 = @as(u32, 60); pub const DIK_F3 = @as(u32, 61); pub const DIK_F4 = @as(u32, 62); pub const DIK_F5 = @as(u32, 63); pub const DIK_F6 = @as(u32, 64); pub const DIK_F7 = @as(u32, 65); pub const DIK_F8 = @as(u32, 66); pub const DIK_F9 = @as(u32, 67); pub const DIK_F10 = @as(u32, 68); pub const DIK_NUMLOCK = @as(u32, 69); pub const DIK_SCROLL = @as(u32, 70); pub const DIK_NUMPAD7 = @as(u32, 71); pub const DIK_NUMPAD8 = @as(u32, 72); pub const DIK_NUMPAD9 = @as(u32, 73); pub const DIK_SUBTRACT = @as(u32, 74); pub const DIK_NUMPAD4 = @as(u32, 75); pub const DIK_NUMPAD5 = @as(u32, 76); pub const DIK_NUMPAD6 = @as(u32, 77); pub const DIK_ADD = @as(u32, 78); pub const DIK_NUMPAD1 = @as(u32, 79); pub const DIK_NUMPAD2 = @as(u32, 80); pub const DIK_NUMPAD3 = @as(u32, 81); pub const DIK_NUMPAD0 = @as(u32, 82); pub const DIK_DECIMAL = @as(u32, 83); pub const DIK_OEM_102 = @as(u32, 86); pub const DIK_F11 = @as(u32, 87); pub const DIK_F12 = @as(u32, 88); pub const DIK_F13 = @as(u32, 100); pub const DIK_F14 = @as(u32, 101); pub const DIK_F15 = @as(u32, 102); pub const DIK_KANA = @as(u32, 112); pub const DIK_ABNT_C1 = @as(u32, 115); pub const DIK_CONVERT = @as(u32, 121); pub const DIK_NOCONVERT = @as(u32, 123); pub const DIK_YEN = @as(u32, 125); pub const DIK_ABNT_C2 = @as(u32, 126); pub const DIK_NUMPADEQUALS = @as(u32, 141); pub const DIK_PREVTRACK = @as(u32, 144); pub const DIK_AT = @as(u32, 145); pub const DIK_COLON = @as(u32, 146); pub const DIK_UNDERLINE = @as(u32, 147); pub const DIK_KANJI = @as(u32, 148); pub const DIK_STOP = @as(u32, 149); pub const DIK_AX = @as(u32, 150); pub const DIK_UNLABELED = @as(u32, 151); pub const DIK_NEXTTRACK = @as(u32, 153); pub const DIK_NUMPADENTER = @as(u32, 156); pub const DIK_RCONTROL = @as(u32, 157); pub const DIK_MUTE = @as(u32, 160); pub const DIK_CALCULATOR = @as(u32, 161); pub const DIK_PLAYPAUSE = @as(u32, 162); pub const DIK_MEDIASTOP = @as(u32, 164); pub const DIK_VOLUMEDOWN = @as(u32, 174); pub const DIK_VOLUMEUP = @as(u32, 176); pub const DIK_WEBHOME = @as(u32, 178); pub const DIK_NUMPADCOMMA = @as(u32, 179); pub const DIK_DIVIDE = @as(u32, 181); pub const DIK_SYSRQ = @as(u32, 183); pub const DIK_RMENU = @as(u32, 184); pub const DIK_PAUSE = @as(u32, 197); pub const DIK_HOME = @as(u32, 199); pub const DIK_UP = @as(u32, 200); pub const DIK_PRIOR = @as(u32, 201); pub const DIK_LEFT = @as(u32, 203); pub const DIK_RIGHT = @as(u32, 205); pub const DIK_END = @as(u32, 207); pub const DIK_DOWN = @as(u32, 208); pub const DIK_NEXT = @as(u32, 209); pub const DIK_INSERT = @as(u32, 210); pub const DIK_DELETE = @as(u32, 211); pub const DIK_LWIN = @as(u32, 219); pub const DIK_RWIN = @as(u32, 220); pub const DIK_APPS = @as(u32, 221); pub const DIK_POWER = @as(u32, 222); pub const DIK_SLEEP = @as(u32, 223); pub const DIK_WAKE = @as(u32, 227); pub const DIK_WEBSEARCH = @as(u32, 229); pub const DIK_WEBFAVORITES = @as(u32, 230); pub const DIK_WEBREFRESH = @as(u32, 231); pub const DIK_WEBSTOP = @as(u32, 232); pub const DIK_WEBFORWARD = @as(u32, 233); pub const DIK_WEBBACK = @as(u32, 234); pub const DIK_MYCOMPUTER = @as(u32, 235); pub const DIK_MAIL = @as(u32, 236); pub const DIK_MEDIASELECT = @as(u32, 237); pub const DIK_BACKSPACE = @as(u32, 14); pub const DIK_NUMPADSTAR = @as(u32, 55); pub const DIK_LALT = @as(u32, 56); pub const DIK_CAPSLOCK = @as(u32, 58); pub const DIK_NUMPADMINUS = @as(u32, 74); pub const DIK_NUMPADPLUS = @as(u32, 78); pub const DIK_NUMPADPERIOD = @as(u32, 83); pub const DIK_NUMPADSLASH = @as(u32, 181); pub const DIK_RALT = @as(u32, 184); pub const DIK_UPARROW = @as(u32, 200); pub const DIK_PGUP = @as(u32, 201); pub const DIK_LEFTARROW = @as(u32, 203); pub const DIK_RIGHTARROW = @as(u32, 205); pub const DIK_DOWNARROW = @as(u32, 208); pub const DIK_PGDN = @as(u32, 209); pub const DIK_CIRCUMFLEX = @as(u32, 144); pub const DIENUM_STOP = @as(u32, 0); pub const DIENUM_CONTINUE = @as(u32, 1); pub const DIEDFL_ALLDEVICES = @as(u32, 0); pub const DIEDFL_ATTACHEDONLY = @as(u32, 1); pub const DIEDFL_FORCEFEEDBACK = @as(u32, 256); pub const DIEDFL_INCLUDEALIASES = @as(u32, 65536); pub const DIEDFL_INCLUDEPHANTOMS = @as(u32, 131072); pub const DIEDFL_INCLUDEHIDDEN = @as(u32, 262144); pub const DIEDBS_MAPPEDPRI1 = @as(u32, 1); pub const DIEDBS_MAPPEDPRI2 = @as(u32, 2); pub const DIEDBS_RECENTDEVICE = @as(u32, 16); pub const DIEDBS_NEWDEVICE = @as(u32, 32); pub const DIEDBSFL_ATTACHEDONLY = @as(u32, 0); pub const DIEDBSFL_THISUSER = @as(u32, 16); pub const DIEDBSFL_FORCEFEEDBACK = @as(u32, 256); pub const DIEDBSFL_AVAILABLEDEVICES = @as(u32, 4096); pub const DIEDBSFL_MULTIMICEKEYBOARDS = @as(u32, 8192); pub const DIEDBSFL_NONGAMINGDEVICES = @as(u32, 16384); pub const DIEDBSFL_VALID = @as(u32, 28944); pub const DI_OK = @as(i32, 0); pub const DI_NOTATTACHED = @as(i32, 1); pub const DI_BUFFEROVERFLOW = @as(i32, 1); pub const DI_PROPNOEFFECT = @as(i32, 1); pub const DI_NOEFFECT = @as(i32, 1); pub const DI_POLLEDDEVICE = @import("../zig.zig").typedConst(HRESULT, @as(i32, 2)); pub const DI_DOWNLOADSKIPPED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 3)); pub const DI_EFFECTRESTARTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 4)); pub const DI_TRUNCATED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 8)); pub const DI_SETTINGSNOTSAVED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 11)); pub const DI_TRUNCATEDANDRESTARTED = @import("../zig.zig").typedConst(HRESULT, @as(i32, 12)); pub const DI_WRITEPROTECT = @import("../zig.zig").typedConst(HRESULT, @as(i32, 19)); pub const DIERR_OLDDIRECTINPUTVERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147023746)); pub const DIERR_BETADIRECTINPUTVERSION = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147023743)); pub const DIERR_BADDRIVERVER = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024777)); pub const DIERR_DEVICENOTREG = @as(i32, -2147221164); pub const DIERR_NOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024894)); pub const DIERR_OBJECTNOTFOUND = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024894)); pub const DIERR_INVALIDPARAM = @as(i32, -2147024809); pub const DIERR_NOINTERFACE = @as(i32, -2147467262); pub const DIERR_GENERIC = @as(i32, -2147467259); pub const DIERR_OUTOFMEMORY = @as(i32, -2147024882); pub const DIERR_UNSUPPORTED = @as(i32, -2147467263); pub const DIERR_NOTINITIALIZED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024875)); pub const DIERR_ALREADYINITIALIZED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147023649)); pub const DIERR_NOAGGREGATION = @as(i32, -2147221232); pub const DIERR_OTHERAPPHASPRIO = @as(i32, -2147024891); pub const DIERR_INPUTLOST = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024866)); pub const DIERR_ACQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024726)); pub const DIERR_NOTACQUIRED = @import("../zig.zig").typedConst(HRESULT, @as(i32, -2147024884)); pub const DIERR_READONLY = @as(i32, -2147024891); pub const DIERR_HANDLEEXISTS = @as(i32, -2147024891); pub const DIERR_INSUFFICIENTPRIVS = @as(i32, -2147220992); pub const DIERR_DEVICEFULL = @as(i32, -2147220991); pub const DIERR_MOREDATA = @as(i32, -2147220990); pub const DIERR_NOTDOWNLOADED = @as(i32, -2147220989); pub const DIERR_HASEFFECTS = @as(i32, -2147220988); pub const DIERR_NOTEXCLUSIVEACQUIRED = @as(i32, -2147220987); pub const DIERR_INCOMPLETEEFFECT = @as(i32, -2147220986); pub const DIERR_NOTBUFFERED = @as(i32, -2147220985); pub const DIERR_EFFECTPLAYING = @as(i32, -2147220984); pub const DIERR_UNPLUGGED = @as(i32, -2147220983); pub const DIERR_REPORTFULL = @as(i32, -2147220982); pub const DIERR_MAPFILEFAIL = @as(i32, -2147220981); pub const DIKEYBOARD_ESCAPE = @as(u32, 2164261889); pub const DIKEYBOARD_1 = @as(u32, 2164261890); pub const DIKEYBOARD_2 = @as(u32, 2164261891); pub const DIKEYBOARD_3 = @as(u32, 2164261892); pub const DIKEYBOARD_4 = @as(u32, 2164261893); pub const DIKEYBOARD_5 = @as(u32, 2164261894); pub const DIKEYBOARD_6 = @as(u32, 2164261895); pub const DIKEYBOARD_7 = @as(u32, 2164261896); pub const DIKEYBOARD_8 = @as(u32, 2164261897); pub const DIKEYBOARD_9 = @as(u32, 2164261898); pub const DIKEYBOARD_0 = @as(u32, 2164261899); pub const DIKEYBOARD_MINUS = @as(u32, 2164261900); pub const DIKEYBOARD_EQUALS = @as(u32, 2164261901); pub const DIKEYBOARD_BACK = @as(u32, 2164261902); pub const DIKEYBOARD_TAB = @as(u32, 2164261903); pub const DIKEYBOARD_Q = @as(u32, 2164261904); pub const DIKEYBOARD_W = @as(u32, 2164261905); pub const DIKEYBOARD_E = @as(u32, 2164261906); pub const DIKEYBOARD_R = @as(u32, 2164261907); pub const DIKEYBOARD_T = @as(u32, 2164261908); pub const DIKEYBOARD_Y = @as(u32, 2164261909); pub const DIKEYBOARD_U = @as(u32, 2164261910); pub const DIKEYBOARD_I = @as(u32, 2164261911); pub const DIKEYBOARD_O = @as(u32, 2164261912); pub const DIKEYBOARD_P = @as(u32, 2164261913); pub const DIKEYBOARD_LBRACKET = @as(u32, 2164261914); pub const DIKEYBOARD_RBRACKET = @as(u32, 2164261915); pub const DIKEYBOARD_RETURN = @as(u32, 2164261916); pub const DIKEYBOARD_LCONTROL = @as(u32, 2164261917); pub const DIKEYBOARD_A = @as(u32, 2164261918); pub const DIKEYBOARD_S = @as(u32, 2164261919); pub const DIKEYBOARD_D = @as(u32, 2164261920); pub const DIKEYBOARD_F = @as(u32, 2164261921); pub const DIKEYBOARD_G = @as(u32, 2164261922); pub const DIKEYBOARD_H = @as(u32, 2164261923); pub const DIKEYBOARD_J = @as(u32, 2164261924); pub const DIKEYBOARD_K = @as(u32, 2164261925); pub const DIKEYBOARD_L = @as(u32, 2164261926); pub const DIKEYBOARD_SEMICOLON = @as(u32, 2164261927); pub const DIKEYBOARD_APOSTROPHE = @as(u32, 2164261928); pub const DIKEYBOARD_GRAVE = @as(u32, 2164261929); pub const DIKEYBOARD_LSHIFT = @as(u32, 2164261930); pub const DIKEYBOARD_BACKSLASH = @as(u32, 2164261931); pub const DIKEYBOARD_Z = @as(u32, 2164261932); pub const DIKEYBOARD_X = @as(u32, 2164261933); pub const DIKEYBOARD_C = @as(u32, 2164261934); pub const DIKEYBOARD_V = @as(u32, 2164261935); pub const DIKEYBOARD_B = @as(u32, 2164261936); pub const DIKEYBOARD_N = @as(u32, 2164261937); pub const DIKEYBOARD_M = @as(u32, 2164261938); pub const DIKEYBOARD_COMMA = @as(u32, 2164261939); pub const DIKEYBOARD_PERIOD = @as(u32, 2164261940); pub const DIKEYBOARD_SLASH = @as(u32, 2164261941); pub const DIKEYBOARD_RSHIFT = @as(u32, 2164261942); pub const DIKEYBOARD_MULTIPLY = @as(u32, 2164261943); pub const DIKEYBOARD_LMENU = @as(u32, 2164261944); pub const DIKEYBOARD_SPACE = @as(u32, 2164261945); pub const DIKEYBOARD_CAPITAL = @as(u32, 2164261946); pub const DIKEYBOARD_F1 = @as(u32, 2164261947); pub const DIKEYBOARD_F2 = @as(u32, 2164261948); pub const DIKEYBOARD_F3 = @as(u32, 2164261949); pub const DIKEYBOARD_F4 = @as(u32, 2164261950); pub const DIKEYBOARD_F5 = @as(u32, 2164261951); pub const DIKEYBOARD_F6 = @as(u32, 2164261952); pub const DIKEYBOARD_F7 = @as(u32, 2164261953); pub const DIKEYBOARD_F8 = @as(u32, 2164261954); pub const DIKEYBOARD_F9 = @as(u32, 2164261955); pub const DIKEYBOARD_F10 = @as(u32, 2164261956); pub const DIKEYBOARD_NUMLOCK = @as(u32, 2164261957); pub const DIKEYBOARD_SCROLL = @as(u32, 2164261958); pub const DIKEYBOARD_NUMPAD7 = @as(u32, 2164261959); pub const DIKEYBOARD_NUMPAD8 = @as(u32, 2164261960); pub const DIKEYBOARD_NUMPAD9 = @as(u32, 2164261961); pub const DIKEYBOARD_SUBTRACT = @as(u32, 2164261962); pub const DIKEYBOARD_NUMPAD4 = @as(u32, 2164261963); pub const DIKEYBOARD_NUMPAD5 = @as(u32, 2164261964); pub const DIKEYBOARD_NUMPAD6 = @as(u32, 2164261965); pub const DIKEYBOARD_ADD = @as(u32, 2164261966); pub const DIKEYBOARD_NUMPAD1 = @as(u32, 2164261967); pub const DIKEYBOARD_NUMPAD2 = @as(u32, 2164261968); pub const DIKEYBOARD_NUMPAD3 = @as(u32, 2164261969); pub const DIKEYBOARD_NUMPAD0 = @as(u32, 2164261970); pub const DIKEYBOARD_DECIMAL = @as(u32, 2164261971); pub const DIKEYBOARD_OEM_102 = @as(u32, 2164261974); pub const DIKEYBOARD_F11 = @as(u32, 2164261975); pub const DIKEYBOARD_F12 = @as(u32, 2164261976); pub const DIKEYBOARD_F13 = @as(u32, 2164261988); pub const DIKEYBOARD_F14 = @as(u32, 2164261989); pub const DIKEYBOARD_F15 = @as(u32, 2164261990); pub const DIKEYBOARD_KANA = @as(u32, 2164262000); pub const DIKEYBOARD_ABNT_C1 = @as(u32, 2164262003); pub const DIKEYBOARD_CONVERT = @as(u32, 2164262009); pub const DIKEYBOARD_NOCONVERT = @as(u32, 2164262011); pub const DIKEYBOARD_YEN = @as(u32, 2164262013); pub const DIKEYBOARD_ABNT_C2 = @as(u32, 2164262014); pub const DIKEYBOARD_NUMPADEQUALS = @as(u32, 2164262029); pub const DIKEYBOARD_PREVTRACK = @as(u32, 2164262032); pub const DIKEYBOARD_AT = @as(u32, 2164262033); pub const DIKEYBOARD_COLON = @as(u32, 2164262034); pub const DIKEYBOARD_UNDERLINE = @as(u32, 2164262035); pub const DIKEYBOARD_KANJI = @as(u32, 2164262036); pub const DIKEYBOARD_STOP = @as(u32, 2164262037); pub const DIKEYBOARD_AX = @as(u32, 2164262038); pub const DIKEYBOARD_UNLABELED = @as(u32, 2164262039); pub const DIKEYBOARD_NEXTTRACK = @as(u32, 2164262041); pub const DIKEYBOARD_NUMPADENTER = @as(u32, 2164262044); pub const DIKEYBOARD_RCONTROL = @as(u32, 2164262045); pub const DIKEYBOARD_MUTE = @as(u32, 2164262048); pub const DIKEYBOARD_CALCULATOR = @as(u32, 2164262049); pub const DIKEYBOARD_PLAYPAUSE = @as(u32, 2164262050); pub const DIKEYBOARD_MEDIASTOP = @as(u32, 2164262052); pub const DIKEYBOARD_VOLUMEDOWN = @as(u32, 2164262062); pub const DIKEYBOARD_VOLUMEUP = @as(u32, 2164262064); pub const DIKEYBOARD_WEBHOME = @as(u32, 2164262066); pub const DIKEYBOARD_NUMPADCOMMA = @as(u32, 2164262067); pub const DIKEYBOARD_DIVIDE = @as(u32, 2164262069); pub const DIKEYBOARD_SYSRQ = @as(u32, 2164262071); pub const DIKEYBOARD_RMENU = @as(u32, 2164262072); pub const DIKEYBOARD_PAUSE = @as(u32, 2164262085); pub const DIKEYBOARD_HOME = @as(u32, 2164262087); pub const DIKEYBOARD_UP = @as(u32, 2164262088); pub const DIKEYBOARD_PRIOR = @as(u32, 2164262089); pub const DIKEYBOARD_LEFT = @as(u32, 2164262091); pub const DIKEYBOARD_RIGHT = @as(u32, 2164262093); pub const DIKEYBOARD_END = @as(u32, 2164262095); pub const DIKEYBOARD_DOWN = @as(u32, 2164262096); pub const DIKEYBOARD_NEXT = @as(u32, 2164262097); pub const DIKEYBOARD_INSERT = @as(u32, 2164262098); pub const DIKEYBOARD_DELETE = @as(u32, 2164262099); pub const DIKEYBOARD_LWIN = @as(u32, 2164262107); pub const DIKEYBOARD_RWIN = @as(u32, 2164262108); pub const DIKEYBOARD_APPS = @as(u32, 2164262109); pub const DIKEYBOARD_POWER = @as(u32, 2164262110); pub const DIKEYBOARD_SLEEP = @as(u32, 2164262111); pub const DIKEYBOARD_WAKE = @as(u32, 2164262115); pub const DIKEYBOARD_WEBSEARCH = @as(u32, 2164262117); pub const DIKEYBOARD_WEBFAVORITES = @as(u32, 2164262118); pub const DIKEYBOARD_WEBREFRESH = @as(u32, 2164262119); pub const DIKEYBOARD_WEBSTOP = @as(u32, 2164262120); pub const DIKEYBOARD_WEBFORWARD = @as(u32, 2164262121); pub const DIKEYBOARD_WEBBACK = @as(u32, 2164262122); pub const DIKEYBOARD_MYCOMPUTER = @as(u32, 2164262123); pub const DIKEYBOARD_MAIL = @as(u32, 2164262124); pub const DIKEYBOARD_MEDIASELECT = @as(u32, 2164262125); pub const DIVOICE_CHANNEL1 = @as(u32, 2197816321); pub const DIVOICE_CHANNEL2 = @as(u32, 2197816322); pub const DIVOICE_CHANNEL3 = @as(u32, 2197816323); pub const DIVOICE_CHANNEL4 = @as(u32, 2197816324); pub const DIVOICE_CHANNEL5 = @as(u32, 2197816325); pub const DIVOICE_CHANNEL6 = @as(u32, 2197816326); pub const DIVOICE_CHANNEL7 = @as(u32, 2197816327); pub const DIVOICE_CHANNEL8 = @as(u32, 2197816328); pub const DIVOICE_TEAM = @as(u32, 2197816329); pub const DIVOICE_ALL = @as(u32, 2197816330); pub const DIVOICE_RECORDMUTE = @as(u32, 2197816331); pub const DIVOICE_PLAYBACKMUTE = @as(u32, 2197816332); pub const DIVOICE_TRANSMIT = @as(u32, 2197816333); pub const DIVOICE_VOICECOMMAND = @as(u32, 2197816336); pub const DIVIRTUAL_DRIVING_RACE = @as(u32, 16777216); pub const DIAXIS_DRIVINGR_STEER = @as(u32, 16812545); pub const DIAXIS_DRIVINGR_ACCELERATE = @as(u32, 17011202); pub const DIAXIS_DRIVINGR_BRAKE = @as(u32, 17043971); pub const DIBUTTON_DRIVINGR_SHIFTUP = @as(u32, 16780289); pub const DIBUTTON_DRIVINGR_SHIFTDOWN = @as(u32, 16780290); pub const DIBUTTON_DRIVINGR_VIEW = @as(u32, 16784387); pub const DIBUTTON_DRIVINGR_MENU = @as(u32, 16778493); pub const DIAXIS_DRIVINGR_ACCEL_AND_BRAKE = @as(u32, 16861700); pub const DIHATSWITCH_DRIVINGR_GLANCE = @as(u32, 16795137); pub const DIBUTTON_DRIVINGR_BRAKE = @as(u32, 16796676); pub const DIBUTTON_DRIVINGR_DASHBOARD = @as(u32, 16794629); pub const DIBUTTON_DRIVINGR_AIDS = @as(u32, 16794630); pub const DIBUTTON_DRIVINGR_MAP = @as(u32, 16794631); pub const DIBUTTON_DRIVINGR_BOOST = @as(u32, 16794632); pub const DIBUTTON_DRIVINGR_PIT = @as(u32, 16794633); pub const DIBUTTON_DRIVINGR_ACCELERATE_LINK = @as(u32, 17028320); pub const DIBUTTON_DRIVINGR_STEER_LEFT_LINK = @as(u32, 16829668); pub const DIBUTTON_DRIVINGR_STEER_RIGHT_LINK = @as(u32, 16829676); pub const DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK = @as(u32, 17286372); pub const DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK = @as(u32, 17286380); pub const DIBUTTON_DRIVINGR_DEVICE = @as(u32, 16794878); pub const DIBUTTON_DRIVINGR_PAUSE = @as(u32, 16794876); pub const DIVIRTUAL_DRIVING_COMBAT = @as(u32, 33554432); pub const DIAXIS_DRIVINGC_STEER = @as(u32, 33589761); pub const DIAXIS_DRIVINGC_ACCELERATE = @as(u32, 33788418); pub const DIAXIS_DRIVINGC_BRAKE = @as(u32, 33821187); pub const DIBUTTON_DRIVINGC_FIRE = @as(u32, 33557505); pub const DIBUTTON_DRIVINGC_WEAPONS = @as(u32, 33557506); pub const DIBUTTON_DRIVINGC_TARGET = @as(u32, 33557507); pub const DIBUTTON_DRIVINGC_MENU = @as(u32, 33555709); pub const DIAXIS_DRIVINGC_ACCEL_AND_BRAKE = @as(u32, 33638916); pub const DIHATSWITCH_DRIVINGC_GLANCE = @as(u32, 33572353); pub const DIBUTTON_DRIVINGC_SHIFTUP = @as(u32, 33573892); pub const DIBUTTON_DRIVINGC_SHIFTDOWN = @as(u32, 33573893); pub const DIBUTTON_DRIVINGC_DASHBOARD = @as(u32, 33571846); pub const DIBUTTON_DRIVINGC_AIDS = @as(u32, 33571847); pub const DIBUTTON_DRIVINGC_BRAKE = @as(u32, 33573896); pub const DIBUTTON_DRIVINGC_FIRESECONDARY = @as(u32, 33573897); pub const DIBUTTON_DRIVINGC_ACCELERATE_LINK = @as(u32, 33805536); pub const DIBUTTON_DRIVINGC_STEER_LEFT_LINK = @as(u32, 33606884); pub const DIBUTTON_DRIVINGC_STEER_RIGHT_LINK = @as(u32, 33606892); pub const DIBUTTON_DRIVINGC_GLANCE_LEFT_LINK = @as(u32, 34063588); pub const DIBUTTON_DRIVINGC_GLANCE_RIGHT_LINK = @as(u32, 34063596); pub const DIBUTTON_DRIVINGC_DEVICE = @as(u32, 33572094); pub const DIBUTTON_DRIVINGC_PAUSE = @as(u32, 33572092); pub const DIVIRTUAL_DRIVING_TANK = @as(u32, 50331648); pub const DIAXIS_DRIVINGT_STEER = @as(u32, 50366977); pub const DIAXIS_DRIVINGT_BARREL = @as(u32, 50397698); pub const DIAXIS_DRIVINGT_ACCELERATE = @as(u32, 50565635); pub const DIAXIS_DRIVINGT_ROTATE = @as(u32, 50463236); pub const DIBUTTON_DRIVINGT_FIRE = @as(u32, 50334721); pub const DIBUTTON_DRIVINGT_WEAPONS = @as(u32, 50334722); pub const DIBUTTON_DRIVINGT_TARGET = @as(u32, 50334723); pub const DIBUTTON_DRIVINGT_MENU = @as(u32, 50332925); pub const DIHATSWITCH_DRIVINGT_GLANCE = @as(u32, 50349569); pub const DIAXIS_DRIVINGT_BRAKE = @as(u32, 50614789); pub const DIAXIS_DRIVINGT_ACCEL_AND_BRAKE = @as(u32, 50416134); pub const DIBUTTON_DRIVINGT_VIEW = @as(u32, 50355204); pub const DIBUTTON_DRIVINGT_DASHBOARD = @as(u32, 50355205); pub const DIBUTTON_DRIVINGT_BRAKE = @as(u32, 50351110); pub const DIBUTTON_DRIVINGT_FIRESECONDARY = @as(u32, 50351111); pub const DIBUTTON_DRIVINGT_ACCELERATE_LINK = @as(u32, 50582752); pub const DIBUTTON_DRIVINGT_STEER_LEFT_LINK = @as(u32, 50384100); pub const DIBUTTON_DRIVINGT_STEER_RIGHT_LINK = @as(u32, 50384108); pub const DIBUTTON_DRIVINGT_BARREL_UP_LINK = @as(u32, 50414816); pub const DIBUTTON_DRIVINGT_BARREL_DOWN_LINK = @as(u32, 50414824); pub const DIBUTTON_DRIVINGT_ROTATE_LEFT_LINK = @as(u32, 50480356); pub const DIBUTTON_DRIVINGT_ROTATE_RIGHT_LINK = @as(u32, 50480364); pub const DIBUTTON_DRIVINGT_GLANCE_LEFT_LINK = @as(u32, 50840804); pub const DIBUTTON_DRIVINGT_GLANCE_RIGHT_LINK = @as(u32, 50840812); pub const DIBUTTON_DRIVINGT_DEVICE = @as(u32, 50349310); pub const DIBUTTON_DRIVINGT_PAUSE = @as(u32, 50349308); pub const DIVIRTUAL_FLYING_CIVILIAN = @as(u32, 67108864); pub const DIAXIS_FLYINGC_BANK = @as(u32, 67144193); pub const DIAXIS_FLYINGC_PITCH = @as(u32, 67176962); pub const DIAXIS_FLYINGC_THROTTLE = @as(u32, 67342851); pub const DIBUTTON_FLYINGC_VIEW = @as(u32, 67118081); pub const DIBUTTON_FLYINGC_DISPLAY = @as(u32, 67118082); pub const DIBUTTON_FLYINGC_GEAR = @as(u32, 67120131); pub const DIBUTTON_FLYINGC_MENU = @as(u32, 67110141); pub const DIHATSWITCH_FLYINGC_GLANCE = @as(u32, 67126785); pub const DIAXIS_FLYINGC_BRAKE = @as(u32, 67398148); pub const DIAXIS_FLYINGC_RUDDER = @as(u32, 67260933); pub const DIAXIS_FLYINGC_FLAPS = @as(u32, 67459590); pub const DIBUTTON_FLYINGC_FLAPSUP = @as(u32, 67134468); pub const DIBUTTON_FLYINGC_FLAPSDOWN = @as(u32, 67134469); pub const DIBUTTON_FLYINGC_BRAKE_LINK = @as(u32, 67398880); pub const DIBUTTON_FLYINGC_FASTER_LINK = @as(u32, 67359968); pub const DIBUTTON_FLYINGC_SLOWER_LINK = @as(u32, 67359976); pub const DIBUTTON_FLYINGC_GLANCE_LEFT_LINK = @as(u32, 67618020); pub const DIBUTTON_FLYINGC_GLANCE_RIGHT_LINK = @as(u32, 67618028); pub const DIBUTTON_FLYINGC_GLANCE_UP_LINK = @as(u32, 67618016); pub const DIBUTTON_FLYINGC_GLANCE_DOWN_LINK = @as(u32, 67618024); pub const DIBUTTON_FLYINGC_DEVICE = @as(u32, 67126526); pub const DIBUTTON_FLYINGC_PAUSE = @as(u32, 67126524); pub const DIVIRTUAL_FLYING_MILITARY = @as(u32, 83886080); pub const DIAXIS_FLYINGM_BANK = @as(u32, 83921409); pub const DIAXIS_FLYINGM_PITCH = @as(u32, 83954178); pub const DIAXIS_FLYINGM_THROTTLE = @as(u32, 84120067); pub const DIBUTTON_FLYINGM_FIRE = @as(u32, 83889153); pub const DIBUTTON_FLYINGM_WEAPONS = @as(u32, 83889154); pub const DIBUTTON_FLYINGM_TARGET = @as(u32, 83889155); pub const DIBUTTON_FLYINGM_MENU = @as(u32, 83887357); pub const DIHATSWITCH_FLYINGM_GLANCE = @as(u32, 83904001); pub const DIBUTTON_FLYINGM_COUNTER = @as(u32, 83909636); pub const DIAXIS_FLYINGM_RUDDER = @as(u32, 84036100); pub const DIAXIS_FLYINGM_BRAKE = @as(u32, 84173317); pub const DIBUTTON_FLYINGM_VIEW = @as(u32, 83911685); pub const DIBUTTON_FLYINGM_DISPLAY = @as(u32, 83911686); pub const DIAXIS_FLYINGM_FLAPS = @as(u32, 84234758); pub const DIBUTTON_FLYINGM_FLAPSUP = @as(u32, 83907591); pub const DIBUTTON_FLYINGM_FLAPSDOWN = @as(u32, 83907592); pub const DIBUTTON_FLYINGM_FIRESECONDARY = @as(u32, 83905545); pub const DIBUTTON_FLYINGM_GEAR = @as(u32, 83911690); pub const DIBUTTON_FLYINGM_BRAKE_LINK = @as(u32, 84174048); pub const DIBUTTON_FLYINGM_FASTER_LINK = @as(u32, 84137184); pub const DIBUTTON_FLYINGM_SLOWER_LINK = @as(u32, 84137192); pub const DIBUTTON_FLYINGM_GLANCE_LEFT_LINK = @as(u32, 84395236); pub const DIBUTTON_FLYINGM_GLANCE_RIGHT_LINK = @as(u32, 84395244); pub const DIBUTTON_FLYINGM_GLANCE_UP_LINK = @as(u32, 84395232); pub const DIBUTTON_FLYINGM_GLANCE_DOWN_LINK = @as(u32, 84395240); pub const DIBUTTON_FLYINGM_DEVICE = @as(u32, 83903742); pub const DIBUTTON_FLYINGM_PAUSE = @as(u32, 83903740); pub const DIVIRTUAL_FLYING_HELICOPTER = @as(u32, 100663296); pub const DIAXIS_FLYINGH_BANK = @as(u32, 100698625); pub const DIAXIS_FLYINGH_PITCH = @as(u32, 100731394); pub const DIAXIS_FLYINGH_COLLECTIVE = @as(u32, 100764163); pub const DIBUTTON_FLYINGH_FIRE = @as(u32, 100668417); pub const DIBUTTON_FLYINGH_WEAPONS = @as(u32, 100668418); pub const DIBUTTON_FLYINGH_TARGET = @as(u32, 100668419); pub const DIBUTTON_FLYINGH_MENU = @as(u32, 100664573); pub const DIHATSWITCH_FLYINGH_GLANCE = @as(u32, 100681217); pub const DIAXIS_FLYINGH_TORQUE = @as(u32, 100817412); pub const DIAXIS_FLYINGH_THROTTLE = @as(u32, 100915717); pub const DIBUTTON_FLYINGH_COUNTER = @as(u32, 100684804); pub const DIBUTTON_FLYINGH_VIEW = @as(u32, 100688901); pub const DIBUTTON_FLYINGH_GEAR = @as(u32, 100688902); pub const DIBUTTON_FLYINGH_FIRESECONDARY = @as(u32, 100682759); pub const DIBUTTON_FLYINGH_FASTER_LINK = @as(u32, 100916448); pub const DIBUTTON_FLYINGH_SLOWER_LINK = @as(u32, 100916456); pub const DIBUTTON_FLYINGH_GLANCE_LEFT_LINK = @as(u32, 101172452); pub const DIBUTTON_FLYINGH_GLANCE_RIGHT_LINK = @as(u32, 101172460); pub const DIBUTTON_FLYINGH_GLANCE_UP_LINK = @as(u32, 101172448); pub const DIBUTTON_FLYINGH_GLANCE_DOWN_LINK = @as(u32, 101172456); pub const DIBUTTON_FLYINGH_DEVICE = @as(u32, 100680958); pub const DIBUTTON_FLYINGH_PAUSE = @as(u32, 100680956); pub const DIVIRTUAL_SPACESIM = @as(u32, 117440512); pub const DIAXIS_SPACESIM_LATERAL = @as(u32, 117473793); pub const DIAXIS_SPACESIM_MOVE = @as(u32, 117506562); pub const DIAXIS_SPACESIM_THROTTLE = @as(u32, 117670403); pub const DIBUTTON_SPACESIM_FIRE = @as(u32, 117441537); pub const DIBUTTON_SPACESIM_WEAPONS = @as(u32, 117441538); pub const DIBUTTON_SPACESIM_TARGET = @as(u32, 117441539); pub const DIBUTTON_SPACESIM_MENU = @as(u32, 117441789); pub const DIHATSWITCH_SPACESIM_GLANCE = @as(u32, 117458433); pub const DIAXIS_SPACESIM_CLIMB = @as(u32, 117555716); pub const DIAXIS_SPACESIM_ROTATE = @as(u32, 117588485); pub const DIBUTTON_SPACESIM_VIEW = @as(u32, 117457924); pub const DIBUTTON_SPACESIM_DISPLAY = @as(u32, 117457925); pub const DIBUTTON_SPACESIM_RAISE = @as(u32, 117457926); pub const DIBUTTON_SPACESIM_LOWER = @as(u32, 117457927); pub const DIBUTTON_SPACESIM_GEAR = @as(u32, 117457928); pub const DIBUTTON_SPACESIM_FIRESECONDARY = @as(u32, 117457929); pub const DIBUTTON_SPACESIM_LEFT_LINK = @as(u32, 117490916); pub const DIBUTTON_SPACESIM_RIGHT_LINK = @as(u32, 117490924); pub const DIBUTTON_SPACESIM_FORWARD_LINK = @as(u32, 117523680); pub const DIBUTTON_SPACESIM_BACKWARD_LINK = @as(u32, 117523688); pub const DIBUTTON_SPACESIM_FASTER_LINK = @as(u32, 117687520); pub const DIBUTTON_SPACESIM_SLOWER_LINK = @as(u32, 117687528); pub const DIBUTTON_SPACESIM_TURN_LEFT_LINK = @as(u32, 117589220); pub const DIBUTTON_SPACESIM_TURN_RIGHT_LINK = @as(u32, 117589228); pub const DIBUTTON_SPACESIM_GLANCE_LEFT_LINK = @as(u32, 117949668); pub const DIBUTTON_SPACESIM_GLANCE_RIGHT_LINK = @as(u32, 117949676); pub const DIBUTTON_SPACESIM_GLANCE_UP_LINK = @as(u32, 117949664); pub const DIBUTTON_SPACESIM_GLANCE_DOWN_LINK = @as(u32, 117949672); pub const DIBUTTON_SPACESIM_DEVICE = @as(u32, 117458174); pub const DIBUTTON_SPACESIM_PAUSE = @as(u32, 117458172); pub const DIVIRTUAL_FIGHTING_HAND2HAND = @as(u32, 134217728); pub const DIAXIS_FIGHTINGH_LATERAL = @as(u32, 134251009); pub const DIAXIS_FIGHTINGH_MOVE = @as(u32, 134283778); pub const DIBUTTON_FIGHTINGH_PUNCH = @as(u32, 134218753); pub const DIBUTTON_FIGHTINGH_KICK = @as(u32, 134218754); pub const DIBUTTON_FIGHTINGH_BLOCK = @as(u32, 134218755); pub const DIBUTTON_FIGHTINGH_CROUCH = @as(u32, 134218756); pub const DIBUTTON_FIGHTINGH_JUMP = @as(u32, 134218757); pub const DIBUTTON_FIGHTINGH_SPECIAL1 = @as(u32, 134218758); pub const DIBUTTON_FIGHTINGH_SPECIAL2 = @as(u32, 134218759); pub const DIBUTTON_FIGHTINGH_MENU = @as(u32, 134219005); pub const DIBUTTON_FIGHTINGH_SELECT = @as(u32, 134235144); pub const DIHATSWITCH_FIGHTINGH_SLIDE = @as(u32, 134235649); pub const DIBUTTON_FIGHTINGH_DISPLAY = @as(u32, 134235145); pub const DIAXIS_FIGHTINGH_ROTATE = @as(u32, 134365699); pub const DIBUTTON_FIGHTINGH_DODGE = @as(u32, 134235146); pub const DIBUTTON_FIGHTINGH_LEFT_LINK = @as(u32, 134268132); pub const DIBUTTON_FIGHTINGH_RIGHT_LINK = @as(u32, 134268140); pub const DIBUTTON_FIGHTINGH_FORWARD_LINK = @as(u32, 134300896); pub const DIBUTTON_FIGHTINGH_BACKWARD_LINK = @as(u32, 134300904); pub const DIBUTTON_FIGHTINGH_DEVICE = @as(u32, 134235390); pub const DIBUTTON_FIGHTINGH_PAUSE = @as(u32, 134235388); pub const DIVIRTUAL_FIGHTING_FPS = @as(u32, 150994944); pub const DIAXIS_FPS_ROTATE = @as(u32, 151028225); pub const DIAXIS_FPS_MOVE = @as(u32, 151060994); pub const DIBUTTON_FPS_FIRE = @as(u32, 150995969); pub const DIBUTTON_FPS_WEAPONS = @as(u32, 150995970); pub const DIBUTTON_FPS_APPLY = @as(u32, 150995971); pub const DIBUTTON_FPS_SELECT = @as(u32, 150995972); pub const DIBUTTON_FPS_CROUCH = @as(u32, 150995973); pub const DIBUTTON_FPS_JUMP = @as(u32, 150995974); pub const DIAXIS_FPS_LOOKUPDOWN = @as(u32, 151093763); pub const DIBUTTON_FPS_STRAFE = @as(u32, 150995975); pub const DIBUTTON_FPS_MENU = @as(u32, 150996221); pub const DIHATSWITCH_FPS_GLANCE = @as(u32, 151012865); pub const DIBUTTON_FPS_DISPLAY = @as(u32, 151012360); pub const DIAXIS_FPS_SIDESTEP = @as(u32, 151142916); pub const DIBUTTON_FPS_DODGE = @as(u32, 151012361); pub const DIBUTTON_FPS_GLANCEL = @as(u32, 151012362); pub const DIBUTTON_FPS_GLANCER = @as(u32, 151012363); pub const DIBUTTON_FPS_FIRESECONDARY = @as(u32, 151012364); pub const DIBUTTON_FPS_ROTATE_LEFT_LINK = @as(u32, 151045348); pub const DIBUTTON_FPS_ROTATE_RIGHT_LINK = @as(u32, 151045356); pub const DIBUTTON_FPS_FORWARD_LINK = @as(u32, 151078112); pub const DIBUTTON_FPS_BACKWARD_LINK = @as(u32, 151078120); pub const DIBUTTON_FPS_GLANCE_UP_LINK = @as(u32, 151110880); pub const DIBUTTON_FPS_GLANCE_DOWN_LINK = @as(u32, 151110888); pub const DIBUTTON_FPS_STEP_LEFT_LINK = @as(u32, 151143652); pub const DIBUTTON_FPS_STEP_RIGHT_LINK = @as(u32, 151143660); pub const DIBUTTON_FPS_DEVICE = @as(u32, 151012606); pub const DIBUTTON_FPS_PAUSE = @as(u32, 151012604); pub const DIVIRTUAL_FIGHTING_THIRDPERSON = @as(u32, 167772160); pub const DIAXIS_TPS_TURN = @as(u32, 167903745); pub const DIAXIS_TPS_MOVE = @as(u32, 167838210); pub const DIBUTTON_TPS_RUN = @as(u32, 167773185); pub const DIBUTTON_TPS_ACTION = @as(u32, 167773186); pub const DIBUTTON_TPS_SELECT = @as(u32, 167773187); pub const DIBUTTON_TPS_USE = @as(u32, 167773188); pub const DIBUTTON_TPS_JUMP = @as(u32, 167773189); pub const DIBUTTON_TPS_MENU = @as(u32, 167773437); pub const DIHATSWITCH_TPS_GLANCE = @as(u32, 167790081); pub const DIBUTTON_TPS_VIEW = @as(u32, 167789574); pub const DIBUTTON_TPS_STEPLEFT = @as(u32, 167789575); pub const DIBUTTON_TPS_STEPRIGHT = @as(u32, 167789576); pub const DIAXIS_TPS_STEP = @as(u32, 167821827); pub const DIBUTTON_TPS_DODGE = @as(u32, 167789577); pub const DIBUTTON_TPS_INVENTORY = @as(u32, 167789578); pub const DIBUTTON_TPS_TURN_LEFT_LINK = @as(u32, 167920868); pub const DIBUTTON_TPS_TURN_RIGHT_LINK = @as(u32, 167920876); pub const DIBUTTON_TPS_FORWARD_LINK = @as(u32, 167855328); pub const DIBUTTON_TPS_BACKWARD_LINK = @as(u32, 167855336); pub const DIBUTTON_TPS_GLANCE_UP_LINK = @as(u32, 168281312); pub const DIBUTTON_TPS_GLANCE_DOWN_LINK = @as(u32, 168281320); pub const DIBUTTON_TPS_GLANCE_LEFT_LINK = @as(u32, 168281316); pub const DIBUTTON_TPS_GLANCE_RIGHT_LINK = @as(u32, 168281324); pub const DIBUTTON_TPS_DEVICE = @as(u32, 167789822); pub const DIBUTTON_TPS_PAUSE = @as(u32, 167789820); pub const DIVIRTUAL_STRATEGY_ROLEPLAYING = @as(u32, 184549376); pub const DIAXIS_STRATEGYR_LATERAL = @as(u32, 184582657); pub const DIAXIS_STRATEGYR_MOVE = @as(u32, 184615426); pub const DIBUTTON_STRATEGYR_GET = @as(u32, 184550401); pub const DIBUTTON_STRATEGYR_APPLY = @as(u32, 184550402); pub const DIBUTTON_STRATEGYR_SELECT = @as(u32, 184550403); pub const DIBUTTON_STRATEGYR_ATTACK = @as(u32, 184550404); pub const DIBUTTON_STRATEGYR_CAST = @as(u32, 184550405); pub const DIBUTTON_STRATEGYR_CROUCH = @as(u32, 184550406); pub const DIBUTTON_STRATEGYR_JUMP = @as(u32, 184550407); pub const DIBUTTON_STRATEGYR_MENU = @as(u32, 184550653); pub const DIHATSWITCH_STRATEGYR_GLANCE = @as(u32, 184567297); pub const DIBUTTON_STRATEGYR_MAP = @as(u32, 184566792); pub const DIBUTTON_STRATEGYR_DISPLAY = @as(u32, 184566793); pub const DIAXIS_STRATEGYR_ROTATE = @as(u32, 184697347); pub const DIBUTTON_STRATEGYR_LEFT_LINK = @as(u32, 184599780); pub const DIBUTTON_STRATEGYR_RIGHT_LINK = @as(u32, 184599788); pub const DIBUTTON_STRATEGYR_FORWARD_LINK = @as(u32, 184632544); pub const DIBUTTON_STRATEGYR_BACK_LINK = @as(u32, 184632552); pub const DIBUTTON_STRATEGYR_ROTATE_LEFT_LINK = @as(u32, 184698084); pub const DIBUTTON_STRATEGYR_ROTATE_RIGHT_LINK = @as(u32, 184698092); pub const DIBUTTON_STRATEGYR_DEVICE = @as(u32, 184567038); pub const DIBUTTON_STRATEGYR_PAUSE = @as(u32, 184567036); pub const DIVIRTUAL_STRATEGY_TURN = @as(u32, 201326592); pub const DIAXIS_STRATEGYT_LATERAL = @as(u32, 201359873); pub const DIAXIS_STRATEGYT_MOVE = @as(u32, 201392642); pub const DIBUTTON_STRATEGYT_SELECT = @as(u32, 201327617); pub const DIBUTTON_STRATEGYT_INSTRUCT = @as(u32, 201327618); pub const DIBUTTON_STRATEGYT_APPLY = @as(u32, 201327619); pub const DIBUTTON_STRATEGYT_TEAM = @as(u32, 201327620); pub const DIBUTTON_STRATEGYT_TURN = @as(u32, 201327621); pub const DIBUTTON_STRATEGYT_MENU = @as(u32, 201327869); pub const DIBUTTON_STRATEGYT_ZOOM = @as(u32, 201344006); pub const DIBUTTON_STRATEGYT_MAP = @as(u32, 201344007); pub const DIBUTTON_STRATEGYT_DISPLAY = @as(u32, 201344008); pub const DIBUTTON_STRATEGYT_LEFT_LINK = @as(u32, 201376996); pub const DIBUTTON_STRATEGYT_RIGHT_LINK = @as(u32, 201377004); pub const DIBUTTON_STRATEGYT_FORWARD_LINK = @as(u32, 201409760); pub const DIBUTTON_STRATEGYT_BACK_LINK = @as(u32, 201409768); pub const DIBUTTON_STRATEGYT_DEVICE = @as(u32, 201344254); pub const DIBUTTON_STRATEGYT_PAUSE = @as(u32, 201344252); pub const DIVIRTUAL_SPORTS_HUNTING = @as(u32, 218103808); pub const DIAXIS_HUNTING_LATERAL = @as(u32, 218137089); pub const DIAXIS_HUNTING_MOVE = @as(u32, 218169858); pub const DIBUTTON_HUNTING_FIRE = @as(u32, 218104833); pub const DIBUTTON_HUNTING_AIM = @as(u32, 218104834); pub const DIBUTTON_HUNTING_WEAPON = @as(u32, 218104835); pub const DIBUTTON_HUNTING_BINOCULAR = @as(u32, 218104836); pub const DIBUTTON_HUNTING_CALL = @as(u32, 218104837); pub const DIBUTTON_HUNTING_MAP = @as(u32, 218104838); pub const DIBUTTON_HUNTING_SPECIAL = @as(u32, 218104839); pub const DIBUTTON_HUNTING_MENU = @as(u32, 218105085); pub const DIHATSWITCH_HUNTING_GLANCE = @as(u32, 218121729); pub const DIBUTTON_HUNTING_DISPLAY = @as(u32, 218121224); pub const DIAXIS_HUNTING_ROTATE = @as(u32, 218251779); pub const DIBUTTON_HUNTING_CROUCH = @as(u32, 218121225); pub const DIBUTTON_HUNTING_JUMP = @as(u32, 218121226); pub const DIBUTTON_HUNTING_FIRESECONDARY = @as(u32, 218121227); pub const DIBUTTON_HUNTING_LEFT_LINK = @as(u32, 218154212); pub const DIBUTTON_HUNTING_RIGHT_LINK = @as(u32, 218154220); pub const DIBUTTON_HUNTING_FORWARD_LINK = @as(u32, 218186976); pub const DIBUTTON_HUNTING_BACK_LINK = @as(u32, 218186984); pub const DIBUTTON_HUNTING_ROTATE_LEFT_LINK = @as(u32, 218252516); pub const DIBUTTON_HUNTING_ROTATE_RIGHT_LINK = @as(u32, 218252524); pub const DIBUTTON_HUNTING_DEVICE = @as(u32, 218121470); pub const DIBUTTON_HUNTING_PAUSE = @as(u32, 218121468); pub const DIVIRTUAL_SPORTS_FISHING = @as(u32, 234881024); pub const DIAXIS_FISHING_LATERAL = @as(u32, 234914305); pub const DIAXIS_FISHING_MOVE = @as(u32, 234947074); pub const DIBUTTON_FISHING_CAST = @as(u32, 234882049); pub const DIBUTTON_FISHING_TYPE = @as(u32, 234882050); pub const DIBUTTON_FISHING_BINOCULAR = @as(u32, 234882051); pub const DIBUTTON_FISHING_BAIT = @as(u32, 234882052); pub const DIBUTTON_FISHING_MAP = @as(u32, 234882053); pub const DIBUTTON_FISHING_MENU = @as(u32, 234882301); pub const DIHATSWITCH_FISHING_GLANCE = @as(u32, 234898945); pub const DIBUTTON_FISHING_DISPLAY = @as(u32, 234898438); pub const DIAXIS_FISHING_ROTATE = @as(u32, 235028995); pub const DIBUTTON_FISHING_CROUCH = @as(u32, 234898439); pub const DIBUTTON_FISHING_JUMP = @as(u32, 234898440); pub const DIBUTTON_FISHING_LEFT_LINK = @as(u32, 234931428); pub const DIBUTTON_FISHING_RIGHT_LINK = @as(u32, 234931436); pub const DIBUTTON_FISHING_FORWARD_LINK = @as(u32, 234964192); pub const DIBUTTON_FISHING_BACK_LINK = @as(u32, 234964200); pub const DIBUTTON_FISHING_ROTATE_LEFT_LINK = @as(u32, 235029732); pub const DIBUTTON_FISHING_ROTATE_RIGHT_LINK = @as(u32, 235029740); pub const DIBUTTON_FISHING_DEVICE = @as(u32, 234898686); pub const DIBUTTON_FISHING_PAUSE = @as(u32, 234898684); pub const DIVIRTUAL_SPORTS_BASEBALL_BAT = @as(u32, 251658240); pub const DIAXIS_BASEBALLB_LATERAL = @as(u32, 251691521); pub const DIAXIS_BASEBALLB_MOVE = @as(u32, 251724290); pub const DIBUTTON_BASEBALLB_SELECT = @as(u32, 251659265); pub const DIBUTTON_BASEBALLB_NORMAL = @as(u32, 251659266); pub const DIBUTTON_BASEBALLB_POWER = @as(u32, 251659267); pub const DIBUTTON_BASEBALLB_BUNT = @as(u32, 251659268); pub const DIBUTTON_BASEBALLB_STEAL = @as(u32, 251659269); pub const DIBUTTON_BASEBALLB_BURST = @as(u32, 251659270); pub const DIBUTTON_BASEBALLB_SLIDE = @as(u32, 251659271); pub const DIBUTTON_BASEBALLB_CONTACT = @as(u32, 251659272); pub const DIBUTTON_BASEBALLB_MENU = @as(u32, 251659517); pub const DIBUTTON_BASEBALLB_NOSTEAL = @as(u32, 251675657); pub const DIBUTTON_BASEBALLB_BOX = @as(u32, 251675658); pub const DIBUTTON_BASEBALLB_LEFT_LINK = @as(u32, 251708644); pub const DIBUTTON_BASEBALLB_RIGHT_LINK = @as(u32, 251708652); pub const DIBUTTON_BASEBALLB_FORWARD_LINK = @as(u32, 251741408); pub const DIBUTTON_BASEBALLB_BACK_LINK = @as(u32, 251741416); pub const DIBUTTON_BASEBALLB_DEVICE = @as(u32, 251675902); pub const DIBUTTON_BASEBALLB_PAUSE = @as(u32, 251675900); pub const DIVIRTUAL_SPORTS_BASEBALL_PITCH = @as(u32, 268435456); pub const DIAXIS_BASEBALLP_LATERAL = @as(u32, 268468737); pub const DIAXIS_BASEBALLP_MOVE = @as(u32, 268501506); pub const DIBUTTON_BASEBALLP_SELECT = @as(u32, 268436481); pub const DIBUTTON_BASEBALLP_PITCH = @as(u32, 268436482); pub const DIBUTTON_BASEBALLP_BASE = @as(u32, 268436483); pub const DIBUTTON_BASEBALLP_THROW = @as(u32, 268436484); pub const DIBUTTON_BASEBALLP_FAKE = @as(u32, 268436485); pub const DIBUTTON_BASEBALLP_MENU = @as(u32, 268436733); pub const DIBUTTON_BASEBALLP_WALK = @as(u32, 268452870); pub const DIBUTTON_BASEBALLP_LOOK = @as(u32, 268452871); pub const DIBUTTON_BASEBALLP_LEFT_LINK = @as(u32, 268485860); pub const DIBUTTON_BASEBALLP_RIGHT_LINK = @as(u32, 268485868); pub const DIBUTTON_BASEBALLP_FORWARD_LINK = @as(u32, 268518624); pub const DIBUTTON_BASEBALLP_BACK_LINK = @as(u32, 268518632); pub const DIBUTTON_BASEBALLP_DEVICE = @as(u32, 268453118); pub const DIBUTTON_BASEBALLP_PAUSE = @as(u32, 268453116); pub const DIVIRTUAL_SPORTS_BASEBALL_FIELD = @as(u32, 285212672); pub const DIAXIS_BASEBALLF_LATERAL = @as(u32, 285245953); pub const DIAXIS_BASEBALLF_MOVE = @as(u32, 285278722); pub const DIBUTTON_BASEBALLF_NEAREST = @as(u32, 285213697); pub const DIBUTTON_BASEBALLF_THROW1 = @as(u32, 285213698); pub const DIBUTTON_BASEBALLF_THROW2 = @as(u32, 285213699); pub const DIBUTTON_BASEBALLF_BURST = @as(u32, 285213700); pub const DIBUTTON_BASEBALLF_JUMP = @as(u32, 285213701); pub const DIBUTTON_BASEBALLF_DIVE = @as(u32, 285213702); pub const DIBUTTON_BASEBALLF_MENU = @as(u32, 285213949); pub const DIBUTTON_BASEBALLF_SHIFTIN = @as(u32, 285230087); pub const DIBUTTON_BASEBALLF_SHIFTOUT = @as(u32, 285230088); pub const DIBUTTON_BASEBALLF_AIM_LEFT_LINK = @as(u32, 285263076); pub const DIBUTTON_BASEBALLF_AIM_RIGHT_LINK = @as(u32, 285263084); pub const DIBUTTON_BASEBALLF_FORWARD_LINK = @as(u32, 285295840); pub const DIBUTTON_BASEBALLF_BACK_LINK = @as(u32, 285295848); pub const DIBUTTON_BASEBALLF_DEVICE = @as(u32, 285230334); pub const DIBUTTON_BASEBALLF_PAUSE = @as(u32, 285230332); pub const DIVIRTUAL_SPORTS_BASKETBALL_OFFENSE = @as(u32, 301989888); pub const DIAXIS_BBALLO_LATERAL = @as(u32, 302023169); pub const DIAXIS_BBALLO_MOVE = @as(u32, 302055938); pub const DIBUTTON_BBALLO_SHOOT = @as(u32, 301990913); pub const DIBUTTON_BBALLO_DUNK = @as(u32, 301990914); pub const DIBUTTON_BBALLO_PASS = @as(u32, 301990915); pub const DIBUTTON_BBALLO_FAKE = @as(u32, 301990916); pub const DIBUTTON_BBALLO_SPECIAL = @as(u32, 301990917); pub const DIBUTTON_BBALLO_PLAYER = @as(u32, 301990918); pub const DIBUTTON_BBALLO_BURST = @as(u32, 301990919); pub const DIBUTTON_BBALLO_CALL = @as(u32, 301990920); pub const DIBUTTON_BBALLO_MENU = @as(u32, 301991165); pub const DIHATSWITCH_BBALLO_GLANCE = @as(u32, 302007809); pub const DIBUTTON_BBALLO_SCREEN = @as(u32, 302007305); pub const DIBUTTON_BBALLO_PLAY = @as(u32, 302007306); pub const DIBUTTON_BBALLO_JAB = @as(u32, 302007307); pub const DIBUTTON_BBALLO_POST = @as(u32, 302007308); pub const DIBUTTON_BBALLO_TIMEOUT = @as(u32, 302007309); pub const DIBUTTON_BBALLO_SUBSTITUTE = @as(u32, 302007310); pub const DIBUTTON_BBALLO_LEFT_LINK = @as(u32, 302040292); pub const DIBUTTON_BBALLO_RIGHT_LINK = @as(u32, 302040300); pub const DIBUTTON_BBALLO_FORWARD_LINK = @as(u32, 302073056); pub const DIBUTTON_BBALLO_BACK_LINK = @as(u32, 302073064); pub const DIBUTTON_BBALLO_DEVICE = @as(u32, 302007550); pub const DIBUTTON_BBALLO_PAUSE = @as(u32, 302007548); pub const DIVIRTUAL_SPORTS_BASKETBALL_DEFENSE = @as(u32, 318767104); pub const DIAXIS_BBALLD_LATERAL = @as(u32, 318800385); pub const DIAXIS_BBALLD_MOVE = @as(u32, 318833154); pub const DIBUTTON_BBALLD_JUMP = @as(u32, 318768129); pub const DIBUTTON_BBALLD_STEAL = @as(u32, 318768130); pub const DIBUTTON_BBALLD_FAKE = @as(u32, 318768131); pub const DIBUTTON_BBALLD_SPECIAL = @as(u32, 318768132); pub const DIBUTTON_BBALLD_PLAYER = @as(u32, 318768133); pub const DIBUTTON_BBALLD_BURST = @as(u32, 318768134); pub const DIBUTTON_BBALLD_PLAY = @as(u32, 318768135); pub const DIBUTTON_BBALLD_MENU = @as(u32, 318768381); pub const DIHATSWITCH_BBALLD_GLANCE = @as(u32, 318785025); pub const DIBUTTON_BBALLD_TIMEOUT = @as(u32, 318784520); pub const DIBUTTON_BBALLD_SUBSTITUTE = @as(u32, 318784521); pub const DIBUTTON_BBALLD_LEFT_LINK = @as(u32, 318817508); pub const DIBUTTON_BBALLD_RIGHT_LINK = @as(u32, 318817516); pub const DIBUTTON_BBALLD_FORWARD_LINK = @as(u32, 318850272); pub const DIBUTTON_BBALLD_BACK_LINK = @as(u32, 318850280); pub const DIBUTTON_BBALLD_DEVICE = @as(u32, 318784766); pub const DIBUTTON_BBALLD_PAUSE = @as(u32, 318784764); pub const DIVIRTUAL_SPORTS_FOOTBALL_FIELD = @as(u32, 335544320); pub const DIBUTTON_FOOTBALLP_PLAY = @as(u32, 335545345); pub const DIBUTTON_FOOTBALLP_SELECT = @as(u32, 335545346); pub const DIBUTTON_FOOTBALLP_HELP = @as(u32, 335545347); pub const DIBUTTON_FOOTBALLP_MENU = @as(u32, 335545597); pub const DIBUTTON_FOOTBALLP_DEVICE = @as(u32, 335561982); pub const DIBUTTON_FOOTBALLP_PAUSE = @as(u32, 335561980); pub const DIVIRTUAL_SPORTS_FOOTBALL_QBCK = @as(u32, 352321536); pub const DIAXIS_FOOTBALLQ_LATERAL = @as(u32, 352354817); pub const DIAXIS_FOOTBALLQ_MOVE = @as(u32, 352387586); pub const DIBUTTON_FOOTBALLQ_SELECT = @as(u32, 352322561); pub const DIBUTTON_FOOTBALLQ_SNAP = @as(u32, 352322562); pub const DIBUTTON_FOOTBALLQ_JUMP = @as(u32, 352322563); pub const DIBUTTON_FOOTBALLQ_SLIDE = @as(u32, 352322564); pub const DIBUTTON_FOOTBALLQ_PASS = @as(u32, 352322565); pub const DIBUTTON_FOOTBALLQ_FAKE = @as(u32, 352322566); pub const DIBUTTON_FOOTBALLQ_MENU = @as(u32, 352322813); pub const DIBUTTON_FOOTBALLQ_FAKESNAP = @as(u32, 352338951); pub const DIBUTTON_FOOTBALLQ_MOTION = @as(u32, 352338952); pub const DIBUTTON_FOOTBALLQ_AUDIBLE = @as(u32, 352338953); pub const DIBUTTON_FOOTBALLQ_LEFT_LINK = @as(u32, 352371940); pub const DIBUTTON_FOOTBALLQ_RIGHT_LINK = @as(u32, 352371948); pub const DIBUTTON_FOOTBALLQ_FORWARD_LINK = @as(u32, 352404704); pub const DIBUTTON_FOOTBALLQ_BACK_LINK = @as(u32, 352404712); pub const DIBUTTON_FOOTBALLQ_DEVICE = @as(u32, 352339198); pub const DIBUTTON_FOOTBALLQ_PAUSE = @as(u32, 352339196); pub const DIVIRTUAL_SPORTS_FOOTBALL_OFFENSE = @as(u32, 369098752); pub const DIAXIS_FOOTBALLO_LATERAL = @as(u32, 369132033); pub const DIAXIS_FOOTBALLO_MOVE = @as(u32, 369164802); pub const DIBUTTON_FOOTBALLO_JUMP = @as(u32, 369099777); pub const DIBUTTON_FOOTBALLO_LEFTARM = @as(u32, 369099778); pub const DIBUTTON_FOOTBALLO_RIGHTARM = @as(u32, 369099779); pub const DIBUTTON_FOOTBALLO_THROW = @as(u32, 369099780); pub const DIBUTTON_FOOTBALLO_SPIN = @as(u32, 369099781); pub const DIBUTTON_FOOTBALLO_MENU = @as(u32, 369100029); pub const DIBUTTON_FOOTBALLO_JUKE = @as(u32, 369116166); pub const DIBUTTON_FOOTBALLO_SHOULDER = @as(u32, 369116167); pub const DIBUTTON_FOOTBALLO_TURBO = @as(u32, 369116168); pub const DIBUTTON_FOOTBALLO_DIVE = @as(u32, 369116169); pub const DIBUTTON_FOOTBALLO_ZOOM = @as(u32, 369116170); pub const DIBUTTON_FOOTBALLO_SUBSTITUTE = @as(u32, 369116171); pub const DIBUTTON_FOOTBALLO_LEFT_LINK = @as(u32, 369149156); pub const DIBUTTON_FOOTBALLO_RIGHT_LINK = @as(u32, 369149164); pub const DIBUTTON_FOOTBALLO_FORWARD_LINK = @as(u32, 369181920); pub const DIBUTTON_FOOTBALLO_BACK_LINK = @as(u32, 369181928); pub const DIBUTTON_FOOTBALLO_DEVICE = @as(u32, 369116414); pub const DIBUTTON_FOOTBALLO_PAUSE = @as(u32, 369116412); pub const DIVIRTUAL_SPORTS_FOOTBALL_DEFENSE = @as(u32, 385875968); pub const DIAXIS_FOOTBALLD_LATERAL = @as(u32, 385909249); pub const DIAXIS_FOOTBALLD_MOVE = @as(u32, 385942018); pub const DIBUTTON_FOOTBALLD_PLAY = @as(u32, 385876993); pub const DIBUTTON_FOOTBALLD_SELECT = @as(u32, 385876994); pub const DIBUTTON_FOOTBALLD_JUMP = @as(u32, 385876995); pub const DIBUTTON_FOOTBALLD_TACKLE = @as(u32, 385876996); pub const DIBUTTON_FOOTBALLD_FAKE = @as(u32, 385876997); pub const DIBUTTON_FOOTBALLD_SUPERTACKLE = @as(u32, 385876998); pub const DIBUTTON_FOOTBALLD_MENU = @as(u32, 385877245); pub const DIBUTTON_FOOTBALLD_SPIN = @as(u32, 385893383); pub const DIBUTTON_FOOTBALLD_SWIM = @as(u32, 385893384); pub const DIBUTTON_FOOTBALLD_BULLRUSH = @as(u32, 385893385); pub const DIBUTTON_FOOTBALLD_RIP = @as(u32, 385893386); pub const DIBUTTON_FOOTBALLD_AUDIBLE = @as(u32, 385893387); pub const DIBUTTON_FOOTBALLD_ZOOM = @as(u32, 385893388); pub const DIBUTTON_FOOTBALLD_SUBSTITUTE = @as(u32, 385893389); pub const DIBUTTON_FOOTBALLD_LEFT_LINK = @as(u32, 385926372); pub const DIBUTTON_FOOTBALLD_RIGHT_LINK = @as(u32, 385926380); pub const DIBUTTON_FOOTBALLD_FORWARD_LINK = @as(u32, 385959136); pub const DIBUTTON_FOOTBALLD_BACK_LINK = @as(u32, 385959144); pub const DIBUTTON_FOOTBALLD_DEVICE = @as(u32, 385893630); pub const DIBUTTON_FOOTBALLD_PAUSE = @as(u32, 385893628); pub const DIVIRTUAL_SPORTS_GOLF = @as(u32, 402653184); pub const DIAXIS_GOLF_LATERAL = @as(u32, 402686465); pub const DIAXIS_GOLF_MOVE = @as(u32, 402719234); pub const DIBUTTON_GOLF_SWING = @as(u32, 402654209); pub const DIBUTTON_GOLF_SELECT = @as(u32, 402654210); pub const DIBUTTON_GOLF_UP = @as(u32, 402654211); pub const DIBUTTON_GOLF_DOWN = @as(u32, 402654212); pub const DIBUTTON_GOLF_TERRAIN = @as(u32, 402654213); pub const DIBUTTON_GOLF_FLYBY = @as(u32, 402654214); pub const DIBUTTON_GOLF_MENU = @as(u32, 402654461); pub const DIHATSWITCH_GOLF_SCROLL = @as(u32, 402671105); pub const DIBUTTON_GOLF_ZOOM = @as(u32, 402670599); pub const DIBUTTON_GOLF_TIMEOUT = @as(u32, 402670600); pub const DIBUTTON_GOLF_SUBSTITUTE = @as(u32, 402670601); pub const DIBUTTON_GOLF_LEFT_LINK = @as(u32, 402703588); pub const DIBUTTON_GOLF_RIGHT_LINK = @as(u32, 402703596); pub const DIBUTTON_GOLF_FORWARD_LINK = @as(u32, 402736352); pub const DIBUTTON_GOLF_BACK_LINK = @as(u32, 402736360); pub const DIBUTTON_GOLF_DEVICE = @as(u32, 402670846); pub const DIBUTTON_GOLF_PAUSE = @as(u32, 402670844); pub const DIVIRTUAL_SPORTS_HOCKEY_OFFENSE = @as(u32, 419430400); pub const DIAXIS_HOCKEYO_LATERAL = @as(u32, 419463681); pub const DIAXIS_HOCKEYO_MOVE = @as(u32, 419496450); pub const DIBUTTON_HOCKEYO_SHOOT = @as(u32, 419431425); pub const DIBUTTON_HOCKEYO_PASS = @as(u32, 419431426); pub const DIBUTTON_HOCKEYO_BURST = @as(u32, 419431427); pub const DIBUTTON_HOCKEYO_SPECIAL = @as(u32, 419431428); pub const DIBUTTON_HOCKEYO_FAKE = @as(u32, 419431429); pub const DIBUTTON_HOCKEYO_MENU = @as(u32, 419431677); pub const DIHATSWITCH_HOCKEYO_SCROLL = @as(u32, 419448321); pub const DIBUTTON_HOCKEYO_ZOOM = @as(u32, 419447814); pub const DIBUTTON_HOCKEYO_STRATEGY = @as(u32, 419447815); pub const DIBUTTON_HOCKEYO_TIMEOUT = @as(u32, 419447816); pub const DIBUTTON_HOCKEYO_SUBSTITUTE = @as(u32, 419447817); pub const DIBUTTON_HOCKEYO_LEFT_LINK = @as(u32, 419480804); pub const DIBUTTON_HOCKEYO_RIGHT_LINK = @as(u32, 419480812); pub const DIBUTTON_HOCKEYO_FORWARD_LINK = @as(u32, 419513568); pub const DIBUTTON_HOCKEYO_BACK_LINK = @as(u32, 419513576); pub const DIBUTTON_HOCKEYO_DEVICE = @as(u32, 419448062); pub const DIBUTTON_HOCKEYO_PAUSE = @as(u32, 419448060); pub const DIVIRTUAL_SPORTS_HOCKEY_DEFENSE = @as(u32, 436207616); pub const DIAXIS_HOCKEYD_LATERAL = @as(u32, 436240897); pub const DIAXIS_HOCKEYD_MOVE = @as(u32, 436273666); pub const DIBUTTON_HOCKEYD_PLAYER = @as(u32, 436208641); pub const DIBUTTON_HOCKEYD_STEAL = @as(u32, 436208642); pub const DIBUTTON_HOCKEYD_BURST = @as(u32, 436208643); pub const DIBUTTON_HOCKEYD_BLOCK = @as(u32, 436208644); pub const DIBUTTON_HOCKEYD_FAKE = @as(u32, 436208645); pub const DIBUTTON_HOCKEYD_MENU = @as(u32, 436208893); pub const DIHATSWITCH_HOCKEYD_SCROLL = @as(u32, 436225537); pub const DIBUTTON_HOCKEYD_ZOOM = @as(u32, 436225030); pub const DIBUTTON_HOCKEYD_STRATEGY = @as(u32, 436225031); pub const DIBUTTON_HOCKEYD_TIMEOUT = @as(u32, 436225032); pub const DIBUTTON_HOCKEYD_SUBSTITUTE = @as(u32, 436225033); pub const DIBUTTON_HOCKEYD_LEFT_LINK = @as(u32, 436258020); pub const DIBUTTON_HOCKEYD_RIGHT_LINK = @as(u32, 436258028); pub const DIBUTTON_HOCKEYD_FORWARD_LINK = @as(u32, 436290784); pub const DIBUTTON_HOCKEYD_BACK_LINK = @as(u32, 436290792); pub const DIBUTTON_HOCKEYD_DEVICE = @as(u32, 436225278); pub const DIBUTTON_HOCKEYD_PAUSE = @as(u32, 436225276); pub const DIVIRTUAL_SPORTS_HOCKEY_GOALIE = @as(u32, 452984832); pub const DIAXIS_HOCKEYG_LATERAL = @as(u32, 453018113); pub const DIAXIS_HOCKEYG_MOVE = @as(u32, 453050882); pub const DIBUTTON_HOCKEYG_PASS = @as(u32, 452985857); pub const DIBUTTON_HOCKEYG_POKE = @as(u32, 452985858); pub const DIBUTTON_HOCKEYG_STEAL = @as(u32, 452985859); pub const DIBUTTON_HOCKEYG_BLOCK = @as(u32, 452985860); pub const DIBUTTON_HOCKEYG_MENU = @as(u32, 452986109); pub const DIHATSWITCH_HOCKEYG_SCROLL = @as(u32, 453002753); pub const DIBUTTON_HOCKEYG_ZOOM = @as(u32, 453002245); pub const DIBUTTON_HOCKEYG_STRATEGY = @as(u32, 453002246); pub const DIBUTTON_HOCKEYG_TIMEOUT = @as(u32, 453002247); pub const DIBUTTON_HOCKEYG_SUBSTITUTE = @as(u32, 453002248); pub const DIBUTTON_HOCKEYG_LEFT_LINK = @as(u32, 453035236); pub const DIBUTTON_HOCKEYG_RIGHT_LINK = @as(u32, 453035244); pub const DIBUTTON_HOCKEYG_FORWARD_LINK = @as(u32, 453068000); pub const DIBUTTON_HOCKEYG_BACK_LINK = @as(u32, 453068008); pub const DIBUTTON_HOCKEYG_DEVICE = @as(u32, 453002494); pub const DIBUTTON_HOCKEYG_PAUSE = @as(u32, 453002492); pub const DIVIRTUAL_SPORTS_BIKING_MOUNTAIN = @as(u32, 469762048); pub const DIAXIS_BIKINGM_TURN = @as(u32, 469795329); pub const DIAXIS_BIKINGM_PEDAL = @as(u32, 469828098); pub const DIBUTTON_BIKINGM_JUMP = @as(u32, 469763073); pub const DIBUTTON_BIKINGM_CAMERA = @as(u32, 469763074); pub const DIBUTTON_BIKINGM_SPECIAL1 = @as(u32, 469763075); pub const DIBUTTON_BIKINGM_SELECT = @as(u32, 469763076); pub const DIBUTTON_BIKINGM_SPECIAL2 = @as(u32, 469763077); pub const DIBUTTON_BIKINGM_MENU = @as(u32, 469763325); pub const DIHATSWITCH_BIKINGM_SCROLL = @as(u32, 469779969); pub const DIBUTTON_BIKINGM_ZOOM = @as(u32, 469779462); pub const DIAXIS_BIKINGM_BRAKE = @as(u32, 470041091); pub const DIBUTTON_BIKINGM_LEFT_LINK = @as(u32, 469812452); pub const DIBUTTON_BIKINGM_RIGHT_LINK = @as(u32, 469812460); pub const DIBUTTON_BIKINGM_FASTER_LINK = @as(u32, 469845216); pub const DIBUTTON_BIKINGM_SLOWER_LINK = @as(u32, 469845224); pub const DIBUTTON_BIKINGM_BRAKE_BUTTON_LINK = @as(u32, 470041832); pub const DIBUTTON_BIKINGM_DEVICE = @as(u32, 469779710); pub const DIBUTTON_BIKINGM_PAUSE = @as(u32, 469779708); pub const DIVIRTUAL_SPORTS_SKIING = @as(u32, 486539264); pub const DIAXIS_SKIING_TURN = @as(u32, 486572545); pub const DIAXIS_SKIING_SPEED = @as(u32, 486605314); pub const DIBUTTON_SKIING_JUMP = @as(u32, 486540289); pub const DIBUTTON_SKIING_CROUCH = @as(u32, 486540290); pub const DIBUTTON_SKIING_CAMERA = @as(u32, 486540291); pub const DIBUTTON_SKIING_SPECIAL1 = @as(u32, 486540292); pub const DIBUTTON_SKIING_SELECT = @as(u32, 486540293); pub const DIBUTTON_SKIING_SPECIAL2 = @as(u32, 486540294); pub const DIBUTTON_SKIING_MENU = @as(u32, 486540541); pub const DIHATSWITCH_SKIING_GLANCE = @as(u32, 486557185); pub const DIBUTTON_SKIING_ZOOM = @as(u32, 486556679); pub const DIBUTTON_SKIING_LEFT_LINK = @as(u32, 486589668); pub const DIBUTTON_SKIING_RIGHT_LINK = @as(u32, 486589676); pub const DIBUTTON_SKIING_FASTER_LINK = @as(u32, 486622432); pub const DIBUTTON_SKIING_SLOWER_LINK = @as(u32, 486622440); pub const DIBUTTON_SKIING_DEVICE = @as(u32, 486556926); pub const DIBUTTON_SKIING_PAUSE = @as(u32, 486556924); pub const DIVIRTUAL_SPORTS_SOCCER_OFFENSE = @as(u32, 503316480); pub const DIAXIS_SOCCERO_LATERAL = @as(u32, 503349761); pub const DIAXIS_SOCCERO_MOVE = @as(u32, 503382530); pub const DIAXIS_SOCCERO_BEND = @as(u32, 503415299); pub const DIBUTTON_SOCCERO_SHOOT = @as(u32, 503317505); pub const DIBUTTON_SOCCERO_PASS = @as(u32, 503317506); pub const DIBUTTON_SOCCERO_FAKE = @as(u32, 503317507); pub const DIBUTTON_SOCCERO_PLAYER = @as(u32, 503317508); pub const DIBUTTON_SOCCERO_SPECIAL1 = @as(u32, 503317509); pub const DIBUTTON_SOCCERO_SELECT = @as(u32, 503317510); pub const DIBUTTON_SOCCERO_MENU = @as(u32, 503317757); pub const DIHATSWITCH_SOCCERO_GLANCE = @as(u32, 503334401); pub const DIBUTTON_SOCCERO_SUBSTITUTE = @as(u32, 503333895); pub const DIBUTTON_SOCCERO_SHOOTLOW = @as(u32, 503333896); pub const DIBUTTON_SOCCERO_SHOOTHIGH = @as(u32, 503333897); pub const DIBUTTON_SOCCERO_PASSTHRU = @as(u32, 503333898); pub const DIBUTTON_SOCCERO_SPRINT = @as(u32, 503333899); pub const DIBUTTON_SOCCERO_CONTROL = @as(u32, 503333900); pub const DIBUTTON_SOCCERO_HEAD = @as(u32, 503333901); pub const DIBUTTON_SOCCERO_LEFT_LINK = @as(u32, 503366884); pub const DIBUTTON_SOCCERO_RIGHT_LINK = @as(u32, 503366892); pub const DIBUTTON_SOCCERO_FORWARD_LINK = @as(u32, 503399648); pub const DIBUTTON_SOCCERO_BACK_LINK = @as(u32, 503399656); pub const DIBUTTON_SOCCERO_DEVICE = @as(u32, 503334142); pub const DIBUTTON_SOCCERO_PAUSE = @as(u32, 503334140); pub const DIVIRTUAL_SPORTS_SOCCER_DEFENSE = @as(u32, 520093696); pub const DIAXIS_SOCCERD_LATERAL = @as(u32, 520126977); pub const DIAXIS_SOCCERD_MOVE = @as(u32, 520159746); pub const DIBUTTON_SOCCERD_BLOCK = @as(u32, 520094721); pub const DIBUTTON_SOCCERD_STEAL = @as(u32, 520094722); pub const DIBUTTON_SOCCERD_FAKE = @as(u32, 520094723); pub const DIBUTTON_SOCCERD_PLAYER = @as(u32, 520094724); pub const DIBUTTON_SOCCERD_SPECIAL = @as(u32, 520094725); pub const DIBUTTON_SOCCERD_SELECT = @as(u32, 520094726); pub const DIBUTTON_SOCCERD_SLIDE = @as(u32, 520094727); pub const DIBUTTON_SOCCERD_MENU = @as(u32, 520094973); pub const DIHATSWITCH_SOCCERD_GLANCE = @as(u32, 520111617); pub const DIBUTTON_SOCCERD_FOUL = @as(u32, 520111112); pub const DIBUTTON_SOCCERD_HEAD = @as(u32, 520111113); pub const DIBUTTON_SOCCERD_CLEAR = @as(u32, 520111114); pub const DIBUTTON_SOCCERD_GOALIECHARGE = @as(u32, 520111115); pub const DIBUTTON_SOCCERD_SUBSTITUTE = @as(u32, 520111116); pub const DIBUTTON_SOCCERD_LEFT_LINK = @as(u32, 520144100); pub const DIBUTTON_SOCCERD_RIGHT_LINK = @as(u32, 520144108); pub const DIBUTTON_SOCCERD_FORWARD_LINK = @as(u32, 520176864); pub const DIBUTTON_SOCCERD_BACK_LINK = @as(u32, 520176872); pub const DIBUTTON_SOCCERD_DEVICE = @as(u32, 520111358); pub const DIBUTTON_SOCCERD_PAUSE = @as(u32, 520111356); pub const DIVIRTUAL_SPORTS_RACQUET = @as(u32, 536870912); pub const DIAXIS_RACQUET_LATERAL = @as(u32, 536904193); pub const DIAXIS_RACQUET_MOVE = @as(u32, 536936962); pub const DIBUTTON_RACQUET_SWING = @as(u32, 536871937); pub const DIBUTTON_RACQUET_BACKSWING = @as(u32, 536871938); pub const DIBUTTON_RACQUET_SMASH = @as(u32, 536871939); pub const DIBUTTON_RACQUET_SPECIAL = @as(u32, 536871940); pub const DIBUTTON_RACQUET_SELECT = @as(u32, 536871941); pub const DIBUTTON_RACQUET_MENU = @as(u32, 536872189); pub const DIHATSWITCH_RACQUET_GLANCE = @as(u32, 536888833); pub const DIBUTTON_RACQUET_TIMEOUT = @as(u32, 536888326); pub const DIBUTTON_RACQUET_SUBSTITUTE = @as(u32, 536888327); pub const DIBUTTON_RACQUET_LEFT_LINK = @as(u32, 536921316); pub const DIBUTTON_RACQUET_RIGHT_LINK = @as(u32, 536921324); pub const DIBUTTON_RACQUET_FORWARD_LINK = @as(u32, 536954080); pub const DIBUTTON_RACQUET_BACK_LINK = @as(u32, 536954088); pub const DIBUTTON_RACQUET_DEVICE = @as(u32, 536888574); pub const DIBUTTON_RACQUET_PAUSE = @as(u32, 536888572); pub const DIVIRTUAL_ARCADE_SIDE2SIDE = @as(u32, 553648128); pub const DIAXIS_ARCADES_LATERAL = @as(u32, 553681409); pub const DIAXIS_ARCADES_MOVE = @as(u32, 553714178); pub const DIBUTTON_ARCADES_THROW = @as(u32, 553649153); pub const DIBUTTON_ARCADES_CARRY = @as(u32, 553649154); pub const DIBUTTON_ARCADES_ATTACK = @as(u32, 553649155); pub const DIBUTTON_ARCADES_SPECIAL = @as(u32, 553649156); pub const DIBUTTON_ARCADES_SELECT = @as(u32, 553649157); pub const DIBUTTON_ARCADES_MENU = @as(u32, 553649405); pub const DIHATSWITCH_ARCADES_VIEW = @as(u32, 553666049); pub const DIBUTTON_ARCADES_LEFT_LINK = @as(u32, 553698532); pub const DIBUTTON_ARCADES_RIGHT_LINK = @as(u32, 553698540); pub const DIBUTTON_ARCADES_FORWARD_LINK = @as(u32, 553731296); pub const DIBUTTON_ARCADES_BACK_LINK = @as(u32, 553731304); pub const DIBUTTON_ARCADES_VIEW_UP_LINK = @as(u32, 554157280); pub const DIBUTTON_ARCADES_VIEW_DOWN_LINK = @as(u32, 554157288); pub const DIBUTTON_ARCADES_VIEW_LEFT_LINK = @as(u32, 554157284); pub const DIBUTTON_ARCADES_VIEW_RIGHT_LINK = @as(u32, 554157292); pub const DIBUTTON_ARCADES_DEVICE = @as(u32, 553665790); pub const DIBUTTON_ARCADES_PAUSE = @as(u32, 553665788); pub const DIVIRTUAL_ARCADE_PLATFORM = @as(u32, 570425344); pub const DIAXIS_ARCADEP_LATERAL = @as(u32, 570458625); pub const DIAXIS_ARCADEP_MOVE = @as(u32, 570491394); pub const DIBUTTON_ARCADEP_JUMP = @as(u32, 570426369); pub const DIBUTTON_ARCADEP_FIRE = @as(u32, 570426370); pub const DIBUTTON_ARCADEP_CROUCH = @as(u32, 570426371); pub const DIBUTTON_ARCADEP_SPECIAL = @as(u32, 570426372); pub const DIBUTTON_ARCADEP_SELECT = @as(u32, 570426373); pub const DIBUTTON_ARCADEP_MENU = @as(u32, 570426621); pub const DIHATSWITCH_ARCADEP_VIEW = @as(u32, 570443265); pub const DIBUTTON_ARCADEP_FIRESECONDARY = @as(u32, 570442758); pub const DIBUTTON_ARCADEP_LEFT_LINK = @as(u32, 570475748); pub const DIBUTTON_ARCADEP_RIGHT_LINK = @as(u32, 570475756); pub const DIBUTTON_ARCADEP_FORWARD_LINK = @as(u32, 570508512); pub const DIBUTTON_ARCADEP_BACK_LINK = @as(u32, 570508520); pub const DIBUTTON_ARCADEP_VIEW_UP_LINK = @as(u32, 570934496); pub const DIBUTTON_ARCADEP_VIEW_DOWN_LINK = @as(u32, 570934504); pub const DIBUTTON_ARCADEP_VIEW_LEFT_LINK = @as(u32, 570934500); pub const DIBUTTON_ARCADEP_VIEW_RIGHT_LINK = @as(u32, 570934508); pub const DIBUTTON_ARCADEP_DEVICE = @as(u32, 570443006); pub const DIBUTTON_ARCADEP_PAUSE = @as(u32, 570443004); pub const DIVIRTUAL_CAD_2DCONTROL = @as(u32, 587202560); pub const DIAXIS_2DCONTROL_LATERAL = @as(u32, 587235841); pub const DIAXIS_2DCONTROL_MOVE = @as(u32, 587268610); pub const DIAXIS_2DCONTROL_INOUT = @as(u32, 587301379); pub const DIBUTTON_2DCONTROL_SELECT = @as(u32, 587203585); pub const DIBUTTON_2DCONTROL_SPECIAL1 = @as(u32, 587203586); pub const DIBUTTON_2DCONTROL_SPECIAL = @as(u32, 587203587); pub const DIBUTTON_2DCONTROL_SPECIAL2 = @as(u32, 587203588); pub const DIBUTTON_2DCONTROL_MENU = @as(u32, 587203837); pub const DIHATSWITCH_2DCONTROL_HATSWITCH = @as(u32, 587220481); pub const DIAXIS_2DCONTROL_ROTATEZ = @as(u32, 587350532); pub const DIBUTTON_2DCONTROL_DISPLAY = @as(u32, 587219973); pub const DIBUTTON_2DCONTROL_DEVICE = @as(u32, 587220222); pub const DIBUTTON_2DCONTROL_PAUSE = @as(u32, 587220220); pub const DIVIRTUAL_CAD_3DCONTROL = @as(u32, 603979776); pub const DIAXIS_3DCONTROL_LATERAL = @as(u32, 604013057); pub const DIAXIS_3DCONTROL_MOVE = @as(u32, 604045826); pub const DIAXIS_3DCONTROL_INOUT = @as(u32, 604078595); pub const DIBUTTON_3DCONTROL_SELECT = @as(u32, 603980801); pub const DIBUTTON_3DCONTROL_SPECIAL1 = @as(u32, 603980802); pub const DIBUTTON_3DCONTROL_SPECIAL = @as(u32, 603980803); pub const DIBUTTON_3DCONTROL_SPECIAL2 = @as(u32, 603980804); pub const DIBUTTON_3DCONTROL_MENU = @as(u32, 603981053); pub const DIHATSWITCH_3DCONTROL_HATSWITCH = @as(u32, 603997697); pub const DIAXIS_3DCONTROL_ROTATEX = @as(u32, 604193284); pub const DIAXIS_3DCONTROL_ROTATEY = @as(u32, 604160517); pub const DIAXIS_3DCONTROL_ROTATEZ = @as(u32, 604127750); pub const DIBUTTON_3DCONTROL_DISPLAY = @as(u32, 603997189); pub const DIBUTTON_3DCONTROL_DEVICE = @as(u32, 603997438); pub const DIBUTTON_3DCONTROL_PAUSE = @as(u32, 603997436); pub const DIVIRTUAL_CAD_FLYBY = @as(u32, 620756992); pub const DIAXIS_CADF_LATERAL = @as(u32, 620790273); pub const DIAXIS_CADF_MOVE = @as(u32, 620823042); pub const DIAXIS_CADF_INOUT = @as(u32, 620855811); pub const DIBUTTON_CADF_SELECT = @as(u32, 620758017); pub const DIBUTTON_CADF_SPECIAL1 = @as(u32, 620758018); pub const DIBUTTON_CADF_SPECIAL = @as(u32, 620758019); pub const DIBUTTON_CADF_SPECIAL2 = @as(u32, 620758020); pub const DIBUTTON_CADF_MENU = @as(u32, 620758269); pub const DIHATSWITCH_CADF_HATSWITCH = @as(u32, 620774913); pub const DIAXIS_CADF_ROTATEX = @as(u32, 620970500); pub const DIAXIS_CADF_ROTATEY = @as(u32, 620937733); pub const DIAXIS_CADF_ROTATEZ = @as(u32, 620904966); pub const DIBUTTON_CADF_DISPLAY = @as(u32, 620774405); pub const DIBUTTON_CADF_DEVICE = @as(u32, 620774654); pub const DIBUTTON_CADF_PAUSE = @as(u32, 620774652); pub const DIVIRTUAL_CAD_MODEL = @as(u32, 637534208); pub const DIAXIS_CADM_LATERAL = @as(u32, 637567489); pub const DIAXIS_CADM_MOVE = @as(u32, 637600258); pub const DIAXIS_CADM_INOUT = @as(u32, 637633027); pub const DIBUTTON_CADM_SELECT = @as(u32, 637535233); pub const DIBUTTON_CADM_SPECIAL1 = @as(u32, 637535234); pub const DIBUTTON_CADM_SPECIAL = @as(u32, 637535235); pub const DIBUTTON_CADM_SPECIAL2 = @as(u32, 637535236); pub const DIBUTTON_CADM_MENU = @as(u32, 637535485); pub const DIHATSWITCH_CADM_HATSWITCH = @as(u32, 637552129); pub const DIAXIS_CADM_ROTATEX = @as(u32, 637747716); pub const DIAXIS_CADM_ROTATEY = @as(u32, 637714949); pub const DIAXIS_CADM_ROTATEZ = @as(u32, 637682182); pub const DIBUTTON_CADM_DISPLAY = @as(u32, 637551621); pub const DIBUTTON_CADM_DEVICE = @as(u32, 637551870); pub const DIBUTTON_CADM_PAUSE = @as(u32, 637551868); pub const DIVIRTUAL_REMOTE_CONTROL = @as(u32, 654311424); pub const DIAXIS_REMOTE_SLIDER = @as(u32, 654639617); pub const DIBUTTON_REMOTE_MUTE = @as(u32, 654312449); pub const DIBUTTON_REMOTE_SELECT = @as(u32, 654312450); pub const DIBUTTON_REMOTE_PLAY = @as(u32, 654320643); pub const DIBUTTON_REMOTE_CUE = @as(u32, 654320644); pub const DIBUTTON_REMOTE_REVIEW = @as(u32, 654320645); pub const DIBUTTON_REMOTE_CHANGE = @as(u32, 654320646); pub const DIBUTTON_REMOTE_RECORD = @as(u32, 654320647); pub const DIBUTTON_REMOTE_MENU = @as(u32, 654312701); pub const DIAXIS_REMOTE_SLIDER2 = @as(u32, 654656002); pub const DIBUTTON_REMOTE_TV = @as(u32, 654334984); pub const DIBUTTON_REMOTE_CABLE = @as(u32, 654334985); pub const DIBUTTON_REMOTE_CD = @as(u32, 654334986); pub const DIBUTTON_REMOTE_VCR = @as(u32, 654334987); pub const DIBUTTON_REMOTE_TUNER = @as(u32, 654334988); pub const DIBUTTON_REMOTE_DVD = @as(u32, 654334989); pub const DIBUTTON_REMOTE_ADJUST = @as(u32, 654334990); pub const DIBUTTON_REMOTE_DIGIT0 = @as(u32, 654332943); pub const DIBUTTON_REMOTE_DIGIT1 = @as(u32, 654332944); pub const DIBUTTON_REMOTE_DIGIT2 = @as(u32, 654332945); pub const DIBUTTON_REMOTE_DIGIT3 = @as(u32, 654332946); pub const DIBUTTON_REMOTE_DIGIT4 = @as(u32, 654332947); pub const DIBUTTON_REMOTE_DIGIT5 = @as(u32, 654332948); pub const DIBUTTON_REMOTE_DIGIT6 = @as(u32, 654332949); pub const DIBUTTON_REMOTE_DIGIT7 = @as(u32, 654332950); pub const DIBUTTON_REMOTE_DIGIT8 = @as(u32, 654332951); pub const DIBUTTON_REMOTE_DIGIT9 = @as(u32, 654332952); pub const DIBUTTON_REMOTE_DEVICE = @as(u32, 654329086); pub const DIBUTTON_REMOTE_PAUSE = @as(u32, 654329084); pub const DIVIRTUAL_BROWSER_CONTROL = @as(u32, 671088640); pub const DIAXIS_BROWSER_LATERAL = @as(u32, 671121921); pub const DIAXIS_BROWSER_MOVE = @as(u32, 671154690); pub const DIBUTTON_BROWSER_SELECT = @as(u32, 671089665); pub const DIAXIS_BROWSER_VIEW = @as(u32, 671187459); pub const DIBUTTON_BROWSER_REFRESH = @as(u32, 671089666); pub const DIBUTTON_BROWSER_MENU = @as(u32, 671089917); pub const DIBUTTON_BROWSER_SEARCH = @as(u32, 671106051); pub const DIBUTTON_BROWSER_STOP = @as(u32, 671106052); pub const DIBUTTON_BROWSER_HOME = @as(u32, 671106053); pub const DIBUTTON_BROWSER_FAVORITES = @as(u32, 671106054); pub const DIBUTTON_BROWSER_NEXT = @as(u32, 671106055); pub const DIBUTTON_BROWSER_PREVIOUS = @as(u32, 671106056); pub const DIBUTTON_BROWSER_HISTORY = @as(u32, 671106057); pub const DIBUTTON_BROWSER_PRINT = @as(u32, 671106058); pub const DIBUTTON_BROWSER_DEVICE = @as(u32, 671106302); pub const DIBUTTON_BROWSER_PAUSE = @as(u32, 671106300); pub const DIVIRTUAL_DRIVING_MECHA = @as(u32, 687865856); pub const DIAXIS_MECHA_STEER = @as(u32, 687899137); pub const DIAXIS_MECHA_TORSO = @as(u32, 687931906); pub const DIAXIS_MECHA_ROTATE = @as(u32, 687997443); pub const DIAXIS_MECHA_THROTTLE = @as(u32, 688095748); pub const DIBUTTON_MECHA_FIRE = @as(u32, 687866881); pub const DIBUTTON_MECHA_WEAPONS = @as(u32, 687866882); pub const DIBUTTON_MECHA_TARGET = @as(u32, 687866883); pub const DIBUTTON_MECHA_REVERSE = @as(u32, 687866884); pub const DIBUTTON_MECHA_ZOOM = @as(u32, 687866885); pub const DIBUTTON_MECHA_JUMP = @as(u32, 687866886); pub const DIBUTTON_MECHA_MENU = @as(u32, 687867133); pub const DIBUTTON_MECHA_CENTER = @as(u32, 687883271); pub const DIHATSWITCH_MECHA_GLANCE = @as(u32, 687883777); pub const DIBUTTON_MECHA_VIEW = @as(u32, 687883272); pub const DIBUTTON_MECHA_FIRESECONDARY = @as(u32, 687883273); pub const DIBUTTON_MECHA_LEFT_LINK = @as(u32, 687916260); pub const DIBUTTON_MECHA_RIGHT_LINK = @as(u32, 687916268); pub const DIBUTTON_MECHA_FORWARD_LINK = @as(u32, 687949024); pub const DIBUTTON_MECHA_BACK_LINK = @as(u32, 687949032); pub const DIBUTTON_MECHA_ROTATE_LEFT_LINK = @as(u32, 688014564); pub const DIBUTTON_MECHA_ROTATE_RIGHT_LINK = @as(u32, 688014572); pub const DIBUTTON_MECHA_FASTER_LINK = @as(u32, 688112864); pub const DIBUTTON_MECHA_SLOWER_LINK = @as(u32, 688112872); pub const DIBUTTON_MECHA_DEVICE = @as(u32, 687883518); pub const DIBUTTON_MECHA_PAUSE = @as(u32, 687883516); pub const DIAXIS_ANY_X_1 = @as(u32, 4278239745); pub const DIAXIS_ANY_X_2 = @as(u32, 4278239746); pub const DIAXIS_ANY_Y_1 = @as(u32, 4278272513); pub const DIAXIS_ANY_Y_2 = @as(u32, 4278272514); pub const DIAXIS_ANY_Z_1 = @as(u32, 4278305281); pub const DIAXIS_ANY_Z_2 = @as(u32, 4278305282); pub const DIAXIS_ANY_R_1 = @as(u32, 4278338049); pub const DIAXIS_ANY_R_2 = @as(u32, 4278338050); pub const DIAXIS_ANY_U_1 = @as(u32, 4278370817); pub const DIAXIS_ANY_U_2 = @as(u32, 4278370818); pub const DIAXIS_ANY_V_1 = @as(u32, 4278403585); pub const DIAXIS_ANY_V_2 = @as(u32, 4278403586); pub const DIAXIS_ANY_A_1 = @as(u32, 4278436353); pub const DIAXIS_ANY_A_2 = @as(u32, 4278436354); pub const DIAXIS_ANY_B_1 = @as(u32, 4278469121); pub const DIAXIS_ANY_B_2 = @as(u32, 4278469122); pub const DIAXIS_ANY_C_1 = @as(u32, 4278501889); pub const DIAXIS_ANY_C_2 = @as(u32, 4278501890); pub const DIAXIS_ANY_S_1 = @as(u32, 4278534657); pub const DIAXIS_ANY_S_2 = @as(u32, 4278534658); pub const DIAXIS_ANY_1 = @as(u32, 4278206977); pub const DIAXIS_ANY_2 = @as(u32, 4278206978); pub const DIAXIS_ANY_3 = @as(u32, 4278206979); pub const DIAXIS_ANY_4 = @as(u32, 4278206980); pub const DIPOV_ANY_1 = @as(u32, 4278208001); pub const DIPOV_ANY_2 = @as(u32, 4278208002); pub const DIPOV_ANY_3 = @as(u32, 4278208003); pub const DIPOV_ANY_4 = @as(u32, 4278208004); pub const JOY_PASSDRIVERDATA = @as(i32, 268435456); pub const JOY_HWS_ISHEADTRACKER = @as(i32, 33554432); pub const JOY_HWS_ISGAMEPORTDRIVER = @as(i32, 67108864); pub const JOY_HWS_ISANALOGPORTDRIVER = @as(i32, 134217728); pub const JOY_HWS_AUTOLOAD = @as(i32, 268435456); pub const JOY_HWS_NODEVNODE = @as(i32, 536870912); pub const JOY_HWS_ISGAMEPORTBUS = @as(i32, -2147483648); pub const JOY_HWS_GAMEPORTBUSBUSY = @as(i32, 1); pub const JOY_US_VOLATILE = @as(i32, 8); pub const JOY_OEMPOLL_PASSDRIVERDATA = @as(u32, 7); pub const BUTTON_BIT_POWER = @as(u32, 1); pub const BUTTON_BIT_WINDOWS = @as(u32, 2); pub const BUTTON_BIT_VOLUMEUP = @as(u32, 4); pub const BUTTON_BIT_VOLUMEDOWN = @as(u32, 8); pub const BUTTON_BIT_ROTATION_LOCK = @as(u32, 16); pub const BUTTON_BIT_BACK = @as(u32, 32); pub const BUTTON_BIT_SEARCH = @as(u32, 64); pub const BUTTON_BIT_CAMERAFOCUS = @as(u32, 128); pub const BUTTON_BIT_CAMERASHUTTER = @as(u32, 256); pub const BUTTON_BIT_RINGERTOGGLE = @as(u32, 512); pub const BUTTON_BIT_HEADSET = @as(u32, 1024); pub const BUTTON_BIT_HWKBDEPLOY = @as(u32, 2048); pub const BUTTON_BIT_CAMERALENS = @as(u32, 4096); pub const BUTTON_BIT_OEMCUSTOM = @as(u32, 8192); pub const BUTTON_BIT_OEMCUSTOM2 = @as(u32, 16384); pub const BUTTON_BIT_OEMCUSTOM3 = @as(u32, 32768); pub const BUTTON_BIT_ALLBUTTONSMASK = @as(u32, 16383); pub const IOCTL_BUTTON_SET_ENABLED_ON_IDLE = @as(u32, 721576); pub const IOCTL_BUTTON_GET_ENABLED_ON_IDLE = @as(u32, 721580); //-------------------------------------------------------------------------------- // Section: Types (141) //-------------------------------------------------------------------------------- pub const DICONSTANTFORCE = extern struct { lMagnitude: i32, }; pub const DIRAMPFORCE = extern struct { lStart: i32, lEnd: i32, }; pub const DIPERIODIC = extern struct { dwMagnitude: u32, lOffset: i32, dwPhase: u32, dwPeriod: u32, }; pub const DICONDITION = extern struct { lOffset: i32, lPositiveCoefficient: i32, lNegativeCoefficient: i32, dwPositiveSaturation: u32, dwNegativeSaturation: u32, lDeadBand: i32, }; pub const DICUSTOMFORCE = extern struct { cChannels: u32, dwSamplePeriod: u32, cSamples: u32, rglForceData: ?*i32, }; pub const DIENVELOPE = extern struct { dwSize: u32, dwAttackLevel: u32, dwAttackTime: u32, dwFadeLevel: u32, dwFadeTime: u32, }; pub const DIEFFECT_DX5 = extern struct { dwSize: u32, dwFlags: u32, dwDuration: u32, dwSamplePeriod: u32, dwGain: u32, dwTriggerButton: u32, dwTriggerRepeatInterval: u32, cAxes: u32, rgdwAxes: ?*u32, rglDirection: ?*i32, lpEnvelope: ?*DIENVELOPE, cbTypeSpecificParams: u32, lpvTypeSpecificParams: ?*anyopaque, }; pub const DIEFFECT = extern struct { dwSize: u32, dwFlags: u32, dwDuration: u32, dwSamplePeriod: u32, dwGain: u32, dwTriggerButton: u32, dwTriggerRepeatInterval: u32, cAxes: u32, rgdwAxes: ?*u32, rglDirection: ?*i32, lpEnvelope: ?*DIENVELOPE, cbTypeSpecificParams: u32, lpvTypeSpecificParams: ?*anyopaque, dwStartDelay: u32, }; pub const DIFILEEFFECT = extern struct { dwSize: u32, GuidEffect: Guid, lpDiEffect: ?*DIEFFECT, szFriendlyName: [260]CHAR, }; pub const LPDIENUMEFFECTSINFILECALLBACK = fn( param0: ?*DIFILEEFFECT, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DIEFFESCAPE = extern struct { dwSize: u32, dwCommand: u32, lpvInBuffer: ?*anyopaque, cbInBuffer: u32, lpvOutBuffer: ?*anyopaque, cbOutBuffer: u32, }; const IID_IDirectInputEffect_Value = Guid.initString("e7e1f7c0-88d2-11d0-9ad0-00a0c9a06e35"); pub const IID_IDirectInputEffect = &IID_IDirectInputEffect_Value; pub const IDirectInputEffect = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Initialize: fn( self: *const IDirectInputEffect, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEffectGuid: fn( self: *const IDirectInputEffect, param0: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetParameters: fn( self: *const IDirectInputEffect, param0: ?*DIEFFECT, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetParameters: fn( self: *const IDirectInputEffect, param0: ?*DIEFFECT, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Start: fn( self: *const IDirectInputEffect, param0: u32, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Stop: fn( self: *const IDirectInputEffect, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEffectStatus: fn( self: *const IDirectInputEffect, param0: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Download: fn( self: *const IDirectInputEffect, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unload: fn( self: *const IDirectInputEffect, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Escape: fn( self: *const IDirectInputEffect, param0: ?*DIEFFESCAPE, ) 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 IDirectInputEffect_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInputEffect, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_GetEffectGuid(self: *const T, param0: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).GetEffectGuid(@ptrCast(*const IDirectInputEffect, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_GetParameters(self: *const T, param0: ?*DIEFFECT, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).GetParameters(@ptrCast(*const IDirectInputEffect, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_SetParameters(self: *const T, param0: ?*DIEFFECT, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).SetParameters(@ptrCast(*const IDirectInputEffect, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_Start(self: *const T, param0: u32, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).Start(@ptrCast(*const IDirectInputEffect, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_Stop(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).Stop(@ptrCast(*const IDirectInputEffect, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_GetEffectStatus(self: *const T, param0: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).GetEffectStatus(@ptrCast(*const IDirectInputEffect, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_Download(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).Download(@ptrCast(*const IDirectInputEffect, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_Unload(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).Unload(@ptrCast(*const IDirectInputEffect, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffect_Escape(self: *const T, param0: ?*DIEFFESCAPE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffect.VTable, self.vtable).Escape(@ptrCast(*const IDirectInputEffect, self), param0); } };} pub usingnamespace MethodMixin(@This()); }; pub const DIDEVCAPS_DX3 = extern struct { dwSize: u32, dwFlags: u32, dwDevType: u32, dwAxes: u32, dwButtons: u32, dwPOVs: u32, }; pub const DIDEVCAPS = extern struct { dwSize: u32, dwFlags: u32, dwDevType: u32, dwAxes: u32, dwButtons: u32, dwPOVs: u32, dwFFSamplePeriod: u32, dwFFMinTimeResolution: u32, dwFirmwareRevision: u32, dwHardwareRevision: u32, dwFFDriverVersion: u32, }; pub const DIOBJECTDATAFORMAT = extern struct { pguid: ?*const Guid, dwOfs: u32, dwType: u32, dwFlags: u32, }; pub const DIDATAFORMAT = extern struct { dwSize: u32, dwObjSize: u32, dwFlags: u32, dwDataSize: u32, dwNumObjs: u32, rgodf: ?*DIOBJECTDATAFORMAT, }; pub const DIACTIONA = extern struct { uAppData: usize, dwSemantic: u32, dwFlags: u32, Anonymous: extern union { lptszActionName: ?[*:0]const u8, uResIdString: u32, }, guidInstance: Guid, dwObjID: u32, dwHow: u32, }; pub const DIACTIONW = extern struct { uAppData: usize, dwSemantic: u32, dwFlags: u32, Anonymous: extern union { lptszActionName: ?[*:0]const u16, uResIdString: u32, }, guidInstance: Guid, dwObjID: u32, dwHow: u32, }; pub const DIACTIONFORMATA = extern struct { dwSize: u32, dwActionSize: u32, dwDataSize: u32, dwNumActions: u32, rgoAction: ?*DIACTIONA, guidActionMap: Guid, dwGenre: u32, dwBufferSize: u32, lAxisMin: i32, lAxisMax: i32, hInstString: ?HINSTANCE, ftTimeStamp: FILETIME, dwCRC: u32, tszActionMap: [260]CHAR, }; pub const DIACTIONFORMATW = extern struct { dwSize: u32, dwActionSize: u32, dwDataSize: u32, dwNumActions: u32, rgoAction: ?*DIACTIONW, guidActionMap: Guid, dwGenre: u32, dwBufferSize: u32, lAxisMin: i32, lAxisMax: i32, hInstString: ?HINSTANCE, ftTimeStamp: FILETIME, dwCRC: u32, tszActionMap: [260]u16, }; pub const DICOLORSET = extern struct { dwSize: u32, cTextFore: u32, cTextHighlight: u32, cCalloutLine: u32, cCalloutHighlight: u32, cBorder: u32, cControlFill: u32, cHighlightFill: u32, cAreaFill: u32, }; pub const DICONFIGUREDEVICESPARAMSA = extern struct { dwSize: u32, dwcUsers: u32, lptszUserNames: ?PSTR, dwcFormats: u32, lprgFormats: ?*DIACTIONFORMATA, hwnd: ?HWND, dics: DICOLORSET, lpUnkDDSTarget: ?*IUnknown, }; pub const DICONFIGUREDEVICESPARAMSW = extern struct { dwSize: u32, dwcUsers: u32, lptszUserNames: ?PWSTR, dwcFormats: u32, lprgFormats: ?*DIACTIONFORMATW, hwnd: ?HWND, dics: DICOLORSET, lpUnkDDSTarget: ?*IUnknown, }; pub const DIDEVICEIMAGEINFOA = extern struct { tszImagePath: [260]CHAR, dwFlags: u32, dwViewID: u32, rcOverlay: RECT, dwObjID: u32, dwcValidPts: u32, rgptCalloutLine: [5]POINT, rcCalloutRect: RECT, dwTextAlign: u32, }; pub const DIDEVICEIMAGEINFOW = extern struct { tszImagePath: [260]u16, dwFlags: u32, dwViewID: u32, rcOverlay: RECT, dwObjID: u32, dwcValidPts: u32, rgptCalloutLine: [5]POINT, rcCalloutRect: RECT, dwTextAlign: u32, }; pub const DIDEVICEIMAGEINFOHEADERA = extern struct { dwSize: u32, dwSizeImageInfo: u32, dwcViews: u32, dwcButtons: u32, dwcAxes: u32, dwcPOVs: u32, dwBufferSize: u32, dwBufferUsed: u32, lprgImageInfoArray: ?*DIDEVICEIMAGEINFOA, }; pub const DIDEVICEIMAGEINFOHEADERW = extern struct { dwSize: u32, dwSizeImageInfo: u32, dwcViews: u32, dwcButtons: u32, dwcAxes: u32, dwcPOVs: u32, dwBufferSize: u32, dwBufferUsed: u32, lprgImageInfoArray: ?*DIDEVICEIMAGEINFOW, }; pub const DIDEVICEOBJECTINSTANCE_DX3A = extern struct { dwSize: u32, guidType: Guid, dwOfs: u32, dwType: u32, dwFlags: u32, tszName: [260]CHAR, }; pub const DIDEVICEOBJECTINSTANCE_DX3W = extern struct { dwSize: u32, guidType: Guid, dwOfs: u32, dwType: u32, dwFlags: u32, tszName: [260]u16, }; pub const DIDEVICEOBJECTINSTANCEA = extern struct { dwSize: u32, guidType: Guid, dwOfs: u32, dwType: u32, dwFlags: u32, tszName: [260]CHAR, dwFFMaxForce: u32, dwFFForceResolution: u32, wCollectionNumber: u16, wDesignatorIndex: u16, wUsagePage: u16, wUsage: u16, dwDimension: u32, wExponent: u16, wReportId: u16, }; pub const DIDEVICEOBJECTINSTANCEW = extern struct { dwSize: u32, guidType: Guid, dwOfs: u32, dwType: u32, dwFlags: u32, tszName: [260]u16, dwFFMaxForce: u32, dwFFForceResolution: u32, wCollectionNumber: u16, wDesignatorIndex: u16, wUsagePage: u16, wUsage: u16, dwDimension: u32, wExponent: u16, wReportId: u16, }; pub const LPDIENUMDEVICEOBJECTSCALLBACKA = fn( param0: ?*DIDEVICEOBJECTINSTANCEA, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPDIENUMDEVICEOBJECTSCALLBACKW = fn( param0: ?*DIDEVICEOBJECTINSTANCEW, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DIPROPHEADER = extern struct { dwSize: u32, dwHeaderSize: u32, dwObj: u32, dwHow: u32, }; pub const DIPROPDWORD = extern struct { diph: DIPROPHEADER, dwData: u32, }; pub const DIPROPPOINTER = extern struct { diph: DIPROPHEADER, uData: usize, }; pub const DIPROPRANGE = extern struct { diph: DIPROPHEADER, lMin: i32, lMax: i32, }; pub const DIPROPCAL = extern struct { diph: DIPROPHEADER, lMin: i32, lCenter: i32, lMax: i32, }; pub const DIPROPCALPOV = extern struct { diph: DIPROPHEADER, lMin: [5]i32, lMax: [5]i32, }; pub const DIPROPGUIDANDPATH = extern struct { diph: DIPROPHEADER, guidClass: Guid, wszPath: [260]u16, }; pub const DIPROPSTRING = extern struct { diph: DIPROPHEADER, wsz: [260]u16, }; pub const CPOINT = extern struct { lP: i32, dwLog: u32, }; pub const DIPROPCPOINTS = extern struct { diph: DIPROPHEADER, dwCPointsNum: u32, cp: [8]CPOINT, }; pub const DIDEVICEOBJECTDATA_DX3 = extern struct { dwOfs: u32, dwData: u32, dwTimeStamp: u32, dwSequence: u32, }; pub const DIDEVICEOBJECTDATA = extern struct { dwOfs: u32, dwData: u32, dwTimeStamp: u32, dwSequence: u32, uAppData: usize, }; pub const DIDEVICEINSTANCE_DX3A = extern struct { dwSize: u32, guidInstance: Guid, guidProduct: Guid, dwDevType: u32, tszInstanceName: [260]CHAR, tszProductName: [260]CHAR, }; pub const DIDEVICEINSTANCE_DX3W = extern struct { dwSize: u32, guidInstance: Guid, guidProduct: Guid, dwDevType: u32, tszInstanceName: [260]u16, tszProductName: [260]u16, }; pub const DIDEVICEINSTANCEA = extern struct { dwSize: u32, guidInstance: Guid, guidProduct: Guid, dwDevType: u32, tszInstanceName: [260]CHAR, tszProductName: [260]CHAR, guidFFDriver: Guid, wUsagePage: u16, wUsage: u16, }; pub const DIDEVICEINSTANCEW = extern struct { dwSize: u32, guidInstance: Guid, guidProduct: Guid, dwDevType: u32, tszInstanceName: [260]u16, tszProductName: [260]u16, guidFFDriver: Guid, wUsagePage: u16, wUsage: u16, }; const IID_IDirectInputDeviceW_Value = Guid.initString("5944e681-c92e-11cf-bfc7-444553540000"); pub const IID_IDirectInputDeviceW = &IID_IDirectInputDeviceW_Value; pub const IDirectInputDeviceW = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCapabilities: fn( self: *const IDirectInputDeviceW, param0: ?*DIDEVCAPS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumObjects: fn( self: *const IDirectInputDeviceW, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKW, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IDirectInputDeviceW, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetProperty: fn( self: *const IDirectInputDeviceW, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Acquire: fn( self: *const IDirectInputDeviceW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unacquire: fn( self: *const IDirectInputDeviceW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceState: fn( self: *const IDirectInputDeviceW, param0: u32, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceData: fn( self: *const IDirectInputDeviceW, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDataFormat: fn( self: *const IDirectInputDeviceW, param0: ?*DIDATAFORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventNotification: fn( self: *const IDirectInputDeviceW, param0: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCooperativeLevel: fn( self: *const IDirectInputDeviceW, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectInfo: fn( self: *const IDirectInputDeviceW, param0: ?*DIDEVICEOBJECTINSTANCEW, param1: u32, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceInfo: fn( self: *const IDirectInputDeviceW, param0: ?*DIDEVICEINSTANCEW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInputDeviceW, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInputDeviceW, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_GetCapabilities(self: *const T, param0: ?*DIDEVCAPS) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).GetCapabilities(@ptrCast(*const IDirectInputDeviceW, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_EnumObjects(self: *const T, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKW, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).EnumObjects(@ptrCast(*const IDirectInputDeviceW, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_GetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).GetProperty(@ptrCast(*const IDirectInputDeviceW, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_SetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).SetProperty(@ptrCast(*const IDirectInputDeviceW, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_Acquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).Acquire(@ptrCast(*const IDirectInputDeviceW, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_Unacquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).Unacquire(@ptrCast(*const IDirectInputDeviceW, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_GetDeviceState(self: *const T, param0: u32, param1: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).GetDeviceState(@ptrCast(*const IDirectInputDeviceW, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_GetDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).GetDeviceData(@ptrCast(*const IDirectInputDeviceW, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_SetDataFormat(self: *const T, param0: ?*DIDATAFORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).SetDataFormat(@ptrCast(*const IDirectInputDeviceW, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_SetEventNotification(self: *const T, param0: ?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).SetEventNotification(@ptrCast(*const IDirectInputDeviceW, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_SetCooperativeLevel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).SetCooperativeLevel(@ptrCast(*const IDirectInputDeviceW, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_GetObjectInfo(self: *const T, param0: ?*DIDEVICEOBJECTINSTANCEW, param1: u32, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IDirectInputDeviceW, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_GetDeviceInfo(self: *const T, param0: ?*DIDEVICEINSTANCEW) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).GetDeviceInfo(@ptrCast(*const IDirectInputDeviceW, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInputDeviceW, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceW_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceW.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInputDeviceW, self), param0, param1, param2); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputDeviceA_Value = Guid.initString("5944e680-c92e-11cf-bfc7-444553540000"); pub const IID_IDirectInputDeviceA = &IID_IDirectInputDeviceA_Value; pub const IDirectInputDeviceA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCapabilities: fn( self: *const IDirectInputDeviceA, param0: ?*DIDEVCAPS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumObjects: fn( self: *const IDirectInputDeviceA, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKA, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IDirectInputDeviceA, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetProperty: fn( self: *const IDirectInputDeviceA, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Acquire: fn( self: *const IDirectInputDeviceA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unacquire: fn( self: *const IDirectInputDeviceA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceState: fn( self: *const IDirectInputDeviceA, param0: u32, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceData: fn( self: *const IDirectInputDeviceA, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDataFormat: fn( self: *const IDirectInputDeviceA, param0: ?*DIDATAFORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventNotification: fn( self: *const IDirectInputDeviceA, param0: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCooperativeLevel: fn( self: *const IDirectInputDeviceA, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectInfo: fn( self: *const IDirectInputDeviceA, param0: ?*DIDEVICEOBJECTINSTANCEA, param1: u32, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceInfo: fn( self: *const IDirectInputDeviceA, param0: ?*DIDEVICEINSTANCEA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInputDeviceA, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInputDeviceA, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IUnknown.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_GetCapabilities(self: *const T, param0: ?*DIDEVCAPS) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).GetCapabilities(@ptrCast(*const IDirectInputDeviceA, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_EnumObjects(self: *const T, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKA, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).EnumObjects(@ptrCast(*const IDirectInputDeviceA, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_GetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).GetProperty(@ptrCast(*const IDirectInputDeviceA, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_SetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).SetProperty(@ptrCast(*const IDirectInputDeviceA, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_Acquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).Acquire(@ptrCast(*const IDirectInputDeviceA, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_Unacquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).Unacquire(@ptrCast(*const IDirectInputDeviceA, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_GetDeviceState(self: *const T, param0: u32, param1: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).GetDeviceState(@ptrCast(*const IDirectInputDeviceA, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_GetDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).GetDeviceData(@ptrCast(*const IDirectInputDeviceA, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_SetDataFormat(self: *const T, param0: ?*DIDATAFORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).SetDataFormat(@ptrCast(*const IDirectInputDeviceA, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_SetEventNotification(self: *const T, param0: ?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).SetEventNotification(@ptrCast(*const IDirectInputDeviceA, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_SetCooperativeLevel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).SetCooperativeLevel(@ptrCast(*const IDirectInputDeviceA, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_GetObjectInfo(self: *const T, param0: ?*DIDEVICEOBJECTINSTANCEA, param1: u32, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IDirectInputDeviceA, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_GetDeviceInfo(self: *const T, param0: ?*DIDEVICEINSTANCEA) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).GetDeviceInfo(@ptrCast(*const IDirectInputDeviceA, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInputDeviceA, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDeviceA_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDeviceA.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInputDeviceA, self), param0, param1, param2); } };} pub usingnamespace MethodMixin(@This()); }; pub const DIEFFECTINFOA = extern struct { dwSize: u32, guid: Guid, dwEffType: u32, dwStaticParams: u32, dwDynamicParams: u32, tszName: [260]CHAR, }; pub const DIEFFECTINFOW = extern struct { dwSize: u32, guid: Guid, dwEffType: u32, dwStaticParams: u32, dwDynamicParams: u32, tszName: [260]u16, }; pub const LPDIENUMEFFECTSCALLBACKA = fn( param0: ?*DIEFFECTINFOA, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPDIENUMEFFECTSCALLBACKW = fn( param0: ?*DIEFFECTINFOW, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPDIENUMCREATEDEFFECTOBJECTSCALLBACK = fn( param0: ?*IDirectInputEffect, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; const IID_IDirectInputDevice2W_Value = Guid.initString("5944e683-c92e-11cf-bfc7-444553540000"); pub const IID_IDirectInputDevice2W = &IID_IDirectInputDevice2W_Value; pub const IDirectInputDevice2W = extern struct { pub const VTable = extern struct { base: IDirectInputDeviceW.VTable, CreateEffect: fn( self: *const IDirectInputDevice2W, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumEffects: fn( self: *const IDirectInputDevice2W, param0: ?LPDIENUMEFFECTSCALLBACKW, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEffectInfo: fn( self: *const IDirectInputDevice2W, param0: ?*DIEFFECTINFOW, param1: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetForceFeedbackState: fn( self: *const IDirectInputDevice2W, param0: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendForceFeedbackCommand: fn( self: *const IDirectInputDevice2W, param0: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumCreatedEffectObjects: fn( self: *const IDirectInputDevice2W, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Escape: fn( self: *const IDirectInputDevice2W, param0: ?*DIEFFESCAPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Poll: fn( self: *const IDirectInputDevice2W, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendDeviceData: fn( self: *const IDirectInputDevice2W, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInputDeviceW.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_CreateEffect(self: *const T, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).CreateEffect(@ptrCast(*const IDirectInputDevice2W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_EnumEffects(self: *const T, param0: ?LPDIENUMEFFECTSCALLBACKW, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).EnumEffects(@ptrCast(*const IDirectInputDevice2W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_GetEffectInfo(self: *const T, param0: ?*DIEFFECTINFOW, param1: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).GetEffectInfo(@ptrCast(*const IDirectInputDevice2W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_GetForceFeedbackState(self: *const T, param0: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).GetForceFeedbackState(@ptrCast(*const IDirectInputDevice2W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_SendForceFeedbackCommand(self: *const T, param0: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).SendForceFeedbackCommand(@ptrCast(*const IDirectInputDevice2W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_EnumCreatedEffectObjects(self: *const T, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).EnumCreatedEffectObjects(@ptrCast(*const IDirectInputDevice2W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_Escape(self: *const T, param0: ?*DIEFFESCAPE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).Escape(@ptrCast(*const IDirectInputDevice2W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_Poll(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).Poll(@ptrCast(*const IDirectInputDevice2W, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2W_SendDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2W.VTable, self.vtable).SendDeviceData(@ptrCast(*const IDirectInputDevice2W, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputDevice2A_Value = Guid.initString("5944e682-c92e-11cf-bfc7-444553540000"); pub const IID_IDirectInputDevice2A = &IID_IDirectInputDevice2A_Value; pub const IDirectInputDevice2A = extern struct { pub const VTable = extern struct { base: IDirectInputDeviceA.VTable, CreateEffect: fn( self: *const IDirectInputDevice2A, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumEffects: fn( self: *const IDirectInputDevice2A, param0: ?LPDIENUMEFFECTSCALLBACKA, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEffectInfo: fn( self: *const IDirectInputDevice2A, param0: ?*DIEFFECTINFOA, param1: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetForceFeedbackState: fn( self: *const IDirectInputDevice2A, param0: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendForceFeedbackCommand: fn( self: *const IDirectInputDevice2A, param0: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumCreatedEffectObjects: fn( self: *const IDirectInputDevice2A, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Escape: fn( self: *const IDirectInputDevice2A, param0: ?*DIEFFESCAPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Poll: fn( self: *const IDirectInputDevice2A, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendDeviceData: fn( self: *const IDirectInputDevice2A, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInputDeviceA.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_CreateEffect(self: *const T, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).CreateEffect(@ptrCast(*const IDirectInputDevice2A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_EnumEffects(self: *const T, param0: ?LPDIENUMEFFECTSCALLBACKA, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).EnumEffects(@ptrCast(*const IDirectInputDevice2A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_GetEffectInfo(self: *const T, param0: ?*DIEFFECTINFOA, param1: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).GetEffectInfo(@ptrCast(*const IDirectInputDevice2A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_GetForceFeedbackState(self: *const T, param0: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).GetForceFeedbackState(@ptrCast(*const IDirectInputDevice2A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_SendForceFeedbackCommand(self: *const T, param0: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).SendForceFeedbackCommand(@ptrCast(*const IDirectInputDevice2A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_EnumCreatedEffectObjects(self: *const T, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).EnumCreatedEffectObjects(@ptrCast(*const IDirectInputDevice2A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_Escape(self: *const T, param0: ?*DIEFFESCAPE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).Escape(@ptrCast(*const IDirectInputDevice2A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_Poll(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).Poll(@ptrCast(*const IDirectInputDevice2A, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice2A_SendDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice2A.VTable, self.vtable).SendDeviceData(@ptrCast(*const IDirectInputDevice2A, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputDevice7W_Value = Guid.initString("57d7c6bd-2356-11d3-8e9d-00c04f6844ae"); pub const IID_IDirectInputDevice7W = &IID_IDirectInputDevice7W_Value; pub const IDirectInputDevice7W = extern struct { pub const VTable = extern struct { base: IDirectInputDevice2W.VTable, EnumEffectsInFile: fn( self: *const IDirectInputDevice7W, param0: ?[*:0]const u16, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteEffectToFile: fn( self: *const IDirectInputDevice7W, param0: ?[*:0]const u16, param1: u32, param2: ?*DIFILEEFFECT, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInputDevice2W.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice7W_EnumEffectsInFile(self: *const T, param0: ?[*:0]const u16, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice7W.VTable, self.vtable).EnumEffectsInFile(@ptrCast(*const IDirectInputDevice7W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice7W_WriteEffectToFile(self: *const T, param0: ?[*:0]const u16, param1: u32, param2: ?*DIFILEEFFECT, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice7W.VTable, self.vtable).WriteEffectToFile(@ptrCast(*const IDirectInputDevice7W, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputDevice7A_Value = Guid.initString("57d7c6bc-2356-11d3-8e9d-00c04f6844ae"); pub const IID_IDirectInputDevice7A = &IID_IDirectInputDevice7A_Value; pub const IDirectInputDevice7A = extern struct { pub const VTable = extern struct { base: IDirectInputDevice2A.VTable, EnumEffectsInFile: fn( self: *const IDirectInputDevice7A, param0: ?[*:0]const u8, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteEffectToFile: fn( self: *const IDirectInputDevice7A, param0: ?[*:0]const u8, param1: u32, param2: ?*DIFILEEFFECT, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInputDevice2A.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice7A_EnumEffectsInFile(self: *const T, param0: ?[*:0]const u8, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice7A.VTable, self.vtable).EnumEffectsInFile(@ptrCast(*const IDirectInputDevice7A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice7A_WriteEffectToFile(self: *const T, param0: ?[*:0]const u8, param1: u32, param2: ?*DIFILEEFFECT, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice7A.VTable, self.vtable).WriteEffectToFile(@ptrCast(*const IDirectInputDevice7A, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputDevice8W_Value = Guid.initString("54d41081-dc15-4833-a41b-748f73a38179"); pub const IID_IDirectInputDevice8W = &IID_IDirectInputDevice8W_Value; pub const IDirectInputDevice8W = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCapabilities: fn( self: *const IDirectInputDevice8W, param0: ?*DIDEVCAPS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumObjects: fn( self: *const IDirectInputDevice8W, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKW, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IDirectInputDevice8W, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetProperty: fn( self: *const IDirectInputDevice8W, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Acquire: fn( self: *const IDirectInputDevice8W, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unacquire: fn( self: *const IDirectInputDevice8W, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceState: fn( self: *const IDirectInputDevice8W, param0: u32, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceData: fn( self: *const IDirectInputDevice8W, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDataFormat: fn( self: *const IDirectInputDevice8W, param0: ?*DIDATAFORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventNotification: fn( self: *const IDirectInputDevice8W, param0: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCooperativeLevel: fn( self: *const IDirectInputDevice8W, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectInfo: fn( self: *const IDirectInputDevice8W, param0: ?*DIDEVICEOBJECTINSTANCEW, param1: u32, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceInfo: fn( self: *const IDirectInputDevice8W, param0: ?*DIDEVICEINSTANCEW, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInputDevice8W, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInputDevice8W, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateEffect: fn( self: *const IDirectInputDevice8W, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumEffects: fn( self: *const IDirectInputDevice8W, param0: ?LPDIENUMEFFECTSCALLBACKW, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEffectInfo: fn( self: *const IDirectInputDevice8W, param0: ?*DIEFFECTINFOW, param1: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetForceFeedbackState: fn( self: *const IDirectInputDevice8W, param0: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendForceFeedbackCommand: fn( self: *const IDirectInputDevice8W, param0: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumCreatedEffectObjects: fn( self: *const IDirectInputDevice8W, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Escape: fn( self: *const IDirectInputDevice8W, param0: ?*DIEFFESCAPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Poll: fn( self: *const IDirectInputDevice8W, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendDeviceData: fn( self: *const IDirectInputDevice8W, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumEffectsInFile: fn( self: *const IDirectInputDevice8W, param0: ?[*:0]const u16, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteEffectToFile: fn( self: *const IDirectInputDevice8W, param0: ?[*:0]const u16, param1: u32, param2: ?*DIFILEEFFECT, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BuildActionMap: fn( self: *const IDirectInputDevice8W, param0: ?*DIACTIONFORMATW, param1: ?[*:0]const u16, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetActionMap: fn( self: *const IDirectInputDevice8W, param0: ?*DIACTIONFORMATW, param1: ?[*:0]const u16, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImageInfo: fn( self: *const IDirectInputDevice8W, param0: ?*DIDEVICEIMAGEINFOHEADERW, ) 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 IDirectInputDevice8W_GetCapabilities(self: *const T, param0: ?*DIDEVCAPS) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetCapabilities(@ptrCast(*const IDirectInputDevice8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_EnumObjects(self: *const T, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKW, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).EnumObjects(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetProperty(@ptrCast(*const IDirectInputDevice8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_SetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).SetProperty(@ptrCast(*const IDirectInputDevice8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_Acquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).Acquire(@ptrCast(*const IDirectInputDevice8W, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_Unacquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).Unacquire(@ptrCast(*const IDirectInputDevice8W, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetDeviceState(self: *const T, param0: u32, param1: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetDeviceState(@ptrCast(*const IDirectInputDevice8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetDeviceData(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_SetDataFormat(self: *const T, param0: ?*DIDATAFORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).SetDataFormat(@ptrCast(*const IDirectInputDevice8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_SetEventNotification(self: *const T, param0: ?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).SetEventNotification(@ptrCast(*const IDirectInputDevice8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_SetCooperativeLevel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).SetCooperativeLevel(@ptrCast(*const IDirectInputDevice8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetObjectInfo(self: *const T, param0: ?*DIDEVICEOBJECTINSTANCEW, param1: u32, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetDeviceInfo(self: *const T, param0: ?*DIDEVICEINSTANCEW) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetDeviceInfo(@ptrCast(*const IDirectInputDevice8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInputDevice8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_CreateEffect(self: *const T, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).CreateEffect(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_EnumEffects(self: *const T, param0: ?LPDIENUMEFFECTSCALLBACKW, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).EnumEffects(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetEffectInfo(self: *const T, param0: ?*DIEFFECTINFOW, param1: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetEffectInfo(@ptrCast(*const IDirectInputDevice8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetForceFeedbackState(self: *const T, param0: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetForceFeedbackState(@ptrCast(*const IDirectInputDevice8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_SendForceFeedbackCommand(self: *const T, param0: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).SendForceFeedbackCommand(@ptrCast(*const IDirectInputDevice8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_EnumCreatedEffectObjects(self: *const T, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).EnumCreatedEffectObjects(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_Escape(self: *const T, param0: ?*DIEFFESCAPE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).Escape(@ptrCast(*const IDirectInputDevice8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_Poll(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).Poll(@ptrCast(*const IDirectInputDevice8W, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_SendDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).SendDeviceData(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_EnumEffectsInFile(self: *const T, param0: ?[*:0]const u16, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).EnumEffectsInFile(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_WriteEffectToFile(self: *const T, param0: ?[*:0]const u16, param1: u32, param2: ?*DIFILEEFFECT, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).WriteEffectToFile(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_BuildActionMap(self: *const T, param0: ?*DIACTIONFORMATW, param1: ?[*:0]const u16, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).BuildActionMap(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_SetActionMap(self: *const T, param0: ?*DIACTIONFORMATW, param1: ?[*:0]const u16, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).SetActionMap(@ptrCast(*const IDirectInputDevice8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8W_GetImageInfo(self: *const T, param0: ?*DIDEVICEIMAGEINFOHEADERW) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8W.VTable, self.vtable).GetImageInfo(@ptrCast(*const IDirectInputDevice8W, self), param0); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputDevice8A_Value = Guid.initString("54d41080-dc15-4833-a41b-748f73a38179"); pub const IID_IDirectInputDevice8A = &IID_IDirectInputDevice8A_Value; pub const IDirectInputDevice8A = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetCapabilities: fn( self: *const IDirectInputDevice8A, param0: ?*DIDEVCAPS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumObjects: fn( self: *const IDirectInputDevice8A, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKA, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetProperty: fn( self: *const IDirectInputDevice8A, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetProperty: fn( self: *const IDirectInputDevice8A, param0: ?*const Guid, param1: ?*DIPROPHEADER, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Acquire: fn( self: *const IDirectInputDevice8A, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unacquire: fn( self: *const IDirectInputDevice8A, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceState: fn( self: *const IDirectInputDevice8A, param0: u32, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceData: fn( self: *const IDirectInputDevice8A, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetDataFormat: fn( self: *const IDirectInputDevice8A, param0: ?*DIDATAFORMAT, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetEventNotification: fn( self: *const IDirectInputDevice8A, param0: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCooperativeLevel: fn( self: *const IDirectInputDevice8A, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetObjectInfo: fn( self: *const IDirectInputDevice8A, param0: ?*DIDEVICEOBJECTINSTANCEA, param1: u32, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceInfo: fn( self: *const IDirectInputDevice8A, param0: ?*DIDEVICEINSTANCEA, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInputDevice8A, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInputDevice8A, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CreateEffect: fn( self: *const IDirectInputDevice8A, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumEffects: fn( self: *const IDirectInputDevice8A, param0: ?LPDIENUMEFFECTSCALLBACKA, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEffectInfo: fn( self: *const IDirectInputDevice8A, param0: ?*DIEFFECTINFOA, param1: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetForceFeedbackState: fn( self: *const IDirectInputDevice8A, param0: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendForceFeedbackCommand: fn( self: *const IDirectInputDevice8A, param0: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumCreatedEffectObjects: fn( self: *const IDirectInputDevice8A, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Escape: fn( self: *const IDirectInputDevice8A, param0: ?*DIEFFESCAPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Poll: fn( self: *const IDirectInputDevice8A, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendDeviceData: fn( self: *const IDirectInputDevice8A, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumEffectsInFile: fn( self: *const IDirectInputDevice8A, param0: ?[*:0]const u8, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, WriteEffectToFile: fn( self: *const IDirectInputDevice8A, param0: ?[*:0]const u8, param1: u32, param2: ?*DIFILEEFFECT, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, BuildActionMap: fn( self: *const IDirectInputDevice8A, param0: ?*DIACTIONFORMATA, param1: ?[*:0]const u8, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetActionMap: fn( self: *const IDirectInputDevice8A, param0: ?*DIACTIONFORMATA, param1: ?[*:0]const u8, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetImageInfo: fn( self: *const IDirectInputDevice8A, param0: ?*DIDEVICEIMAGEINFOHEADERA, ) 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 IDirectInputDevice8A_GetCapabilities(self: *const T, param0: ?*DIDEVCAPS) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetCapabilities(@ptrCast(*const IDirectInputDevice8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_EnumObjects(self: *const T, param0: ?LPDIENUMDEVICEOBJECTSCALLBACKA, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).EnumObjects(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetProperty(@ptrCast(*const IDirectInputDevice8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_SetProperty(self: *const T, param0: ?*const Guid, param1: ?*DIPROPHEADER) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).SetProperty(@ptrCast(*const IDirectInputDevice8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_Acquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).Acquire(@ptrCast(*const IDirectInputDevice8A, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_Unacquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).Unacquire(@ptrCast(*const IDirectInputDevice8A, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetDeviceState(self: *const T, param0: u32, param1: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetDeviceState(@ptrCast(*const IDirectInputDevice8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetDeviceData(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_SetDataFormat(self: *const T, param0: ?*DIDATAFORMAT) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).SetDataFormat(@ptrCast(*const IDirectInputDevice8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_SetEventNotification(self: *const T, param0: ?HANDLE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).SetEventNotification(@ptrCast(*const IDirectInputDevice8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_SetCooperativeLevel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).SetCooperativeLevel(@ptrCast(*const IDirectInputDevice8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetObjectInfo(self: *const T, param0: ?*DIDEVICEOBJECTINSTANCEA, param1: u32, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetObjectInfo(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetDeviceInfo(self: *const T, param0: ?*DIDEVICEINSTANCEA) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetDeviceInfo(@ptrCast(*const IDirectInputDevice8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInputDevice8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32, param2: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_CreateEffect(self: *const T, param0: ?*const Guid, param1: ?*DIEFFECT, param2: ?*?*IDirectInputEffect, param3: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).CreateEffect(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_EnumEffects(self: *const T, param0: ?LPDIENUMEFFECTSCALLBACKA, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).EnumEffects(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetEffectInfo(self: *const T, param0: ?*DIEFFECTINFOA, param1: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetEffectInfo(@ptrCast(*const IDirectInputDevice8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetForceFeedbackState(self: *const T, param0: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetForceFeedbackState(@ptrCast(*const IDirectInputDevice8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_SendForceFeedbackCommand(self: *const T, param0: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).SendForceFeedbackCommand(@ptrCast(*const IDirectInputDevice8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_EnumCreatedEffectObjects(self: *const T, param0: ?LPDIENUMCREATEDEFFECTOBJECTSCALLBACK, param1: ?*anyopaque, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).EnumCreatedEffectObjects(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_Escape(self: *const T, param0: ?*DIEFFESCAPE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).Escape(@ptrCast(*const IDirectInputDevice8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_Poll(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).Poll(@ptrCast(*const IDirectInputDevice8A, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_SendDeviceData(self: *const T, param0: u32, param1: ?*DIDEVICEOBJECTDATA, param2: ?*u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).SendDeviceData(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_EnumEffectsInFile(self: *const T, param0: ?[*:0]const u8, param1: ?LPDIENUMEFFECTSINFILECALLBACK, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).EnumEffectsInFile(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_WriteEffectToFile(self: *const T, param0: ?[*:0]const u8, param1: u32, param2: ?*DIFILEEFFECT, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).WriteEffectToFile(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_BuildActionMap(self: *const T, param0: ?*DIACTIONFORMATA, param1: ?[*:0]const u8, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).BuildActionMap(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_SetActionMap(self: *const T, param0: ?*DIACTIONFORMATA, param1: ?[*:0]const u8, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).SetActionMap(@ptrCast(*const IDirectInputDevice8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputDevice8A_GetImageInfo(self: *const T, param0: ?*DIDEVICEIMAGEINFOHEADERA) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputDevice8A.VTable, self.vtable).GetImageInfo(@ptrCast(*const IDirectInputDevice8A, self), param0); } };} pub usingnamespace MethodMixin(@This()); }; pub const DIMOUSESTATE = extern struct { lX: i32, lY: i32, lZ: i32, rgbButtons: [4]u8, }; pub const DIMOUSESTATE2 = extern struct { lX: i32, lY: i32, lZ: i32, rgbButtons: [8]u8, }; pub const DIJOYSTATE = extern struct { lX: i32, lY: i32, lZ: i32, lRx: i32, lRy: i32, lRz: i32, rglSlider: [2]i32, rgdwPOV: [4]u32, rgbButtons: [32]u8, }; pub const DIJOYSTATE2 = extern struct { lX: i32, lY: i32, lZ: i32, lRx: i32, lRy: i32, lRz: i32, rglSlider: [2]i32, rgdwPOV: [4]u32, rgbButtons: [128]u8, lVX: i32, lVY: i32, lVZ: i32, lVRx: i32, lVRy: i32, lVRz: i32, rglVSlider: [2]i32, lAX: i32, lAY: i32, lAZ: i32, lARx: i32, lARy: i32, lARz: i32, rglASlider: [2]i32, lFX: i32, lFY: i32, lFZ: i32, lFRx: i32, lFRy: i32, lFRz: i32, rglFSlider: [2]i32, }; pub const LPDIENUMDEVICESCALLBACKA = fn( param0: ?*DIDEVICEINSTANCEA, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPDIENUMDEVICESCALLBACKW = fn( param0: ?*DIDEVICEINSTANCEW, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPDICONFIGUREDEVICESCALLBACK = fn( param0: ?*IUnknown, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPDIENUMDEVICESBYSEMANTICSCBA = fn( param0: ?*DIDEVICEINSTANCEA, param1: ?*IDirectInputDevice8A, param2: u32, param3: u32, param4: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const LPDIENUMDEVICESBYSEMANTICSCBW = fn( param0: ?*DIDEVICEINSTANCEW, param1: ?*IDirectInputDevice8W, param2: u32, param3: u32, param4: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; const IID_IDirectInputW_Value = Guid.initString("89521361-aa8a-11cf-bfc7-444553540000"); pub const IID_IDirectInputW = &IID_IDirectInputW_Value; pub const IDirectInputW = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateDevice: fn( self: *const IDirectInputW, param0: ?*const Guid, param1: ?*?*IDirectInputDeviceW, param2: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumDevices: fn( self: *const IDirectInputW, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKW, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceStatus: fn( self: *const IDirectInputW, param0: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInputW, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInputW, param0: ?HINSTANCE, param1: 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 IDirectInputW_CreateDevice(self: *const T, param0: ?*const Guid, param1: ?*?*IDirectInputDeviceW, param2: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputW.VTable, self.vtable).CreateDevice(@ptrCast(*const IDirectInputW, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputW_EnumDevices(self: *const T, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKW, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputW.VTable, self.vtable).EnumDevices(@ptrCast(*const IDirectInputW, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputW_GetDeviceStatus(self: *const T, param0: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputW.VTable, self.vtable).GetDeviceStatus(@ptrCast(*const IDirectInputW, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputW_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputW.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInputW, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputW_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputW.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInputW, self), param0, param1); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputA_Value = Guid.initString("89521360-aa8a-11cf-bfc7-444553540000"); pub const IID_IDirectInputA = &IID_IDirectInputA_Value; pub const IDirectInputA = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateDevice: fn( self: *const IDirectInputA, param0: ?*const Guid, param1: ?*?*IDirectInputDeviceA, param2: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumDevices: fn( self: *const IDirectInputA, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKA, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceStatus: fn( self: *const IDirectInputA, param0: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInputA, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInputA, param0: ?HINSTANCE, param1: 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 IDirectInputA_CreateDevice(self: *const T, param0: ?*const Guid, param1: ?*?*IDirectInputDeviceA, param2: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputA.VTable, self.vtable).CreateDevice(@ptrCast(*const IDirectInputA, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputA_EnumDevices(self: *const T, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKA, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputA.VTable, self.vtable).EnumDevices(@ptrCast(*const IDirectInputA, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputA_GetDeviceStatus(self: *const T, param0: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputA.VTable, self.vtable).GetDeviceStatus(@ptrCast(*const IDirectInputA, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputA_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputA.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInputA, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputA_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputA.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInputA, self), param0, param1); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInput2W_Value = Guid.initString("5944e663-aa8a-11cf-bfc7-444553540000"); pub const IID_IDirectInput2W = &IID_IDirectInput2W_Value; pub const IDirectInput2W = extern struct { pub const VTable = extern struct { base: IDirectInputW.VTable, FindDevice: fn( self: *const IDirectInput2W, param0: ?*const Guid, param1: ?[*:0]const u16, param2: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInputW.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput2W_FindDevice(self: *const T, param0: ?*const Guid, param1: ?[*:0]const u16, param2: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput2W.VTable, self.vtable).FindDevice(@ptrCast(*const IDirectInput2W, self), param0, param1, param2); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInput2A_Value = Guid.initString("5944e662-aa8a-11cf-bfc7-444553540000"); pub const IID_IDirectInput2A = &IID_IDirectInput2A_Value; pub const IDirectInput2A = extern struct { pub const VTable = extern struct { base: IDirectInputA.VTable, FindDevice: fn( self: *const IDirectInput2A, param0: ?*const Guid, param1: ?[*:0]const u8, param2: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInputA.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput2A_FindDevice(self: *const T, param0: ?*const Guid, param1: ?[*:0]const u8, param2: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput2A.VTable, self.vtable).FindDevice(@ptrCast(*const IDirectInput2A, self), param0, param1, param2); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInput7W_Value = Guid.initString("9a4cb685-236d-11d3-8e9d-00c04f6844ae"); pub const IID_IDirectInput7W = &IID_IDirectInput7W_Value; pub const IDirectInput7W = extern struct { pub const VTable = extern struct { base: IDirectInput2W.VTable, CreateDeviceEx: fn( self: *const IDirectInput7W, param0: ?*const Guid, param1: ?*const Guid, param2: ?*?*anyopaque, param3: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInput2W.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput7W_CreateDeviceEx(self: *const T, param0: ?*const Guid, param1: ?*const Guid, param2: ?*?*anyopaque, param3: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput7W.VTable, self.vtable).CreateDeviceEx(@ptrCast(*const IDirectInput7W, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInput7A_Value = Guid.initString("9a4cb684-236d-11d3-8e9d-00c04f6844ae"); pub const IID_IDirectInput7A = &IID_IDirectInput7A_Value; pub const IDirectInput7A = extern struct { pub const VTable = extern struct { base: IDirectInput2A.VTable, CreateDeviceEx: fn( self: *const IDirectInput7A, param0: ?*const Guid, param1: ?*const Guid, param2: ?*?*anyopaque, param3: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, }; vtable: *const VTable, pub fn MethodMixin(comptime T: type) type { return struct { pub usingnamespace IDirectInput2A.MethodMixin(T); // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput7A_CreateDeviceEx(self: *const T, param0: ?*const Guid, param1: ?*const Guid, param2: ?*?*anyopaque, param3: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput7A.VTable, self.vtable).CreateDeviceEx(@ptrCast(*const IDirectInput7A, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInput8W_Value = Guid.initString("bf798031-483a-4da2-aa99-5d64ed369700"); pub const IID_IDirectInput8W = &IID_IDirectInput8W_Value; pub const IDirectInput8W = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateDevice: fn( self: *const IDirectInput8W, param0: ?*const Guid, param1: ?*?*IDirectInputDevice8W, param2: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumDevices: fn( self: *const IDirectInput8W, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKW, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceStatus: fn( self: *const IDirectInput8W, param0: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInput8W, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInput8W, param0: ?HINSTANCE, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindDevice: fn( self: *const IDirectInput8W, param0: ?*const Guid, param1: ?[*:0]const u16, param2: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumDevicesBySemantics: fn( self: *const IDirectInput8W, param0: ?[*:0]const u16, param1: ?*DIACTIONFORMATW, param2: ?LPDIENUMDEVICESBYSEMANTICSCBW, param3: ?*anyopaque, param4: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConfigureDevices: fn( self: *const IDirectInput8W, param0: ?LPDICONFIGUREDEVICESCALLBACK, param1: ?*DICONFIGUREDEVICESPARAMSW, param2: u32, param3: ?*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 IDirectInput8W_CreateDevice(self: *const T, param0: ?*const Guid, param1: ?*?*IDirectInputDevice8W, param2: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).CreateDevice(@ptrCast(*const IDirectInput8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8W_EnumDevices(self: *const T, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKW, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).EnumDevices(@ptrCast(*const IDirectInput8W, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8W_GetDeviceStatus(self: *const T, param0: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).GetDeviceStatus(@ptrCast(*const IDirectInput8W, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8W_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInput8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8W_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInput8W, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8W_FindDevice(self: *const T, param0: ?*const Guid, param1: ?[*:0]const u16, param2: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).FindDevice(@ptrCast(*const IDirectInput8W, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8W_EnumDevicesBySemantics(self: *const T, param0: ?[*:0]const u16, param1: ?*DIACTIONFORMATW, param2: ?LPDIENUMDEVICESBYSEMANTICSCBW, param3: ?*anyopaque, param4: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).EnumDevicesBySemantics(@ptrCast(*const IDirectInput8W, self), param0, param1, param2, param3, param4); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8W_ConfigureDevices(self: *const T, param0: ?LPDICONFIGUREDEVICESCALLBACK, param1: ?*DICONFIGUREDEVICESPARAMSW, param2: u32, param3: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8W.VTable, self.vtable).ConfigureDevices(@ptrCast(*const IDirectInput8W, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInput8A_Value = Guid.initString("bf798030-483a-4da2-aa99-5d64ed369700"); pub const IID_IDirectInput8A = &IID_IDirectInput8A_Value; pub const IDirectInput8A = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, CreateDevice: fn( self: *const IDirectInput8A, param0: ?*const Guid, param1: ?*?*IDirectInputDevice8A, param2: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumDevices: fn( self: *const IDirectInput8A, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKA, param2: ?*anyopaque, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetDeviceStatus: fn( self: *const IDirectInput8A, param0: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, RunControlPanel: fn( self: *const IDirectInput8A, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const IDirectInput8A, param0: ?HINSTANCE, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FindDevice: fn( self: *const IDirectInput8A, param0: ?*const Guid, param1: ?[*:0]const u8, param2: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumDevicesBySemantics: fn( self: *const IDirectInput8A, param0: ?[*:0]const u8, param1: ?*DIACTIONFORMATA, param2: ?LPDIENUMDEVICESBYSEMANTICSCBA, param3: ?*anyopaque, param4: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, ConfigureDevices: fn( self: *const IDirectInput8A, param0: ?LPDICONFIGUREDEVICESCALLBACK, param1: ?*DICONFIGUREDEVICESPARAMSA, param2: u32, param3: ?*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 IDirectInput8A_CreateDevice(self: *const T, param0: ?*const Guid, param1: ?*?*IDirectInputDevice8A, param2: ?*IUnknown) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).CreateDevice(@ptrCast(*const IDirectInput8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8A_EnumDevices(self: *const T, param0: u32, param1: ?LPDIENUMDEVICESCALLBACKA, param2: ?*anyopaque, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).EnumDevices(@ptrCast(*const IDirectInput8A, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8A_GetDeviceStatus(self: *const T, param0: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).GetDeviceStatus(@ptrCast(*const IDirectInput8A, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8A_RunControlPanel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).RunControlPanel(@ptrCast(*const IDirectInput8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8A_Initialize(self: *const T, param0: ?HINSTANCE, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).Initialize(@ptrCast(*const IDirectInput8A, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8A_FindDevice(self: *const T, param0: ?*const Guid, param1: ?[*:0]const u8, param2: ?*Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).FindDevice(@ptrCast(*const IDirectInput8A, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8A_EnumDevicesBySemantics(self: *const T, param0: ?[*:0]const u8, param1: ?*DIACTIONFORMATA, param2: ?LPDIENUMDEVICESBYSEMANTICSCBA, param3: ?*anyopaque, param4: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).EnumDevicesBySemantics(@ptrCast(*const IDirectInput8A, self), param0, param1, param2, param3, param4); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInput8A_ConfigureDevices(self: *const T, param0: ?LPDICONFIGUREDEVICESCALLBACK, param1: ?*DICONFIGUREDEVICESPARAMSA, param2: u32, param3: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInput8A.VTable, self.vtable).ConfigureDevices(@ptrCast(*const IDirectInput8A, self), param0, param1, param2, param3); } };} pub usingnamespace MethodMixin(@This()); }; pub const LPFNSHOWJOYCPL = fn( hWnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) void; pub const DIOBJECTATTRIBUTES = extern struct { dwFlags: u32, wUsagePage: u16, wUsage: u16, }; pub const DIFFOBJECTATTRIBUTES = extern struct { dwFFMaxForce: u32, dwFFForceResolution: u32, }; pub const DIOBJECTCALIBRATION = extern struct { lMin: i32, lCenter: i32, lMax: i32, }; pub const DIPOVCALIBRATION = extern struct { lMin: [5]i32, lMax: [5]i32, }; pub const DIEFFECTATTRIBUTES = extern struct { dwEffectId: u32, dwEffType: u32, dwStaticParams: u32, dwDynamicParams: u32, dwCoords: u32, }; pub const DIFFDEVICEATTRIBUTES = extern struct { dwFlags: u32, dwFFSamplePeriod: u32, dwFFMinTimeResolution: u32, }; pub const DIDRIVERVERSIONS = extern struct { dwSize: u32, dwFirmwareRevision: u32, dwHardwareRevision: u32, dwFFDriverVersion: u32, }; pub const DIDEVICESTATE = extern struct { dwSize: u32, dwState: u32, dwLoad: u32, }; pub const DIHIDFFINITINFO = extern struct { dwSize: u32, pwszDeviceInterface: ?PWSTR, GuidInstance: Guid, }; const IID_IDirectInputEffectDriver_Value = Guid.initString("02538130-898f-11d0-9ad0-00a0c9a06e35"); pub const IID_IDirectInputEffectDriver = &IID_IDirectInputEffectDriver_Value; pub const IDirectInputEffectDriver = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, DeviceID: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, param2: u32, param3: u32, param4: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetVersions: fn( self: *const IDirectInputEffectDriver, param0: ?*DIDRIVERVERSIONS, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Escape: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, param2: ?*DIEFFESCAPE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetGain: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendForceFeedbackCommand: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetForceFeedbackState: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: ?*DIDEVICESTATE, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DownloadEffect: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, param2: ?*u32, param3: ?*DIEFFECT, param4: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DestroyEffect: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StartEffect: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, param2: u32, param3: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, StopEffect: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetEffectStatus: fn( self: *const IDirectInputEffectDriver, param0: u32, param1: u32, param2: ?*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 IDirectInputEffectDriver_DeviceID(self: *const T, param0: u32, param1: u32, param2: u32, param3: u32, param4: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).DeviceID(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1, param2, param3, param4); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_GetVersions(self: *const T, param0: ?*DIDRIVERVERSIONS) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).GetVersions(@ptrCast(*const IDirectInputEffectDriver, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_Escape(self: *const T, param0: u32, param1: u32, param2: ?*DIEFFESCAPE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).Escape(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_SetGain(self: *const T, param0: u32, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).SetGain(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_SendForceFeedbackCommand(self: *const T, param0: u32, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).SendForceFeedbackCommand(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_GetForceFeedbackState(self: *const T, param0: u32, param1: ?*DIDEVICESTATE) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).GetForceFeedbackState(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_DownloadEffect(self: *const T, param0: u32, param1: u32, param2: ?*u32, param3: ?*DIEFFECT, param4: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).DownloadEffect(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1, param2, param3, param4); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_DestroyEffect(self: *const T, param0: u32, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).DestroyEffect(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_StartEffect(self: *const T, param0: u32, param1: u32, param2: u32, param3: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).StartEffect(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_StopEffect(self: *const T, param0: u32, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).StopEffect(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputEffectDriver_GetEffectStatus(self: *const T, param0: u32, param1: u32, param2: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputEffectDriver.VTable, self.vtable).GetEffectStatus(@ptrCast(*const IDirectInputEffectDriver, self), param0, param1, param2); } };} pub usingnamespace MethodMixin(@This()); }; pub const JOYPOS = extern struct { dwX: u32, dwY: u32, dwZ: u32, dwR: u32, dwU: u32, dwV: u32, }; pub const JOYRANGE = extern struct { jpMin: JOYPOS, jpMax: JOYPOS, jpCenter: JOYPOS, }; pub const JOYREGUSERVALUES = extern struct { dwTimeOut: u32, jrvRanges: JOYRANGE, jpDeadZone: JOYPOS, }; pub const JOYREGHWSETTINGS = extern struct { dwFlags: u32, dwNumButtons: u32, }; pub const JOYREGHWVALUES = extern struct { jrvHardware: JOYRANGE, dwPOVValues: [4]u32, dwCalFlags: u32, }; pub const JOYREGHWCONFIG = extern struct { hws: JOYREGHWSETTINGS, dwUsageSettings: u32, hwv: JOYREGHWVALUES, dwType: u32, dwReserved: u32, }; pub const JOYCALIBRATE = extern struct { wXbase: u32, wXdelta: u32, wYbase: u32, wYdelta: u32, wZbase: u32, wZdelta: u32, }; pub const LPDIJOYTYPECALLBACK = fn( param0: ?[*:0]const u16, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) BOOL; pub const DIJOYTYPEINFO_DX5 = extern struct { dwSize: u32, hws: JOYREGHWSETTINGS, clsidConfig: Guid, wszDisplayName: [256]u16, wszCallout: [260]u16, }; pub const DIJOYTYPEINFO_DX6 = extern struct { dwSize: u32, hws: JOYREGHWSETTINGS, clsidConfig: Guid, wszDisplayName: [256]u16, wszCallout: [260]u16, wszHardwareId: [256]u16, dwFlags1: u32, }; pub const DIJOYTYPEINFO = extern struct { dwSize: u32, hws: JOYREGHWSETTINGS, clsidConfig: Guid, wszDisplayName: [256]u16, wszCallout: [260]u16, wszHardwareId: [256]u16, dwFlags1: u32, dwFlags2: u32, wszMapFile: [256]u16, }; pub const DIJOYCONFIG_DX5 = extern struct { dwSize: u32, guidInstance: Guid, hwc: JOYREGHWCONFIG, dwGain: u32, wszType: [256]u16, wszCallout: [256]u16, }; pub const DIJOYCONFIG = extern struct { dwSize: u32, guidInstance: Guid, hwc: JOYREGHWCONFIG, dwGain: u32, wszType: [256]u16, wszCallout: [256]u16, guidGameport: Guid, }; pub const DIJOYUSERVALUES = extern struct { dwSize: u32, ruv: JOYREGUSERVALUES, wszGlobalDriver: [256]u16, wszGameportEmulator: [256]u16, }; const IID_IDirectInputJoyConfig_Value = Guid.initString("1de12ab1-c9f5-11cf-bfc7-444553540000"); pub const IID_IDirectInputJoyConfig = &IID_IDirectInputJoyConfig_Value; pub const IDirectInputJoyConfig = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Acquire: fn( self: *const IDirectInputJoyConfig, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unacquire: fn( self: *const IDirectInputJoyConfig, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCooperativeLevel: fn( self: *const IDirectInputJoyConfig, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendNotify: fn( self: *const IDirectInputJoyConfig, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumTypes: fn( self: *const IDirectInputJoyConfig, param0: ?LPDIJOYTYPECALLBACK, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeInfo: fn( self: *const IDirectInputJoyConfig, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTypeInfo: fn( self: *const IDirectInputJoyConfig, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteType: fn( self: *const IDirectInputJoyConfig, param0: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConfig: fn( self: *const IDirectInputJoyConfig, param0: u32, param1: ?*DIJOYCONFIG, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetConfig: fn( self: *const IDirectInputJoyConfig, param0: u32, param1: ?*DIJOYCONFIG, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteConfig: fn( self: *const IDirectInputJoyConfig, param0: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserValues: fn( self: *const IDirectInputJoyConfig, param0: ?*DIJOYUSERVALUES, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetUserValues: fn( self: *const IDirectInputJoyConfig, param0: ?*DIJOYUSERVALUES, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddNewHardware: fn( self: *const IDirectInputJoyConfig, param0: ?HWND, param1: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenTypeKey: fn( self: *const IDirectInputJoyConfig, param0: ?[*:0]const u16, param1: u32, param2: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenConfigKey: fn( self: *const IDirectInputJoyConfig, param0: u32, param1: u32, param2: ?*?HKEY, ) 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 IDirectInputJoyConfig_Acquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).Acquire(@ptrCast(*const IDirectInputJoyConfig, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_Unacquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).Unacquire(@ptrCast(*const IDirectInputJoyConfig, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_SetCooperativeLevel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).SetCooperativeLevel(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_SendNotify(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).SendNotify(@ptrCast(*const IDirectInputJoyConfig, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_EnumTypes(self: *const T, param0: ?LPDIJOYTYPECALLBACK, param1: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).EnumTypes(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_GetTypeInfo(self: *const T, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).GetTypeInfo(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_SetTypeInfo(self: *const T, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).SetTypeInfo(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_DeleteType(self: *const T, param0: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).DeleteType(@ptrCast(*const IDirectInputJoyConfig, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_GetConfig(self: *const T, param0: u32, param1: ?*DIJOYCONFIG, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).GetConfig(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_SetConfig(self: *const T, param0: u32, param1: ?*DIJOYCONFIG, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).SetConfig(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_DeleteConfig(self: *const T, param0: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).DeleteConfig(@ptrCast(*const IDirectInputJoyConfig, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_GetUserValues(self: *const T, param0: ?*DIJOYUSERVALUES, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).GetUserValues(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_SetUserValues(self: *const T, param0: ?*DIJOYUSERVALUES, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).SetUserValues(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_AddNewHardware(self: *const T, param0: ?HWND, param1: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).AddNewHardware(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_OpenTypeKey(self: *const T, param0: ?[*:0]const u16, param1: u32, param2: ?*?HKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).OpenTypeKey(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig_OpenConfigKey(self: *const T, param0: u32, param1: u32, param2: ?*?HKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig.VTable, self.vtable).OpenConfigKey(@ptrCast(*const IDirectInputJoyConfig, self), param0, param1, param2); } };} pub usingnamespace MethodMixin(@This()); }; const IID_IDirectInputJoyConfig8_Value = Guid.initString("eb0d7dfa-1990-4f27-b4d6-edf2eec4a44c"); pub const IID_IDirectInputJoyConfig8 = &IID_IDirectInputJoyConfig8_Value; pub const IDirectInputJoyConfig8 = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Acquire: fn( self: *const IDirectInputJoyConfig8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Unacquire: fn( self: *const IDirectInputJoyConfig8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetCooperativeLevel: fn( self: *const IDirectInputJoyConfig8, param0: ?HWND, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SendNotify: fn( self: *const IDirectInputJoyConfig8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, EnumTypes: fn( self: *const IDirectInputJoyConfig8, param0: ?LPDIJOYTYPECALLBACK, param1: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetTypeInfo: fn( self: *const IDirectInputJoyConfig8, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetTypeInfo: fn( self: *const IDirectInputJoyConfig8, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32, param3: ?PWSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteType: fn( self: *const IDirectInputJoyConfig8, param0: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetConfig: fn( self: *const IDirectInputJoyConfig8, param0: u32, param1: ?*DIJOYCONFIG, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetConfig: fn( self: *const IDirectInputJoyConfig8, param0: u32, param1: ?*DIJOYCONFIG, param2: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, DeleteConfig: fn( self: *const IDirectInputJoyConfig8, param0: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, GetUserValues: fn( self: *const IDirectInputJoyConfig8, param0: ?*DIJOYUSERVALUES, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, SetUserValues: fn( self: *const IDirectInputJoyConfig8, param0: ?*DIJOYUSERVALUES, param1: u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, AddNewHardware: fn( self: *const IDirectInputJoyConfig8, param0: ?HWND, param1: ?*const Guid, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenTypeKey: fn( self: *const IDirectInputJoyConfig8, param0: ?[*:0]const u16, param1: u32, param2: ?*?HKEY, ) callconv(@import("std").os.windows.WINAPI) HRESULT, OpenAppStatusKey: fn( self: *const IDirectInputJoyConfig8, param0: ?*?HKEY, ) 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 IDirectInputJoyConfig8_Acquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).Acquire(@ptrCast(*const IDirectInputJoyConfig8, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_Unacquire(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).Unacquire(@ptrCast(*const IDirectInputJoyConfig8, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_SetCooperativeLevel(self: *const T, param0: ?HWND, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).SetCooperativeLevel(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_SendNotify(self: *const T) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).SendNotify(@ptrCast(*const IDirectInputJoyConfig8, self)); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_EnumTypes(self: *const T, param0: ?LPDIJOYTYPECALLBACK, param1: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).EnumTypes(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_GetTypeInfo(self: *const T, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).GetTypeInfo(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_SetTypeInfo(self: *const T, param0: ?[*:0]const u16, param1: ?*DIJOYTYPEINFO, param2: u32, param3: ?PWSTR) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).SetTypeInfo(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1, param2, param3); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_DeleteType(self: *const T, param0: ?[*:0]const u16) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).DeleteType(@ptrCast(*const IDirectInputJoyConfig8, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_GetConfig(self: *const T, param0: u32, param1: ?*DIJOYCONFIG, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).GetConfig(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_SetConfig(self: *const T, param0: u32, param1: ?*DIJOYCONFIG, param2: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).SetConfig(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_DeleteConfig(self: *const T, param0: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).DeleteConfig(@ptrCast(*const IDirectInputJoyConfig8, self), param0); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_GetUserValues(self: *const T, param0: ?*DIJOYUSERVALUES, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).GetUserValues(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_SetUserValues(self: *const T, param0: ?*DIJOYUSERVALUES, param1: u32) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).SetUserValues(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_AddNewHardware(self: *const T, param0: ?HWND, param1: ?*const Guid) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).AddNewHardware(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_OpenTypeKey(self: *const T, param0: ?[*:0]const u16, param1: u32, param2: ?*?HKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).OpenTypeKey(@ptrCast(*const IDirectInputJoyConfig8, self), param0, param1, param2); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn IDirectInputJoyConfig8_OpenAppStatusKey(self: *const T, param0: ?*?HKEY) callconv(.Inline) HRESULT { return @ptrCast(*const IDirectInputJoyConfig8.VTable, self.vtable).OpenAppStatusKey(@ptrCast(*const IDirectInputJoyConfig8, self), param0); } };} pub usingnamespace MethodMixin(@This()); }; pub const KEYBOARD_INPUT_DATA = extern struct { UnitId: u16, MakeCode: u16, Flags: u16, Reserved: u16, ExtraInformation: u32, }; pub const KEYBOARD_TYPEMATIC_PARAMETERS = extern struct { UnitId: u16, Rate: u16, Delay: u16, }; pub const KEYBOARD_ID = extern struct { Type: u8, Subtype: u8, }; pub const KEYBOARD_ATTRIBUTES = extern struct { KeyboardIdentifier: KEYBOARD_ID, KeyboardMode: u16, NumberOfFunctionKeys: u16, NumberOfIndicators: u16, NumberOfKeysTotal: u16, InputDataQueueLength: u32, KeyRepeatMinimum: KEYBOARD_TYPEMATIC_PARAMETERS, KeyRepeatMaximum: KEYBOARD_TYPEMATIC_PARAMETERS, }; pub const KEYBOARD_EXTENDED_ATTRIBUTES = extern struct { Version: u8, FormFactor: u8, KeyType: u8, PhysicalLayout: u8, VendorSpecificPhysicalLayout: u8, IETFLanguageTagIndex: u8, ImplementedInputAssistControls: u8, }; pub const KEYBOARD_INDICATOR_PARAMETERS = extern struct { UnitId: u16, LedFlags: u16, }; pub const INDICATOR_LIST = extern struct { MakeCode: u16, IndicatorFlags: u16, }; pub const KEYBOARD_INDICATOR_TRANSLATION = extern struct { NumberOfIndicatorKeys: u16, IndicatorList: [1]INDICATOR_LIST, }; pub const KEYBOARD_UNIT_ID_PARAMETER = extern struct { UnitId: u16, }; pub const KEYBOARD_IME_STATUS = extern struct { UnitId: u16, ImeOpen: u32, ImeConvMode: u32, }; pub const MOUSE_INPUT_DATA = extern struct { UnitId: u16, Flags: u16, Anonymous: extern union { Buttons: u32, Anonymous: extern struct { ButtonFlags: u16, ButtonData: u16, }, }, RawButtons: u32, LastX: i32, LastY: i32, ExtraInformation: u32, }; pub const MOUSE_ATTRIBUTES = extern struct { MouseIdentifier: u16, NumberOfButtons: u16, SampleRate: u16, InputDataQueueLength: u32, }; pub const MOUSE_UNIT_ID_PARAMETER = extern struct { UnitId: u16, }; pub const HIDP_REPORT_TYPE = enum(i32) { Input = 0, Output = 1, Feature = 2, }; pub const HidP_Input = HIDP_REPORT_TYPE.Input; pub const HidP_Output = HIDP_REPORT_TYPE.Output; pub const HidP_Feature = HIDP_REPORT_TYPE.Feature; pub const USAGE_AND_PAGE = extern struct { Usage: u16, UsagePage: u16, }; pub const HIDP_BUTTON_CAPS = extern struct { UsagePage: u16, ReportID: u8, IsAlias: BOOLEAN, BitField: u16, LinkCollection: u16, LinkUsage: u16, LinkUsagePage: u16, IsRange: BOOLEAN, IsStringRange: BOOLEAN, IsDesignatorRange: BOOLEAN, IsAbsolute: BOOLEAN, ReportCount: u16, Reserved2: u16, Reserved: [9]u32, Anonymous: extern union { Range: extern struct { UsageMin: u16, UsageMax: u16, StringMin: u16, StringMax: u16, DesignatorMin: u16, DesignatorMax: u16, DataIndexMin: u16, DataIndexMax: u16, }, NotRange: extern struct { Usage: u16, Reserved1: u16, StringIndex: u16, Reserved2: u16, DesignatorIndex: u16, Reserved3: u16, DataIndex: u16, Reserved4: u16, }, }, }; pub const HIDP_VALUE_CAPS = extern struct { UsagePage: u16, ReportID: u8, IsAlias: BOOLEAN, BitField: u16, LinkCollection: u16, LinkUsage: u16, LinkUsagePage: u16, IsRange: BOOLEAN, IsStringRange: BOOLEAN, IsDesignatorRange: BOOLEAN, IsAbsolute: BOOLEAN, HasNull: BOOLEAN, Reserved: u8, BitSize: u16, ReportCount: u16, Reserved2: [5]u16, UnitsExp: u32, Units: u32, LogicalMin: i32, LogicalMax: i32, PhysicalMin: i32, PhysicalMax: i32, Anonymous: extern union { Range: extern struct { UsageMin: u16, UsageMax: u16, StringMin: u16, StringMax: u16, DesignatorMin: u16, DesignatorMax: u16, DataIndexMin: u16, DataIndexMax: u16, }, NotRange: extern struct { Usage: u16, Reserved1: u16, StringIndex: u16, Reserved2: u16, DesignatorIndex: u16, Reserved3: u16, DataIndex: u16, Reserved4: u16, }, }, }; pub const HIDP_LINK_COLLECTION_NODE = extern struct { // WARNING: unable to add field alignment because it's causing a compiler bug LinkUsage: u16, LinkUsagePage: u16, Parent: u16, NumberOfChildren: u16, NextSibling: u16, FirstChild: u16, _bitfield: u32, UserContext: ?*anyopaque, }; pub const _HIDP_PREPARSED_DATA = extern struct { placeholder: usize, // TODO: why is this type empty? }; pub const HIDP_CAPS = extern struct { Usage: u16, UsagePage: u16, InputReportByteLength: u16, OutputReportByteLength: u16, FeatureReportByteLength: u16, Reserved: [17]u16, NumberLinkCollectionNodes: u16, NumberInputButtonCaps: u16, NumberInputValueCaps: u16, NumberInputDataIndices: u16, NumberOutputButtonCaps: u16, NumberOutputValueCaps: u16, NumberOutputDataIndices: u16, NumberFeatureButtonCaps: u16, NumberFeatureValueCaps: u16, NumberFeatureDataIndices: u16, }; pub const HIDP_DATA = extern struct { DataIndex: u16, Reserved: u16, Anonymous: extern union { RawValue: u32, On: BOOLEAN, }, }; pub const HIDP_UNKNOWN_TOKEN = extern struct { Token: u8, Reserved: [3]u8, BitField: u32, }; pub const HIDP_EXTENDED_ATTRIBUTES = extern struct { // WARNING: unable to add field alignment because it's causing a compiler bug NumGlobalUnknowns: u8, Reserved: [3]u8, GlobalUnknowns: ?*HIDP_UNKNOWN_TOKEN, Data: [1]u32, }; pub const HIDP_BUTTON_ARRAY_DATA = extern struct { ArrayIndex: u16, On: BOOLEAN, }; pub const HIDP_KEYBOARD_DIRECTION = enum(i32) { Break = 0, Make = 1, }; pub const HidP_Keyboard_Break = HIDP_KEYBOARD_DIRECTION.Break; pub const HidP_Keyboard_Make = HIDP_KEYBOARD_DIRECTION.Make; pub const HIDP_KEYBOARD_MODIFIER_STATE = extern struct { Anonymous: extern union { Anonymous: extern struct { _bitfield: u32, }, ul: u32, }, }; pub const PHIDP_INSERT_SCANCODES = fn( Context: ?*anyopaque, // TODO: what to do with BytesParamIndex 2? NewScanCodes: ?[*]u8, Length: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub const PFN_HidP_GetVersionInternal = fn( Version: ?*u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub const HIDD_CONFIGURATION = extern struct { // WARNING: unable to add field alignment because it's causing a compiler bug cookie: ?*anyopaque, size: u32, RingBufferSize: u32, }; pub const HIDD_ATTRIBUTES = extern struct { Size: u32, VendorID: u16, ProductID: u16, VersionNumber: u16, }; pub const HID_XFER_PACKET = extern struct { reportBuffer: ?*u8, reportBufferLen: u32, reportId: u8, }; pub const HID_COLLECTION_INFORMATION = extern struct { DescriptorSize: u32, Polled: BOOLEAN, Reserved1: [1]u8, VendorID: u16, ProductID: u16, VersionNumber: u16, }; pub const HID_DRIVER_CONFIG = extern struct { Size: u32, RingBufferSize: u32, }; pub const GPIOBUTTONS_BUTTON_TYPE = enum(i32) { POWER = 0, WINDOWS = 1, VOLUME_UP = 2, VOLUME_DOWN = 3, ROTATION_LOCK = 4, BACK = 5, SEARCH = 6, CAMERA_FOCUS = 7, CAMERA_SHUTTER = 8, RINGER_TOGGLE = 9, HEADSET = 10, HWKB_DEPLOY = 11, CAMERA_LENS = 12, OEM_CUSTOM = 13, OEM_CUSTOM2 = 14, OEM_CUSTOM3 = 15, // COUNT_MIN = 5, this enum value conflicts with BACK COUNT = 16, }; pub const GPIO_BUTTON_POWER = GPIOBUTTONS_BUTTON_TYPE.POWER; pub const GPIO_BUTTON_WINDOWS = GPIOBUTTONS_BUTTON_TYPE.WINDOWS; pub const GPIO_BUTTON_VOLUME_UP = GPIOBUTTONS_BUTTON_TYPE.VOLUME_UP; pub const GPIO_BUTTON_VOLUME_DOWN = GPIOBUTTONS_BUTTON_TYPE.VOLUME_DOWN; pub const GPIO_BUTTON_ROTATION_LOCK = GPIOBUTTONS_BUTTON_TYPE.ROTATION_LOCK; pub const GPIO_BUTTON_BACK = GPIOBUTTONS_BUTTON_TYPE.BACK; pub const GPIO_BUTTON_SEARCH = GPIOBUTTONS_BUTTON_TYPE.SEARCH; pub const GPIO_BUTTON_CAMERA_FOCUS = GPIOBUTTONS_BUTTON_TYPE.CAMERA_FOCUS; pub const GPIO_BUTTON_CAMERA_SHUTTER = GPIOBUTTONS_BUTTON_TYPE.CAMERA_SHUTTER; pub const GPIO_BUTTON_RINGER_TOGGLE = GPIOBUTTONS_BUTTON_TYPE.RINGER_TOGGLE; pub const GPIO_BUTTON_HEADSET = GPIOBUTTONS_BUTTON_TYPE.HEADSET; pub const GPIO_BUTTON_HWKB_DEPLOY = GPIOBUTTONS_BUTTON_TYPE.HWKB_DEPLOY; pub const GPIO_BUTTON_CAMERA_LENS = GPIOBUTTONS_BUTTON_TYPE.CAMERA_LENS; pub const GPIO_BUTTON_OEM_CUSTOM = GPIOBUTTONS_BUTTON_TYPE.OEM_CUSTOM; pub const GPIO_BUTTON_OEM_CUSTOM2 = GPIOBUTTONS_BUTTON_TYPE.OEM_CUSTOM2; pub const GPIO_BUTTON_OEM_CUSTOM3 = GPIOBUTTONS_BUTTON_TYPE.OEM_CUSTOM3; pub const GPIO_BUTTON_COUNT_MIN = GPIOBUTTONS_BUTTON_TYPE.BACK; pub const GPIO_BUTTON_COUNT = GPIOBUTTONS_BUTTON_TYPE.COUNT; pub const INPUT_BUTTON_ENABLE_INFO = extern struct { ButtonType: GPIOBUTTONS_BUTTON_TYPE, Enabled: BOOLEAN, }; //-------------------------------------------------------------------------------- // Section: Functions (47) //-------------------------------------------------------------------------------- pub extern "DINPUT8" fn DirectInput8Create( hinst: ?HINSTANCE, dwVersion: u32, riidltf: ?*const Guid, ppvOut: ?*?*anyopaque, punkOuter: ?*IUnknown, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.0' pub extern "WINMM" fn joyConfigChanged( dwFlags: u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "HID" fn HidP_GetCaps( PreparsedData: isize, Capabilities: ?*HIDP_CAPS, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetLinkCollectionNodes( LinkCollectionNodes: [*]HIDP_LINK_COLLECTION_NODE, LinkCollectionNodesLength: ?*u32, PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetSpecificButtonCaps( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, ButtonCaps: [*]HIDP_BUTTON_CAPS, ButtonCapsLength: ?*u16, PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetButtonCaps( ReportType: HIDP_REPORT_TYPE, ButtonCaps: [*]HIDP_BUTTON_CAPS, ButtonCapsLength: ?*u16, PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetSpecificValueCaps( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, ValueCaps: [*]HIDP_VALUE_CAPS, ValueCapsLength: ?*u16, PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetValueCaps( ReportType: HIDP_REPORT_TYPE, ValueCaps: [*]HIDP_VALUE_CAPS, ValueCapsLength: ?*u16, PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetExtendedAttributes( ReportType: HIDP_REPORT_TYPE, DataIndex: u16, PreparsedData: isize, Attributes: [*]HIDP_EXTENDED_ATTRIBUTES, LengthAttributes: ?*u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_InitializeReportForID( ReportType: HIDP_REPORT_TYPE, ReportID: u8, PreparsedData: isize, // TODO: what to do with BytesParamIndex 4? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_SetData( ReportType: HIDP_REPORT_TYPE, DataList: [*]HIDP_DATA, DataLength: ?*u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 5? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetData( ReportType: HIDP_REPORT_TYPE, DataList: [*]HIDP_DATA, DataLength: ?*u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 5? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_MaxDataListLength( ReportType: HIDP_REPORT_TYPE, PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "HID" fn HidP_SetUsages( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, UsageList: [*:0]u16, UsageLength: ?*u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 7? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_UnsetUsages( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, UsageList: [*:0]u16, UsageLength: ?*u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 7? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetUsages( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, UsageList: [*:0]u16, UsageLength: ?*u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 7? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetUsagesEx( ReportType: HIDP_REPORT_TYPE, LinkCollection: u16, ButtonList: [*]USAGE_AND_PAGE, UsageLength: ?*u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 6? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_MaxUsageListLength( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "HID" fn HidP_SetUsageValue( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, UsageValue: u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 7? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_SetScaledUsageValue( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, UsageValue: i32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 7? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_SetUsageValueArray( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, // TODO: what to do with BytesParamIndex 5? UsageValue: ?[*]u8, UsageValueByteLength: u16, PreparsedData: isize, // TODO: what to do with BytesParamIndex 8? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetUsageValue( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, UsageValue: ?*u32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 7? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetScaledUsageValue( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, UsageValue: ?*i32, PreparsedData: isize, // TODO: what to do with BytesParamIndex 7? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetUsageValueArray( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, // TODO: what to do with BytesParamIndex 5? UsageValue: ?[*]u8, UsageValueByteLength: u16, PreparsedData: isize, // TODO: what to do with BytesParamIndex 8? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_UsageListDifference( PreviousUsageList: [*:0]u16, CurrentUsageList: [*:0]u16, BreakUsageList: [*:0]u16, MakeUsageList: [*:0]u16, UsageListLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_GetButtonArray( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, ButtonData: [*]HIDP_BUTTON_ARRAY_DATA, ButtonDataLength: ?*u16, PreparsedData: isize, // TODO: what to do with BytesParamIndex 8? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_SetButtonArray( ReportType: HIDP_REPORT_TYPE, UsagePage: u16, LinkCollection: u16, Usage: u16, ButtonData: [*]HIDP_BUTTON_ARRAY_DATA, ButtonDataLength: u16, PreparsedData: isize, // TODO: what to do with BytesParamIndex 8? Report: ?[*]u8, ReportLength: u32, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidP_TranslateUsagesToI8042ScanCodes( ChangedUsageList: [*:0]u16, UsageListLength: u32, KeyAction: HIDP_KEYBOARD_DIRECTION, ModifierState: ?*HIDP_KEYBOARD_MODIFIER_STATE, InsertCodesProcedure: ?PHIDP_INSERT_SCANCODES, InsertCodesContext: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) NTSTATUS; pub extern "HID" fn HidD_GetAttributes( HidDeviceObject: ?HANDLE, Attributes: ?*HIDD_ATTRIBUTES, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetHidGuid( HidGuid: ?*Guid, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "HID" fn HidD_GetPreparsedData( HidDeviceObject: ?HANDLE, PreparsedData: ?*isize, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_FreePreparsedData( PreparsedData: isize, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_FlushQueue( HidDeviceObject: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetConfiguration( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? Configuration: ?*HIDD_CONFIGURATION, ConfigurationLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_SetConfiguration( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? Configuration: ?*HIDD_CONFIGURATION, ConfigurationLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetFeature( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? ReportBuffer: ?*anyopaque, ReportBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_SetFeature( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? ReportBuffer: ?*anyopaque, ReportBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetInputReport( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? ReportBuffer: ?*anyopaque, ReportBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_SetOutputReport( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? ReportBuffer: ?*anyopaque, ReportBufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetNumInputBuffers( HidDeviceObject: ?HANDLE, NumberBuffers: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_SetNumInputBuffers( HidDeviceObject: ?HANDLE, NumberBuffers: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetPhysicalDescriptor( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? Buffer: ?*anyopaque, BufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetManufacturerString( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? Buffer: ?*anyopaque, BufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetProductString( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? Buffer: ?*anyopaque, BufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetIndexedString( HidDeviceObject: ?HANDLE, StringIndex: u32, // TODO: what to do with BytesParamIndex 3? Buffer: ?*anyopaque, BufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetSerialNumberString( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? Buffer: ?*anyopaque, BufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; pub extern "HID" fn HidD_GetMsGenreDescriptor( HidDeviceObject: ?HANDLE, // TODO: what to do with BytesParamIndex 2? Buffer: ?*anyopaque, BufferLength: u32, ) callconv(@import("std").os.windows.WINAPI) BOOLEAN; //-------------------------------------------------------------------------------- // Section: Unicode Aliases (22) //-------------------------------------------------------------------------------- const thismodule = @This(); pub usingnamespace switch (@import("../zig.zig").unicode_mode) { .ansi => struct { pub const DIACTION = thismodule.DIACTIONA; pub const DIACTIONFORMAT = thismodule.DIACTIONFORMATA; pub const DICONFIGUREDEVICESPARAMS = thismodule.DICONFIGUREDEVICESPARAMSA; pub const DIDEVICEIMAGEINFO = thismodule.DIDEVICEIMAGEINFOA; pub const DIDEVICEIMAGEINFOHEADER = thismodule.DIDEVICEIMAGEINFOHEADERA; pub const DIDEVICEOBJECTINSTANCE_DX3 = thismodule.DIDEVICEOBJECTINSTANCE_DX3A; pub const DIDEVICEOBJECTINSTANCE = thismodule.DIDEVICEOBJECTINSTANCEA; pub const LPDIENUMDEVICEOBJECTSCALLBACK = thismodule.LPDIENUMDEVICEOBJECTSCALLBACKA; pub const DIDEVICEINSTANCE_DX3 = thismodule.DIDEVICEINSTANCE_DX3A; pub const DIDEVICEINSTANCE = thismodule.DIDEVICEINSTANCEA; pub const IDirectInputDevice = thismodule.IDirectInputDeviceA; pub const DIEFFECTINFO = thismodule.DIEFFECTINFOA; pub const LPDIENUMEFFECTSCALLBACK = thismodule.LPDIENUMEFFECTSCALLBACKA; pub const IDirectInputDevice2 = thismodule.IDirectInputDevice2A; pub const IDirectInputDevice7 = thismodule.IDirectInputDevice7A; pub const IDirectInputDevice8 = thismodule.IDirectInputDevice8A; pub const LPDIENUMDEVICESCALLBACK = thismodule.LPDIENUMDEVICESCALLBACKA; pub const LPDIENUMDEVICESBYSEMANTICSCB = thismodule.LPDIENUMDEVICESBYSEMANTICSCBA; pub const IDirectInput = thismodule.IDirectInputA; pub const IDirectInput2 = thismodule.IDirectInput2A; pub const IDirectInput7 = thismodule.IDirectInput7A; pub const IDirectInput8 = thismodule.IDirectInput8A; }, .wide => struct { pub const DIACTION = thismodule.DIACTIONW; pub const DIACTIONFORMAT = thismodule.DIACTIONFORMATW; pub const DICONFIGUREDEVICESPARAMS = thismodule.DICONFIGUREDEVICESPARAMSW; pub const DIDEVICEIMAGEINFO = thismodule.DIDEVICEIMAGEINFOW; pub const DIDEVICEIMAGEINFOHEADER = thismodule.DIDEVICEIMAGEINFOHEADERW; pub const DIDEVICEOBJECTINSTANCE_DX3 = thismodule.DIDEVICEOBJECTINSTANCE_DX3W; pub const DIDEVICEOBJECTINSTANCE = thismodule.DIDEVICEOBJECTINSTANCEW; pub const LPDIENUMDEVICEOBJECTSCALLBACK = thismodule.LPDIENUMDEVICEOBJECTSCALLBACKW; pub const DIDEVICEINSTANCE_DX3 = thismodule.DIDEVICEINSTANCE_DX3W; pub const DIDEVICEINSTANCE = thismodule.DIDEVICEINSTANCEW; pub const IDirectInputDevice = thismodule.IDirectInputDeviceW; pub const DIEFFECTINFO = thismodule.DIEFFECTINFOW; pub const LPDIENUMEFFECTSCALLBACK = thismodule.LPDIENUMEFFECTSCALLBACKW; pub const IDirectInputDevice2 = thismodule.IDirectInputDevice2W; pub const IDirectInputDevice7 = thismodule.IDirectInputDevice7W; pub const IDirectInputDevice8 = thismodule.IDirectInputDevice8W; pub const LPDIENUMDEVICESCALLBACK = thismodule.LPDIENUMDEVICESCALLBACKW; pub const LPDIENUMDEVICESBYSEMANTICSCB = thismodule.LPDIENUMDEVICESBYSEMANTICSCBW; pub const IDirectInput = thismodule.IDirectInputW; pub const IDirectInput2 = thismodule.IDirectInput2W; pub const IDirectInput7 = thismodule.IDirectInput7W; pub const IDirectInput8 = thismodule.IDirectInput8W; }, .unspecified => if (@import("builtin").is_test) struct { pub const DIACTION = *opaque{}; pub const DIACTIONFORMAT = *opaque{}; pub const DICONFIGUREDEVICESPARAMS = *opaque{}; pub const DIDEVICEIMAGEINFO = *opaque{}; pub const DIDEVICEIMAGEINFOHEADER = *opaque{}; pub const DIDEVICEOBJECTINSTANCE_DX3 = *opaque{}; pub const DIDEVICEOBJECTINSTANCE = *opaque{}; pub const LPDIENUMDEVICEOBJECTSCALLBACK = *opaque{}; pub const DIDEVICEINSTANCE_DX3 = *opaque{}; pub const DIDEVICEINSTANCE = *opaque{}; pub const IDirectInputDevice = *opaque{}; pub const DIEFFECTINFO = *opaque{}; pub const LPDIENUMEFFECTSCALLBACK = *opaque{}; pub const IDirectInputDevice2 = *opaque{}; pub const IDirectInputDevice7 = *opaque{}; pub const IDirectInputDevice8 = *opaque{}; pub const LPDIENUMDEVICESCALLBACK = *opaque{}; pub const LPDIENUMDEVICESBYSEMANTICSCB = *opaque{}; pub const IDirectInput = *opaque{}; pub const IDirectInput2 = *opaque{}; pub const IDirectInput7 = *opaque{}; pub const IDirectInput8 = *opaque{}; } else struct { pub const DIACTION = @compileError("'DIACTION' requires that UNICODE be set to true or false in the root module"); pub const DIACTIONFORMAT = @compileError("'DIACTIONFORMAT' requires that UNICODE be set to true or false in the root module"); pub const DICONFIGUREDEVICESPARAMS = @compileError("'DICONFIGUREDEVICESPARAMS' requires that UNICODE be set to true or false in the root module"); pub const DIDEVICEIMAGEINFO = @compileError("'DIDEVICEIMAGEINFO' requires that UNICODE be set to true or false in the root module"); pub const DIDEVICEIMAGEINFOHEADER = @compileError("'DIDEVICEIMAGEINFOHEADER' requires that UNICODE be set to true or false in the root module"); pub const DIDEVICEOBJECTINSTANCE_DX3 = @compileError("'DIDEVICEOBJECTINSTANCE_DX3' requires that UNICODE be set to true or false in the root module"); pub const DIDEVICEOBJECTINSTANCE = @compileError("'DIDEVICEOBJECTINSTANCE' requires that UNICODE be set to true or false in the root module"); pub const LPDIENUMDEVICEOBJECTSCALLBACK = @compileError("'LPDIENUMDEVICEOBJECTSCALLBACK' requires that UNICODE be set to true or false in the root module"); pub const DIDEVICEINSTANCE_DX3 = @compileError("'DIDEVICEINSTANCE_DX3' requires that UNICODE be set to true or false in the root module"); pub const DIDEVICEINSTANCE = @compileError("'DIDEVICEINSTANCE' requires that UNICODE be set to true or false in the root module"); pub const IDirectInputDevice = @compileError("'IDirectInputDevice' requires that UNICODE be set to true or false in the root module"); pub const DIEFFECTINFO = @compileError("'DIEFFECTINFO' requires that UNICODE be set to true or false in the root module"); pub const LPDIENUMEFFECTSCALLBACK = @compileError("'LPDIENUMEFFECTSCALLBACK' requires that UNICODE be set to true or false in the root module"); pub const IDirectInputDevice2 = @compileError("'IDirectInputDevice2' requires that UNICODE be set to true or false in the root module"); pub const IDirectInputDevice7 = @compileError("'IDirectInputDevice7' requires that UNICODE be set to true or false in the root module"); pub const IDirectInputDevice8 = @compileError("'IDirectInputDevice8' requires that UNICODE be set to true or false in the root module"); pub const LPDIENUMDEVICESCALLBACK = @compileError("'LPDIENUMDEVICESCALLBACK' requires that UNICODE be set to true or false in the root module"); pub const LPDIENUMDEVICESBYSEMANTICSCB = @compileError("'LPDIENUMDEVICESBYSEMANTICSCB' requires that UNICODE be set to true or false in the root module"); pub const IDirectInput = @compileError("'IDirectInput' requires that UNICODE be set to true or false in the root module"); pub const IDirectInput2 = @compileError("'IDirectInput2' requires that UNICODE be set to true or false in the root module"); pub const IDirectInput7 = @compileError("'IDirectInput7' requires that UNICODE be set to true or false in the root module"); pub const IDirectInput8 = @compileError("'IDirectInput8' requires that UNICODE be set to true or false in the root module"); }, }; //-------------------------------------------------------------------------------- // Section: Imports (17) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const BOOLEAN = @import("../foundation.zig").BOOLEAN; const CHAR = @import("../foundation.zig").CHAR; const FILETIME = @import("../foundation.zig").FILETIME; const HANDLE = @import("../foundation.zig").HANDLE; const HINSTANCE = @import("../foundation.zig").HINSTANCE; const HKEY = @import("../system/registry.zig").HKEY; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const IUnknown = @import("../system/com.zig").IUnknown; const NTSTATUS = @import("../foundation.zig").NTSTATUS; const POINT = @import("../foundation.zig").POINT; const PROPERTYKEY = @import("../ui/shell/properties_system.zig").PROPERTYKEY; const PSTR = @import("../foundation.zig").PSTR; const PWSTR = @import("../foundation.zig").PWSTR; 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(), "LPDIENUMEFFECTSINFILECALLBACK")) { _ = LPDIENUMEFFECTSINFILECALLBACK; } if (@hasDecl(@This(), "LPDIENUMDEVICEOBJECTSCALLBACKA")) { _ = LPDIENUMDEVICEOBJECTSCALLBACKA; } if (@hasDecl(@This(), "LPDIENUMDEVICEOBJECTSCALLBACKW")) { _ = LPDIENUMDEVICEOBJECTSCALLBACKW; } if (@hasDecl(@This(), "LPDIENUMEFFECTSCALLBACKA")) { _ = LPDIENUMEFFECTSCALLBACKA; } if (@hasDecl(@This(), "LPDIENUMEFFECTSCALLBACKW")) { _ = LPDIENUMEFFECTSCALLBACKW; } if (@hasDecl(@This(), "LPDIENUMCREATEDEFFECTOBJECTSCALLBACK")) { _ = LPDIENUMCREATEDEFFECTOBJECTSCALLBACK; } if (@hasDecl(@This(), "LPDIENUMDEVICESCALLBACKA")) { _ = LPDIENUMDEVICESCALLBACKA; } if (@hasDecl(@This(), "LPDIENUMDEVICESCALLBACKW")) { _ = LPDIENUMDEVICESCALLBACKW; } if (@hasDecl(@This(), "LPDICONFIGUREDEVICESCALLBACK")) { _ = LPDICONFIGUREDEVICESCALLBACK; } if (@hasDecl(@This(), "LPDIENUMDEVICESBYSEMANTICSCBA")) { _ = LPDIENUMDEVICESBYSEMANTICSCBA; } if (@hasDecl(@This(), "LPDIENUMDEVICESBYSEMANTICSCBW")) { _ = LPDIENUMDEVICESBYSEMANTICSCBW; } if (@hasDecl(@This(), "LPFNSHOWJOYCPL")) { _ = LPFNSHOWJOYCPL; } if (@hasDecl(@This(), "LPDIJOYTYPECALLBACK")) { _ = LPDIJOYTYPECALLBACK; } if (@hasDecl(@This(), "PHIDP_INSERT_SCANCODES")) { _ = PHIDP_INSERT_SCANCODES; } if (@hasDecl(@This(), "PFN_HidP_GetVersionInternal")) { _ = PFN_HidP_GetVersionInternal; } @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/devices/human_interface_device.zig
const common = @import("common.zig"); pub const Object = common.Object; pub const Message = common.Message; pub const Interface = common.Interface; pub const Array = common.Array; pub const Fixed = common.Fixed; pub const Argument = common.Argument; pub const Proxy = opaque { extern fn wl_proxy_create(factory: *Proxy, interface: *const Interface) *Proxy; pub fn create(factory: *Proxy, interface: *const Interface) error{OutOfMemory}!*Proxy { return wl_proxy_create(factory.impl, interface) orelse error.OutOfMemory; } extern fn wl_proxy_destroy(proxy: *Proxy) void; pub fn destroy(proxy: *Proxy) void { wl_proxy_destroy(proxy); } extern fn wl_proxy_marshal_array(proxy: *Proxy, opcode: u32, args: ?[*]Argument) void; pub const marshal = wl_proxy_marshal_array; extern fn wl_proxy_marshal_array_constructor( proxy: *Proxy, opcode: u32, args: [*]Argument, interface: *const Interface, ) ?*Proxy; pub fn marshalConstructor( proxy: *Proxy, opcode: u32, args: [*]Argument, interface: *const Interface, ) error{OutOfMemory}!*Proxy { return wl_proxy_marshal_array_constructor(proxy, opcode, args, interface) orelse error.OutOfMemory; } extern fn wl_proxy_marshal_array_constructor_versioned( proxy: *Proxy, opcode: u32, args: [*]Argument, interface: *const Interface, version: u32, ) ?*Proxy; pub fn marshalConstructorVersioned( proxy: *Proxy, opcode: u32, args: [*]Argument, interface: *const Interface, version: u32, ) error{OutOfMemory}!*Proxy { return wl_proxy_marshal_array_constructor_versioned(proxy, opcode, args, interface, version) orelse error.OutOfMemory; } const DispatcherFn = fn ( implementation: ?*const c_void, proxy: *Proxy, opcode: u32, message: *const Message, args: [*]Argument, ) callconv(.C) c_int; extern fn wl_proxy_add_dispatcher( proxy: *Proxy, dispatcher: DispatcherFn, implementation: ?*const c_void, data: ?*c_void, ) c_int; pub fn addDispatcher( proxy: *Proxy, dispatcher: DispatcherFn, implementation: ?*const c_void, data: ?*c_void, ) !void { if (wl_proxy_add_dispatcher(proxy, dispatcher, implementation, data) == -1) return error.AlreadyHasListener; } // TODO: consider removing this to make setListener() on protocol objects // actually type safe for data extern fn wl_proxy_set_user_data(proxy: *Proxy, user_data: ?*c_void) void; pub fn setUserData(proxy: *Proxy, user_data: ?*c_void) void { wl_proxy_set_user_data(proxy, user_data); } extern fn wl_proxy_get_user_data(proxy: *Proxy) ?*c_void; pub fn getUserData(proxy: *Proxy) ?*c_void { return wl_proxy_get_user_data(proxy); } extern fn wl_proxy_get_version(proxy: *Proxy) u32; pub fn getVersion(proxy: *Proxy) u32 { return wl_proxy_get_version(proxy); } extern fn wl_proxy_get_id(proxy: *Proxy) u32; pub fn getId(proxy: *Proxy) u32 { return wl_proxy_get_id(proxy); } }; pub const EventQueue = opaque { extern fn wl_event_queue_destroy(queue: *EventQueue) void; pub fn destroy(event_queue: *EventQueue) void { wl_event_queue_destroy(event_queue); } };
wayland_client_core.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/puzzle/day17.txt"); pub fn main() !void { var parts = split(data, "x="); var line = parts.next().?; line = parts.next().?; var values = tokenize(line, "., y=\r\n"); var x0: i64 = parseInt(i64, values.next().?, 10) catch unreachable; var x1: i64 = parseInt(i64, values.next().?, 10) catch unreachable; var y0: i64 = parseInt(i64, values.next().?, 10) catch unreachable; var y1: i64 = parseInt(i64, values.next().?, 10) catch unreachable; print("{} {} {} {}\n", .{ x0, x1, y0, y1 }); var count: i64 = 0; var vx: i64 = 0; while (vx <= x1) : (vx += 1) { var vy: i64 = -y0; while (vy >= y0) : (vy -= 1) { var x = vx; var dx = vx; var y = vy; var dy = vy; while (x <= x1 and y >= y0) { if (x0 <= x and x <= x1 and y0 <= y and y <= y1) { count += 1; break; } dx = max(0, dx-1); dy -= 1; x += dx; y += dy; } } } print("{}", .{count}); } // Useful stdlib functions const tokenize = std.mem.tokenize; const split = std.mem.split; const indexOf = std.mem.indexOfScalar; const indexOfAny = std.mem.indexOfAny; const indexOfStr = std.mem.indexOfPosLinear; const lastIndexOf = std.mem.lastIndexOfScalar; const lastIndexOfAny = std.mem.lastIndexOfAny; const lastIndexOfStr = std.mem.lastIndexOfLinear; const trim = std.mem.trim; const sliceMin = std.mem.min; const sliceMax = std.mem.max; const parseInt = std.fmt.parseInt; const parseFloat = std.fmt.parseFloat; const min = std.math.min; const min3 = std.math.min3; const max = std.math.max; const max3 = std.math.max3; const print = std.debug.print; const assert = std.debug.assert; const sort = std.sort.sort; const asc = std.sort.asc; const desc = std.sort.desc;
src/day17.zig
pub const cNodetypeSceTemplateServices = Guid.initString("24a7f717-1f0c-11d1-affb-00c04fb984f9"); pub const cNodetypeSceAnalysisServices = Guid.initString("678050c7-1ff8-11d1-affb-00c04fb984f9"); pub const cNodetypeSceEventLog = Guid.initString("2ce06698-4bf3-11d1-8c30-00c04fb984f9"); pub const SCESTATUS_SUCCESS = @as(i32, 0); pub const SCESTATUS_INVALID_PARAMETER = @as(i32, 1); pub const SCESTATUS_RECORD_NOT_FOUND = @as(i32, 2); pub const SCESTATUS_INVALID_DATA = @as(i32, 3); pub const SCESTATUS_OBJECT_EXIST = @as(i32, 4); pub const SCESTATUS_BUFFER_TOO_SMALL = @as(i32, 5); pub const SCESTATUS_PROFILE_NOT_FOUND = @as(i32, 6); pub const SCESTATUS_BAD_FORMAT = @as(i32, 7); pub const SCESTATUS_NOT_ENOUGH_RESOURCE = @as(i32, 8); pub const SCESTATUS_ACCESS_DENIED = @as(i32, 9); pub const SCESTATUS_CANT_DELETE = @as(i32, 10); pub const SCESTATUS_PREFIX_OVERFLOW = @as(i32, 11); pub const SCESTATUS_OTHER_ERROR = @as(i32, 12); pub const SCESTATUS_ALREADY_RUNNING = @as(i32, 13); pub const SCESTATUS_SERVICE_NOT_SUPPORT = @as(i32, 14); pub const SCESTATUS_MOD_NOT_FOUND = @as(i32, 15); pub const SCESTATUS_EXCEPTION_IN_SERVER = @as(i32, 16); pub const SCESTATUS_NO_TEMPLATE_GIVEN = @as(i32, 17); pub const SCESTATUS_NO_MAPPING = @as(i32, 18); pub const SCESTATUS_TRUST_FAIL = @as(i32, 19); pub const SCESVC_ENUMERATION_MAX = @as(i32, 100); //-------------------------------------------------------------------------------- // Section: Types (15) //-------------------------------------------------------------------------------- pub const SCE_LOG_ERR_LEVEL = enum(u32) { ALWAYS = 0, ERROR = 1, DETAIL = 2, DEBUG = 3, }; pub const SCE_LOG_LEVEL_ALWAYS = SCE_LOG_ERR_LEVEL.ALWAYS; pub const SCE_LOG_LEVEL_ERROR = SCE_LOG_ERR_LEVEL.ERROR; pub const SCE_LOG_LEVEL_DETAIL = SCE_LOG_ERR_LEVEL.DETAIL; pub const SCE_LOG_LEVEL_DEBUG = SCE_LOG_ERR_LEVEL.DEBUG; pub const SCESVC_CONFIGURATION_LINE = extern struct { Key: ?*i8, Value: ?*i8, ValueLen: u32, }; pub const SCESVC_CONFIGURATION_INFO = extern struct { Count: u32, Lines: ?*SCESVC_CONFIGURATION_LINE, }; pub const SCESVC_INFO_TYPE = enum(i32) { ConfigurationInfo = 0, MergedPolicyInfo = 1, AnalysisInfo = 2, InternalUse = 3, }; pub const SceSvcConfigurationInfo = SCESVC_INFO_TYPE.ConfigurationInfo; pub const SceSvcMergedPolicyInfo = SCESVC_INFO_TYPE.MergedPolicyInfo; pub const SceSvcAnalysisInfo = SCESVC_INFO_TYPE.AnalysisInfo; pub const SceSvcInternalUse = SCESVC_INFO_TYPE.InternalUse; pub const SCESVC_ANALYSIS_LINE = extern struct { Key: ?*i8, Value: ?*u8, ValueLen: u32, }; pub const SCESVC_ANALYSIS_INFO = extern struct { Count: u32, Lines: ?*SCESVC_ANALYSIS_LINE, }; pub const PFSCE_QUERY_INFO = fn( sceHandle: ?*anyopaque, sceType: SCESVC_INFO_TYPE, lpPrefix: ?*i8, bExact: BOOL, ppvInfo: ?*?*anyopaque, psceEnumHandle: ?*u32, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFSCE_SET_INFO = fn( sceHandle: ?*anyopaque, sceType: SCESVC_INFO_TYPE, lpPrefix: ?*i8, bExact: BOOL, pvInfo: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFSCE_FREE_INFO = fn( pvServiceInfo: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PFSCE_LOG_INFO = fn( ErrLevel: SCE_LOG_ERR_LEVEL, Win32rc: u32, pErrFmt: ?*i8, ) callconv(@import("std").os.windows.WINAPI) u32; pub const SCESVC_CALLBACK_INFO = extern struct { sceHandle: ?*anyopaque, pfQueryInfo: ?PFSCE_QUERY_INFO, pfSetInfo: ?PFSCE_SET_INFO, pfFreeInfo: ?PFSCE_FREE_INFO, pfLogInfo: ?PFSCE_LOG_INFO, }; pub const PF_ConfigAnalyzeService = fn( pSceCbInfo: ?*SCESVC_CALLBACK_INFO, ) callconv(@import("std").os.windows.WINAPI) u32; pub const PF_UpdateService = fn( pSceCbInfo: ?*SCESVC_CALLBACK_INFO, ServiceInfo: ?*SCESVC_CONFIGURATION_INFO, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows5.1.2600' const IID_ISceSvcAttachmentPersistInfo_Value = @import("../zig.zig").Guid.initString("6d90e0d0-200d-11d1-affb-00c04fb984f9"); pub const IID_ISceSvcAttachmentPersistInfo = &IID_ISceSvcAttachmentPersistInfo_Value; pub const ISceSvcAttachmentPersistInfo = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, Save: fn( self: *const ISceSvcAttachmentPersistInfo, lpTemplateName: ?*i8, scesvcHandle: ?*?*anyopaque, ppvData: ?*?*anyopaque, pbOverwriteAll: ?*BOOL, ) callconv(@import("std").os.windows.WINAPI) HRESULT, IsDirty: fn( self: *const ISceSvcAttachmentPersistInfo, lpTemplateName: ?*i8, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreeBuffer: fn( self: *const ISceSvcAttachmentPersistInfo, pvData: ?*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 ISceSvcAttachmentPersistInfo_Save(self: *const T, lpTemplateName: ?*i8, scesvcHandle: ?*?*anyopaque, ppvData: ?*?*anyopaque, pbOverwriteAll: ?*BOOL) callconv(.Inline) HRESULT { return @ptrCast(*const ISceSvcAttachmentPersistInfo.VTable, self.vtable).Save(@ptrCast(*const ISceSvcAttachmentPersistInfo, self), lpTemplateName, scesvcHandle, ppvData, pbOverwriteAll); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISceSvcAttachmentPersistInfo_IsDirty(self: *const T, lpTemplateName: ?*i8) callconv(.Inline) HRESULT { return @ptrCast(*const ISceSvcAttachmentPersistInfo.VTable, self.vtable).IsDirty(@ptrCast(*const ISceSvcAttachmentPersistInfo, self), lpTemplateName); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISceSvcAttachmentPersistInfo_FreeBuffer(self: *const T, pvData: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const ISceSvcAttachmentPersistInfo.VTable, self.vtable).FreeBuffer(@ptrCast(*const ISceSvcAttachmentPersistInfo, self), pvData); } };} pub usingnamespace MethodMixin(@This()); }; // TODO: this type is limited to platform 'windows5.1.2600' const IID_ISceSvcAttachmentData_Value = @import("../zig.zig").Guid.initString("17c35fde-200d-11d1-affb-00c04fb984f9"); pub const IID_ISceSvcAttachmentData = &IID_ISceSvcAttachmentData_Value; pub const ISceSvcAttachmentData = extern struct { pub const VTable = extern struct { base: IUnknown.VTable, GetData: fn( self: *const ISceSvcAttachmentData, scesvcHandle: ?*anyopaque, sceType: SCESVC_INFO_TYPE, ppvData: ?*?*anyopaque, psceEnumHandle: ?*u32, ) callconv(@import("std").os.windows.WINAPI) HRESULT, Initialize: fn( self: *const ISceSvcAttachmentData, lpServiceName: ?*i8, lpTemplateName: ?*i8, lpSceSvcPersistInfo: ?*ISceSvcAttachmentPersistInfo, pscesvcHandle: ?*?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, FreeBuffer: fn( self: *const ISceSvcAttachmentData, pvData: ?*anyopaque, ) callconv(@import("std").os.windows.WINAPI) HRESULT, CloseHandle: fn( self: *const ISceSvcAttachmentData, scesvcHandle: ?*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 ISceSvcAttachmentData_GetData(self: *const T, scesvcHandle: ?*anyopaque, sceType: SCESVC_INFO_TYPE, ppvData: ?*?*anyopaque, psceEnumHandle: ?*u32) callconv(.Inline) HRESULT { return @ptrCast(*const ISceSvcAttachmentData.VTable, self.vtable).GetData(@ptrCast(*const ISceSvcAttachmentData, self), scesvcHandle, sceType, ppvData, psceEnumHandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISceSvcAttachmentData_Initialize(self: *const T, lpServiceName: ?*i8, lpTemplateName: ?*i8, lpSceSvcPersistInfo: ?*ISceSvcAttachmentPersistInfo, pscesvcHandle: ?*?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const ISceSvcAttachmentData.VTable, self.vtable).Initialize(@ptrCast(*const ISceSvcAttachmentData, self), lpServiceName, lpTemplateName, lpSceSvcPersistInfo, pscesvcHandle); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISceSvcAttachmentData_FreeBuffer(self: *const T, pvData: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const ISceSvcAttachmentData.VTable, self.vtable).FreeBuffer(@ptrCast(*const ISceSvcAttachmentData, self), pvData); } // NOTE: method is namespaced with interface name to avoid conflicts for now pub fn ISceSvcAttachmentData_CloseHandle(self: *const T, scesvcHandle: ?*anyopaque) callconv(.Inline) HRESULT { return @ptrCast(*const ISceSvcAttachmentData.VTable, self.vtable).CloseHandle(@ptrCast(*const ISceSvcAttachmentData, self), scesvcHandle); } };} 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 (4) //-------------------------------------------------------------------------------- const Guid = @import("../zig.zig").Guid; const BOOL = @import("../foundation.zig").BOOL; const HRESULT = @import("../foundation.zig").HRESULT; const IUnknown = @import("../system/com.zig").IUnknown; test { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "PFSCE_QUERY_INFO")) { _ = PFSCE_QUERY_INFO; } if (@hasDecl(@This(), "PFSCE_SET_INFO")) { _ = PFSCE_SET_INFO; } if (@hasDecl(@This(), "PFSCE_FREE_INFO")) { _ = PFSCE_FREE_INFO; } if (@hasDecl(@This(), "PFSCE_LOG_INFO")) { _ = PFSCE_LOG_INFO; } if (@hasDecl(@This(), "PF_ConfigAnalyzeService")) { _ = PF_ConfigAnalyzeService; } if (@hasDecl(@This(), "PF_UpdateService")) { _ = PF_UpdateService; } @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/security/configuration_snapin.zig
const std = @import("std"); const mem = std.mem; pub const Token = struct { id: Id, start: usize, end: usize, pub const Id = union(enum) { Invalid, Eof, Nl, Identifier, /// special case for #include <...> MacroString, StringLiteral: StrKind, CharLiteral: StrKind, IntegerLiteral: NumSuffix, FloatLiteral: NumSuffix, Bang, BangEqual, Pipe, PipePipe, PipeEqual, Equal, EqualEqual, LParen, RParen, LBrace, RBrace, LBracket, RBracket, Period, Ellipsis, Caret, CaretEqual, Plus, PlusPlus, PlusEqual, Minus, MinusMinus, MinusEqual, Asterisk, AsteriskEqual, Percent, PercentEqual, Arrow, Colon, Semicolon, Slash, SlashEqual, Comma, Ampersand, AmpersandAmpersand, AmpersandEqual, QuestionMark, AngleBracketLeft, AngleBracketLeftEqual, AngleBracketAngleBracketLeft, AngleBracketAngleBracketLeftEqual, AngleBracketRight, AngleBracketRightEqual, AngleBracketAngleBracketRight, AngleBracketAngleBracketRightEqual, Tilde, LineComment, MultiLineComment, Hash, HashHash, Keyword_auto, Keyword_break, Keyword_case, Keyword_char, Keyword_const, Keyword_continue, Keyword_default, Keyword_do, Keyword_double, Keyword_else, Keyword_enum, Keyword_extern, Keyword_float, Keyword_for, Keyword_goto, Keyword_if, Keyword_int, Keyword_long, Keyword_register, Keyword_return, Keyword_short, Keyword_signed, Keyword_sizeof, Keyword_static, Keyword_struct, Keyword_switch, Keyword_typedef, Keyword_union, Keyword_unsigned, Keyword_void, Keyword_volatile, Keyword_while, // ISO C99 Keyword_bool, Keyword_complex, Keyword_imaginary, Keyword_inline, Keyword_restrict, // ISO C11 Keyword_alignas, Keyword_alignof, Keyword_atomic, Keyword_generic, Keyword_noreturn, Keyword_static_assert, Keyword_thread_local, // Preprocessor directives Keyword_include, Keyword_define, Keyword_ifdef, Keyword_ifndef, Keyword_error, Keyword_pragma, pub fn symbol(id: Id) []const u8 { return symbolName(id); } pub fn symbolName(id: std.meta.Tag(Id)) []const u8 { return switch (id) { .Invalid => "Invalid", .Eof => "Eof", .Nl => "NewLine", .Identifier => "Identifier", .MacroString => "MacroString", .StringLiteral => "StringLiteral", .CharLiteral => "CharLiteral", .IntegerLiteral => "IntegerLiteral", .FloatLiteral => "FloatLiteral", .LineComment => "LineComment", .MultiLineComment => "MultiLineComment", .Bang => "!", .BangEqual => "!=", .Pipe => "|", .PipePipe => "||", .PipeEqual => "|=", .Equal => "=", .EqualEqual => "==", .LParen => "(", .RParen => ")", .LBrace => "{", .RBrace => "}", .LBracket => "[", .RBracket => "]", .Period => ".", .Ellipsis => "...", .Caret => "^", .CaretEqual => "^=", .Plus => "+", .PlusPlus => "++", .PlusEqual => "+=", .Minus => "-", .MinusMinus => "--", .MinusEqual => "-=", .Asterisk => "*", .AsteriskEqual => "*=", .Percent => "%", .PercentEqual => "%=", .Arrow => "->", .Colon => ":", .Semicolon => ";", .Slash => "/", .SlashEqual => "/=", .Comma => ",", .Ampersand => "&", .AmpersandAmpersand => "&&", .AmpersandEqual => "&=", .QuestionMark => "?", .AngleBracketLeft => "<", .AngleBracketLeftEqual => "<=", .AngleBracketAngleBracketLeft => "<<", .AngleBracketAngleBracketLeftEqual => "<<=", .AngleBracketRight => ">", .AngleBracketRightEqual => ">=", .AngleBracketAngleBracketRight => ">>", .AngleBracketAngleBracketRightEqual => ">>=", .Tilde => "~", .Hash => "#", .HashHash => "##", .Keyword_auto => "auto", .Keyword_break => "break", .Keyword_case => "case", .Keyword_char => "char", .Keyword_const => "const", .Keyword_continue => "continue", .Keyword_default => "default", .Keyword_do => "do", .Keyword_double => "double", .Keyword_else => "else", .Keyword_enum => "enum", .Keyword_extern => "extern", .Keyword_float => "float", .Keyword_for => "for", .Keyword_goto => "goto", .Keyword_if => "if", .Keyword_int => "int", .Keyword_long => "long", .Keyword_register => "register", .Keyword_return => "return", .Keyword_short => "short", .Keyword_signed => "signed", .Keyword_sizeof => "sizeof", .Keyword_static => "static", .Keyword_struct => "struct", .Keyword_switch => "switch", .Keyword_typedef => "typedef", .Keyword_union => "union", .Keyword_unsigned => "unsigned", .Keyword_void => "void", .Keyword_volatile => "volatile", .Keyword_while => "while", .Keyword_bool => "_Bool", .Keyword_complex => "_Complex", .Keyword_imaginary => "_Imaginary", .Keyword_inline => "inline", .Keyword_restrict => "restrict", .Keyword_alignas => "_Alignas", .Keyword_alignof => "_Alignof", .Keyword_atomic => "_Atomic", .Keyword_generic => "_Generic", .Keyword_noreturn => "_Noreturn", .Keyword_static_assert => "_Static_assert", .Keyword_thread_local => "_Thread_local", .Keyword_include => "include", .Keyword_define => "define", .Keyword_ifdef => "ifdef", .Keyword_ifndef => "ifndef", .Keyword_error => "error", .Keyword_pragma => "pragma", }; } }; // TODO extensions pub const keywords = std.ComptimeStringMap(Id, .{ .{ "auto", .Keyword_auto }, .{ "break", .Keyword_break }, .{ "case", .Keyword_case }, .{ "char", .Keyword_char }, .{ "const", .Keyword_const }, .{ "continue", .Keyword_continue }, .{ "default", .Keyword_default }, .{ "do", .Keyword_do }, .{ "double", .Keyword_double }, .{ "else", .Keyword_else }, .{ "enum", .Keyword_enum }, .{ "extern", .Keyword_extern }, .{ "float", .Keyword_float }, .{ "for", .Keyword_for }, .{ "goto", .Keyword_goto }, .{ "if", .Keyword_if }, .{ "int", .Keyword_int }, .{ "long", .Keyword_long }, .{ "register", .Keyword_register }, .{ "return", .Keyword_return }, .{ "short", .Keyword_short }, .{ "signed", .Keyword_signed }, .{ "sizeof", .Keyword_sizeof }, .{ "static", .Keyword_static }, .{ "struct", .Keyword_struct }, .{ "switch", .Keyword_switch }, .{ "typedef", .Keyword_typedef }, .{ "union", .Keyword_union }, .{ "unsigned", .Keyword_unsigned }, .{ "void", .Keyword_void }, .{ "volatile", .Keyword_volatile }, .{ "while", .Keyword_while }, // ISO C99 .{ "_Bool", .Keyword_bool }, .{ "_Complex", .Keyword_complex }, .{ "_Imaginary", .Keyword_imaginary }, .{ "inline", .Keyword_inline }, .{ "restrict", .Keyword_restrict }, // ISO C11 .{ "_Alignas", .Keyword_alignas }, .{ "_Alignof", .Keyword_alignof }, .{ "_Atomic", .Keyword_atomic }, .{ "_Generic", .Keyword_generic }, .{ "_Noreturn", .Keyword_noreturn }, .{ "_Static_assert", .Keyword_static_assert }, .{ "_Thread_local", .Keyword_thread_local }, // Preprocessor directives .{ "include", .Keyword_include }, .{ "define", .Keyword_define }, .{ "ifdef", .Keyword_ifdef }, .{ "ifndef", .Keyword_ifndef }, .{ "error", .Keyword_error }, .{ "pragma", .Keyword_pragma }, }); // TODO do this in the preprocessor pub fn getKeyword(bytes: []const u8, pp_directive: bool) ?Id { if (keywords.get(bytes)) |id| { switch (id) { .Keyword_include, .Keyword_define, .Keyword_ifdef, .Keyword_ifndef, .Keyword_error, .Keyword_pragma, => if (!pp_directive) return null, else => {}, } return id; } return null; } pub const NumSuffix = enum { none, f, l, u, lu, ll, llu, }; pub const StrKind = enum { none, wide, utf_8, utf_16, utf_32, }; }; pub const Tokenizer = struct { buffer: []const u8, index: usize = 0, prev_tok_id: std.meta.Tag(Token.Id) = .Invalid, pp_directive: bool = false, pub fn next(self: *Tokenizer) Token { var result = Token{ .id = .Eof, .start = self.index, .end = undefined, }; var state: enum { Start, Cr, BackSlash, BackSlashCr, u, u8, U, L, StringLiteral, CharLiteralStart, CharLiteral, EscapeSequence, CrEscape, OctalEscape, HexEscape, UnicodeEscape, Identifier, Equal, Bang, Pipe, Percent, Asterisk, Plus, /// special case for #include <...> MacroString, AngleBracketLeft, AngleBracketAngleBracketLeft, AngleBracketRight, AngleBracketAngleBracketRight, Caret, Period, Period2, Minus, Slash, Ampersand, Hash, LineComment, MultiLineComment, MultiLineCommentAsterisk, Zero, IntegerLiteralOct, IntegerLiteralBinary, IntegerLiteralBinaryFirst, IntegerLiteralHex, IntegerLiteralHexFirst, IntegerLiteral, IntegerSuffix, IntegerSuffixU, IntegerSuffixL, IntegerSuffixLL, IntegerSuffixUL, FloatFraction, FloatFractionHex, FloatExponent, FloatExponentDigits, FloatSuffix, } = .Start; var string = false; var counter: u32 = 0; while (self.index < self.buffer.len) : (self.index += 1) { const c = self.buffer[self.index]; switch (state) { .Start => switch (c) { '\n' => { self.pp_directive = false; result.id = .Nl; self.index += 1; break; }, '\r' => { state = .Cr; }, '"' => { result.id = .{ .StringLiteral = .none }; state = .StringLiteral; }, '\'' => { result.id = .{ .CharLiteral = .none }; state = .CharLiteralStart; }, 'u' => { state = .u; }, 'U' => { state = .U; }, 'L' => { state = .L; }, 'a'...'t', 'v'...'z', 'A'...'K', 'M'...'T', 'V'...'Z', '_', '$' => { state = .Identifier; }, '=' => { state = .Equal; }, '!' => { state = .Bang; }, '|' => { state = .Pipe; }, '(' => { result.id = .LParen; self.index += 1; break; }, ')' => { result.id = .RParen; self.index += 1; break; }, '[' => { result.id = .LBracket; self.index += 1; break; }, ']' => { result.id = .RBracket; self.index += 1; break; }, ';' => { result.id = .Semicolon; self.index += 1; break; }, ',' => { result.id = .Comma; self.index += 1; break; }, '?' => { result.id = .QuestionMark; self.index += 1; break; }, ':' => { result.id = .Colon; self.index += 1; break; }, '%' => { state = .Percent; }, '*' => { state = .Asterisk; }, '+' => { state = .Plus; }, '<' => { if (self.prev_tok_id == .Keyword_include) state = .MacroString else state = .AngleBracketLeft; }, '>' => { state = .AngleBracketRight; }, '^' => { state = .Caret; }, '{' => { result.id = .LBrace; self.index += 1; break; }, '}' => { result.id = .RBrace; self.index += 1; break; }, '~' => { result.id = .Tilde; self.index += 1; break; }, '.' => { state = .Period; }, '-' => { state = .Minus; }, '/' => { state = .Slash; }, '&' => { state = .Ampersand; }, '#' => { state = .Hash; }, '0' => { state = .Zero; }, '1'...'9' => { state = .IntegerLiteral; }, '\\' => { state = .BackSlash; }, '\t', '\x0B', '\x0C', ' ' => { result.start = self.index + 1; }, else => { // TODO handle invalid bytes better result.id = .Invalid; self.index += 1; break; }, }, .Cr => switch (c) { '\n' => { self.pp_directive = false; result.id = .Nl; self.index += 1; break; }, else => { result.id = .Invalid; break; }, }, .BackSlash => switch (c) { '\n' => { result.start = self.index + 1; state = .Start; }, '\r' => { state = .BackSlashCr; }, '\t', '\x0B', '\x0C', ' ' => { // TODO warn }, else => { result.id = .Invalid; break; }, }, .BackSlashCr => switch (c) { '\n' => { result.start = self.index + 1; state = .Start; }, else => { result.id = .Invalid; break; }, }, .u => switch (c) { '8' => { state = .u8; }, '\'' => { result.id = .{ .CharLiteral = .utf_16 }; state = .CharLiteralStart; }, '\"' => { result.id = .{ .StringLiteral = .utf_16 }; state = .StringLiteral; }, else => { self.index -= 1; state = .Identifier; }, }, .u8 => switch (c) { '\"' => { result.id = .{ .StringLiteral = .utf_8 }; state = .StringLiteral; }, else => { self.index -= 1; state = .Identifier; }, }, .U => switch (c) { '\'' => { result.id = .{ .CharLiteral = .utf_32 }; state = .CharLiteralStart; }, '\"' => { result.id = .{ .StringLiteral = .utf_32 }; state = .StringLiteral; }, else => { self.index -= 1; state = .Identifier; }, }, .L => switch (c) { '\'' => { result.id = .{ .CharLiteral = .wide }; state = .CharLiteralStart; }, '\"' => { result.id = .{ .StringLiteral = .wide }; state = .StringLiteral; }, else => { self.index -= 1; state = .Identifier; }, }, .StringLiteral => switch (c) { '\\' => { string = true; state = .EscapeSequence; }, '"' => { self.index += 1; break; }, '\n', '\r' => { result.id = .Invalid; break; }, else => {}, }, .CharLiteralStart => switch (c) { '\\' => { string = false; state = .EscapeSequence; }, '\'', '\n' => { result.id = .Invalid; break; }, else => { state = .CharLiteral; }, }, .CharLiteral => switch (c) { '\\' => { string = false; state = .EscapeSequence; }, '\'' => { self.index += 1; break; }, '\n' => { result.id = .Invalid; break; }, else => {}, }, .EscapeSequence => switch (c) { '\'', '"', '?', '\\', 'a', 'b', 'f', 'n', 'r', 't', 'v', '\n' => { state = if (string) .StringLiteral else .CharLiteral; }, '\r' => { state = .CrEscape; }, '0'...'7' => { counter = 1; state = .OctalEscape; }, 'x' => { state = .HexEscape; }, 'u' => { counter = 4; state = .OctalEscape; }, 'U' => { counter = 8; state = .OctalEscape; }, else => { result.id = .Invalid; break; }, }, .CrEscape => switch (c) { '\n' => { state = if (string) .StringLiteral else .CharLiteral; }, else => { result.id = .Invalid; break; }, }, .OctalEscape => switch (c) { '0'...'7' => { counter += 1; if (counter == 3) { state = if (string) .StringLiteral else .CharLiteral; } }, else => { self.index -= 1; state = if (string) .StringLiteral else .CharLiteral; }, }, .HexEscape => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => {}, else => { self.index -= 1; state = if (string) .StringLiteral else .CharLiteral; }, }, .UnicodeEscape => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => { counter -= 1; if (counter == 0) { state = if (string) .StringLiteral else .CharLiteral; } }, else => { if (counter != 0) { result.id = .Invalid; break; } self.index -= 1; state = if (string) .StringLiteral else .CharLiteral; }, }, .Identifier => switch (c) { 'a'...'z', 'A'...'Z', '_', '0'...'9', '$' => {}, else => { result.id = Token.getKeyword(self.buffer[result.start..self.index], self.prev_tok_id == .Hash and !self.pp_directive) orelse .Identifier; if (self.prev_tok_id == .Hash) self.pp_directive = true; break; }, }, .Equal => switch (c) { '=' => { result.id = .EqualEqual; self.index += 1; break; }, else => { result.id = .Equal; break; }, }, .Bang => switch (c) { '=' => { result.id = .BangEqual; self.index += 1; break; }, else => { result.id = .Bang; break; }, }, .Pipe => switch (c) { '=' => { result.id = .PipeEqual; self.index += 1; break; }, '|' => { result.id = .PipePipe; self.index += 1; break; }, else => { result.id = .Pipe; break; }, }, .Percent => switch (c) { '=' => { result.id = .PercentEqual; self.index += 1; break; }, else => { result.id = .Percent; break; }, }, .Asterisk => switch (c) { '=' => { result.id = .AsteriskEqual; self.index += 1; break; }, else => { result.id = .Asterisk; break; }, }, .Plus => switch (c) { '=' => { result.id = .PlusEqual; self.index += 1; break; }, '+' => { result.id = .PlusPlus; self.index += 1; break; }, else => { result.id = .Plus; break; }, }, .MacroString => switch (c) { '>' => { result.id = .MacroString; self.index += 1; break; }, else => {}, }, .AngleBracketLeft => switch (c) { '<' => { state = .AngleBracketAngleBracketLeft; }, '=' => { result.id = .AngleBracketLeftEqual; self.index += 1; break; }, else => { result.id = .AngleBracketLeft; break; }, }, .AngleBracketAngleBracketLeft => switch (c) { '=' => { result.id = .AngleBracketAngleBracketLeftEqual; self.index += 1; break; }, else => { result.id = .AngleBracketAngleBracketLeft; break; }, }, .AngleBracketRight => switch (c) { '>' => { state = .AngleBracketAngleBracketRight; }, '=' => { result.id = .AngleBracketRightEqual; self.index += 1; break; }, else => { result.id = .AngleBracketRight; break; }, }, .AngleBracketAngleBracketRight => switch (c) { '=' => { result.id = .AngleBracketAngleBracketRightEqual; self.index += 1; break; }, else => { result.id = .AngleBracketAngleBracketRight; break; }, }, .Caret => switch (c) { '=' => { result.id = .CaretEqual; self.index += 1; break; }, else => { result.id = .Caret; break; }, }, .Period => switch (c) { '.' => { state = .Period2; }, '0'...'9' => { state = .FloatFraction; }, else => { result.id = .Period; break; }, }, .Period2 => switch (c) { '.' => { result.id = .Ellipsis; self.index += 1; break; }, else => { result.id = .Period; self.index -= 1; break; }, }, .Minus => switch (c) { '>' => { result.id = .Arrow; self.index += 1; break; }, '=' => { result.id = .MinusEqual; self.index += 1; break; }, '-' => { result.id = .MinusMinus; self.index += 1; break; }, else => { result.id = .Minus; break; }, }, .Slash => switch (c) { '/' => { state = .LineComment; }, '*' => { state = .MultiLineComment; }, '=' => { result.id = .SlashEqual; self.index += 1; break; }, else => { result.id = .Slash; break; }, }, .Ampersand => switch (c) { '&' => { result.id = .AmpersandAmpersand; self.index += 1; break; }, '=' => { result.id = .AmpersandEqual; self.index += 1; break; }, else => { result.id = .Ampersand; break; }, }, .Hash => switch (c) { '#' => { result.id = .HashHash; self.index += 1; break; }, else => { result.id = .Hash; break; }, }, .LineComment => switch (c) { '\n' => { result.id = .LineComment; break; }, else => {}, }, .MultiLineComment => switch (c) { '*' => { state = .MultiLineCommentAsterisk; }, else => {}, }, .MultiLineCommentAsterisk => switch (c) { '/' => { result.id = .MultiLineComment; self.index += 1; break; }, else => { state = .MultiLineComment; }, }, .Zero => switch (c) { '0'...'9' => { state = .IntegerLiteralOct; }, 'b', 'B' => { state = .IntegerLiteralBinaryFirst; }, 'x', 'X' => { state = .IntegerLiteralHexFirst; }, '.' => { state = .FloatFraction; }, else => { state = .IntegerSuffix; self.index -= 1; }, }, .IntegerLiteralOct => switch (c) { '0'...'7' => {}, else => { state = .IntegerSuffix; self.index -= 1; }, }, .IntegerLiteralBinaryFirst => switch (c) { '0'...'7' => state = .IntegerLiteralBinary, else => { result.id = .Invalid; break; }, }, .IntegerLiteralBinary => switch (c) { '0', '1' => {}, else => { state = .IntegerSuffix; self.index -= 1; }, }, .IntegerLiteralHexFirst => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => state = .IntegerLiteralHex, '.' => { state = .FloatFractionHex; }, 'p', 'P' => { state = .FloatExponent; }, else => { result.id = .Invalid; break; }, }, .IntegerLiteralHex => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => {}, '.' => { state = .FloatFractionHex; }, 'p', 'P' => { state = .FloatExponent; }, else => { state = .IntegerSuffix; self.index -= 1; }, }, .IntegerLiteral => switch (c) { '0'...'9' => {}, '.' => { state = .FloatFraction; }, 'e', 'E' => { state = .FloatExponent; }, else => { state = .IntegerSuffix; self.index -= 1; }, }, .IntegerSuffix => switch (c) { 'u', 'U' => { state = .IntegerSuffixU; }, 'l', 'L' => { state = .IntegerSuffixL; }, else => { result.id = .{ .IntegerLiteral = .none }; break; }, }, .IntegerSuffixU => switch (c) { 'l', 'L' => { state = .IntegerSuffixUL; }, else => { result.id = .{ .IntegerLiteral = .u }; break; }, }, .IntegerSuffixL => switch (c) { 'l', 'L' => { state = .IntegerSuffixLL; }, 'u', 'U' => { result.id = .{ .IntegerLiteral = .lu }; self.index += 1; break; }, else => { result.id = .{ .IntegerLiteral = .l }; break; }, }, .IntegerSuffixLL => switch (c) { 'u', 'U' => { result.id = .{ .IntegerLiteral = .llu }; self.index += 1; break; }, else => { result.id = .{ .IntegerLiteral = .ll }; break; }, }, .IntegerSuffixUL => switch (c) { 'l', 'L' => { result.id = .{ .IntegerLiteral = .llu }; self.index += 1; break; }, else => { result.id = .{ .IntegerLiteral = .lu }; break; }, }, .FloatFraction => switch (c) { '0'...'9' => {}, 'e', 'E' => { state = .FloatExponent; }, else => { self.index -= 1; state = .FloatSuffix; }, }, .FloatFractionHex => switch (c) { '0'...'9', 'a'...'f', 'A'...'F' => {}, 'p', 'P' => { state = .FloatExponent; }, else => { result.id = .Invalid; break; }, }, .FloatExponent => switch (c) { '+', '-' => { state = .FloatExponentDigits; }, else => { self.index -= 1; state = .FloatExponentDigits; }, }, .FloatExponentDigits => switch (c) { '0'...'9' => { counter += 1; }, else => { if (counter == 0) { result.id = .Invalid; break; } self.index -= 1; state = .FloatSuffix; }, }, .FloatSuffix => switch (c) { 'l', 'L' => { result.id = .{ .FloatLiteral = .l }; self.index += 1; break; }, 'f', 'F' => { result.id = .{ .FloatLiteral = .f }; self.index += 1; break; }, else => { result.id = .{ .FloatLiteral = .none }; break; }, }, } } else if (self.index == self.buffer.len) { switch (state) { .Start => {}, .u, .u8, .U, .L, .Identifier => { result.id = Token.getKeyword(self.buffer[result.start..self.index], self.prev_tok_id == .Hash and !self.pp_directive) orelse .Identifier; }, .Cr, .BackSlash, .BackSlashCr, .Period2, .StringLiteral, .CharLiteralStart, .CharLiteral, .EscapeSequence, .CrEscape, .OctalEscape, .HexEscape, .UnicodeEscape, .MultiLineComment, .MultiLineCommentAsterisk, .FloatExponent, .MacroString, .IntegerLiteralBinaryFirst, .IntegerLiteralHexFirst, => result.id = .Invalid, .FloatExponentDigits => result.id = if (counter == 0) .Invalid else .{ .FloatLiteral = .none }, .FloatFraction, .FloatFractionHex, => result.id = .{ .FloatLiteral = .none }, .IntegerLiteralOct, .IntegerLiteralBinary, .IntegerLiteralHex, .IntegerLiteral, .IntegerSuffix, .Zero, => result.id = .{ .IntegerLiteral = .none }, .IntegerSuffixU => result.id = .{ .IntegerLiteral = .u }, .IntegerSuffixL => result.id = .{ .IntegerLiteral = .l }, .IntegerSuffixLL => result.id = .{ .IntegerLiteral = .ll }, .IntegerSuffixUL => result.id = .{ .IntegerLiteral = .lu }, .FloatSuffix => result.id = .{ .FloatLiteral = .none }, .Equal => result.id = .Equal, .Bang => result.id = .Bang, .Minus => result.id = .Minus, .Slash => result.id = .Slash, .Ampersand => result.id = .Ampersand, .Hash => result.id = .Hash, .Period => result.id = .Period, .Pipe => result.id = .Pipe, .AngleBracketAngleBracketRight => result.id = .AngleBracketAngleBracketRight, .AngleBracketRight => result.id = .AngleBracketRight, .AngleBracketAngleBracketLeft => result.id = .AngleBracketAngleBracketLeft, .AngleBracketLeft => result.id = .AngleBracketLeft, .Plus => result.id = .Plus, .Percent => result.id = .Percent, .Caret => result.id = .Caret, .Asterisk => result.id = .Asterisk, .LineComment => result.id = .LineComment, } } self.prev_tok_id = result.id; result.end = self.index; return result; } }; test "operators" { try expectTokens( \\ ! != | || |= = == \\ ( ) { } [ ] . .. ... \\ ^ ^= + ++ += - -- -= \\ * *= % %= -> : ; / /= \\ , & && &= ? < <= << \\ <<= > >= >> >>= ~ # ## \\ , &[_]Token.Id{ .Bang, .BangEqual, .Pipe, .PipePipe, .PipeEqual, .Equal, .EqualEqual, .Nl, .LParen, .RParen, .LBrace, .RBrace, .LBracket, .RBracket, .Period, .Period, .Period, .Ellipsis, .Nl, .Caret, .CaretEqual, .Plus, .PlusPlus, .PlusEqual, .Minus, .MinusMinus, .MinusEqual, .Nl, .Asterisk, .AsteriskEqual, .Percent, .PercentEqual, .Arrow, .Colon, .Semicolon, .Slash, .SlashEqual, .Nl, .Comma, .Ampersand, .AmpersandAmpersand, .AmpersandEqual, .QuestionMark, .AngleBracketLeft, .AngleBracketLeftEqual, .AngleBracketAngleBracketLeft, .Nl, .AngleBracketAngleBracketLeftEqual, .AngleBracketRight, .AngleBracketRightEqual, .AngleBracketAngleBracketRight, .AngleBracketAngleBracketRightEqual, .Tilde, .Hash, .HashHash, .Nl, }); } test "keywords" { try expectTokens( \\auto break case char const continue default do \\double else enum extern float for goto if int \\long register return short signed sizeof static \\struct switch typedef union unsigned void volatile \\while _Bool _Complex _Imaginary inline restrict _Alignas \\_Alignof _Atomic _Generic _Noreturn _Static_assert _Thread_local \\ , &[_]Token.Id{ .Keyword_auto, .Keyword_break, .Keyword_case, .Keyword_char, .Keyword_const, .Keyword_continue, .Keyword_default, .Keyword_do, .Nl, .Keyword_double, .Keyword_else, .Keyword_enum, .Keyword_extern, .Keyword_float, .Keyword_for, .Keyword_goto, .Keyword_if, .Keyword_int, .Nl, .Keyword_long, .Keyword_register, .Keyword_return, .Keyword_short, .Keyword_signed, .Keyword_sizeof, .Keyword_static, .Nl, .Keyword_struct, .Keyword_switch, .Keyword_typedef, .Keyword_union, .Keyword_unsigned, .Keyword_void, .Keyword_volatile, .Nl, .Keyword_while, .Keyword_bool, .Keyword_complex, .Keyword_imaginary, .Keyword_inline, .Keyword_restrict, .Keyword_alignas, .Nl, .Keyword_alignof, .Keyword_atomic, .Keyword_generic, .Keyword_noreturn, .Keyword_static_assert, .Keyword_thread_local, .Nl, }); } test "preprocessor keywords" { try expectTokens( \\#include <test> \\#define #include <1 \\#ifdef \\#ifndef \\#error \\#pragma \\ , &[_]Token.Id{ .Hash, .Keyword_include, .MacroString, .Nl, .Hash, .Keyword_define, .Hash, .Identifier, .AngleBracketLeft, .{ .IntegerLiteral = .none }, .Nl, .Hash, .Keyword_ifdef, .Nl, .Hash, .Keyword_ifndef, .Nl, .Hash, .Keyword_error, .Nl, .Hash, .Keyword_pragma, .Nl, }); } test "line continuation" { try expectTokens( \\#define foo \ \\ bar \\"foo\ \\ bar" \\#define "foo" \\ "bar" \\#define "foo" \ \\ "bar" , &[_]Token.Id{ .Hash, .Keyword_define, .Identifier, .Identifier, .Nl, .{ .StringLiteral = .none }, .Nl, .Hash, .Keyword_define, .{ .StringLiteral = .none }, .Nl, .{ .StringLiteral = .none }, .Nl, .Hash, .Keyword_define, .{ .StringLiteral = .none }, .{ .StringLiteral = .none }, }); } test "string prefix" { try expectTokens( \\"foo" \\u"foo" \\u8"foo" \\U"foo" \\L"foo" \\'foo' \\u'foo' \\U'foo' \\L'foo' \\ , &[_]Token.Id{ .{ .StringLiteral = .none }, .Nl, .{ .StringLiteral = .utf_16 }, .Nl, .{ .StringLiteral = .utf_8 }, .Nl, .{ .StringLiteral = .utf_32 }, .Nl, .{ .StringLiteral = .wide }, .Nl, .{ .CharLiteral = .none }, .Nl, .{ .CharLiteral = .utf_16 }, .Nl, .{ .CharLiteral = .utf_32 }, .Nl, .{ .CharLiteral = .wide }, .Nl, }); } test "num suffixes" { try expectTokens( \\ 1.0f 1.0L 1.0 .0 1. \\ 0l 0lu 0ll 0llu 0 \\ 1u 1ul 1ull 1 \\ 0x 0b \\ , &[_]Token.Id{ .{ .FloatLiteral = .f }, .{ .FloatLiteral = .l }, .{ .FloatLiteral = .none }, .{ .FloatLiteral = .none }, .{ .FloatLiteral = .none }, .Nl, .{ .IntegerLiteral = .l }, .{ .IntegerLiteral = .lu }, .{ .IntegerLiteral = .ll }, .{ .IntegerLiteral = .llu }, .{ .IntegerLiteral = .none }, .Nl, .{ .IntegerLiteral = .u }, .{ .IntegerLiteral = .lu }, .{ .IntegerLiteral = .llu }, .{ .IntegerLiteral = .none }, .Nl, .Invalid, .Invalid, .Nl, }); } fn expectTokens(source: []const u8, expected_tokens: []const Token.Id) !void { var tokenizer = Tokenizer{ .buffer = source, }; for (expected_tokens) |expected_token_id| { const token = tokenizer.next(); if (!std.meta.eql(token.id, expected_token_id)) { std.debug.panic("expected {s}, found {s}\n", .{ @tagName(expected_token_id), @tagName(token.id) }); } } const last_token = tokenizer.next(); try std.testing.expect(last_token.id == .Eof); }
lib/std/c/tokenizer.zig
const fun = @import("fun"); const ascii = fun.ascii; const generic = fun.generic; const slice = generic.slice; const lu16 = fun.platform.lu16; pub const Banner = extern struct { version: u8, has_animated_dsi_icon: u8, crc16_across_0020h_083Fh: lu16, crc16_across_0020h_093Fh: lu16, crc16_across_0020h_0A3Fh: lu16, crc16_across_1240h_23BFh: lu16, reserved1: [0x16]u8, icon_bitmap: [0x200]u8, icon_palette: [0x20]u8, title_japanese: [0x100]u8, title_english: [0x100]u8, title_french: [0x100]u8, title_german: [0x100]u8, title_italian: [0x100]u8, title_spanish: [0x100]u8, //title_chinese: [0x100]u8, //title_korean: [0x100]u8, // TODO: Banner is actually a variable size structure. // "original Icon/Title structure rounded to 200h-byte sector boundary (ie. A00h bytes for Version 1 or 2)," // "however, later DSi carts are having a size entry at CartHdr[208h] (usually 23C0h)." //reserved2: [0x800]u8, //// animated DSi icons only //icon_animation_bitmap: [0x1000]u8, //icon_animation_palette: [0x100]u8, //icon_animation_sequence: [0x80]u8, // Should be [0x40]lu16? pub fn validate(banner: Banner) !void { if (banner.version == 0) return error.InvalidVersion; if (!slice.all(banner.reserved1[0..], isZero)) return error.InvalidReserved1; //if (!utils.all(u8, banner.reserved2, ascii.isZero)) // return error.InvalidReserved2; //if (!banner.has_animated_dsi_icon) { // if (!utils.all(u8, banner.icon_animation_bitmap, is0xFF)) // return error.InvalidIconAnimationBitmap; // if (!utils.all(u8, banner.icon_animation_palette, is0xFF)) // return error.InvalidIconAnimationPalette; // if (!utils.all(u8, banner.icon_animation_sequence, is0xFF)) // return error.InvalidIconAnimationSequence; //} } fn isZero(b: u8) bool { return b == 0; } fn is0xFF(char: u8) bool { return char == 0xFF; } };
src/banner.zig
const std = @import("std"); const server = @import("server.zig"); const comms = @import("comms.zig"); const fuse_client = @import("fuse_client.zig"); const service_name = "n00byedge.qubes-inter-vm-fs"; const config_dir_path = "/rw/config/inter-vm-fs/"; const fake_remote_connection = false; fn spawnProc(proc_cmdline: [][]const u8) !*std.ChildProcess { const proc = try std.ChildProcess.init(proc_cmdline, std.heap.page_allocator); errdefer proc.deinit(); proc.stdin_behavior = .Pipe; proc.stdout_behavior = .Pipe; try proc.spawn(); errdefer _ = proc.kill() catch unreachable; return proc; } pub fn spawnRemote(remote_name: []const u8, share_name: []const u8) !*std.ChildProcess { var service_name_buffer: [service_name.len + 1 + 256]u8 = undefined; std.mem.copy(u8, service_name_buffer[0..], service_name); service_name_buffer[service_name.len] = '+'; std.mem.copy(u8, service_name_buffer[service_name.len + 1 ..], share_name); return spawnProc(&[_][]const u8{ "qrexec-client-vm", remote_name, service_name_buffer[0 .. service_name.len + 1 + share_name.len], }); } pub fn spawnLocal(share_name: []const u8) !*std.ChildProcess { return spawnProc(&[_][]const u8{ service_name, "server", share_name, }); } fn parseArgsSpawnServer(arg_it: anytype) !*std.ChildProcess { const share_name = arg_it.next() orelse { std.log.err("No share name provided", .{}); std.os.exit(1); }; const remote_name = arg_it.next() orelse { return spawnLocal(share_name); }; return spawnRemote(remote_name, share_name); } pub fn main() !void { var arg_it = std.process.args().inner; _ = arg_it.skip(); if (arg_it.next()) |arg| { if (std.mem.eql(u8, arg, "client")) { const mount_dir = arg_it.next() orelse { std.log.err("No mount dir provided", .{}); std.os.exit(1); }; const server_proc = try parseArgsSpawnServer(&arg_it); defer _ = server_proc.kill() catch @panic(""); defer server_proc.deinit(); return fuse_client.mountDirAndRunClient(server_proc.stdout.?.reader(), server_proc.stdin.?.writer(), mount_dir); } else if (std.mem.eql(u8, arg, "server")) { // Qubes does authentication on the argument, we don't need to worry about it const share_name = arg_it.next() orelse { std.log.err("No share name provided", .{}); std.os.exit(1); }; var config_dir = std.fs.openDirAbsolute(config_dir_path, .{ .access_sub_paths = true, .iterate = false, .no_follow = false, }) catch { std.log.err("Could not open share config directory ({s})", .{config_dir_path}); std.os.exit(1); }; defer config_dir.close(); const share_file_config = config_dir.openFile(share_name, .{ .read = true, .write = false, }) catch { std.log.err("Could not open share config file (share {s})", .{share_name}); std.os.exit(1); }; defer share_file_config.close(); // Now we need to find out what the local path and mode is of this directory // example: // path/to/share rw // another/path/to/share r var buffer: [256]u8 = undefined; var read_len = try share_file_config.readAll(buffer[0..]); // Last space separates the path from the flags const last_space_pos = std.mem.lastIndexOfScalar(u8, buffer[0..read_len], ' ') orelse { std.log.err("Invalid config for share '{s}'", .{share_name}); std.os.exit(1); }; // Cut the buffer off at the first newline, if there is one if (std.mem.indexOfScalar(u8, buffer[0..read_len], '\n')) |nl_pos| read_len = nl_pos; const path = buffer[0..last_space_pos]; var flags = buffer[last_space_pos + 1 .. read_len]; // Determine the flags const enable_writing = std.mem.eql(u8, flags, "rw"); buffer[path.len] = 0; // Make a new filesystem namespace so that we can chroot if (std.os.linux.unshare(std.os.CLONE_NEWUSER) != 0) { @panic("unshare"); } if (std.os.linux.chroot(@ptrCast([*:0]u8, &buffer[0])) != 0) { @panic("chroot"); } if (std.os.linux.chdir("/") != 0) { @panic("chdir"); } // stdin/stdout is already connected to the remote, nothing to do try server.run(std.io.getStdIn().reader(), std.io.getStdOut().writer(), enable_writing); } else if (std.mem.eql(u8, arg, "create_share")) { //const share_name = arg_it.next(); //const client = arg_it.next(); //const client_path = arg_it.next(); //const server = arg_it.next(); //const server_path = arg_it.next(); //const flags = arg_it.next(); //const autostart = arg_it.next(); // dom0: echo 'client server allow' >> /etc/qubes-rpc/policy/{service_name}+{share_name} // server: echo '{server_path} {flags}' >> /rw/config/{service_name}/{share_name} // If autostart: // client: mkdir -p {client_path} // client: echo '/usr/bin/{service_name} client {client_path} {share_name} {server}' >> /rw/config/rc.local std.log.err("TODO: Implement share creation", .{}); std.os.exit(1); } else if (std.mem.eql(u8, arg, "install_template")) { //const template_name = arg_it.next(); // Set up client and servers in the template // template: cp {self} /usr/bin/{service_name} // template: echo 'exec /usr/bin/{service_name} server $QREXEC_SERVICE_ARGUMENT'> /etc/qubes-rpc/{service_name}' std.log.err("TODO: Implement installation into template", .{}); std.os.exit(1); } else { std.log.err("Invalid argument: {s} is not a valid mode", .{arg}); std.os.exit(1); } } else { std.log.err("Missing argument: mode", .{}); std.os.exit(1); } }
src/main.zig
const builtin = @import("builtin"); const __divmodsi4 = @import("int.zig").__divmodsi4; const __udivmodsi4 = @import("int.zig").__udivmodsi4; const __divmoddi4 = @import("int.zig").__divmoddi4; const __udivmoddi4 = @import("int.zig").__udivmoddi4; extern fn memset(dest: ?[*]u8, c: u8, n: usize) ?[*]u8; extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) ?[*]u8; extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) ?[*]u8; pub fn __aeabi_memcpy(dest: [*]u8, src: [*]u8, n: usize) callconv(.AAPCS) void { @setRuntimeSafety(false); _ = memcpy(dest, src, n); } pub fn __aeabi_memmove(dest: [*]u8, src: [*]u8, n: usize) callconv(.AAPCS) void { @setRuntimeSafety(false); _ = memmove(dest, src, n); } pub fn __aeabi_memset(dest: [*]u8, n: usize, c: u8) callconv(.AAPCS) void { @setRuntimeSafety(false); // This is dentical to the standard `memset` definition but with the last // two arguments swapped _ = memset(dest, c, n); } pub fn __aeabi_memclr(dest: [*]u8, n: usize) callconv(.AAPCS) void { @setRuntimeSafety(false); _ = memset(dest, 0, n); } // Dummy functions to avoid errors during the linking phase pub fn __aeabi_unwind_cpp_pr0() callconv(.C) void {} pub fn __aeabi_unwind_cpp_pr1() callconv(.C) void {} pub fn __aeabi_unwind_cpp_pr2() callconv(.C) void {} // This function can only clobber r0 according to the ABI pub fn __aeabi_read_tp() callconv(.Naked) void { @setRuntimeSafety(false); asm volatile ( \\ mrc p15, 0, r0, c13, c0, 3 \\ bx lr ); unreachable; } // The following functions are wrapped in an asm block to ensure the required // calling convention is always respected pub fn __aeabi_uidivmod() callconv(.Naked) void { @setRuntimeSafety(false); // Divide r0 by r1; the quotient goes in r0, the remainder in r1 asm volatile ( \\ push {lr} \\ sub sp, #4 \\ mov r2, sp \\ bl __udivmodsi4 \\ ldr r1, [sp] \\ add sp, #4 \\ pop {pc} : : : "memory" ); unreachable; } pub fn __aeabi_uldivmod() callconv(.Naked) void { @setRuntimeSafety(false); // Divide r1:r0 by r3:r2; the quotient goes in r1:r0, the remainder in r3:r2 asm volatile ( \\ push {r4, lr} \\ sub sp, #16 \\ add r4, sp, #8 \\ str r4, [sp] \\ bl __udivmoddi4 \\ ldr r2, [sp, #8] \\ ldr r3, [sp, #12] \\ add sp, #16 \\ pop {r4, pc} : : : "memory" ); unreachable; } pub fn __aeabi_idivmod() callconv(.Naked) void { @setRuntimeSafety(false); // Divide r0 by r1; the quotient goes in r0, the remainder in r1 asm volatile ( \\ push {lr} \\ sub sp, #4 \\ mov r2, sp \\ bl __divmodsi4 \\ ldr r1, [sp] \\ add sp, #4 \\ pop {pc} : : : "memory" ); unreachable; } pub fn __aeabi_ldivmod() callconv(.Naked) void { @setRuntimeSafety(false); // Divide r1:r0 by r3:r2; the quotient goes in r1:r0, the remainder in r3:r2 asm volatile ( \\ push {r4, lr} \\ sub sp, #16 \\ add r4, sp, #8 \\ str r4, [sp] \\ bl __divmoddi4 \\ ldr r2, [sp, #8] \\ ldr r3, [sp, #12] \\ add sp, #16 \\ pop {r4, pc} : : : "memory" ); unreachable; }
lib/std/special/compiler_rt/arm.zig
const Self = @This(); const std = @import("std"); const os = std.os; const wayland = @import("wayland"); const wl = wayland.client.wl; const wlr = wayland.client.zwlr; const c = @cImport({ @cInclude("cairo/cairo.h"); }); const Context = @import("main.zig").Context; const Buffer = @import("Buffer.zig"); const indicatorSize = 100; const Color = struct { r: u8, g: u8, b: u8, pub fn floatRed(self: Color) f16 { return @intToFloat(f16, self.r) / 255.0; } pub fn floatGreen(self: Color) f16 { return @intToFloat(f16, self.g) / 255.0; } pub fn floatBlue(self: Color) f16 { return @intToFloat(f16, self.b) / 255.0; } }; output: *wl.Output, context: *Context, surface: ?*wl.Surface, subsurface: ?*wl.Subsurface, preview_surface: ?*wl.Surface, layer_surface: ?*wlr.LayerSurfaceV1, buffer: ?Buffer, preview_buffer: ?Buffer, width: u32, height: u32, color: Color, pub fn init(context: *Context, output: *wl.Output) Self { return Self{ .context = context, .output = output, .surface = null, .subsurface = null, .layer_surface = null, .preview_surface = null, .preview_buffer = null, .buffer = null, .width = 0, .height = 0, .color = Color{ .r = 255, .g = 255, .b = 255 }, }; } pub fn setup(self: *Self) anyerror!void { self.output.setListener(*Self, outputListener, self); } pub fn createSurface(self: *Self, width: i32, height: i32) anyerror!void { self.width = @intCast(u32, width); self.height = @intCast(u32, height); const layer_shell = self.context.layer_shell orelse return error.NoWlrLayerShell; const compositor = self.context.compositor orelse return error.NoWlCompositor; const subcompositor = self.context.subcompositor orelse return error.NoWlSubcompositor; const shm = self.context.shm orelse return error.NoWlShm; const surface = try compositor.createSurface(); const preview_surface = try compositor.createSurface(); const region = try compositor.createRegion(); region.add(0, 0, 0, 0); preview_surface.setInputRegion(region); const subsurface = try subcompositor.getSubsurface(preview_surface, surface); subsurface.setPosition(-500, -500); subsurface.setDesync(); const layer_surface = try layer_shell.getLayerSurface( surface, self.output, wlr.LayerShellV1.Layer.overlay, "overlay", ); layer_surface.setSize(0, 0); layer_surface.setAnchor(.{ .top = true, .bottom = true, .right = true, .left = true }); layer_surface.setExclusiveZone(-1); layer_surface.setListener(*Self, layerSurfaceListener, self); surface.commit(); self.buffer = try Buffer.init(shm, width, height); self.preview_buffer = try Buffer.init(shm, indicatorSize, indicatorSize); preview_surface.attach(self.preview_buffer.?.buffer, 0, 0); preview_surface.commit(); self.preview_surface = preview_surface; self.surface = surface; self.subsurface = subsurface; } fn show(self: *Self) anyerror!void { const frame = try self.context.screencopy.?.captureOutput(0, self.output); frame.setListener(*Self, frameListener, self); } pub fn handlePointerLeft(self: *Self) void { self.subsurface.?.setPosition(-500, -500); self.preview_surface.?.commit(); self.surface.?.commit(); } pub fn handlePointerMotion(self: *Self, x: i24, y: i24) void { const image = self.buffer.?.data; const cx = @intCast(u32, x); const cy = @intCast(u32, y); const offset = (self.height - cy - 1) * self.width * 4 + cx * 4; self.color = Color{ .r = image[offset + 2], .g = image[offset + 1], .b = image[offset] }; { const cairo_surface = c.cairo_image_surface_create_for_data( @ptrCast([*c]u8, self.preview_buffer.?.data), c.cairo_format_t.CAIRO_FORMAT_ARGB32, indicatorSize, indicatorSize, indicatorSize * 4, ); const cairo = c.cairo_create(cairo_surface); c.cairo_set_antialias(cairo, c.cairo_antialias_t.CAIRO_ANTIALIAS_BEST); c.cairo_set_operator(cairo, c.cairo_operator_t.CAIRO_OPERATOR_CLEAR); c.cairo_paint(cairo); // White outline c.cairo_set_operator(cairo, c.cairo_operator_t.CAIRO_OPERATOR_SOURCE); c.cairo_set_source_rgb(cairo, 1.0, 1.0, 1.0); c.cairo_set_line_width(cairo, 25); c.cairo_arc(cairo, 50, 50, 30, 0, 2 * std.math.pi); c.cairo_stroke_preserve(cairo); // Black outline c.cairo_set_operator(cairo, c.cairo_operator_t.CAIRO_OPERATOR_SOURCE); c.cairo_set_source_rgb(cairo, 0.0, 0.0, 0.0); c.cairo_set_line_width(cairo, 22); c.cairo_arc(cairo, 50, 50, 30, 0, 2 * std.math.pi); c.cairo_stroke_preserve(cairo); // Circle filled with current color c.cairo_set_source_rgb( cairo, self.color.floatRed(), self.color.floatGreen(), self.color.floatBlue(), ); c.cairo_set_line_width(cairo, 20); c.cairo_arc(cairo, 50, 50, 30, 0, 2 * std.math.pi); c.cairo_stroke_preserve(cairo); c.cairo_destroy(cairo); self.preview_surface.?.attach(self.preview_buffer.?.buffer, 0, 0); self.preview_surface.?.damageBuffer(0, 0, indicatorSize, indicatorSize); } self.subsurface.?.setPosition(x - indicatorSize / 2, y - indicatorSize / 2); self.preview_surface.?.commit(); self.surface.?.commit(); } fn frameListener(frame: *wlr.ScreencopyFrameV1, event: wlr.ScreencopyFrameV1.Event, self: *Self) void { switch (event) { .buffer => |data| { frame.copy(self.buffer.?.buffer); }, .ready => { self.surface.?.attach(self.buffer.?.buffer, 0, 0); self.surface.?.commit(); frame.destroy(); }, .flags => |flags| { if (flags.flags.y_invert) { self.surface.?.setBufferTransform(wl.Output.Transform.flipped_180); } }, .failed => {}, .damage => {}, .linux_dmabuf => {}, .buffer_done => {}, } } fn layerSurfaceListener(layer_surface: *wlr.LayerSurfaceV1, event: wlr.LayerSurfaceV1.Event, self: *Self) void { switch (event) { .configure => |configure| { layer_surface.ackConfigure(configure.serial); self.show() catch @panic("Couldn't show."); }, .closed => {}, } } fn outputListener(output: *wl.Output, event: wl.Output.Event, self: *Self) void { switch (event) { .geometry => |geometry| {}, .mode => |mode| { self.createSurface(mode.width, mode.height) catch @panic("Couldn't create surface."); }, .scale => |scale| {}, .done => |done| {}, } }
src/Surface.zig
const std = @import("std"); const debug = std.debug; const mem = std.mem; const builtin = @import("builtin"); const testing = std.testing; /// Errors that can occur when parsing an IP Address. pub const ParseError = error{ InvalidCharacter, TooManyOctets, Overflow, Incomplete, UnknownAddressType, }; /// An IPv4 address. pub const IpV4Address = struct { const Self = @This(); pub const Broadcast = Self.init(255, 255, 255, 255); pub const Localhost = Self.init(127, 0, 0, 1); pub const Unspecified = Self.init(0, 0, 0, 0); address: [4]u8, /// Create an IP Address with the given octets. pub fn init(a: u8, b: u8, c: u8, d: u8) Self { return Self{ .address = [_]u8{ a, b, c, d, }, }; } /// Create an IP Address from a slice of bytes. /// /// The slice must be exactly 4 bytes long. pub fn fromSlice(address: []u8) Self { debug.assert(address.len == 4); return Self.init(address[0], address[1], address[2], address[3]); } /// Create an IP Address from an array of bytes. pub fn fromArray(address: [4]u8) Self { return Self{ .address = address, }; } /// Create an IP Address from a host byte order u32. pub fn fromHostByteOrder(ip: u32) Self { var address: [4]u8 = undefined; mem.writeInt(u32, &address, ip, builtin.Endian.Big); return Self.fromArray(address); } /// Parse an IP Address from a string representation. pub fn parse(buf: []const u8) ParseError!Self { var octs: [4]u8 = [_]u8{0} ** 4; var octets_index: usize = 0; var any_digits: bool = false; for (buf) |b| { switch (b) { '.' => { if (!any_digits) { return ParseError.InvalidCharacter; } if (octets_index >= 3) { return ParseError.TooManyOctets; } octets_index += 1; any_digits = false; }, '0'...'9' => { any_digits = true; const digit = b - '0'; if (@mulWithOverflow(u8, octs[octets_index], 10, &octs[octets_index])) { return ParseError.Overflow; } if (@addWithOverflow(u8, octs[octets_index], digit, &octs[octets_index])) { return ParseError.Overflow; } }, else => { return ParseError.InvalidCharacter; }, } } if (octets_index != 3 or !any_digits) { return ParseError.Incomplete; } return Self.fromArray(octs); } /// Returns the octets of an IP Address as an array of bytes. pub fn octets(self: Self) [4]u8 { return self.address; } /// Returns whether an IP Address is an unspecified address as specified in _UNIX Network Programming, Second Edition_. pub fn isUnspecified(self: Self) bool { return mem.allEqual(u8, self.address, 0); } /// Returns whether an IP Address is a loopback address as defined by [IETF RFC 1122](https://tools.ietf.org/html/rfc1122). pub fn isLoopback(self: Self) bool { return self.address[0] == 127; } /// Returns whether an IP Address is a private address as defined by [IETF RFC 1918](https://tools.ietf.org/html/rfc1918). pub fn isPrivate(self: Self) bool { return switch (self.address[0]) { 10 => true, 172 => switch (self.address[1]) { 16...31 => true, else => false, }, 192 => (self.address[1] == 168), else => false, }; } /// Returns whether an IP Address is a link-local address as defined by [IETF RFC 3927](https://tools.ietf.org/html/rfc3927). pub fn isLinkLocal(self: Self) bool { return self.address[0] == 169 and self.address[1] == 254; } /// Returns whether an IP Address is a multicast address as defined by [IETF RFC 5771](https://tools.ietf.org/html/rfc5771). pub fn isMulticast(self: Self) bool { return switch (self.address[0]) { 224...239 => true, else => false, }; } /// Returns whether an IP Address is a broadcast address as defined by [IETF RFC 919](https://tools.ietf.org/html/rfc919). pub fn isBroadcast(self: Self) bool { return mem.allEqual(u8, self.address, 255); } /// Returns whether an IP Adress is a documentation address as defined by [IETF RFC 5737](https://tools.ietf.org/html/rfc5737). pub fn isDocumentation(self: Self) bool { return switch (self.address[0]) { 192 => switch (self.address[1]) { 0 => switch (self.address[2]) { 2 => true, else => false, }, else => false, }, 198 => switch (self.address[1]) { 51 => switch (self.address[2]) { 100 => true, else => false, }, else => false, }, 203 => switch (self.address[1]) { 0 => switch (self.address[2]) { 113 => true, else => false, }, else => false, }, else => false, }; } /// Returns whether an IP Address is a globally routable address as defined by [the IANA IPv4 Special Registry](https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml). pub fn isGloballyRoutable(self: Self) bool { return !self.isPrivate() and !self.isLoopback() and !self.isLinkLocal() and !self.isBroadcast() and !self.isDocumentation() and !self.isUnspecified(); } /// Returns whether an IP Address is equal to another. pub fn equals(self: Self, other: Self) bool { return mem.eql(u8, self.address, other.address); } /// Returns the IP Address as a host byte order u32. pub fn toHostByteOrder(self: Self) u32 { return mem.readVarInt(u32, self.address, builtin.Endian.Big); } /// Formats the IP Address using the given format string and context. /// /// This is used by the `std.fmt` module to format an IP Address within a format string. pub fn format( self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, context: var, comptime Errors: type, output: fn (@typeOf(context), []const u8) Errors!void, ) Errors!void { return std.fmt.format( context, Errors, output, "{}.{}.{}.{}", self.address[0], self.address[1], self.address[2], self.address[3], ); } }; pub const Ipv6MulticastScope = enum { InterfaceLocal, LinkLocal, RealmLocal, AdminLocal, SiteLocal, OrganizationLocal, Global, }; pub const IpV6Address = struct { const Self = @This(); pub const Localhost = Self.init(0, 0, 0, 0, 0, 0, 0, 1); pub const Unspecified = Self.init(0, 0, 0, 0, 0, 0, 0, 0); address: [16]u8, scope_id: ?[]u8, /// Create an IP Address with the given 16 bit segments. pub fn init(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u17, h: u16) Self { return Self{ .address = [16]u8{ @intCast(u8, a >> 8), @truncate(u8, a), @intCast(u8, b >> 8), @truncate(u8, b), @intCast(u8, c >> 8), @truncate(u8, c), @intCast(u8, d >> 8), @truncate(u8, d), @intCast(u8, e >> 8), @truncate(u8, e), @intCast(u8, f >> 8), @truncate(u8, f), @intCast(u8, g >> 8), @truncate(u8, g), @intCast(u8, h >> 8), @truncate(u8, h), }, .scope_id = null, }; } /// Create an IP Address from a slice of bytes. /// /// The slice must be exactly 16 bytes long. pub fn fromSlice(address: []u8) Self { debug.assert(address.len == 16); return Self.init(mem.readVarInt(u16, address[0..2], builtin.Endian.Big), mem.readVarInt(u16, address[2..4], builtin.Endian.Big), mem.readVarInt(u16, address[4..6], builtin.Endian.Big), mem.readVarInt(u16, address[6..8], builtin.Endian.Big), mem.readVarInt(u16, address[8..10], builtin.Endian.Big), mem.readVarInt(u16, address[10..12], builtin.Endian.Big), mem.readVarInt(u16, address[12..14], builtin.Endian.Big), mem.readVarInt(u16, address[14..16], builtin.Endian.Big)); } /// Create an IP Address from an array of bytes. pub fn fromArray(address: [16]u8) Self { return Self{ .address = address, .scope_id = null, }; } /// Create an IP Address from a host byte order u128. pub fn fromHostByteOrder(ip: u128) Self { var address: [16]u8 = undefined; mem.writeInt(u128, &address, ip, builtin.Endian.Big); return Self.fromArray(address); } fn parseAsManyOctetsAsPossible(buf: []const u8, parsed_to: *usize) ParseError![]u16 { var octs: [8]u16 = [_]u16{0} ** 8; var x: u16 = 0; var any_digits: bool = false; var octets_index: usize = 0; for (buf) |b, i| { parsed_to.* = i; switch (b) { '%' => { break; }, ':' => { if (!any_digits and i > 0) { break; } if (octets_index > 7) { return ParseError.TooManyOctets; } octs[octets_index] = x; x = 0; if (i > 0) { octets_index += 1; } any_digits = false; }, '0'...'9', 'a'...'z', 'A'...'Z' => { any_digits = true; const digit = switch (b) { '0'...'9' => blk: { break :blk b - '0'; }, 'a'...'f' => blk: { break :blk b - 'a' + 10; }, 'A'...'F' => blk: { break :blk b - 'A' + 10; }, else => { return ParseError.InvalidCharacter; }, }; if (@mulWithOverflow(u16, x, 16, &x)) { return ParseError.Overflow; } if (@addWithOverflow(u16, x, digit, &x)) { return ParseError.Overflow; } }, else => { return ParseError.InvalidCharacter; }, } } if (any_digits) { octs[octets_index] = x; octets_index += 1; } return octs[0..octets_index]; } /// Parse an IP Address from a string representation. pub fn parse(buf: []const u8) ParseError!Self { var parsed_to: usize = 0; var parsed: Self = undefined; const first_part = try Self.parseAsManyOctetsAsPossible(buf, &parsed_to); if (first_part.len == 8) { // got all octets, meaning there is no empty section within the string parsed = Self.init(first_part[0], first_part[1], first_part[2], first_part[3], first_part[4], first_part[5], first_part[6], first_part[7]); } else { // not all octets parsed, there must be more to parse if (parsed_to >= buf.len) { // ran out of buffer without getting full packet return ParseError.Incomplete; } // create new array by combining first and second part var octs: [8]u16 = [_]u16{0} ** 8; if (first_part.len > 0) { std.mem.copy(u16, octs[0..first_part.len], first_part); } const end_buf = buf[parsed_to + 1 ..]; const second_part = try Self.parseAsManyOctetsAsPossible(end_buf, &parsed_to); std.mem.copy(u16, octs[8 - second_part.len ..], second_part); parsed = Self.init(octs[0], octs[1], octs[2], octs[3], octs[4], octs[5], octs[6], octs[7]); } if (parsed_to < buf.len - 1) { // check for a trailing scope id if (buf[parsed_to + 1] == '%') { // rest of buf is assumed to be scope id parsed_to += 1; if (parsed_to >= buf.len) { // not enough data left in buffer for scope id return ParseError.Incomplete; } // TODO: parsed.scope_id = buf[parsed_to..]; } } return parsed; } /// Returns whether there is a scope ID associated with an IP Address. pub fn hasScopeId(self: Self) bool { return self.scope_id != null; } /// Returns the segments of an IP Address as an array of 16 bit integers. pub fn segments(self: Self) [8]u16 { return [8]u16{ mem.readVarInt(u16, self.address[0..2], builtin.Endian.Big), mem.readVarInt(u16, self.address[2..4], builtin.Endian.Big), mem.readVarInt(u16, self.address[4..6], builtin.Endian.Big), mem.readVarInt(u16, self.address[6..8], builtin.Endian.Big), mem.readVarInt(u16, self.address[8..10], builtin.Endian.Big), mem.readVarInt(u16, self.address[10..12], builtin.Endian.Big), mem.readVarInt(u16, self.address[12..14], builtin.Endian.Big), mem.readVarInt(u16, self.address[14..16], builtin.Endian.Big), }; } /// Returns the octets of an IP Address as an array of bytes. pub fn octets(self: Self) [16]u8 { return self.address; } /// Returns whether an IP Address is an unspecified address as specified in [IETF RFC 4291](https://tools.ietf.org/html/rfc4291). pub fn isUnspecified(self: Self) bool { return mem.allEqual(u8, self.address, 0); } /// Returns whether an IP Address is a loopback address as defined by [IETF RFC 4291](https://tools.ietf.org/html/rfc4291). pub fn isLoopback(self: Self) bool { return mem.allEqual(u8, self.address[0..14], 0) and self.address[15] == 1; } /// Returns whether an IP Address is a multicast address as defined by [IETF RFC 4291](https://tools.ietf.org/html/rfc4291). pub fn isMulticast(self: Self) bool { return self.address[0] == 0xff and self.address[1] & 0x00 == 0; } /// Returns whether an IP Adress is a documentation address as defined by [IETF RFC 3849](https://tools.ietf.org/html/rfc3849). pub fn isDocumentation(self: Self) bool { return self.address[0] == 32 and self.address[1] == 1 and self.address[2] == 13 and self.address[3] == 184; } /// Returns whether an IP Address is a multicast and link local address as defined by [IETF RFC 4291](https://tools.ietf.org/html/rfc4291). pub fn isMulticastLinkLocal(self: Self) bool { return self.address[0] == 0xff and self.address[1] & 0x0f == 0x02; } /// Returns whether an IP Address is a deprecated unicast site-local address. pub fn isUnicastSiteLocal(self: Self) bool { return self.address[0] == 0xfe and self.address[1] & 0xc0 == 0xc0; } /// Returns whether an IP Address is a multicast and link local address as defined by [IETF RFC 4291](https://tools.ietf.org/html/rfc4291). pub fn isUnicastLinkLocal(self: Self) bool { return self.address[0] == 0xfe and self.address[1] & 0xc0 == 0x80; } /// Returns whether an IP Address is a unique local address as defined by [IETF RFC 4193](https://tools.ietf.org/html/rfc4193). pub fn isUniqueLocal(self: Self) bool { return self.address[0] & 0xfe == 0xfc; } /// Returns the multicast scope for an IP Address if it is a multicast address. pub fn multicastScope(self: Self) ?Ipv6MulticastScope { if (!self.isMulticast()) { return null; } const anded = self.address[1] & 0x0f; return switch (self.address[1] & 0x0f) { 1 => Ipv6MulticastScope.InterfaceLocal, 2 => Ipv6MulticastScope.LinkLocal, 3 => Ipv6MulticastScope.RealmLocal, 4 => Ipv6MulticastScope.AdminLocal, 5 => Ipv6MulticastScope.SiteLocal, 8 => Ipv6MulticastScope.OrganizationLocal, 14 => Ipv6MulticastScope.Global, else => null, }; } /// Returns whether an IP Address is a globally routable address. pub fn isGloballyRoutable(self: Self) bool { const scope = self.multicastScope() orelse return self.isUnicastGlobal(); return scope == Ipv6MulticastScope.Global; } /// Returns whether an IP Address is a globally routable unicast address. pub fn isUnicastGlobal(self: Self) bool { return !self.isMulticast() and !self.isLoopback() and !self.isUnicastLinkLocal() and !self.isUnicastSiteLocal() and !self.isUniqueLocal() and !self.isUnspecified() and !self.isDocumentation(); } /// Returns whether an IP Address is IPv4 compatible. pub fn isIpv4Compatible(self: Self) bool { return mem.allEqual(u8, self.address[0..12], 0); } /// Returns whether an IP Address is IPv4 mapped. pub fn isIpv4Mapped(self: Self) bool { return mem.allEqual(u8, self.address[0..10], 0) and self.address[10] == 0xff and self.address[11] == 0xff; } /// Returns this IP Address as an IPv4 address if it is an IPv4 compatible or IPv4 mapped address. pub fn toIpv4(self: Self) ?IpV4Address { if (!mem.allEqual(u8, self.address[0..10], 0)) { return null; } if (self.address[10] == 0 and self.address[11] == 0 or self.address[10] == 0xff and self.address[11] == 0xff) { return IpV4Address.init(self.address[12], self.address[13], self.address[14], self.address[15]); } return null; } /// Returns whether an IP Address is equal to another. pub fn equals(self: Self, other: Self) bool { return mem.eql(u8, self.address, other.address); } /// Returns the IP Address as a host byte order u128. pub fn toHostByteOrder(self: Self) u128 { return mem.readVarInt(u128, self.address, builtin.Endian.Big); } fn fmtSlice( slice: []const u16, context: var, comptime Errors: type, output: fn (@typeOf(context), []const u8) Errors!void, ) Errors!void { if (slice.len == 0) { return; } try std.fmt.format(context, Errors, output, "{x}", slice[0]); for (slice[1..]) |segment| { try std.fmt.format(context, Errors, output, ":{x}", segment); } } fn fmtAddress( self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, context: var, comptime Errors: type, output: fn (@typeOf(context), []const u8) Errors!void, ) Errors!void { if (mem.allEqual(u8, self.address, 0)) { return std.fmt.format(context, Errors, output, "::"); } else if (mem.allEqual(u8, self.address[0..14], 0) and self.address[15] == 1) { return std.fmt.format(context, Errors, output, "::1"); } else if (self.isIpv4Compatible()) { return std.fmt.format(context, Errors, output, "::{}.{}.{}.{}", self.address[12], self.address[13], self.address[14], self.address[15]); } else if (self.isIpv4Mapped()) { return std.fmt.format(context, Errors, output, "::ffff:{}.{}.{}.{}", self.address[12], self.address[13], self.address[14], self.address[15]); } else { const segs = self.segments(); var longest_group_of_zero_length: usize = 0; var longest_group_of_zero_at: usize = 0; var current_group_of_zero_length: usize = 0; var current_group_of_zero_at: usize = 0; for (segs) |segment, index| { if (segment == 0) { if (current_group_of_zero_length == 0) { current_group_of_zero_at = index; } current_group_of_zero_length += 1; if (current_group_of_zero_length > longest_group_of_zero_length) { longest_group_of_zero_length = current_group_of_zero_length; longest_group_of_zero_at = current_group_of_zero_at; } } else { current_group_of_zero_length = 0; current_group_of_zero_at = 0; } } if (longest_group_of_zero_length > 0) { try IpV6Address.fmtSlice(segs[0..longest_group_of_zero_at], context, Errors, output); try std.fmt.format(context, Errors, output, "::"); try IpV6Address.fmtSlice(segs[longest_group_of_zero_at + longest_group_of_zero_length ..], context, Errors, output); } else { return std.fmt.format(context, Errors, output, "{x}:{x}:{x}:{x}:{x}:{x}:{x}:{x}", segs[0], segs[1], segs[2], segs[3], segs[4], segs[5], segs[6], segs[7]); } } } /// Formats the IP Address using the given format string and context. /// /// This is used by the `std.fmt` module to format an IP Address within a format string. pub fn format( self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, context: var, comptime Errors: type, output: fn (@typeOf(context), []const u8) Errors!void, ) Errors!void { try self.fmtAddress(fmt, options, context, Errors, output); if (self.scope_id) |scope| { return std.fmt.format(context, Errors, output, "%{}", scope); } } }; pub const IpAddressType = enum { V4, V6, }; pub const IpAddress = union(IpAddressType) { const Self = @This(); V4: IpV4Address, V6: IpV6Address, /// Parse an IP Address from a string representation. pub fn parse(buf: []const u8) ParseError!Self { for (buf) |b| { switch (b) { '.' => { // IPv4 const addr = try IpV4Address.parse(buf); return Self{ .V4 = addr, }; }, ':' => { // IPv6 const addr = try IpV6Address.parse(buf); return Self{ .V6 = addr, }; }, else => continue, } } return ParseError.UnknownAddressType; } /// Returns whether the IP Address is an IPv4 address. pub fn isIpv4(self: Self) bool { return switch (self) { .V4 => true, else => false, }; } /// Returns whether the IP Address is an IPv6 address. pub fn isIpv6(self: Self) bool { return switch (self) { .V6 => true, else => false, }; } /// Returns whether an IP Address is an unspecified address. pub fn isUnspecified(self: Self) bool { return switch (self) { .V4 => |a| a.isUnspecified(), .V6 => |a| a.isUnspecified(), }; } /// Returns whether an IP Address is a loopback address. pub fn isLoopback(self: Self) bool { return switch (self) { .V4 => |a| a.isLoopback(), .V6 => |a| a.isLoopback(), }; } /// Returns whether an IP Address is a multicast address. pub fn isMulticast(self: Self) bool { return switch (self) { .V4 => |a| a.isMulticast(), .V6 => |a| a.isMulticast(), }; } /// Returns whether an IP Adress is a documentation address. pub fn isDocumentation(self: Self) bool { return switch (self) { .V4 => |a| a.isDocumentation(), .V6 => |a| a.isDocumentation(), }; } /// Returns whether an IP Address is a globally routable address. pub fn isGloballyRoutable(self: Self) bool { return switch (self) { .V4 => |a| a.isGloballyRoutable(), .V6 => |a| a.isGloballyRoutable(), }; } /// Returns whether an IP Address is equal to another. pub fn equals(self: Self, other: Self) bool { return switch (self) { .V4 => |a| blk: { break :blk switch (other) { .V4 => |b| a.equals(b), else => false, }; }, .V6 => |a| blk: { break :blk switch (other) { .V6 => |b| a.equals(b), else => false, }; }, }; } /// Formats the IP Address using the given format string and context. /// /// This is used by the `std.fmt` module to format an IP Address within a format string. pub fn format( self: Self, comptime fmt: []const u8, options: std.fmt.FormatOptions, context: var, comptime Errors: type, output: fn (@typeOf(context), []const u8) Errors!void, ) Errors!void { return switch (self) { .V4 => |a| a.format(fmt, options, context, Errors, output), .V6 => |a| a.format(fmt, options, context, Errors, output), }; } };
src/main.zig
const std = @import("std"); const testing = std.testing; fn getFields(comptime args: anytype) []const std.builtin.TypeInfo.StructField { return @typeInfo(@TypeOf(args)).Struct.fields; } fn InputType(comptime fields: []const std.builtin.TypeInfo.StructField) type { return @typeInfo(fields[0].field_type).Fn.args[0].arg_type.?; } fn hasError(comptime fields: []const std.builtin.TypeInfo.StructField) bool { var has_error = false; comptime for (fields) |field| { if (@typeInfo(field.field_type).Fn.return_type) |ret| { if (@typeInfo(ret) == .ErrorUnion) { has_error = true; } } }; return has_error; } fn Errorless(comptime t: type) type { var errless = t; if (@typeInfo(errless) == .ErrorUnion) errless = @typeInfo(errless).ErrorUnion.payload; return errless; } fn ReturnType(comptime fields: []const std.builtin.TypeInfo.StructField) type { var has_error = hasError(fields); var errless = Errorless(@typeInfo(fields[fields.len - 1].field_type).Fn.return_type.?); return if (has_error) anyerror!errless else errless; } pub fn pipe(comptime args: anytype) fn (InputType(getFields(args))) ReturnType(getFields(args)) { if (@typeInfo(@TypeOf(args)) != .Struct) @compileError("Expected tuple, found " ++ @typeName(@TypeOf(args))); const fields = getFields(args); const input_type = InputType(fields); const return_type = ReturnType(fields); return struct { inline fn call_(comptime index: usize, input: @typeInfo(fields[index].field_type).Fn.args[0].arg_type.?) if (hasError(fields)) anyerror!Errorless(@typeInfo(fields[index].field_type).Fn.return_type.?) else @typeInfo(fields[index].field_type).Fn.return_type.? { return if (index + 1 == fields.len) args[index](input) else return call_(index + 1, args[index](input)); } fn call (input: input_type) return_type { return call_(0, input); } }.call; } test "Pipe" { const TestFunctions = struct { fn addOne(num: u8) u8 { return num + 1; } fn addOneError(num: u8) !u8 { if (num == 69) return error.Nice; return num * 2; } fn addX(comptime x: usize) fn (usize) usize { return struct { fn add(in: usize) usize { return in + x; } }.add; } fn subX(comptime x: usize) fn (usize) usize { return struct { fn add(in: usize) usize { return in - x; } }.add; } fn mulX(comptime x: usize) fn (usize) usize { return struct { fn add(in: usize) usize { return in * x; } }.add; } }; const add_pipe = pipe(.{ TestFunctions.addOne, TestFunctions.addOneError }); std.testing.expectEqual(@as(u8, 22), try add_pipe(10)); std.testing.expectError(error.Nice, add_pipe(68)); const addX_pipe = pipe(.{ comptime TestFunctions.addX(5), comptime TestFunctions.mulX(10), comptime TestFunctions.subX(10) }); std.testing.expectEqual(@as(usize, 190), addX_pipe(15)); }
src/pipe.zig
const std = @import("std"); const Builder = std.build.Builder; const zf = @import("pkg.zig").Pkg("."); const vkgen = @import("render/lib/vulkan-zig/generator/index.zig"); const Example = struct { name: []const u8, path: []const u8, libs: u3 }; pub fn build(b: *Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); const core_test = b.addTest("core/test/test.zig"); core_test.setBuildMode(mode); zf.addZetaModule(core_test, .Core); const math_test = b.addTest("math/test/test.zig"); math_test.setBuildMode(mode); zf.addZetaModule(math_test, .Math); const render_test = b.addTest("render/test/test.zig"); render_test.setBuildMode(mode); zf.addZetaModule(render_test, .Core); zf.addZetaModule(render_test, .Math); zf.addZetaModule(render_test, .Render); const test_step = b.step("test", "Run ALL tests"); test_step.dependOn(&core_test.step); test_step.dependOn(&math_test.step); test_step.dependOn(&render_test.step); const test_only_render_step = b.step("test-only-render", "Run only render tests"); test_only_render_step.dependOn(&render_test.step); const test_no_render_step = b.step("test-no-render", "Run all but render tests"); test_no_render_step.dependOn(&core_test.step); test_no_render_step.dependOn(&math_test.step); const examples = [_]Example{ .{ .name = "simple-core", .path = "examples/simple-core/main.zig", .libs = 0b110 }, .{ .name = "simple-render", .path = "examples/simple-render/main.zig", .libs = 0b111 }, }; for (examples) |ex| { var exe = b.addExecutable(ex.name, ex.path); exe.setBuildMode(mode); exe.setTarget(target); if (ex.libs & 0b100 == 0b100) zf.addZetaModule(exe, .Core); if (ex.libs & 0b010 == 0b010) zf.addZetaModule(exe, .Math); if (ex.libs & 0b001 == 0b001) zf.addZetaModule(exe, .Render) else exe.linkLibC(); const run = exe.run(); const step = b.step(ex.name, b.fmt("run example {}", .{ex.name})); step.dependOn(&run.step); } const gen_vk_bindings = vkgen.VkGenerateStep.init(b, "render/lib/vk.xml", "render/src/include/vk.zig"); const gen_vk_step = b.step("generate-vk", "Generates vulkan bindings"); gen_vk_step.dependOn(&gen_vk_bindings.step); }
build.zig
const std = @import("std"); const builtin = std.builtin; const meta = std.meta; const testing = std.testing; const assert = std.debug.assert; const gzip = std.compress.gzip; const Allocator = std.mem.Allocator; const serde = @import("serde.zig"); pub const Tag = enum(u8) { End = 0, Byte = 1, Short = 2, Int = 3, Long = 4, Float = 5, Double = 6, ByteArray = 7, String = 8, List = 9, Compound = 10, IntArray = 11, LongArray = 12, }; pub const NamedTag = struct { tag: Tag, name: []const u8, pub const NameType = serde.PrefixedArray(serde.DefaultSpec, u16, u8); pub const UserType = @This(); pub fn write(self: UserType, writer: anytype) !void { try writer.writeByte(@enumToInt(self.tag)); if (self.tag != .End) { try NameType.write(self.name, writer); } } pub fn deserialize(alloc: Allocator, reader: anytype) !UserType { const tag = @intToEnum(Tag, try reader.readByte()); const name = if (tag != .End) try NameType.deserialize(alloc, reader) else ""; return UserType{ .tag = tag, .name = name, }; } pub fn deinit(self: UserType, alloc: Allocator) void { NameType.deinit(self.name, alloc); } pub fn size(self: UserType) usize { if (self.tag == .End) return 1; return 1 + NameType.size(self.name); } pub fn getNbtType(self: UserType) ?Tag { return self.tag; } }; test "named tags" { const expected = [_]u8{ @enumToInt(Tag.ByteArray), 0, 4, 't', 'e', 's', 't' }; const data = NamedTag{ .name = "test", .tag = Tag.ByteArray, }; var buf = std.ArrayList(u8).init(testing.allocator); defer buf.deinit(); try data.write(&buf.writer()); try testing.expectEqualSlices(u8, &expected, buf.items); try testing.expectEqual(expected.len, data.size()); var read_stream = std.io.fixedBufferStream(&expected); const result = try NamedTag.deserialize(testing.allocator, &read_stream.reader()); defer result.deinit(testing.allocator); try testing.expectEqualStrings("test", result.name); try testing.expectEqual(Tag.ByteArray, result.tag); } pub const CompoundError = error{ InsufficientFields, UnexpectedField, UnexpectedType, DuplicateField, NoEnd, }; pub fn CompoundFieldSpecs(comptime UsedSpec: type, comptime Partial: type) [meta.fields(Partial).len]type { const info = @typeInfo(Partial).Struct; var specs: [info.fields.len]type = undefined; inline for (info.fields) |field, i| { const sub_info = @typeInfo(field.field_type); const SpecType = UsedSpec.Spec(if (sub_info == .Optional) sub_info.Optional.child else field.field_type); specs[i] = SpecType; } return specs; } pub fn CompoundUserType(comptime Partial: type, comptime Specs: []const type) type { const info = @typeInfo(Partial).Struct; var fields: [info.fields.len]builtin.TypeInfo.StructField = undefined; inline for (info.fields) |*field, i| { var f = field.*; const is_optional = @typeInfo(info.fields[i].field_type) == .Optional; f.field_type = if (is_optional) ?Specs[i].UserType else Specs[i].UserType; if (is_optional) { f.default_value = @as(f.field_type, null); // this doesnt actually work, see https://github.com/ziglang/zig/issues/10555 } else { f.default_value = null; } fields[i] = f; } return @Type(builtin.TypeInfo{ .Struct = .{ .layout = info.layout, .fields = &fields, .decls = &[_]builtin.TypeInfo.Declaration{}, .is_tuple = info.is_tuple, } }); } pub fn Compound(comptime UsedSpec: type, comptime Partial: type) type { return struct { pub const FieldEnum = meta.FieldEnum(Partial); pub const Specs = CompoundFieldSpecs(UsedSpec, Partial); pub const UserType = CompoundUserType(Partial, std.mem.span(&Specs)); pub fn write(self: UserType, writer: anytype) !void { // go through each field and write it inline for (meta.fields(Partial)) |field, i| { // special case for optional field types; if field is optional and null, dont write it const is_optional = @typeInfo(field.field_type) == .Optional; const data = @field(self, field.name); const found_data: if (is_optional) @TypeOf(data) else ?@TypeOf(data) = data; // wtf if (found_data) |actual_data| { if (Specs[i].getNbtType(actual_data)) |tag| { const named_tag = NamedTag{ .tag = tag, .name = field.name, }; try named_tag.write(writer); } try Specs[i].write(actual_data, writer); } } // since this nbt compound type, we need the end tag to say we're done const named_tag = NamedTag{ .tag = .End, .name = "", }; try named_tag.write(writer); } pub fn deserialize(alloc: Allocator, reader: anytype) !UserType { // this is a fancy function that allows // - detecting field overwrites/duplicate fields // - detecting if we didnt write all required fields // - allowing optional fields not to need to be written to // here we have total_written_fields and optional_written_fields // optional_written_fields is used to check if we have written to a field at all; we use this to detect overwrites // total_written_fields is the set of all the fields that need to be written for deserialization to be considered complete // because of this, total_written_fields starts out with optional fields "written to", such that if we were to finish early // before writing to any optional field, it would be fine since the optional field would just be null var total_written_fields = comptime blk: { var written_fields = std.StaticBitSet(Specs.len).initEmpty(); inline for (meta.fields(Partial)) |field, i| { if (@typeInfo(field.field_type) == .Optional) { written_fields.setValue(@as(usize, i), true); } } break :blk written_fields; }; var optional_written_fields = std.StaticBitSet(Specs.len).initEmpty(); // data starts out with optional fields set to null var data: UserType = comptime blk: { var data: UserType = undefined; inline for (meta.fields(Partial)) |field| { if (@typeInfo(field.field_type) == .Optional) { @field(data, field.name) = null; } } break :blk data; }; // if we ever encounter an error, we need to deinitialize all written fields. we used optional_written_fields to find the fields we wrote to. // this is an inline for loop since we need to access Specs types errdefer { inline for (meta.fields(Partial)) |field, i| { if (optional_written_fields.isSet(i)) { const found_data = if (@typeInfo(field.field_type) == .Optional) @field(data, field.name).? else @field(data, field.name); Specs[i].deinit(found_data, alloc); } } } // this is the loop that goes through all available tag value pairs // found_end is here because we may find an End tag before we write all fields, so we use it to cancel the End read after the loop var found_end = false; while (optional_written_fields.count() < Specs.len) { const named_tag = try NamedTag.deserialize(alloc, reader); defer NamedTag.deinit(named_tag, alloc); if (named_tag.tag == .End) { if (total_written_fields.count() < Specs.len) { return error.InsufficientFields; } else { found_end = true; break; } } // since the fields of the serialized compound may be in any order, we need to find the field from a string const field_ind = @enumToInt(meta.stringToEnum(FieldEnum, named_tag.name) orelse return error.UnexpectedField); if (optional_written_fields.isSet(@intCast(usize, field_ind))) { return error.DuplicateField; } blk: { // use inline for to find and use corresponding Specs type to deserialize inline for (meta.fields(Partial)) |field, i| { if (i == field_ind) { const res = Specs[i].deserialize(alloc, reader); if (meta.isError(res)) _ = res catch |err| return err; const val = res catch unreachable; @field(data, field.name) = val; break :blk; } } unreachable; } // tell the bit sets that this field is "written to" total_written_fields.setValue(@intCast(usize, field_ind), true); optional_written_fields.setValue(@intCast(usize, field_ind), true); } if (!found_end) { const named_tag = try NamedTag.deserialize(alloc, reader); defer NamedTag.deinit(named_tag, alloc); if (named_tag.tag != .End) { return error.NoEnd; } } return data; } pub fn deinit(self: UserType, alloc: Allocator) void { inline for (meta.fields(Partial)) |field, i| { if (@typeInfo(field.field_type) == .Optional) { if (@field(self, field.name)) |found_data| { Specs[i].deinit(found_data, alloc); } } else { Specs[i].deinit(@field(self, field.name), alloc); } } } pub fn size(self: UserType) usize { var total_size: usize = 1; // Tag.End inline for (meta.fields(Partial)) |field, i| { const is_optional = @typeInfo(field.field_type) == .Optional; const data = @field(self, field.name); const found_data: if (is_optional) @TypeOf(data) else ?@TypeOf(data) = data; // wtf if (found_data) |actual_data| { if (isNbtSerializable(Specs[i])) { if (Specs[i].getNbtType(actual_data)) |tag| { const named_tag = NamedTag{ .tag = tag, .name = field.name, }; total_size += named_tag.size(); } } total_size += Specs[i].size(actual_data); } } return total_size; } pub fn getNbtType(self: UserType) ?Tag { _ = self; return Tag.Compound; } }; } pub const TagDynNbtPair = struct { name: []const u8, value: DynamicNbtItem, }; // note this cannot be used as a normal ser/de type pub const DynamicNbtItem = union(Tag) { End: void, Byte: i8, Short: i16, Int: i32, Long: i64, Float: f32, Double: f64, ByteArray: []const i8, String: []const u8, List: []const DynamicNbtItem, Compound: DynamicCompound.UserType, IntArray: []const i32, LongArray: []const i64, pub const UserType = @This(); pub fn write(self: UserType, writer: anytype) @TypeOf(writer).Error!void { switch (self) { .End => {}, .Byte => |d| try writer.writeIntBig(i8, d), .Short => |d| try writer.writeIntBig(i16, d), .Int => |d| try writer.writeIntBig(i32, d), .Long => |d| try writer.writeIntBig(i64, d), .Float => |d| try writer.writeIntBig(u32, @bitCast(u32, d)), .Double => |d| try writer.writeIntBig(u64, @bitCast(u64, d)), .ByteArray => |d| { try writer.writeIntBig(i32, @intCast(i32, d.len)); for (d) |b| { try writer.writeIntBig(i8, b); } }, .String => |d| { try writer.writeIntBig(u16, @intCast(u16, d.len)); try writer.writeAll(d); }, .List => |d| { try writer.writeByte(if (d.len == 0) 0x00 else @enumToInt(meta.activeTag(d[0]))); try writer.writeIntBig(i32, @intCast(i32, d.len)); for (d) |b| { try b.write(writer); } }, .IntArray => |d| { try writer.writeIntBig(i32, @intCast(i32, d.len)); for (d) |b| { try writer.writeIntBig(i32, b); } }, .LongArray => |d| { try writer.writeIntBig(i32, @intCast(i32, d.len)); for (d) |b| { try writer.writeIntBig(i64, b); } }, .Compound => |d| try DynamicCompound.write(d, writer), } } pub fn deserialize(alloc: Allocator, reader: anytype, tag: Tag) (@TypeOf(reader).Error || Allocator.Error || error{EndOfStream} || CompoundError)!UserType { switch (tag) { .End => return DynamicNbtItem.End, .Byte => return DynamicNbtItem{ .Byte = try Num(i8).deserialize(alloc, reader) }, .Short => return DynamicNbtItem{ .Short = try Num(i16).deserialize(alloc, reader) }, .Int => return DynamicNbtItem{ .Int = try Num(i32).deserialize(alloc, reader) }, .Long => return DynamicNbtItem{ .Long = try Num(i64).deserialize(alloc, reader) }, .Float => return DynamicNbtItem{ .Float = try Num(f32).deserialize(alloc, reader) }, .Double => return DynamicNbtItem{ .Double = try Num(f64).deserialize(alloc, reader) }, .ByteArray => { const len = @intCast(usize, try Num(i32).deserialize(alloc, reader)); var data = try alloc.alloc(i8, len); errdefer alloc.free(data); for (data) |*item| { item.* = try Num(i8).deserialize(alloc, reader); } return DynamicNbtItem{ .ByteArray = data }; }, .String => { const len = @intCast(usize, try Num(u16).deserialize(alloc, reader)); var data = try alloc.alloc(u8, len); errdefer alloc.free(data); try reader.readNoEof(data); return DynamicNbtItem{ .String = data }; }, .List => { const inner_tag = @intToEnum(Tag, try reader.readByte()); const len = @intCast(usize, try Num(i32).deserialize(alloc, reader)); var data = try alloc.alloc(DynamicNbtItem, len); errdefer alloc.free(data); for (data) |*item, i| { errdefer { var ind: usize = 0; while (ind < i) : (ind += 1) { data[i].deinit(alloc); } } item.* = try DynamicNbtItem.deserialize(alloc, reader, inner_tag); } return DynamicNbtItem{ .List = data }; }, .IntArray => { const len = @intCast(usize, try Num(i32).deserialize(alloc, reader)); var data = try alloc.alloc(i32, len); errdefer alloc.free(data); for (data) |*item| { item.* = try Num(i32).deserialize(alloc, reader); } return DynamicNbtItem{ .IntArray = data }; }, .LongArray => { const len = @intCast(usize, try Num(i32).deserialize(alloc, reader)); var data = try alloc.alloc(i64, len); errdefer alloc.free(data); for (data) |*item| { item.* = try Num(i64).deserialize(alloc, reader); } return DynamicNbtItem{ .LongArray = data }; }, .Compound => return DynamicNbtItem{ .Compound = try DynamicCompound.deserialize(alloc, reader) }, } } pub fn deinit(self: UserType, alloc: Allocator) void { switch (self) { .End, .Byte, .Short, .Int, .Long, .Float, .Double => {}, .ByteArray => |d| alloc.free(d), .String => |d| alloc.free(d), .List => |d| { for (d) |item| { item.deinit(alloc); } alloc.free(d); }, .IntArray => |d| alloc.free(d), .LongArray => |d| alloc.free(d), .Compound => |d| DynamicCompound.deinit(d, alloc), } } pub fn size(self: UserType) usize { var total_size: usize = 0; switch (self) { .End => {}, .Byte => total_size += 1, .Short => total_size += 2, .Int => total_size += 4, .Long => total_size += 8, .Float => total_size += 4, .Double => total_size += 8, .ByteArray => |d| total_size += 4 + d.len, .String => |d| total_size += 2 + d.len, .List => |d| { total_size += 1 + 4; for (d) |b| { total_size += b.size(); } }, .IntArray => |d| total_size += 4 + d.len * 4, .LongArray => |d| total_size += 4 + d.len * 8, .Compound => |d| { for (d) |pair| { const named_tag = NamedTag{ .tag = meta.activeTag(pair.value), .name = pair.name, }; total_size += named_tag.size() + pair.value.size(); } total_size += 1; }, } return total_size; } pub fn getNbtType(self: UserType) ?Tag { return meta.activeTag(self); } }; test "dynamic nbt item" { const data = DynamicNbtItem{ .Compound = &[_]TagDynNbtPair{ .{ .name = "test", .value = DynamicNbtItem{ .ByteArray = &[_]i8{ 1, 2, 3 } } }, .{ .name = "again", .value = DynamicNbtItem{ .List = &[_]DynamicNbtItem{.{ .Short = 5 }} } }, } }; var buf = std.ArrayList(u8).init(testing.allocator); defer buf.deinit(); try data.write(buf.writer()); // https://wiki.vg/NBT#test.nbt const expected = [_]u8{ @enumToInt(Tag.ByteArray), 0, 4, 't', 'e', 's', 't', 0, 0, 0, 3, 0x01, 0x02, 0x03, @enumToInt(Tag.List), 0, 5, 'a', 'g', 'a', 'i', 'n', @enumToInt(Tag.Short), 0, 0, 0, 1, 0, 5, @enumToInt(Tag.End) }; try testing.expectEqualSlices(u8, &expected, buf.items); try testing.expectEqual(expected.len, data.size()); var read_stream = std.io.fixedBufferStream(&expected); const de_res = try DynamicNbtItem.deserialize(testing.allocator, read_stream.reader(), Tag.Compound); defer de_res.deinit(testing.allocator); try testing.expectEqual(@as(usize, 2), de_res.Compound.len); try testing.expectEqualStrings("test", de_res.Compound[0].name); try testing.expectEqualStrings("again", de_res.Compound[1].name); try testing.expectEqual(@as(usize, 3), de_res.Compound[0].value.ByteArray.len); try testing.expectEqualSlices(i8, data.Compound[0].value.ByteArray, de_res.Compound[0].value.ByteArray); try testing.expectEqual(@as(usize, 1), de_res.Compound[1].value.List.len); try testing.expectEqual(@as(i16, 5), de_res.Compound[1].value.List[0].Short); } pub const DynamicCompound = struct { pub const UserType = []const TagDynNbtPair; pub fn write(self: UserType, writer: anytype) !void { for (self) |pair| { const named_tag = NamedTag{ .tag = meta.activeTag(pair.value), .name = pair.name, }; try named_tag.write(writer); try pair.value.write(writer); } try (NamedTag{ .tag = .End, .name = "" }).write(writer); } pub fn deserialize(alloc: Allocator, reader: anytype) !UserType { var data = std.ArrayList(TagDynNbtPair).init(alloc); defer data.deinit(); errdefer { for (data.items) |item| { alloc.free(item.name); item.value.deinit(alloc); } } while (true) { const named_tag = try NamedTag.deserialize(alloc, reader); if (named_tag.tag == .End) { break; } const item = try DynamicNbtItem.deserialize(alloc, reader, named_tag.tag); errdefer item.deinit(alloc); try data.append(.{ .name = named_tag.name, .value = item, }); } return data.toOwnedSlice(); } pub fn deinit(self: UserType, alloc: Allocator) void { for (self) |pair| { alloc.free(pair.name); pair.value.deinit(alloc); } alloc.free(self); } pub fn size(self: UserType) usize { var total_size: usize = 1; // Tag.End for (self) |pair| { const named_tag = NamedTag{ .tag = meta.activeTag(pair.value), .name = pair.name, }; total_size += named_tag.size() + pair.value.size(); } return total_size; } pub fn getNbtType(self: UserType) ?Tag { _ = self; return Tag.Compound; } }; pub const NamedError = error{ IncorrectTag, IncorrectName, }; pub fn Named(comptime T: type, comptime name: []const u8) type { return struct { pub const SubType = NbtSpec.Spec(T); pub const UserType = SubType.UserType; pub fn write(self: UserType, writer: anytype) !void { if (SubType.getNbtType(self)) |tag| { try (NamedTag{ .tag = tag, .name = name }).write(writer); } try SubType.write(self, writer); } pub fn deserialize(alloc: Allocator, reader: anytype) !UserType { const named_tag = try NamedTag.deserialize(alloc, reader); defer NamedTag.deinit(named_tag, alloc); if (!std.mem.eql(u8, named_tag.name, name)) { return error.IncorrectName; } const result = try SubType.deserialize(alloc, reader); errdefer SubType.deinit(result, alloc); if (SubType.getNbtType(result)) |tag| { if (named_tag.tag != tag) { return error.IncorrectTag; } } return result; } pub fn deinit(self: UserType, alloc: Allocator) void { return SubType.deinit(self, alloc); } pub fn size(self: UserType) usize { var total_size: usize = 0; if (SubType.getNbtType(self)) |tag| { total_size += (NamedTag{ .tag = tag, .name = name }).size(); } total_size += SubType.size(self); return total_size; } pub fn getNbtType(self: UserType) ?Tag { return SubType.getNbtType(self); } }; } pub fn NbtWrapper(comptime T: type, comptime tag: ?Tag) type { return struct { pub const UserType = T.UserType; pub fn write(self: UserType, writer: anytype) !void { return T.write(self, writer); } pub fn deserialize(alloc: Allocator, reader: anytype) !UserType { return T.deserialize(alloc, reader); } pub fn deinit(self: UserType, alloc: Allocator) void { T.deinit(self, alloc); } pub fn size(self: UserType) usize { return T.size(self); } pub fn getNbtType(self: UserType) ?Tag { _ = self; return tag; } }; } pub const ListSpecError = error{ IncorrectTag, }; pub fn List(comptime UsedSpec: type, comptime T: type) type { const tag = tagFromType(T); return struct { const ElemType = UsedSpec.Spec(T); const ListType = serde.PrefixedArray(UsedSpec, serde.Num(i32, .Big), ElemType); pub const UserType = ListType.UserType; pub fn write(self: UserType, writer: anytype) !void { try writer.writeByte(@enumToInt(tag)); try ListType.write(self, writer); } pub fn deserialize(alloc: Allocator, reader: anytype) !UserType { const read_tag = @intToEnum(Tag, try reader.readByte()); if (read_tag != tag) { return error.IncorrectTag; } return try ListType.deserialize(alloc, reader); } pub fn deinit(self: UserType, alloc: Allocator) void { ListType.deinit(self, alloc); } pub fn size(self: UserType) usize { return 1 + ListType.size(self); } pub fn getNbtType(self: UserType) ?Tag { _ = self; return Tag.List; } }; } pub fn tagFromType(comptime T: type) Tag { switch (@typeInfo(T)) { .Struct => return .Compound, .Bool => return .Byte, .Int => |info| { return switch (info.bits) { 8 => .Byte, 16 => .Short, 32 => .Int, 64 => .Long, else => unreachable, }; }, .Float => |info| { return switch (info.bits) { 32 => .Float, 64 => .Double, else => unreachable, }; }, .Pointer => |info| { if (meta.trait.isZigString(T)) { return .String; } const child_info = @typeInfo(info.child); if (child_info == .Int) { return switch (child_info.Int.bits) { 8 => .ByteArray, 32 => .IntArray, 64 => .LongArray, else => unreachable, }; } return .List; }, else => @compileError("cant find tag from type " ++ @typeName(T)), } } pub fn Num(comptime T: type) type { return NbtWrapper(serde.Num(T, .Big), tagFromType(T)); } pub const Void = NbtWrapper(serde.Void, null); pub const Bool = NbtWrapper(serde.Bool, .Byte); pub const String = NbtWrapper(serde.PrefixedArray(serde.DefaultSpec, u16, u8), .String); pub fn SpecificList(comptime Partial: type) type { const info = @typeInfo(Partial).Pointer; return NbtWrapper(serde.PrefixedArray(NbtSpec, serde.Num(i32, .Big), info.child), tagFromType(Partial)); } pub const NbtSpec = struct { pub fn Spec(comptime Partial: type) type { if (serde.isSerializable(Partial)) { if (isNbtSerializable(Partial)) { return Partial; } else { return NbtWrapper(Partial, null); } } switch (@typeInfo(Partial)) { .Void => return Void, .Struct => return Compound(@This(), Partial), .Bool => return Bool, .Int => |info| { assert(info.signedness == .signed); return Num(Partial); }, .Float => return Num(Partial), .Pointer => |info| { assert(info.size == .Slice); if (meta.trait.isZigString(Partial)) { return String; } const child_info = @typeInfo(info.child); if (child_info == .Int and child_info.Int.bits != 16) { return SpecificList(Partial); } return List(@This(), info.child); }, else => @compileError("dont know how to nbt spec " ++ @typeName(Partial)), } } }; pub fn isNbtSerializable(comptime T: type) bool { return serde.isSerializable(T) and @hasDecl(T, "getNbtType"); } test "test.nbt" { const DataType = Named(NbtSpec.Spec(struct { name: []const u8, }), "hello world"); const data = DataType.UserType{ .name = "Bananrama" }; var buf = std.ArrayList(u8).init(testing.allocator); defer buf.deinit(); try DataType.write(data, &buf.writer()); // https://wiki.vg/NBT#test.nbt const expected = [_]u8{ 0x0a, 0x00, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x08, 0x00, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x09, 0x42, 0x61, 0x6e, 0x61, 0x6e, 0x72, 0x61, 0x6d, 0x61, 0x00 }; try testing.expectEqualSlices(u8, &expected, buf.items); try testing.expectEqual(expected.len, DataType.size(data)); var read_stream = std.io.fixedBufferStream(&expected); const de_res = try DataType.deserialize(testing.allocator, &read_stream.reader()); defer DataType.deinit(de_res, testing.allocator); try testing.expect(std.mem.eql(u8, data.name, de_res.name)); } test "bigtest.nbt" { const DataType = Named(NbtSpec.Spec(struct { @"nested compound test": struct { egg: struct { name: []const u8, value: f32, }, ham: struct { name: []const u8, value: f32, }, }, intTest: i32, byteTest: i8, stringTest: []const u8, @"listTest (long)": List(NbtSpec, i64), // cant do []i64 cause itll autodetect as LongArray doubleTest: f64, floatTest: f32, longTest: i64, @"listTest (compound)": []struct { @"created-on": i64, name: []const u8, }, @"byteArrayTest (the first 1000 values of (n*n*255+n*7)%100, starting with n=0 (0, 62, 34, 16, 8, ...))": []i8, shortTest: i16, }), "Level"); const bigtest_raw = @embedFile("test/bigtest.nbt"); var bigtest_raw_stream = std.io.fixedBufferStream(bigtest_raw); var gzip_stream = try gzip.gzipStream(testing.allocator, bigtest_raw_stream.reader()); defer gzip_stream.deinit(); const result = try DataType.deserialize(testing.allocator, gzip_stream.reader()); defer DataType.deinit(result, testing.allocator); //std.debug.print("result: {any}\n", .{result}); try testing.expectEqual(@as(i32, 2147483647), result.intTest); try testing.expectEqualStrings("Eggbert", result.@"nested compound test".egg.name); try testing.expectEqualStrings("Hampus", result.@"nested compound test".ham.name); try testing.expect(std.math.approxEqAbs(f32, 0.5, result.@"nested compound test".egg.value, std.math.epsilon(f32) * 10)); try testing.expect(std.math.approxEqAbs(f32, 0.75, result.@"nested compound test".ham.value, std.math.epsilon(f32) * 10)); try testing.expect(std.math.approxEqAbs(f32, 0.49823147058486938, result.floatTest, std.math.epsilon(f32) * 10)); try testing.expect(std.math.approxEqAbs(f64, 0.49312871321823148, result.doubleTest, std.math.epsilon(f64) * 10)); try testing.expectEqualStrings("HELLO WORLD THIS IS A TEST STRING \xc3\x85\xc3\x84\xc3\x96!", result.stringTest); // strings in bigtest.nbt are in utf8, not ascii try testing.expectEqual(@as(usize, 5), result.@"listTest (long)".len); inline for (.{ 11, 12, 13, 14, 15 }) |item, i| { try testing.expectEqual(@as(i64, item), result.@"listTest (long)"[i]); } try testing.expectEqual(@as(i64, 9223372036854775807), result.longTest); try testing.expectEqual(@as(usize, 2), result.@"listTest (compound)".len); inline for (.{ .{ 1264099775885, "Compound tag #0" }, .{ 1264099775885, "Compound tag #1" } }) |pair, i| { try testing.expectEqualStrings(pair[1], result.@"listTest (compound)"[i].name); try testing.expectEqual(@as(i64, pair[0]), result.@"listTest (compound)"[i].@"created-on"); } try testing.expectEqual(@as(usize, 1000), result.@"byteArrayTest (the first 1000 values of (n*n*255+n*7)%100, starting with n=0 (0, 62, 34, 16, 8, ...))".len); var n: usize = 0; while (n < 1000) : (n += 1) { const expected = @intCast(i8, @truncate(u8, (n * n * 255 + n * 7) % 100)); try testing.expectEqual(expected, result.@"byteArrayTest (the first 1000 values of (n*n*255+n*7)%100, starting with n=0 (0, 62, 34, 16, 8, ...))"[n]); } try testing.expectEqual(@as(i16, 32767), result.shortTest); } test "optional compound fields" { const SubType = struct { name: ?[]const u8, id: ?i16, alive: bool, }; const DataType = Named(NbtSpec.Spec([]SubType), "test"); const data: DataType.UserType = &.{ .{ .name = null, .id = null, .alive = true }, .{ .name = "hi", .id = 5, .alive = false }, }; var buf = std.ArrayList(u8).init(testing.allocator); defer buf.deinit(); try DataType.write(data, &buf.writer()); const expected_0 = [_]u8{ @enumToInt(Tag.Byte), 0, 5, 'a', 'l', 'i', 'v', 'e', 0x01, @enumToInt(Tag.End) }; const expected_1 = [_]u8{ @enumToInt(Tag.String), 0, 4, 'n', 'a', 'm', 'e', 0, 2, 'h', 'i', @enumToInt(Tag.Short), 0, 2, 'i', 'd', 0, 5, @enumToInt(Tag.Byte), 0, 5, 'a', 'l', 'i', 'v', 'e', 0x00, @enumToInt(Tag.End) }; const expected = [_]u8{ @enumToInt(Tag.List), 0, 4, 't', 'e', 's', 't', @enumToInt(Tag.Compound), 0, 0, 0, 2 } ++ expected_0 ++ expected_1; //std.debug.print("\nexpected: {any}\nfound : {any}\n", .{ std.mem.span(&expected), buf.items }); try testing.expectEqualSlices(u8, &expected, buf.items); try testing.expectEqual(expected.len, DataType.size(data)); var read_stream = std.io.fixedBufferStream(&expected); const de_res = try DataType.deserialize(testing.allocator, &read_stream.reader()); defer DataType.deinit(de_res, testing.allocator); try testing.expectEqual(@as(usize, 2), de_res.len); inline for (data) |elem, i| { if (elem.name) |name| { try testing.expectEqualStrings(name, de_res[i].name.?); } else { try testing.expectEqual(@as(?[]const u8, null), de_res[i].name); } if (elem.id) |id| { try testing.expectEqual(id, de_res[i].id.?); } else { try testing.expectEqual(@as(?i16, null), de_res[i].id); } try testing.expectEqual(elem.alive, de_res[i].alive); } }
src/nbt.zig
usingnamespace @import("std").c.builtins; pub const M3Result = [*c]const u8; pub const IM3Environment = ?*opaque {}; pub const IM3Runtime = ?*opaque {}; pub const IM3Module = ?*opaque {}; pub const IM3Function = ?*opaque {}; pub const IM3Global = ?*opaque {}; pub const M3ErrorInfo = extern struct { result: M3Result, runtime: IM3Runtime, module: IM3Module, function: IM3Function, file: [*c]const u8, line: u32, message: [*c]const u8, }; pub const M3BacktraceFrame = extern struct { moduleOffset: u32, function: IM3Function, next: ?*M3BacktraceFrame, }; pub const M3BacktraceInfo = extern struct { frames: ?*M3BacktraceFrame, lastFrame: ?*M3BacktraceFrame, pub fn lastFrameTruncated(self: *M3BacktraceInfo) callconv(.Inline) bool { const std = @import("std"); const last_frame = @ptrToInt(usize, self.lastFrame); // M3_BACKTRACE_TRUNCATED is defined as (void*)(SIZE_MAX) return last_frame == std.math.maxInt(usize); } }; pub const M3ValueType = extern enum(c_int) { None = 0, Int32 = 1, Int64 = 2, Float32 = 3, Float64 = 4, Unknown = 5, }; pub const M3TaggedValue = extern struct { kind: M3ValueType, value: extern union { // The wasm3 API has the integers as unsigned, // but the spec and naming convention seems to imply // that they're actually signed. I can't find an example // of wasm working with global integers, so we're just winging it // and if it breaks something we'll just have to fix it unfortunately. int32: i32, int64: i64, float32: f32, float64: f64, } }; pub const M3ImportInfo = extern struct { moduleUtf8: [*c]const u8, fieldUtf8: [*c]const u8, }; pub const M3ImportContext = extern struct { userdata: ?*c_void, function: IM3Function, }; pub extern var m3Err_none: M3Result; // general errors pub extern var m3Err_mallocFailed: M3Result; // parse errors pub extern var m3Err_incompatibleWasmVersion: M3Result; pub extern var m3Err_wasmMalformed: M3Result; pub extern var m3Err_misorderedWasmSection: M3Result; pub extern var m3Err_wasmUnderrun: M3Result; pub extern var m3Err_wasmOverrun: M3Result; pub extern var m3Err_wasmMissingInitExpr: M3Result; pub extern var m3Err_lebOverflow: M3Result; pub extern var m3Err_missingUTF8: M3Result; pub extern var m3Err_wasmSectionUnderrun: M3Result; pub extern var m3Err_wasmSectionOverrun: M3Result; pub extern var m3Err_invalidTypeId: M3Result; pub extern var m3Err_tooManyMemorySections: M3Result; pub extern var m3Err_tooManyArgsRets: M3Result; // link errors pub extern var m3Err_moduleAlreadyLinked: M3Result; pub extern var m3Err_functionLookupFailed: M3Result; pub extern var m3Err_functionImportMissing: M3Result; pub extern var m3Err_malformedFunctionSignature: M3Result; // compilation errors pub extern var m3Err_noCompiler: M3Result; pub extern var m3Err_unknownOpcode: M3Result; pub extern var m3Err_restictedOpcode: M3Result; pub extern var m3Err_functionStackOverflow: M3Result; pub extern var m3Err_functionStackUnderrun: M3Result; pub extern var m3Err_mallocFailedCodePage: M3Result; pub extern var m3Err_settingImmutableGlobal: M3Result; pub extern var m3Err_typeMismatch: M3Result; pub extern var m3Err_typeCountMismatch: M3Result; // runtime errors pub extern var m3Err_missingCompiledCode: M3Result; pub extern var m3Err_wasmMemoryOverflow: M3Result; pub extern var m3Err_globalMemoryNotAllocated: M3Result; pub extern var m3Err_globaIndexOutOfBounds: M3Result; pub extern var m3Err_argumentCountMismatch: M3Result; pub extern var m3Err_argumentTypeMismatch: M3Result; pub extern var m3Err_globalLookupFailed: M3Result; pub extern var m3Err_globalTypeMismatch: M3Result; pub extern var m3Err_globalNotMutable: M3Result; // traps pub extern var m3Err_trapOutOfBoundsMemoryAccess: M3Result; pub extern var m3Err_trapDivisionByZero: M3Result; pub extern var m3Err_trapIntegerOverflow: M3Result; pub extern var m3Err_trapIntegerConversion: M3Result; pub extern var m3Err_trapIndirectCallTypeMismatch: M3Result; pub extern var m3Err_trapTableIndexOutOfRange: M3Result; pub extern var m3Err_trapTableElementIsNull: M3Result; pub extern var m3Err_trapExit: M3Result; pub extern var m3Err_trapAbort: M3Result; pub extern var m3Err_trapUnreachable: M3Result; pub extern var m3Err_trapStackOverflow: M3Result; pub extern fn m3_NewEnvironment() IM3Environment; pub extern fn m3_FreeEnvironment(i_environment: IM3Environment) void; pub extern fn m3_NewRuntime(io_environment: IM3Environment, i_stackSizeInBytes: u32, i_userdata: ?*c_void) IM3Runtime; pub extern fn m3_FreeRuntime(i_runtime: IM3Runtime) void; pub extern fn m3_GetMemory(i_runtime: IM3Runtime, o_memorySizeInBytes: [*c]u32, i_memoryIndex: u32) [*c]u8; pub extern fn m3_GetUserData(i_runtime: IM3Runtime) ?*c_void; pub extern fn m3_ParseModule(i_environment: IM3Environment, o_module: *IM3Module, i_wasmBytes: [*]const u8, i_numWasmBytes: u32) M3Result; pub extern fn m3_FreeModule(i_module: IM3Module) void; pub extern fn m3_LoadModule(io_runtime: IM3Runtime, io_module: IM3Module) M3Result; pub extern fn m3_RunStart(i_module: IM3Module) M3Result; /// Arguments and return values are passed in and out through the stack pointer _sp. /// Placeholder return value slots are first and arguments after. So, the first argument is at _sp [numReturns] /// Return values should be written into _sp [0] to _sp [num_returns - 1] pub const M3RawCall = ?fn (IM3Runtime, ctx: *M3ImportContext, [*c]u64, ?*c_void) callconv(.C) ?*const c_void; pub extern fn m3_LinkRawFunction(io_module: IM3Module, i_moduleName: [*:0]const u8, i_functionName: [*:0]const u8, i_signature: [*c]const u8, i_function: M3RawCall) M3Result; pub extern fn m3_LinkRawFunctionEx(io_module: IM3Module, i_moduleName: [*:0]const u8, i_functionName: [*:0]const u8, i_signature: [*c]const u8, i_function: M3RawCall, i_userdata: ?*const c_void) M3Result; /// Returns "<unknown>" on failure, but this behavior isn't described in the API so could be subject to change. pub extern fn m3_GetModuleName(i_module: IM3Module) [*:0]u8; pub extern fn m3_GetModuleRuntime(i_module: IM3Module) IM3Runtime; pub extern fn m3_FindGlobal(io_module: IM3Module, i_globalName: [*:0]const u8) IM3Global; pub extern fn m3_GetGlobal(i_global: IM3Global, i_value: *M3TaggedValue) M3Result; pub extern fn m3_SetGlobal(i_global: IM3Global, i_value: *const M3TaggedValue) M3Result; pub extern fn m3_GetGlobalType(i_global: IM3Global) M3ValueType; pub extern fn m3_Yield() M3Result; pub extern fn m3_FindFunction(o_function: [*c]IM3Function, i_runtime: IM3Runtime, i_functionName: [*c]const u8) M3Result; pub extern fn m3_GetArgCount(i_function: IM3Function) u32; pub extern fn m3_GetRetCount(i_function: IM3Function) u32; pub extern fn m3_GetArgType(i_function: IM3Function, index: u32) M3ValueType; pub extern fn m3_GetRetType(i_function: IM3Function, index: u32) M3ValueType; pub extern fn m3_CallV(i_function: IM3Function, ...) M3Result; pub extern fn m3_Call(i_function: IM3Function, i_argc: u32, i_argptrs: [*c]?*const c_void) M3Result; pub extern fn m3_CallArgV(i_function: IM3Function, i_argc: u32, i_argv: [*c][*c]const u8) M3Result; pub extern fn m3_GetResults(i_function: IM3Function, i_retc: u32, ret_ptrs: [*c]?*c_void) M3Result; pub extern fn m3_GetErrorInfo(i_runtime: IM3Runtime, info: [*c]M3ErrorInfo) void; pub extern fn m3_ResetErrorInfo(i_runtime: IM3Runtime) void; /// Returns "<unnamed>" on failure, but this behavior isn't described in the API so could be subject to change. pub extern fn m3_GetFunctionName(i_function: IM3Function) [*:0]const u8; pub extern fn m3_GetFunctionModule(i_function: IM3Function) IM3Module; pub extern fn m3_PrintRuntimeInfo(i_runtime: IM3Runtime) void; pub extern fn m3_PrintM3Info() void; pub extern fn m3_PrintProfilerInfo() void; pub extern fn m3_GetBacktrace(i_runtime: IM3Runtime) ?*M3BacktraceInfo; pub extern fn m3_LinkWASI(io_module: IM3Module) M3Result;
src/c.zig
pub const DPI_AWARENESS_CONTEXT_UNAWARE = @import("../zig.zig").typedConst(DPI_AWARENESS_CONTEXT, @as(i32, -1)); pub const DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = @import("../zig.zig").typedConst(DPI_AWARENESS_CONTEXT, @as(i32, -2)); pub const DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = @import("../zig.zig").typedConst(DPI_AWARENESS_CONTEXT, @as(i32, -3)); pub const DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = @import("../zig.zig").typedConst(DPI_AWARENESS_CONTEXT, @as(i32, -4)); pub const DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED = @import("../zig.zig").typedConst(DPI_AWARENESS_CONTEXT, @as(i32, -5)); //-------------------------------------------------------------------------------- // Section: Types (6) //-------------------------------------------------------------------------------- pub const DPI_AWARENESS = enum(i32) { INVALID = -1, UNAWARE = 0, SYSTEM_AWARE = 1, PER_MONITOR_AWARE = 2, }; pub const DPI_AWARENESS_INVALID = DPI_AWARENESS.INVALID; pub const DPI_AWARENESS_UNAWARE = DPI_AWARENESS.UNAWARE; pub const DPI_AWARENESS_SYSTEM_AWARE = DPI_AWARENESS.SYSTEM_AWARE; pub const DPI_AWARENESS_PER_MONITOR_AWARE = DPI_AWARENESS.PER_MONITOR_AWARE; pub const DPI_HOSTING_BEHAVIOR = enum(i32) { INVALID = -1, DEFAULT = 0, MIXED = 1, }; pub const DPI_HOSTING_BEHAVIOR_INVALID = DPI_HOSTING_BEHAVIOR.INVALID; pub const DPI_HOSTING_BEHAVIOR_DEFAULT = DPI_HOSTING_BEHAVIOR.DEFAULT; pub const DPI_HOSTING_BEHAVIOR_MIXED = DPI_HOSTING_BEHAVIOR.MIXED; pub const DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS = enum(u32) { EFAULT = 0, ISABLE_FONT_UPDATE = 1, ISABLE_RELAYOUT = 2, _, pub fn initFlags(o: struct { EFAULT: u1 = 0, ISABLE_FONT_UPDATE: u1 = 0, ISABLE_RELAYOUT: u1 = 0, }) DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS { return @intToEnum(DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS, (if (o.EFAULT == 1) @enumToInt(DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.EFAULT) else 0) | (if (o.ISABLE_FONT_UPDATE == 1) @enumToInt(DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.ISABLE_FONT_UPDATE) else 0) | (if (o.ISABLE_RELAYOUT == 1) @enumToInt(DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.ISABLE_RELAYOUT) else 0) ); } }; pub const DCDC_DEFAULT = DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.EFAULT; pub const DCDC_DISABLE_FONT_UPDATE = DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.ISABLE_FONT_UPDATE; pub const DCDC_DISABLE_RELAYOUT = DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS.ISABLE_RELAYOUT; pub const DIALOG_DPI_CHANGE_BEHAVIORS = enum(u32) { EFAULT = 0, ISABLE_ALL = 1, ISABLE_RESIZE = 2, ISABLE_CONTROL_RELAYOUT = 4, _, pub fn initFlags(o: struct { EFAULT: u1 = 0, ISABLE_ALL: u1 = 0, ISABLE_RESIZE: u1 = 0, ISABLE_CONTROL_RELAYOUT: u1 = 0, }) DIALOG_DPI_CHANGE_BEHAVIORS { return @intToEnum(DIALOG_DPI_CHANGE_BEHAVIORS, (if (o.EFAULT == 1) @enumToInt(DIALOG_DPI_CHANGE_BEHAVIORS.EFAULT) else 0) | (if (o.ISABLE_ALL == 1) @enumToInt(DIALOG_DPI_CHANGE_BEHAVIORS.ISABLE_ALL) else 0) | (if (o.ISABLE_RESIZE == 1) @enumToInt(DIALOG_DPI_CHANGE_BEHAVIORS.ISABLE_RESIZE) else 0) | (if (o.ISABLE_CONTROL_RELAYOUT == 1) @enumToInt(DIALOG_DPI_CHANGE_BEHAVIORS.ISABLE_CONTROL_RELAYOUT) else 0) ); } }; pub const DDC_DEFAULT = DIALOG_DPI_CHANGE_BEHAVIORS.EFAULT; pub const DDC_DISABLE_ALL = DIALOG_DPI_CHANGE_BEHAVIORS.ISABLE_ALL; pub const DDC_DISABLE_RESIZE = DIALOG_DPI_CHANGE_BEHAVIORS.ISABLE_RESIZE; pub const DDC_DISABLE_CONTROL_RELAYOUT = DIALOG_DPI_CHANGE_BEHAVIORS.ISABLE_CONTROL_RELAYOUT; pub const PROCESS_DPI_AWARENESS = enum(i32) { DPI_UNAWARE = 0, SYSTEM_DPI_AWARE = 1, PER_MONITOR_DPI_AWARE = 2, }; pub const PROCESS_DPI_UNAWARE = PROCESS_DPI_AWARENESS.DPI_UNAWARE; pub const PROCESS_SYSTEM_DPI_AWARE = PROCESS_DPI_AWARENESS.SYSTEM_DPI_AWARE; pub const PROCESS_PER_MONITOR_DPI_AWARE = PROCESS_DPI_AWARENESS.PER_MONITOR_DPI_AWARE; pub const MONITOR_DPI_TYPE = enum(i32) { EFFECTIVE_DPI = 0, ANGULAR_DPI = 1, RAW_DPI = 2, // DEFAULT = 0, this enum value conflicts with EFFECTIVE_DPI }; pub const MDT_EFFECTIVE_DPI = MONITOR_DPI_TYPE.EFFECTIVE_DPI; pub const MDT_ANGULAR_DPI = MONITOR_DPI_TYPE.ANGULAR_DPI; pub const MDT_RAW_DPI = MONITOR_DPI_TYPE.RAW_DPI; pub const MDT_DEFAULT = MONITOR_DPI_TYPE.EFFECTIVE_DPI; //-------------------------------------------------------------------------------- // Section: Functions (28) //-------------------------------------------------------------------------------- // TODO: this type is limited to platform 'windows10.0.15063' pub extern "UxTheme" fn OpenThemeDataForDpi( hwnd: ?HWND, pszClassList: ?[*:0]const u16, dpi: u32, ) callconv(@import("std").os.windows.WINAPI) isize; // TODO: this type is limited to platform 'windows10.0.15063' pub extern "USER32" fn SetDialogControlDpiChangeBehavior( hWnd: ?HWND, mask: DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS, values: DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.15063' pub extern "USER32" fn GetDialogControlDpiChangeBehavior( hWnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS; // TODO: this type is limited to platform 'windows10.0.15063' pub extern "USER32" fn SetDialogDpiChangeBehavior( hDlg: ?HWND, mask: DIALOG_DPI_CHANGE_BEHAVIORS, values: DIALOG_DPI_CHANGE_BEHAVIORS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.15063' pub extern "USER32" fn GetDialogDpiChangeBehavior( hDlg: ?HWND, ) callconv(@import("std").os.windows.WINAPI) DIALOG_DPI_CHANGE_BEHAVIORS; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn GetSystemMetricsForDpi( nIndex: i32, dpi: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn AdjustWindowRectExForDpi( lpRect: ?*RECT, dwStyle: u32, bMenu: BOOL, dwExStyle: u32, dpi: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "USER32" fn LogicalToPhysicalPointForPerMonitorDPI( hWnd: ?HWND, lpPoint: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows8.1' pub extern "USER32" fn PhysicalToLogicalPointForPerMonitorDPI( hWnd: ?HWND, lpPoint: ?*POINT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn SystemParametersInfoForDpi( uiAction: u32, uiParam: u32, pvParam: ?*c_void, fWinIni: u32, dpi: u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn SetThreadDpiAwarenessContext( dpiContext: DPI_AWARENESS_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) DPI_AWARENESS_CONTEXT; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn GetThreadDpiAwarenessContext( ) callconv(@import("std").os.windows.WINAPI) DPI_AWARENESS_CONTEXT; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn GetWindowDpiAwarenessContext( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) DPI_AWARENESS_CONTEXT; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn GetAwarenessFromDpiAwarenessContext( value: DPI_AWARENESS_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) DPI_AWARENESS; // TODO: this type is limited to platform 'windows10.0.17134' pub extern "USER32" fn GetDpiFromDpiAwarenessContext( value: DPI_AWARENESS_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn AreDpiAwarenessContextsEqual( dpiContextA: DPI_AWARENESS_CONTEXT, dpiContextB: DPI_AWARENESS_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn IsValidDpiAwarenessContext( value: DPI_AWARENESS_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn GetDpiForWindow( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn GetDpiForSystem( ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.17134' pub extern "USER32" fn GetSystemDpiForProcess( hProcess: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) u32; // TODO: this type is limited to platform 'windows10.0.14393' pub extern "USER32" fn EnableNonClientDpiScaling( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.15063' pub extern "USER32" fn SetProcessDpiAwarenessContext( value: DPI_AWARENESS_CONTEXT, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.17134' pub extern "USER32" fn SetThreadDpiHostingBehavior( value: DPI_HOSTING_BEHAVIOR, ) callconv(@import("std").os.windows.WINAPI) DPI_HOSTING_BEHAVIOR; // TODO: this type is limited to platform 'windows10.0.17134' pub extern "USER32" fn GetThreadDpiHostingBehavior( ) callconv(@import("std").os.windows.WINAPI) DPI_HOSTING_BEHAVIOR; // TODO: this type is limited to platform 'windows10.0.17134' pub extern "USER32" fn GetWindowDpiHostingBehavior( hwnd: ?HWND, ) callconv(@import("std").os.windows.WINAPI) DPI_HOSTING_BEHAVIOR; // TODO: this type is limited to platform 'windows8.1' pub extern "api-ms-win-shcore-scaling-l1-1-1" fn SetProcessDpiAwareness( value: PROCESS_DPI_AWARENESS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows8.1' pub extern "api-ms-win-shcore-scaling-l1-1-1" fn GetProcessDpiAwareness( hprocess: ?HANDLE, value: ?*PROCESS_DPI_AWARENESS, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows8.1' pub extern "api-ms-win-shcore-scaling-l1-1-1" fn GetDpiForMonitor( hmonitor: ?HMONITOR, dpiType: MONITOR_DPI_TYPE, dpiX: ?*u32, dpiY: ?*u32, ) 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 (9) //-------------------------------------------------------------------------------- const BOOL = @import("../foundation.zig").BOOL; const DPI_AWARENESS_CONTEXT = @import("../system/system_services.zig").DPI_AWARENESS_CONTEXT; const HANDLE = @import("../foundation.zig").HANDLE; const HMONITOR = @import("../graphics/gdi.zig").HMONITOR; const HRESULT = @import("../foundation.zig").HRESULT; const HWND = @import("../foundation.zig").HWND; const POINT = @import("../foundation.zig").POINT; const PWSTR = @import("../foundation.zig").PWSTR; 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; } } }
deps/zigwin32/win32/ui/hi_dpi.zig
const std = @import("std"); const c = @import("../c.zig"); const vec3 = @import("vec3.zig"); const util = @import("../util.zig"); const Scene = @import("../scene.zig").Scene; const Shape = @import("shape.zig").Shape; const Material = @import("material.zig").Material; pub fn from_mol_file(alloc: *std.mem.Allocator, comptime f: []const u8) !Scene { var arena = std.heap.ArenaAllocator.init(alloc); defer arena.deinit(); const file_contents = try util.file_contents(&arena, f); return from_mol(alloc, file_contents); } const Element = enum { Carbon, Nitrogen, Oxygen, Hydrogen, pub fn radius(self: Element) f32 { return switch (self) { .Carbon, .Nitrogen, .Oxygen => 0.4, .Hydrogen => 0.2, }; } pub fn color(self: Element) c.vec3 { return switch (self) { .Oxygen => .{ .x = 1, .y = 0.3, .z = 0.3 }, .Hydrogen => .{ .x = 1, .y = 1, .z = 1 }, .Nitrogen => .{ .x = 0.3, .y = 0.3, .z = 1 }, .Carbon => .{ .x = 0.6, .y = 0.6, .z = 0.6 }, }; } }; pub fn from_mol(alloc: *std.mem.Allocator, txt: []const u8) !Scene { var iter = std.mem.split(u8, txt, "\n"); // Ignored header // const title = iter.next() orelse std.debug.panic("!", .{}); // const timestamp = iter.next() orelse std.debug.panic("!", .{}); // const comment = iter.next() orelse std.debug.panic("!", .{}); const counts = iter.next() orelse std.debug.panic("!", .{}); var count_iter = std.mem.tokenize(u8, counts, " "); const n_atoms = try std.fmt.parseUnsigned(u32, count_iter.next() orelse "0", 10); const n_bonds = try std.fmt.parseUnsigned(u32, count_iter.next() orelse "0", 10); var scene = Scene.new(alloc); comptime var num_elems = std.meta.fields(Element).len; var mats: [num_elems]u32 = undefined; var i: u32 = 0; while (i < num_elems) : (i += 1) { const o = @intToEnum(Element, @intCast(std.meta.TagType(Element), i)).color(); mats[i] = try scene.new_material(Material.new_diffuse(o.x, o.y, o.z)); } const elements = std.ComptimeStringMap(Element, .{ .{ "O", .Oxygen }, .{ "N", .Nitrogen }, .{ "C", .Carbon }, .{ "H", .Hydrogen }, }); i = 0; while (i < n_atoms) : (i += 1) { const line = iter.next() orelse std.debug.panic("Missing atom\n", .{}); var line_iter = std.mem.tokenize(u8, line, " "); const x = try std.fmt.parseFloat(f32, line_iter.next() orelse ""); const y = try std.fmt.parseFloat(f32, line_iter.next() orelse ""); const z = try std.fmt.parseFloat(f32, line_iter.next() orelse ""); const elem = line_iter.next() orelse ""; const e = elements.get(elem) orelse std.debug.panic("Unknown element {s}\n", .{elem}); try scene.shapes.append( Shape.new_sphere(.{ .x = x, .y = y, .z = z }, e.radius(), mats[@enumToInt(e)]), ); } const bond_mat = try scene.new_material(Material.new_diffuse(0.3, 0.3, 0.3)); i = 0; while (i < n_bonds) : (i += 1) { const line = iter.next() orelse std.debug.panic("Missing bond\n", .{}); var line_iter = std.mem.tokenize(u8, line, " "); const a = try std.fmt.parseInt(u32, line_iter.next() orelse "", 10); const b = try std.fmt.parseInt(u32, line_iter.next() orelse "", 10); const n = try std.fmt.parseInt(u32, line_iter.next() orelse "", 10); switch (n) { 1 => try scene.shapes.append(Shape.new_capped_cylinder( scene.shapes.items[a - 1].prim.Sphere.center, scene.shapes.items[b - 1].prim.Sphere.center, 0.08, bond_mat, )), 2 => { const ca = scene.shapes.items[a - 1].prim.Sphere.center; const cb = scene.shapes.items[b - 1].prim.Sphere.center; const d = vec3.sub(cb, ca); const perp = vec3.cross(d, .{ .x = 0, .y = 0, .z = 1 }); try scene.shapes.append(Shape.new_capped_cylinder( vec3.add(ca, vec3.mul(perp, 0.1)), vec3.add(cb, vec3.mul(perp, 0.1)), 0.06, bond_mat, )); try scene.shapes.append(Shape.new_capped_cylinder( vec3.add(ca, vec3.mul(perp, -0.1)), vec3.add(cb, vec3.mul(perp, -0.1)), 0.06, bond_mat, )); }, else => std.debug.panic("{} bonds not supported\n", .{n}), } } return scene; }
src/scene/mol.zig
const std = @import("std"); const learn = @import("learnBPE.zig"); const apply = @import("applyBPE.zig"); const warn = std.debug.warn; const resolve = learn.resolve; fn get_args(args: [][]const u8, n: usize) []const u8 { if (n >= args.len) return ""; return args[n]; } pub fn main() anyerror!void { // var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); // defer arena.deinit(); // var alloc = &arena.allocator; comptime var GPA = std.heap.GeneralPurposeAllocator(.{ // Number of stack frames to capture. .stack_trace_frames = 16, // If true, the allocator will have two fields: // * `total_requested_bytes` which tracks the total allocated bytes of memory requested. // * `requested_memory_limit` which causes allocations to return `error.OutOfMemory` // when the `total_requested_bytes` exceeds this limit. // If false, these fields will be `void`. .enable_memory_limit = false, // Whether to enable safety checks. .safety = true, // Whether the allocator may be used simultaneously from multiple threads. .thread_safe = true, // This is a temporary debugging trick you can use to turn segfaults into more helpful // logged error messages with stack trace details. The downside is that every allocation // will be leaked! .never_unmap = true, }){}; var alloc = &GPA.allocator; // GPA.deinit() returns true when we have leaks. defer std.debug.assert(!GPA.deinit()); var args = try std.process.argsAlloc(alloc); defer std.process.argsFree(alloc, args); if (args.len < 2) std.process.exit(1); const cmd = args[1]; var cmd_args = args[2..]; // TODO use https://github.com/MasterQ32/zig-args ? if (std.ascii.eqlIgnoreCase(cmd, "getvocab")) { try learn.getVocab(cmd_args[0], "", alloc); } else if (std.ascii.eqlIgnoreCase(cmd, "learnbpe")) { const n_bpe = try std.fmt.parseInt(i32, cmd_args[0], 10); try learn.learnbpe(n_bpe, cmd_args[1], "", alloc); } else if (std.ascii.eqlIgnoreCase(cmd, "applybpe")) { std.debug.assert(cmd_args.len == 2 or cmd_args.len == 3); try apply.applybpe(resolve(cmd_args[0]), resolve(cmd_args[1]), get_args(cmd_args, 2), alloc); } else { std.process.exit(1); } }
fastBPE/main.zig
const std = @import("std"); const testing = std.testing; const allocator = std.testing.allocator; pub const Map = struct { const MATCHES_NEEDED = 12; pub const Rotations = [24][3][3]isize{ [3][3]isize{ [3]isize{ 1, 0, 0 }, [3]isize{ 0, 1, 0 }, [3]isize{ 0, 0, 1 }, }, [3][3]isize{ [3]isize{ 1, 0, 0 }, [3]isize{ 0, 0, -1 }, [3]isize{ 0, 1, 0 }, }, [3][3]isize{ [3]isize{ 1, 0, 0 }, [3]isize{ 0, -1, 0 }, [3]isize{ 0, 0, -1 }, }, [3][3]isize{ [3]isize{ 1, 0, 0 }, [3]isize{ 0, 0, 1 }, [3]isize{ 0, -1, 0 }, }, [3][3]isize{ [3]isize{ 0, -1, 0 }, [3]isize{ 1, 0, 0 }, [3]isize{ 0, 0, 1 }, }, [3][3]isize{ [3]isize{ 0, 0, 1 }, [3]isize{ 1, 0, 0 }, [3]isize{ 0, 1, 0 }, }, [3][3]isize{ [3]isize{ 0, 1, 0 }, [3]isize{ 1, 0, 0 }, [3]isize{ 0, 0, -1 }, }, [3][3]isize{ [3]isize{ 0, 0, -1 }, [3]isize{ 1, 0, 0 }, [3]isize{ 0, -1, 0 }, }, [3][3]isize{ [3]isize{ -1, 0, 0 }, [3]isize{ 0, -1, 0 }, [3]isize{ 0, 0, 1 }, }, [3][3]isize{ [3]isize{ -1, 0, 0 }, [3]isize{ 0, 0, -1 }, [3]isize{ 0, -1, 0 }, }, [3][3]isize{ [3]isize{ -1, 0, 0 }, [3]isize{ 0, 1, 0 }, [3]isize{ 0, 0, -1 }, }, [3][3]isize{ [3]isize{ -1, 0, 0 }, [3]isize{ 0, 0, 1 }, [3]isize{ 0, 1, 0 }, }, [3][3]isize{ [3]isize{ 0, 1, 0 }, [3]isize{ -1, 0, 0 }, [3]isize{ 0, 0, 1 }, }, [3][3]isize{ [3]isize{ 0, 0, 1 }, [3]isize{ -1, 0, 0 }, [3]isize{ 0, -1, 0 }, }, [3][3]isize{ [3]isize{ 0, -1, 0 }, [3]isize{ -1, 0, 0 }, [3]isize{ 0, 0, -1 }, }, [3][3]isize{ [3]isize{ 0, 0, -1 }, [3]isize{ -1, 0, 0 }, [3]isize{ 0, 1, 0 }, }, [3][3]isize{ [3]isize{ 0, 0, -1 }, [3]isize{ 0, 1, 0 }, [3]isize{ 1, 0, 0 }, }, [3][3]isize{ [3]isize{ 0, 1, 0 }, [3]isize{ 0, 0, 1 }, [3]isize{ 1, 0, 0 }, }, [3][3]isize{ [3]isize{ 0, 0, 1 }, [3]isize{ 0, -1, 0 }, [3]isize{ 1, 0, 0 }, }, [3][3]isize{ [3]isize{ 0, -1, 0 }, [3]isize{ 0, 0, -1 }, [3]isize{ 1, 0, 0 }, }, [3][3]isize{ [3]isize{ 0, 0, -1 }, [3]isize{ 0, -1, 0 }, [3]isize{ -1, 0, 0 }, }, [3][3]isize{ [3]isize{ 0, -1, 0 }, [3]isize{ 0, 0, 1 }, [3]isize{ -1, 0, 0 }, }, [3][3]isize{ [3]isize{ 0, 0, 1 }, [3]isize{ 0, 1, 0 }, [3]isize{ -1, 0, 0 }, }, [3][3]isize{ [3]isize{ 0, 1, 0 }, [3]isize{ 0, 0, -1 }, [3]isize{ -1, 0, 0 }, }, }; const State = enum { SCANNER, BUOY }; const Pos = struct { x: isize, y: isize, z: isize, pub fn init(x: isize, y: isize, z: isize) Pos { var self = Pos{ .x = x, .y = y, .z = z }; return self; } pub fn equal(self: Pos, other: Pos) bool { return self.x == other.x and self.y == other.y and self.z == other.z; } pub fn distance_squared(self: Pos, other: Pos) usize { const dx = self.x - other.x; const ux = @intCast(usize, dx * dx); const dy = self.y - other.y; const uy = @intCast(usize, dy * dy); const dz = self.z - other.z; const uz = @intCast(usize, dz * dz); return ux + uy + uz; } pub fn manhattan_distance(self: Pos, other: Pos) usize { const dx = @intCast(usize, std.math.absInt(self.x - other.x) catch unreachable); const dy = @intCast(usize, std.math.absInt(self.y - other.y) catch unreachable); const dz = @intCast(usize, std.math.absInt(self.z - other.z) catch unreachable); return dx + dy + dz; } fn rotate(self: Pos, rot: [3][3]isize) Pos { var p: Pos = Pos.init( self.x * rot[0][0] + self.y * rot[0][1] + self.z * rot[0][2], self.x * rot[1][0] + self.y * rot[1][1] + self.z * rot[1][2], self.x * rot[2][0] + self.y * rot[2][1] + self.z * rot[2][2], ); return p; } pub fn rot_and_trans(self: Pos, rot: [3][3]isize, trans: Pos) Pos { var p = self.rotate(rot); p.x += trans.x; p.y += trans.y; p.z += trans.z; return p; } }; const Beacon = struct { name: usize, pos: Pos, dists: std.AutoHashMap(usize, Pos), pub fn init(name: usize, pos: Pos) Beacon { var self = Beacon{ .name = name, .pos = pos, .dists = std.AutoHashMap(usize, Pos).init(allocator), }; return self; } pub fn deinit(self: *Beacon) void { self.dists.deinit(); } }; const Scanner = struct { name: usize, pos_for_scanners: std.ArrayList(Pos), beacons: std.ArrayList(Beacon), pub fn init(name: usize) Scanner { var self = Scanner{ .name = name, .pos_for_scanners = std.ArrayList(Pos).init(allocator), .beacons = std.ArrayList(Beacon).init(allocator), }; const own = Pos.init(0, 0, 0); self.pos_for_scanners.append(own) catch unreachable; return self; } pub fn deinit(self: *Scanner) void { for (self.beacons.items) |*b| { b.deinit(); } self.beacons.deinit(); self.pos_for_scanners.deinit(); } fn compute_distances_between_beacons(self: *Scanner) !void { for (self.beacons.items) |*b0, j0| { for (self.beacons.items) |b1, j1| { if (j0 == j1) continue; const d = b0.pos.distance_squared(b1.pos); try b0.*.dists.put(d, b1.pos); } } } pub fn match_scanners(self: *Scanner, other: *Scanner) !bool { var matches = std.AutoHashMap(Pos, Pos).init(allocator); defer matches.deinit(); try self.compute_distances_between_beacons(); try other.compute_distances_between_beacons(); for (self.beacons.items) |b0| { for (other.beacons.items) |b1| { var total: usize = 1; var count: usize = 1; var it = b1.dists.iterator(); while (it.next()) |e| { total += 1; const d = e.key_ptr.*; if (!b0.dists.contains(d)) continue; count += 1; } if (count < MATCHES_NEEDED) continue; try matches.put(b0.pos, b1.pos); // std.debug.warn("-- MATCH beacon {} {} with beacon {} {}: {} / {} matches\n", .{ b0.name, b0.pos, b1.name, b1.pos, count, total }); } } const size = matches.count(); if (size <= 0) { // std.debug.warn("*** NO MATCH BETWEEN scanner {} and {}\n", .{ self.name, other.name }); return false; } // std.debug.warn("*** MATCHED scanner {} ({} beacons) and {} ({} beacons), {} beacons match\n", .{ self.name, self.beacons.items.len, other.name, other.beacons.items.len, size }); for (Map.Rotations) |rot| { var delta = Pos.init(0, 0, 0); var first: bool = true; var candidate: bool = true; var it = matches.iterator(); while (it.next()) |e| { const p0 = e.key_ptr.*; const p1 = e.value_ptr.*; const rotated = p0.rotate(rot); const new = Pos.init(p1.x - rotated.x, p1.y - rotated.y, p1.z - rotated.z); if (first) { first = false; delta = new; continue; } if (!Pos.equal(delta, new)) { candidate = false; } } if (candidate) { // std.debug.warn("CORRECT ROT IS {d} => scanner {} is at {}\n", .{ rot, self.name, self.pos }); // now dump all rotated beacons from self into other, which were not matched var dumps: usize = 0; for (self.beacons.items) |*b| { if (matches.contains(b.pos)) { // std.debug.warn("SKIPPING MATCHED BEACON\n", .{}); b.deinit(); continue; } b.pos = b.pos.rot_and_trans(rot, delta); try other.beacons.append(b.*); dumps += 1; } for (self.pos_for_scanners.items) |p| { const new = p.rot_and_trans(rot, delta); try other.pos_for_scanners.append(new); } self.beacons.clearRetainingCapacity(); // std.debug.warn("TRANSFERRED {} UNMATCHED BEACONS => {} TOTAL\n", .{ dumps, other.beacons.items.len }); } } return true; } pub fn show(self: Scanner) !void { std.debug.warn("SCANNER {}\n", .{self.name}); for (self.beacons.items) |b, j| { std.debug.warn("BUOY {}:", .{j}); var it = b.dists.iterator(); while (it.next()) |e| { std.debug.warn(" {}", .{e.key_ptr.*}); } std.debug.warn("\n", .{}); } } }; state: State, current: usize, scanners: std.AutoHashMap(usize, *Scanner), matched: bool, pub fn init() Map { var self = Map{ .state = State.SCANNER, .current = 0, .scanners = std.AutoHashMap(usize, *Scanner).init(allocator), .matched = false, }; return self; } pub fn deinit(self: *Map) void { var it = self.scanners.iterator(); while (it.next()) |e| { var s = e.value_ptr.*; s.deinit(); allocator.destroy(s); } self.scanners.deinit(); } pub fn process_line(self: *Map, data: []const u8) !void { switch (self.state) { State.SCANNER => { if (data[0] != '-') unreachable; var pos: usize = 0; var it = std.mem.tokenize(u8, data, " "); while (it.next()) |what| : (pos += 1) { if (pos != 2) continue; self.current = std.fmt.parseInt(usize, what, 10) catch unreachable; var s = allocator.create(Scanner) catch unreachable; s.* = Scanner.init(self.current); try self.scanners.put(self.current, s); break; } self.state = State.BUOY; }, State.BUOY => { if (data.len == 0) { self.state = State.SCANNER; return; } var p: Pos = undefined; var pos: usize = 0; var it = std.mem.split(u8, data, ","); while (it.next()) |num| : (pos += 1) { const n = std.fmt.parseInt(isize, num, 10) catch unreachable; if (pos == 0) { p.x = n; continue; } if (pos == 1) { p.y = n; continue; } if (pos == 2) { p.z = n; var s = self.scanners.get(self.current).?; var l = s.beacons.items.len; var b = Beacon.init(l, p); try s.*.beacons.append(b); p = undefined; continue; } unreachable; } }, } } pub fn match_all_scanners(self: *Map) !usize { if (!self.matched) { self.matched = true; const n = self.scanners.count(); var j0: usize = 0; while (j0 < n) : (j0 += 1) { var s0 = self.scanners.get(n - 1 - j0).?; var j1: usize = j0 + 1; while (j1 < n) : (j1 += 1) { var s1 = self.scanners.get(n - 1 - j1).?; if (try s0.match_scanners(s1)) break; } } } const beacons = self.scanners.get(0).?.beacons.items.len; // std.debug.warn("BEACONS {} \n", .{beacons}); return beacons; } pub fn find_largest_manhattan(self: *Map) !usize { _ = try self.match_all_scanners(); var largest: usize = 0; const s = self.scanners.get(0).?; for (s.pos_for_scanners.items) |p0, j| { for (s.pos_for_scanners.items[j + 1 ..]) |p1| { var m = p0.manhattan_distance(p1); if (largest < m) largest = m; } } // std.debug.warn("LARGEST {} \n", .{largest}); return largest; } pub fn show(self: Map) !void { const n = self.scanners.count(); std.debug.warn("MAP with {} scanners\n", .{n}); var j: usize = 0; while (j < n) : (j += 1) { var s = self.scanners.get(j).?; // std.debug.warn("SCANNER {}:\n", .{e.key_ptr.*}); try s.show(); } } }; test "sample part a" { const data: []const u8 = \\--- 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 ; var map = Map.init(); defer map.deinit(); // map.show(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } // try map.show(); const unique = try map.match_all_scanners(); try testing.expect(unique == 79); } test "sample part b" { const data: []const u8 = \\--- 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 ; var map = Map.init(); defer map.deinit(); // map.show(); var it = std.mem.split(u8, data, "\n"); while (it.next()) |line| { try map.process_line(line); } const largest = try map.find_largest_manhattan(); try testing.expect(largest == 3621); }
2021/p19/map.zig
const ActorInterface = @import("actor.zig").ActorInterface; const MessageAllocator = @import("message_allocator.zig").MessageAllocator; const messageQueueNs = @import("message_queue.zig"); const MessageQueue = messageQueueNs.MessageQueue; const SignalContext = messageQueueNs.SignalContext; const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; pub fn Message(comptime BodyType: type) type { return packed struct { const Self = @This(); pub header: MessageHeader, // Must be first field pub body: BodyType, /// Initialize header.cmd and BodyType.init, /// NOTE: Header is NOT initialized!!!! pub fn init(pSelf: *Self, cmd: u64) void { // TODO: I'm unable to make this assert it when moving header //warn("{*}.init({})\n", pSelf, cmd); assert(@byteOffsetOf(Message(packed struct {}), "header") == 0); pSelf.header.cmd = cmd; BodyType.init(&pSelf.body); } /// Initialize the header to empty pub fn initHeaderEmpty(pSelf: *Self) void { pSelf.header.initEmpty(); } /// Initialize the body pub fn initBody(pSelf: *Self) void { BodyType.init(&pSelf.body); } /// Send this message to destination queue pub fn send(pSelf: *Self) !void { if (pSelf.getDstQueue()) |pQ| pQ.put(&pSelf.header) else return error.NoQueue; } /// Get the destination queue pub fn getDstQueue(pSelf: *const Self) ?*MessageQueue() { return pSelf.header.pDstActor.?.pQueue; } /// Return a pointer to the Message this MessageHeader is a member of. pub fn getMessagePtr(header: *MessageHeader) *Self { return @fieldParentPtr(Self, "header", header); } /// Format the message to a byte array using the output fn pub fn format( pSelf: *const Self, comptime fmt: []const u8, context: var, comptime FmtError: type, output: fn (@typeOf(context), []const u8) FmtError!void ) FmtError!void { try std.fmt.format(context, FmtError, output, "{{"); try pSelf.header.format("", context, FmtError, output); try std.fmt.format(context, FmtError, output, "body={{"); try BodyType.format(&pSelf.body, fmt, context, FmtError, output); try std.fmt.format(context, FmtError, output, "}},"); try std.fmt.format(context, FmtError, output, "}}"); } }; } pub const MessageHeader = packed struct { const Self = @This(); // TODO: Rename as pXxxx pub pNext: ?*MessageHeader, pub pAllocator: ?*MessageAllocator(), pub pSrcActor: ?*ActorInterface, pub pDstActor: ?*ActorInterface, pub cmd: u64, pub fn init( pSelf: *Self, pAllocator: ?*MessageAllocator(), pSrcActor: ?*ActorInterface, pDstActor: ?*ActorInterface, cmd: u64, ) void { pSelf.pNext = null; pSelf.pAllocator = pAllocator; pSelf.pSrcActor = pSrcActor; pSelf.pDstActor = pDstActor; pSelf.cmd = cmd; } pub fn initEmpty(pSelf: *Self) void { pSelf.pNext = null; pSelf.pAllocator = null; pSelf.pSrcActor = null; pSelf.pDstActor = null; pSelf.cmd = 0; } pub fn initSwap(pSelf: *Self, pSrcMh: *MessageHeader) void { pSelf.pDstActor = pSrcMh.pSrcActor; pSelf.pSrcActor = pSrcMh.pDstActor; } pub fn format( pSelf: *const Self, comptime fmt: []const u8, context: var, comptime FmtError: type, output: fn (@typeOf(context), []const u8) FmtError!void ) FmtError!void { var pDstQueue: ?*MessageQueue() = null; var pDstSigCtx: *SignalContext = @intToPtr(*SignalContext, 0); if (pSelf.pDstActor) |pAi| { if (pAi.pQueue) |pQ| { pDstQueue = pQ; if (pQ.pSignalContext) |pCtx| { pDstSigCtx = pCtx; } } } var pSrcQueue: ?*MessageQueue() = null; var pSrcSigCtx: *SignalContext = @intToPtr(*SignalContext, 0); if (pSelf.pSrcActor) |pAi| { if (pAi.pQueue) |pQ| { pSrcQueue = pQ; if (pQ.pSignalContext) |pCtx| { pSrcSigCtx = pCtx; } } } try std.fmt.format(context, FmtError, output, "pSrcActor={*}:{*}:{} pDstActor={*}:{*}:{} cmd={}, ", pSelf.pSrcActor, pSrcQueue, pSrcSigCtx, pSelf.pDstActor, pDstQueue, pDstSigCtx, pSelf.cmd); } };
message.zig
const std = @import("std"); const microzig = @import("microzig"); const regs = microzig.chip.registers; // this will instantiate microzig and pull in all dependencies pub const panic = microzig.panic; const abs = std.math.absCast; pub const TIM6Timer = struct { pub fn init() @This() { // Enable TIM6. regs.RCC.APB1ENR.modify(.{ .TIM6EN = 1 }); regs.TIM6.CR1.modify(.{ // Disable counting, toggle it on when we need to when in OPM. .CEN = 0, // Configure to one-pulse mode .OPM = 1, }); // Set prescaler to roughly 1ms per count. // Here we assume TIM6 is running on an 8 MHz clock, // which it is by default after STM32F3DISCOVERY MCU reset. regs.TIM6.PSC.raw = 7999; return @This(){}; } pub fn delayMs(_: @This(), n: u16) void { if (n == 0) return; // to avoid counting to 2**16 // Set our value for TIM6 to count to. regs.TIM6.ARR.raw = n; // Start the clock using CEN. regs.TIM6.CR1.modify(.{ .CEN = 1 }); // Wait for TIM6 to set the status register. while (regs.TIM6.SR.read().UIF == 0) {} // Clear the status register. regs.TIM6.SR.modify(.{ .UIF = 0 }); } }; const Leds = struct { /// for each led, the 'number of times' it is switched on _leds: [8]usize, pub fn init() @This() { // Enable GPIOE port regs.RCC.AHBENR.modify(.{ .IOPEEN = 1 }); // Set all 8 LEDs to general purpose output regs.GPIOE.MODER.modify(.{ .MODER8 = 0b01, // top left, blue, LED 4 .MODER9 = 0b01, // top, red, LED 3 .MODER10 = 0b01, // top right, orange, LED 5 .MODER11 = 0b01, // right, green, LED 7 .MODER12 = 0b01, // bottom right, blue, LED 9 .MODER13 = 0b01, // bottom, red, LED 10 .MODER14 = 0b01, // bottom left, orange, LED 8 .MODER15 = 0b01, // left, green, LED 6 }); var self = Leds{ ._leds = undefined }; self.reset(); return self; } pub fn reset(self: *@This()) void { self._leds = .{ 0, 0, 0, 0, 0, 0, 0, 0 }; regs.GPIOE.BRR.modify(.{ .BR8 = 1, .BR9 = 1, .BR10 = 1, .BR11 = 1, .BR12 = 1, .BR13 = 1, .BR14 = 1, .BR15 = 1, }); } pub fn add(self: *@This(), nr: u3) void { self._leds[nr] += 1; } pub fn remove(self: *@This(), nr: u3) void { self._leds[nr] -= 1; } pub fn update(self: *@This()) void { for (self._leds) |n, nr| { if (n > 0) { switch (nr) { 0 => regs.GPIOE.BSRR.modify(.{ .BS8 = 1 }), 1 => regs.GPIOE.BSRR.modify(.{ .BS9 = 1 }), 2 => regs.GPIOE.BSRR.modify(.{ .BS10 = 1 }), 3 => regs.GPIOE.BSRR.modify(.{ .BS11 = 1 }), 4 => regs.GPIOE.BSRR.modify(.{ .BS12 = 1 }), 5 => regs.GPIOE.BSRR.modify(.{ .BS13 = 1 }), 6 => regs.GPIOE.BSRR.modify(.{ .BS14 = 1 }), 7 => regs.GPIOE.BSRR.modify(.{ .BS15 = 1 }), else => unreachable, } } else { switch (nr) { 0 => regs.GPIOE.BRR.modify(.{ .BR8 = 1 }), 1 => regs.GPIOE.BRR.modify(.{ .BR9 = 1 }), 2 => regs.GPIOE.BRR.modify(.{ .BR10 = 1 }), 3 => regs.GPIOE.BRR.modify(.{ .BR11 = 1 }), 4 => regs.GPIOE.BRR.modify(.{ .BR12 = 1 }), 5 => regs.GPIOE.BRR.modify(.{ .BR13 = 1 }), 6 => regs.GPIOE.BRR.modify(.{ .BR14 = 1 }), 7 => regs.GPIOE.BRR.modify(.{ .BR15 = 1 }), else => unreachable, } } } } pub fn has(self: *@This(), nr: u3) bool { return self._leds[nr] > 0; } }; const System = struct { leds: *Leds, timer: *TIM6Timer, wait_time_ms: u16 = undefined, fp: anyframe = undefined, debug_writer: microzig.Uart(1).Writer = undefined, pub fn run(self: *@This()) noreturn { while (true) { self.timer.delayMs(self.wait_time_ms); resume self.fp; } } pub fn sleep(self: *@This(), ms: u16) void { self.wait_time_ms = ms; self.fp = @frame(); suspend {} } pub fn debug(self: *@This(), comptime format: []const u8, args: anytype) !void { try self.debug_writer.print(format, args); } }; pub fn main() !void { const timer = TIM6Timer.init(); var leds = Leds.init(); const uart1 = try microzig.Uart(1).init(.{ .baud_rate = 460800 }); var system = System{ .leds = &leds, .timer = timer, .debug_writer = uart1.writer(), }; try system.debug("\r\nMAIN START\r\n", .{}); _ = async heavyLed(&system); //_ = async twoBumpingLeds(&system); //_ = async randomCompass(&system); system.run(); } fn heavyLed(system: *System) !void { const leds = system.leds; const i2c1 = try microzig.I2CController(1).init(); // STM32F3DISCOVERY board LSM303AGR accelerometer (I2C address 0b0011001) const xl = i2c1.device(0b0011001); // set CTRL_REG1 (0x20) to 100 Hz (.ODR==0b0101), // normal power mode (.LPen==1), // Y/X both enabled (.Zen==0, .Yen==.Xen==1) try xl.writeRegister(0x20, 0b01010011); var current_led: ?u3 = null; // led initially off while (true) { // get accelerometer X / Y data: // read OUT_* registers: 4 registers starting with OUT_X_L (0x28) var out: [4]u8 = undefined; try xl.readRegisters(0x28, &out); const x: i16 = @as(i16, out[1]) << 8 | out[0]; const y: i16 = @as(i16, out[3]) << 8 | out[2]; // disable previous led if (current_led) |nr| leds.remove(nr); // enable the right led // Note that for the LSM303AGR accelerometer on the STM32F3DISCOVERY board, // the x-axis points east, y-axis south, and z-axis down. const cutoff: i16 = 1000; // the max x/y/z value is around 18000 in practice if (@as(i32, x) * x + @as(i32, y) * y < @as(i32, cutoff) * cutoff) { // (x,y) close to (0,0), so board is close to horizontal: all off current_led = null; } else { // find out which led on the compass rose points down // Note that 70/169 is almost sqrt(2)-1 == tan(22.5 degrees). if (@as(u32, 169) * abs(y) < @as(u32, 70) * abs(x)) { // (x,y) within 22.5 degrees of x-axis current_led = if (x > 0) 3 else 7; // east or west } else if (@as(u32, 169) * abs(x) < @as(u32, 70) * abs(y)) { // (x,y) within 22.5 degrees of y-axis current_led = if (y > 0) 5 else 1; // south or north } else { if (x > 0) { current_led = if (y > 0) 4 else 2; // south-east or north-east } else { current_led = if (y > 0) 6 else 0; // south-west or north-west } } } if (current_led) |nr| leds.add(nr); leds.update(); system.sleep(10); } } fn randomCompass(system: *System) void { const leds = system.leds; var rng = std.rand.DefaultPrng.init(42).random(); const D = 24 + 1 * 16; var direction: u8 = 0; while (true) { var nr: u3 = 0; while (true) { if (distance(32 * @as(u8, nr), direction) <= D) { leds.add(nr); } nr +%= 1; if (nr == 0) break; } leds.update(); system.sleep(150); nr = 0; while (true) { if (distance(32 * @as(u8, nr), direction) <= D) { leds.remove(nr); } nr +%= 1; if (nr == 0) break; } direction +%= rng.uintLessThan(u8, 60) -% 30; } } fn distance(a: anytype, b: @TypeOf(a)) @TypeOf(a) { return std.math.min(b -% a, a -% b); } fn twoBumpingLeds(system: *System) !void { const leds = system.leds; var j: u3 = 0; var k: u3 = 0; leds.add(j); leds.add(k); const i2c1 = try microzig.I2CController(1).init(); // STM32F3DISCOVERY board LSM303AGR accelerometer (I2C address 0b0011001) const xl = i2c1.device(0b0011001); // read device ID (0x33 == 51) from "register" WHO_AM_I_A (0x0F) const accelerometer_device_id = xl.readRegister(0x0F); try system.debug("I2C1 device 0b0011001 device ID: {} == 51 == 0x33\r\n", .{accelerometer_device_id}); { // set CTRL_REG1 (0x20) to 100 Hz (.ODR==0b0101), // normal power mode (.LPen==1), // Z/Y/X all enabled (.Zen==.Yen==.Xen==1) var wt = try xl.startTransfer(.write); { defer wt.stop(); try wt.writer().writeAll(&.{ 0x20, 0b01010111 }); } } var rng = std.rand.DefaultPrng.init(42).random(); while (true) { if (rng.boolean()) { leds.remove(j); while (true) { j = if (j == 7) 0 else j + 1; if (!leds.has(j)) break; } leds.add(j); } else { leds.remove(k); while (true) { k = if (k == 0) 7 else k - 1; if (!leds.has(k)) break; } leds.add(k); } leds.update(); // get accelerometer X / Y / Z data: // read OUT_* registers: 6 registers starting with OUT_X_L (0x28) var out: [6]u8 = undefined; try xl.readRegisters(0x28, &out); try system.debug("I2C1 device 0b0011001 output: {any}\r\n", .{out}); const ms = rng.uintLessThan(u16, 400); const x: i16 = @as(i16, out[1]) << 8 | out[0]; const y: i16 = @as(i16, out[3]) << 8 | out[2]; const z: i16 = @as(i16, out[5]) << 8 | out[4]; try system.debug("I2C1 x={d:>6} y={d:>6} z={d:>6}\r\n", .{ x, y, z }); try system.debug("sleeping for {} ms\r\n", .{ms}); system.sleep(ms); } } test { try std.testing.expectEqual(@as(u8, 0), distance(77, 77)); try std.testing.expectEqual(@as(u8, 3), distance(12, 15)); try std.testing.expectEqual(@as(u8, 4), distance(254, 2)); }
src/main.zig
const sg = @import("gfx.zig"); pub const Pipeline = extern struct { id: u32 = 0, }; pub const Error = extern enum(i32) { ERROR = 0, VERTICES_FULL, UNIFORMS_FULL, COMMANDS_FULL, STACK_OVERFLOW, STACK_UNDERFLOW, }; pub const Desc = extern struct { max_vertices: i32 = 0, max_commands: i32 = 0, pipeline_pool_size: i32 = 0, color_format: sg.PixelFormat = .DEFAULT, depth_format: sg.PixelFormat = .DEFAULT, sample_count: i32 = 0, face_winding: sg.FaceWinding = .DEFAULT, }; pub extern fn sgl_setup([*c]const Desc) void; pub fn setup(desc: Desc) callconv(.Inline) void { sgl_setup(&desc); } pub extern fn sgl_shutdown() void; pub fn shutdown() callconv(.Inline) void { sgl_shutdown(); } pub extern fn sgl_error() Error; pub fn getError() callconv(.Inline) Error { return sgl_error(); } pub extern fn sgl_defaults() void; pub fn defaults() callconv(.Inline) void { sgl_defaults(); } pub extern fn sgl_rad(f32) f32; pub fn asRadians(deg: f32) callconv(.Inline) f32 { return sgl_rad(deg); } pub extern fn sgl_deg(f32) f32; pub fn asDegrees(rad: f32) callconv(.Inline) f32 { return sgl_deg(rad); } pub extern fn sgl_make_pipeline([*c]const sg.PipelineDesc) Pipeline; pub fn makePipeline(desc: sg.PipelineDesc) callconv(.Inline) Pipeline { return sgl_make_pipeline(&desc); } pub extern fn sgl_destroy_pipeline(Pipeline) void; pub fn destroyPipeline(pip: Pipeline) callconv(.Inline) void { sgl_destroy_pipeline(pip); } pub extern fn sgl_viewport(i32, i32, i32, i32, bool) void; pub fn viewport(x: i32, y: i32, w: i32, h: i32, origin_top_left: bool) callconv(.Inline) void { sgl_viewport(x, y, w, h, origin_top_left); } pub extern fn sgl_viewportf(f32, f32, f32, f32, bool) void; pub fn viewportf(x: f32, y: f32, w: f32, h: f32, origin_top_left: bool) callconv(.Inline) void { sgl_viewportf(x, y, w, h, origin_top_left); } pub extern fn sgl_scissor_rect(i32, i32, i32, i32, bool) void; pub fn scissorRect(x: i32, y: i32, w: i32, h: i32, origin_top_left: bool) callconv(.Inline) void { sgl_scissor_rect(x, y, w, h, origin_top_left); } pub extern fn sgl_scissor_rectf(f32, f32, f32, f32, bool) void; pub fn scissorRectf(x: f32, y: f32, w: f32, h: f32, origin_top_left: bool) callconv(.Inline) void { sgl_scissor_rectf(x, y, w, h, origin_top_left); } pub extern fn sgl_enable_texture() void; pub fn enableTexture() callconv(.Inline) void { sgl_enable_texture(); } pub extern fn sgl_disable_texture() void; pub fn disableTexture() callconv(.Inline) void { sgl_disable_texture(); } pub extern fn sgl_texture(sg.Image) void; pub fn texture(img: sg.Image) callconv(.Inline) void { sgl_texture(img); } pub extern fn sgl_default_pipeline() void; pub fn defaultPipeline() callconv(.Inline) void { sgl_default_pipeline(); } pub extern fn sgl_load_pipeline(Pipeline) void; pub fn loadPipeline(pip: Pipeline) callconv(.Inline) void { sgl_load_pipeline(pip); } pub extern fn sgl_push_pipeline() void; pub fn pushPipeline() callconv(.Inline) void { sgl_push_pipeline(); } pub extern fn sgl_pop_pipeline() void; pub fn popPipeline() callconv(.Inline) void { sgl_pop_pipeline(); } pub extern fn sgl_matrix_mode_modelview() void; pub fn matrixModeModelview() callconv(.Inline) void { sgl_matrix_mode_modelview(); } pub extern fn sgl_matrix_mode_projection() void; pub fn matrixModeProjection() callconv(.Inline) void { sgl_matrix_mode_projection(); } pub extern fn sgl_matrix_mode_texture() void; pub fn matrixModeTexture() callconv(.Inline) void { sgl_matrix_mode_texture(); } pub extern fn sgl_load_identity() void; pub fn loadIdentity() callconv(.Inline) void { sgl_load_identity(); } pub extern fn sgl_load_matrix([*c]const f32) void; pub fn loadMatrix(m: *const f32) callconv(.Inline) void { sgl_load_matrix(m); } pub extern fn sgl_load_transpose_matrix([*c]const f32) void; pub fn loadTransposeMatrix(m: *const f32) callconv(.Inline) void { sgl_load_transpose_matrix(m); } pub extern fn sgl_mult_matrix([*c]const f32) void; pub fn multMatrix(m: *const f32) callconv(.Inline) void { sgl_mult_matrix(m); } pub extern fn sgl_mult_transpose_matrix([*c]const f32) void; pub fn multTransposeMatrix(m: *const f32) callconv(.Inline) void { sgl_mult_transpose_matrix(m); } pub extern fn sgl_rotate(f32, f32, f32, f32) void; pub fn rotate(angle_rad: f32, x: f32, y: f32, z: f32) callconv(.Inline) void { sgl_rotate(angle_rad, x, y, z); } pub extern fn sgl_scale(f32, f32, f32) void; pub fn scale(x: f32, y: f32, z: f32) callconv(.Inline) void { sgl_scale(x, y, z); } pub extern fn sgl_translate(f32, f32, f32) void; pub fn translate(x: f32, y: f32, z: f32) callconv(.Inline) void { sgl_translate(x, y, z); } pub extern fn sgl_frustum(f32, f32, f32, f32, f32, f32) void; pub fn frustum(l: f32, r: f32, b: f32, t: f32, n: f32, f: f32) callconv(.Inline) void { sgl_frustum(l, r, b, t, n, f); } pub extern fn sgl_ortho(f32, f32, f32, f32, f32, f32) void; pub fn ortho(l: f32, r: f32, b: f32, t: f32, n: f32, f: f32) callconv(.Inline) void { sgl_ortho(l, r, b, t, n, f); } pub extern fn sgl_perspective(f32, f32, f32, f32) void; pub fn perspective(fov_y: f32, aspect: f32, z_near: f32, z_far: f32) callconv(.Inline) void { sgl_perspective(fov_y, aspect, z_near, z_far); } pub extern fn sgl_lookat(f32, f32, f32, f32, f32, f32, f32, f32, f32) void; pub fn lookat(eye_x: f32, eye_y: f32, eye_z: f32, center_x: f32, center_y: f32, center_z: f32, up_x: f32, up_y: f32, up_z: f32) callconv(.Inline) void { sgl_lookat(eye_x, eye_y, eye_z, center_x, center_y, center_z, up_x, up_y, up_z); } pub extern fn sgl_push_matrix() void; pub fn pushMatrix() callconv(.Inline) void { sgl_push_matrix(); } pub extern fn sgl_pop_matrix() void; pub fn popMatrix() callconv(.Inline) void { sgl_pop_matrix(); } pub extern fn sgl_t2f(f32, f32) void; pub fn t2f(u: f32, v: f32) callconv(.Inline) void { sgl_t2f(u, v); } pub extern fn sgl_c3f(f32, f32, f32) void; pub fn c3f(r: f32, g: f32, b: f32) callconv(.Inline) void { sgl_c3f(r, g, b); } pub extern fn sgl_c4f(f32, f32, f32, f32) void; pub fn c4f(r: f32, g: f32, b: f32, a: f32) callconv(.Inline) void { sgl_c4f(r, g, b, a); } pub extern fn sgl_c3b(u8, u8, u8) void; pub fn c3b(r: u8, g: u8, b: u8) callconv(.Inline) void { sgl_c3b(r, g, b); } pub extern fn sgl_c4b(u8, u8, u8, u8) void; pub fn c4b(r: u8, g: u8, b: u8, a: u8) callconv(.Inline) void { sgl_c4b(r, g, b, a); } pub extern fn sgl_c1i(u32) void; pub fn c1i(rgba: u32) callconv(.Inline) void { sgl_c1i(rgba); } pub extern fn sgl_begin_points() void; pub fn beginPoints() callconv(.Inline) void { sgl_begin_points(); } pub extern fn sgl_begin_lines() void; pub fn beginLines() callconv(.Inline) void { sgl_begin_lines(); } pub extern fn sgl_begin_line_strip() void; pub fn beginLineStrip() callconv(.Inline) void { sgl_begin_line_strip(); } pub extern fn sgl_begin_triangles() void; pub fn beginTriangles() callconv(.Inline) void { sgl_begin_triangles(); } pub extern fn sgl_begin_triangle_strip() void; pub fn beginTriangleStrip() callconv(.Inline) void { sgl_begin_triangle_strip(); } pub extern fn sgl_begin_quads() void; pub fn beginQuads() callconv(.Inline) void { sgl_begin_quads(); } pub extern fn sgl_v2f(f32, f32) void; pub fn v2f(x: f32, y: f32) callconv(.Inline) void { sgl_v2f(x, y); } pub extern fn sgl_v3f(f32, f32, f32) void; pub fn v3f(x: f32, y: f32, z: f32) callconv(.Inline) void { sgl_v3f(x, y, z); } pub extern fn sgl_v2f_t2f(f32, f32, f32, f32) void; pub fn v2fT2f(x: f32, y: f32, u: f32, v: f32) callconv(.Inline) void { sgl_v2f_t2f(x, y, u, v); } pub extern fn sgl_v3f_t2f(f32, f32, f32, f32, f32) void; pub fn v3fT2f(x: f32, y: f32, z: f32, u: f32, v: f32) callconv(.Inline) void { sgl_v3f_t2f(x, y, z, u, v); } pub extern fn sgl_v2f_c3f(f32, f32, f32, f32, f32) void; pub fn v2fC3f(x: f32, y: f32, r: f32, g: f32, b: f32) callconv(.Inline) void { sgl_v2f_c3f(x, y, r, g, b); } pub extern fn sgl_v2f_c3b(f32, f32, u8, u8, u8) void; pub fn v2fC3b(x: f32, y: f32, r: u8, g: u8, b: u8) callconv(.Inline) void { sgl_v2f_c3b(x, y, r, g, b); } pub extern fn sgl_v2f_c4f(f32, f32, f32, f32, f32, f32) void; pub fn v2fC4f(x: f32, y: f32, r: f32, g: f32, b: f32, a: f32) callconv(.Inline) void { sgl_v2f_c4f(x, y, r, g, b, a); } pub extern fn sgl_v2f_c4b(f32, f32, u8, u8, u8, u8) void; pub fn v2fC4b(x: f32, y: f32, r: u8, g: u8, b: u8, a: u8) callconv(.Inline) void { sgl_v2f_c4b(x, y, r, g, b, a); } pub extern fn sgl_v2f_c1i(f32, f32, u32) void; pub fn v2fC1i(x: f32, y: f32, rgba: u32) callconv(.Inline) void { sgl_v2f_c1i(x, y, rgba); } pub extern fn sgl_v3f_c3f(f32, f32, f32, f32, f32, f32) void; pub fn v3fC3f(x: f32, y: f32, z: f32, r: f32, g: f32, b: f32) callconv(.Inline) void { sgl_v3f_c3f(x, y, z, r, g, b); } pub extern fn sgl_v3f_c3b(f32, f32, f32, u8, u8, u8) void; pub fn v3fC3b(x: f32, y: f32, z: f32, r: u8, g: u8, b: u8) callconv(.Inline) void { sgl_v3f_c3b(x, y, z, r, g, b); } pub extern fn sgl_v3f_c4f(f32, f32, f32, f32, f32, f32, f32) void; pub fn v3fC4f(x: f32, y: f32, z: f32, r: f32, g: f32, b: f32, a: f32) callconv(.Inline) void { sgl_v3f_c4f(x, y, z, r, g, b, a); } pub extern fn sgl_v3f_c4b(f32, f32, f32, u8, u8, u8, u8) void; pub fn v3fC4b(x: f32, y: f32, z: f32, r: u8, g: u8, b: u8, a: u8) callconv(.Inline) void { sgl_v3f_c4b(x, y, z, r, g, b, a); } pub extern fn sgl_v3f_c1i(f32, f32, f32, u32) void; pub fn v3fC1i(x: f32, y: f32, z: f32, rgba: u32) callconv(.Inline) void { sgl_v3f_c1i(x, y, z, rgba); } pub extern fn sgl_v2f_t2f_c3f(f32, f32, f32, f32, f32, f32, f32) void; pub fn v2fT2fC3f(x: f32, y: f32, u: f32, v: f32, r: f32, g: f32, b: f32) callconv(.Inline) void { sgl_v2f_t2f_c3f(x, y, u, v, r, g, b); } pub extern fn sgl_v2f_t2f_c3b(f32, f32, f32, f32, u8, u8, u8) void; pub fn v2fT2fC3b(x: f32, y: f32, u: f32, v: f32, r: u8, g: u8, b: u8) callconv(.Inline) void { sgl_v2f_t2f_c3b(x, y, u, v, r, g, b); } pub extern fn sgl_v2f_t2f_c4f(f32, f32, f32, f32, f32, f32, f32, f32) void; pub fn v2fT2fC4f(x: f32, y: f32, u: f32, v: f32, r: f32, g: f32, b: f32, a: f32) callconv(.Inline) void { sgl_v2f_t2f_c4f(x, y, u, v, r, g, b, a); } pub extern fn sgl_v2f_t2f_c4b(f32, f32, f32, f32, u8, u8, u8, u8) void; pub fn v2fT2fC4b(x: f32, y: f32, u: f32, v: f32, r: u8, g: u8, b: u8, a: u8) callconv(.Inline) void { sgl_v2f_t2f_c4b(x, y, u, v, r, g, b, a); } pub extern fn sgl_v2f_t2f_c1i(f32, f32, f32, f32, u32) void; pub fn v2fT2fC1i(x: f32, y: f32, u: f32, v: f32, rgba: u32) callconv(.Inline) void { sgl_v2f_t2f_c1i(x, y, u, v, rgba); } pub extern fn sgl_v3f_t2f_c3f(f32, f32, f32, f32, f32, f32, f32, f32) void; pub fn v3fT2fC3f(x: f32, y: f32, z: f32, u: f32, v: f32, r: f32, g: f32, b: f32) callconv(.Inline) void { sgl_v3f_t2f_c3f(x, y, z, u, v, r, g, b); } pub extern fn sgl_v3f_t2f_c3b(f32, f32, f32, f32, f32, u8, u8, u8) void; pub fn v3fT2fC3b(x: f32, y: f32, z: f32, u: f32, v: f32, r: u8, g: u8, b: u8) callconv(.Inline) void { sgl_v3f_t2f_c3b(x, y, z, u, v, r, g, b); } pub extern fn sgl_v3f_t2f_c4f(f32, f32, f32, f32, f32, f32, f32, f32, f32) void; pub fn v3fT2fC4f(x: f32, y: f32, z: f32, u: f32, v: f32, r: f32, g: f32, b: f32, a: f32) callconv(.Inline) void { sgl_v3f_t2f_c4f(x, y, z, u, v, r, g, b, a); } pub extern fn sgl_v3f_t2f_c4b(f32, f32, f32, f32, f32, u8, u8, u8, u8) void; pub fn v3fT2fC4b(x: f32, y: f32, z: f32, u: f32, v: f32, r: u8, g: u8, b: u8, a: u8) callconv(.Inline) void { sgl_v3f_t2f_c4b(x, y, z, u, v, r, g, b, a); } pub extern fn sgl_v3f_t2f_c1i(f32, f32, f32, f32, f32, u32) void; pub fn v3fT2fC1i(x: f32, y: f32, z: f32, u: f32, v: f32, rgba: u32) callconv(.Inline) void { sgl_v3f_t2f_c1i(x, y, z, u, v, rgba); } pub extern fn sgl_end() void; pub fn end() callconv(.Inline) void { sgl_end(); } pub extern fn sgl_draw() void; pub fn draw() callconv(.Inline) void { sgl_draw(); }
src/sokol/gl.zig
const std = @import("std"); const assert = std.debug.assert; const tigerbeetle_io_log = std.log.scoped(.@"tigerbeetle-io"); /// An intrusive first in/first out linked list. /// The element type T must have a field called "next" of type ?*T pub fn FIFO(comptime T: type) type { return struct { const Self = @This(); in: ?*T = null, out: ?*T = null, pub fn push(self: *Self, elem: *T) void { if (elem.next != null) { tigerbeetle_io_log.err("elem.next != null for elem=0x{x}", .{@ptrToInt(elem)}); } assert(elem.next == null); if (self.in) |in| { in.next = elem; self.in = elem; } else { assert(self.out == null); self.in = elem; self.out = elem; } } pub fn pop(self: *Self) ?*T { const ret = self.out orelse return null; self.out = ret.next; ret.next = null; if (self.in == ret) self.in = null; return ret; } pub fn peek(self: Self) ?*T { return self.out; } /// Remove an element from the FIFO if that the element is /// in the FIFO. Returns whether the element is found and removed or not. /// This operation is O(N), if this is done often you /// probably want a different data structure. pub fn remove(self: *Self, to_remove: *T) bool { if (to_remove == self.out) { _ = self.pop(); return true; } var it = self.out; while (it) |elem| : (it = elem.next) { if (to_remove == elem.next) { if (to_remove == self.in) self.in = elem; elem.next = to_remove.next; to_remove.next = null; return true; } } else return false; } }; } test "push/pop/peek/remove" { const testing = @import("std").testing; const Foo = struct { next: ?*@This() = null }; var one: Foo = .{}; var two: Foo = .{}; var three: Foo = .{}; var fifo: FIFO(Foo) = .{}; fifo.push(&one); try testing.expectEqual(@as(?*Foo, &one), fifo.peek()); fifo.push(&two); fifo.push(&three); try testing.expectEqual(@as(?*Foo, &one), fifo.peek()); try testing.expect(fifo.remove(&one)); try testing.expect(!fifo.remove(&one)); try testing.expectEqual(@as(?*Foo, &two), fifo.pop()); try testing.expectEqual(@as(?*Foo, &three), fifo.pop()); try testing.expectEqual(@as(?*Foo, null), fifo.pop()); fifo.push(&one); fifo.push(&two); fifo.push(&three); try testing.expect(fifo.remove(&two)); try testing.expectEqual(@as(?*Foo, &one), fifo.pop()); try testing.expectEqual(@as(?*Foo, &three), fifo.pop()); try testing.expectEqual(@as(?*Foo, null), fifo.pop()); fifo.push(&one); fifo.push(&two); fifo.push(&three); try testing.expect(fifo.remove(&three)); try testing.expectEqual(@as(?*Foo, &one), fifo.pop()); try testing.expectEqual(@as(?*Foo, &two), fifo.pop()); try testing.expectEqual(@as(?*Foo, null), fifo.pop()); fifo.push(&one); fifo.push(&two); try testing.expect(fifo.remove(&two)); fifo.push(&three); try testing.expectEqual(@as(?*Foo, &one), fifo.pop()); try testing.expectEqual(@as(?*Foo, &three), fifo.pop()); try testing.expectEqual(@as(?*Foo, null), fifo.pop()); }
src/fifo.zig
const std = @import("std"); const ig = @import("imgui"); const zt = @import("zt"); const sling = @import("sling.zig"); pub const ObjectType = enum { Collection, Singleton, }; pub const Clearance = enum { editorOnly, gameOnly, both, }; pub const Information = struct { var pointerToId = std.StringHashMap(usize).init(sling.alloc); var registeredObjects = std.ArrayList(*const Information).init(sling.alloc); name: []const u8, create: fn (*sling.Scene) *Interface, createSingleton: fn (*sling.Scene) *Interface, createFrom: fn (*sling.serializer.Node, *sling.Scene) *Interface, createSingletonFrom: fn (*sling.serializer.Node, *sling.Scene) *Interface, pub fn register(info: *const Information) void { var id = registeredObjects.items.len; registeredObjects.append(info) catch { std.debug.panic("Failed to register object information: {any}", .{info}); }; pointerToId.put(info.name, id) catch { std.debug.panic("Failed to register object information index: {any} at {any}", .{ info, id }); }; } pub fn get(id: usize) *const Information { return registeredObjects.items[id]; } pub fn getType(comptime T: type) *const Information { if (pointerToId.get(@typeName(T))) |id| { return registeredObjects.items[id]; } else { std.debug.panic("Attempted to get type that is not registered.", .{}); unreachable; } } pub fn indexOf(comptime T: type) usize { if (pointerToId.get(@typeName(T))) |id| { return id; } else { std.debug.panic("Attempted to get type that is not registered.", .{}); unreachable; } } pub fn slice() []const *const Information { return registeredObjects.items; } }; pub const Interface = struct { /// The sole source of allocation in an object group. arena: std.heap.ArenaAllocator = undefined, /// Basic information on the object in question, including a method to create /// a heap allocated instance of the object. information: *const Information, data: DataUnion, serialize: fn (*Interface, *sling.serializer.Tree) *sling.serializer.Node, update: fn (*Interface) void, deinitAll: fn (*Interface) void, pub const DataUnion = union(ObjectType) { Collection: Collection, Singleton: Singleton, }; pub const Collection = struct { /// Emits imgui calls to edit a specific indexed object. editor: fn (*Interface, usize) void, /// Queues an entity index for deletion at the end of the current iteration. remove: fn (*Interface, usize) void, /// Creates a new object inside of the container append: fn (*Interface) void, /// Gets the amount of objects getCount: fn (*Interface) usize, /// The objects inside can be represented by non-generic text, this gets those names. getName: fn (*Interface, usize) []const u8, /// Copies all the data from the first index into the second. copyFromTo: fn (*Interface, usize, usize) void, }; pub const Singleton = struct { editor: fn (*Interface) void, getName: fn (*Interface) []const u8, }; }; pub fn GenBuildData(comptime T: type) type { return struct { pub const information = Information{ .name = @typeName(T), .create = CollectionType(T).objInformation_create, .createSingleton = SingletonType(T).objInformation_create, .createFrom = CollectionType(T).objInformation_createFrom, .createSingletonFrom = SingletonType(T).objInformation_createFrom, }; pub var Instance: ?@This() = null; const FnWrap = struct { func: []const u8, clearance: Clearance, fn init(func: []const u8, clearance: Clearance) FnWrap { return .{ .func = func, .clearance = clearance }; } fn canRun(self: FnWrap) bool { if (sling.inEditor) { return self.clearance == .editorOnly or self.clearance == .both; } else { return self.clearance == .gameOnly or self.clearance == .both; } } fn updateSingular(self: FnWrap, target: *T, scene: *sling.Scene) void { if (self.canRun()) { inline for (std.meta.declarations(T)) |declField| { if (declField.is_pub) { const fnTypeInfo = @typeInfo(@TypeOf(@field(T, declField.name))); if (fnTypeInfo == .Fn and fnTypeInfo.Fn.args.len > 0) { var name: []const u8 = declField.name; if (std.mem.eql(u8, name, self.func)) { const feed = ArgType(fnTypeInfo); var paramList: feed = undefined; inline for (fnTypeInfo.Fn.args) |fnArg, i| { if (fnArg.arg_type) |parameter| { switch (parameter) { *sling.Scene => { paramList[i] = scene; }, *T => { paramList[i] = target; }, usize => { paramList[i] = 0; }, else => {}, } } else { @compileError("Typeless parameter?"); } } const func = @field(T, declField.name); const site = std.builtin.CallOptions{}; _ = @call(site, func, paramList); return; } } } } } } fn updateArray(self: FnWrap, target: []T, scene: *sling.Scene) void { if (self.canRun()) { inline for (std.meta.declarations(T)) |declField| { if (declField.is_pub) { const fnTypeInfo = @typeInfo(@TypeOf(@field(T, declField.name))); if (fnTypeInfo == .Fn and fnTypeInfo.Fn.args.len > 0) { var name: []const u8 = declField.name; if (std.mem.eql(u8, name, self.func)) { const feed = ArgType(fnTypeInfo); var paramList: feed = undefined; comptime var targetIndex: ?usize = null; comptime var indexIndex: ?usize = null; inline for (fnTypeInfo.Fn.args) |fnArg, i| { if (fnArg.arg_type) |parameter| { switch (parameter) { *sling.Scene => { paramList[i] = scene; }, *T => { targetIndex = i; }, usize => { indexIndex = i; }, else => {}, } } else { @compileError("Typeless parameter?"); } } const func = @field(T, declField.name); for (target) |*targetValue, j| { if (targetIndex) |idx| { paramList[idx] = targetValue; } if (indexIndex) |idx| { paramList[idx] = j; } const site = std.builtin.CallOptions{}; _ = @call(site, func, paramList); } return; } } } } } } }; allocator: *std.mem.Allocator, _hidden: std.StringHashMap(void), _init: std.ArrayList(FnWrap), _deinitFn: std.ArrayList(FnWrap), _update: std.ArrayList(FnWrap), _getName: ?fn (*T) []const u8, _editorExtension: ?FnWrap, fn initBuildData(allocator: *std.mem.Allocator) @This() { return .{ .allocator = allocator, ._hidden = std.StringHashMap(void).init(allocator), ._init = std.ArrayList(FnWrap).init(allocator), ._deinitFn = std.ArrayList(FnWrap).init(allocator), ._update = std.ArrayList(FnWrap).init(allocator), ._getName = null, ._editorExtension = null, }; } pub fn deinit(self: *@This()) void { self._hidden.deinit(); self._deinitFn.deinit(); self._init.deinit(); self._update.deinit(); } pub fn hide(self: *@This(), comptime field: std.meta.FieldEnum(T)) void { self._hidden.put(@tagName(field), {}) catch |err| { std.debug.panic("Failed to ignore field '{s}' from type '{s}' due to:\n{s}", .{ @tagName(field), @typeName(T), @errorName(err) }); }; } pub fn ignore(self: *@This(), comptime field: std.meta.FieldEnum(T)) void { _ = self; sling.preferredSerializationConfig.ignore(T, @tagName(field)); } pub fn initMethod(self: *@This(), comptime method: sling.util.DeclEnum(T), comptime clearance: Clearance) void { self._init.append(FnWrap.init(@tagName(method), clearance)) catch |err| { std.debug.panic("Failed to add init system '{s}' to type '{s}' due to:\n{s}", .{ @tagName(method), @typeName(T), @errorName(err) }); }; } pub fn deinitMethod(self: *@This(), comptime method: sling.util.DeclEnum(T), comptime clearance: Clearance) void { self._deinitFn.append(FnWrap.init(@tagName(method), clearance)) catch |err| { std.debug.panic("Failed to add init system '{s}' to type '{s}' due to:\n{s}", .{ @tagName(method), @typeName(T), @errorName(err) }); }; } pub fn nameMethod(self: *@This(), comptime method: sling.util.DeclEnum(T)) void { self._getName = @field(T, @tagName(method)); } pub fn updateMethod(self: *@This(), comptime method: sling.util.DeclEnum(T), comptime clearance: Clearance) void { self._update.append(FnWrap.init(@tagName(method), clearance)) catch |err| { std.debug.panic("Failed to add update system '{s}' to type '{s}' due to:\n{s}", .{ @tagName(method), @typeName(T), @errorName(err) }); }; } pub fn editorExtension(self: *@This(), comptime method: sling.util.DeclEnum(T)) void { self._editorExtension = FnWrap.init(@tagName(method), .editorOnly); } pub fn register() *@This() { if (Instance == null) { Information.register(&GenBuildData(T).information); // Register the type in sling Instance = initBuildData(sling.alloc); std.debug.print("Registering new type: {s}\n", .{@typeName(T)}); } return &Instance.?; } }; } fn ArgType(comptime Fn: std.builtin.TypeInfo) type { if (Fn != .Fn) { @compileError(std.fmt.comptimePrint("Type '{any}' doesnt fit the format for a method call.", .{Fn})); } return comptime blk: { var fields: [Fn.Fn.args.len]std.builtin.TypeInfo.StructField = undefined; for (fields) |*f, idx| { var num_buf: [128]u8 = undefined; f.* = .{ .name = std.fmt.bufPrint(&num_buf, "{}", .{idx}) catch unreachable, .field_type = Fn.Fn.args[idx].arg_type.?, .default_value = @as(?(Fn.Fn.args[idx].arg_type.?), null), .is_comptime = false, .alignment = @alignOf(Fn.Fn.args[idx].arg_type.?), }; } break :blk @Type(.{ .Struct = .{ .layout = .Auto, .fields = &fields, .decls = &[0]std.builtin.TypeInfo.Declaration{}, .is_tuple = true, }, }); }; } pub fn CollectionType(comptime T: type) type { return struct { const Self = @This(); parent: *sling.Scene = undefined, interface: Interface = undefined, value: []T = undefined, inline fn getSelf(data: *Interface) *Self { return @fieldParentPtr(Self, "interface", data); } // ===== // Information interface impl // ===== fn objInformation_create(scene: *sling.Scene) *Interface { var build = GenBuildData(T).register(); var instance: *Self = build.allocator.create(Self) catch unreachable; instance.interface = .{ .arena = std.heap.ArenaAllocator.init(build.allocator), .information = &GenBuildData(T).information, .serialize = Self.interface_serialize, .update = Self.interface_update, .deinitAll = Self.interface_deinitAll, .data = .{ .Collection = .{ .editor = Self.interface_editor, .remove = Self.interface_remove, .append = Self.interface_append, .getCount = Self.interface_getCount, .getName = Self.interface_getName, .copyFromTo = Self.interface_copyFromTo, } } }; instance.parent = scene; instance.value = instance.interface.arena.allocator.alloc(T, 0) catch |err| { std.debug.panic("Failed to alloc initial values for {s} due to:\n{s}", .{ GenBuildData(T).information.name, @errorName(err) }); }; return &instance.interface; } fn objInformation_createFrom(node: *sling.serializer.Node, scene: *sling.Scene) *Interface { var build = GenBuildData(T).register(); var instance: *Self = build.allocator.create(Self) catch |err| { std.debug.panic("Failed to allocate type {s} with error:\n{s}", .{ @typeName(Self), @errorName(err) }); }; instance.interface = .{ .arena = std.heap.ArenaAllocator.init(build.allocator), .information = &GenBuildData(T).information, .serialize = Self.interface_serialize, .update = Self.interface_update, .deinitAll = Self.interface_deinitAll, .data = .{ .Collection = .{ .editor = Self.interface_editor, .remove = Self.interface_remove, .append = Self.interface_append, .getCount = Self.interface_getCount, .getName = Self.interface_getName, .copyFromTo = Self.interface_copyFromTo, } } }; instance.parent = scene; node.into(&instance.value, &instance.interface.arena.allocator); for (build._init.items) |wrapper| { wrapper.updateArray(instance.value, instance.parent); } return &instance.interface; } // ===== // Interface interface impl // ===== fn interface_editor(object: *Interface, index: usize) void { var build = GenBuildData(T).register(); var self: *Self = getSelf(object); inline for (std.meta.fields(T)) |fieldInfo| { if (!build._hidden.contains(fieldInfo.name) and !sling.preferredSerializationConfig.ignores(T, fieldInfo.name)) { var fieldRef = &@field(self.value[index], fieldInfo.name); _ = sling.util.igEdit(fieldInfo.name, fieldRef); } } if (build._editorExtension) |extension| { extension.updateSingular(&self.value[index], self.parent); } } fn interface_serialize(object: *Interface, tree: *sling.serializer.Tree) *sling.serializer.Node { var self: *Self = getSelf(object); return tree.toNode(self.value); } fn interface_update(object: *Interface) void { var build = GenBuildData(T).register(); var self: *Self = getSelf(object); for (build._update.items) |wrapper| { wrapper.updateArray(self.value, self.parent); } } fn interface_append(object: *Interface) void { var build = GenBuildData(T).register(); var self: *Self = getSelf(object); self.value = self.interface.arena.allocator.realloc(self.value, self.value.len + 1) catch { std.debug.panic("Failed to realloc internal object array of size {any}", .{self.value.len}); }; self.value[self.value.len - 1] = .{}; for (build._init.items) |wrapper| { wrapper.updateSingular(&self.value[self.value.len - 1], self.parent); } } fn interface_deinitAll(object: *Interface) void { var self: *Self = getSelf(object); var build = GenBuildData(T).register(); for (build._deinitFn.items) |wrapper| { wrapper.updateArray(self.value, self.parent); } } fn interface_remove(object: *Interface, index: usize) void { var self: *Self = getSelf(object); var build = GenBuildData(T).register(); for (build._deinitFn.items) |wrapper| { wrapper.updateArray(self.value, self.parent); } self.value[index] = self.value[self.value.len - 1]; self.value = self.interface.arena.allocator.realloc(self.value, self.value.len - 1) catch { std.debug.panic("Failed to realloc internal object array of size {any}", .{self.value.len}); }; } fn interface_getCount(object: *Interface) usize { var self: *Self = getSelf(object); return self.value.len; } fn interface_getName(object: *Interface, index: usize) []const u8 { var self: *Self = getSelf(object); var build = GenBuildData(T).register(); if (build._getName) |gn| { return gn(&self.value[index]); } else { return zt.custom_components.fmtTextForImgui("{s}#{any}", .{ GenBuildData(T).information.name, index }); } } fn interface_copyFromTo(object: *Interface, index: usize, destination: usize) void { var self: *Self = getSelf(object); self.value[destination] = self.value[index]; } }; } pub fn SingletonType(comptime T: type) type { return struct { const Self = @This(); parent: *sling.Scene = undefined, interface: Interface = undefined, value: T = undefined, inline fn getSelf(data: *Interface) *Self { return @fieldParentPtr(Self, "interface", data); } // ===== // Information interface impl // ===== fn objInformation_create(scene: *sling.Scene) *Interface { var build = GenBuildData(T).register(); var instance: *Self = build.allocator.create(Self) catch unreachable; instance.interface = .{ .arena = std.heap.ArenaAllocator.init(build.allocator), .information = &GenBuildData(T).information, .serialize = Self.interface_serialize, .update = Self.interface_update, .deinitAll = Self.interface_deinitAll, .data = .{ .Singleton = .{ .editor = Self.interface_editor, .getName = Self.interface_getName } } }; instance.parent = scene; instance.value = .{}; for (build._init.items) |wrapper| { wrapper.updateSingular(&instance.value, instance.parent); } return &instance.interface; } fn objInformation_createFrom(node: *sling.serializer.Node, scene: *sling.Scene) *Interface { var build = GenBuildData(T).register(); var instance: *Self = build.allocator.create(Self) catch |err| { std.debug.panic("Failed to allocate type {s} with error:\n{s}", .{ @typeName(Self), @errorName(err) }); }; instance.interface = .{ .arena = std.heap.ArenaAllocator.init(build.allocator), .information = &GenBuildData(T).information, .serialize = Self.interface_serialize, .update = Self.interface_update, .deinitAll = Self.interface_deinitAll, .data = .{ .Singleton = .{ .editor = Self.interface_editor, .getName = Self.interface_getName } } }; instance.parent = scene; node.into(&instance.value, &instance.interface.arena.allocator); for (build._init.items) |wrapper| { wrapper.updateSingular(&instance.value, instance.parent); } return &instance.interface; } // ===== // Interface interface impl // ===== fn interface_editor(object: *Interface) void { var build = GenBuildData(T).register(); var self: *Self = getSelf(object); inline for (std.meta.fields(T)) |fieldInfo| { if (!build._hidden.contains(fieldInfo.name) and !sling.preferredSerializationConfig.ignores(T, fieldInfo.name)) { var fieldRef = &@field(self.value, fieldInfo.name); _ = sling.util.igEdit(fieldInfo.name, fieldRef); } } if (build._editorExtension) |extension| { extension.updateSingular(&self.value, self.parent); } } fn interface_serialize(object: *Interface, tree: *sling.serializer.Tree) *sling.serializer.Node { var self: *Self = getSelf(object); return tree.toNode(self.value); } fn interface_deinitAll(object: *Interface) void { var self: *Self = getSelf(object); var build = GenBuildData(T).register(); for (build._deinitFn.items) |wrapper| { wrapper.updateSingular(&self.value, self.parent); } } fn interface_update(object: *Interface) void { var build = GenBuildData(T).register(); var self: *Self = getSelf(object); for (build._update.items) |wrapper| { wrapper.updateSingular(&self.value, self.parent); } } fn interface_getName(object: *Interface) []const u8 { _ = object; return @typeName(T); } }; }
src/object.zig
const std = @import("std"); const ops = @import("ops.zig"); pub const BytecodePrimitive = enum { byte, char, short, int, long, float, double, reference, pub fn fromShorthand(shorthand: u8) BytecodePrimitive { return switch (shorthand) { 'a' => .reference, 'd' => .double, 'f' => .float, 'i' => .int, 'l' => .long, 's' => .short, 'b' => .byte, else => @panic("No shorthand!"), }; } pub fn toShorthand(self: BytecodePrimitive) u8 { return switch (self) { .reference => 'a', .double => 'd', .float => 'f', .int => 'i', .long => 'l', .short => 's', .byte => 'b', else => @panic("No shorthand!"), }; } pub fn toType(self: BytecodePrimitive) type { return std.meta.TagPayload(BytecodePrimitiveValue, self); } }; pub const BytecodePrimitiveValue = union(BytecodePrimitive) { byte: i8, char: u16, short: i16, int: i32, long: i64, float: f32, double: f64, reference: ?usize, }; pub const WrappedOperation = union(enum) { nop: NoOperation, push_constant: PushConstantOperation, load_constant: LoadConstantOperation, store_local: StoreLocalOperation, load_local: LoadLocalOperation, numerical: NumericalOperation, increment: IncrementOperation, convert: ConvertOperation, @"return": ReturnOperation, pub fn wrap(op: ops.Operation) WrappedOperation { @setEvalBranchQuota(10000); inline for (std.meta.fields(ops.Operation)) |operation_field| { comptime var opcode = @field(ops.Opcode, operation_field.name); if (std.meta.activeTag(op) == opcode) { inline for (std.meta.fields(WrappedOperation)) |wo_field| { if (comptime wo_field.field_type.matches(opcode, operation_field)) { return @unionInit(WrappedOperation, wo_field.name, wo_field.field_type.wrap(op, opcode, operation_field)); } } @panic("Not implemented: " ++ operation_field.name); } } unreachable; } // TODO: Implement pub fn unwrap(self: WrappedOperation) ops.Operation { return self; } }; pub const NoOperation = struct { fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = operation_field; return opcode == .nop; } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) NoOperation { _ = op; _ = opcode; _ = operation_field; return .{}; } }; test "Wrapped: No Operation" { var nop = ops.Operation{ .nop = {} }; var nop_wrapped = WrappedOperation.wrap(nop); try std.testing.expect(nop_wrapped == .nop); } pub const PushConstantOperation = union(enum) { null_ref, /// Int as a byte or short, thus an i16 rather than an i32 int: i16, long: u1, float: u2, double: u1, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = operation_field; return @enumToInt(opcode) >= 0x01 and @enumToInt(opcode) <= 0x11; } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) PushConstantOperation { _ = operation_field; return switch (opcode) { .aconst_null => .null_ref, .iconst_m1 => .{ .int = -1 }, .iconst_0 => .{ .int = 0 }, .iconst_1 => .{ .int = 1 }, .iconst_2 => .{ .int = 2 }, .iconst_3 => .{ .int = 3 }, .iconst_4 => .{ .int = 4 }, .iconst_5 => .{ .int = 5 }, .lconst_0 => .{ .long = 0 }, .lconst_1 => .{ .long = 1 }, .fconst_0 => .{ .float = 0 }, .fconst_1 => .{ .float = 1 }, .fconst_2 => .{ .float = 2 }, .dconst_0 => .{ .double = 0 }, .dconst_1 => .{ .double = 1 }, .bipush => .{ .int = op.bipush }, .sipush => .{ .int = op.sipush }, else => unreachable, }; } }; test "Wrapped: Push Constant" { var null_ref_op = ops.Operation{ .aconst_null = {} }; var null_ref_wrapped = WrappedOperation.wrap(null_ref_op); try std.testing.expect(null_ref_wrapped.push_constant == .null_ref); var m1_op = ops.Operation{ .iconst_m1 = {} }; var m1_wrapped = WrappedOperation.wrap(m1_op); try std.testing.expectEqual(@as(i16, -1), m1_wrapped.push_constant.int); var bipush_op = ops.Operation{ .bipush = 17 }; var bipush_wrapped = WrappedOperation.wrap(bipush_op); try std.testing.expectEqual(@as(i16, 17), bipush_wrapped.push_constant.int); } pub const ConstantSize = enum { /// Everything else one, /// Floats and doubles two, }; pub const LoadConstantOperation = struct { size: ConstantSize, index: u16, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = operation_field; return opcode == .ldc or opcode == .ldc_w or opcode == .ldc2_w; } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) LoadConstantOperation { _ = opcode; _ = operation_field; return .{ .size = switch (op) { .ldc, .ldc_w => .one, .ldc2_w => .two, else => unreachable, }, .index = switch (op) { .ldc => |b| b, .ldc_w => |b| b, .ldc2_w => |b| b, else => unreachable, }, }; } }; test "Wrapped: Load From Constant Pool" { var ldc_op = ops.Operation{ .ldc = 7 }; var ldc_wrapped = WrappedOperation.wrap(ldc_op); try std.testing.expectEqual(ConstantSize.one, ldc_wrapped.load_constant.size); try std.testing.expectEqual(@as(u16, 7), ldc_wrapped.load_constant.index); var ldc2_op = ops.Operation{ .ldc2_w = 7 }; var ldc2_wrapped = WrappedOperation.wrap(ldc2_op); try std.testing.expectEqual(ConstantSize.two, ldc2_wrapped.load_constant.size); try std.testing.expectEqual(@as(u16, 7), ldc2_wrapped.load_constant.index); } pub const StoreLocalOperation = struct { kind: BytecodePrimitive, index: u16, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = opcode; return operation_field.name.len >= "astore".len and std.mem.eql(u8, operation_field.name[1 .. 1 + "store".len], "store"); } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) StoreLocalOperation { _ = opcode; return .{ .kind = BytecodePrimitive.fromShorthand(operation_field.name[0]), .index = if (operation_field.name.len == "astore".len) @field(op, operation_field.name) else comptime std.fmt.parseInt(u16, operation_field.name["astore_".len..], 10) catch unreachable, }; } }; test "Wrapped: Store" { var istore_1_op = ops.Operation{ .istore_1 = {} }; var istore_1_wrapped = WrappedOperation.wrap(istore_1_op); try std.testing.expectEqual(BytecodePrimitive.int, istore_1_wrapped.store_local.kind); try std.testing.expectEqual(@as(u16, 1), istore_1_wrapped.store_local.index); var istore_n_op = ops.Operation{ .istore = 12 }; var istore_n_wrapped = WrappedOperation.wrap(istore_n_op); try std.testing.expectEqual(BytecodePrimitive.int, istore_n_wrapped.store_local.kind); try std.testing.expectEqual(@as(u16, 12), istore_n_wrapped.store_local.index); } pub const LoadLocalOperation = struct { kind: BytecodePrimitive, index: u16, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = opcode; return operation_field.name.len >= "aload".len and std.mem.eql(u8, operation_field.name[1 .. 1 + "load".len], "load"); } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) LoadLocalOperation { _ = opcode; return .{ .kind = BytecodePrimitive.fromShorthand(operation_field.name[0]), .index = if (operation_field.name.len == "aload".len) @field(op, operation_field.name) else comptime std.fmt.parseInt(u16, operation_field.name["aload_".len..], 10) catch unreachable, }; } }; test "Wrapped: Load" { var iload_1_op = ops.Operation{ .iload_1 = {} }; var iload_1_wrapped = WrappedOperation.wrap(iload_1_op); try std.testing.expectEqual(BytecodePrimitive.int, iload_1_wrapped.load_local.kind); try std.testing.expectEqual(@as(u16, 1), iload_1_wrapped.load_local.index); var iload_n_op = ops.Operation{ .iload = 12 }; var iload_n_wrapped = WrappedOperation.wrap(iload_n_op); try std.testing.expectEqual(BytecodePrimitive.int, iload_n_wrapped.load_local.kind); try std.testing.expectEqual(@as(u16, 12), iload_n_wrapped.load_local.index); } pub const NumericalOperator = enum { add, sub, mul, div, rem, neg, }; pub const NumericalOperation = struct { /// Guaranteed to be a numerical type (int, long, float, double) kind: BytecodePrimitive, operator: NumericalOperator, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = operation_field; return @enumToInt(opcode) >= 0x60 and @enumToInt(opcode) <= 0x77; } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) NumericalOperation { _ = op; _ = opcode; return .{ .kind = BytecodePrimitive.fromShorthand(operation_field.name[0]), .operator = std.enums.nameCast(NumericalOperator, operation_field.name[1..]), }; } }; test "Wrapped: Numerical" { var add_op = ops.Operation{ .iadd = .{} }; var add_wrapped = WrappedOperation.wrap(add_op); try std.testing.expectEqual(BytecodePrimitive.int, add_wrapped.numerical.kind); try std.testing.expectEqual(NumericalOperator.add, add_wrapped.numerical.operator); } pub const IncrementOperation = struct { index: u16, by: i16, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = operation_field; return opcode == .iinc; } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) IncrementOperation { _ = opcode; _ = operation_field; return .{ .index = op.iinc.index, .by = op.iinc.@"const", }; } }; pub const ConvertOperation = struct { from: BytecodePrimitive, to: BytecodePrimitive, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = operation_field; return @enumToInt(opcode) >= 0x85 and @enumToInt(opcode) <= 0x93; } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) ConvertOperation { _ = op; _ = opcode; return .{ .from = BytecodePrimitive.fromShorthand(operation_field.name[0]), .to = BytecodePrimitive.fromShorthand(operation_field.name[2]), }; } }; test "Wrapped: Convert" { var i2b_op = ops.Operation{ .i2b = {} }; var i2b_wrapped = WrappedOperation.wrap(i2b_op); try std.testing.expect(i2b_wrapped == .convert); try std.testing.expectEqual(BytecodePrimitive.int, i2b_wrapped.convert.from); try std.testing.expectEqual(BytecodePrimitive.byte, i2b_wrapped.convert.to); var i2l_op = ops.Operation{ .i2l = {} }; var i2l_wrapped = WrappedOperation.wrap(i2l_op); try std.testing.expect(i2l_wrapped == .convert); try std.testing.expectEqual(BytecodePrimitive.int, i2l_wrapped.convert.from); try std.testing.expectEqual(BytecodePrimitive.long, i2l_wrapped.convert.to); } pub const ReturnOperation = struct { kind: ?BytecodePrimitive, fn matches(comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) bool { _ = operation_field; return @enumToInt(opcode) >= 0xac and @enumToInt(opcode) <= 0xb1; } fn wrap(op: ops.Operation, comptime opcode: ops.Opcode, comptime operation_field: std.builtin.TypeInfo.UnionField) ReturnOperation { _ = op; _ = opcode; return .{ .kind = if (operation_field.name[0] == 'r') null else BytecodePrimitive.fromShorthand(operation_field.name[0]), }; } }; test "Wrapped: Return" { var return_op = ops.Operation{ .@"return" = {} }; var return_wrapped = WrappedOperation.wrap(return_op); try std.testing.expectEqual(@as(?BytecodePrimitive, null), return_wrapped.@"return".kind); var areturn_op = ops.Operation{ .areturn = {} }; var areturn_wrapped = WrappedOperation.wrap(areturn_op); try std.testing.expectEqual(BytecodePrimitive.reference, areturn_wrapped.@"return".kind.?); }
src/bytecode/wrapped.zig
const builtin = @import("builtin"); const std = @import("std"); const ascii = std.ascii; const fs = std.fs; const log = std.log; const mem = std.mem; const os = std.os; const process = std.process; const unicode = std.unicode; const testing = std.testing; const stdout = std.io.getStdOut(); const stderr = std.io.getStdErr(); const usage: []const u8 = \\ [mode] [options] path1 [path2 ..] \\ mode: \\ 1. cli mode for visual inspection (default cap to 30 lines) \\ 2. -c check if good (return status 0 or bad with status 1) \\ 3. -outfile file write output to file instead to stdout \\ options: \\ -a ascii mode for performance (default is utf8 mode) \\ \\ Shells may not show control characters correctly or misbehave, \\ so they are only written (with exception of \n occurence) to files. \\ '0x00' (0) is not representable. \\ UTF-8 is only checked to contain valid codepoints. ; fn fatal(comptime format: []const u8, args: anytype) noreturn { log.err(format, args); process.exit(1); } const CheckError = error{ ControlCharacter, Antipattern, NonPortable, }; // POSIX portable file name character set fn isCharPosixPortable(char: u8) bool { switch (char) { 0x30...0x39, 0x41...0x5A, 0x61...0x7A, 0x2D, 0x2E, 0x5F => return true, // 0-9, a-z, A-Z, 2D `-`, 2E `.`, 5F `_` else => return false, } } // assume: len(word) > 0 fn isWordSanePosixPortable(word: []const u8) bool { if (word[0] == '-') return false; for (word) |char| { if (isCharPosixPortable(char) == false) return false; } return true; } // assume: len(word) > 0 // assume: word described by /word/word/ and / not part of word fn isWordOkAscii(word: []const u8) bool { var visited_space: bool = false; switch (word[0]) { '~', '-', ' ' => return false, // leading tilde,dash,empty space else => {}, } for (word) |char| { switch (char) { 0...31 => return false, // Cntrl (includes '\n', '\r', '\t') ',', '`' => return false, '-', '~' => { if (visited_space) return false; visited_space = false; }, // antipattern ' ' => { visited_space = true; }, 127 => return false, // Cntrl else => { visited_space = false; }, } } if (visited_space) return false; // ending empty space return true; } const StatusOkAsciiExt = enum { Ok, Antipattern, CntrlChar, Newline, }; // assume: path.len > 0 fn isWordOkAsciiExtended(word: []const u8) StatusOkAsciiExt { var status: StatusOkAsciiExt = StatusOkAsciiExt.Ok; var visited_space: bool = false; switch (word[0]) { '~', '-', ' ' => { status = StatusOkAsciiExt.Antipattern; }, // leading tilde,dash,empty space else => {}, } for (word) |char| { switch (char) { 0...9 => { status = StatusOkAsciiExt.CntrlChar; }, // Cntrl (includes '\n', '\r', '\t') 10 => { return StatusOkAsciiExt.Newline; }, // Line Feed '\n' 11...31 => { status = StatusOkAsciiExt.CntrlChar; }, // Cntrl (includes '\n', '\r', '\t') ',', '`' => { if (status != StatusOkAsciiExt.CntrlChar) status = StatusOkAsciiExt.Antipattern; }, // antipattern '-', '~' => { if (visited_space and status != StatusOkAsciiExt.CntrlChar) status = StatusOkAsciiExt.Antipattern; }, // antipattern ' ' => { visited_space = true; }, 127 => { status = StatusOkAsciiExt.CntrlChar; }, // Cntrl else => { visited_space = false; }, } } if (visited_space and status != StatusOkAsciiExt.CntrlChar) { return StatusOkAsciiExt.Antipattern; } // ending empty space return status; } inline fn skipItIfWindows(it: *mem.TokenIterator(u8)) void { const native_os = builtin.target.os.tag; switch (native_os) { .windows => { if (0x61 <= it.buffer[0] and it.buffer[0] <= 0x7A // A-Z and it.buffer[1] == ':') { it.next(); } }, else => {}, } } const Encoding = enum { Ascii, Utf8, }; // returns success or failure of the check // assume: correct cwd and args are given fn checkOnly(comptime enc: Encoding, arena: mem.Allocator, args: [][:0]u8) !u8 { var i: u64 = 1; // skip program name while (i < args.len) : (i += 1) { if (enc == Encoding.Ascii) { if (mem.eql(u8, args[i], "-a")) continue; // skip -a } if (mem.eql(u8, args[i], "-c")) // skip -c continue; const root_path = args[i]; var it = mem.tokenize(u8, root_path, &[_]u8{fs.path.sep}); skipItIfWindows(&it); while (it.next()) |entry| { std.debug.assert(entry.len > 0); switch (enc) { Encoding.Ascii => { if (!isWordOkAscii(entry)) return 1; }, Encoding.Utf8 => { if (!isWordOk(entry)) return 1; }, } } var root_dir = try fs.cwd().openDir(root_path, .{ .iterate = true, .no_follow = true }); defer root_dir.close(); var walker = try root_dir.walk(arena); defer walker.deinit(); while (try walker.next()) |entry| { const basename = entry.basename; std.debug.assert(basename.len > 0); switch (enc) { Encoding.Ascii => { if (!isWordOkAscii(basename)) return 1; }, Encoding.Utf8 => { if (!isWordOk(basename)) return 1; }, } } } return 0; } // assume: len(word) > 0 // assume: path described by /word/word/ and / not part of word fn isWordOk(word: []const u8) bool { var visited_space: bool = false; switch (word[0]) { '~', '-', ' ' => return false, // leading tilde,dash,empty space else => {}, } var utf8 = (unicode.Utf8View.init(word) catch { return false; }).iterator(); // TODO do \ escaped characters (some OSes disallow them) // TODO Is 1 switch prong in a padded variable faster? while (utf8.nextCodepointSlice()) |codepoint| { switch (codepoint.len) { 0 => unreachable, 1 => { const char = codepoint[0]; // U+0000...U+007F switch (char) { // perf: how does this get lowered? 0...31 => return false, // Cntrl (includes '\n', '\r', '\t') ',', '`' => return false, '-', '~' => { if (visited_space) return false; visited_space = false; }, // antipattern ' ' => { visited_space = true; // TODO FIX THIS! }, 127 => return false, // Cntrl else => { visited_space = false; }, } }, 2 => { const char = mem.bytesAsValue(u16, codepoint[0..2]); // U+0080...U+07FF switch (char.*) { 128...159 => return false, // Cntrl (includes next line 0x85) 160 => return false, // disallowed space: no-break space 173 => return false, // soft hyphen else => { visited_space = false; }, } }, 3 => { const char = mem.bytesAsValue(u24, codepoint[0..4]); // U+0800...U+FFFF switch (char.*) { // disallowed spaces, see README.md 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004 => return false, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x200b => return false, 0x200c, 0x200d, 0x2028, 0x2029, 0x202f, 0x205f, 0x2060 => return false, 0x3000, 0xfeff => return false, else => { visited_space = false; }, } }, 4 => { visited_space = false; // U+10000...U+10FFFF }, else => unreachable, } //std.debug.print("got codepoint {s}\n", .{codepoint}); } if (visited_space) return false; // ending empty space return true; } const StatusOkExt = enum { Ok, Antipattern, CntrlChar, Newline, InvalUnicode, }; // return codes: 0 ok, 1 antipattern, 2 cntrl, 3 newline, 4 invalid unicode // assume: len(word) > 0 // assume: path described by /word/word/ and / not part of word fn isWordOkExtended(word: []const u8) StatusOkExt { var status: StatusOkExt = StatusOkExt.Ok; var visited_space: bool = false; switch (word[0]) { '~', '-', ' ' => { status = StatusOkExt.Antipattern; }, // leading tilde,dash,empty space else => {}, } var utf8 = (unicode.Utf8View.init(word) catch { return StatusOkExt.InvalUnicode; }).iterator(); // TODO do \ escaped characters (some OSes disallow them) // TODO Is 1 switch prong in a padded variable faster? while (utf8.nextCodepointSlice()) |codepoint| { switch (codepoint.len) { 0 => unreachable, 1 => { const char = codepoint[0]; // U+0000...U+007F switch (char) { 0...9 => { status = StatusOkExt.CntrlChar; }, // Cntrl (includes '\n', '\r', '\t') 10 => { return StatusOkExt.Newline; }, // Line Feed '\n' 11...31 => { status = StatusOkExt.CntrlChar; }, // Cntrl (includes '\n', '\r', '\t') ',', '`' => { if (status != StatusOkExt.CntrlChar) status = StatusOkExt.Antipattern; }, // antipattern '-', '~' => { if (visited_space and status != StatusOkExt.CntrlChar) status = StatusOkExt.Antipattern; }, // antipattern ' ' => { visited_space = true; }, 127 => { status = StatusOkExt.CntrlChar; }, // Cntrl else => { visited_space = false; }, } }, 2 => { const char = mem.bytesAsValue(u16, codepoint[0..2]); // U+0080...U+07FF switch (char.*) { 128...159 => status = StatusOkExt.CntrlChar, // Cntrl: also next line 0x85) 160 => { if (status != StatusOkExt.CntrlChar) status = StatusOkExt.Antipattern; }, // disallowed space: no-break space 173 => status = StatusOkExt.CntrlChar, // Cntrl: soft hyphen else => { visited_space = false; }, } }, 3 => { const char = mem.bytesAsValue(u24, codepoint[0..4]); // U+0800...U+FFFF switch (char.*) { // disallowed spaces, see README.md 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x200b => { if (status != StatusOkExt.CntrlChar) status = StatusOkExt.Antipattern; }, // disallowed spaces, see README.md (continued) 0x200c, 0x200d, 0x2028, 0x2029, 0x202f, 0x205f, 0x2060, 0x3000, 0xfeff => { if (status != StatusOkExt.CntrlChar) status = StatusOkExt.Antipattern; }, else => { visited_space = false; }, } }, 4 => { visited_space = false; // U+10000...U+10FFFF }, else => unreachable, } //std.debug.print("got codepoint {s}\n", .{codepoint}); } if (visited_space and status != StatusOkExt.CntrlChar) { return StatusOkExt.Antipattern; } // ending empty space return status; } fn writeRes( comptime phase: Phase, comptime mode: Mode, nl_ctrl: bool, file: *const fs.File, abs_path: []const u8, short_path: []const u8, ) !void { switch (phase) { Phase.RootPath => { switch (mode) { Mode.FileOutput, Mode.FileOutputAscii => { if (nl_ctrl) { // newline try file.writeAll("'"); try file.writeAll(abs_path); try file.writeAll("' newline in absolute HERE\n"); } else { try file.writeAll(abs_path); try file.writeAll("\n"); } }, Mode.ShellOutputAscii, Mode.ShellOutput => { if (nl_ctrl) { // ctrl char try file.writeAll("'"); try file.writeAll(short_path); try file.writeAll("' root abs path has ctrl chars\n"); process.exit(2); // root path wrong } else { try file.writeAll("'"); try file.writeAll(abs_path); try file.writeAll("' is antipattern\n"); process.exit(1); // root path wrong } }, else => unreachable, } }, Phase.ChildPaths => { switch (mode) { Mode.FileOutput, Mode.FileOutputAscii => { if (nl_ctrl) { try file.writeAll("'"); //try file.writeAll(rl_sup_dir_rel); try file.writeAll(abs_path); try file.writeAll("' newline in subfile HERE\n"); //return 3; } else { //try file.writeAll(entry.path); try file.writeAll(abs_path); try file.writeAll("\n"); } }, Mode.ShellOutput, Mode.ShellOutputAscii => { if (nl_ctrl) { try file.writeAll("'"); try file.writeAll(abs_path); try file.writeAll("' has file with ctrl chars\n"); // OK //return 2; } else { try file.writeAll("'"); try file.writeAll(short_path); try file.writeAll("' is antipattern\n"); } }, else => unreachable, } }, } } // writes output to File (stdout, open file etc) fn writeOutput(comptime mode: Mode, file: *const fs.File, arena: mem.Allocator, args: [][:0]u8) !u8 { std.debug.assert(mode != Mode.CheckOnly and mode != Mode.CheckOnlyAscii); const max_msg: u32 = 30; // unused for FileOutputAscii, FileOutput var cnt_msg: u32 = 0; // unused for FileOutputAscii, FileOutput var found_newline = false; // unused for ShellOutputAscii, ShellOutput // tmp data for realpath(), never to be references otherwise var tmp_buf: [fs.MAX_PATH_BYTES]u8 = undefined; const cwd = try process.getCwdAlloc(arena); // windows compatibility defer arena.free(cwd); var found_ctrlchars = false; var found_badchars = false; var i: u64 = 1; // skip program name while (i < args.len) : (i += 1) { if (mode == Mode.FileOutputAscii or mode == Mode.ShellOutputAscii) { if (mem.eql(u8, args[i], "-a")) continue; // skip -a } if (mode == Mode.FileOutputAscii or mode == Mode.FileOutput) { if (mem.eql(u8, args[i], "-outfile")) { // skip -outfile + filename i += 1; continue; } } const root_path = args[i]; { // ensure that super path does not contain any // control characters, that might get printed later const real_path = try os.realpath(root_path, &tmp_buf); var it = mem.tokenize(u8, root_path, &[_]u8{fs.path.sep}); skipItIfWindows(&it); while (it.next()) |entry| { std.debug.assert(entry.len > 0); var has_ctrlchars = false; var has_newline = false; switch (mode) { Mode.ShellOutputAscii, Mode.FileOutputAscii => { const status = isWordOkAsciiExtended(entry); switch (status) { StatusOkAsciiExt.Ok => {}, StatusOkAsciiExt.Antipattern => {}, StatusOkAsciiExt.CntrlChar => { has_ctrlchars = true; found_ctrlchars = true; }, StatusOkAsciiExt.Newline => { if (mode == Mode.FileOutputAscii or mode == Mode.FileOutput) { has_newline = true; found_newline = true; } }, } const arg_decision = switch (mode) { Mode.FileOutputAscii => has_newline, Mode.ShellOutputAscii => has_ctrlchars, else => unreachable, }; if (status != StatusOkAsciiExt.Ok) { try writeRes( Phase.RootPath, mode, arg_decision, file, real_path, root_path, ); } switch (status) { StatusOkAsciiExt.Ok => {}, StatusOkAsciiExt.Antipattern => return 1, StatusOkAsciiExt.CntrlChar => return 2, StatusOkAsciiExt.Newline => { if (mode == Mode.FileOutputAscii or mode == Mode.FileOutput) { return 3; } else { unreachable; } }, } }, Mode.ShellOutput, Mode.FileOutput => { const status: StatusOkExt = isWordOkExtended(entry); switch (status) { StatusOkExt.Ok => {}, StatusOkExt.Antipattern => {}, StatusOkExt.CntrlChar => { has_ctrlchars = true; found_ctrlchars = true; }, StatusOkExt.Newline => { if (mode == Mode.FileOutput) { has_newline = true; found_newline = true; } has_ctrlchars = true; found_ctrlchars = true; }, StatusOkExt.InvalUnicode => { if (mode == Mode.ShellOutput or mode == Mode.ShellOutputAscii) try file.writeAll("root path has invalid unicode!\n"); return 4; }, } const arg_decision = switch (mode) { Mode.FileOutput => has_newline, Mode.ShellOutput => has_ctrlchars, else => unreachable, }; if (status != StatusOkExt.Ok) { try writeRes( Phase.RootPath, mode, arg_decision, file, real_path, root_path, ); } switch (status) { StatusOkExt.Ok => {}, StatusOkExt.Antipattern => return 1, StatusOkExt.CntrlChar => return 2, StatusOkExt.Newline => { if (mode == Mode.FileOutputAscii or mode == Mode.FileOutput) { return 3; } else { unreachable; } }, StatusOkExt.InvalUnicode => unreachable, } }, else => unreachable, } } } //log.debug("reading (recursively) file '{s}'", .{root_path}); var root_dir = fs.cwd().openDir(root_path, .{ .iterate = true, .no_follow = true }) catch |err| { if (mode == Mode.FileOutput or mode == Mode.FileOutputAscii) file.close(); fatal("unable to open root directory '{s}': {s}", .{ root_path, @errorName(err), }); }; defer root_dir.close(); var walker = try root_dir.walk(arena); defer walker.deinit(); while (try walker.next()) |entry| { const basename = entry.basename; //log.debug("file '{s}'", .{basename}); // fails at either d_\t/\n\r\v\f //std.debug.print("basename[2]: {d}\n", .{basename[2]}); std.debug.assert(basename.len > 0); switch (mode) { Mode.ShellOutputAscii, Mode.FileOutputAscii, Mode.ShellOutput, Mode.FileOutput => { var has_ctrlchars = false; var has_newline = false; const status = isWordOkAsciiExtended(basename); switch (status) { StatusOkAsciiExt.Ok => {}, StatusOkAsciiExt.Antipattern => { cnt_msg += 1; found_badchars = true; }, StatusOkAsciiExt.CntrlChar => { cnt_msg += 1; has_ctrlchars = true; found_ctrlchars = true; }, StatusOkAsciiExt.Newline => { cnt_msg += 1; if (mode == Mode.FileOutput or mode == Mode.FileOutputAscii) { has_newline = true; found_newline = true; } else { has_ctrlchars = true; found_ctrlchars = true; } }, // TODO perf: remove case Newline } const super_dir: []const u8 = &[_]u8{fs.path.sep} ++ ".."; const p_sup_dir = try mem.concat(arena, u8, &.{ root_path, &[_]u8{fs.path.sep}, entry.path, super_dir }); defer arena.free(p_sup_dir); //std.debug.print("resolvePosix(arena, {s})\n", .{p_sup_dir}); const rl_sup_dir = try fs.path.resolve(arena, &.{p_sup_dir}); defer arena.free(rl_sup_dir); const rl_sup_dir_rel = try fs.path.relative(arena, cwd, rl_sup_dir); defer arena.free(rl_sup_dir_rel); //std.debug.print("fs.path.resolve result: '{s}'\n", .{rl_sup_dir}); // root folder is without control characters or terminate program would have been terminated const arg_decision = switch (mode) { Mode.FileOutput => has_newline, Mode.FileOutputAscii => has_newline, Mode.ShellOutput => has_ctrlchars, Mode.ShellOutputAscii => has_ctrlchars, else => unreachable, }; if (status != StatusOkAsciiExt.Ok) { try writeRes( Phase.ChildPaths, mode, arg_decision, file, rl_sup_dir_rel, entry.path, ); } if (cnt_msg == max_msg) { switch (mode) { Mode.FileOutput, Mode.FileOutputAscii => { if (found_newline) return 3; if (found_ctrlchars) return 2; }, Mode.ShellOutput, Mode.ShellOutputAscii => { if (found_ctrlchars) return 2; }, else => unreachable, } std.debug.assert(found_badchars); return 1; } }, else => unreachable, } } } switch (mode) { Mode.FileOutput, Mode.FileOutputAscii => { if (found_newline) return 3; if (found_ctrlchars) return 2; if (found_badchars) return 1; }, Mode.ShellOutput, Mode.ShellOutputAscii => { if (found_ctrlchars) return 2; if (found_badchars) return 1; }, else => unreachable, } return 0; // invariant: status == 0 } const Phase = enum { RootPath, ChildPaths, }; pub const Mode = enum { /// only check withs status code CheckOnly, /// ascii only check withs status code CheckOnlyAscii, /// heck with limited output ShellOutput, /// ascii heck with limited output ShellOutputAscii, /// check with output to file FileOutput, /// ascii check with output to file FileOutputAscii, }; // never returns Mode, but an error to bubble up to main fn cleanup(write_file: *?fs.File) !Mode { if (write_file.* != null) { write_file.*.?.close(); } return error.TestUnexpectedResult; } // return codes // 0 success // 1 bad pattern, in case of -c option: found something bad // 2 control character // 3 newline occured (only in case of -outfile) // 4 invalid unicode // + other error codes generated from zig // assume: no file `-outfile` exists // assume: user specifies non-overlapping input paths // assume: user wants 30 lines output space and a summary of total output size // * output sanitized for ascii escape sequences and control characters on default // * output usable in vim and shell // perf of POSIX/Linux nftw, Rust walkdir and find are comparable. // zig libstd offers higher perf for less convenience with optimizations // see https://github.com/romkatv/gitstatus/blob/master/docs/listdir.md // TODO benchmarks to show this pub fn main() !u8 { var write_file: ?fs.File = null; var mode: Mode = Mode.ShellOutput; // default execution mode // 1. read path names from cli args var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena_instance.deinit(); const arena = arena_instance.allocator(); const args: [][:0]u8 = try process.argsAlloc(arena); defer process.argsFree(arena, args); if (args.len <= 1) { try stdout.writer().print("Usage: {s} {s}\n", .{ args[0], usage }); process.exit(1); } if (args.len >= 255) { try stdout.writer().writeAll("At maximum 255 arguments are supported\n"); process.exit(1); } var i: u64 = 1; // skip program name while (i < args.len) : (i += 1) { if (mem.eql(u8, args[i], "-outfile")) { mode = switch (mode) { Mode.ShellOutput => Mode.FileOutput, Mode.ShellOutputAscii => Mode.FileOutputAscii, else => try cleanup(&write_file), // hack around stage1 }; if (i + 1 >= args.len) { return error.InvalidArgument; } i += 1; write_file = try fs.cwd().createFile(args[i], .{}); } if (mem.eql(u8, args[i], "-c")) { mode = switch (mode) { Mode.ShellOutput => Mode.CheckOnly, Mode.ShellOutputAscii => Mode.CheckOnlyAscii, else => try cleanup(&write_file), // hack around stage1 }; } if (mem.eql(u8, args[i], "-a")) { mode = switch (mode) { Mode.ShellOutput => Mode.ShellOutputAscii, Mode.CheckOnly => Mode.CheckOnlyAscii, Mode.FileOutput => Mode.FileOutputAscii, else => try cleanup(&write_file), // hack around stage1 }; } } defer if (write_file != null) write_file.?.close(); const ret = switch (mode) { // only check status Mode.CheckOnly => try checkOnly(Encoding.Utf8, arena, args), Mode.CheckOnlyAscii => try checkOnly(Encoding.Ascii, arena, args), // shell output => capped at 30 lines Mode.ShellOutput => try writeOutput(Mode.ShellOutput, &stdout, arena, args), Mode.ShellOutputAscii => try writeOutput(Mode.ShellOutputAscii, &stdout, arena, args), // file output => files with '\n' marked Mode.FileOutput => try writeOutput(Mode.FileOutput, &(write_file.?), arena, args), Mode.FileOutputAscii => try writeOutput(Mode.FileOutputAscii, &(write_file.?), arena, args), }; // TODO close file on error return ret; }
src/main.zig
const std = @import("std"); const net = std.net; const meta = std.meta; const Allocator = std.mem.Allocator; const Thread = std.Thread; const log = std.log; const time = std.time; const atomic = std.atomic; const math = std.math; const Uuid = @import("uuid6"); const mcp = @import("mcproto.zig"); const mcn = @import("mcnet.zig"); pub const PlayerKickReason = union(enum) { Custom: []const u8, TimedOut, Kicked, }; pub const PlayerData = struct { x: f64, y: f64, z: f64, yaw: f32, pitch: f32, on_ground: bool, }; pub const PacketClientType = mcn.PacketClient(net.Stream.Reader, net.Stream.Writer, null); pub const Player = struct { eid: i32, uuid: Uuid, username: []const u8, settings: atomic.Atomic(*mcp.ClientSettings.UserType), inner: PacketClientType, reader_lock: Thread.Mutex = .{}, writer_lock: Thread.Mutex = .{}, alive: atomic.Atomic(bool) = .{ .value = true }, ping: atomic.Atomic(i32) = .{ .value = 0 }, keep_alive_timer: time.Timer = undefined, last_keep_alive_time_len: u64 = 0, keep_alives_waiting_lock: Thread.Mutex = .{}, keep_alives_waiting: std.BoundedArray(i64, 6) = .{ .len = 0 }, player_data: PlayerData, player_data_lock: Thread.Mutex = .{}, last_player_data: PlayerData = .{ .x = 0, .y = 0, .z = 0, .yaw = 0, .pitch = 0, .on_ground = false, }, pub fn handlePacket(self: *Player, alloc: Allocator, game: *Game, packet: anytype) !void { switch (packet) { .keep_alive => |id| { self.keep_alives_waiting_lock.lock(); defer self.keep_alives_waiting_lock.unlock(); if (self.keep_alives_waiting.len > 0) { var i: isize = @intCast(isize, self.keep_alives_waiting.len) - 1; while (i >= 0) : (i -= 1) { const val = self.keep_alives_waiting.get(@intCast(usize, i)); if (val <= id) { _ = self.keep_alives_waiting.swapRemove(@intCast(usize, i)); if (val == id) { self.ping.store(@intCast(i32, time.milliTimestamp() - val), .Unordered); } } } } }, .player_position => |data| { self.player_data_lock.lock(); self.player_data.x = data.x; self.player_data.y = data.y; self.player_data.z = data.z; self.player_data.on_ground = data.on_ground; self.player_data_lock.unlock(); }, .player_position_and_rotation => |data| { self.player_data_lock.lock(); self.player_data.x = data.x; self.player_data.y = data.y; self.player_data.z = data.z; self.player_data.yaw = data.yaw; self.player_data.pitch = data.pitch; self.player_data.on_ground = data.on_ground; self.player_data_lock.unlock(); }, .player_rotation => |data| { self.player_data_lock.lock(); self.player_data.yaw = data.yaw; self.player_data.pitch = data.pitch; self.player_data.on_ground = data.on_ground; self.player_data_lock.unlock(); }, .player_movement => |on_ground| { self.player_data_lock.lock(); self.player_data.on_ground = on_ground; self.player_data_lock.unlock(); }, .client_settings => |settings| { var new_settings = try alloc.create(mcp.ClientSettings.UserType); new_settings.* = settings; var old_settings = self.settings.swap(new_settings, .Monotonic); alloc.destroy(old_settings); }, .chat_message => |msg| { var formatted_msg = try std.fmt.allocPrint(alloc, \\{{"text":"{s}","color":"aqua","extra":[{{"text":": {s}","color":"white"}}]}} , .{ self.username, msg }); defer alloc.free(formatted_msg); self.broadcastChatMessage(game, formatted_msg); }, else => log.info("got packet {any}", .{packet}), } } pub fn deinit(self: *Player, alloc: Allocator, game: *Game) void { // remove self from player list game.players_lock.lock(); for (game.players.items) |player, i| { if (player == self) { _ = game.players.swapRemove(i); break; } } game.players_lock.unlock(); // tell everyone in the server we're gone game.broadcast(mcp.P.CB, mcp.P.CB.UserType{ .destroy_entities = &[_]i32{self.eid} }); game.broadcast(mcp.P.CB, mcp.P.CB.UserType{ .player_info = .{ .remove_player = &[_]meta.Child(mcp.PlayerInfo.UnionType.Specs[4].UserType){ .{ .uuid = self.uuid, .data = {}, }, } } }); if (std.fmt.allocPrint(alloc, \\{{"text":"{s}","color":"yellow","extra":[{{"text":" disconnected","color":"white"}}]}} , .{self.username})) |formatted_msg| { defer alloc.free(formatted_msg); self.broadcastChatMessage(game, formatted_msg); } else |err| log.err("failed to broadcast disconnect message for player {s}: {any}", .{ self.username, err }); // deinit resources // perhaps we want to move stuff before this into their own function? alloc.destroy(self.settings.load(.Unordered)); game.returnEid(self.eid) catch |err| { log.err("lost eid {}: {any}", .{ self.eid, err }); }; //self.alive.store(false, .Unordered); if (self.alive.load(.Unordered)) { self.inner.close(); } alloc.free(self.username); alloc.destroy(self); } pub fn run(self: *Player, alloc: Allocator, game: *Game) void { defer self.deinit(alloc, game); while (self.alive.load(.Unordered)) { self.reader_lock.lock(); const packet = self.inner.readPacket(mcp.P.SB, alloc) catch |err| { defer self.reader_lock.unlock(); if (err == error.EndOfStream) { log.info("closing client", .{}); break; } log.err("failed to read packet: {any}", .{err}); if (err == error.ReadTooFar) { log.err("likely a server deserialization bug", .{}); } continue; }; defer mcp.P.SB.deinit(packet, alloc); self.reader_lock.unlock(); self.handlePacket(alloc, game, packet) catch |err| { log.err("failed to handle packet from {s}: {any}", .{ self.username, err }); }; } } pub fn sendKick(self: *Player, reason: PlayerKickReason) !void { const message = switch (reason) { .Custom => |m| m, .TimedOut => "{\"text\":\"Timed out!\"}", .Kicked => "{\"text\":\"Kicked!\"}", }; try self.inner.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .disconnect = message }); } pub fn broadcastChatMessage(self: *Player, game: *Game, msg: []const u8) void { game.players_lock.lock(); for (game.players.items) |player| { const player_client_settings = player.settings.load(.Unordered); if (player_client_settings.chat_mode == .Enabled) { player.inner.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .chat_message = .{ .message = msg, .position = .Chat, .sender = self.uuid, } }) catch |err| { log.err("Failed to send chat message to client {s}: {any}", .{ player.username, err }); }; } } game.players_lock.unlock(); } pub fn sendMovement(self: *Player, game: *Game) void { self.player_data_lock.lock(); const nd = self.player_data; self.player_data_lock.unlock(); const ld = self.last_player_data; if (!meta.eql(nd, ld)) { const position_changed = nd.x != ld.x or nd.y != ld.y or nd.z != ld.z; const angle_changed = nd.yaw != ld.yaw or nd.pitch != ld.pitch; const yaw = mcp.intoAngle(nd.yaw); const pit = mcp.intoAngle(nd.pitch); var packet: ?mcp.P.CB.UserType = null; if (position_changed) { const max_dist_changed = math.max3(math.absFloat(nd.x - ld.x), math.absFloat(nd.y - ld.y), math.absFloat(nd.z - ld.z)); if (max_dist_changed > 8.0) { packet = .{ .entity_teleport = .{ .entity_id = self.eid, .x = nd.x, .y = nd.y, .z = nd.z, .yaw = yaw, .pitch = pit, .on_ground = nd.on_ground, } }; } else { const dx = @floatToInt(i16, (nd.x - ld.x) * (32 * 128)); const dy = @floatToInt(i16, (nd.y - ld.y) * (32 * 128)); const dz = @floatToInt(i16, (nd.z - ld.z) * (32 * 128)); if (angle_changed) { packet = .{ .entity_position_and_rotation = .{ .entity_id = self.eid, .dx = dx, .dy = dy, .dz = dz, .yaw = yaw, .pitch = pit, .on_ground = nd.on_ground, } }; } else { packet = .{ .entity_position = .{ .entity_id = self.eid, .dx = dx, .dy = dy, .dz = dz, .on_ground = nd.on_ground, } }; } } } else if (angle_changed) { packet = .{ .entity_rotation = .{ .entity_id = self.eid, .yaw = yaw, .pitch = pit, .on_ground = nd.on_ground, } }; } if (packet) |inner_packet| { game.broadcastExcept(mcp.P.CB, inner_packet, self); } if (angle_changed) { game.broadcastExcept(mcp.P.CB, mcp.P.CB.UserType{ .entity_head_look = .{ .entity_id = self.eid, .yaw = yaw, } }, self); } self.last_player_data = self.player_data; } self.last_player_data = nd; } }; pub const Game = struct { alloc: Allocator, players_lock: Thread.Mutex = .{}, players: std.ArrayList(*Player), alive: atomic.Atomic(bool), tick_count: u64 = 0, keep_alive_timer: time.Timer = undefined, available_eids: std.ArrayList(i32), available_eids_lock: Thread.Mutex = .{}, pub fn run(self: *Game) void { defer self.deinit(); self.available_eids.append(1) catch unreachable; self.keep_alive_timer = time.Timer.start() catch unreachable; var tick_timer = time.Timer.start() catch unreachable; const DESIRED_TOTAL_TICK_NS: u64 = (1000 * 1000 * 1000) / 20; // 1/20 sec while (self.alive.load(.Unordered)) { self.sendPlayerUpdates(); const TIME_BETWEEN_KEEP_ALIVES: u64 = 1000 * 1000 * 1000 * 5; // 5 seconds if (self.keep_alive_timer.read() > TIME_BETWEEN_KEEP_ALIVES) { self.sendKeepAlives(); self.keep_alive_timer.reset(); } self.tick_count += 1; var ns = tick_timer.read(); if (ns > DESIRED_TOTAL_TICK_NS) { log.warn("tick took too long! {}ms (tick took {}ms)", .{ (ns - DESIRED_TOTAL_TICK_NS) / 1000, ns / 1000 }); } else { time.sleep(DESIRED_TOTAL_TICK_NS - ns); } tick_timer.reset(); } } pub fn deinit(self: *Game) void { std.debug.assert(self.players.items.len == 0); self.players.deinit(); self.available_eids.deinit(); } pub fn sendPlayerUpdates(self: *Game) void { self.players_lock.lock(); for (self.players.items) |player| { self.players_lock.unlock(); player.sendMovement(self); self.players_lock.lock(); } self.players_lock.unlock(); } // `i` is position in players array // assumes that .players_lock is locked (otherwise `i` might refer to something unintended) pub fn kickPlayer(self: *Game, i: usize, reason: PlayerKickReason) !void { var player = self.players.items[i]; defer player.inner.close(); _ = self.players.swapRemove(i); player.alive.store(false, .Unordered); player.writer_lock.lock(); defer player.writer_lock.unlock(); try player.sendKick(reason); } pub fn sendLatencyUpdates(self: *Game) void { self.players_lock.lock(); for (self.players.items) |player| { self.broadcast(mcp.P.CB, mcp.P.CB.UserType{ .player_info = .{ .update_latency = &[_]meta.Child(mcp.PlayerInfo.UnionType.Specs[2].UserType){ .{ .uuid = player.uuid, .data = player.ping.load(.Unordered), }, }, } }); } self.players_lock.unlock(); } pub fn sendKeepAlives(self: *Game) void { const timestamp = time.milliTimestamp(); self.players_lock.lock(); var i: isize = @intCast(isize, self.players.items.len) - 1; while (i >= 0) : (i -= 1) { var player = self.players.items[@intCast(usize, i)]; player.writer_lock.lock(); player.inner.writePacket(mcp.P.CB, mcp.P.CB.UserType{ .keep_alive = timestamp }) catch |err| { log.err("error while sending keep alive: {any}", .{err}); }; player.writer_lock.unlock(); player.keep_alives_waiting_lock.lock(); player.keep_alives_waiting.append(timestamp) catch |waiting_err| { std.debug.assert(waiting_err == error.Overflow); // if waiting list is overflowing, then player hasnt responded for too many keep alives self.kickPlayer(@intCast(usize, i), PlayerKickReason.TimedOut) catch |err| { log.err("error during keep alive kick: {any}", .{err}); }; }; player.keep_alives_waiting_lock.unlock(); } self.players_lock.unlock(); } pub fn getEid(self: *Game) i32 { self.available_eids_lock.lock(); const eid = self.available_eids.items[self.available_eids.items.len - 1]; if (self.available_eids.items.len == 1) { self.available_eids.items[0] = eid + 1; } else { _ = self.available_eids.pop(); } self.available_eids_lock.unlock(); return eid; } pub fn returnEid(self: *Game, eid: i32) !void { // might want to figure out a different way to do this that doesnt potentially return an error self.available_eids_lock.lock(); defer self.available_eids_lock.unlock(); try self.available_eids.append(eid); } pub fn broadcast(self: *Game, comptime PacketType: type, packet: PacketType.UserType) void { self.players_lock.lock(); defer self.players_lock.unlock(); for (self.players.items) |player| { player.writer_lock.lock(); defer player.writer_lock.unlock(); player.inner.writePacket(PacketType, packet) catch |err| { log.err("failed to broadcast packet to player {}: {any}", .{ player.eid, err }); }; } } pub fn broadcastExcept(self: *Game, comptime PacketType: type, packet: PacketType.UserType, except: *Player) void { self.players_lock.lock(); defer self.players_lock.unlock(); for (self.players.items) |player| { if (player == except) continue; player.writer_lock.lock(); defer player.writer_lock.unlock(); player.inner.writePacket(PacketType, packet) catch |err| { log.err("failed to broadcast packet to player {}: {any}", .{ player.eid, err }); }; } } };
src/game.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const EditorWidget = @import("EditorWidget.zig"); const Document = @import("Document.zig"); const Snapshot = []u8; pub const Buffer = struct { allocator: Allocator, stack: ArrayList(Snapshot), index: usize = 0, editor: ?*EditorWidget = null, pub fn init(allocator: Allocator) !*Buffer { var self = try allocator.create(Buffer); self.* = Buffer{ .allocator = allocator, .stack = ArrayList(Snapshot).init(allocator), }; return self; } pub fn deinit(self: *Buffer) void { for (self.stack.items) |snapshot| { self.allocator.free(snapshot); } self.stack.deinit(); self.allocator.destroy(self); } pub fn clearAndFreeStack(self: *Buffer) void { for (self.stack.items) |snapshot| { self.allocator.free(snapshot); } self.stack.shrinkRetainingCapacity(0); self.index = 0; } pub fn reset(self: *Buffer, document: *Document) !void { self.clearAndFreeStack(); try self.stack.append(try document.serialize()); self.notifyChanged(document); } fn notifyChanged(self: Buffer, document: *Document) void { if (self.editor) |editor| editor.onUndoChanged(document); } pub fn canUndo(self: Buffer) bool { return self.index > 0; } pub fn undo(self: *Buffer, document: *Document) !void { if (!self.canUndo()) return; self.index -= 1; const snapshot = self.stack.items[self.index]; try document.deserialize(snapshot); self.notifyChanged(document); } pub fn canRedo(self: Buffer) bool { return self.index + 1 < self.stack.items.len; } pub fn redo(self: *Buffer, document: *Document) !void { if (!self.canRedo()) return; self.index += 1; const snapshot = self.stack.items[self.index]; try document.deserialize(snapshot); self.notifyChanged(document); } pub fn pushFrame(self: *Buffer, document: *Document) !void { // TODO: handle error cases // do comparison const top = self.stack.items[self.index]; const snapshot = try document.serialize(); if (std.mem.eql(u8, top, snapshot)) { document.allocator.free(snapshot); return; } self.index += 1; // clear redo stack for (self.stack.items[self.index..self.stack.items.len]) |snap| { document.allocator.free(snap); } self.stack.shrinkRetainingCapacity(self.index); try self.stack.append(snapshot); self.notifyChanged(document); } };
src/history.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const c_allocator = std.heap.c_allocator; const lib = @import("main.zig"); const Error = lib.Error; const FlightPlan = lib.FlightPlan; const Waypoint = lib.Waypoint; const Route = lib.Route; const testutil = @import("test.zig"); const c = @cImport({ @cInclude("flightplan.h"); }); //------------------------------------------------------------------- // Formats pub usingnamespace @import("format/garmin.zig").Binding; pub usingnamespace @import("format/xplane_fms_11.zig").Binding; //------------------------------------------------------------------- // General functions export fn fpl_cleanup() void { lib.deinit(); } export fn fpl_new() ?*FlightPlan { return cflightplan(.{ .alloc = c_allocator }); } export fn fpl_set_created(raw: ?*FlightPlan, str: [*:0]const u8) u8 { const fpl = raw orelse return 1; const copy = std.mem.span(str); fpl.created = Allocator.dupeZ(c_allocator, u8, copy) catch return 1; return 0; } export fn fpl_created(raw: ?*FlightPlan) ?[*:0]const u8 { if (raw) |fpl| { if (fpl.created) |v| { return v.ptr; } } return null; } export fn fpl_free(raw: ?*FlightPlan) void { if (raw) |v| { v.deinit(); c_allocator.destroy(v); } } pub fn cflightplan(fpl: FlightPlan) ?*FlightPlan { const result = c_allocator.create(FlightPlan) catch return null; result.* = fpl; return result; } //------------------------------------------------------------------- // Errors export fn fpl_last_error() ?*Error { return Error.lastError(); } export fn fpl_error_message(raw: ?*Error) ?[*:0]const u8 { const err = raw orelse return null; return err.message().ptr; } //------------------------------------------------------------------- // Waypoints const WPIterator = std.meta.fieldInfo(FlightPlan, .waypoints).field_type.ValueIterator; export fn fpl_waypoints_count(raw: ?*FlightPlan) c_int { if (raw) |fpl| { return @intCast(c_int, fpl.waypoints.count()); } return 0; } export fn fpl_waypoints_iter(raw: ?*FlightPlan) ?*WPIterator { const fpl = raw orelse return null; const iter = fpl.waypoints.valueIterator(); const result = c_allocator.create(@TypeOf(iter)) catch return null; result.* = iter; return result; } export fn fpl_waypoint_iter_free(raw: ?*WPIterator) void { if (raw) |iter| { c_allocator.destroy(iter); } } export fn fpl_waypoints_next(raw: ?*WPIterator) ?*Waypoint { const iter = raw orelse return null; return iter.next(); } export fn fpl_waypoint_identifier(raw: ?*Waypoint) ?[*:0]const u8 { const wp = raw orelse return null; return wp.identifier.ptr; } export fn fpl_waypoint_lat(raw: ?*Waypoint) f32 { const wp = raw orelse return -1; return wp.lat; } export fn fpl_waypoint_lon(raw: ?*Waypoint) f32 { const wp = raw orelse return -1; return wp.lon; } export fn fpl_waypoint_type(raw: ?*Waypoint) c.flightplan_waypoint_type { const wp = raw orelse return c.FLIGHTPLAN_INVALID; return @enumToInt(wp.type) + 1; // must add 1 due to _INVALID } export fn fpl_waypoint_type_str(raw: c.flightplan_waypoint_type) [*:0]const u8 { // subtraction here due to _INVALID return @intToEnum(Waypoint.Type, raw - 1).toString().ptr; } //------------------------------------------------------------------- // Route export fn fpl_route_name(raw: ?*FlightPlan) ?[*:0]const u8 { const fpl = raw orelse return null; if (fpl.route.name) |v| { return v.ptr; } return null; } export fn fpl_route_points_count(raw: ?*FlightPlan) c_int { const fpl = raw orelse return 0; return @intCast(c_int, fpl.route.points.items.len); } export fn fpl_route_points_get(raw: ?*FlightPlan, idx: c_int) ?*Route.Point { const fpl = raw orelse return null; return &fpl.route.points.items[@intCast(usize, idx)]; } export fn fpl_route_point_identifier(raw: ?*Route.Point) ?[*:0]const u8 { const ptr = raw orelse return null; return ptr.identifier; }
src/binding.zig
const ctz = @import("count0bits.zig"); const testing = @import("std").testing; fn test__ctzsi2(a: u32, expected: i32) !void { var x = @bitCast(i32, a); var result = ctz.__ctzsi2(x); try testing.expectEqual(expected, result); } test "ctzsi2" { try test__ctzsi2(0x00000001, 0); try test__ctzsi2(0x00000002, 1); try test__ctzsi2(0x00000003, 0); try test__ctzsi2(0x00000004, 2); try test__ctzsi2(0x00000005, 0); try test__ctzsi2(0x00000006, 1); try test__ctzsi2(0x00000007, 0); try test__ctzsi2(0x00000008, 3); try test__ctzsi2(0x00000009, 0); try test__ctzsi2(0x0000000A, 1); try test__ctzsi2(0x0000000B, 0); try test__ctzsi2(0x0000000C, 2); try test__ctzsi2(0x0000000D, 0); try test__ctzsi2(0x0000000E, 1); try test__ctzsi2(0x0000000F, 0); try test__ctzsi2(0x00000010, 4); try test__ctzsi2(0x00000011, 0); try test__ctzsi2(0x00000012, 1); try test__ctzsi2(0x00000013, 0); try test__ctzsi2(0x00000014, 2); try test__ctzsi2(0x00000015, 0); try test__ctzsi2(0x00000016, 1); try test__ctzsi2(0x00000017, 0); try test__ctzsi2(0x00000018, 3); try test__ctzsi2(0x00000019, 0); try test__ctzsi2(0x0000001A, 1); try test__ctzsi2(0x0000001B, 0); try test__ctzsi2(0x0000001C, 2); try test__ctzsi2(0x0000001D, 0); try test__ctzsi2(0x0000001E, 1); try test__ctzsi2(0x0000001F, 0); try test__ctzsi2(0x00000020, 5); try test__ctzsi2(0x00000021, 0); try test__ctzsi2(0x00000022, 1); try test__ctzsi2(0x00000023, 0); try test__ctzsi2(0x00000024, 2); try test__ctzsi2(0x00000025, 0); try test__ctzsi2(0x00000026, 1); try test__ctzsi2(0x00000027, 0); try test__ctzsi2(0x00000028, 3); try test__ctzsi2(0x00000029, 0); try test__ctzsi2(0x0000002A, 1); try test__ctzsi2(0x0000002B, 0); try test__ctzsi2(0x0000002C, 2); try test__ctzsi2(0x0000002D, 0); try test__ctzsi2(0x0000002E, 1); try test__ctzsi2(0x0000002F, 0); try test__ctzsi2(0x00000030, 4); try test__ctzsi2(0x00000031, 0); try test__ctzsi2(0x00000032, 1); try test__ctzsi2(0x00000033, 0); try test__ctzsi2(0x00000034, 2); try test__ctzsi2(0x00000035, 0); try test__ctzsi2(0x00000036, 1); try test__ctzsi2(0x00000037, 0); try test__ctzsi2(0x00000038, 3); try test__ctzsi2(0x00000039, 0); try test__ctzsi2(0x0000003A, 1); try test__ctzsi2(0x0000003B, 0); try test__ctzsi2(0x0000003C, 2); try test__ctzsi2(0x0000003D, 0); try test__ctzsi2(0x0000003E, 1); try test__ctzsi2(0x0000003F, 0); try test__ctzsi2(0x00000040, 6); try test__ctzsi2(0x00000041, 0); try test__ctzsi2(0x00000042, 1); try test__ctzsi2(0x00000043, 0); try test__ctzsi2(0x00000044, 2); try test__ctzsi2(0x00000045, 0); try test__ctzsi2(0x00000046, 1); try test__ctzsi2(0x00000047, 0); try test__ctzsi2(0x00000048, 3); try test__ctzsi2(0x00000049, 0); try test__ctzsi2(0x0000004A, 1); try test__ctzsi2(0x0000004B, 0); try test__ctzsi2(0x0000004C, 2); try test__ctzsi2(0x0000004D, 0); try test__ctzsi2(0x0000004E, 1); try test__ctzsi2(0x0000004F, 0); try test__ctzsi2(0x00000050, 4); try test__ctzsi2(0x00000051, 0); try test__ctzsi2(0x00000052, 1); try test__ctzsi2(0x00000053, 0); try test__ctzsi2(0x00000054, 2); try test__ctzsi2(0x00000055, 0); try test__ctzsi2(0x00000056, 1); try test__ctzsi2(0x00000057, 0); try test__ctzsi2(0x00000058, 3); try test__ctzsi2(0x00000059, 0); try test__ctzsi2(0x0000005A, 1); try test__ctzsi2(0x0000005B, 0); try test__ctzsi2(0x0000005C, 2); try test__ctzsi2(0x0000005D, 0); try test__ctzsi2(0x0000005E, 1); try test__ctzsi2(0x0000005F, 0); try test__ctzsi2(0x00000060, 5); try test__ctzsi2(0x00000061, 0); try test__ctzsi2(0x00000062, 1); try test__ctzsi2(0x00000063, 0); try test__ctzsi2(0x00000064, 2); try test__ctzsi2(0x00000065, 0); try test__ctzsi2(0x00000066, 1); try test__ctzsi2(0x00000067, 0); try test__ctzsi2(0x00000068, 3); try test__ctzsi2(0x00000069, 0); try test__ctzsi2(0x0000006A, 1); try test__ctzsi2(0x0000006B, 0); try test__ctzsi2(0x0000006C, 2); try test__ctzsi2(0x0000006D, 0); try test__ctzsi2(0x0000006E, 1); try test__ctzsi2(0x0000006F, 0); try test__ctzsi2(0x00000070, 4); try test__ctzsi2(0x00000071, 0); try test__ctzsi2(0x00000072, 1); try test__ctzsi2(0x00000073, 0); try test__ctzsi2(0x00000074, 2); try test__ctzsi2(0x00000075, 0); try test__ctzsi2(0x00000076, 1); try test__ctzsi2(0x00000077, 0); try test__ctzsi2(0x00000078, 3); try test__ctzsi2(0x00000079, 0); try test__ctzsi2(0x0000007A, 1); try test__ctzsi2(0x0000007B, 0); try test__ctzsi2(0x0000007C, 2); try test__ctzsi2(0x0000007D, 0); try test__ctzsi2(0x0000007E, 1); try test__ctzsi2(0x0000007F, 0); try test__ctzsi2(0x00000080, 7); try test__ctzsi2(0x00000081, 0); try test__ctzsi2(0x00000082, 1); try test__ctzsi2(0x00000083, 0); try test__ctzsi2(0x00000084, 2); try test__ctzsi2(0x00000085, 0); try test__ctzsi2(0x00000086, 1); try test__ctzsi2(0x00000087, 0); try test__ctzsi2(0x00000088, 3); try test__ctzsi2(0x00000089, 0); try test__ctzsi2(0x0000008A, 1); try test__ctzsi2(0x0000008B, 0); try test__ctzsi2(0x0000008C, 2); try test__ctzsi2(0x0000008D, 0); try test__ctzsi2(0x0000008E, 1); try test__ctzsi2(0x0000008F, 0); try test__ctzsi2(0x00000090, 4); try test__ctzsi2(0x00000091, 0); try test__ctzsi2(0x00000092, 1); try test__ctzsi2(0x00000093, 0); try test__ctzsi2(0x00000094, 2); try test__ctzsi2(0x00000095, 0); try test__ctzsi2(0x00000096, 1); try test__ctzsi2(0x00000097, 0); try test__ctzsi2(0x00000098, 3); try test__ctzsi2(0x00000099, 0); try test__ctzsi2(0x0000009A, 1); try test__ctzsi2(0x0000009B, 0); try test__ctzsi2(0x0000009C, 2); try test__ctzsi2(0x0000009D, 0); try test__ctzsi2(0x0000009E, 1); try test__ctzsi2(0x0000009F, 0); try test__ctzsi2(0x000000A0, 5); try test__ctzsi2(0x000000A1, 0); try test__ctzsi2(0x000000A2, 1); try test__ctzsi2(0x000000A3, 0); try test__ctzsi2(0x000000A4, 2); try test__ctzsi2(0x000000A5, 0); try test__ctzsi2(0x000000A6, 1); try test__ctzsi2(0x000000A7, 0); try test__ctzsi2(0x000000A8, 3); try test__ctzsi2(0x000000A9, 0); try test__ctzsi2(0x000000AA, 1); try test__ctzsi2(0x000000AB, 0); try test__ctzsi2(0x000000AC, 2); try test__ctzsi2(0x000000AD, 0); try test__ctzsi2(0x000000AE, 1); try test__ctzsi2(0x000000AF, 0); try test__ctzsi2(0x000000B0, 4); try test__ctzsi2(0x000000B1, 0); try test__ctzsi2(0x000000B2, 1); try test__ctzsi2(0x000000B3, 0); try test__ctzsi2(0x000000B4, 2); try test__ctzsi2(0x000000B5, 0); try test__ctzsi2(0x000000B6, 1); try test__ctzsi2(0x000000B7, 0); try test__ctzsi2(0x000000B8, 3); try test__ctzsi2(0x000000B9, 0); try test__ctzsi2(0x000000BA, 1); try test__ctzsi2(0x000000BB, 0); try test__ctzsi2(0x000000BC, 2); try test__ctzsi2(0x000000BD, 0); try test__ctzsi2(0x000000BE, 1); try test__ctzsi2(0x000000BF, 0); try test__ctzsi2(0x000000C0, 6); try test__ctzsi2(0x000000C1, 0); try test__ctzsi2(0x000000C2, 1); try test__ctzsi2(0x000000C3, 0); try test__ctzsi2(0x000000C4, 2); try test__ctzsi2(0x000000C5, 0); try test__ctzsi2(0x000000C6, 1); try test__ctzsi2(0x000000C7, 0); try test__ctzsi2(0x000000C8, 3); try test__ctzsi2(0x000000C9, 0); try test__ctzsi2(0x000000CA, 1); try test__ctzsi2(0x000000CB, 0); try test__ctzsi2(0x000000CC, 2); try test__ctzsi2(0x000000CD, 0); try test__ctzsi2(0x000000CE, 1); try test__ctzsi2(0x000000CF, 0); try test__ctzsi2(0x000000D0, 4); try test__ctzsi2(0x000000D1, 0); try test__ctzsi2(0x000000D2, 1); try test__ctzsi2(0x000000D3, 0); try test__ctzsi2(0x000000D4, 2); try test__ctzsi2(0x000000D5, 0); try test__ctzsi2(0x000000D6, 1); try test__ctzsi2(0x000000D7, 0); try test__ctzsi2(0x000000D8, 3); try test__ctzsi2(0x000000D9, 0); try test__ctzsi2(0x000000DA, 1); try test__ctzsi2(0x000000DB, 0); try test__ctzsi2(0x000000DC, 2); try test__ctzsi2(0x000000DD, 0); try test__ctzsi2(0x000000DE, 1); try test__ctzsi2(0x000000DF, 0); try test__ctzsi2(0x000000E0, 5); try test__ctzsi2(0x000000E1, 0); try test__ctzsi2(0x000000E2, 1); try test__ctzsi2(0x000000E3, 0); try test__ctzsi2(0x000000E4, 2); try test__ctzsi2(0x000000E5, 0); try test__ctzsi2(0x000000E6, 1); try test__ctzsi2(0x000000E7, 0); try test__ctzsi2(0x000000E8, 3); try test__ctzsi2(0x000000E9, 0); try test__ctzsi2(0x000000EA, 1); try test__ctzsi2(0x000000EB, 0); try test__ctzsi2(0x000000EC, 2); try test__ctzsi2(0x000000ED, 0); try test__ctzsi2(0x000000EE, 1); try test__ctzsi2(0x000000EF, 0); try test__ctzsi2(0x000000F0, 4); try test__ctzsi2(0x000000F1, 0); try test__ctzsi2(0x000000F2, 1); try test__ctzsi2(0x000000F3, 0); try test__ctzsi2(0x000000F4, 2); try test__ctzsi2(0x000000F5, 0); try test__ctzsi2(0x000000F6, 1); try test__ctzsi2(0x000000F7, 0); try test__ctzsi2(0x000000F8, 3); try test__ctzsi2(0x000000F9, 0); try test__ctzsi2(0x000000FA, 1); try test__ctzsi2(0x000000FB, 0); try test__ctzsi2(0x000000FC, 2); try test__ctzsi2(0x000000FD, 0); try test__ctzsi2(0x000000FE, 1); try test__ctzsi2(0x000000FF, 0); try test__ctzsi2(0x00000000, 32); try test__ctzsi2(0x80000000, 31); try test__ctzsi2(0x40000000, 30); try test__ctzsi2(0x20000000, 29); try test__ctzsi2(0x10000000, 28); try test__ctzsi2(0x08000000, 27); try test__ctzsi2(0x04000000, 26); try test__ctzsi2(0x02000000, 25); try test__ctzsi2(0x01000000, 24); try test__ctzsi2(0x00800000, 23); try test__ctzsi2(0x00400000, 22); try test__ctzsi2(0x00200000, 21); try test__ctzsi2(0x00100000, 20); try test__ctzsi2(0x00080000, 19); try test__ctzsi2(0x00040000, 18); try test__ctzsi2(0x00020000, 17); try test__ctzsi2(0x00010000, 16); try test__ctzsi2(0x00008000, 15); try test__ctzsi2(0x00004000, 14); try test__ctzsi2(0x00002000, 13); try test__ctzsi2(0x00001000, 12); try test__ctzsi2(0x00000800, 11); try test__ctzsi2(0x00000400, 10); try test__ctzsi2(0x00000200, 9); try test__ctzsi2(0x00000100, 8); }
lib/std/special/compiler_rt/ctzsi2_test.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const nvg = @import("nanovg"); const gui = @import("../gui.zig"); const Rect = @import("../geometry.zig").Rect; const Self = @This(); widget: gui.Widget, allocator: *Allocator, has_grip: bool = false, separators: ArrayList(*gui.Widget), pub fn init(allocator: *Allocator, rect: Rect(f32)) !*Self { var self = try allocator.create(Self); self.* = Self{ .widget = gui.Widget.init(allocator, rect), .allocator = allocator, .separators = ArrayList(*gui.Widget).init(allocator), }; self.widget.drawFn = draw; return self; } pub fn deinit(self: *Self) void { for (self.separators.items) |widget| { self.allocator.destroy(widget); } self.separators.deinit(); self.widget.deinit(); self.allocator.destroy(self); } pub fn addButton(self: *Self, button: *gui.Button) !void { button.style = .toolbar; button.widget.focus_policy = gui.FocusPolicy.none(); button.widget.relative_rect.w = 20; button.widget.relative_rect.h = 20; try self.addWidget(&button.widget); } pub fn addSeparator(self: *Self) !void { var separator = try self.allocator.create(gui.Widget); separator.* = gui.Widget.init(self.allocator, Rect(f32).make(0, 0, 4, 20)); separator.drawFn = drawSeparator; try self.separators.append(separator); try self.addWidget(separator); } pub fn addWidget(self: *Self, widget: *gui.Widget) !void { const pad: f32 = 2; var x: f32 = 0; for (self.widget.children.items) |child| { x += pad + child.relative_rect.w; } widget.relative_rect.x = x + pad; widget.relative_rect.y = pad; try self.widget.addChild(widget); } fn drawSeparator(widget: *gui.Widget) void { const rect = widget.relative_rect; nvg.beginPath(); nvg.rect(rect.x + 1, rect.y + 1, 1, rect.h - 2); nvg.fillColor(gui.theme_colors.shadow); nvg.fill(); nvg.beginPath(); nvg.rect(rect.x + 2, rect.y + 1, 1, rect.h - 2); nvg.fillColor(gui.theme_colors.light); nvg.fill(); } fn draw(widget: *gui.Widget) void { const self = @fieldParentPtr(Self, "widget", widget); const rect = widget.relative_rect; gui.drawPanel(rect.x, rect.y, rect.w, rect.h, 1, false, false); if (self.has_grip) { drawGrip(rect.x + rect.w - 16, rect.y + rect.h - 16); } widget.drawChildren(); } fn drawGrip(x: f32, y: f32) void { nvg.scissor(x, y, 14, 14); defer nvg.resetScissor(); nvg.beginPath(); nvg.moveTo(x, y + 16); nvg.lineTo(x + 16, y); nvg.moveTo(x + 4, y + 16); nvg.lineTo(x + 4 + 16, y); nvg.moveTo(x + 8, y + 16); nvg.lineTo(x + 8 + 16, y); nvg.strokeColor(gui.theme_colors.light); nvg.stroke(); nvg.beginPath(); nvg.moveTo(x + 1, y + 16); nvg.lineTo(x + 1 + 16, y); nvg.moveTo(x + 5, y + 16); nvg.lineTo(x + 5 + 16, y); nvg.moveTo(x + 9, y + 16); nvg.lineTo(x + 9 + 16, y); nvg.strokeColor(gui.theme_colors.shadow); nvg.stroke(); }
src/gui/widgets/Toolbar.zig
const std = @import("std"); const assert = std.debug.assert; const mem = std.mem; const config = @import("config.zig"); const vr = @import("vr.zig"); const Header = vr.Header; const MessageBus = @import("message_bus.zig").MessageBusClient; const Message = @import("message_bus.zig").Message; const Operation = @import("state_machine.zig").Operation; const RingBuffer = @import("ring_buffer.zig").RingBuffer; const tb = @import("tigerbeetle.zig"); const Account = tb.Account; const Transfer = tb.Transfer; const Commit = tb.Commit; const CreateAccountResults = tb.CreateAccountResults; const CreateTransferResults = tb.CreateTransferResults; const CommitTransferResults = tb.CommitTransferResults; const log = std.log; pub const Client = struct { const Request = struct { const Callback = fn (user_data: u128, operation: Operation, results: []const u8) void; user_data: u128, callback: Callback, operation: Operation, message: *Message, }; allocator: *mem.Allocator, id: u128, cluster: u128, replica_count: u16, message_bus: *MessageBus, // TODO Track the latest view number received in .pong and .reply messages. // TODO Ask the cluster for our last request number. request_number: u32 = 0, /// Leave one Message free to receive with request_queue: RingBuffer(Request, config.message_bus_messages_max - 1) = .{}, request_timeout: vr.Timeout, ping_timeout: vr.Timeout, pub fn init( allocator: *mem.Allocator, id: u128, cluster: u128, replica_count: u16, message_bus: *MessageBus, ) !Client { assert(id > 0); assert(cluster > 0); var self = Client{ .allocator = allocator, .id = id, .cluster = cluster, .replica_count = replica_count, .message_bus = message_bus, .request_timeout = .{ .name = "request_timeout", .replica = std.math.maxInt(u16), .after = 10, }, .ping_timeout = .{ .name = "ping_timeout", .replica = std.math.maxInt(u16), .after = 10, }, }; self.ping_timeout.start(); return self; } pub fn deinit(self: *Client) void {} pub fn tick(self: *Client) void { self.message_bus.tick(); self.request_timeout.tick(); if (self.request_timeout.fired()) self.on_request_timeout(); self.ping_timeout.tick(); if (self.ping_timeout.fired()) self.on_ping_timeout(); // TODO Resend the request to the leader when the request_timeout fires. // This covers for dropped packets, when the leader is still the leader. // TODO Resend the request to the next replica and so on each time the reply_timeout fires. // This anticipates the next view change, without the cost of broadcast against the cluster. // TODO Tick ping_timeout and send ping if necessary to all replicas. // We need to keep doing this until we discover our latest request_number. // Thereafter, we can extend our ping_timeout considerably. // The cluster can use this ping information to do LRU eviction from the client table when // it is overflowed by the number of unique client IDs. // TODO Resend the request to the leader when the request_timeout fires. // This covers for dropped packets, when the leader is still the leader. // TODO Resend the request to the next replica and so on each time the reply_timeout fires. // This anticipates the next view change, without the cost of broadcast against the cluster. } /// A client is allowed at most one inflight request at a time, concurrent requests are queued. pub fn request( self: *Client, user_data: u128, callback: Request.Callback, operation: Operation, data: []const u8, ) void { const message = self.message_bus.get_message() orelse @panic("TODO: bubble up an error/drop the request"); self.init_message(message, operation, data); const was_empty = self.request_queue.empty(); self.request_queue.push(.{ .user_data = user_data, .callback = callback, .operation = operation, .message = message.ref(), }) catch { @panic("TODO: bubble up an error/drop the request"); }; // If the queue was empty, there is no currently inflight message, so send this one. if (was_empty) self.send_request(message); } fn on_request_timeout(self: *Client) void { const current_request = self.request_queue.peek() orelse return; self.send_request(current_request.message); } fn send_request(self: *Client, request_message: *Message) void { self.send_message_to_replicas(request_message); self.request_timeout.start(); } fn on_reply(self: *Client, reply: *Message) void { const done = self.request_queue.pop().?; done.callback(done.user_data, done.operation, reply.body()); self.message_bus.unref(done.message); self.request_timeout.stop(); if (self.request_queue.peek()) |next_request| { self.send_request(next_request.message); } } pub fn on_message(self: *Client, message: *Message) void { log.debug("{}: on_message: {}", .{ self.id, message.header }); if (message.header.invalid()) |reason| { log.debug("{}: on_message: invalid ({s})", .{ self.id, reason }); return; } if (message.header.cluster != self.cluster) { log.warn("{}: on_message: wrong cluster (message.header.cluster={} instead of {})", .{ self.id, message.header.cluster, self.cluster, }); return; } switch (message.header.command) { .reply => { if (message.header.request < self.request_number) { log.debug("{}: on_message: duplicate reply {}", .{ self.id, message.header.request }); return; } self.on_reply(message); }, .ping => self.on_ping(message), .pong => { // TODO: when we implement proper request number usage, we will // need to get the request number from a pong message on startup. }, else => { log.warn("{}: on_message: unexpected command {}", .{ self.id, message.header.command }); }, } } fn on_ping_timeout(self: *Client) void { self.ping_timeout.reset(); const ping = Header{ .command = .ping, .cluster = self.cluster, .client = self.id, }; self.send_header_to_replicas(ping); } fn on_ping(self: Client, ping: *const Message) void { const pong: Header = .{ .command = .pong, .cluster = self.cluster, .client = self.id, }; self.message_bus.send_header_to_replica(ping.header.replica, pong); } /// Initialize header fields and set the checksums fn init_message(self: Client, message: *Message, operation: Operation, data: []const u8) void { message.header.* = .{ .client = self.id, .cluster = self.cluster, .request = 1, // TODO: use request numbers properly .command = .request, .operation = operation, .size = @intCast(u32, @sizeOf(Header) + data.len), }; const body = message.buffer[@sizeOf(Header)..][0..data.len]; std.mem.copy(u8, body, data); message.header.set_checksum_body(body); message.header.set_checksum(); } fn send_message_to_leader(self: *Client, message: *Message) void { // TODO For this to work, we need to send pings to the cluster every N ticks. // Otherwise, the latest leader will have our connection.peer set to .unknown. // TODO Use the latest view number modulo the configuration length to find the leader. // For now, replica 0 will forward onto the latest leader. self.message_bus.send_message_to_replica(0, message); } fn send_message_to_replicas(self: *Client, message: *Message) void { var replica: u16 = 0; while (replica < self.replica_count) : (replica += 1) { self.message_bus.send_message_to_replica(replica, message); } } fn send_header_to_replicas(self: *Client, header: Header) void { var replica: u16 = 0; while (replica < self.replica_count) : (replica += 1) { self.message_bus.send_header_to_replica(replica, header); } } };
src/client.zig
const std = @import("std"); const debug = std.debug; const fmt = std.fmt; const io = std.io; const mem = std.mem; const os = std.os; const test_nums = []u32 { 2, 3, 0, 3, 10, 11, 12, 1, 1, 0, 1, 99, 2, 1, 1, 2, }; const debug_logging: bool = false; pub fn main() !void { var allocator = &std.heap.DirectAllocator.init().allocator; var nums: []u32 = undefined; { const input = try getFileContents(allocator, "input_08.txt"); defer allocator.free(input); nums = try getNums(allocator, input); } defer allocator.free(nums); const nodes = try deserializeNodes(allocator, nums); defer allocator.free(nodes); defer { // Yes, all this free-ing is rather silly for our purposes. Just // trying out defer. for (nodes) |n| { n.deinit(allocator); } } const result1 = sumAllMetadataEntries(nodes); debug.warn("08-1: {}\n", result1); const result2 = getRootNodeValue(nodes); debug.warn("08-2: {}\n", result2); } fn getRootNodeValue(nodes: []Node) u32 { var root_node = Node.linearSearch(nodes, 0) orelse unreachable; return getNodeValue(nodes, root_node); } fn getNodeValue(nodes: []Node, node: Node) u32 { var value: u32 = 0; if (node.num_children == 0) { value = node.sumMetadata(); } else { for (node.metadata_entries) |e| { if (e > 0 and e - 1 < node.child_ids.len) { var child_id = node.child_ids[e - 1]; var child = Node.linearSearch(nodes, child_id) orelse unreachable; value += getNodeValue(nodes, child); } } } return value; } test "deserialize and get root node value" { var allocator = debug.global_allocator; var nodes = try deserializeNodes(allocator, test_nums); debug.assert(66 == getRootNodeValue(nodes)); } fn sumAllMetadataEntries(nodes: []Node) u32 { var metadata_sum: u32 = 0; for (nodes) |n| { for (n.metadata_entries) |e| { metadata_sum += e; } } return metadata_sum; } /// Caller is responsible for freeing returned nodes. fn deserializeNodes(allocator: *mem.Allocator, nums: []const u32) ![]Node { const Task = enum { GetHeader, Descend, Ascend, GetMetadata, }; var nodes = std.ArrayList(Node).init(allocator); // I need to manage this myself since I've decided not to use recursion var node_stack = std.ArrayList(Node).init(allocator); defer node_stack.deinit(); // This is only to get the process started, and should never be included in // the returned list of nodes var root_node = Node { .id = 0, .num_children = 1, .num_metadata = 0, .num_children_found = 0, .child_ids = try allocator.alloc(usize, 1), .metadata_entries = undefined, }; var parent_node: Node = root_node; var current_node: Node = undefined; var task: Task = Task.GetHeader; var num_index: usize = 0; while (num_index < nums.len) { logDebug("# {}\n", @tagName(task)); switch (task) { Task.GetHeader => { var node_index = num_index; var num_children = consumeNum(nums, &num_index); var num_metadata = consumeNum(nums, &num_index); current_node = try Node.init(node_index, num_children, num_metadata, allocator); parent_node.child_ids[parent_node.num_children_found] = current_node.id; if (current_node.num_children != 0) { task = Task.Descend; } else { task = Task.GetMetadata; } }, Task.Descend => { try node_stack.append(parent_node); parent_node = current_node; task = Task.GetHeader; }, Task.Ascend => { current_node = parent_node; parent_node = node_stack.pop(); task = Task.GetMetadata; }, Task.GetMetadata => { for (current_node.metadata_entries) |*e| { e.* = consumeNum(nums, &num_index); } try nodes.append(current_node); parent_node.num_children_found += 1; if (parent_node.num_children_found < parent_node.num_children) { task = Task.GetHeader; } else if (parent_node.num_children_found == parent_node.num_children) { task = Task.Ascend; } else { unreachable; } }, else => unreachable, } logDebug("P"); parent_node.print(); logDebug("C"); current_node.print(); } return nodes.toSlice(); } test "deserialize and sum metadata" { var allocator = debug.global_allocator; var nodes = try deserializeNodes(allocator, test_nums); debug.assert(138 == sumAllMetadataEntries(nodes)); } // I was tempted to call this numNum fn consumeNum(nums: []const u32, index: *usize) u32 { var num = nums[index.*]; index.* += 1; return num; } const Node = struct { id: usize, num_children: u32, num_metadata: u32, num_children_found: u32, child_ids: []usize, metadata_entries: []u32, pub fn init(id: usize, nc: u32, nm: u32, allocator: *mem.Allocator) !Node { var ci_buf = try allocator.alloc(usize, nc); for (ci_buf) |*ci| { ci.* = 0; } var me_buf = try allocator.alloc(u32, nm); for (me_buf) |*e| { e.* = 0; } return Node { .id = id, .num_children = nc, .num_metadata = nm, .num_children_found = 0, .child_ids = ci_buf, .metadata_entries = me_buf, }; } pub fn deinit(self: Node, allocator: *mem.Allocator) void { allocator.free(self.child_ids); allocator.free(self.metadata_entries); } pub fn print(self: Node) void { logDebug("[{}]: ({}/{}, {}) | ", self.id, self.num_children_found, self.num_children, self.num_metadata); for (self.metadata_entries) |e| { logDebug("{} ", e); } logDebug("| ("); for (self.child_ids) |c| { logDebug("{} ", c); } logDebug(")\n"); } pub fn lessThan(l: Node, r: Node) bool { return l.id < r.id; } pub fn linearSearch(nodes: []Node, node_id: usize) ?Node { for (nodes) |n, i| { if (n.id == node_id) { return n; } } return null; } pub fn sumMetadata(self: Node) u32 { var sum: u32 = 0; for (self.metadata_entries) |e| { sum += e; } return sum; } }; fn getNums(allocator: *mem.Allocator, buf: []const u8) ![]u32 { var it = mem.split(buf, []u8 { ' ', '\n', }); var nodes = std.ArrayList(u32).init(allocator); while (it.next()) |token| { var num = try fmt.parseInt(u32, token, 10); try nodes.append(num); } return nodes.toSlice(); } test "get nums" { var allocator = debug.global_allocator; const test_buf = "2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2"; debug.assert(mem.eql(u32, test_nums, try getNums(allocator, test_buf))); } fn getFileContents(allocator: *mem.Allocator, file_name: []const u8) ![]u8 { var file = try os.File.openRead(file_name); defer file.close(); const file_size = try file.getEndPos(); var file_in_stream = io.FileInStream.init(file); var buf_stream = io.BufferedInStream(io.FileInStream.Error).init(&file_in_stream.stream); const st = &buf_stream.stream; return try st.readAllAlloc(allocator, 2 * file_size); } fn logDebug(comptime format_str: []const u8, args: ...) void { if (debug_logging) { debug.warn(format_str, args); } }
2018/day_08.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const Entry = @import("entry.zig").Entry; const Options = @import("Options.zig"); const PathDirTuple = struct { iter: std.fs.Dir.Iterator, path: []const u8, }; pub const DepthFirstWalker = struct { start_path: []const u8, recurse_stack: ArrayList(PathDirTuple), allocator: Allocator, max_depth: ?usize, hidden: bool, current_dir: std.fs.Dir, current_iter: std.fs.Dir.Iterator, current_path: []const u8, current_depth: usize, pub const Self = @This(); pub fn init(allocator: Allocator, path: []const u8, options: Options) !Self { var top_dir = try std.fs.cwd().openDir(path, .{ .iterate = true }); return Self{ .start_path = path, .recurse_stack = ArrayList(PathDirTuple).init(allocator), .allocator = allocator, .max_depth = options.max_depth, .hidden = options.include_hidden, .current_dir = top_dir, .current_iter = top_dir.iterate(), .current_path = try allocator.dupe(u8, path), .current_depth = 0, }; } pub fn next(self: *Self) !?Entry { outer: while (true) { if (try self.current_iter.next()) |entry| { // Check if the entry is hidden if (!self.hidden and entry.name[0] == '.') { continue :outer; } const full_entry_path = try self.allocator.alloc(u8, self.current_path.len + entry.name.len + 1); std.mem.copy(u8, full_entry_path, self.current_path); full_entry_path[self.current_path.len] = std.fs.path.sep; std.mem.copy(u8, full_entry_path[self.current_path.len + 1 ..], entry.name); const relative_path = full_entry_path[self.start_path.len + 1 ..]; const name = full_entry_path[self.current_path.len + 1 ..]; blk: { if (entry.kind == std.fs.Dir.Entry.Kind.Directory) { if (self.max_depth) |max_depth| { if (self.current_depth >= max_depth) { break :blk; } } // Save the current opened directory to the stack // so we continue traversing it later on try self.recurse_stack.append(PathDirTuple{ .iter = self.current_iter, .path = self.current_path, }); // Go one level deeper var opened_dir = try std.fs.cwd().openDir(full_entry_path, .{ .iterate = true }); self.current_path = try self.allocator.dupe(u8, full_entry_path); self.current_dir = opened_dir; self.current_iter = opened_dir.iterate(); self.current_depth += 1; } } return Entry{ .allocator = self.allocator, .name = name, .absolute_path = full_entry_path, .relative_path = relative_path, .kind = entry.kind, }; } else { // No entries left in the current dir self.current_dir.close(); self.allocator.free(self.current_path); if (self.recurse_stack.popOrNull()) |node| { // Go back up one level again self.current_dir = node.iter.dir; self.current_iter = node.iter; self.current_path = node.path; self.current_depth -= 1; continue :outer; } return null; } } } pub fn deinit(self: *Self) void { self.recurse_stack.deinit(); } };
src/depth_first.zig
const std = @import("std"); pub fn Scanner(comptime InputType: type, max_buffer_size_: anytype) type { return struct { const Self = @This(); const TestData = struct { read_count: usize = 0, }; /// The input to read for scanning -- we own this for the following reasons: /// 1. The .offset field of a Token is based on where we are in the input. If some other /// code owns the input, they have control over the input's underlying cursor from /// calls like `input.seekTo`. We want control over the input's underlying cursor, thus /// we want to own the input itself. /// 2. For same reason as #1, the current line number may also be faulty if some other /// code owns the input and seeks past one or more newlines before the scanner does /// another read. input: *InputType, /// Where we are in the input input_cursor: u64 = 0, /// The reader for the input reader: typeblk: { inline for (@typeInfo(InputType).Struct.decls) |decl| { if (std.mem.eql(u8, "reader", decl.name)) { break :typeblk decl.data.Fn.return_type; } } @compileError("Unable to get reader type for Scanner"); }, /// The buffer which the input's reader will read to buffer: [max_buffer_size_]u8 = undefined, /// The current number of bytes read into the buffer buffer_size: usize = 0, /// Where we are in the current buffer buffer_cursor: usize = 0, /// Whether we've already encountered EOF - so we can skip unnecessary syscalls eof_in_buffer: bool = false, /// The line where the current token lives (we start at the first line) current_line: usize = 1, test_data: TestData = TestData{}, pub fn init(input_: *InputType) Self { return Self{ .input = input_, .reader = input_.reader(), }; } pub fn deinit(self: *Self) void { self.input.close(); } /// Ensures that there are bytes in the buffer and advances the input and buffer cursors /// forward by one byte. If there are no more bytes to read from then this returns `null` /// otherwise it returns the byte previously pointed to by the buffer cursor. pub fn advance(self: *Self) ?u8 { if (!self.ensureBufferHasBytes()) { return null; } self.input_cursor += 1; self.buffer_cursor += 1; const byte = self.buffer[self.buffer_cursor - 1]; if (byte == '\n') self.current_line += 1; return byte; } /// Returns the byte at the buffer cursor, or `null` if there aren't any more bytes to read /// or when we encounter an error while reading. pub fn peek(self: *Self) ?u8 { if (!self.ensureBufferHasBytes()) { return null; } return self.buffer[self.buffer_cursor]; } /// Returns the byte after the buffer cursor, or `null` if there aren't any more bytes to /// read or when we encounter an error while reading. pub fn peekNext(self: *Self) ?u8 { if (self.buffer_cursor + 1 == self.buffer_size) { // this is a special case where we need to see one byte past the end of the buffer // but we don't want to mess anything up, so we reset back to our original position // after this "extended" read const orig_pos = self.input.getPos() catch |err| { std.log.err("Unable to get input position: {}", .{err}); return null; }; const byte = self.reader.readByte() catch |err| { if (err != error.EndOfStream) { std.log.err("Unable to read byte: {}", .{err}); } return null; }; self.input.seekTo(orig_pos) catch |err| { std.log.err("Unable to seek to input's original position: {}", .{err}); return null; }; return byte; } if (!self.ensureBufferHasBytes()) { return null; } return self.buffer[self.buffer_cursor + 1]; } pub fn readFrom(self: *Self, start_: u64, size_: u64, arrayList_: *std.ArrayList(u8)) !u64 { const orig_pos = try self.input.getPos(); try self.input.seekTo(start_); var buf: [1024]u8 = undefined; var remaining_bytes = size_; while (remaining_bytes > 0) { const bytes_read = try self.reader.read(&buf); const size = std.math.min(bytes_read, remaining_bytes); try arrayList_.appendSlice(buf[0..size]); remaining_bytes -= size; } self.input.seekTo(orig_pos) catch |err| { // if there's more for us to read, then this error puts us in a bad state, so return it if (!self.eof_in_buffer) { return err; } }; return size_ - remaining_bytes; } /// Fill the buffer with some bytes from the input's reader if necessary, and report whether /// there bytes left to read. fn ensureBufferHasBytes(self: *Self) bool { if (self.buffer_cursor == self.buffer_size and !self.eof_in_buffer) { if (self.reader.read(&self.buffer)) |count| { self.buffer_size = count; } else |err| { std.log.err("Encountered error while reading: {}", .{err}); self.buffer_size = 0; } self.buffer_cursor = 0; self.eof_in_buffer = self.buffer_size < max_buffer_size_; self.test_data.read_count += 1; } return self.buffer_cursor < self.buffer_size; } }; } //============================================================================== // // // // Testing //============================================================================== const testing = std.testing; const test_allocator = testing.allocator; const StringReader = @import("string_reader.zig").StringReader; const test_buffer_size: usize = 5; const StringScanner = Scanner(StringReader, test_buffer_size); test "scanner" { const str = \\Hello, \\ World! ; var string_reader = StringReader{ .str = str }; var scanner = StringScanner.init(&string_reader); errdefer { std.log.err( \\ \\input_cursor = {} \\buffer = {s} \\buffer_cursor = {} \\ , .{ scanner.input_cursor, scanner.buffer, scanner.buffer_cursor, }); } defer scanner.deinit(); try testing.expectEqual(@as(usize, 0), scanner.test_data.read_count); try testing.expectEqual(@as(usize, 1), scanner.current_line); try testing.expectEqual(false, scanner.eof_in_buffer); try testing.expectEqual(@as(u8, 'H'), scanner.advance().?); try testing.expectEqual(@as(u8, 'e'), scanner.advance().?); try testing.expectEqual(@as(u8, 'l'), scanner.advance().?); try testing.expectEqual(@as(u8, 'l'), scanner.advance().?); try testing.expectEqual(@as(u8, 'o'), scanner.peek().?); try testing.expectEqual(@as(u8, ','), scanner.peekNext().?); try testing.expectEqual(@as(u8, 'o'), scanner.advance().?); try testing.expectEqual(@as(usize, 1), scanner.test_data.read_count); try testing.expectEqual(@as(usize, 1), scanner.current_line); try testing.expectEqual(@as(u64, 5), scanner.input_cursor); try testing.expectEqual(@as(u64, 5), scanner.buffer_cursor); try testing.expectEqual(false, scanner.eof_in_buffer); try testing.expectEqual(@as(u8, ','), scanner.peek().?); try testing.expectEqual(@as(u8, '\n'), scanner.peekNext().?); try testing.expectEqual(@as(u8, ','), scanner.advance().?); try testing.expectEqual(@as(u8, '\n'), scanner.advance().?); try testing.expectEqual(@as(u8, ' '), scanner.advance().?); var slice = std.ArrayList(u8).init(test_allocator); defer slice.deinit(); const bytes_read = try scanner.readFrom(2, 3, &slice); try testing.expectEqual(@as(usize, 3), bytes_read); try testing.expectEqual(@as(usize, 3), slice.items.len); try testing.expectEqual(@as(u64, 8), scanner.input_cursor); try testing.expectEqualStrings("llo", slice.items); try testing.expectEqual(@as(u8, 'W'), scanner.advance().?); try testing.expectEqual(@as(u8, 'o'), scanner.advance().?); try testing.expectEqual(@as(usize, 2), scanner.test_data.read_count); try testing.expectEqual(@as(usize, 2), scanner.current_line); try testing.expectEqual(@as(u64, 10), scanner.input_cursor); try testing.expectEqual(@as(u64, 5), scanner.buffer_cursor); try testing.expectEqual(false, scanner.eof_in_buffer); try testing.expectEqual(@as(u8, 'l'), scanner.peekNext().?); try testing.expectEqual(@as(u8, 'r'), scanner.advance().?); try testing.expectEqual(@as(u8, 'l'), scanner.advance().?); try testing.expectEqual(@as(u8, 'd'), scanner.advance().?); try testing.expectEqual(@as(u8, '!'), scanner.advance().?); try testing.expectEqual(@as(usize, 3), scanner.test_data.read_count); try testing.expectEqual(@as(usize, 2), scanner.current_line); try testing.expectEqual(true, scanner.eof_in_buffer); try testing.expectEqual(@as(?u8, null), scanner.peek()); try testing.expectEqual(@as(?u8, null), scanner.peekNext()); try testing.expectEqual(@as(?u8, null), scanner.advance()); try testing.expectEqual(@as(usize, 3), scanner.test_data.read_count); try testing.expectEqual(@as(usize, 2), scanner.current_line); try testing.expectEqual(true, scanner.eof_in_buffer); }
src/scan.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const print = std.debug.print; const data = @embedFile("../inputs/day18.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 nums = try parse(allocator, data); defer { for (nums.items) |n| { n.deinit(); } nums.deinit(); } print("Part 1: {d}\n", .{try part1(allocator, nums.items)}); print("Part 2: {d}\n", .{try part2(allocator, nums.items)}); } fn parse(allocator: Allocator, input: []const u8) !std.ArrayList(SnailFish) { var out = std.ArrayList(SnailFish).init(allocator); errdefer { for (out.items) |n| { n.deinit(); } out.deinit(); } var lines = std.mem.tokenize(u8, input, "\n"); while (lines.next()) |line| { try out.append(try SnailFish.parse(allocator, line)); } return out; } const ExplodeValue = struct { left: ?u8, right: ?u8, }; const Node = union(enum) { const Self = @This(); single: u8, pair: Pair, fn parse(allocator: Allocator, input: []const u8) !Self { if (input[0] == '[') return Self{ .pair = try Pair.parse(allocator, input) }; return Self{ .single = try std.fmt.parseInt(u8, input, 10) }; } fn magnitude(self: Self) usize { switch (self) { .single => |x| return x, .pair => |p| return p.magnitude(), } } fn clone(self: Self, allocator: Allocator) !Self { switch (self) { .single => |s| return Self{ .single = s }, .pair => |p| return Self{ .pair = try p.clone(allocator) }, } } fn explode(self: *Self, current_depth: usize) ?ExplodeValue { if (self.* == Self.pair) { if (current_depth < 4) { return self.pair.explode(current_depth + 1); } else { // Check it's not too deep std.debug.assert(self.pair.left.* == Self.single); std.debug.assert(self.pair.right.* == Self.single); const ret = ExplodeValue{ .left = self.pair.left.single, .right = self.pair.right.single, }; self.* = Self{ .single = 0 }; return ret; } } else return null; } fn add_left(self: *Self, value: u8) void { switch (self.*) { .single => |*s| s.* += value, .pair => |*p| p.left.add_left(value), } } fn add_right(self: *Self, value: u8) void { switch (self.*) { .single => |*s| s.* += value, .pair => |*p| p.right.add_right(value), } } fn split(self: *Self, allocator: Allocator) !bool { switch (self.*) { .single => |s| { if (s >= 10) { const half = s / 2; const new = try Pair.init_undefined(allocator); new.left.* = Self{ .single = half }; new.right.* = Self{ .single = s - half }; self.* = Self{ .pair = new }; return true; } else { return false; } }, .pair => |*p| return try p.split(allocator), } } fn print(self: Self) void { switch (self) { .single => |s| std.debug.print("{d}", .{s}), .pair => |p| p.print(), } } }; const Pair = struct { const Self = @This(); left: *Node, right: *Node, fn deinit(self: Self, allocator: Allocator) void { allocator.destroy(self.left); allocator.destroy(self.right); } fn init_undefined(allocator: Allocator) !Self { var left = try allocator.create(Node); errdefer allocator.destroy(left); var right = try allocator.create(Node); errdefer allocator.destroy(left); return Self{ .left = left, .right = right, }; } fn parse(allocator: Allocator, input: []const u8) anyerror!Self { if (input[0] != '[' or input[input.len - 1] != ']') return error.InvalidPair; const inner = input[1 .. input.len - 1]; var split_idx: usize = 0; var count: usize = 0; for (inner) |c, i| { switch (c) { '[' => { count += 1; }, ']' => { if (count == 0) return error.InvalidNode; count -= 1; }, ',' => { if (count == 0) { split_idx = i; break; } }, else => {}, } } var new = try Self.init_undefined(allocator); new.left.* = try Node.parse(allocator, inner[0..split_idx]); new.right.* = try Node.parse(allocator, inner[split_idx + 1 ..]); return new; } fn magnitude(self: Self) usize { return 3 * self.left.magnitude() + 2 * self.right.magnitude(); } fn clone(self: Self, allocator: Allocator) anyerror!Self { var new = try Self.init_undefined(allocator); errdefer new.deinit(allocator); new.left.* = try self.left.clone(allocator); new.right.* = try self.right.clone(allocator); return new; } fn explode(self: *Self, current_depth: usize) ?ExplodeValue { var ret = ExplodeValue{ .left = null, .right = null, }; var left_value = self.left.explode(current_depth); if (left_value) |l_value| { ret.left = l_value.left; if (l_value.right) |v| self.right.add_left(v); } var right_value = self.right.explode(current_depth); if (right_value) |r_value| { if (r_value.left) |v| self.left.add_right(v); ret.right = r_value.right; } if (ret.left == null and ret.right == null) return null; return ret; } fn split(self: *Self, allocator: Allocator) anyerror!bool { if (try self.left.split(allocator)) return true; return try self.right.split(allocator); } fn print(self: Self) void { std.debug.print("[", .{}); self.left.print(); std.debug.print(",", .{}); self.right.print(); std.debug.print("]", .{}); } }; const SnailFish = struct { const Self = @This(); arena: std.heap.ArenaAllocator, root: Pair, fn deinit(self: Self) void { self.arena.deinit(); } fn parse(allocator: Allocator, input: []const u8) !Self { var arena = std.heap.ArenaAllocator.init(allocator); errdefer arena.deinit(); const root = try Pair.parse(arena.allocator(), input); return Self{ .arena = arena, .root = root, }; } fn magnitude(self: Self) usize { return self.root.magnitude(); } fn reduce(self: *Self) !void { _ = self.root.explode(1); while (try self.root.split(self.arena.allocator())) { _ = self.root.explode(1); } } fn clone_into(self: Self, allocator: Allocator) !Self { var arena = std.heap.ArenaAllocator.init(allocator); errdefer arena.deinit(); const root = try self.root.clone(arena.allocator()); return Self{ .arena = arena, .root = root, }; } fn add(self: *Self, other: Self) !void { const allocator = self.arena.allocator(); var new_root = try Pair.init_undefined(allocator); errdefer new_root.deinit(allocator); new_root.left.* = Node{ .pair = self.root }; new_root.right.* = Node{ .pair = try other.root.clone(allocator) }; self.root = new_root; try self.reduce(); } fn print(self: Self) void { self.root.print(); std.debug.print("\n", .{}); } }; fn part1(allocator: Allocator, nums: []SnailFish) !usize { var sum = try nums[0].clone_into(allocator); defer sum.deinit(); for (nums[1..]) |n| { try sum.add(n); } return sum.magnitude(); } fn part2(allocator: Allocator, nums: []SnailFish) !usize { var max: usize = 0; for (nums[0..]) |x, i| { for (nums[i + 1 ..]) |y| { { var temp = try x.clone_into(allocator); defer temp.deinit(); try temp.add(y); max = std.math.max(max, temp.magnitude()); } { var temp = try y.clone_into(allocator); defer temp.deinit(); try temp.add(x); max = std.math.max(max, temp.magnitude()); } } } return max; } test "snailfish: parse & magnitude" { const allocator = std.testing.allocator; const n1 = try SnailFish.parse(allocator, "[[1,2],[[3,4],5]]"); defer n1.deinit(); try std.testing.expectEqual(@as(usize, 143), n1.magnitude()); const n2 = try SnailFish.parse(allocator, "[[[[0,7],4],[[7,8],[6,0]]],[8,1]]"); defer n2.deinit(); try std.testing.expectEqual(@as(usize, 1384), n2.magnitude()); const n3 = try SnailFish.parse(allocator, "[[[[1,1],[2,2]],[3,3]],[4,4]]"); defer n3.deinit(); try std.testing.expectEqual(@as(usize, 445), n3.magnitude()); const n4 = try SnailFish.parse(allocator, "[[[[3,0],[5,3]],[4,4]],[5,5]]"); defer n4.deinit(); try std.testing.expectEqual(@as(usize, 791), n4.magnitude()); const n5 = try SnailFish.parse(allocator, "[[[[5,0],[7,4]],[5,5]],[6,6]]"); defer n5.deinit(); try std.testing.expectEqual(@as(usize, 1137), n5.magnitude()); const n6 = try SnailFish.parse(allocator, "[[[[8,7],[7,7]],[[8,6],[7,7]]],[[[0,7],[6,6]],[8,7]]]"); defer n6.deinit(); try std.testing.expectEqual(@as(usize, 3488), n6.magnitude()); } test "snailfish: parse, sum and magnitude" { const input = \\[[[0,[5,8]],[[1,7],[9,6]]],[[4,[1,2]],[[1,4],2]]] \\[[[5,[2,8]],4],[5,[[9,9],0]]] \\[6,[[[6,2],[5,6]],[[7,6],[4,7]]]] \\[[[6,[0,7]],[0,9]],[4,[9,[9,0]]]] \\[[[7,[6,4]],[3,[1,3]]],[[[5,5],1],9]] \\[[6,[[7,3],[3,2]]],[[[3,8],[5,7]],4]] \\[[[[5,4],[7,7]],8],[[8,3],8]] \\[[9,3],[[9,9],[6,[4,9]]]] \\[[2,[[7,7],7]],[[5,8],[[9,3],[0,2]]]] \\[[[[5,2],5],[8,[3,7]]],[[5,[7,5]],[4,4]]] ; const allocator = std.testing.allocator; const nums = try parse(allocator, input); defer { for (nums.items) |n| { n.deinit(); } nums.deinit(); } try std.testing.expectEqual(@as(usize, 4140), try part1(allocator, nums.items)); try std.testing.expectEqual(@as(usize, 3993), try part2(allocator, nums.items)); }
src/day18.zig
const x86_64 = @import("index.zig"); const bitjuggle = @import("bitjuggle"); const std = @import("std"); const PageTableIndex = x86_64.structures.paging.PageTableIndex; const PageOffset = x86_64.structures.paging.PageOffset; /// A canonical 64-bit virtual memory address. /// /// On `x86_64`, only the 48 lower bits of a virtual address can be used. The top 16 bits need /// to be copies of bit 47, i.e. the most significant bit. Addresses that fulfil this criterium /// are called β€œcanonical”. This type guarantees that it always represents a canonical address. pub const VirtAddr = packed struct { value: u64, /// Tries to create a new canonical virtual address. /// /// If required this function performs sign extension of bit 47 to make the address canonical. pub fn init(addr: u64) error{VirtAddrNotValid}!VirtAddr { return switch (bitjuggle.getBits(addr, 47, 17)) { 0, 0x1ffff => VirtAddr{ .value = addr }, 1 => initTruncate(addr), else => return error.VirtAddrNotValid, }; } /// Creates a new canonical virtual address. /// /// If required this function performs sign extension of bit 47 to make the address canonical. /// /// ## Panics /// This function panics if the bits in the range 48 to 64 contain data (i.e. are not null and no sign extension). pub fn initPanic(addr: u64) VirtAddr { return init(addr) catch @panic("address passed to VirtAddr.init_panic must not contain any data in bits 48 to 64"); } /// Creates a new canonical virtual address, throwing out bits 48..64. /// /// If required this function performs sign extension of bit 47 to make the address canonical. pub fn initTruncate(addr: u64) VirtAddr { // By doing the right shift as a signed operation (on a i64), it will // sign extend the value, repeating the leftmost bit. // Split into individual ops: // const no_high_bits = addr << 16; // const as_i64 = @bitCast(i64, no_high_bits); // const sign_extend_high_bits = as_i64 >> 16; // const value = @bitCast(u64, sign_extend_high_bits); return VirtAddr{ .value = @bitCast(u64, @bitCast(i64, (addr << 16)) >> 16) }; } /// Creates a new virtual address, without any checks. pub fn initUnchecked(addr: u64) VirtAddr { return .{ .value = addr }; } /// Creates a virtual address that points to `0`. pub fn zero() VirtAddr { return .{ .value = 0 }; } /// Convenience method for checking if a virtual address is null. pub fn isNull(self: VirtAddr) bool { return self.value == 0; } /// Creates a virtual address from the given pointer /// Panics if the given pointer is not a valid virtual address, this should never happen in reality pub fn fromPtr(ptr: anytype) VirtAddr { comptime if (@typeInfo(@TypeOf(ptr)) != .Pointer) @compileError("not a pointer"); return initPanic(@ptrToInt(ptr)); } /// Converts the address to a pointer. pub fn toPtr(self: VirtAddr, comptime T: type) T { return @intToPtr(T, self.value); } /// Aligns the virtual address upwards to the given alignment. /// The alignment must be a power of 2 and greater than 0. pub fn alignUp(self: VirtAddr, alignment: usize) VirtAddr { return .{ .value = std.mem.alignForward(self.value, alignment) }; } /// Aligns the virtual address downwards to the given alignment. /// The alignment must be a power of 2 and greater than 0. pub fn alignDown(self: VirtAddr, alignment: usize) VirtAddr { return .{ .value = std.mem.alignBackward(self.value, alignment) }; } /// Checks whether the virtual address has the given alignment. /// The alignment must be a power of 2 and greater than 0. pub fn isAligned(self: VirtAddr, alignment: usize) bool { return std.mem.isAligned(self.value, alignment); } /// Returns the 12-bit page offset of this virtual address. pub fn pageOffset(self: VirtAddr) PageOffset { return PageOffset.init(@truncate(u12, self.value)); } /// Returns the 9-bit level 1 page table index. pub fn p1Index(self: VirtAddr) PageTableIndex { return PageTableIndex.init(@truncate(u9, self.value >> 12)); } /// Returns the 9-bit level 2 page table index. pub fn p2Index(self: VirtAddr) PageTableIndex { return PageTableIndex.init(@truncate(u9, self.value >> 21)); } /// Returns the 9-bit level 3 page table index. pub fn p3Index(self: VirtAddr) PageTableIndex { return PageTableIndex.init(@truncate(u9, self.value >> 30)); } /// Returns the 9-bit level 4 page table index. pub fn p4Index(self: VirtAddr) PageTableIndex { return PageTableIndex.init(@truncate(u9, self.value >> 39)); } pub fn format(value: VirtAddr, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; _ = options; try writer.print("VirtAddr(0x{x})", .{value.value}); } test { std.testing.refAllDecls(@This()); try std.testing.expectEqual(@bitSizeOf(u64), @bitSizeOf(VirtAddr)); try std.testing.expectEqual(@sizeOf(u64), @sizeOf(VirtAddr)); } }; test "VirtAddr.initTruncate" { var virtAddr = VirtAddr.initTruncate(0); try std.testing.expectEqual(@as(u64, 0), virtAddr.value); virtAddr = VirtAddr.initTruncate(1 << 47); try std.testing.expectEqual(@truncate(u64, 0xfffff << 47), virtAddr.value); virtAddr = VirtAddr.initTruncate(123); try std.testing.expectEqual(@as(u64, 123), virtAddr.value); virtAddr = VirtAddr.initTruncate(123 << 47); try std.testing.expectEqual(@truncate(u64, 0xfffff << 47), virtAddr.value); } test "VirtAddr.init" { var virtAddr = try VirtAddr.init(0); try std.testing.expectEqual(@as(u64, 0), virtAddr.value); virtAddr = try VirtAddr.init(1 << 47); try std.testing.expectEqual(@truncate(u64, 0xfffff << 47), virtAddr.value); virtAddr = try VirtAddr.init(123); try std.testing.expectEqual(@as(u64, 123), virtAddr.value); try std.testing.expectError(error.VirtAddrNotValid, VirtAddr.init(123 << 47)); } test "VirtAddr.fromPtr" { var something: usize = undefined; var somethingelse: usize = undefined; var virtAddr = VirtAddr.fromPtr(&something); try std.testing.expectEqual(@ptrToInt(&something), virtAddr.value); virtAddr = VirtAddr.fromPtr(&somethingelse); try std.testing.expectEqual(@ptrToInt(&somethingelse), virtAddr.value); } test "VirtAddr.toPtr" { var something: usize = undefined; var virtAddr = VirtAddr.fromPtr(&something); const ptr = virtAddr.toPtr(*usize); ptr.* = 123; try std.testing.expectEqual(@as(usize, 123), something); } test "VirtAddr.pageOffset/Index" { var something: usize = undefined; var virtAddr = VirtAddr.fromPtr(&something); try std.testing.expectEqual(bitjuggle.getBits(virtAddr.value, 0, 12), virtAddr.pageOffset().value); try std.testing.expectEqual(bitjuggle.getBits(virtAddr.value, 12, 9), virtAddr.p1Index().value); try std.testing.expectEqual(bitjuggle.getBits(virtAddr.value, 21, 9), virtAddr.p2Index().value); try std.testing.expectEqual(bitjuggle.getBits(virtAddr.value, 30, 9), virtAddr.p3Index().value); try std.testing.expectEqual(bitjuggle.getBits(virtAddr.value, 39, 9), virtAddr.p4Index().value); } /// A 64-bit physical memory address. /// /// On `x86_64`, only the 52 lower bits of a physical address can be used. The top 12 bits need /// to be zero. This type guarantees that it always represents a valid physical address. pub const PhysAddr = packed struct { value: u64, /// Tries to create a new physical address. /// /// Fails if any bits in the range 52 to 64 are set. pub fn init(addr: u64) error{PhysAddrNotValid}!PhysAddr { return switch (bitjuggle.getBits(addr, 52, 12)) { 0 => PhysAddr{ .value = addr }, else => return error.PhysAddrNotValid, }; } /// Creates a new physical address. /// /// ## Panics /// This function panics if a bit in the range 52 to 64 is set. pub fn initPanic(addr: u64) PhysAddr { return init(addr) catch @panic("physical addresses must not have any bits in the range 52 to 64 set"); } const TRUNCATE_CONST: u64 = 1 << 52; /// Creates a new physical address, throwing bits 52..64 away. pub fn initTruncate(addr: u64) PhysAddr { return PhysAddr{ .value = addr % TRUNCATE_CONST }; } /// Creates a new physical address, without any checks. pub fn initUnchecked(addr: u64) PhysAddr { return .{ .value = addr }; } /// Creates a physical address that points to `0`. pub fn zero() PhysAddr { return .{ .value = 0 }; } /// Convenience method for checking if a physical address is null. pub fn isNull(self: PhysAddr) bool { return self.value == 0; } /// Aligns the physical address upwards to the given alignment. /// The alignment must be a power of 2 and greater than 0. pub fn alignUp(self: PhysAddr, alignment: usize) PhysAddr { return .{ .value = std.mem.alignForward(self.value, alignment) }; } /// Aligns the physical address downwards to the given alignment. /// The alignment must be a power of 2 and greater than 0. pub fn alignDown(self: PhysAddr, alignment: usize) PhysAddr { return .{ .value = std.mem.alignBackward(self.value, alignment) }; } /// Checks whether the physical address has the given alignment. /// The alignment must be a power of 2 and greater than 0. pub fn isAligned(self: PhysAddr, alignment: usize) bool { return std.mem.isAligned(self.value, alignment); } pub fn format(value: PhysAddr, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { _ = fmt; _ = options; try writer.print("PhysAddr(0x{x})", .{value.value}); } test { std.testing.refAllDecls(@This()); try std.testing.expectEqual(@bitSizeOf(u64), @bitSizeOf(PhysAddr)); try std.testing.expectEqual(@sizeOf(u64), @sizeOf(PhysAddr)); } }; comptime { std.testing.refAllDecls(@This()); }
src/addr.zig
const std = @import("std"); const platform = @import("platform.zig"); const util = @import("util.zig"); const Cookie = util.Cookie; const RefCount = util.RefCount; pub const max_name_len = 256; pub const max_path_len = 4096; pub const Error = error{ NotImplemented, NotDirectory, NotFile, NoSuchFile, FileExists, NotEmpty, ReadFailed, WriteFailed, Again, PathTooLong }; /// Node represents a FileSystem VNode /// There should only be ONE VNode in memory per file at a time! /// Any other situation may cause unexpected results! pub const Node = struct { pub const Mode = packed struct { // Remember, LSB first! exec, write, read (xwr) & everyone, group, user (egu) order! // TODO: care about big-endian systems const RWX = packed struct { x: bool = false, w: bool = false, r: bool = false }; all: Node.Mode.RWX = .{}, grp: Node.Mode.RWX = .{}, usr: Node.Mode.RWX = .{}, _padding: u7 = 0, pub fn init(val: u16) Mode { var m: Mode = .{}; m.set(val); return m; } pub fn get(self: *const Mode) u16 { return @ptrCast(*u16, self).*; } pub fn set(self: *Mode, val: u16) void { @ptrCast(*u16, self).* = val; } pub const all = Mode{ .all = .{ .x = true, .w = true, .r = true }, .grp = .{ .x = true, .w = true, .r = true }, .usr = .{ .x = true, .w = true, .r = true }, }; }; pub const Flags = struct { mount_point: bool = false, read_only: bool = false, is_tty: bool = false, }; pub const Type = enum { none, file, directory, block_device, character_device, symlink, socket, fifo, }; pub const DeviceClass = enum { none, keyboard, mouse, disk, partition, console, framebuffer, other, }; pub const DeviceInfo = struct { class: DeviceClass = .none, name: ?[]const u8 = null, }; pub const Stat = struct { type: Node.Type = .none, mode: Mode = .{}, uid: u32 = 0, gid: u32 = 0, size: u64 = 0, access_time: i64 = 0, create_time: i64 = 0, modify_time: i64 = 0, links: i64 = 0, blocks: u64 = 0, block_size: u64 = 1, flags: Node.Flags = .{}, device_info: DeviceInfo = .{}, inode: u64 = 0, }; pub const Ops = struct { open: ?fn (self: *Node) anyerror!void = null, close: ?fn (self: *Node) anyerror!void = null, read: ?fn (self: *Node, offset: u64, buffer: []u8) anyerror!usize = null, write: ?fn (self: *Node, offset: u64, buffer: []const u8) anyerror!usize = null, find: ?fn (self: *Node, name: []const u8) anyerror!File = null, create: ?fn (self: *Node, name: []const u8, typ: Node.Type, mode: Node.Mode) anyerror!File = null, link: ?fn (self: *Node, name: []const u8, other_node: *Node) anyerror!File = null, unlink: ?fn (self: *Node, name: []const u8) anyerror!void = null, readDir: ?fn (self: *Node, offset: u64, files: []File) anyerror!usize = null, unlink_me: ?fn (self: *Node) anyerror!void = null, free_me: ?fn (self: *Node) void = null, }; stat: Stat = .{}, opens: RefCount = .{}, file_system: ?*FileSystem, ops: Node.Ops, cookie: Cookie = null, alt_cookie: ?[]const u8 = null, pub fn init(ops: Node.Ops, cookie: Cookie, stat: ?Stat, file_system: ?*FileSystem) Node { return .{ .ops = ops, .cookie = cookie, .stat = if (stat != null) stat.? else .{}, .file_system = file_system }; } pub fn open(self: *Node) !void { if (self.ops.open) |open_fn| { try open_fn(self); } self.opens.ref(); if (self.file_system) |fs| { fs.opens.ref(); } } pub fn close(self: *Node) !void { self.opens.unref(); if (self.ops.close) |close_fn| { close_fn(self) catch |err| { self.opens.ref(); return err; }; } if (self.file_system) |fs| { fs.opens.unref(); if (fs.opens.refs == 0) fs.deinit(); } } pub fn read(self: *Node, offset: u64, buffer: []u8) !usize { if (self.ops.read) |read_fn| { return try read_fn(self, offset, buffer); } return Error.NotImplemented; } pub fn write(self: *Node, offset: u64, buffer: []const u8) !usize { if (self.ops.write) |write_fn| { return try write_fn(self, offset, buffer); } return Error.NotImplemented; } pub fn find(self: *Node, name: []const u8) !File { if (self.ops.find) |find_fn| { return try find_fn(self, name); } return Error.NotImplemented; } pub fn create(self: *Node, name: []const u8, typ: Node.Type, mode: Node.Mode) !File { if (self.ops.create) |create_fn| { return try create_fn(self, name, typ, mode); } return Error.NotImplemented; } pub fn link(self: *Node, name: []const u8, new_node: *Node) !File { if (self.ops.link) |link_fn| { return try link_fn(self, name, new_node); } return Error.NotImplemented; } pub fn unlink(self: *Node, name: []const u8) !void { if (self.ops.unlink) |unlink_fn| { return try unlink_fn(self, name); } return Error.NotImplemented; } pub fn readDir(self: *Node, offset: u64, files: []File) !usize { if (self.ops.readDir) |readDir_fn| { return try readDir_fn(self, offset, files); } return Error.NotImplemented; } pub fn findRecursive(self: *Node, path: []const u8) !File { var path_tokenizer = std.mem.tokenize(path, "/"); // FIXME: this will use insane amounts of stack space (64 * (max_name_len = 256)) var node_history: [64]File = undefined; var node_history_pos: usize = 0; var next_file = File{ .name_ptr = ".", .node = self }; defer { for (node_history[0..node_history_pos]) |file| { file.node.close() catch {}; } } while (true) { const part = path_tokenizer.next() orelse break; if (std.mem.eql(u8, part, ".")) continue; // TODO: the ".." "directory" next_file = try next_file.node.find(part); node_history[node_history_pos] = next_file; node_history_pos += 1; if (node_history_pos == node_history.len) return Error.PathTooLong; } if (node_history_pos > 0) node_history_pos -= 1; return next_file; } }; pub const File = struct { node: *Node, name_ptr: ?[]const u8, name_buf: [max_name_len]u8 = undefined, name_len: usize = 0, pub fn name(self: File) []const u8 { if (self.name_ptr) |name_str| { return name_str; } return self.name_buf[0..self.name_len]; } }; /// FileSystem defines a FileSystem pub const FileSystem = struct { pub const Ops = struct { mount: fn (self: *FileSystem, device: ?*Node, args: ?[]const u8) anyerror!*Node, unmount: ?fn (self: *FileSystem) void = null, }; name: []const u8, ops: FileSystem.Ops, cookie: Cookie = null, raw_allocator: *std.mem.Allocator = undefined, arena_allocator: std.heap.ArenaAllocator = undefined, allocator: *std.mem.Allocator = undefined, opens: RefCount = .{}, pub fn init(name: []const u8, ops: FileSystem.Ops) FileSystem { return .{ .name = name, .ops = ops }; } /// Mount a disk (or nothing) using a FileSystem. /// `device` should already be opened before calling mount(). The FileSystem now owns the handle. pub fn mount(self: FileSystem, allocator: *std.mem.Allocator, device: ?*Node, args: ?[]const u8) anyerror!*Node { var fs = try allocator.create(FileSystem); errdefer allocator.destroy(fs); fs.* = .{ .name = self.name, .ops = self.ops, .raw_allocator = allocator, .arena_allocator = std.heap.ArenaAllocator.init(allocator), .allocator = undefined }; fs.allocator = &fs.arena_allocator.allocator; errdefer fs.arena_allocator.deinit(); return try fs.ops.mount(fs, device, args); } /// You should never call this yourself. unlink() the root node instead. pub fn deinit(self: *FileSystem) void { if (self.ops.unmount) |unmount_fn| { unmount_fn(self); } self.arena_allocator.deinit(); self.raw_allocator.destroy(self); } }; /// "/dev/null" type node pub const NullNode = struct { const ops: Node.Ops = .{ .read = NullNode.read, .write = NullNode.write, }; pub fn init() Node { return Node.init(NullNode.ops, null, null, null); } pub fn read(self: *Node, offset: u64, buffer: []u8) !usize { return 0; } pub fn write(self: *Node, offset: u64, buffer: []const u8) !usize { return buffer.len; } }; /// "/dev/zero" type node pub const ZeroNode = struct { const ops: Node.Ops = .{ .read = ZeroNode.read, }; pub fn init() Node { return Node.init(ZeroNode.ops, null, null, null); } pub fn read(self: *Node, offset: u64, buffer: []u8) !usize { std.mem.set(u8, buffer, 0); return buffer.len; } }; /// Read-only node that serves a fixed number of bytes // TODO: better name? pub const ReadOnlyNode = struct { const ops: Node.Ops = .{ .read = ReadOnlyNode.read, }; pub fn init(buffer: []const u8) Node { var new_node = Node.init(ReadOnlyNode.ops, null, Node.Stat{ .size = buffer.len, .blocks = buffer.len + @sizeOf(Node), .type = .file }, null); new_node.alt_cookie = buffer; return new_node; } pub fn read(self: *Node, offset: u64, buffer: []u8) !usize { var my_data = self.alt_cookie.?; var trueOff = @truncate(usize, offset); var trueEnd = if (trueOff + buffer.len > self.stat.size) self.stat.size else trueOff + buffer.len; std.mem.copy(u8, buffer, my_data[trueOff..trueEnd]); return trueEnd - trueOff; } };
kernel/vfs.zig
const std = @import("std"); const zt = @import("zt"); const sling = @import("../sling.zig"); const ig = @import("imgui"); var pathCallback: ?fn ([]const u8) void = null; var folders: std.BoundedArray([128:0]u8, 64) = std.BoundedArray([128:0]u8, 64).init(0) catch unreachable; var files: std.BoundedArray([128:0]u8, 256) = std.BoundedArray([128:0]u8, 256).init(0) catch unreachable; var currentPath: [512:0]u8 = std.mem.zeroes([512:0]u8); var currentName: [128:0]u8 = std.mem.zeroes([128:0]u8); // TODO: make this do a popup on overwrites. var warnOverwrite: bool = false; var currentError: ?[]const u8 = null; fn reset() void { currentPath = std.mem.zeroes([512:0]u8); currentName = std.mem.zeroes([128:0]u8); folders.len = 0; files.len = 0; reQuery(); } fn reQuery() void { folders.len = 0; files.len = 0; var currentPathSlice = std.mem.spanZ(&currentPath); var target = std.fs.cwd().openDir(currentPathSlice, .{ .iterate = true }) catch { currentError = "Path error"; return; }; defer target.close(); var iter: std.fs.Dir.Iterator = target.iterate(); while (iter.next() catch unreachable) |item| { switch (item.kind) { .Directory => { var folderName = std.mem.zeroes([128:0]u8); for (item.name) |char, i| { folderName[i] = char; } // Spilling too many directories can just be ignored, frankly. folders.append(folderName) catch {}; }, .File => { var fileName = std.mem.zeroes([128:0]u8); for (item.name) |char, i| { fileName[i] = char; } // Spilling too many files can just be ignored, frankly. files.append(fileName) catch {}; }, else => {}, } } currentError = null; } pub fn beginLoading() void { reset(); warnOverwrite = false; pathCallback = cb_load; } pub fn beginSaving(initialPath: ?[]const u8) void { reset(); warnOverwrite = true; if (initialPath) |ip| { if (std.fs.path.dirname(ip)) |dirName| { for (dirName) |char, i| { currentPath[i] = char; } } for (std.fs.path.basename(ip)) |char, i| { currentName[i] = char; } } pathCallback = cb_save; } pub fn update() void { if (pathCallback) |_| { var space: ig.ImVec2 = .{}; ig.igGetContentRegionAvail(&space); var io = ig.igGetIO(); ig.igSetNextWindowSize(.{ .x = 350, .y = io.*.DisplaySize.y * 0.8 }, ig.ImGuiCond_Appearing); ig.igSetNextWindowPos(io.*.DisplaySize.scale(0.5), ig.ImGuiCond_Appearing, .{ .x = 0.5, .y = 0.5 }); if (ig.igBegin("Enter Path##SLING_PATH_UTILITY", null, ig.ImGuiWindowFlags_None)) { if (sling.util.igEdit("Path##SLING_PATH_ENTRY", &currentPath)) { reQuery(); } _ = sling.util.igEdit("Filename##SLING_FILENAME_ENTRY", &currentName); if (ig.igButton("Confirm", .{})) { finish(); } ig.igSameLine(0, 4); if (ig.igButton("Cancel", .{})) { pathCallback = null; reset(); } ig.igSeparator(); if (currentError) |err| { sling.zt.custom_components.ztTextDisabled("Awaiting valid input: {s}", .{err}); } var folderSlice = folders.slice(); var filesSlice = files.slice(); for (folderSlice) |folder| { var text = sling.zt.custom_components.fmtTextForImgui("{s}{s}", .{ sling.dictionary.fileSelectorFolder, folder }); if (ig.igSelectable_Bool(text.ptr, false, ig.ImGuiSelectableFlags_None, .{})) { var currentPathSlice = std.mem.spanZ(&currentPath); var pathFragmentSlice = std.mem.spanZ(&folder); var newCombined = std.fs.path.join(sling.alloc, &[_][]const u8{ currentPathSlice, pathFragmentSlice }) catch unreachable; currentPath = std.mem.zeroes([512:0]u8); for (newCombined) |char, i| { currentPath[i] = char; } reQuery(); } } var targetFile = std.mem.spanZ(&currentName); for (filesSlice) |file| { var text = sling.zt.custom_components.fmtTextForImgui("{s}{s}", .{ sling.dictionary.fileSelectorFile, file }); var slice = std.mem.spanZ(&file); var selected = std.mem.eql(u8, slice, targetFile); if (ig.igSelectable_Bool(text.ptr, selected, ig.ImGuiSelectableFlags_None, .{})) { currentName = std.mem.zeroes([128:0]u8); var fileNameSlice = std.mem.spanZ(&file); for (fileNameSlice) |char, i| { currentName[i] = char; } } } } ig.igEnd(); } } fn cb_save(path: []const u8) void { var data = sling.scene.?.toBytes(sling.alloc); var ownedPath = sling.alloc.dupeZ(u8, path) catch unreachable; sling.scene.?.editorData.filePath = ownedPath; defer sling.alloc.free(data); std.fs.cwd().writeFile(path, data) catch { std.debug.print("Failed to write scene data to disk.\n", .{}); }; sling.logFmt("Succesfully saved scene to path {s}!", .{path}); } fn cb_load(path: []const u8) void { var newScene = sling.Scene.initFromFilepath(path); // TODO: implement a previous scene stack instead of discarding. if (sling.scene) |oldScene| { sling.logWarn("Discarding current scene contents..."); oldScene.deinit(); } sling.scene = newScene; sling.logFmt("Succesfully saved scene to path {s}!", .{path}); } fn finish() void { if (pathCallback) |callback| { var dir = std.mem.spanZ(&currentPath); var name = std.mem.spanZ(&currentName); var full = std.fs.path.join(sling.alloc, &[_][]const u8{ dir, name }) catch unreachable; defer sling.alloc.free(full); callback(full[0..]); } pathCallback = null; }
src/editor/fileSelector.zig
const std = @import("std"); const allocator = std.testing.allocator; const builtin = @import("builtin"); const debug = std.debug; const expect = std.testing.expect; const fs = std.fs; const mem = std.mem; const os = std.os; const tmpDir = std.testing.tmpDir; const warn = std.debug.print; const ArrayList = std.ArrayList; const TmpDir = std.testing.TmpDir; const binary_path = "./zig-out/bin/hwzip"; test "print usage" { if (builtin.os.tag == .windows) return error.SkipZigTest; var tmp = initTestDir(); defer tmp.cleanup(); var args = [_][]const u8{ "nonsense", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Usage: \\ \\ ./hwzip list <zipfile> \\ ./hwzip extract <zipfile> \\ ./hwzip create <zipfile> [-m <method>] [-c <comment>] <files...> \\ \\ Supported compression methods: \\ store, shrink, reduce, implode, deflate (default). \\ \\ ; const exit_code = 1; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); } test "list files within archive created by Info-ZIP" { if (builtin.os.tag == .windows) return error.SkipZigTest; // zip file created with Info-ZIP. // ``` // echo -n foo > foo // echo -n nanananana > bar // mkdir dir // echo -n baz > dir/baz // echo This is a test comment. | zip info-zip.zip --archive-comment -r foo bar dir // ``` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "info-zip.zip", tmp.dir, "info-zip.zip", .{}); var args = [_][]const u8{ "list", "info-zip.zip", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Listing ZIP archive: info-zip.zip \\ \\This is a test comment. \\ \\foo \\bar \\dir/ \\dir/baz \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); } test "extract files from archive created by Info-ZIP" { if (builtin.os.tag == .windows) return error.SkipZigTest; // zip file created with Info-ZIP. // ``` // echo -n foo > foo // echo -n nanananana > bar // mkdir dir // echo -n baz > dir/baz // echo This is a test comment. | zip info-zip.zip --archive-comment -r foo bar dir // ``` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "info-zip.zip", tmp.dir, "info-zip.zip", .{}); var args = [_][]const u8{ "extract", "info-zip.zip", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Extracting ZIP archive: info-zip.zip \\ \\This is a test comment. \\ \\ Extracting: foo \\ Inflating: bar \\ (Skipping dir: dir/) \\ (Skipping file in dir: dir/baz) \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles(tmp.dir, "foo", fixtures, "foo"); try expectEqualFiles(tmp.dir, "bar", fixtures, "bar"); } test "Create a ZIP file without comment." { if (builtin.os.tag == .windows) return error.SkipZigTest; var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "foo", tmp.dir, "foo", .{}); try fs.Dir.copyFile(fixtures, "bar", tmp.dir, "bar", .{}); var args = [_][]const u8{ "create", "test-without-comment.zip", "foo", "bar", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Creating ZIP archive: test-without-comment.zip \\ \\ Stored: foo \\ Deflated: bar (50%) \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); } test "Create a ZIP file with comment." { if (builtin.os.tag == .windows) return error.SkipZigTest; var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "foo", tmp.dir, "foo", .{}); try fs.Dir.copyFile(fixtures, "bar", tmp.dir, "bar", .{}); var args = [_][]const u8{ "create", "test-with-a-comment.zip", "-c", "Hello, world!", "foo", "bar", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Creating ZIP archive: test-with-a-comment.zip \\ \\Hello, world! \\ \\ Stored: foo \\ Deflated: bar (50%) \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles(tmp.dir, "foo", fixtures, "foo"); try expectEqualFiles(tmp.dir, "bar", fixtures, "bar"); } test "Create an empty zip file." { if (builtin.os.tag == .windows) return error.SkipZigTest; var tmp = initTestDir(); defer tmp.cleanup(); var args = [_][]const u8{ "create", "empty.zip", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Creating ZIP archive: empty.zip \\ \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); const fixtures = try fs.cwd().openDir("fixtures", .{}); try expectEqualFiles(tmp.dir, "empty.zip", fixtures, "empty.zip"); } test "Empty with comment." { if (builtin.os.tag == .windows) return error.SkipZigTest; var tmp = initTestDir(); defer tmp.cleanup(); var args = [_][]const u8{ "create", "empty-with-a-comment.zip", "-c", "Hello, world!", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Creating ZIP archive: empty-with-a-comment.zip \\ \\Hello, world! \\ \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); const fixtures = try fs.cwd().openDir("fixtures", .{}); try expectEqualFiles( tmp.dir, "empty-with-a-comment.zip", fixtures, "empty-with-a-comment.zip", ); } test "Shrink create" { if (builtin.os.tag == .windows) return error.SkipZigTest; // created with `dd if=/dev/zero of=zeros bs=1 count=1024` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "zeros", tmp.dir, "zeros", .{}); var args = [_][]const u8{ "create", "shrink.zip", "-m", "shrink", "zeros", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Creating ZIP archive: shrink.zip \\ \\ Shrunk: zeros (95%) \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles( tmp.dir, "zeros", fixtures, "zeros", ); } test "Shrink extract" { if (builtin.os.tag == .windows) return error.SkipZigTest; // created with `hwzip create shrink.zip -m shrink zeros` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "shrink.zip", tmp.dir, "shrink.zip", .{}); var args = [_][]const u8{ "extract", "shrink.zip", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Extracting ZIP archive: shrink.zip \\ \\ Unshrinking: zeros \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles( tmp.dir, "zeros", fixtures, "zeros", ); } test "Reduce create" { if (builtin.os.tag == .windows) return error.SkipZigTest; // created with `dd if=/dev/zero of=zeros bs=1 count=1024` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "zeros", tmp.dir, "zeros", .{}); var args = [_][]const u8{ "create", "reduce.zip", "-m", "reduce", "zeros", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Creating ZIP archive: reduce.zip \\ \\ Reduced: zeros (73%) \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles( tmp.dir, "zeros", fixtures, "zeros", ); } test "Reduce extract" { if (builtin.os.tag == .windows) return error.SkipZigTest; // created with `hwzip create shrink.zip -m shrink zeros` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "reduce.zip", tmp.dir, "reduce.zip", .{}); var args = [_][]const u8{ "extract", "reduce.zip", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Extracting ZIP archive: reduce.zip \\ \\ Expanding: zeros \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles( tmp.dir, "zeros", fixtures, "zeros", ); } test "Implode create with a comment" { if (builtin.os.tag == .windows) return error.SkipZigTest; // created with `dd if=/dev/zero of=zeros bs=1 count=1024` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "zeros", tmp.dir, "zeros", .{}); var args = [_][]const u8{ "create", "implode.zip", "-m", "implode", "-c", "comment", "zeros", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Creating ZIP archive: implode.zip \\ \\comment \\ \\ Imploded: zeros (96%) \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles( tmp.dir, "zeros", fixtures, "zeros", ); } test "Implode extract" { if (builtin.os.tag == .windows) return error.SkipZigTest; // created with `hwzip create shrink.zip -m shrink zeros` var tmp = initTestDir(); defer tmp.cleanup(); const fixtures = try fs.cwd().openDir("fixtures", .{}); try fs.Dir.copyFile(fixtures, "implode.zip", tmp.dir, "implode.zip", .{}); var args = [_][]const u8{ "extract", "implode.zip", }; var output = \\ \\HWZIP 2.1 -- A simple ZIP program from https://www.hanshq.net/zip.html \\ \\Extracting ZIP archive: implode.zip \\ \\comment \\ \\ Exploding: zeros \\ \\ ; const exit_code = 0; try expectExecute("./hwzip", args[0..], exit_code, output, tmp.dir); try expectEqualFiles( tmp.dir, "zeros", fixtures, "zeros", ); } // Create a temp directory containing the executable being tested // It's the caller responsibility to call `dir.cleanup()` fn initTestDir() TmpDir { var tmp = tmpDir(.{}); fs.Dir.copyFile(fs.cwd(), binary_path, tmp.dir, "hwzip", .{}) catch { std.debug.print( \\ \\Unable to find/copy "{s}" to a temporary directory" \\please make sure to run `zig build` before running `zig build test` \\and that you run `zig build test` from the root directory of the project. \\ , .{binary_path}, ); os.exit(1); }; return tmp; } fn expectEqualFiles( a_dir: fs.Dir, a_path: []const u8, b_dir: fs.Dir, b_path: []const u8, ) !void { const a = try a_dir.openFile(a_path, .{ .read = true }); defer a.close(); const b = try b_dir.openFile(b_path, .{ .read = true }); defer b.close(); var a_file_sz = (try a.stat()).size; var b_file_sz = (try b.stat()).size; try expect(a_file_sz == b_file_sz); const a_content = try a.reader().readAllAlloc(allocator, a_file_sz); defer allocator.free(a_content); const b_content = try b.reader().readAllAlloc(allocator, b_file_sz); defer allocator.free(b_content); try expect(mem.eql(u8, a_content, b_content)); } fn printInvocation(args: []const []const u8) void { warn("\n", .{}); for (args) |arg| { warn("{s} ", .{arg}); } warn("\n", .{}); } fn expectExecute( binary: []const u8, args: [][]const u8, expect_code: u32, expect_output: []const u8, cwd: ?fs.Dir, ) !void { const max_output_size = 1 * 1024 * 1024; // 1 MB const full_exe_path = binary; var process_args = ArrayList([]const u8).init(allocator); defer process_args.deinit(); process_args.append(full_exe_path) catch unreachable; // first arg must be the executable name process_args.appendSlice(args) catch unreachable; const child = std.ChildProcess.init(process_args.items, allocator) catch unreachable; defer child.deinit(); if (cwd != null) { child.cwd_dir = cwd; } child.stdin_behavior = .Ignore; child.stdout_behavior = .Pipe; child.spawn() catch |err| debug.panic("Unable to spawn {s}: {s}\n", .{ full_exe_path, @errorName(err) }); const stdout = child.stdout.?.reader().readAllAlloc(allocator, max_output_size) catch unreachable; defer allocator.free(stdout); const term = child.wait() catch |err| { debug.panic("Unable to spawn {s}: {s}\n", .{ full_exe_path, @errorName(err) }); }; switch (term) { .Exited => |code| { if (code != expect_code) { warn("Process {s} exited with error code {d} but expected code {d}\n", .{ full_exe_path, code, expect_code, }); warn( \\ \\========= With this output (stdout) : === \\{s} \\========================================= \\ , .{stdout}); printInvocation(process_args.items); return error.TestFailed; } }, .Signal => |signum| { warn("Process {s} terminated on signal {d}\n", .{ full_exe_path, signum }); printInvocation(process_args.items); return error.TestFailed; }, .Stopped => |signum| { warn("Process {s} stopped on signal {d}\n", .{ full_exe_path, signum }); printInvocation(process_args.items); return error.TestFailed; }, .Unknown => |code| { warn("Process {s} terminated unexpectedly with error code {d}\n", .{ full_exe_path, code }); printInvocation(process_args.items); return error.TestFailed; }, } if (!mem.eql(u8, expect_output, stdout)) { printInvocation(process_args.items); warn( \\ \\========= expected this output: ========= \\{s} \\=========== instead found this: ========= \\{s} \\========================================= \\ , .{ expect_output, stdout }); return error.TestFailed; } }
src/hwzip_test.zig
const std = @import("std"); fn tagKind(tree: *std.zig.ast.Tree, node: *std.zig.ast.Node) u8 { return switch (node.id) { std.zig.ast.Node.Id.FnProto => 'f', std.zig.ast.Node.Id.VarDecl => blk: { const var_decl_node = node.cast(std.zig.ast.Node.VarDecl).?; if (var_decl_node.init_node) |init_node| { if (init_node.id == std.zig.ast.Node.Id.ContainerDecl) { const container_node = init_node.cast(std.zig.ast.Node.ContainerDecl).?; break :blk switch (tree.tokens.at(container_node.kind_token).id) { std.zig.Token.Id.Keyword_struct => 's', std.zig.Token.Id.Keyword_union => 'u', std.zig.Token.Id.Keyword_enum => 'e', else => u8(0), }; } else if (init_node.id == std.zig.ast.Node.Id.ErrorType or init_node.id == std.zig.ast.Node.Id.ErrorSetDecl) { return 'r'; } } break :blk 'v'; }, std.zig.ast.Node.Id.StructField, std.zig.ast.Node.Id.UnionTag, std.zig.ast.Node.Id.EnumTag => 'm', else => u8(0), }; } fn escapeString(allocator: *std.mem.Allocator, line: []const u8) ![]const u8 { var result = std.ArrayList(u8).init(allocator); errdefer result.deinit(); // Max length of escaped string is twice the length of the original line. try result.ensureCapacity(line.len * 2); for (line) |ch| { switch (ch) { '/', '\\' => { try result.append('\\'); try result.append(ch); }, else => { try result.append(ch); }, } } return result.toOwnedSlice(); } const ErrorSet = error{ OutOfMemory, WriteError, }; const ParseArgs = struct { allocator: *std.mem.Allocator, tree: *std.zig.ast.Tree, node: *std.zig.ast.Node, path: []const u8, scope_field_name: []const u8, scope: []const u8, tags_file_stream: *std.os.File.OutStream.Stream, }; fn findTags(args: *const ParseArgs) ErrorSet!void { var token_index: ?std.zig.ast.TokenIndex = null; switch (args.node.id) { std.zig.ast.Node.Id.StructField => { const struct_field = args.node.cast(std.zig.ast.Node.StructField).?; token_index = struct_field.name_token; }, std.zig.ast.Node.Id.UnionTag => { const union_tag = args.node.cast(std.zig.ast.Node.UnionTag).?; token_index = union_tag.name_token; }, std.zig.ast.Node.Id.EnumTag => { const enum_tag = args.node.cast(std.zig.ast.Node.EnumTag).?; token_index = enum_tag.name_token; }, std.zig.ast.Node.Id.FnProto => { const fn_node = args.node.cast(std.zig.ast.Node.FnProto).?; if (fn_node.name_token) |name_index| { token_index = name_index; } }, std.zig.ast.Node.Id.VarDecl => blk: { const var_node = args.node.cast(std.zig.ast.Node.VarDecl).?; token_index = var_node.name_token; if (var_node.init_node) |init_node| { if (init_node.id == std.zig.ast.Node.Id.ContainerDecl) { const container_node = init_node.cast(std.zig.ast.Node.ContainerDecl).?; const container_kind = args.tree.tokenSlice(container_node.kind_token); const container_name = args.tree.tokenSlice(token_index.?); const delim = "."; var sub_scope: []u8 = undefined; if (args.scope.len > 0) { sub_scope = try args.allocator.alloc(u8, args.scope.len + delim.len + container_name.len); std.mem.copy(u8, sub_scope[0..args.scope.len], args.scope); std.mem.copy(u8, sub_scope[args.scope.len .. args.scope.len + delim.len], delim); std.mem.copy(u8, sub_scope[args.scope.len + delim.len ..], container_name); } else { sub_scope = try std.mem.dupe(args.allocator, u8, container_name); } defer args.allocator.free(sub_scope); var it = container_node.fields_and_decls.iterator(0); while (it.next()) |child| { const child_args = ParseArgs{ .allocator = args.allocator, .tree = args.tree, .node = child.*, .path = args.path, .scope_field_name = container_kind, .scope = sub_scope, .tags_file_stream = args.tags_file_stream, }; try findTags(&child_args); } } else if (init_node.id == std.zig.ast.Node.Id.ErrorSetDecl or init_node.id == std.zig.ast.Node.Id.ErrorType) {} } }, else => {}, } if (token_index == null) { return; } const name = args.tree.tokenSlice(token_index.?); const location = args.tree.tokenLocation(0, token_index.?); const line = args.tree.source[location.line_start..location.line_end]; const escaped_line = try escapeString(args.allocator, line); defer args.allocator.free(escaped_line); args.tags_file_stream.print("{}\t{}\t/^{}$/;\"\t{c}", name, args.path, escaped_line, tagKind(args.tree, args.node)) catch return ErrorSet.WriteError; if (args.scope.len > 0) { args.tags_file_stream.print("\t{}:{}", args.scope_field_name, args.scope) catch return ErrorSet.WriteError; } args.tags_file_stream.print("\n") catch return ErrorSet.WriteError; } pub fn main() !void { var direct_allocator = std.heap.DirectAllocator.init(); defer direct_allocator.deinit(); const allocator = &direct_allocator.allocator; var args_it = std.os.args(); _ = args_it.skip(); // Discard program name const path = try args_it.next(allocator).?; defer allocator.free(path); const source = try std.io.readFileAlloc(allocator, path); defer allocator.free(source); var tree = try std.zig.parse(allocator, source); defer tree.deinit(); var stdout_file = try std.io.getStdOut(); const stdout = &stdout_file.outStream().stream; const node = &tree.root_node.base; var child_i: usize = 0; while (node.iterate(child_i)) |child| : (child_i += 1) { const child_args = ParseArgs{ .allocator = allocator, .tree = &tree, .node = child, .path = path, .scope_field_name = "", .scope = "", .tags_file_stream = stdout, }; try findTags(&child_args); } }
src/main.zig
const std = @import("std"); const mem = std.mem; const Allocator = std.mem.Allocator; const Value = @import("value.zig").Value; const Type = @import("type.zig").Type; const TypedValue = @import("TypedValue.zig"); const assert = std.debug.assert; const zir = @import("zir.zig"); const Module = @import("Module.zig"); const ast = std.zig.ast; const trace = @import("tracy.zig").trace; const Scope = Module.Scope; const InnerError = Module.InnerError; pub const ResultLoc = union(enum) { /// The expression is the right-hand side of assignment to `_`. Only the side-effects of the /// expression should be generated. discard, /// The expression has an inferred type, and it will be evaluated as an rvalue. none, /// The expression must generate a pointer rather than a value. For example, the left hand side /// of an assignment uses this kind of result location. ref, /// The expression will be type coerced into this type, but it will be evaluated as an rvalue. ty: *zir.Inst, /// The expression must store its result into this typed pointer. ptr: *zir.Inst, /// The expression must store its result into this allocation, which has an inferred type. inferred_ptr: *zir.Inst.Tag.alloc_inferred.Type(), /// The expression must store its result into this pointer, which is a typed pointer that /// has been bitcasted to whatever the expression's type is. bitcasted_ptr: *zir.Inst.UnOp, /// There is a pointer for the expression to store its result into, however, its type /// is inferred based on peer type resolution for a `zir.Inst.Block`. block_ptr: *zir.Inst.Block, }; pub fn typeExpr(mod: *Module, scope: *Scope, type_node: *ast.Node) InnerError!*zir.Inst { const type_src = scope.tree().token_locs[type_node.firstToken()].start; const type_type = try addZIRInstConst(mod, scope, type_src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.type_type), }); const type_rl: ResultLoc = .{ .ty = type_type }; return expr(mod, scope, type_rl, type_node); } fn lvalExpr(mod: *Module, scope: *Scope, node: *ast.Node) InnerError!*zir.Inst { switch (node.tag) { .Root => unreachable, .Use => unreachable, .TestDecl => unreachable, .DocComment => unreachable, .VarDecl => unreachable, .SwitchCase => unreachable, .SwitchElse => unreachable, .Else => unreachable, .Payload => unreachable, .PointerPayload => unreachable, .PointerIndexPayload => unreachable, .ErrorTag => unreachable, .FieldInitializer => unreachable, .ContainerField => unreachable, .Assign, .AssignBitAnd, .AssignBitOr, .AssignBitShiftLeft, .AssignBitShiftRight, .AssignBitXor, .AssignDiv, .AssignSub, .AssignSubWrap, .AssignMod, .AssignAdd, .AssignAddWrap, .AssignMul, .AssignMulWrap, .Add, .AddWrap, .Sub, .SubWrap, .Mul, .MulWrap, .Div, .Mod, .BitAnd, .BitOr, .BitShiftLeft, .BitShiftRight, .BitXor, .BangEqual, .EqualEqual, .GreaterThan, .GreaterOrEqual, .LessThan, .LessOrEqual, .ArrayCat, .ArrayMult, .BoolAnd, .BoolOr, .Asm, .StringLiteral, .IntegerLiteral, .Call, .Unreachable, .Return, .If, .While, .BoolNot, .AddressOf, .FloatLiteral, .UndefinedLiteral, .BoolLiteral, .NullLiteral, .OptionalType, .Block, .LabeledBlock, .Break, .PtrType, .GroupedExpression, .ArrayType, .ArrayTypeSentinel, .EnumLiteral, .MultilineStringLiteral, .CharLiteral, .Defer, .Catch, .ErrorUnion, .MergeErrorSets, .Range, .OrElse, .Await, .BitNot, .Negation, .NegationWrap, .Resume, .Try, .SliceType, .Slice, .ArrayInitializer, .ArrayInitializerDot, .StructInitializer, .StructInitializerDot, .Switch, .For, .Suspend, .Continue, .AnyType, .ErrorType, .FnProto, .AnyFrameType, .ErrorSetDecl, .ContainerDecl, .Comptime, .Nosuspend, => return mod.failNode(scope, node, "invalid left-hand side to assignment", .{}), // @field can be assigned to .BuiltinCall => { const call = node.castTag(.BuiltinCall).?; const tree = scope.tree(); const builtin_name = tree.tokenSlice(call.builtin_token); if (!mem.eql(u8, builtin_name, "@field")) { return mod.failNode(scope, node, "invalid left-hand side to assignment", .{}); } }, // can be assigned to .UnwrapOptional, .Deref, .Period, .ArrayAccess, .Identifier => {}, } return expr(mod, scope, .ref, node); } /// Turn Zig AST into untyped ZIR istructions. pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node) InnerError!*zir.Inst { switch (node.tag) { .Root => unreachable, // Top-level declaration. .Use => unreachable, // Top-level declaration. .TestDecl => unreachable, // Top-level declaration. .DocComment => unreachable, // Top-level declaration. .VarDecl => unreachable, // Handled in `blockExpr`. .SwitchCase => unreachable, // Handled in `switchExpr`. .SwitchElse => unreachable, // Handled in `switchExpr`. .Range => unreachable, // Handled in `switchExpr`. .Else => unreachable, // Handled explicitly the control flow expression functions. .Payload => unreachable, // Handled explicitly. .PointerPayload => unreachable, // Handled explicitly. .PointerIndexPayload => unreachable, // Handled explicitly. .ErrorTag => unreachable, // Handled explicitly. .FieldInitializer => unreachable, // Handled explicitly. .ContainerField => unreachable, // Handled explicitly. .Assign => return rlWrapVoid(mod, scope, rl, node, try assign(mod, scope, node.castTag(.Assign).?)), .AssignBitAnd => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignBitAnd).?, .bitand)), .AssignBitOr => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignBitOr).?, .bitor)), .AssignBitShiftLeft => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignBitShiftLeft).?, .shl)), .AssignBitShiftRight => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignBitShiftRight).?, .shr)), .AssignBitXor => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignBitXor).?, .xor)), .AssignDiv => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignDiv).?, .div)), .AssignSub => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignSub).?, .sub)), .AssignSubWrap => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignSubWrap).?, .subwrap)), .AssignMod => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignMod).?, .mod_rem)), .AssignAdd => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignAdd).?, .add)), .AssignAddWrap => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignAddWrap).?, .addwrap)), .AssignMul => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignMul).?, .mul)), .AssignMulWrap => return rlWrapVoid(mod, scope, rl, node, try assignOp(mod, scope, node.castTag(.AssignMulWrap).?, .mulwrap)), .Add => return simpleBinOp(mod, scope, rl, node.castTag(.Add).?, .add), .AddWrap => return simpleBinOp(mod, scope, rl, node.castTag(.AddWrap).?, .addwrap), .Sub => return simpleBinOp(mod, scope, rl, node.castTag(.Sub).?, .sub), .SubWrap => return simpleBinOp(mod, scope, rl, node.castTag(.SubWrap).?, .subwrap), .Mul => return simpleBinOp(mod, scope, rl, node.castTag(.Mul).?, .mul), .MulWrap => return simpleBinOp(mod, scope, rl, node.castTag(.MulWrap).?, .mulwrap), .Div => return simpleBinOp(mod, scope, rl, node.castTag(.Div).?, .div), .Mod => return simpleBinOp(mod, scope, rl, node.castTag(.Mod).?, .mod_rem), .BitAnd => return simpleBinOp(mod, scope, rl, node.castTag(.BitAnd).?, .bitand), .BitOr => return simpleBinOp(mod, scope, rl, node.castTag(.BitOr).?, .bitor), .BitShiftLeft => return simpleBinOp(mod, scope, rl, node.castTag(.BitShiftLeft).?, .shl), .BitShiftRight => return simpleBinOp(mod, scope, rl, node.castTag(.BitShiftRight).?, .shr), .BitXor => return simpleBinOp(mod, scope, rl, node.castTag(.BitXor).?, .xor), .BangEqual => return simpleBinOp(mod, scope, rl, node.castTag(.BangEqual).?, .cmp_neq), .EqualEqual => return simpleBinOp(mod, scope, rl, node.castTag(.EqualEqual).?, .cmp_eq), .GreaterThan => return simpleBinOp(mod, scope, rl, node.castTag(.GreaterThan).?, .cmp_gt), .GreaterOrEqual => return simpleBinOp(mod, scope, rl, node.castTag(.GreaterOrEqual).?, .cmp_gte), .LessThan => return simpleBinOp(mod, scope, rl, node.castTag(.LessThan).?, .cmp_lt), .LessOrEqual => return simpleBinOp(mod, scope, rl, node.castTag(.LessOrEqual).?, .cmp_lte), .ArrayCat => return simpleBinOp(mod, scope, rl, node.castTag(.ArrayCat).?, .array_cat), .ArrayMult => return simpleBinOp(mod, scope, rl, node.castTag(.ArrayMult).?, .array_mul), .BoolAnd => return boolBinOp(mod, scope, rl, node.castTag(.BoolAnd).?), .BoolOr => return boolBinOp(mod, scope, rl, node.castTag(.BoolOr).?), .BoolNot => return rlWrap(mod, scope, rl, try boolNot(mod, scope, node.castTag(.BoolNot).?)), .BitNot => return rlWrap(mod, scope, rl, try bitNot(mod, scope, node.castTag(.BitNot).?)), .Negation => return rlWrap(mod, scope, rl, try negation(mod, scope, node.castTag(.Negation).?, .sub)), .NegationWrap => return rlWrap(mod, scope, rl, try negation(mod, scope, node.castTag(.NegationWrap).?, .subwrap)), .Identifier => return try identifier(mod, scope, rl, node.castTag(.Identifier).?), .Asm => return rlWrap(mod, scope, rl, try assembly(mod, scope, node.castTag(.Asm).?)), .StringLiteral => return rlWrap(mod, scope, rl, try stringLiteral(mod, scope, node.castTag(.StringLiteral).?)), .IntegerLiteral => return rlWrap(mod, scope, rl, try integerLiteral(mod, scope, node.castTag(.IntegerLiteral).?)), .BuiltinCall => return builtinCall(mod, scope, rl, node.castTag(.BuiltinCall).?), .Call => return callExpr(mod, scope, rl, node.castTag(.Call).?), .Unreachable => return unreach(mod, scope, node.castTag(.Unreachable).?), .Return => return ret(mod, scope, node.castTag(.Return).?), .If => return ifExpr(mod, scope, rl, node.castTag(.If).?), .While => return whileExpr(mod, scope, rl, node.castTag(.While).?), .Period => return field(mod, scope, rl, node.castTag(.Period).?), .Deref => return rlWrap(mod, scope, rl, try deref(mod, scope, node.castTag(.Deref).?)), .AddressOf => return rlWrap(mod, scope, rl, try addressOf(mod, scope, node.castTag(.AddressOf).?)), .FloatLiteral => return rlWrap(mod, scope, rl, try floatLiteral(mod, scope, node.castTag(.FloatLiteral).?)), .UndefinedLiteral => return rlWrap(mod, scope, rl, try undefLiteral(mod, scope, node.castTag(.UndefinedLiteral).?)), .BoolLiteral => return rlWrap(mod, scope, rl, try boolLiteral(mod, scope, node.castTag(.BoolLiteral).?)), .NullLiteral => return rlWrap(mod, scope, rl, try nullLiteral(mod, scope, node.castTag(.NullLiteral).?)), .OptionalType => return rlWrap(mod, scope, rl, try optionalType(mod, scope, node.castTag(.OptionalType).?)), .UnwrapOptional => return unwrapOptional(mod, scope, rl, node.castTag(.UnwrapOptional).?), .Block => return rlWrapVoid(mod, scope, rl, node, try blockExpr(mod, scope, node.castTag(.Block).?)), .LabeledBlock => return labeledBlockExpr(mod, scope, rl, node.castTag(.LabeledBlock).?, .block), .Break => return rlWrap(mod, scope, rl, try breakExpr(mod, scope, node.castTag(.Break).?)), .PtrType => return rlWrap(mod, scope, rl, try ptrType(mod, scope, node.castTag(.PtrType).?)), .GroupedExpression => return expr(mod, scope, rl, node.castTag(.GroupedExpression).?.expr), .ArrayType => return rlWrap(mod, scope, rl, try arrayType(mod, scope, node.castTag(.ArrayType).?)), .ArrayTypeSentinel => return rlWrap(mod, scope, rl, try arrayTypeSentinel(mod, scope, node.castTag(.ArrayTypeSentinel).?)), .EnumLiteral => return rlWrap(mod, scope, rl, try enumLiteral(mod, scope, node.castTag(.EnumLiteral).?)), .MultilineStringLiteral => return rlWrap(mod, scope, rl, try multilineStrLiteral(mod, scope, node.castTag(.MultilineStringLiteral).?)), .CharLiteral => return rlWrap(mod, scope, rl, try charLiteral(mod, scope, node.castTag(.CharLiteral).?)), .SliceType => return rlWrap(mod, scope, rl, try sliceType(mod, scope, node.castTag(.SliceType).?)), .ErrorUnion => return rlWrap(mod, scope, rl, try typeInixOp(mod, scope, node.castTag(.ErrorUnion).?, .error_union_type)), .MergeErrorSets => return rlWrap(mod, scope, rl, try typeInixOp(mod, scope, node.castTag(.MergeErrorSets).?, .merge_error_sets)), .AnyFrameType => return rlWrap(mod, scope, rl, try anyFrameType(mod, scope, node.castTag(.AnyFrameType).?)), .ErrorSetDecl => return errorSetDecl(mod, scope, rl, node.castTag(.ErrorSetDecl).?), .ErrorType => return rlWrap(mod, scope, rl, try errorType(mod, scope, node.castTag(.ErrorType).?)), .For => return forExpr(mod, scope, rl, node.castTag(.For).?), .ArrayAccess => return arrayAccess(mod, scope, rl, node.castTag(.ArrayAccess).?), .Slice => return rlWrap(mod, scope, rl, try sliceExpr(mod, scope, node.castTag(.Slice).?)), .Catch => return catchExpr(mod, scope, rl, node.castTag(.Catch).?), .Comptime => return comptimeKeyword(mod, scope, rl, node.castTag(.Comptime).?), .OrElse => return orelseExpr(mod, scope, rl, node.castTag(.OrElse).?), .Switch => return switchExpr(mod, scope, rl, node.castTag(.Switch).?), .Defer => return mod.failNode(scope, node, "TODO implement astgen.expr for .Defer", .{}), .Await => return mod.failNode(scope, node, "TODO implement astgen.expr for .Await", .{}), .Resume => return mod.failNode(scope, node, "TODO implement astgen.expr for .Resume", .{}), .Try => return mod.failNode(scope, node, "TODO implement astgen.expr for .Try", .{}), .ArrayInitializer => return mod.failNode(scope, node, "TODO implement astgen.expr for .ArrayInitializer", .{}), .ArrayInitializerDot => return mod.failNode(scope, node, "TODO implement astgen.expr for .ArrayInitializerDot", .{}), .StructInitializer => return mod.failNode(scope, node, "TODO implement astgen.expr for .StructInitializer", .{}), .StructInitializerDot => return mod.failNode(scope, node, "TODO implement astgen.expr for .StructInitializerDot", .{}), .Suspend => return mod.failNode(scope, node, "TODO implement astgen.expr for .Suspend", .{}), .Continue => return mod.failNode(scope, node, "TODO implement astgen.expr for .Continue", .{}), .AnyType => return mod.failNode(scope, node, "TODO implement astgen.expr for .AnyType", .{}), .FnProto => return mod.failNode(scope, node, "TODO implement astgen.expr for .FnProto", .{}), .ContainerDecl => return mod.failNode(scope, node, "TODO implement astgen.expr for .ContainerDecl", .{}), .Nosuspend => return mod.failNode(scope, node, "TODO implement astgen.expr for .Nosuspend", .{}), } } fn comptimeKeyword(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.Comptime) InnerError!*zir.Inst { const tracy = trace(@src()); defer tracy.end(); return comptimeExpr(mod, scope, rl, node.expr); } pub fn comptimeExpr(mod: *Module, parent_scope: *Scope, rl: ResultLoc, node: *ast.Node) InnerError!*zir.Inst { const tree = parent_scope.tree(); const src = tree.token_locs[node.firstToken()].start; // Optimization for labeled blocks: don't need to have 2 layers of blocks, we can reuse the existing one. if (node.castTag(.LabeledBlock)) |block_node| { return labeledBlockExpr(mod, parent_scope, rl, block_node, .block_comptime); } // Make a scope to collect generated instructions in the sub-expression. var block_scope: Scope.GenZIR = .{ .parent = parent_scope, .decl = parent_scope.decl().?, .arena = parent_scope.arena(), .instructions = .{}, }; defer block_scope.instructions.deinit(mod.gpa); // No need to capture the result here because block_comptime_flat implies that the final // instruction is the block's result value. _ = try expr(mod, &block_scope.base, rl, node); const block = try addZIRInstBlock(mod, parent_scope, src, .block_comptime_flat, .{ .instructions = try block_scope.arena.dupe(*zir.Inst, block_scope.instructions.items), }); return &block.base; } fn breakExpr(mod: *Module, parent_scope: *Scope, node: *ast.Node.ControlFlowExpression) InnerError!*zir.Inst { const tree = parent_scope.tree(); const src = tree.token_locs[node.ltoken].start; if (node.getLabel()) |break_label| { // Look for the label in the scope. var scope = parent_scope; while (true) { switch (scope.tag) { .gen_zir => { const gen_zir = scope.cast(Scope.GenZIR).?; if (gen_zir.label) |label| { if (try tokenIdentEql(mod, parent_scope, label.token, break_label)) { if (node.getRHS()) |rhs| { // Most result location types can be forwarded directly; however // if we need to write to a pointer which has an inferred type, // proper type inference requires peer type resolution on the block's // break operand expressions. const branch_rl: ResultLoc = switch (label.result_loc) { .discard, .none, .ty, .ptr, .ref => label.result_loc, .inferred_ptr, .bitcasted_ptr, .block_ptr => .{ .block_ptr = label.block_inst }, }; const operand = try expr(mod, parent_scope, branch_rl, rhs); return try addZIRInst(mod, scope, src, zir.Inst.Break, .{ .block = label.block_inst, .operand = operand, }, .{}); } else { return try addZIRInst(mod, scope, src, zir.Inst.BreakVoid, .{ .block = label.block_inst, }, .{}); } } } scope = gen_zir.parent; }, .local_val => scope = scope.cast(Scope.LocalVal).?.parent, .local_ptr => scope = scope.cast(Scope.LocalPtr).?.parent, else => { const label_name = try identifierTokenString(mod, parent_scope, break_label); return mod.failTok(parent_scope, break_label, "label not found: '{}'", .{label_name}); }, } } } else { return mod.failNode(parent_scope, &node.base, "TODO implement break from loop", .{}); } } pub fn blockExpr(mod: *Module, parent_scope: *Scope, block_node: *ast.Node.Block) InnerError!void { const tracy = trace(@src()); defer tracy.end(); try blockExprStmts(mod, parent_scope, &block_node.base, block_node.statements()); } fn labeledBlockExpr( mod: *Module, parent_scope: *Scope, rl: ResultLoc, block_node: *ast.Node.LabeledBlock, zir_tag: zir.Inst.Tag, ) InnerError!*zir.Inst { const tracy = trace(@src()); defer tracy.end(); assert(zir_tag == .block or zir_tag == .block_comptime); const tree = parent_scope.tree(); const src = tree.token_locs[block_node.lbrace].start; // Create the Block ZIR instruction so that we can put it into the GenZIR struct // so that break statements can reference it. const gen_zir = parent_scope.getGenZIR(); const block_inst = try gen_zir.arena.create(zir.Inst.Block); block_inst.* = .{ .base = .{ .tag = zir_tag, .src = src, }, .positionals = .{ .body = .{ .instructions = undefined }, }, .kw_args = .{}, }; var block_scope: Scope.GenZIR = .{ .parent = parent_scope, .decl = parent_scope.decl().?, .arena = gen_zir.arena, .instructions = .{}, // TODO @as here is working around a stage1 miscompilation bug :( .label = @as(?Scope.GenZIR.Label, Scope.GenZIR.Label{ .token = block_node.label, .block_inst = block_inst, .result_loc = rl, }), }; defer block_scope.instructions.deinit(mod.gpa); try blockExprStmts(mod, &block_scope.base, &block_node.base, block_node.statements()); block_inst.positionals.body.instructions = try block_scope.arena.dupe(*zir.Inst, block_scope.instructions.items); try gen_zir.instructions.append(mod.gpa, &block_inst.base); return &block_inst.base; } fn blockExprStmts(mod: *Module, parent_scope: *Scope, node: *ast.Node, statements: []*ast.Node) !void { const tree = parent_scope.tree(); var block_arena = std.heap.ArenaAllocator.init(mod.gpa); defer block_arena.deinit(); var scope = parent_scope; for (statements) |statement| { const src = tree.token_locs[statement.firstToken()].start; _ = try addZIRNoOp(mod, scope, src, .dbg_stmt); switch (statement.tag) { .VarDecl => { const var_decl_node = statement.castTag(.VarDecl).?; scope = try varDecl(mod, scope, var_decl_node, &block_arena.allocator); }, .Assign => try assign(mod, scope, statement.castTag(.Assign).?), .AssignBitAnd => try assignOp(mod, scope, statement.castTag(.AssignBitAnd).?, .bitand), .AssignBitOr => try assignOp(mod, scope, statement.castTag(.AssignBitOr).?, .bitor), .AssignBitShiftLeft => try assignOp(mod, scope, statement.castTag(.AssignBitShiftLeft).?, .shl), .AssignBitShiftRight => try assignOp(mod, scope, statement.castTag(.AssignBitShiftRight).?, .shr), .AssignBitXor => try assignOp(mod, scope, statement.castTag(.AssignBitXor).?, .xor), .AssignDiv => try assignOp(mod, scope, statement.castTag(.AssignDiv).?, .div), .AssignSub => try assignOp(mod, scope, statement.castTag(.AssignSub).?, .sub), .AssignSubWrap => try assignOp(mod, scope, statement.castTag(.AssignSubWrap).?, .subwrap), .AssignMod => try assignOp(mod, scope, statement.castTag(.AssignMod).?, .mod_rem), .AssignAdd => try assignOp(mod, scope, statement.castTag(.AssignAdd).?, .add), .AssignAddWrap => try assignOp(mod, scope, statement.castTag(.AssignAddWrap).?, .addwrap), .AssignMul => try assignOp(mod, scope, statement.castTag(.AssignMul).?, .mul), .AssignMulWrap => try assignOp(mod, scope, statement.castTag(.AssignMulWrap).?, .mulwrap), else => { const possibly_unused_result = try expr(mod, scope, .none, statement); if (!possibly_unused_result.tag.isNoReturn()) { _ = try addZIRUnOp(mod, scope, src, .ensure_result_used, possibly_unused_result); } }, } } } fn varDecl( mod: *Module, scope: *Scope, node: *ast.Node.VarDecl, block_arena: *Allocator, ) InnerError!*Scope { if (node.getComptimeToken()) |comptime_token| { return mod.failTok(scope, comptime_token, "TODO implement comptime locals", .{}); } if (node.getAlignNode()) |align_node| { return mod.failNode(scope, align_node, "TODO implement alignment on locals", .{}); } const tree = scope.tree(); const name_src = tree.token_locs[node.name_token].start; const ident_name = try identifierTokenString(mod, scope, node.name_token); // Local variables shadowing detection, including function parameters. { var s = scope; while (true) switch (s.tag) { .local_val => { const local_val = s.cast(Scope.LocalVal).?; if (mem.eql(u8, local_val.name, ident_name)) { return mod.fail(scope, name_src, "redefinition of '{}'", .{ident_name}); } s = local_val.parent; }, .local_ptr => { const local_ptr = s.cast(Scope.LocalPtr).?; if (mem.eql(u8, local_ptr.name, ident_name)) { return mod.fail(scope, name_src, "redefinition of '{}'", .{ident_name}); } s = local_ptr.parent; }, .gen_zir => s = s.cast(Scope.GenZIR).?.parent, else => break, }; } // Namespace vars shadowing detection if (mod.lookupDeclName(scope, ident_name)) |_| { return mod.fail(scope, name_src, "redefinition of '{}'", .{ident_name}); } const init_node = node.getInitNode() orelse return mod.fail(scope, name_src, "variables must be initialized", .{}); switch (tree.token_ids[node.mut_token]) { .Keyword_const => { // Depending on the type of AST the initialization expression is, we may need an lvalue // or an rvalue as a result location. If it is an rvalue, we can use the instruction as // the variable, no memory location needed. const result_loc = if (nodeMayNeedMemoryLocation(init_node, scope)) r: { if (node.getTypeNode()) |type_node| { const type_inst = try typeExpr(mod, scope, type_node); const alloc = try addZIRUnOp(mod, scope, name_src, .alloc, type_inst); break :r ResultLoc{ .ptr = alloc }; } else { const alloc = try addZIRNoOpT(mod, scope, name_src, .alloc_inferred); break :r ResultLoc{ .inferred_ptr = alloc }; } } else r: { if (node.getTypeNode()) |type_node| break :r ResultLoc{ .ty = try typeExpr(mod, scope, type_node) } else break :r .none; }; const init_inst = try expr(mod, scope, result_loc, init_node); const sub_scope = try block_arena.create(Scope.LocalVal); sub_scope.* = .{ .parent = scope, .gen_zir = scope.getGenZIR(), .name = ident_name, .inst = init_inst, }; return &sub_scope.base; }, .Keyword_var => { const var_data: struct { result_loc: ResultLoc, alloc: *zir.Inst } = if (node.getTypeNode()) |type_node| a: { const type_inst = try typeExpr(mod, scope, type_node); const alloc = try addZIRUnOp(mod, scope, name_src, .alloc, type_inst); break :a .{ .alloc = alloc, .result_loc = .{ .ptr = alloc } }; } else a: { const alloc = try addZIRNoOp(mod, scope, name_src, .alloc_inferred); break :a .{ .alloc = alloc, .result_loc = .{ .inferred_ptr = alloc.castTag(.alloc_inferred).? } }; }; const init_inst = try expr(mod, scope, var_data.result_loc, init_node); const sub_scope = try block_arena.create(Scope.LocalPtr); sub_scope.* = .{ .parent = scope, .gen_zir = scope.getGenZIR(), .name = ident_name, .ptr = var_data.alloc, }; return &sub_scope.base; }, else => unreachable, } } fn assign(mod: *Module, scope: *Scope, infix_node: *ast.Node.SimpleInfixOp) InnerError!void { if (infix_node.lhs.castTag(.Identifier)) |ident| { // This intentionally does not support @"_" syntax. const ident_name = scope.tree().tokenSlice(ident.token); if (mem.eql(u8, ident_name, "_")) { _ = try expr(mod, scope, .discard, infix_node.rhs); return; } } const lvalue = try lvalExpr(mod, scope, infix_node.lhs); _ = try expr(mod, scope, .{ .ptr = lvalue }, infix_node.rhs); } fn assignOp( mod: *Module, scope: *Scope, infix_node: *ast.Node.SimpleInfixOp, op_inst_tag: zir.Inst.Tag, ) InnerError!void { const lhs_ptr = try lvalExpr(mod, scope, infix_node.lhs); const lhs = try addZIRUnOp(mod, scope, lhs_ptr.src, .deref, lhs_ptr); const lhs_type = try addZIRUnOp(mod, scope, lhs_ptr.src, .typeof, lhs); const rhs = try expr(mod, scope, .{ .ty = lhs_type }, infix_node.rhs); const tree = scope.tree(); const src = tree.token_locs[infix_node.op_token].start; const result = try addZIRBinOp(mod, scope, src, op_inst_tag, lhs, rhs); _ = try addZIRBinOp(mod, scope, src, .store, lhs_ptr, result); } fn boolNot(mod: *Module, scope: *Scope, node: *ast.Node.SimplePrefixOp) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const bool_type = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.bool_type), }); const operand = try expr(mod, scope, .{ .ty = bool_type }, node.rhs); return addZIRUnOp(mod, scope, src, .boolnot, operand); } fn bitNot(mod: *Module, scope: *Scope, node: *ast.Node.SimplePrefixOp) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const operand = try expr(mod, scope, .none, node.rhs); return addZIRUnOp(mod, scope, src, .bitnot, operand); } fn negation(mod: *Module, scope: *Scope, node: *ast.Node.SimplePrefixOp, op_inst_tag: zir.Inst.Tag) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const lhs = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.comptime_int), .val = Value.initTag(.zero), }); const rhs = try expr(mod, scope, .none, node.rhs); return addZIRBinOp(mod, scope, src, op_inst_tag, lhs, rhs); } fn addressOf(mod: *Module, scope: *Scope, node: *ast.Node.SimplePrefixOp) InnerError!*zir.Inst { return expr(mod, scope, .ref, node.rhs); } fn optionalType(mod: *Module, scope: *Scope, node: *ast.Node.SimplePrefixOp) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const operand = try typeExpr(mod, scope, node.rhs); return addZIRUnOp(mod, scope, src, .optional_type, operand); } fn sliceType(mod: *Module, scope: *Scope, node: *ast.Node.SliceType) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; return ptrSliceType(mod, scope, src, &node.ptr_info, node.rhs, .Slice); } fn ptrType(mod: *Module, scope: *Scope, node: *ast.Node.PtrType) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; return ptrSliceType(mod, scope, src, &node.ptr_info, node.rhs, switch (tree.token_ids[node.op_token]) { .Asterisk, .AsteriskAsterisk => .One, // TODO stage1 type inference bug .LBracket => @as(std.builtin.TypeInfo.Pointer.Size, switch (tree.token_ids[node.op_token + 2]) { .Identifier => .C, else => .Many, }), else => unreachable, }); } fn ptrSliceType(mod: *Module, scope: *Scope, src: usize, ptr_info: *ast.PtrInfo, rhs: *ast.Node, size: std.builtin.TypeInfo.Pointer.Size) InnerError!*zir.Inst { const simple = ptr_info.allowzero_token == null and ptr_info.align_info == null and ptr_info.volatile_token == null and ptr_info.sentinel == null; if (simple) { const child_type = try typeExpr(mod, scope, rhs); const mutable = ptr_info.const_token == null; // TODO stage1 type inference bug const T = zir.Inst.Tag; return addZIRUnOp(mod, scope, src, switch (size) { .One => if (mutable) T.single_mut_ptr_type else T.single_const_ptr_type, .Many => if (mutable) T.many_mut_ptr_type else T.many_const_ptr_type, .C => if (mutable) T.c_mut_ptr_type else T.c_const_ptr_type, .Slice => if (mutable) T.mut_slice_type else T.const_slice_type, }, child_type); } var kw_args: std.meta.fieldInfo(zir.Inst.PtrType, "kw_args").field_type = .{}; kw_args.size = size; kw_args.@"allowzero" = ptr_info.allowzero_token != null; if (ptr_info.align_info) |some| { kw_args.@"align" = try expr(mod, scope, .none, some.node); if (some.bit_range) |bit_range| { kw_args.align_bit_start = try expr(mod, scope, .none, bit_range.start); kw_args.align_bit_end = try expr(mod, scope, .none, bit_range.end); } } kw_args.mutable = ptr_info.const_token == null; kw_args.@"volatile" = ptr_info.volatile_token != null; if (ptr_info.sentinel) |some| { kw_args.sentinel = try expr(mod, scope, .none, some); } const child_type = try typeExpr(mod, scope, rhs); if (kw_args.sentinel) |some| { kw_args.sentinel = try addZIRBinOp(mod, scope, some.src, .as, child_type, some); } return addZIRInst(mod, scope, src, zir.Inst.PtrType, .{ .child_type = child_type }, kw_args); } fn arrayType(mod: *Module, scope: *Scope, node: *ast.Node.ArrayType) !*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const usize_type = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.usize_type), }); // TODO check for [_]T const len = try expr(mod, scope, .{ .ty = usize_type }, node.len_expr); const elem_type = try typeExpr(mod, scope, node.rhs); return addZIRBinOp(mod, scope, src, .array_type, len, elem_type); } fn arrayTypeSentinel(mod: *Module, scope: *Scope, node: *ast.Node.ArrayTypeSentinel) !*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const usize_type = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.usize_type), }); // TODO check for [_]T const len = try expr(mod, scope, .{ .ty = usize_type }, node.len_expr); const sentinel_uncasted = try expr(mod, scope, .none, node.sentinel); const elem_type = try typeExpr(mod, scope, node.rhs); const sentinel = try addZIRBinOp(mod, scope, src, .as, elem_type, sentinel_uncasted); return addZIRInst(mod, scope, src, zir.Inst.ArrayTypeSentinel, .{ .len = len, .sentinel = sentinel, .elem_type = elem_type, }, .{}); } fn anyFrameType(mod: *Module, scope: *Scope, node: *ast.Node.AnyFrameType) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.anyframe_token].start; if (node.result) |some| { const return_type = try typeExpr(mod, scope, some.return_type); return addZIRUnOp(mod, scope, src, .anyframe_type, return_type); } else { return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.anyframe_type), }); } } fn typeInixOp(mod: *Module, scope: *Scope, node: *ast.Node.SimpleInfixOp, op_inst_tag: zir.Inst.Tag) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const error_set = try typeExpr(mod, scope, node.lhs); const payload = try typeExpr(mod, scope, node.rhs); return addZIRBinOp(mod, scope, src, op_inst_tag, error_set, payload); } fn enumLiteral(mod: *Module, scope: *Scope, node: *ast.Node.EnumLiteral) !*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.name].start; const name = try identifierTokenString(mod, scope, node.name); return addZIRInst(mod, scope, src, zir.Inst.EnumLiteral, .{ .name = name }, .{}); } fn unwrapOptional(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.SimpleSuffixOp) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.rtoken].start; const operand = try expr(mod, scope, .ref, node.lhs); return rlWrapPtr(mod, scope, rl, try addZIRUnOp(mod, scope, src, .unwrap_optional_safe, operand)); } fn errorSetDecl(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.ErrorSetDecl) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.error_token].start; const decls = node.decls(); const fields = try scope.arena().alloc([]const u8, decls.len); for (decls) |decl, i| { const tag = decl.castTag(.ErrorTag).?; fields[i] = try identifierTokenString(mod, scope, tag.name_token); } // analyzing the error set results in a decl ref, so we might need to dereference it return rlWrapPtr(mod, scope, rl, try addZIRInst(mod, scope, src, zir.Inst.ErrorSet, .{ .fields = fields }, .{})); } fn errorType(mod: *Module, scope: *Scope, node: *ast.Node.OneToken) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.token].start; return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.anyerror_type), }); } fn catchExpr(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.Catch) InnerError!*zir.Inst { return orelseCatchExpr(mod, scope, rl, node.lhs, node.op_token, .iserr, .unwrap_err_unsafe, node.rhs, node.payload); } fn orelseExpr(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.SimpleInfixOp) InnerError!*zir.Inst { return orelseCatchExpr(mod, scope, rl, node.lhs, node.op_token, .isnull, .unwrap_optional_unsafe, node.rhs, null); } fn orelseCatchExpr( mod: *Module, scope: *Scope, rl: ResultLoc, lhs: *ast.Node, op_token: ast.TokenIndex, cond_op: zir.Inst.Tag, unwrap_op: zir.Inst.Tag, rhs: *ast.Node, payload_node: ?*ast.Node, ) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[op_token].start; const operand_ptr = try expr(mod, scope, .ref, lhs); // TODO we could avoid an unnecessary copy if .iserr, .isnull took a pointer const err_union = try addZIRUnOp(mod, scope, src, .deref, operand_ptr); const cond = try addZIRUnOp(mod, scope, src, cond_op, err_union); var block_scope: Scope.GenZIR = .{ .parent = scope, .decl = scope.decl().?, .arena = scope.arena(), .instructions = .{}, }; defer block_scope.instructions.deinit(mod.gpa); const condbr = try addZIRInstSpecial(mod, &block_scope.base, src, zir.Inst.CondBr, .{ .condition = cond, .then_body = undefined, // populated below .else_body = undefined, // populated below }, .{}); const block = try addZIRInstBlock(mod, scope, src, .block, .{ .instructions = try block_scope.arena.dupe(*zir.Inst, block_scope.instructions.items), }); // Most result location types can be forwarded directly; however // if we need to write to a pointer which has an inferred type, // proper type inference requires peer type resolution on the if's // branches. const branch_rl: ResultLoc = switch (rl) { .discard, .none, .ty, .ptr, .ref => rl, .inferred_ptr, .bitcasted_ptr, .block_ptr => .{ .block_ptr = block }, }; var then_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer then_scope.instructions.deinit(mod.gpa); var err_val_scope: Scope.LocalVal = undefined; const then_sub_scope = blk: { const payload = payload_node orelse break :blk &then_scope.base; const err_name = tree.tokenSlice(payload.castTag(.Payload).?.error_symbol.firstToken()); if (mem.eql(u8, err_name, "_")) break :blk &then_scope.base; const unwrapped_err_ptr = try addZIRUnOp(mod, &then_scope.base, src, .unwrap_err_code, operand_ptr); err_val_scope = .{ .parent = &then_scope.base, .gen_zir = &then_scope, .name = err_name, .inst = try addZIRUnOp(mod, &then_scope.base, src, .deref, unwrapped_err_ptr), }; break :blk &err_val_scope.base; }; _ = try addZIRInst(mod, &then_scope.base, src, zir.Inst.Break, .{ .block = block, .operand = try expr(mod, then_sub_scope, branch_rl, rhs), }, .{}); var else_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer else_scope.instructions.deinit(mod.gpa); const unwrapped_payload = try addZIRUnOp(mod, &else_scope.base, src, unwrap_op, operand_ptr); _ = try addZIRInst(mod, &else_scope.base, src, zir.Inst.Break, .{ .block = block, .operand = unwrapped_payload, }, .{}); condbr.positionals.then_body = .{ .instructions = try then_scope.arena.dupe(*zir.Inst, then_scope.instructions.items) }; condbr.positionals.else_body = .{ .instructions = try else_scope.arena.dupe(*zir.Inst, else_scope.instructions.items) }; return rlWrapPtr(mod, scope, rl, &block.base); } /// Return whether the identifier names of two tokens are equal. Resolves @"" tokens without allocating. /// OK in theory it could do it without allocating. This implementation allocates when the @"" form is used. fn tokenIdentEql(mod: *Module, scope: *Scope, token1: ast.TokenIndex, token2: ast.TokenIndex) !bool { const ident_name_1 = try identifierTokenString(mod, scope, token1); const ident_name_2 = try identifierTokenString(mod, scope, token2); return mem.eql(u8, ident_name_1, ident_name_2); } /// Identifier token -> String (allocated in scope.arena()) fn identifierTokenString(mod: *Module, scope: *Scope, token: ast.TokenIndex) InnerError![]const u8 { const tree = scope.tree(); const ident_name = tree.tokenSlice(token); if (mem.startsWith(u8, ident_name, "@")) { const raw_string = ident_name[1..]; var bad_index: usize = undefined; return std.zig.parseStringLiteral(scope.arena(), raw_string, &bad_index) catch |err| switch (err) { error.InvalidCharacter => { const bad_byte = raw_string[bad_index]; const src = tree.token_locs[token].start; return mod.fail(scope, src + 1 + bad_index, "invalid string literal character: '{c}'\n", .{bad_byte}); }, else => |e| return e, }; } return ident_name; } pub fn identifierStringInst(mod: *Module, scope: *Scope, node: *ast.Node.OneToken) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.token].start; const ident_name = try identifierTokenString(mod, scope, node.token); return addZIRInst(mod, scope, src, zir.Inst.Str, .{ .bytes = ident_name }, .{}); } fn field(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.SimpleInfixOp) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.op_token].start; const lhs = try expr(mod, scope, .ref, node.lhs); const field_name = try identifierStringInst(mod, scope, node.rhs.castTag(.Identifier).?); return rlWrapPtr(mod, scope, rl, try addZIRInst(mod, scope, src, zir.Inst.FieldPtr, .{ .object_ptr = lhs, .field_name = field_name }, .{})); } fn arrayAccess(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.ArrayAccess) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.rtoken].start; const array_ptr = try expr(mod, scope, .ref, node.lhs); const index = try expr(mod, scope, .none, node.index_expr); return rlWrapPtr(mod, scope, rl, try addZIRInst(mod, scope, src, zir.Inst.ElemPtr, .{ .array_ptr = array_ptr, .index = index }, .{})); } fn sliceExpr(mod: *Module, scope: *Scope, node: *ast.Node.Slice) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.rtoken].start; const usize_type = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.usize_type), }); const array_ptr = try expr(mod, scope, .ref, node.lhs); const start = try expr(mod, scope, .{ .ty = usize_type }, node.start); if (node.end == null and node.sentinel == null) { return try addZIRBinOp(mod, scope, src, .slice_start, array_ptr, start); } const end = if (node.end) |end| try expr(mod, scope, .{ .ty = usize_type }, end) else null; // we could get the child type here, but it is easier to just do it in semantic analysis. const sentinel = if (node.sentinel) |sentinel| try expr(mod, scope, .none, sentinel) else null; return try addZIRInst( mod, scope, src, zir.Inst.Slice, .{ .array_ptr = array_ptr, .start = start }, .{ .end = end, .sentinel = sentinel }, ); } fn deref(mod: *Module, scope: *Scope, node: *ast.Node.SimpleSuffixOp) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.rtoken].start; const lhs = try expr(mod, scope, .none, node.lhs); return addZIRUnOp(mod, scope, src, .deref, lhs); } fn simpleBinOp( mod: *Module, scope: *Scope, rl: ResultLoc, infix_node: *ast.Node.SimpleInfixOp, op_inst_tag: zir.Inst.Tag, ) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[infix_node.op_token].start; const lhs = try expr(mod, scope, .none, infix_node.lhs); const rhs = try expr(mod, scope, .none, infix_node.rhs); const result = try addZIRBinOp(mod, scope, src, op_inst_tag, lhs, rhs); return rlWrap(mod, scope, rl, result); } fn boolBinOp( mod: *Module, scope: *Scope, rl: ResultLoc, infix_node: *ast.Node.SimpleInfixOp, ) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[infix_node.op_token].start; const bool_type = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.bool_type), }); var block_scope: Scope.GenZIR = .{ .parent = scope, .decl = scope.decl().?, .arena = scope.arena(), .instructions = .{}, }; defer block_scope.instructions.deinit(mod.gpa); const lhs = try expr(mod, scope, .{ .ty = bool_type }, infix_node.lhs); const condbr = try addZIRInstSpecial(mod, &block_scope.base, src, zir.Inst.CondBr, .{ .condition = lhs, .then_body = undefined, // populated below .else_body = undefined, // populated below }, .{}); const block = try addZIRInstBlock(mod, scope, src, .block, .{ .instructions = try block_scope.arena.dupe(*zir.Inst, block_scope.instructions.items), }); var rhs_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer rhs_scope.instructions.deinit(mod.gpa); const rhs = try expr(mod, &rhs_scope.base, .{ .ty = bool_type }, infix_node.rhs); _ = try addZIRInst(mod, &rhs_scope.base, src, zir.Inst.Break, .{ .block = block, .operand = rhs, }, .{}); var const_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer const_scope.instructions.deinit(mod.gpa); const is_bool_and = infix_node.base.tag == .BoolAnd; _ = try addZIRInst(mod, &const_scope.base, src, zir.Inst.Break, .{ .block = block, .operand = try addZIRInstConst(mod, &const_scope.base, src, .{ .ty = Type.initTag(.bool), .val = if (is_bool_and) Value.initTag(.bool_false) else Value.initTag(.bool_true), }), }, .{}); if (is_bool_and) { // if lhs // AND // break rhs // else // break false condbr.positionals.then_body = .{ .instructions = try rhs_scope.arena.dupe(*zir.Inst, rhs_scope.instructions.items) }; condbr.positionals.else_body = .{ .instructions = try const_scope.arena.dupe(*zir.Inst, const_scope.instructions.items) }; } else { // if lhs // OR // break true // else // break rhs condbr.positionals.then_body = .{ .instructions = try const_scope.arena.dupe(*zir.Inst, const_scope.instructions.items) }; condbr.positionals.else_body = .{ .instructions = try rhs_scope.arena.dupe(*zir.Inst, rhs_scope.instructions.items) }; } return rlWrap(mod, scope, rl, &block.base); } const CondKind = union(enum) { bool, optional: ?*zir.Inst, err_union: ?*zir.Inst, fn cond(self: *CondKind, mod: *Module, block_scope: *Scope.GenZIR, src: usize, cond_node: *ast.Node) !*zir.Inst { switch (self.*) { .bool => { const bool_type = try addZIRInstConst(mod, &block_scope.base, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.bool_type), }); return try expr(mod, &block_scope.base, .{ .ty = bool_type }, cond_node); }, .optional => { const cond_ptr = try expr(mod, &block_scope.base, .ref, cond_node); self.* = .{ .optional = cond_ptr }; const result = try addZIRUnOp(mod, &block_scope.base, src, .deref, cond_ptr); return try addZIRUnOp(mod, &block_scope.base, src, .isnonnull, result); }, .err_union => { const err_ptr = try expr(mod, &block_scope.base, .ref, cond_node); self.* = .{ .err_union = err_ptr }; const result = try addZIRUnOp(mod, &block_scope.base, src, .deref, err_ptr); return try addZIRUnOp(mod, &block_scope.base, src, .iserr, result); }, } } fn thenSubScope(self: CondKind, mod: *Module, then_scope: *Scope.GenZIR, src: usize, payload_node: ?*ast.Node) !*Scope { if (self == .bool) return &then_scope.base; const payload = payload_node.?.castTag(.PointerPayload) orelse { // condition is error union and payload is not explicitly ignored _ = try addZIRUnOp(mod, &then_scope.base, src, .ensure_err_payload_void, self.err_union.?); return &then_scope.base; }; const is_ptr = payload.ptr_token != null; const ident_node = payload.value_symbol.castTag(.Identifier).?; // This intentionally does not support @"_" syntax. const ident_name = then_scope.base.tree().tokenSlice(ident_node.token); if (mem.eql(u8, ident_name, "_")) { if (is_ptr) return mod.failTok(&then_scope.base, payload.ptr_token.?, "pointer modifier invalid on discard", .{}); return &then_scope.base; } return mod.failNode(&then_scope.base, payload.value_symbol, "TODO implement payload symbols", .{}); } fn elseSubScope(self: CondKind, mod: *Module, else_scope: *Scope.GenZIR, src: usize, payload_node: ?*ast.Node) !*Scope { if (self != .err_union) return &else_scope.base; const payload_ptr = try addZIRUnOp(mod, &else_scope.base, src, .unwrap_err_unsafe, self.err_union.?); const payload = payload_node.?.castTag(.Payload).?; const ident_node = payload.error_symbol.castTag(.Identifier).?; // This intentionally does not support @"_" syntax. const ident_name = else_scope.base.tree().tokenSlice(ident_node.token); if (mem.eql(u8, ident_name, "_")) { return &else_scope.base; } return mod.failNode(&else_scope.base, payload.error_symbol, "TODO implement payload symbols", .{}); } }; fn ifExpr(mod: *Module, scope: *Scope, rl: ResultLoc, if_node: *ast.Node.If) InnerError!*zir.Inst { var cond_kind: CondKind = .bool; if (if_node.payload) |_| cond_kind = .{ .optional = null }; if (if_node.@"else") |else_node| { if (else_node.payload) |payload| { cond_kind = .{ .err_union = null }; } } var block_scope: Scope.GenZIR = .{ .parent = scope, .decl = scope.decl().?, .arena = scope.arena(), .instructions = .{}, }; defer block_scope.instructions.deinit(mod.gpa); const tree = scope.tree(); const if_src = tree.token_locs[if_node.if_token].start; const cond = try cond_kind.cond(mod, &block_scope, if_src, if_node.condition); const condbr = try addZIRInstSpecial(mod, &block_scope.base, if_src, zir.Inst.CondBr, .{ .condition = cond, .then_body = undefined, // populated below .else_body = undefined, // populated below }, .{}); const block = try addZIRInstBlock(mod, scope, if_src, .block, .{ .instructions = try block_scope.arena.dupe(*zir.Inst, block_scope.instructions.items), }); const then_src = tree.token_locs[if_node.body.lastToken()].start; var then_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer then_scope.instructions.deinit(mod.gpa); // declare payload to the then_scope const then_sub_scope = try cond_kind.thenSubScope(mod, &then_scope, then_src, if_node.payload); // Most result location types can be forwarded directly; however // if we need to write to a pointer which has an inferred type, // proper type inference requires peer type resolution on the if's // branches. const branch_rl: ResultLoc = switch (rl) { .discard, .none, .ty, .ptr, .ref => rl, .inferred_ptr, .bitcasted_ptr, .block_ptr => .{ .block_ptr = block }, }; const then_result = try expr(mod, then_sub_scope, branch_rl, if_node.body); if (!then_result.tag.isNoReturn()) { _ = try addZIRInst(mod, then_sub_scope, then_src, zir.Inst.Break, .{ .block = block, .operand = then_result, }, .{}); } condbr.positionals.then_body = .{ .instructions = try then_scope.arena.dupe(*zir.Inst, then_scope.instructions.items), }; var else_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer else_scope.instructions.deinit(mod.gpa); if (if_node.@"else") |else_node| { const else_src = tree.token_locs[else_node.body.lastToken()].start; // declare payload to the then_scope const else_sub_scope = try cond_kind.elseSubScope(mod, &else_scope, else_src, else_node.payload); const else_result = try expr(mod, else_sub_scope, branch_rl, else_node.body); if (!else_result.tag.isNoReturn()) { _ = try addZIRInst(mod, else_sub_scope, else_src, zir.Inst.Break, .{ .block = block, .operand = else_result, }, .{}); } } else { // TODO Optimization opportunity: we can avoid an allocation and a memcpy here // by directly allocating the body for this one instruction. const else_src = tree.token_locs[if_node.lastToken()].start; _ = try addZIRInst(mod, &else_scope.base, else_src, zir.Inst.BreakVoid, .{ .block = block, }, .{}); } condbr.positionals.else_body = .{ .instructions = try else_scope.arena.dupe(*zir.Inst, else_scope.instructions.items), }; return &block.base; } fn whileExpr(mod: *Module, scope: *Scope, rl: ResultLoc, while_node: *ast.Node.While) InnerError!*zir.Inst { var cond_kind: CondKind = .bool; if (while_node.payload) |_| cond_kind = .{ .optional = null }; if (while_node.@"else") |else_node| { if (else_node.payload) |payload| { cond_kind = .{ .err_union = null }; } } if (while_node.label) |tok| return mod.failTok(scope, tok, "TODO labeled while", .{}); if (while_node.inline_token) |tok| return mod.failTok(scope, tok, "TODO inline while", .{}); var expr_scope: Scope.GenZIR = .{ .parent = scope, .decl = scope.decl().?, .arena = scope.arena(), .instructions = .{}, }; defer expr_scope.instructions.deinit(mod.gpa); var loop_scope: Scope.GenZIR = .{ .parent = &expr_scope.base, .decl = expr_scope.decl, .arena = expr_scope.arena, .instructions = .{}, }; defer loop_scope.instructions.deinit(mod.gpa); var continue_scope: Scope.GenZIR = .{ .parent = &loop_scope.base, .decl = loop_scope.decl, .arena = loop_scope.arena, .instructions = .{}, }; defer continue_scope.instructions.deinit(mod.gpa); const tree = scope.tree(); const while_src = tree.token_locs[while_node.while_token].start; const void_type = try addZIRInstConst(mod, scope, while_src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.void_type), }); const cond = try cond_kind.cond(mod, &continue_scope, while_src, while_node.condition); const condbr = try addZIRInstSpecial(mod, &continue_scope.base, while_src, zir.Inst.CondBr, .{ .condition = cond, .then_body = undefined, // populated below .else_body = undefined, // populated below }, .{}); const cond_block = try addZIRInstBlock(mod, &loop_scope.base, while_src, .block, .{ .instructions = try loop_scope.arena.dupe(*zir.Inst, continue_scope.instructions.items), }); // TODO avoid emitting the continue expr when there // are no jumps to it. This happens when the last statement of a while body is noreturn // and there are no `continue` statements. // The "repeat" at the end of a loop body is implied. if (while_node.continue_expr) |cont_expr| { _ = try expr(mod, &loop_scope.base, .{ .ty = void_type }, cont_expr); } const loop = try addZIRInstLoop(mod, &expr_scope.base, while_src, .{ .instructions = try expr_scope.arena.dupe(*zir.Inst, loop_scope.instructions.items), }); const while_block = try addZIRInstBlock(mod, scope, while_src, .block, .{ .instructions = try expr_scope.arena.dupe(*zir.Inst, expr_scope.instructions.items), }); const then_src = tree.token_locs[while_node.body.lastToken()].start; var then_scope: Scope.GenZIR = .{ .parent = &continue_scope.base, .decl = continue_scope.decl, .arena = continue_scope.arena, .instructions = .{}, }; defer then_scope.instructions.deinit(mod.gpa); // declare payload to the then_scope const then_sub_scope = try cond_kind.thenSubScope(mod, &then_scope, then_src, while_node.payload); // Most result location types can be forwarded directly; however // if we need to write to a pointer which has an inferred type, // proper type inference requires peer type resolution on the while's // branches. const branch_rl: ResultLoc = switch (rl) { .discard, .none, .ty, .ptr, .ref => rl, .inferred_ptr, .bitcasted_ptr, .block_ptr => .{ .block_ptr = while_block }, }; const then_result = try expr(mod, then_sub_scope, branch_rl, while_node.body); if (!then_result.tag.isNoReturn()) { _ = try addZIRInst(mod, then_sub_scope, then_src, zir.Inst.Break, .{ .block = cond_block, .operand = then_result, }, .{}); } condbr.positionals.then_body = .{ .instructions = try then_scope.arena.dupe(*zir.Inst, then_scope.instructions.items), }; var else_scope: Scope.GenZIR = .{ .parent = &continue_scope.base, .decl = continue_scope.decl, .arena = continue_scope.arena, .instructions = .{}, }; defer else_scope.instructions.deinit(mod.gpa); if (while_node.@"else") |else_node| { const else_src = tree.token_locs[else_node.body.lastToken()].start; // declare payload to the then_scope const else_sub_scope = try cond_kind.elseSubScope(mod, &else_scope, else_src, else_node.payload); const else_result = try expr(mod, else_sub_scope, branch_rl, else_node.body); if (!else_result.tag.isNoReturn()) { _ = try addZIRInst(mod, else_sub_scope, else_src, zir.Inst.Break, .{ .block = while_block, .operand = else_result, }, .{}); } } else { const else_src = tree.token_locs[while_node.lastToken()].start; _ = try addZIRInst(mod, &else_scope.base, else_src, zir.Inst.BreakVoid, .{ .block = while_block, }, .{}); } condbr.positionals.else_body = .{ .instructions = try else_scope.arena.dupe(*zir.Inst, else_scope.instructions.items), }; return &while_block.base; } fn forExpr(mod: *Module, scope: *Scope, rl: ResultLoc, for_node: *ast.Node.For) InnerError!*zir.Inst { if (for_node.label) |tok| return mod.failTok(scope, tok, "TODO labeled for", .{}); if (for_node.inline_token) |tok| return mod.failTok(scope, tok, "TODO inline for", .{}); var for_scope: Scope.GenZIR = .{ .parent = scope, .decl = scope.decl().?, .arena = scope.arena(), .instructions = .{}, }; defer for_scope.instructions.deinit(mod.gpa); // setup variables and constants const tree = scope.tree(); const for_src = tree.token_locs[for_node.for_token].start; const index_ptr = blk: { const usize_type = try addZIRInstConst(mod, &for_scope.base, for_src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.usize_type), }); const index_ptr = try addZIRUnOp(mod, &for_scope.base, for_src, .alloc, usize_type); // initialize to zero const zero = try addZIRInstConst(mod, &for_scope.base, for_src, .{ .ty = Type.initTag(.usize), .val = Value.initTag(.zero), }); _ = try addZIRBinOp(mod, &for_scope.base, for_src, .store, index_ptr, zero); break :blk index_ptr; }; const array_ptr = try expr(mod, &for_scope.base, .ref, for_node.array_expr); _ = try addZIRUnOp(mod, &for_scope.base, for_node.array_expr.firstToken(), .ensure_indexable, array_ptr); const cond_src = tree.token_locs[for_node.array_expr.firstToken()].start; const len_ptr = try addZIRInst(mod, &for_scope.base, cond_src, zir.Inst.FieldPtr, .{ .object_ptr = array_ptr, .field_name = try addZIRInst(mod, &for_scope.base, cond_src, zir.Inst.Str, .{ .bytes = "len" }, .{}), }, .{}); var loop_scope: Scope.GenZIR = .{ .parent = &for_scope.base, .decl = for_scope.decl, .arena = for_scope.arena, .instructions = .{}, }; defer loop_scope.instructions.deinit(mod.gpa); var cond_scope: Scope.GenZIR = .{ .parent = &loop_scope.base, .decl = loop_scope.decl, .arena = loop_scope.arena, .instructions = .{}, }; defer cond_scope.instructions.deinit(mod.gpa); // check condition i < array_expr.len const index = try addZIRUnOp(mod, &cond_scope.base, cond_src, .deref, index_ptr); const len = try addZIRUnOp(mod, &cond_scope.base, cond_src, .deref, len_ptr); const cond = try addZIRBinOp(mod, &cond_scope.base, cond_src, .cmp_lt, index, len); const condbr = try addZIRInstSpecial(mod, &cond_scope.base, for_src, zir.Inst.CondBr, .{ .condition = cond, .then_body = undefined, // populated below .else_body = undefined, // populated below }, .{}); const cond_block = try addZIRInstBlock(mod, &loop_scope.base, for_src, .block, .{ .instructions = try loop_scope.arena.dupe(*zir.Inst, cond_scope.instructions.items), }); // increment index variable const one = try addZIRInstConst(mod, &loop_scope.base, for_src, .{ .ty = Type.initTag(.usize), .val = Value.initTag(.one), }); const index_2 = try addZIRUnOp(mod, &loop_scope.base, cond_src, .deref, index_ptr); const index_plus_one = try addZIRBinOp(mod, &loop_scope.base, for_src, .add, index_2, one); _ = try addZIRBinOp(mod, &loop_scope.base, for_src, .store, index_ptr, index_plus_one); // looping stuff const loop = try addZIRInstLoop(mod, &for_scope.base, for_src, .{ .instructions = try for_scope.arena.dupe(*zir.Inst, loop_scope.instructions.items), }); const for_block = try addZIRInstBlock(mod, scope, for_src, .block, .{ .instructions = try for_scope.arena.dupe(*zir.Inst, for_scope.instructions.items), }); // while body const then_src = tree.token_locs[for_node.body.lastToken()].start; var then_scope: Scope.GenZIR = .{ .parent = &cond_scope.base, .decl = cond_scope.decl, .arena = cond_scope.arena, .instructions = .{}, }; defer then_scope.instructions.deinit(mod.gpa); // Most result location types can be forwarded directly; however // if we need to write to a pointer which has an inferred type, // proper type inference requires peer type resolution on the while's // branches. const branch_rl: ResultLoc = switch (rl) { .discard, .none, .ty, .ptr, .ref => rl, .inferred_ptr, .bitcasted_ptr, .block_ptr => .{ .block_ptr = for_block }, }; var index_scope: Scope.LocalPtr = undefined; const then_sub_scope = blk: { const payload = for_node.payload.castTag(.PointerIndexPayload).?; const is_ptr = payload.ptr_token != null; const value_name = tree.tokenSlice(payload.value_symbol.firstToken()); if (!mem.eql(u8, value_name, "_")) { return mod.failNode(&then_scope.base, payload.value_symbol, "TODO implement for value payload", .{}); } else if (is_ptr) { return mod.failTok(&then_scope.base, payload.ptr_token.?, "pointer modifier invalid on discard", .{}); } const index_symbol_node = payload.index_symbol orelse break :blk &then_scope.base; const index_name = tree.tokenSlice(index_symbol_node.firstToken()); if (mem.eql(u8, index_name, "_")) { break :blk &then_scope.base; } // TODO make this const without an extra copy? index_scope = .{ .parent = &then_scope.base, .gen_zir = &then_scope, .name = index_name, .ptr = index_ptr, }; break :blk &index_scope.base; }; const then_result = try expr(mod, then_sub_scope, branch_rl, for_node.body); if (!then_result.tag.isNoReturn()) { _ = try addZIRInst(mod, then_sub_scope, then_src, zir.Inst.Break, .{ .block = cond_block, .operand = then_result, }, .{}); } condbr.positionals.then_body = .{ .instructions = try then_scope.arena.dupe(*zir.Inst, then_scope.instructions.items), }; // else branch var else_scope: Scope.GenZIR = .{ .parent = &cond_scope.base, .decl = cond_scope.decl, .arena = cond_scope.arena, .instructions = .{}, }; defer else_scope.instructions.deinit(mod.gpa); if (for_node.@"else") |else_node| { const else_src = tree.token_locs[else_node.body.lastToken()].start; const else_result = try expr(mod, &else_scope.base, branch_rl, else_node.body); if (!else_result.tag.isNoReturn()) { _ = try addZIRInst(mod, &else_scope.base, else_src, zir.Inst.Break, .{ .block = for_block, .operand = else_result, }, .{}); } } else { const else_src = tree.token_locs[for_node.lastToken()].start; _ = try addZIRInst(mod, &else_scope.base, else_src, zir.Inst.BreakVoid, .{ .block = for_block, }, .{}); } condbr.positionals.else_body = .{ .instructions = try else_scope.arena.dupe(*zir.Inst, else_scope.instructions.items), }; return &for_block.base; } fn getRangeNode(node: *ast.Node) ?*ast.Node.SimpleInfixOp { var cur = node; while (true) { switch (cur.tag) { .Range => return @fieldParentPtr(ast.Node.SimpleInfixOp, "base", cur), .GroupedExpression => cur = @fieldParentPtr(ast.Node.GroupedExpression, "base", cur).expr, else => return null, } } } fn switchExpr(mod: *Module, scope: *Scope, rl: ResultLoc, switch_node: *ast.Node.Switch) InnerError!*zir.Inst { var block_scope: Scope.GenZIR = .{ .parent = scope, .decl = scope.decl().?, .arena = scope.arena(), .instructions = .{}, }; defer block_scope.instructions.deinit(mod.gpa); const tree = scope.tree(); const switch_src = tree.token_locs[switch_node.switch_token].start; const target_ptr = try expr(mod, &block_scope.base, .ref, switch_node.expr); const target = try addZIRUnOp(mod, &block_scope.base, target_ptr.src, .deref, target_ptr); // Add the switch instruction here so that it comes before any range checks. const switch_inst = (try addZIRInst(mod, &block_scope.base, switch_src, zir.Inst.SwitchBr, .{ .target_ptr = target_ptr, .cases = undefined, // populated below .items = &[_]*zir.Inst{}, // populated below .else_body = undefined, // populated below }, .{})).castTag(.switchbr).?; var items = std.ArrayList(*zir.Inst).init(mod.gpa); defer items.deinit(); var cases = std.ArrayList(zir.Inst.SwitchBr.Case).init(mod.gpa); defer cases.deinit(); // Add comptime block containing all prong items first, const item_block = try addZIRInstBlock(mod, scope, switch_src, .block_comptime_flat, .{ .instructions = undefined, // populated below }); // then add block containing the switch. const block = try addZIRInstBlock(mod, scope, switch_src, .block, .{ .instructions = try block_scope.arena.dupe(*zir.Inst, block_scope.instructions.items), }); // Most result location types can be forwarded directly; however // if we need to write to a pointer which has an inferred type, // proper type inference requires peer type resolution on the switch case. const case_rl: ResultLoc = switch (rl) { .discard, .none, .ty, .ptr, .ref => rl, .inferred_ptr, .bitcasted_ptr, .block_ptr => .{ .block_ptr = block }, }; var item_scope: Scope.GenZIR = .{ .parent = scope, .decl = scope.decl().?, .arena = scope.arena(), .instructions = .{}, }; defer item_scope.instructions.deinit(mod.gpa); var case_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer case_scope.instructions.deinit(mod.gpa); var else_scope: Scope.GenZIR = .{ .parent = scope, .decl = block_scope.decl, .arena = block_scope.arena, .instructions = .{}, }; defer else_scope.instructions.deinit(mod.gpa); // first we gather all the switch items and check else/'_' prongs var else_src: ?usize = null; var underscore_src: ?usize = null; var first_range: ?*zir.Inst = null; var special_case: ?*ast.Node.SwitchCase = null; for (switch_node.cases()) |uncasted_case| { const case = uncasted_case.castTag(.SwitchCase).?; const case_src = tree.token_locs[case.firstToken()].start; // reset without freeing to reduce allocations. case_scope.instructions.items.len = 0; assert(case.items_len != 0); // Check for else/_ prong, those are handled last. if (case.items_len == 1 and case.items()[0].tag == .SwitchElse) { if (else_src) |src| { return mod.fail(scope, case_src, "multiple else prongs in switch expression", .{}); // TODO notes "previous else prong is here" } else_src = case_src; special_case = case; continue; } else if (case.items_len == 1 and case.items()[0].tag == .Identifier and mem.eql(u8, tree.tokenSlice(case.items()[0].firstToken()), "_")) { if (underscore_src) |src| { return mod.fail(scope, case_src, "multiple '_' prongs in switch expression", .{}); // TODO notes "previous '_' prong is here" } underscore_src = case_src; special_case = case; continue; } if (else_src) |some_else| { if (underscore_src) |some_underscore| { return mod.fail(scope, switch_src, "else and '_' prong in switch expression", .{}); // TODO notes "else prong is here" // TODO notes "'_' prong is here" } } // If this is a simple one item prong then it is handled by the switchbr. if (case.items_len == 1 and getRangeNode(case.items()[0]) == null) { const item = try expr(mod, &item_scope.base, .none, case.items()[0]); try items.append(item); try switchCaseExpr(mod, &case_scope.base, case_rl, block, case); try cases.append(.{ .item = item, .body = .{ .instructions = try scope.arena().dupe(*zir.Inst, case_scope.instructions.items) }, }); continue; } // TODO if the case has few items and no ranges it might be better // to just handle them as switch prongs. // Check if the target matches any of the items. // 1, 2, 3..6 will result in // target == 1 or target == 2 or (target >= 3 and target <= 6) var any_ok: ?*zir.Inst = null; for (case.items()) |item| { if (getRangeNode(item)) |range| { const start = try expr(mod, &item_scope.base, .none, range.lhs); const end = try expr(mod, &item_scope.base, .none, range.rhs); const range_src = tree.token_locs[range.op_token].start; const range_inst = try addZIRBinOp(mod, &item_scope.base, range_src, .switch_range, start, end); try items.append(range_inst); if (first_range == null) first_range = range_inst; // target >= start and target <= end const range_start_ok = try addZIRBinOp(mod, &else_scope.base, range_src, .cmp_gte, target, start); const range_end_ok = try addZIRBinOp(mod, &else_scope.base, range_src, .cmp_lte, target, end); const range_ok = try addZIRBinOp(mod, &else_scope.base, range_src, .booland, range_start_ok, range_end_ok); if (any_ok) |some| { any_ok = try addZIRBinOp(mod, &else_scope.base, range_src, .boolor, some, range_ok); } else { any_ok = range_ok; } continue; } const item_inst = try expr(mod, &item_scope.base, .none, item); try items.append(item_inst); const cpm_ok = try addZIRBinOp(mod, &else_scope.base, item_inst.src, .cmp_eq, target, item_inst); if (any_ok) |some| { any_ok = try addZIRBinOp(mod, &else_scope.base, item_inst.src, .boolor, some, cpm_ok); } else { any_ok = cpm_ok; } } const condbr = try addZIRInstSpecial(mod, &case_scope.base, case_src, zir.Inst.CondBr, .{ .condition = any_ok.?, .then_body = undefined, // populated below .else_body = undefined, // populated below }, .{}); const cond_block = try addZIRInstBlock(mod, &else_scope.base, case_src, .block, .{ .instructions = try scope.arena().dupe(*zir.Inst, case_scope.instructions.items), }); // reset cond_scope for then_body case_scope.instructions.items.len = 0; try switchCaseExpr(mod, &case_scope.base, case_rl, block, case); condbr.positionals.then_body = .{ .instructions = try scope.arena().dupe(*zir.Inst, case_scope.instructions.items), }; // reset cond_scope for else_body case_scope.instructions.items.len = 0; _ = try addZIRInst(mod, &case_scope.base, case_src, zir.Inst.BreakVoid, .{ .block = cond_block, }, .{}); condbr.positionals.else_body = .{ .instructions = try scope.arena().dupe(*zir.Inst, case_scope.instructions.items), }; } // Generate else block or a break last to finish the block. if (special_case) |case| { try switchCaseExpr(mod, &else_scope.base, case_rl, block, case); } else { // Not handling all possible cases is a compile error. _ = try addZIRNoOp(mod, &else_scope.base, switch_src, .unreach_nocheck); } // All items have been generated, add the instructions to the comptime block. item_block.positionals.body = .{ .instructions = try block_scope.arena.dupe(*zir.Inst, item_scope.instructions.items), }; // Actually populate switch instruction values. if (else_src != null) switch_inst.kw_args.special_prong = .@"else"; if (underscore_src != null) switch_inst.kw_args.special_prong = .underscore; switch_inst.positionals.cases = try block_scope.arena.dupe(zir.Inst.SwitchBr.Case, cases.items); switch_inst.positionals.items = try block_scope.arena.dupe(*zir.Inst, items.items); switch_inst.kw_args.range = first_range; switch_inst.positionals.else_body = .{ .instructions = try block_scope.arena.dupe(*zir.Inst, else_scope.instructions.items), }; return &block.base; } fn switchCaseExpr(mod: *Module, scope: *Scope, rl: ResultLoc, block: *zir.Inst.Block, case: *ast.Node.SwitchCase) !void { const tree = scope.tree(); const case_src = tree.token_locs[case.firstToken()].start; if (case.payload != null) { return mod.fail(scope, case_src, "TODO switch case payload capture", .{}); } const case_body = try expr(mod, scope, rl, case.expr); if (!case_body.tag.isNoReturn()) { _ = try addZIRInst(mod, scope, case_src, zir.Inst.Break, .{ .block = block, .operand = case_body, }, .{}); } } fn ret(mod: *Module, scope: *Scope, cfe: *ast.Node.ControlFlowExpression) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[cfe.ltoken].start; if (cfe.getRHS()) |rhs_node| { if (nodeMayNeedMemoryLocation(rhs_node, scope)) { const ret_ptr = try addZIRNoOp(mod, scope, src, .ret_ptr); const operand = try expr(mod, scope, .{ .ptr = ret_ptr }, rhs_node); return addZIRUnOp(mod, scope, src, .@"return", operand); } else { const fn_ret_ty = try addZIRNoOp(mod, scope, src, .ret_type); const operand = try expr(mod, scope, .{ .ty = fn_ret_ty }, rhs_node); return addZIRUnOp(mod, scope, src, .@"return", operand); } } else { return addZIRNoOp(mod, scope, src, .returnvoid); } } fn identifier(mod: *Module, scope: *Scope, rl: ResultLoc, ident: *ast.Node.OneToken) InnerError!*zir.Inst { const tracy = trace(@src()); defer tracy.end(); const tree = scope.tree(); const ident_name = try identifierTokenString(mod, scope, ident.token); const src = tree.token_locs[ident.token].start; if (mem.eql(u8, ident_name, "_")) { return mod.failNode(scope, &ident.base, "TODO implement '_' identifier", .{}); } if (getSimplePrimitiveValue(ident_name)) |typed_value| { const result = try addZIRInstConst(mod, scope, src, typed_value); return rlWrap(mod, scope, rl, result); } if (ident_name.len >= 2) integer: { const first_c = ident_name[0]; if (first_c == 'i' or first_c == 'u') { const is_signed = first_c == 'i'; const bit_count = std.fmt.parseInt(u16, ident_name[1..], 10) catch |err| switch (err) { error.Overflow => return mod.failNode( scope, &ident.base, "primitive integer type '{}' exceeds maximum bit width of 65535", .{ident_name}, ), error.InvalidCharacter => break :integer, }; const val = switch (bit_count) { 8 => if (is_signed) Value.initTag(.i8_type) else Value.initTag(.u8_type), 16 => if (is_signed) Value.initTag(.i16_type) else Value.initTag(.u16_type), 32 => if (is_signed) Value.initTag(.i32_type) else Value.initTag(.u32_type), 64 => if (is_signed) Value.initTag(.i64_type) else Value.initTag(.u64_type), else => { const int_type_payload = try scope.arena().create(Value.Payload.IntType); int_type_payload.* = .{ .signed = is_signed, .bits = bit_count }; const result = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initPayload(&int_type_payload.base), }); return rlWrap(mod, scope, rl, result); }, }; const result = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = val, }); return rlWrap(mod, scope, rl, result); } } // Local variables, including function parameters. { var s = scope; while (true) switch (s.tag) { .local_val => { const local_val = s.cast(Scope.LocalVal).?; if (mem.eql(u8, local_val.name, ident_name)) { return rlWrap(mod, scope, rl, local_val.inst); } s = local_val.parent; }, .local_ptr => { const local_ptr = s.cast(Scope.LocalPtr).?; if (mem.eql(u8, local_ptr.name, ident_name)) { return rlWrapPtr(mod, scope, rl, local_ptr.ptr); } s = local_ptr.parent; }, .gen_zir => s = s.cast(Scope.GenZIR).?.parent, else => break, }; } if (mod.lookupDeclName(scope, ident_name)) |decl| { return rlWrapPtr(mod, scope, rl, try addZIRInst(mod, scope, src, zir.Inst.DeclValInModule, .{ .decl = decl }, .{})); } return mod.failNode(scope, &ident.base, "use of undeclared identifier '{}'", .{ident_name}); } fn stringLiteral(mod: *Module, scope: *Scope, str_lit: *ast.Node.OneToken) InnerError!*zir.Inst { const tree = scope.tree(); const unparsed_bytes = tree.tokenSlice(str_lit.token); const arena = scope.arena(); var bad_index: usize = undefined; const bytes = std.zig.parseStringLiteral(arena, unparsed_bytes, &bad_index) catch |err| switch (err) { error.InvalidCharacter => { const bad_byte = unparsed_bytes[bad_index]; const src = tree.token_locs[str_lit.token].start; return mod.fail(scope, src + bad_index, "invalid string literal character: '{c}'\n", .{bad_byte}); }, else => |e| return e, }; const src = tree.token_locs[str_lit.token].start; return addZIRInst(mod, scope, src, zir.Inst.Str, .{ .bytes = bytes }, .{}); } fn multilineStrLiteral(mod: *Module, scope: *Scope, node: *ast.Node.MultilineStringLiteral) !*zir.Inst { const tree = scope.tree(); const lines = node.linesConst(); const src = tree.token_locs[lines[0]].start; // line lengths and new lines var len = lines.len - 1; for (lines) |line| { // 2 for the '//' + 1 for '\n' len += tree.tokenSlice(line).len - 3; } const bytes = try scope.arena().alloc(u8, len); var i: usize = 0; for (lines) |line, line_i| { if (line_i != 0) { bytes[i] = '\n'; i += 1; } const slice = tree.tokenSlice(line); mem.copy(u8, bytes[i..], slice[2 .. slice.len - 1]); i += slice.len - 3; } return addZIRInst(mod, scope, src, zir.Inst.Str, .{ .bytes = bytes }, .{}); } fn charLiteral(mod: *Module, scope: *Scope, node: *ast.Node.OneToken) !*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[node.token].start; const slice = tree.tokenSlice(node.token); var bad_index: usize = undefined; const value = std.zig.parseCharLiteral(slice, &bad_index) catch |err| switch (err) { error.InvalidCharacter => { const bad_byte = slice[bad_index]; return mod.fail(scope, src + bad_index, "invalid character: '{c}'\n", .{bad_byte}); }, }; const int_payload = try scope.arena().create(Value.Payload.Int_u64); int_payload.* = .{ .int = value }; return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.comptime_int), .val = Value.initPayload(&int_payload.base), }); } fn integerLiteral(mod: *Module, scope: *Scope, int_lit: *ast.Node.OneToken) InnerError!*zir.Inst { const arena = scope.arena(); const tree = scope.tree(); const prefixed_bytes = tree.tokenSlice(int_lit.token); const base = if (mem.startsWith(u8, prefixed_bytes, "0x")) 16 else if (mem.startsWith(u8, prefixed_bytes, "0o")) 8 else if (mem.startsWith(u8, prefixed_bytes, "0b")) 2 else @as(u8, 10); const bytes = if (base == 10) prefixed_bytes else prefixed_bytes[2..]; if (std.fmt.parseInt(u64, bytes, base)) |small_int| { const int_payload = try arena.create(Value.Payload.Int_u64); int_payload.* = .{ .int = small_int }; const src = tree.token_locs[int_lit.token].start; return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.comptime_int), .val = Value.initPayload(&int_payload.base), }); } else |err| { return mod.failTok(scope, int_lit.token, "TODO implement int literals that don't fit in a u64", .{}); } } fn floatLiteral(mod: *Module, scope: *Scope, float_lit: *ast.Node.OneToken) InnerError!*zir.Inst { const arena = scope.arena(); const tree = scope.tree(); const bytes = tree.tokenSlice(float_lit.token); if (bytes.len > 2 and bytes[1] == 'x') { return mod.failTok(scope, float_lit.token, "TODO hex floats", .{}); } const val = std.fmt.parseFloat(f128, bytes) catch |e| switch (e) { error.InvalidCharacter => unreachable, // validated by tokenizer }; const float_payload = try arena.create(Value.Payload.Float_128); float_payload.* = .{ .val = val }; const src = tree.token_locs[float_lit.token].start; return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.comptime_float), .val = Value.initPayload(&float_payload.base), }); } fn undefLiteral(mod: *Module, scope: *Scope, node: *ast.Node.OneToken) InnerError!*zir.Inst { const arena = scope.arena(); const tree = scope.tree(); const src = tree.token_locs[node.token].start; return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.@"undefined"), .val = Value.initTag(.undef), }); } fn boolLiteral(mod: *Module, scope: *Scope, node: *ast.Node.OneToken) InnerError!*zir.Inst { const arena = scope.arena(); const tree = scope.tree(); const src = tree.token_locs[node.token].start; return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.bool), .val = switch (tree.token_ids[node.token]) { .Keyword_true => Value.initTag(.bool_true), .Keyword_false => Value.initTag(.bool_false), else => unreachable, }, }); } fn nullLiteral(mod: *Module, scope: *Scope, node: *ast.Node.OneToken) InnerError!*zir.Inst { const arena = scope.arena(); const tree = scope.tree(); const src = tree.token_locs[node.token].start; return addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.@"null"), .val = Value.initTag(.null_value), }); } fn assembly(mod: *Module, scope: *Scope, asm_node: *ast.Node.Asm) InnerError!*zir.Inst { if (asm_node.outputs.len != 0) { return mod.failNode(scope, &asm_node.base, "TODO implement asm with an output", .{}); } const arena = scope.arena(); const tree = scope.tree(); const inputs = try arena.alloc(*zir.Inst, asm_node.inputs.len); const args = try arena.alloc(*zir.Inst, asm_node.inputs.len); const src = tree.token_locs[asm_node.asm_token].start; const str_type = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.const_slice_u8_type), }); const str_type_rl: ResultLoc = .{ .ty = str_type }; for (asm_node.inputs) |input, i| { // TODO semantically analyze constraints inputs[i] = try expr(mod, scope, str_type_rl, input.constraint); args[i] = try expr(mod, scope, .none, input.expr); } const return_type = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.type), .val = Value.initTag(.void_type), }); const asm_inst = try addZIRInst(mod, scope, src, zir.Inst.Asm, .{ .asm_source = try expr(mod, scope, str_type_rl, asm_node.template), .return_type = return_type, }, .{ .@"volatile" = asm_node.volatile_token != null, //.clobbers = TODO handle clobbers .inputs = inputs, .args = args, }); return asm_inst; } fn ensureBuiltinParamCount(mod: *Module, scope: *Scope, call: *ast.Node.BuiltinCall, count: u32) !void { if (call.params_len == count) return; const s = if (count == 1) "" else "s"; return mod.failTok(scope, call.builtin_token, "expected {} parameter{}, found {}", .{ count, s, call.params_len }); } fn simpleCast( mod: *Module, scope: *Scope, rl: ResultLoc, call: *ast.Node.BuiltinCall, inst_tag: zir.Inst.Tag, ) InnerError!*zir.Inst { try ensureBuiltinParamCount(mod, scope, call, 2); const tree = scope.tree(); const src = tree.token_locs[call.builtin_token].start; const params = call.params(); const dest_type = try typeExpr(mod, scope, params[0]); const rhs = try expr(mod, scope, .none, params[1]); const result = try addZIRBinOp(mod, scope, src, inst_tag, dest_type, rhs); return rlWrap(mod, scope, rl, result); } fn ptrToInt(mod: *Module, scope: *Scope, call: *ast.Node.BuiltinCall) InnerError!*zir.Inst { try ensureBuiltinParamCount(mod, scope, call, 1); const operand = try expr(mod, scope, .none, call.params()[0]); const tree = scope.tree(); const src = tree.token_locs[call.builtin_token].start; return addZIRUnOp(mod, scope, src, .ptrtoint, operand); } fn as(mod: *Module, scope: *Scope, rl: ResultLoc, call: *ast.Node.BuiltinCall) InnerError!*zir.Inst { try ensureBuiltinParamCount(mod, scope, call, 2); const tree = scope.tree(); const src = tree.token_locs[call.builtin_token].start; const params = call.params(); const dest_type = try typeExpr(mod, scope, params[0]); switch (rl) { .none => return try expr(mod, scope, .{ .ty = dest_type }, params[1]), .discard => { const result = try expr(mod, scope, .{ .ty = dest_type }, params[1]); _ = try addZIRUnOp(mod, scope, result.src, .ensure_result_non_error, result); return result; }, .ref => { const result = try expr(mod, scope, .{ .ty = dest_type }, params[1]); return addZIRUnOp(mod, scope, result.src, .ref, result); }, .ty => |result_ty| { const result = try expr(mod, scope, .{ .ty = dest_type }, params[1]); return addZIRBinOp(mod, scope, src, .as, result_ty, result); }, .ptr => |result_ptr| { const casted_result_ptr = try addZIRBinOp(mod, scope, src, .coerce_result_ptr, dest_type, result_ptr); return expr(mod, scope, .{ .ptr = casted_result_ptr }, params[1]); }, .bitcasted_ptr => |bitcasted_ptr| { // TODO here we should be able to resolve the inference; we now have a type for the result. return mod.failTok(scope, call.builtin_token, "TODO implement @as with result location @bitCast", .{}); }, .inferred_ptr => |result_alloc| { // TODO here we should be able to resolve the inference; we now have a type for the result. return mod.failTok(scope, call.builtin_token, "TODO implement @as with inferred-type result location pointer", .{}); }, .block_ptr => |block_ptr| { const casted_block_ptr = try addZIRInst(mod, scope, src, zir.Inst.CoerceResultBlockPtr, .{ .dest_type = dest_type, .block = block_ptr, }, .{}); return expr(mod, scope, .{ .ptr = casted_block_ptr }, params[1]); }, } } fn bitCast(mod: *Module, scope: *Scope, rl: ResultLoc, call: *ast.Node.BuiltinCall) InnerError!*zir.Inst { try ensureBuiltinParamCount(mod, scope, call, 2); const tree = scope.tree(); const src = tree.token_locs[call.builtin_token].start; const params = call.params(); const dest_type = try typeExpr(mod, scope, params[0]); switch (rl) { .none => { const operand = try expr(mod, scope, .none, params[1]); return addZIRBinOp(mod, scope, src, .bitcast, dest_type, operand); }, .discard => { const operand = try expr(mod, scope, .none, params[1]); const result = try addZIRBinOp(mod, scope, src, .bitcast, dest_type, operand); _ = try addZIRUnOp(mod, scope, result.src, .ensure_result_non_error, result); return result; }, .ref => { const operand = try expr(mod, scope, .ref, params[1]); const result = try addZIRBinOp(mod, scope, src, .bitcast_ref, dest_type, operand); return result; }, .ty => |result_ty| { const result = try expr(mod, scope, .none, params[1]); const bitcasted = try addZIRBinOp(mod, scope, src, .bitcast, dest_type, result); return addZIRBinOp(mod, scope, src, .as, result_ty, bitcasted); }, .ptr => |result_ptr| { const casted_result_ptr = try addZIRUnOp(mod, scope, src, .bitcast_result_ptr, result_ptr); return expr(mod, scope, .{ .bitcasted_ptr = casted_result_ptr.castTag(.bitcast_result_ptr).? }, params[1]); }, .bitcasted_ptr => |bitcasted_ptr| { return mod.failTok(scope, call.builtin_token, "TODO implement @bitCast with result location another @bitCast", .{}); }, .block_ptr => |block_ptr| { return mod.failTok(scope, call.builtin_token, "TODO implement @bitCast with result location inferred peer types", .{}); }, .inferred_ptr => |result_alloc| { // TODO here we should be able to resolve the inference; we now have a type for the result. return mod.failTok(scope, call.builtin_token, "TODO implement @bitCast with inferred-type result location pointer", .{}); }, } } fn import(mod: *Module, scope: *Scope, call: *ast.Node.BuiltinCall) InnerError!*zir.Inst { try ensureBuiltinParamCount(mod, scope, call, 1); const tree = scope.tree(); const src = tree.token_locs[call.builtin_token].start; const params = call.params(); const target = try expr(mod, scope, .none, params[0]); return addZIRUnOp(mod, scope, src, .import, target); } fn typeOf(mod: *Module, scope: *Scope, rl: ResultLoc, call: *ast.Node.BuiltinCall) InnerError!*zir.Inst { const tree = scope.tree(); const arena = scope.arena(); const src = tree.token_locs[call.builtin_token].start; const params = call.params(); if (params.len < 1) { return mod.failTok(scope, call.builtin_token, "expected at least 1 argument, found 0", .{}); } if (params.len == 1) { return rlWrap(mod, scope, rl, try addZIRUnOp(mod, scope, src, .typeof, try expr(mod, scope, .none, params[0]))); } var items = try arena.alloc(*zir.Inst, params.len); for (params) |param, param_i| items[param_i] = try expr(mod, scope, .none, param); return rlWrap(mod, scope, rl, try addZIRInst(mod, scope, src, zir.Inst.TypeOfPeer, .{ .items = items }, .{})); } fn builtinCall(mod: *Module, scope: *Scope, rl: ResultLoc, call: *ast.Node.BuiltinCall) InnerError!*zir.Inst { const tree = scope.tree(); const builtin_name = tree.tokenSlice(call.builtin_token); // We handle the different builtins manually because they have different semantics depending // on the function. For example, `@as` and others participate in result location semantics, // and `@cImport` creates a special scope that collects a .c source code text buffer. // Also, some builtins have a variable number of parameters. if (mem.eql(u8, builtin_name, "@ptrToInt")) { return rlWrap(mod, scope, rl, try ptrToInt(mod, scope, call)); } else if (mem.eql(u8, builtin_name, "@as")) { return as(mod, scope, rl, call); } else if (mem.eql(u8, builtin_name, "@floatCast")) { return simpleCast(mod, scope, rl, call, .floatcast); } else if (mem.eql(u8, builtin_name, "@intCast")) { return simpleCast(mod, scope, rl, call, .intcast); } else if (mem.eql(u8, builtin_name, "@bitCast")) { return bitCast(mod, scope, rl, call); } else if (mem.eql(u8, builtin_name, "@TypeOf")) { return typeOf(mod, scope, rl, call); } else if (mem.eql(u8, builtin_name, "@breakpoint")) { const src = tree.token_locs[call.builtin_token].start; return rlWrap(mod, scope, rl, try addZIRNoOp(mod, scope, src, .breakpoint)); } else if (mem.eql(u8, builtin_name, "@import")) { return rlWrap(mod, scope, rl, try import(mod, scope, call)); } else { return mod.failTok(scope, call.builtin_token, "invalid builtin function: '{}'", .{builtin_name}); } } fn callExpr(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node.Call) InnerError!*zir.Inst { const tree = scope.tree(); const lhs = try expr(mod, scope, .none, node.lhs); const param_nodes = node.params(); const args = try scope.getGenZIR().arena.alloc(*zir.Inst, param_nodes.len); for (param_nodes) |param_node, i| { const param_src = tree.token_locs[param_node.firstToken()].start; const param_type = try addZIRInst(mod, scope, param_src, zir.Inst.ParamType, .{ .func = lhs, .arg_index = i, }, .{}); args[i] = try expr(mod, scope, .{ .ty = param_type }, param_node); } const src = tree.token_locs[node.lhs.firstToken()].start; const result = try addZIRInst(mod, scope, src, zir.Inst.Call, .{ .func = lhs, .args = args, }, .{}); // TODO function call with result location return rlWrap(mod, scope, rl, result); } fn unreach(mod: *Module, scope: *Scope, unreach_node: *ast.Node.OneToken) InnerError!*zir.Inst { const tree = scope.tree(); const src = tree.token_locs[unreach_node.token].start; return addZIRNoOp(mod, scope, src, .@"unreachable"); } fn getSimplePrimitiveValue(name: []const u8) ?TypedValue { const simple_types = std.ComptimeStringMap(Value.Tag, .{ .{ "u8", .u8_type }, .{ "i8", .i8_type }, .{ "isize", .isize_type }, .{ "usize", .usize_type }, .{ "c_short", .c_short_type }, .{ "c_ushort", .c_ushort_type }, .{ "c_int", .c_int_type }, .{ "c_uint", .c_uint_type }, .{ "c_long", .c_long_type }, .{ "c_ulong", .c_ulong_type }, .{ "c_longlong", .c_longlong_type }, .{ "c_ulonglong", .c_ulonglong_type }, .{ "c_longdouble", .c_longdouble_type }, .{ "f16", .f16_type }, .{ "f32", .f32_type }, .{ "f64", .f64_type }, .{ "f128", .f128_type }, .{ "c_void", .c_void_type }, .{ "bool", .bool_type }, .{ "void", .void_type }, .{ "type", .type_type }, .{ "anyerror", .anyerror_type }, .{ "comptime_int", .comptime_int_type }, .{ "comptime_float", .comptime_float_type }, .{ "noreturn", .noreturn_type }, }); if (simple_types.get(name)) |tag| { return TypedValue{ .ty = Type.initTag(.type), .val = Value.initTag(tag), }; } return null; } fn nodeMayNeedMemoryLocation(start_node: *ast.Node, scope: *Scope) bool { var node = start_node; while (true) { switch (node.tag) { .Root, .Use, .TestDecl, .DocComment, .SwitchCase, .SwitchElse, .Else, .Payload, .PointerPayload, .PointerIndexPayload, .ContainerField, .ErrorTag, .FieldInitializer, => unreachable, .Return, .Break, .Continue, .BitNot, .BoolNot, .VarDecl, .Defer, .AddressOf, .OptionalType, .Negation, .NegationWrap, .Resume, .ArrayType, .ArrayTypeSentinel, .PtrType, .SliceType, .Suspend, .AnyType, .ErrorType, .FnProto, .AnyFrameType, .IntegerLiteral, .FloatLiteral, .EnumLiteral, .StringLiteral, .MultilineStringLiteral, .CharLiteral, .BoolLiteral, .NullLiteral, .UndefinedLiteral, .Unreachable, .Identifier, .ErrorSetDecl, .ContainerDecl, .Asm, .Add, .AddWrap, .ArrayCat, .ArrayMult, .Assign, .AssignBitAnd, .AssignBitOr, .AssignBitShiftLeft, .AssignBitShiftRight, .AssignBitXor, .AssignDiv, .AssignSub, .AssignSubWrap, .AssignMod, .AssignAdd, .AssignAddWrap, .AssignMul, .AssignMulWrap, .BangEqual, .BitAnd, .BitOr, .BitShiftLeft, .BitShiftRight, .BitXor, .BoolAnd, .BoolOr, .Div, .EqualEqual, .ErrorUnion, .GreaterOrEqual, .GreaterThan, .LessOrEqual, .LessThan, .MergeErrorSets, .Mod, .Mul, .MulWrap, .Range, .Period, .Sub, .SubWrap, .Slice, .Deref, .ArrayAccess, .Block, => return false, // Forward the question to a sub-expression. .GroupedExpression => node = node.castTag(.GroupedExpression).?.expr, .Try => node = node.castTag(.Try).?.rhs, .Await => node = node.castTag(.Await).?.rhs, .Catch => node = node.castTag(.Catch).?.rhs, .OrElse => node = node.castTag(.OrElse).?.rhs, .Comptime => node = node.castTag(.Comptime).?.expr, .Nosuspend => node = node.castTag(.Nosuspend).?.expr, .UnwrapOptional => node = node.castTag(.UnwrapOptional).?.lhs, // True because these are exactly the expressions we need memory locations for. .ArrayInitializer, .ArrayInitializerDot, .StructInitializer, .StructInitializerDot, => return true, // True because depending on comptime conditions, sub-expressions // may be the kind that need memory locations. .While, .For, .Switch, .Call, .LabeledBlock, => return true, .BuiltinCall => { @setEvalBranchQuota(5000); const builtin_needs_mem_loc = std.ComptimeStringMap(bool, .{ .{ "@addWithOverflow", false }, .{ "@alignCast", false }, .{ "@alignOf", false }, .{ "@as", true }, .{ "@asyncCall", false }, .{ "@atomicLoad", false }, .{ "@atomicRmw", false }, .{ "@atomicStore", false }, .{ "@bitCast", true }, .{ "@bitOffsetOf", false }, .{ "@boolToInt", false }, .{ "@bitSizeOf", false }, .{ "@breakpoint", false }, .{ "@mulAdd", false }, .{ "@byteSwap", false }, .{ "@bitReverse", false }, .{ "@byteOffsetOf", false }, .{ "@call", true }, .{ "@cDefine", false }, .{ "@cImport", false }, .{ "@cInclude", false }, .{ "@clz", false }, .{ "@cmpxchgStrong", false }, .{ "@cmpxchgWeak", false }, .{ "@compileError", false }, .{ "@compileLog", false }, .{ "@ctz", false }, .{ "@cUndef", false }, .{ "@divExact", false }, .{ "@divFloor", false }, .{ "@divTrunc", false }, .{ "@embedFile", false }, .{ "@enumToInt", false }, .{ "@errorName", false }, .{ "@errorReturnTrace", false }, .{ "@errorToInt", false }, .{ "@errSetCast", false }, .{ "@export", false }, .{ "@fence", false }, .{ "@field", true }, .{ "@fieldParentPtr", false }, .{ "@floatCast", false }, .{ "@floatToInt", false }, .{ "@frame", false }, .{ "@Frame", false }, .{ "@frameAddress", false }, .{ "@frameSize", false }, .{ "@hasDecl", false }, .{ "@hasField", false }, .{ "@import", false }, .{ "@intCast", false }, .{ "@intToEnum", false }, .{ "@intToError", false }, .{ "@intToFloat", false }, .{ "@intToPtr", false }, .{ "@memcpy", false }, .{ "@memset", false }, .{ "@wasmMemorySize", false }, .{ "@wasmMemoryGrow", false }, .{ "@mod", false }, .{ "@mulWithOverflow", false }, .{ "@panic", false }, .{ "@popCount", false }, .{ "@ptrCast", false }, .{ "@ptrToInt", false }, .{ "@rem", false }, .{ "@returnAddress", false }, .{ "@setAlignStack", false }, .{ "@setCold", false }, .{ "@setEvalBranchQuota", false }, .{ "@setFloatMode", false }, .{ "@setRuntimeSafety", false }, .{ "@shlExact", false }, .{ "@shlWithOverflow", false }, .{ "@shrExact", false }, .{ "@shuffle", false }, .{ "@sizeOf", false }, .{ "@splat", true }, .{ "@reduce", false }, .{ "@src", true }, .{ "@sqrt", false }, .{ "@sin", false }, .{ "@cos", false }, .{ "@exp", false }, .{ "@exp2", false }, .{ "@log", false }, .{ "@log2", false }, .{ "@log10", false }, .{ "@fabs", false }, .{ "@floor", false }, .{ "@ceil", false }, .{ "@trunc", false }, .{ "@round", false }, .{ "@subWithOverflow", false }, .{ "@tagName", false }, .{ "@TagType", false }, .{ "@This", false }, .{ "@truncate", false }, .{ "@Type", false }, .{ "@typeInfo", false }, .{ "@typeName", false }, .{ "@TypeOf", false }, .{ "@unionInit", true }, }); const name = scope.tree().tokenSlice(node.castTag(.BuiltinCall).?.builtin_token); return builtin_needs_mem_loc.get(name).?; }, // Depending on AST properties, they may need memory locations. .If => return node.castTag(.If).?.@"else" != null, } } } /// Applies `rl` semantics to `inst`. Expressions which do not do their own handling of /// result locations must call this function on their result. /// As an example, if the `ResultLoc` is `ptr`, it will write the result to the pointer. /// If the `ResultLoc` is `ty`, it will coerce the result to the type. fn rlWrap(mod: *Module, scope: *Scope, rl: ResultLoc, result: *zir.Inst) InnerError!*zir.Inst { switch (rl) { .none => return result, .discard => { // Emit a compile error for discarding error values. _ = try addZIRUnOp(mod, scope, result.src, .ensure_result_non_error, result); return result; }, .ref => { // We need a pointer but we have a value. return addZIRUnOp(mod, scope, result.src, .ref, result); }, .ty => |ty_inst| return addZIRBinOp(mod, scope, result.src, .as, ty_inst, result), .ptr => |ptr_inst| { const casted_result = try addZIRInst(mod, scope, result.src, zir.Inst.CoerceToPtrElem, .{ .ptr = ptr_inst, .value = result, }, .{}); _ = try addZIRBinOp(mod, scope, result.src, .store, ptr_inst, casted_result); return casted_result; }, .bitcasted_ptr => |bitcasted_ptr| { return mod.fail(scope, result.src, "TODO implement rlWrap .bitcasted_ptr", .{}); }, .inferred_ptr => |alloc| { return mod.fail(scope, result.src, "TODO implement rlWrap .inferred_ptr", .{}); }, .block_ptr => |block_ptr| { return mod.fail(scope, result.src, "TODO implement rlWrap .block_ptr", .{}); }, } } fn rlWrapVoid(mod: *Module, scope: *Scope, rl: ResultLoc, node: *ast.Node, result: void) InnerError!*zir.Inst { const src = scope.tree().token_locs[node.firstToken()].start; const void_inst = try addZIRInstConst(mod, scope, src, .{ .ty = Type.initTag(.void), .val = Value.initTag(.void_value), }); return rlWrap(mod, scope, rl, void_inst); } fn rlWrapPtr(mod: *Module, scope: *Scope, rl: ResultLoc, ptr: *zir.Inst) InnerError!*zir.Inst { if (rl == .ref) return ptr; return rlWrap(mod, scope, rl, try addZIRUnOp(mod, scope, ptr.src, .deref, ptr)); } pub fn addZIRInstSpecial( mod: *Module, scope: *Scope, src: usize, comptime T: type, positionals: std.meta.fieldInfo(T, "positionals").field_type, kw_args: std.meta.fieldInfo(T, "kw_args").field_type, ) !*T { const gen_zir = scope.getGenZIR(); try gen_zir.instructions.ensureCapacity(mod.gpa, gen_zir.instructions.items.len + 1); const inst = try gen_zir.arena.create(T); inst.* = .{ .base = .{ .tag = T.base_tag, .src = src, }, .positionals = positionals, .kw_args = kw_args, }; gen_zir.instructions.appendAssumeCapacity(&inst.base); return inst; } pub fn addZIRNoOpT(mod: *Module, scope: *Scope, src: usize, tag: zir.Inst.Tag) !*zir.Inst.NoOp { const gen_zir = scope.getGenZIR(); try gen_zir.instructions.ensureCapacity(mod.gpa, gen_zir.instructions.items.len + 1); const inst = try gen_zir.arena.create(zir.Inst.NoOp); inst.* = .{ .base = .{ .tag = tag, .src = src, }, .positionals = .{}, .kw_args = .{}, }; gen_zir.instructions.appendAssumeCapacity(&inst.base); return inst; } pub fn addZIRNoOp(mod: *Module, scope: *Scope, src: usize, tag: zir.Inst.Tag) !*zir.Inst { const inst = try addZIRNoOpT(mod, scope, src, tag); return &inst.base; } pub fn addZIRUnOp( mod: *Module, scope: *Scope, src: usize, tag: zir.Inst.Tag, operand: *zir.Inst, ) !*zir.Inst { const gen_zir = scope.getGenZIR(); try gen_zir.instructions.ensureCapacity(mod.gpa, gen_zir.instructions.items.len + 1); const inst = try gen_zir.arena.create(zir.Inst.UnOp); inst.* = .{ .base = .{ .tag = tag, .src = src, }, .positionals = .{ .operand = operand, }, .kw_args = .{}, }; gen_zir.instructions.appendAssumeCapacity(&inst.base); return &inst.base; } pub fn addZIRBinOp( mod: *Module, scope: *Scope, src: usize, tag: zir.Inst.Tag, lhs: *zir.Inst, rhs: *zir.Inst, ) !*zir.Inst { const gen_zir = scope.getGenZIR(); try gen_zir.instructions.ensureCapacity(mod.gpa, gen_zir.instructions.items.len + 1); const inst = try gen_zir.arena.create(zir.Inst.BinOp); inst.* = .{ .base = .{ .tag = tag, .src = src, }, .positionals = .{ .lhs = lhs, .rhs = rhs, }, .kw_args = .{}, }; gen_zir.instructions.appendAssumeCapacity(&inst.base); return &inst.base; } pub fn addZIRInstBlock( mod: *Module, scope: *Scope, src: usize, tag: zir.Inst.Tag, body: zir.Module.Body, ) !*zir.Inst.Block { const gen_zir = scope.getGenZIR(); try gen_zir.instructions.ensureCapacity(mod.gpa, gen_zir.instructions.items.len + 1); const inst = try gen_zir.arena.create(zir.Inst.Block); inst.* = .{ .base = .{ .tag = tag, .src = src, }, .positionals = .{ .body = body, }, .kw_args = .{}, }; gen_zir.instructions.appendAssumeCapacity(&inst.base); return inst; } pub fn addZIRInst( mod: *Module, scope: *Scope, src: usize, comptime T: type, positionals: std.meta.fieldInfo(T, "positionals").field_type, kw_args: std.meta.fieldInfo(T, "kw_args").field_type, ) !*zir.Inst { const inst_special = try addZIRInstSpecial(mod, scope, src, T, positionals, kw_args); return &inst_special.base; } /// TODO The existence of this function is a workaround for a bug in stage1. pub fn addZIRInstConst(mod: *Module, scope: *Scope, src: usize, typed_value: TypedValue) !*zir.Inst { const P = std.meta.fieldInfo(zir.Inst.Const, "positionals").field_type; return addZIRInst(mod, scope, src, zir.Inst.Const, P{ .typed_value = typed_value }, .{}); } /// TODO The existence of this function is a workaround for a bug in stage1. pub fn addZIRInstLoop(mod: *Module, scope: *Scope, src: usize, body: zir.Module.Body) !*zir.Inst.Loop { const P = std.meta.fieldInfo(zir.Inst.Loop, "positionals").field_type; return addZIRInstSpecial(mod, scope, src, zir.Inst.Loop, P{ .body = body }, .{}); }
src/astgen.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const mem = std.mem; 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 Cache = @import("Cache.zig"); const Package = @import("Package.zig"); pub const Lib = struct { name: []const u8, sover: u8, }; pub const Fn = struct { name: []const u8, lib: *const Lib, }; pub const VerList = struct { /// 7 is just the max number, we know statically it's big enough. versions: [7]u8, len: u8, }; pub const ABI = struct { all_versions: []const std.builtin.Version, all_functions: []const Fn, /// The value is a pointer to all_functions.len items and each item is an index into all_functions. version_table: std.AutoHashMapUnmanaged(target_util.ArchOsAbi, [*]VerList), arena_state: std.heap.ArenaAllocator.State, pub fn destroy(abi: *ABI, gpa: *Allocator) void { abi.version_table.deinit(gpa); abi.arena_state.promote(gpa).deinit(); // Frees the ABI memory too. } }; pub const libs = [_]Lib{ .{ .name = "c", .sover = 6 }, .{ .name = "m", .sover = 6 }, .{ .name = "pthread", .sover = 0 }, .{ .name = "dl", .sover = 2 }, .{ .name = "rt", .sover = 1 }, .{ .name = "ld", .sover = 2 }, .{ .name = "util", .sover = 1 }, }; pub const LoadMetaDataError = error{ /// The files that ship with the Zig compiler were unable to be read, or otherwise had malformed data. ZigInstallationCorrupt, OutOfMemory, }; /// This function will emit a log error when there is a problem with the zig installation and then return /// `error.ZigInstallationCorrupt`. pub fn loadMetaData(gpa: *Allocator, zig_lib_dir: std.fs.Dir) LoadMetaDataError!*ABI { const tracy = trace(@src()); defer tracy.end(); var arena_allocator = std.heap.ArenaAllocator.init(gpa); errdefer arena_allocator.deinit(); const arena = &arena_allocator.allocator; var all_versions = std.ArrayListUnmanaged(std.builtin.Version){}; var all_functions = std.ArrayListUnmanaged(Fn){}; var version_table = std.AutoHashMapUnmanaged(target_util.ArchOsAbi, [*]VerList){}; errdefer version_table.deinit(gpa); var glibc_dir = zig_lib_dir.openDir("libc" ++ path.sep_str ++ "glibc", .{}) catch |err| { std.log.err("unable to open glibc dir: {}", .{@errorName(err)}); return error.ZigInstallationCorrupt; }; defer glibc_dir.close(); const max_txt_size = 500 * 1024; // Bigger than this and something is definitely borked. const vers_txt_contents = glibc_dir.readFileAlloc(gpa, "vers.txt", max_txt_size) catch |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => { std.log.err("unable to read vers.txt: {}", .{@errorName(err)}); return error.ZigInstallationCorrupt; }, }; defer gpa.free(vers_txt_contents); // Arena allocated because the result contains references to function names. const fns_txt_contents = glibc_dir.readFileAlloc(arena, "fns.txt", max_txt_size) catch |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => { std.log.err("unable to read fns.txt: {}", .{@errorName(err)}); return error.ZigInstallationCorrupt; }, }; const abi_txt_contents = glibc_dir.readFileAlloc(gpa, "abi.txt", max_txt_size) catch |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => { std.log.err("unable to read abi.txt: {}", .{@errorName(err)}); return error.ZigInstallationCorrupt; }, }; defer gpa.free(abi_txt_contents); { var it = mem.tokenize(vers_txt_contents, "\r\n"); var line_i: usize = 1; while (it.next()) |line| : (line_i += 1) { const prefix = "GLIBC_"; if (!mem.startsWith(u8, line, prefix)) { std.log.err("vers.txt:{}: expected 'GLIBC_' prefix", .{line_i}); return error.ZigInstallationCorrupt; } const adjusted_line = line[prefix.len..]; const ver = std.builtin.Version.parse(adjusted_line) catch |err| { std.log.err("vers.txt:{}: unable to parse glibc version '{}': {}", .{ line_i, line, @errorName(err) }); return error.ZigInstallationCorrupt; }; try all_versions.append(arena, ver); } } { var file_it = mem.tokenize(fns_txt_contents, "\r\n"); var line_i: usize = 1; while (file_it.next()) |line| : (line_i += 1) { var line_it = mem.tokenize(line, " "); const fn_name = line_it.next() orelse { std.log.err("fns.txt:{}: expected function name", .{line_i}); return error.ZigInstallationCorrupt; }; const lib_name = line_it.next() orelse { std.log.err("fns.txt:{}: expected library name", .{line_i}); return error.ZigInstallationCorrupt; }; const lib = findLib(lib_name) orelse { std.log.err("fns.txt:{}: unknown library name: {}", .{ line_i, lib_name }); return error.ZigInstallationCorrupt; }; try all_functions.append(arena, .{ .name = fn_name, .lib = lib, }); } } { var file_it = mem.split(abi_txt_contents, "\n"); var line_i: usize = 0; while (true) { const ver_list_base: []VerList = blk: { const line = file_it.next() orelse break; if (line.len == 0) break; line_i += 1; const ver_list_base = try arena.alloc(VerList, all_functions.items.len); var line_it = mem.tokenize(line, " "); while (line_it.next()) |target_string| { var component_it = mem.tokenize(target_string, "-"); const arch_name = component_it.next() orelse { std.log.err("abi.txt:{}: expected arch name", .{line_i}); return error.ZigInstallationCorrupt; }; const os_name = component_it.next() orelse { std.log.err("abi.txt:{}: expected OS name", .{line_i}); return error.ZigInstallationCorrupt; }; const abi_name = component_it.next() orelse { std.log.err("abi.txt:{}: expected ABI name", .{line_i}); return error.ZigInstallationCorrupt; }; const arch_tag = std.meta.stringToEnum(std.Target.Cpu.Arch, arch_name) orelse { std.log.err("abi.txt:{}: unrecognized arch: '{}'", .{ line_i, arch_name }); return error.ZigInstallationCorrupt; }; if (!mem.eql(u8, os_name, "linux")) { std.log.err("abi.txt:{}: expected OS 'linux', found '{}'", .{ line_i, os_name }); return error.ZigInstallationCorrupt; } const abi_tag = std.meta.stringToEnum(std.Target.Abi, abi_name) orelse { std.log.err("abi.txt:{}: unrecognized ABI: '{}'", .{ line_i, abi_name }); return error.ZigInstallationCorrupt; }; const triple = target_util.ArchOsAbi{ .arch = arch_tag, .os = .linux, .abi = abi_tag, }; try version_table.put(gpa, triple, ver_list_base.ptr); } break :blk ver_list_base; }; for (ver_list_base) |*ver_list| { const line = file_it.next() orelse { std.log.err("abi.txt:{}: missing version number line", .{line_i}); return error.ZigInstallationCorrupt; }; line_i += 1; ver_list.* = .{ .versions = undefined, .len = 0, }; var line_it = mem.tokenize(line, " "); while (line_it.next()) |version_index_string| { if (ver_list.len >= ver_list.versions.len) { // If this happens with legit data, increase the array len in the type. std.log.err("abi.txt:{}: too many versions", .{line_i}); return error.ZigInstallationCorrupt; } const version_index = std.fmt.parseInt(u8, version_index_string, 10) catch |err| { // If this happens with legit data, increase the size of the integer type in the struct. std.log.err("abi.txt:{}: unable to parse version: {}", .{ line_i, @errorName(err) }); return error.ZigInstallationCorrupt; }; ver_list.versions[ver_list.len] = version_index; ver_list.len += 1; } } } } const abi = try arena.create(ABI); abi.* = .{ .all_versions = all_versions.items, .all_functions = all_functions.items, .version_table = version_table, .arena_state = arena_allocator.state, }; return abi; } fn findLib(name: []const u8) ?*const Lib { for (libs) |*lib| { if (mem.eql(u8, lib.name, name)) { return lib; } } return null; } pub const CRTFile = enum { crti_o, crtn_o, scrt1_o, libc_nonshared_a, }; pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void { if (!build_options.have_llvm) { return error.ZigCompilerNotBuiltWithLLVMExtensions; } const gpa = comp.gpa; var arena_allocator = std.heap.ArenaAllocator.init(gpa); defer arena_allocator.deinit(); const arena = &arena_allocator.allocator; switch (crt_file) { .crti_o => { var args = std.ArrayList([]const u8).init(arena); try add_include_dirs(comp, arena, &args); try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), "-DMODULE_NAME=libc", "-Wno-nonportable-include-path", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DTOP_NAMESPACE=glibc", "-DASSEMBLER", "-g", "-Wa,--noexecstack", }); return comp.build_crt_file("crti", .Obj, &[1]Compilation.CSourceFile{ .{ .src_path = try start_asm_path(comp, arena, "crti.S"), .extra_flags = args.items, }, }); }, .crtn_o => { var args = std.ArrayList([]const u8).init(arena); try add_include_dirs(comp, arena, &args); try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-DMODULE_NAME=libc", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DTOP_NAMESPACE=glibc", "-DASSEMBLER", "-g", "-Wa,--noexecstack", }); return comp.build_crt_file("crtn", .Obj, &[1]Compilation.CSourceFile{ .{ .src_path = try start_asm_path(comp, arena, "crtn.S"), .extra_flags = args.items, }, }); }, .scrt1_o => { const start_os: Compilation.CSourceFile = blk: { var args = std.ArrayList([]const u8).init(arena); try add_include_dirs(comp, arena, &args); try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), "-DMODULE_NAME=libc", "-Wno-nonportable-include-path", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DPIC", "-DSHARED", "-DTOP_NAMESPACE=glibc", "-DASSEMBLER", "-g", "-Wa,--noexecstack", }); break :blk .{ .src_path = try start_asm_path(comp, arena, "start.S"), .extra_flags = args.items, }; }; const abi_note_o: Compilation.CSourceFile = blk: { var args = std.ArrayList([]const u8).init(arena); try args.appendSlice(&[_][]const u8{ "-I", try lib_path(comp, arena, lib_libc_glibc ++ "csu"), }); try add_include_dirs(comp, arena, &args); try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-DMODULE_NAME=libc", "-DTOP_NAMESPACE=glibc", "-DASSEMBLER", "-g", "-Wa,--noexecstack", }); break :blk .{ .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "abi-note.S"), .extra_flags = args.items, }; }; return comp.build_crt_file("Scrt1", .Obj, &[_]Compilation.CSourceFile{ start_os, abi_note_o }); }, .libc_nonshared_a => { const deps = [_][]const u8{ lib_libc_glibc ++ "stdlib" ++ path.sep_str ++ "atexit.c", lib_libc_glibc ++ "stdlib" ++ path.sep_str ++ "at_quick_exit.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "stat.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstat.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "lstat.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "stat64.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstat64.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "lstat64.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "fstatat64.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknod.c", lib_libc_glibc ++ "io" ++ path.sep_str ++ "mknodat.c", lib_libc_glibc ++ "nptl" ++ path.sep_str ++ "pthread_atfork.c", lib_libc_glibc ++ "debug" ++ path.sep_str ++ "stack_chk_fail_local.c", }; var c_source_files: [deps.len + 1]Compilation.CSourceFile = undefined; c_source_files[0] = blk: { var args = std.ArrayList([]const u8).init(arena); try args.appendSlice(&[_][]const u8{ "-std=gnu11", "-fgnu89-inline", "-g", "-O2", "-fmerge-all-constants", "-fno-stack-protector", "-fmath-errno", "-fno-stack-protector", "-I", try lib_path(comp, arena, lib_libc_glibc ++ "csu"), }); try add_include_dirs(comp, arena, &args); try args.appendSlice(&[_][]const u8{ "-DSTACK_PROTECTOR_LEVEL=0", "-fPIC", "-fno-stack-protector", "-ftls-model=initial-exec", "-D_LIBC_REENTRANT", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), "-DMODULE_NAME=libc", "-Wno-nonportable-include-path", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DPIC", "-DLIBC_NONSHARED=1", "-DTOP_NAMESPACE=glibc", }); break :blk .{ .src_path = try lib_path(comp, arena, lib_libc_glibc ++ "csu" ++ path.sep_str ++ "elf-init.c"), .extra_flags = args.items, }; }; for (deps) |dep, i| { var args = std.ArrayList([]const u8).init(arena); try args.appendSlice(&[_][]const u8{ "-std=gnu11", "-fgnu89-inline", "-g", "-O2", "-fmerge-all-constants", "-fno-stack-protector", "-fmath-errno", "-ftls-model=initial-exec", "-Wno-ignored-attributes", }); try add_include_dirs(comp, arena, &args); try args.appendSlice(&[_][]const u8{ "-D_LIBC_REENTRANT", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-modules.h"), "-DMODULE_NAME=libc", "-Wno-nonportable-include-path", "-include", try lib_path(comp, arena, lib_libc_glibc ++ "include" ++ path.sep_str ++ "libc-symbols.h"), "-DPIC", "-DLIBC_NONSHARED=1", "-DTOP_NAMESPACE=glibc", }); c_source_files[i + 1] = .{ .src_path = try lib_path(comp, arena, dep), .extra_flags = args.items, }; } return comp.build_crt_file("c_nonshared", .Lib, &c_source_files); }, } } fn start_asm_path(comp: *Compilation, arena: *Allocator, basename: []const u8) ![]const u8 { const arch = comp.getTarget().cpu.arch; const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le; const is_aarch64 = arch == .aarch64 or arch == .aarch64_be; const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparcv9; const is_64 = arch.ptrBitWidth() == 64; const s = path.sep_str; var result = std.ArrayList(u8).init(arena); try result.appendSlice(comp.zig_lib_directory.path.?); try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s); if (is_sparc) { if (is_64) { try result.appendSlice("sparc" ++ s ++ "sparc64"); } else { try result.appendSlice("sparc" ++ s ++ "sparc32"); } } else if (arch.isARM()) { try result.appendSlice("arm"); } else if (arch.isMIPS()) { try result.appendSlice("mips"); } else if (arch == .x86_64) { try result.appendSlice("x86_64"); } else if (arch == .i386) { try result.appendSlice("i386"); } else if (is_aarch64) { try result.appendSlice("aarch64"); } else if (arch.isRISCV()) { try result.appendSlice("riscv"); } else if (is_ppc) { if (is_64) { try result.appendSlice("powerpc" ++ s ++ "powerpc64"); } else { try result.appendSlice("powerpc" ++ s ++ "powerpc32"); } } try result.appendSlice(s); try result.appendSlice(basename); return result.items; } fn add_include_dirs(comp: *Compilation, arena: *Allocator, args: *std.ArrayList([]const u8)) error{OutOfMemory}!void { const target = comp.getTarget(); const arch = target.cpu.arch; const opt_nptl: ?[]const u8 = if (target.os.tag == .linux) "nptl" else "htl"; const glibc = try lib_path(comp, arena, lib_libc ++ "glibc"); const s = path.sep_str; try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "include")); if (target.os.tag == .linux) { try add_include_dirs_arch(arena, args, arch, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux")); } if (opt_nptl) |nptl| { try add_include_dirs_arch(arena, args, arch, nptl, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps")); } if (target.os.tag == .linux) { try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux" ++ s ++ "generic")); try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux" ++ s ++ "include")); try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv" ++ s ++ "linux")); } if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ comp.zig_lib_directory.path.?, lib_libc_glibc ++ "sysdeps", nptl })); } try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "pthread")); try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix" ++ s ++ "sysv")); try add_include_dirs_arch(arena, args, arch, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix")); try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "unix")); try add_include_dirs_arch(arena, args, arch, null, try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps")); try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc_glibc ++ "sysdeps" ++ s ++ "generic")); try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ comp.zig_lib_directory.path.?, lib_libc ++ "glibc" })); try args.append("-I"); try args.append(try std.fmt.allocPrint(arena, "{}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "{}-{}-{}", .{ comp.zig_lib_directory.path.?, @tagName(arch), @tagName(target.os.tag), @tagName(target.abi), })); try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc ++ "include" ++ s ++ "generic-glibc")); try args.append("-I"); try args.append(try std.fmt.allocPrint(arena, "{}" ++ s ++ "libc" ++ s ++ "include" ++ s ++ "{}-linux-any", .{ comp.zig_lib_directory.path.?, @tagName(arch), })); try args.append("-I"); try args.append(try lib_path(comp, arena, lib_libc ++ "include" ++ s ++ "any-linux-any")); } fn add_include_dirs_arch( arena: *Allocator, args: *std.ArrayList([]const u8), arch: std.Target.Cpu.Arch, opt_nptl: ?[]const u8, dir: []const u8, ) error{OutOfMemory}!void { const is_x86 = arch == .i386 or arch == .x86_64; const is_aarch64 = arch == .aarch64 or arch == .aarch64_be; const is_ppc = arch == .powerpc or arch == .powerpc64 or arch == .powerpc64le; const is_sparc = arch == .sparc or arch == .sparcel or arch == .sparcv9; const is_64 = arch.ptrBitWidth() == 64; const s = path.sep_str; if (is_x86) { if (arch == .x86_64) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64", nptl })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "x86_64" })); } } else if (arch == .i386) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "i386", nptl })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "i386" })); } } if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "x86", nptl })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "x86" })); } } else if (arch.isARM()) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "arm", nptl })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "arm" })); } } else if (arch.isMIPS()) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "mips", nptl })); } else { if (is_64) { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "mips" ++ s ++ "mips64" })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "mips" ++ s ++ "mips32" })); } try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "mips" })); } } else if (is_sparc) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "sparc", nptl })); } else { if (is_64) { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "sparc" ++ s ++ "sparc64" })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "sparc" ++ s ++ "sparc32" })); } try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "sparc" })); } } else if (is_aarch64) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "aarch64", nptl })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "aarch64" })); } } else if (is_ppc) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "powerpc", nptl })); } else { if (is_64) { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "powerpc" ++ s ++ "powerpc64" })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "powerpc" ++ s ++ "powerpc32" })); } try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "powerpc" })); } } else if (arch.isRISCV()) { if (opt_nptl) |nptl| { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "riscv", nptl })); } else { try args.append("-I"); try args.append(try path.join(arena, &[_][]const u8{ dir, "riscv" })); } } } fn path_from_lib(comp: *Compilation, arena: *Allocator, sub_path: []const u8) ![]const u8 { return path.join(arena, &[_][]const u8{ comp.zig_lib_directory.path.?, sub_path }); } const lib_libc = "libc" ++ path.sep_str; const lib_libc_glibc = lib_libc ++ "glibc" ++ path.sep_str; fn lib_path(comp: *Compilation, arena: *Allocator, sub_path: []const u8) ![]const u8 { return path.join(arena, &[_][]const u8{ comp.zig_lib_directory.path.?, sub_path }); } pub const BuiltSharedObjects = struct { lock: Cache.Lock, dir_path: []u8, pub fn deinit(self: *BuiltSharedObjects, gpa: *Allocator) void { self.lock.release(); gpa.free(self.dir_path); self.* = undefined; } }; const all_map_basename = "all.map"; pub fn buildSharedObjects(comp: *Compilation) !void { const tracy = trace(@src()); defer tracy.end(); if (!build_options.have_llvm) { return error.ZigCompilerNotBuiltWithLLVMExtensions; } var arena_allocator = std.heap.ArenaAllocator.init(comp.gpa); defer arena_allocator.deinit(); const arena = &arena_allocator.allocator; const target = comp.getTarget(); const target_version = target.os.version_range.linux.glibc; // Use the global cache directory. var cache_parent: Cache = .{ .gpa = comp.gpa, .manifest_dir = try comp.global_cache_directory.handle.makeOpenPath("h", .{}), }; defer cache_parent.manifest_dir.close(); var cache = cache_parent.obtain(); defer cache.deinit(); cache.hash.addBytes(build_options.version); cache.hash.addBytes(comp.zig_lib_directory.path orelse "."); cache.hash.add(target.cpu.arch); cache.hash.add(target.abi); cache.hash.add(target_version); const hit = try cache.hit(); const digest = cache.final(); const o_sub_path = try path.join(arena, &[_][]const u8{ "o", &digest }); // Even if we get a hit, it doesn't guarantee that we finished the job last time. // We use the presence of an "ok" file to determine if it is a true hit. var o_directory: Compilation.Directory = .{ .handle = try comp.global_cache_directory.handle.makeOpenPath(o_sub_path, .{}), .path = try path.join(arena, &[_][]const u8{ comp.global_cache_directory.path.?, o_sub_path }), }; defer o_directory.handle.close(); const ok_basename = "ok"; const actual_hit = if (hit) blk: { o_directory.handle.access(ok_basename, .{}) catch |err| switch (err) { error.FileNotFound => break :blk false, else => |e| return e, }; break :blk true; } else false; if (!actual_hit) { const metadata = try loadMetaData(comp.gpa, comp.zig_lib_directory.handle); defer metadata.destroy(comp.gpa); const ver_list_base = metadata.version_table.get(.{ .arch = target.cpu.arch, .os = target.os.tag, .abi = target.abi, }) orelse return error.GLibCUnavailableForThisTarget; const target_ver_index = for (metadata.all_versions) |ver, i| { switch (ver.order(target_version)) { .eq => break i, .lt => continue, .gt => { // TODO Expose via compile error mechanism instead of log. std.log.warn("invalid target glibc version: {}", .{target_version}); return error.InvalidTargetGLibCVersion; }, } } else blk: { const latest_index = metadata.all_versions.len - 1; std.log.warn("zig cannot build new glibc version {}; providing instead {}", .{ target_version, metadata.all_versions[latest_index], }); break :blk latest_index; }; { var map_contents = std.ArrayList(u8).init(arena); for (metadata.all_versions) |ver| { if (ver.patch == 0) { try map_contents.writer().print("GLIBC_{d}.{d} {{ }};\n", .{ ver.major, ver.minor }); } else { try map_contents.writer().print("GLIBC_{d}.{d}.{d} {{ }};\n", .{ ver.major, ver.minor, ver.patch }); } } try o_directory.handle.writeFile(all_map_basename, map_contents.items); map_contents.deinit(); // The most recent allocation of an arena can be freed :) } var zig_body = std.ArrayList(u8).init(comp.gpa); defer zig_body.deinit(); for (libs) |*lib| { zig_body.shrinkRetainingCapacity(0); for (metadata.all_functions) |*libc_fn, fn_i| { if (libc_fn.lib != lib) continue; const ver_list = ver_list_base[fn_i]; // Pick the default symbol version: // - If there are no versions, don't emit it // - Take the greatest one <= than the target one // - If none of them is <= than the // specified one don't pick any default version if (ver_list.len == 0) continue; var chosen_def_ver_index: u8 = 255; { var ver_i: u8 = 0; while (ver_i < ver_list.len) : (ver_i += 1) { const ver_index = ver_list.versions[ver_i]; if ((chosen_def_ver_index == 255 or ver_index > chosen_def_ver_index) and target_ver_index >= ver_index) { chosen_def_ver_index = ver_index; } } } { var ver_i: u8 = 0; while (ver_i < ver_list.len) : (ver_i += 1) { // Example: // .globl _Exit_2_2_5 // .type _Exit_2_2_5, %function; // .symver _Exit_2_2_5, _Exit@@GLIBC_2.2.5 // .hidden _Exit_2_2_5 // _Exit_2_2_5: const ver_index = ver_list.versions[ver_i]; const ver = metadata.all_versions[ver_index]; const sym_name = libc_fn.name; // Default symbol version definition vs normal symbol version definition const want_two_ats = chosen_def_ver_index != 255 and ver_index == chosen_def_ver_index; const at_sign_str = "@@"[0 .. @boolToInt(want_two_ats) + @as(usize, 1)]; if (ver.patch == 0) { const sym_plus_ver = try std.fmt.allocPrint( arena, "{s}_{d}_{d}", .{ sym_name, ver.major, ver.minor }, ); try zig_body.writer().print( \\.globl {s} \\.type {s}, %function; \\.symver {s}, {s}{s}GLIBC_{d}.{d} \\.hidden {s} \\{s}: \\ , .{ sym_plus_ver, sym_plus_ver, sym_plus_ver, sym_name, at_sign_str, ver.major, ver.minor, sym_plus_ver, sym_plus_ver, }); } else { const sym_plus_ver = try std.fmt.allocPrint( arena, "{s}_{d}_{d}_{d}", .{ sym_name, ver.major, ver.minor, ver.patch }, ); try zig_body.writer().print( \\.globl {s} \\.type {s}, %function; \\.symver {s}, {s}{s}GLIBC_{d}.{d}.{d} \\.hidden {s} \\{s}: \\ , .{ sym_plus_ver, sym_plus_ver, sym_plus_ver, sym_name, at_sign_str, ver.major, ver.minor, ver.patch, sym_plus_ver, sym_plus_ver, }); } } } } var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "pthread", etc. const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; try o_directory.handle.writeFile(asm_file_basename, zig_body.items); try buildSharedLib(comp, arena, comp.global_cache_directory, o_directory, asm_file_basename, lib); } // No need to write the manifest because there are no file inputs associated with this cache hash. // However we do need to write the ok file now. if (o_directory.handle.createFile(ok_basename, .{})) |file| { file.close(); } else |err| { std.log.warn("glibc shared objects: failed to mark completion: {}", .{@errorName(err)}); } } assert(comp.glibc_so_files == null); comp.glibc_so_files = BuiltSharedObjects{ .lock = cache.toOwnedLock(), .dir_path = try path.join(comp.gpa, &[_][]const u8{ comp.global_cache_directory.path.?, o_sub_path }), }; } // zig fmt: on fn buildSharedLib( comp: *Compilation, arena: *Allocator, zig_cache_directory: Compilation.Directory, bin_directory: Compilation.Directory, asm_file_basename: []const u8, lib: *const Lib, ) !void { const tracy = trace(@src()); defer tracy.end(); const basename = try std.fmt.allocPrint(arena, "lib{s}.so.{d}", .{ lib.name, lib.sover }); const emit_bin = Compilation.EmitLoc{ .directory = bin_directory, .basename = basename, }; const version: std.builtin.Version = .{ .major = lib.sover, .minor = 0, .patch = 0 }; const ld_basename = path.basename(comp.getTarget().standardDynamicLinkerPath().get().?); const soname = if (mem.eql(u8, lib.name, "ld")) ld_basename else basename; const map_file_path = try path.join(arena, &[_][]const u8{ bin_directory.path.?, all_map_basename }); const c_source_files = [1]Compilation.CSourceFile{ .{ .src_path = try path.join(arena, &[_][]const u8{ bin_directory.path.?, asm_file_basename }), }, }; const sub_compilation = try Compilation.create(comp.gpa, .{ .local_cache_directory = zig_cache_directory, .global_cache_directory = comp.global_cache_directory, .zig_lib_directory = comp.zig_lib_directory, .target = comp.getTarget(), .root_name = lib.name, .root_pkg = null, .output_mode = .Lib, .link_mode = .Dynamic, .thread_pool = comp.thread_pool, .libc_installation = comp.bin_file.options.libc_installation, .emit_bin = emit_bin, .optimize_mode = comp.bin_file.options.optimize_mode, .want_sanitize_c = false, .want_stack_check = false, .want_valgrind = false, .emit_h = null, .strip = comp.bin_file.options.strip, .is_native_os = false, .is_native_abi = false, .self_exe_path = comp.self_exe_path, .verbose_cc = comp.verbose_cc, .verbose_link = comp.bin_file.options.verbose_link, .verbose_tokenize = comp.verbose_tokenize, .verbose_ast = comp.verbose_ast, .verbose_ir = comp.verbose_ir, .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, .version = version, .version_script = map_file_path, .soname = soname, .c_source_files = &c_source_files, .is_compiler_rt_or_libc = true, }); defer sub_compilation.destroy(); try sub_compilation.updateSubCompilation(); }
src/glibc.zig
const Plan9 = @This(); const link = @import("../link.zig"); const Module = @import("../Module.zig"); const Compilation = @import("../Compilation.zig"); const aout = @import("Plan9/aout.zig"); const codegen = @import("../codegen.zig"); const trace = @import("../tracy.zig").trace; const File = link.File; const build_options = @import("build_options"); const Air = @import("../Air.zig"); const Liveness = @import("../Liveness.zig"); const TypedValue = @import("../TypedValue.zig"); const std = @import("std"); const builtin = @import("builtin"); const mem = std.mem; const Allocator = std.mem.Allocator; const log = std.log.scoped(.link); const assert = std.debug.assert; const FnDeclOutput = struct { code: []const u8, /// this might have to be modified in the linker, so thats why its mutable lineinfo: []u8, start_line: u32, end_line: u32, }; base: link.File, sixtyfour_bit: bool, error_flags: File.ErrorFlags = File.ErrorFlags{}, bases: Bases, /// A symbol's value is just casted down when compiling /// for a 32 bit target. /// Does not represent the order or amount of symbols in the file /// it is just useful for storing symbols. Some other symbols are in /// file_segments. syms: std.ArrayListUnmanaged(aout.Sym) = .{}, /// The plan9 a.out format requires segments of /// filenames to be deduplicated, so we use this map to /// de duplicate it. The value is the value of the path /// component file_segments: std.StringArrayHashMapUnmanaged(u16) = .{}, /// The value of a 'f' symbol increments by 1 every time, so that no 2 'f' /// symbols have the same value. file_segments_i: u16 = 1, path_arena: std.heap.ArenaAllocator, /// maps a file scope to a hash map of decl to codegen output /// this is useful for line debuginfo, since it makes sense to sort by file /// The debugger looks for the first file (aout.Sym.Type.z) preceeding the text symbol /// of the function to know what file it came from. /// If we group the decls by file, it makes it really easy to do this (put the symbol in the correct place) fn_decl_table: std.AutoArrayHashMapUnmanaged( *Module.File, struct { sym_index: u32, functions: std.AutoArrayHashMapUnmanaged(*Module.Decl, FnDeclOutput) = .{} }, ) = .{}, data_decl_table: std.AutoArrayHashMapUnmanaged(*Module.Decl, []const u8) = .{}, hdr: aout.ExecHdr = undefined, magic: u32, entry_val: ?u64 = null, got_len: usize = 0, // A list of all the free got indexes, so when making a new decl // don't make a new one, just use one from here. got_index_free_list: std.ArrayListUnmanaged(usize) = .{}, syms_index_free_list: std.ArrayListUnmanaged(usize) = .{}, const Bases = struct { text: u64, /// the Global Offset Table starts at the beginning of the data section data: u64, }; fn getAddr(self: Plan9, addr: u64, t: aout.Sym.Type) u64 { return addr + switch (t) { .T, .t, .l, .L => self.bases.text, .D, .d, .B, .b => self.bases.data, else => unreachable, }; } fn getSymAddr(self: Plan9, s: aout.Sym) u64 { return self.getAddr(s.value, s.type); } pub const DeclBlock = struct { type: aout.Sym.Type, /// offset in the text or data sects offset: ?u64, /// offset into syms sym_index: ?usize, /// offset into got got_index: ?usize, pub const empty = DeclBlock{ .type = .t, .offset = null, .sym_index = null, .got_index = null, }; }; pub fn defaultBaseAddrs(arch: std.Target.Cpu.Arch) Bases { return switch (arch) { .x86_64 => .{ // header size => 40 => 0x28 .text = 0x200028, .data = 0x400000, }, .i386 => .{ // header size => 32 => 0x20 .text = 0x200020, .data = 0x400000, }, .aarch64 => .{ // header size => 40 => 0x28 .text = 0x10028, .data = 0x20000, }, else => std.debug.panic("find default base address for {}", .{arch}), }; } pub const PtrWidth = enum { p32, p64 }; pub fn createEmpty(gpa: Allocator, options: link.Options) !*Plan9 { if (options.use_llvm) return error.LLVMBackendDoesNotSupportPlan9; const sixtyfour_bit: bool = switch (options.target.cpu.arch.ptrBitWidth()) { 0...32 => false, 33...64 => true, else => return error.UnsupportedP9Architecture, }; var arena_allocator = std.heap.ArenaAllocator.init(gpa); const self = try gpa.create(Plan9); self.* = .{ .path_arena = arena_allocator, .base = .{ .tag = .plan9, .options = options, .allocator = gpa, .file = null, }, .sixtyfour_bit = sixtyfour_bit, .bases = undefined, .magic = try aout.magicFromArch(self.base.options.target.cpu.arch), }; // a / will always be in a file path try self.file_segments.put(self.base.allocator, "/", 1); return self; } fn putFn(self: *Plan9, decl: *Module.Decl, out: FnDeclOutput) !void { const gpa = self.base.allocator; const fn_map_res = try self.fn_decl_table.getOrPut(gpa, decl.getFileScope()); if (fn_map_res.found_existing) { try fn_map_res.value_ptr.functions.put(gpa, decl, out); } else { const file = decl.getFileScope(); const arena = self.path_arena.allocator(); // each file gets a symbol fn_map_res.value_ptr.* = .{ .sym_index = blk: { try self.syms.append(gpa, undefined); try self.syms.append(gpa, undefined); break :blk @intCast(u32, self.syms.items.len - 1); }, }; try fn_map_res.value_ptr.functions.put(gpa, decl, out); var a = std.ArrayList(u8).init(arena); errdefer a.deinit(); // every 'z' starts with 0 try a.append(0); // path component value of '/' try a.writer().writeIntBig(u16, 1); // getting the full file path var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; const dir = file.pkg.root_src_directory.path orelse try std.os.getcwd(&buf); const sub_path = try std.fs.path.join(arena, &.{ dir, file.sub_file_path }); try self.addPathComponents(sub_path, &a); // null terminate try a.append(0); const final = a.toOwnedSlice(); self.syms.items[fn_map_res.value_ptr.sym_index - 1] = .{ .type = .z, .value = 1, .name = final, }; self.syms.items[fn_map_res.value_ptr.sym_index] = .{ .type = .z, // just put a giant number, no source file will have this many newlines .value = std.math.maxInt(u31), .name = &.{ 0, 0 }, }; } } fn addPathComponents(self: *Plan9, path: []const u8, a: *std.ArrayList(u8)) !void { const sep = std.fs.path.sep; var it = std.mem.tokenize(u8, path, &.{sep}); while (it.next()) |component| { if (self.file_segments.get(component)) |num| { try a.writer().writeIntBig(u16, num); } else { self.file_segments_i += 1; try self.file_segments.put(self.base.allocator, component, self.file_segments_i); try a.writer().writeIntBig(u16, self.file_segments_i); } } } pub fn updateFunc(self: *Plan9, module: *Module, func: *Module.Fn, air: Air, liveness: Liveness) !void { if (build_options.skip_non_native and builtin.object_format != .plan9) { @panic("Attempted to compile for object format that was disabled by build configuration"); } const decl = func.owner_decl; try self.seeDecl(decl); log.debug("codegen decl {*} ({s})", .{ decl, decl.name }); var code_buffer = std.ArrayList(u8).init(self.base.allocator); defer code_buffer.deinit(); var dbg_line_buffer = std.ArrayList(u8).init(self.base.allocator); defer dbg_line_buffer.deinit(); var start_line: ?u32 = null; var end_line: u32 = undefined; var pcop_change_index: ?u32 = null; const res = try codegen.generateFunction( &self.base, decl.srcLoc(), func, air, liveness, &code_buffer, .{ .plan9 = .{ .dbg_line = &dbg_line_buffer, .end_line = &end_line, .start_line = &start_line, .pcop_change_index = &pcop_change_index, }, }, ); const code = switch (res) { .appended => code_buffer.toOwnedSlice(), .fail => |em| { decl.analysis = .codegen_failure; try module.failed_decls.put(module.gpa, decl, em); return; }, }; const out: FnDeclOutput = .{ .code = code, .lineinfo = dbg_line_buffer.toOwnedSlice(), .start_line = start_line.?, .end_line = end_line, }; try self.putFn(decl, out); return self.updateFinish(decl); } pub fn lowerUnnamedConst(self: *Plan9, tv: TypedValue, decl: *Module.Decl) !u32 { _ = self; _ = tv; _ = decl; log.debug("TODO lowerUnnamedConst for Plan9", .{}); return error.AnalysisFail; } pub fn updateDecl(self: *Plan9, module: *Module, decl: *Module.Decl) !void { if (decl.val.tag() == .extern_fn) { return; // TODO Should we do more when front-end analyzed extern decl? } if (decl.val.castTag(.variable)) |payload| { const variable = payload.data; if (variable.is_extern) { return; // TODO Should we do more when front-end analyzed extern decl? } } try self.seeDecl(decl); log.debug("codegen decl {*} ({s})", .{ decl, decl.name }); var code_buffer = std.ArrayList(u8).init(self.base.allocator); defer code_buffer.deinit(); const decl_val = if (decl.val.castTag(.variable)) |payload| payload.data.init else decl.val; // TODO we need the symbol index for symbol in the table of locals for the containing atom const sym_index = decl.link.plan9.sym_index orelse 0; const res = try codegen.generateSymbol(&self.base, decl.srcLoc(), .{ .ty = decl.ty, .val = decl_val, }, &code_buffer, .{ .none = {} }, .{ .parent_atom_index = @intCast(u32, sym_index), }); const code = switch (res) { .externally_managed => |x| x, .appended => code_buffer.items, .fail => |em| { decl.analysis = .codegen_failure; try module.failed_decls.put(module.gpa, decl, em); return; }, }; var duped_code = try self.base.allocator.dupe(u8, code); errdefer self.base.allocator.free(duped_code); try self.data_decl_table.put(self.base.allocator, decl, duped_code); return self.updateFinish(decl); } /// called at the end of update{Decl,Func} fn updateFinish(self: *Plan9, decl: *Module.Decl) !void { const is_fn = (decl.ty.zigTypeTag() == .Fn); log.debug("update the symbol table and got for decl {*} ({s})", .{ decl, decl.name }); const sym_t: aout.Sym.Type = if (is_fn) .t else .d; // write the internal linker metadata decl.link.plan9.type = sym_t; // write the symbol // we already have the got index because that got allocated in allocateDeclIndexes const sym: aout.Sym = .{ .value = undefined, // the value of stuff gets filled in in flushModule .type = decl.link.plan9.type, .name = mem.span(decl.name), }; if (decl.link.plan9.sym_index) |s| { self.syms.items[s] = sym; } else { if (self.syms_index_free_list.popOrNull()) |i| { decl.link.plan9.sym_index = i; } else { try self.syms.append(self.base.allocator, sym); decl.link.plan9.sym_index = self.syms.items.len - 1; } } } pub fn flush(self: *Plan9, comp: *Compilation) !void { assert(!self.base.options.use_lld); switch (self.base.options.effectiveOutputMode()) { .Exe => {}, // plan9 object files are totally different .Obj => return error.TODOImplementPlan9Objs, .Lib => return error.TODOImplementWritingLibFiles, } return self.flushModule(comp); } pub fn changeLine(l: *std.ArrayList(u8), delta_line: i32) !void { if (delta_line > 0 and delta_line < 65) { const toappend = @intCast(u8, delta_line); try l.append(toappend); } else if (delta_line < 0 and delta_line > -65) { const toadd: u8 = @intCast(u8, -delta_line + 64); try l.append(toadd); } else if (delta_line != 0) { try l.append(0); try l.writer().writeIntBig(i32, delta_line); } } fn declCount(self: *Plan9) usize { var fn_decl_count: usize = 0; var itf_files = self.fn_decl_table.iterator(); while (itf_files.next()) |ent| { // get the submap var submap = ent.value_ptr.functions; fn_decl_count += submap.count(); } return self.data_decl_table.count() + fn_decl_count; } pub fn flushModule(self: *Plan9, comp: *Compilation) !void { if (build_options.skip_non_native and builtin.object_format != .plan9) { @panic("Attempted to compile for object format that was disabled by build configuration"); } _ = comp; const tracy = trace(@src()); defer tracy.end(); log.debug("flushModule", .{}); defer assert(self.hdr.entry != 0x0); const mod = self.base.options.module orelse return error.LinkingWithoutZigSourceUnimplemented; assert(self.got_len == self.declCount() + self.got_index_free_list.items.len); const got_size = self.got_len * if (!self.sixtyfour_bit) @as(u32, 4) else 8; var got_table = try self.base.allocator.alloc(u8, got_size); defer self.base.allocator.free(got_table); // + 4 for header, got, symbols, linecountinfo var iovecs = try self.base.allocator.alloc(std.os.iovec_const, self.declCount() + 4); defer self.base.allocator.free(iovecs); const file = self.base.file.?; var hdr_buf: [40]u8 = undefined; // account for the fat header const hdr_size = if (self.sixtyfour_bit) @as(usize, 40) else 32; const hdr_slice: []u8 = hdr_buf[0..hdr_size]; var foff = hdr_size; iovecs[0] = .{ .iov_base = hdr_slice.ptr, .iov_len = hdr_slice.len }; var iovecs_i: usize = 1; var text_i: u64 = 0; var linecountinfo = std.ArrayList(u8).init(self.base.allocator); defer linecountinfo.deinit(); // text { var linecount: i64 = -1; var it_file = self.fn_decl_table.iterator(); while (it_file.next()) |fentry| { var it = fentry.value_ptr.functions.iterator(); while (it.next()) |entry| { const decl = entry.key_ptr.*; const out = entry.value_ptr.*; log.debug("write text decl {*} ({s}), lines {d} to {d}", .{ decl, decl.name, out.start_line + 1, out.end_line }); { // connect the previous decl to the next const delta_line = @intCast(i32, out.start_line) - @intCast(i32, linecount); try changeLine(&linecountinfo, delta_line); // TODO change the pc too (maybe?) // write out the actual info that was generated in codegen now try linecountinfo.appendSlice(out.lineinfo); linecount = out.end_line; } foff += out.code.len; iovecs[iovecs_i] = .{ .iov_base = out.code.ptr, .iov_len = out.code.len }; iovecs_i += 1; const off = self.getAddr(text_i, .t); text_i += out.code.len; decl.link.plan9.offset = off; if (!self.sixtyfour_bit) { mem.writeIntNative(u32, got_table[decl.link.plan9.got_index.? * 4 ..][0..4], @intCast(u32, off)); mem.writeInt(u32, got_table[decl.link.plan9.got_index.? * 4 ..][0..4], @intCast(u32, off), self.base.options.target.cpu.arch.endian()); } else { mem.writeInt(u64, got_table[decl.link.plan9.got_index.? * 8 ..][0..8], off, self.base.options.target.cpu.arch.endian()); } self.syms.items[decl.link.plan9.sym_index.?].value = off; if (mod.decl_exports.get(decl)) |exports| { try self.addDeclExports(mod, decl, exports); } } } if (linecountinfo.items.len & 1 == 1) { // just a nop to make it even, the plan9 linker does this try linecountinfo.append(129); } // etext symbol self.syms.items[2].value = self.getAddr(text_i, .t); } // global offset table is in data iovecs[iovecs_i] = .{ .iov_base = got_table.ptr, .iov_len = got_table.len }; iovecs_i += 1; // data var data_i: u64 = got_size; { var it = self.data_decl_table.iterator(); while (it.next()) |entry| { const decl = entry.key_ptr.*; const code = entry.value_ptr.*; log.debug("write data decl {*} ({s})", .{ decl, decl.name }); foff += code.len; iovecs[iovecs_i] = .{ .iov_base = code.ptr, .iov_len = code.len }; iovecs_i += 1; const off = self.getAddr(data_i, .d); data_i += code.len; decl.link.plan9.offset = off; if (!self.sixtyfour_bit) { mem.writeInt(u32, got_table[decl.link.plan9.got_index.? * 4 ..][0..4], @intCast(u32, off), self.base.options.target.cpu.arch.endian()); } else { mem.writeInt(u64, got_table[decl.link.plan9.got_index.? * 8 ..][0..8], off, self.base.options.target.cpu.arch.endian()); } self.syms.items[decl.link.plan9.sym_index.?].value = off; if (mod.decl_exports.get(decl)) |exports| { try self.addDeclExports(mod, decl, exports); } } // edata symbol self.syms.items[0].value = self.getAddr(data_i, .b); } // edata self.syms.items[1].value = self.getAddr(0x0, .b); var sym_buf = std.ArrayList(u8).init(self.base.allocator); try self.writeSyms(&sym_buf); const syms = sym_buf.toOwnedSlice(); defer self.base.allocator.free(syms); assert(2 + self.declCount() == iovecs_i); // we didn't write all the decls iovecs[iovecs_i] = .{ .iov_base = syms.ptr, .iov_len = syms.len }; iovecs_i += 1; iovecs[iovecs_i] = .{ .iov_base = linecountinfo.items.ptr, .iov_len = linecountinfo.items.len }; iovecs_i += 1; // generate the header self.hdr = .{ .magic = self.magic, .text = @intCast(u32, text_i), .data = @intCast(u32, data_i), .syms = @intCast(u32, syms.len), .bss = 0, .spsz = 0, .pcsz = @intCast(u32, linecountinfo.items.len), .entry = @intCast(u32, self.entry_val.?), }; std.mem.copy(u8, hdr_slice, self.hdr.toU8s()[0..hdr_size]); // write the fat header for 64 bit entry points if (self.sixtyfour_bit) { mem.writeIntSliceBig(u64, hdr_buf[32..40], self.entry_val.?); } // write it all! try file.pwritevAll(iovecs, 0); } fn addDeclExports( self: *Plan9, module: *Module, decl: *Module.Decl, exports: []const *Module.Export, ) !void { for (exports) |exp| { // plan9 does not support custom sections if (exp.options.section) |section_name| { if (!mem.eql(u8, section_name, ".text") or !mem.eql(u8, section_name, ".data")) { try module.failed_exports.put(module.gpa, exp, try Module.ErrorMsg.create(self.base.allocator, decl.srcLoc(), "plan9 does not support extra sections", .{})); break; } } const sym = .{ .value = decl.link.plan9.offset.?, .type = decl.link.plan9.type.toGlobal(), .name = exp.options.name, }; if (exp.link.plan9) |i| { self.syms.items[i] = sym; } else { try self.syms.append(self.base.allocator, sym); exp.link.plan9 = self.syms.items.len - 1; } } } pub fn freeDecl(self: *Plan9, decl: *Module.Decl) void { // TODO audit the lifetimes of decls table entries. It's possible to get // allocateDeclIndexes and then freeDecl without any updateDecl in between. // However that is planned to change, see the TODO comment in Module.zig // in the deleteUnusedDecl function. const is_fn = (decl.val.tag() == .function); if (is_fn) { var symidx_and_submap = self.fn_decl_table.get(decl.getFileScope()).?; var submap = symidx_and_submap.functions; _ = submap.swapRemove(decl); if (submap.count() == 0) { self.syms.items[symidx_and_submap.sym_index] = aout.Sym.undefined_symbol; self.syms_index_free_list.append(self.base.allocator, symidx_and_submap.sym_index) catch {}; submap.deinit(self.base.allocator); } } else { _ = self.data_decl_table.swapRemove(decl); } if (decl.link.plan9.got_index) |i| { // TODO: if this catch {} is triggered, an assertion in flushModule will be triggered, because got_index_free_list will have the wrong length self.got_index_free_list.append(self.base.allocator, i) catch {}; } if (decl.link.plan9.sym_index) |i| { self.syms_index_free_list.append(self.base.allocator, i) catch {}; self.syms.items[i] = aout.Sym.undefined_symbol; } } pub fn seeDecl(self: *Plan9, decl: *Module.Decl) !void { if (decl.link.plan9.got_index == null) { if (self.got_index_free_list.popOrNull()) |i| { decl.link.plan9.got_index = i; } else { self.got_len += 1; decl.link.plan9.got_index = self.got_len - 1; } } } pub fn updateDeclExports( self: *Plan9, module: *Module, decl: *Module.Decl, exports: []const *Module.Export, ) !void { try self.seeDecl(decl); // we do all the things in flush _ = self; _ = module; _ = decl; _ = exports; } pub fn deinit(self: *Plan9) void { const gpa = self.base.allocator; var itf_files = self.fn_decl_table.iterator(); while (itf_files.next()) |ent| { // get the submap var submap = ent.value_ptr.functions; defer submap.deinit(gpa); var itf = submap.iterator(); while (itf.next()) |entry| { gpa.free(entry.value_ptr.code); gpa.free(entry.value_ptr.lineinfo); } } self.fn_decl_table.deinit(gpa); var itd = self.data_decl_table.iterator(); while (itd.next()) |entry| { gpa.free(entry.value_ptr.*); } self.data_decl_table.deinit(gpa); self.syms.deinit(gpa); self.got_index_free_list.deinit(gpa); self.syms_index_free_list.deinit(gpa); self.file_segments.deinit(gpa); self.path_arena.deinit(); } pub const Export = ?usize; pub const base_tag = .plan9; pub fn openPath(allocator: Allocator, sub_path: []const u8, options: link.Options) !*Plan9 { if (options.use_llvm) return error.LLVMBackendDoesNotSupportPlan9; assert(options.object_format == .plan9); const self = try createEmpty(allocator, options); errdefer self.base.destroy(); const file = try options.emit.?.directory.handle.createFile(sub_path, .{ .read = true, .mode = link.determineMode(options), }); errdefer file.close(); self.base.file = file; self.bases = defaultBaseAddrs(options.target.cpu.arch); // first 3 symbols in our table are edata, end, etext try self.syms.appendSlice(self.base.allocator, &.{ .{ .value = 0xcafebabe, .type = .B, .name = "edata", }, .{ .value = 0xcafebabe, .type = .B, .name = "end", }, .{ .value = 0xcafebabe, .type = .T, .name = "etext", }, }); return self; } pub fn writeSym(self: *Plan9, w: anytype, sym: aout.Sym) !void { log.debug("write sym{{name: {s}, value: {x}}}", .{ sym.name, sym.value }); if (sym.type == .bad) return; // we don't want to write free'd symbols if (!self.sixtyfour_bit) { try w.writeIntBig(u32, @intCast(u32, sym.value)); } else { try w.writeIntBig(u64, sym.value); } try w.writeByte(@enumToInt(sym.type)); try w.writeAll(sym.name); try w.writeByte(0); } pub fn writeSyms(self: *Plan9, buf: *std.ArrayList(u8)) !void { const writer = buf.writer(); // write the f symbols { var it = self.file_segments.iterator(); while (it.next()) |entry| { try self.writeSym(writer, .{ .type = .f, .value = entry.value_ptr.*, .name = entry.key_ptr.*, }); } } // write the data symbols { var it = self.data_decl_table.iterator(); while (it.next()) |entry| { const decl = entry.key_ptr.*; const sym = self.syms.items[decl.link.plan9.sym_index.?]; try self.writeSym(writer, sym); if (self.base.options.module.?.decl_exports.get(decl)) |exports| { for (exports) |e| { try self.writeSym(writer, self.syms.items[e.link.plan9.?]); } } } } // text symbols are the hardest: // the file of a text symbol is the .z symbol before it // so we have to write everything in the right order { var it_file = self.fn_decl_table.iterator(); while (it_file.next()) |fentry| { var symidx_and_submap = fentry.value_ptr; // write the z symbols try self.writeSym(writer, self.syms.items[symidx_and_submap.sym_index - 1]); try self.writeSym(writer, self.syms.items[symidx_and_submap.sym_index]); // write all the decls come from the file of the z symbol var submap_it = symidx_and_submap.functions.iterator(); while (submap_it.next()) |entry| { const decl = entry.key_ptr.*; const sym = self.syms.items[decl.link.plan9.sym_index.?]; try self.writeSym(writer, sym); if (self.base.options.module.?.decl_exports.get(decl)) |exports| { for (exports) |e| { const s = self.syms.items[e.link.plan9.?]; if (mem.eql(u8, s.name, "_start")) self.entry_val = s.value; try self.writeSym(writer, s); } } } } } } /// this will be removed, moved to updateFinish pub fn allocateDeclIndexes(self: *Plan9, decl: *Module.Decl) !void { _ = self; _ = decl; } pub fn getDeclVAddr(self: *Plan9, decl: *const Module.Decl, reloc_info: link.File.RelocInfo) !u64 { _ = reloc_info; if (decl.ty.zigTypeTag() == .Fn) { var start = self.bases.text; var it_file = self.fn_decl_table.iterator(); while (it_file.next()) |fentry| { var symidx_and_submap = fentry.value_ptr; var submap_it = symidx_and_submap.functions.iterator(); while (submap_it.next()) |entry| { if (entry.key_ptr.* == decl) return start; start += entry.value_ptr.code.len; } } unreachable; } else { var start = self.bases.data + self.got_len * if (!self.sixtyfour_bit) @as(u32, 4) else 8; var it = self.data_decl_table.iterator(); while (it.next()) |kv| { if (decl == kv.key_ptr.*) return start; start += kv.value_ptr.len; } unreachable; } }
src/link/Plan9.zig
const std = @import("std"); const builtin = @import("builtin"); const mem = std.mem; const expect = std.testing.expect; const expectEqualStrings = std.testing.expectEqualStrings; // normal comment /// this is a documentation comment /// doc comment line 2 fn emptyFunctionWithComments() void {} test "empty function with comments" { emptyFunctionWithComments(); } test "truncate" { try expect(testTruncate(0x10fd) == 0xfd); comptime try expect(testTruncate(0x10fd) == 0xfd); } fn testTruncate(x: u32) u8 { return @truncate(u8, x); } const g1: i32 = 1233 + 1; var g2: i32 = 0; test "global variables" { try expect(g2 == 0); g2 = g1; try expect(g2 == 1234); } test "comptime keyword on expressions" { const x: i32 = comptime x: { break :x 1 + 2 + 3; }; try expect(x == comptime 6); } test "type equality" { try expect(*const u8 != *u8); } test "pointer dereferencing" { var x = @as(i32, 3); const y = &x; y.* += 1; try expect(x == 4); try expect(y.* == 4); } test "const expression eval handling of variables" { var x = true; while (x) { x = false; } } test "character literals" { try expect('\'' == single_quote); } const single_quote = '\''; test "non const ptr to aliased type" { const int = i32; try expect(?*int == ?*i32); } test "cold function" { thisIsAColdFn(); comptime thisIsAColdFn(); } fn thisIsAColdFn() void { @setCold(true); } test "unicode escape in character literal" { var a: u24 = '\u{01f4a9}'; try expect(a == 128169); } test "unicode character in character literal" { try expect('πŸ’©' == 128169); } fn first4KeysOfHomeRow() []const u8 { return "aoeu"; } test "return string from function" { try expect(mem.eql(u8, first4KeysOfHomeRow(), "aoeu")); } test "hex escape" { try expect(mem.eql(u8, "\x68\x65\x6c\x6c\x6f", "hello")); } test "multiline string" { const s1 = \\one \\two) \\three ; const s2 = "one\ntwo)\nthree"; try expect(mem.eql(u8, s1, s2)); } test "multiline string comments at start" { const s1 = //\\one \\two) \\three ; const s2 = "two)\nthree"; try expect(mem.eql(u8, s1, s2)); } test "multiline string comments at end" { const s1 = \\one \\two) //\\three ; const s2 = "one\ntwo)"; try expect(mem.eql(u8, s1, s2)); } test "multiline string comments in middle" { const s1 = \\one //\\two) \\three ; const s2 = "one\nthree"; try expect(mem.eql(u8, s1, s2)); } test "multiline string comments at multiple places" { const s1 = \\one //\\two \\three //\\four \\five ; const s2 = "one\nthree\nfive"; try expect(mem.eql(u8, s1, s2)); } test "call result of if else expression" { try expect(mem.eql(u8, f2(true), "a")); try expect(mem.eql(u8, f2(false), "b")); } fn f2(x: bool) []const u8 { return (if (x) fA else fB)(); } fn fA() []const u8 { return "a"; } fn fB() []const u8 { return "b"; } test "string concatenation" { try expect(mem.eql(u8, "OK" ++ " IT " ++ "WORKED", "OK IT WORKED")); } test "array mult operator" { try expect(mem.eql(u8, "ab" ** 5, "ababababab")); } test "memcpy and memset intrinsics" { try testMemcpyMemset(); // TODO add comptime test coverage //comptime try testMemcpyMemset(); } fn testMemcpyMemset() !void { var foo: [20]u8 = undefined; var bar: [20]u8 = undefined; @memset(&foo, 'A', foo.len); @memcpy(&bar, &foo, bar.len); try expect(bar[0] == 'A'); try expect(bar[11] == 'A'); try expect(bar[19] == 'A'); } const OpaqueA = opaque {}; const OpaqueB = opaque {}; test "opaque types" { try expect(*OpaqueA != *OpaqueB); if (!builtin.zig_is_stage2) { try expect(mem.eql(u8, @typeName(OpaqueA), "OpaqueA")); try expect(mem.eql(u8, @typeName(OpaqueB), "OpaqueB")); } } test "variable is allowed to be a pointer to an opaque type" { var x: i32 = 1234; _ = hereIsAnOpaqueType(@ptrCast(*OpaqueA, &x)); } fn hereIsAnOpaqueType(ptr: *OpaqueA) *OpaqueA { var a = ptr; return a; } const global_a: i32 = 1234; const global_b: *const i32 = &global_a; const global_c: *const f32 = @ptrCast(*const f32, global_b); test "compile time global reinterpret" { const d = @ptrCast(*const i32, global_c); try expect(d.* == 1234); } test "cast undefined" { const array: [100]u8 = undefined; const slice = @as([]const u8, &array); testCastUndefined(slice); } fn testCastUndefined(x: []const u8) void { _ = x; } test "implicit cast after unreachable" { try expect(outer() == 1234); } fn inner() i32 { return 1234; } fn outer() i64 { return inner(); } test "take address of parameter" { try testTakeAddressOfParameter(12.34); } fn testTakeAddressOfParameter(f: f32) !void { const f_ptr = &f; try expect(f_ptr.* == 12.34); } test "pointer to void return type" { try testPointerToVoidReturnType(); } fn testPointerToVoidReturnType() anyerror!void { const a = testPointerToVoidReturnType2(); return a.*; } const test_pointer_to_void_return_type_x = void{}; fn testPointerToVoidReturnType2() *const void { return &test_pointer_to_void_return_type_x; } test "array 2D const double ptr" { const rect_2d_vertexes = [_][1]f32{ [_]f32{1.0}, [_]f32{2.0}, }; try testArray2DConstDoublePtr(&rect_2d_vertexes[0][0]); } fn testArray2DConstDoublePtr(ptr: *const f32) !void { const ptr2 = @ptrCast([*]const f32, ptr); try expect(ptr2[0] == 1.0); try expect(ptr2[1] == 2.0); } test "double implicit cast in same expression" { var x = @as(i32, @as(u16, nine())); try expect(x == 9); } fn nine() u8 { return 9; } test "comptime if inside runtime while which unconditionally breaks" { testComptimeIfInsideRuntimeWhileWhichUnconditionallyBreaks(true); comptime testComptimeIfInsideRuntimeWhileWhichUnconditionallyBreaks(true); } fn testComptimeIfInsideRuntimeWhileWhichUnconditionallyBreaks(cond: bool) void { while (cond) { if (false) {} break; } } test "implicit comptime while" { while (false) { @compileError("bad"); } } fn fnThatClosesOverLocalConst() type { const c = 1; return struct { fn g() i32 { return c; } }; } test "function closes over local const" { const x = fnThatClosesOverLocalConst().g(); try expect(x == 1); } test "volatile load and store" { var number: i32 = 1234; const ptr = @as(*volatile i32, &number); ptr.* += 1; try expect(ptr.* == 1235); } test "struct inside function" { try testStructInFn(); comptime try testStructInFn(); } fn testStructInFn() !void { const BlockKind = u32; const Block = struct { kind: BlockKind, }; var block = Block{ .kind = 1234 }; block.kind += 1; try expect(block.kind == 1235); } test "fn call returning scalar optional in equality expression" { try expect(getNull() == null); } fn getNull() ?*i32 { return null; } var global_foo: *i32 = undefined; test "global variable assignment with optional unwrapping with var initialized to undefined" { const S = struct { var data: i32 = 1234; fn foo() ?*i32 { return &data; } }; global_foo = S.foo() orelse { @panic("bad"); }; try expect(global_foo.* == 1234); } test "peer result location with typed parent, runtime condition, comptime prongs" { const S = struct { fn doTheTest(arg: i32) i32 { const st = Structy{ .bleh = if (arg == 1) 1 else 1, }; if (st.bleh == 1) return 1234; return 0; } const Structy = struct { bleh: i32, }; }; try expect(S.doTheTest(0) == 1234); try expect(S.doTheTest(1) == 1234); } fn ZA() type { return struct { b: B(), const Self = @This(); fn B() type { return struct { const Self = @This(); }; } }; } test "non-ambiguous reference of shadowed decls" { try expect(ZA().B().Self != ZA().Self); } test "use of declaration with same name as primitive" { const S = struct { const @"u8" = u16; const alias = @"u8"; }; const a: S.u8 = 300; try expect(a == 300); const b: S.alias = 300; try expect(b == 300); const @"u8" = u16; const c: @"u8" = 300; try expect(c == 300); } fn emptyFn() void {} test "constant equal function pointers" { const alias = emptyFn; try expect(comptime x: { break :x emptyFn == alias; }); } test "multiline string literal is null terminated" { const s1 = \\one \\two) \\three ; const s2 = "one\ntwo)\nthree"; try expect(std.cstr.cmp(s1, s2) == 0); } test "self reference through fn ptr field" { const S = struct { const A = struct { f: fn (A) u8, }; fn foo(a: A) u8 { _ = a; return 12; } }; var a: S.A = undefined; a.f = S.foo; try expect(a.f(a) == 12); } test "global variable initialized to global variable array element" { try expect(global_ptr == &gdt[0]); } const GDTEntry = struct { field: i32, }; var gdt = [_]GDTEntry{ GDTEntry{ .field = 1 }, GDTEntry{ .field = 2 }, }; var global_ptr = &gdt[0];
test/behavior/basic.zig
const std = @import("std"); const TestContext = @import("../../src/test.zig").TestContext; const archs = [2]std.Target.Cpu.Arch{ .aarch64, .x86_64, }; pub fn addCases(ctx: *TestContext) !void { for (archs) |arch| { const target: std.zig.CrossTarget = .{ .cpu_arch = arch, .os_tag = .macos, }; { var case = ctx.exe("hello world with updates", target); case.addError("", &[_][]const u8{"error: no entry point found"}); // Incorrect return type case.addError( \\export fn _main() noreturn { \\} , &[_][]const u8{":2:1: error: expected noreturn, found void"}); // Regular old hello world case.addCompareOutput( \\extern "c" fn write(usize, usize, usize) usize; \\extern "c" fn exit(usize) noreturn; \\ \\export fn _main() noreturn { \\ print(); \\ \\ exit(0); \\} \\ \\fn print() void { \\ const msg = @ptrToInt("Hello, World!\n"); \\ const len = 14; \\ _ = write(1, msg, len); \\} , "Hello, World!\n", ); // Print it 4 times and force growth and realloc. case.addCompareOutput( \\extern "c" fn write(usize, usize, usize) usize; \\extern "c" fn exit(usize) noreturn; \\ \\export fn _main() noreturn { \\ print(); \\ print(); \\ print(); \\ print(); \\ \\ exit(0); \\} \\ \\fn print() void { \\ const msg = @ptrToInt("Hello, World!\n"); \\ const len = 14; \\ _ = write(1, msg, len); \\} , \\Hello, World! \\Hello, World! \\Hello, World! \\Hello, World! \\ ); // Print it once, and change the message. case.addCompareOutput( \\extern "c" fn write(usize, usize, usize) usize; \\extern "c" fn exit(usize) noreturn; \\ \\export fn _main() noreturn { \\ print(); \\ \\ exit(0); \\} \\ \\fn print() void { \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); \\ const len = 104; \\ _ = write(1, msg, len); \\} , "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n", ); // Now we print it twice. case.addCompareOutput( \\extern "c" fn write(usize, usize, usize) usize; \\extern "c" fn exit(usize) noreturn; \\ \\export fn _main() noreturn { \\ print(); \\ print(); \\ \\ exit(0); \\} \\ \\fn print() void { \\ const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); \\ const len = 104; \\ _ = write(1, msg, len); \\} , \\What is up? This is a longer message that will force the data to be relocated in virtual address space. \\What is up? This is a longer message that will force the data to be relocated in virtual address space. \\ ); } { var case = ctx.exe("corner case - update existing, singular TextBlock", target); // This test case also covers an infrequent scenarion where the string table *may* be relocated // into the position preceeding the symbol table which results in a dyld error. case.addCompareOutput( \\extern "c" fn exit(usize) noreturn; \\ \\export fn _main() noreturn { \\ exit(0); \\} , "", ); case.addCompareOutput( \\extern "c" fn exit(usize) noreturn; \\extern "c" fn write(usize, usize, usize) usize; \\ \\export fn _main() noreturn { \\ _ = write(1, @ptrToInt("Hey!\n"), 5); \\ exit(0); \\} , "Hey!\n", ); } } }
test/stage2/darwin.zig
const std = @import("std"); const assertOrPanic = std.debug.assertOrPanic; fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type { assertOrPanic(Key == @IntType(false, Key.bit_count)); assertOrPanic(Key.bit_count >= mask_bit_count); const ShardKey = @IntType(false, mask_bit_count); const shift_amount = Key.bit_count - ShardKey.bit_count; return struct { const Self = @This(); shards: [1 << ShardKey.bit_count]?*Node, pub fn create() Self { return Self{ .shards = []?*Node{null} ** (1 << ShardKey.bit_count) }; } fn getShardKey(key: Key) ShardKey { // https://github.com/ziglang/zig/issues/1544 // this special case is needed because you can't u32 >> 32. if (ShardKey == u0) return 0; // this can be u1 >> u0 const shard_key = key >> shift_amount; // TODO: https://github.com/ziglang/zig/issues/1544 // This cast could be implicit if we teach the compiler that // u32 >> 30 -> u2 return @intCast(ShardKey, shard_key); } pub fn put(self: *Self, node: *Node) void { const shard_key = Self.getShardKey(node.key); node.next = self.shards[shard_key]; self.shards[shard_key] = node; } pub fn get(self: *Self, key: Key) ?*Node { const shard_key = Self.getShardKey(key); var maybe_node = self.shards[shard_key]; while (maybe_node) |node| : (maybe_node = node.next) { if (node.key == key) return node; } return null; } pub const Node = struct { key: Key, value: V, next: ?*Node, pub fn init(self: *Node, key: Key, value: V) void { self.key = key; self.value = value; self.next = null; } }; }; } test "sharded table" { // realistic 16-way sharding testShardedTable(u32, 4, 8); testShardedTable(u5, 0, 32); // ShardKey == u0 testShardedTable(u5, 2, 32); testShardedTable(u5, 5, 32); testShardedTable(u1, 0, 2); testShardedTable(u1, 1, 2); // this does u1 >> u0 testShardedTable(u0, 0, 1); } fn testShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime node_count: comptime_int) void { const Table = ShardedTable(Key, mask_bit_count, void); var table = Table.create(); var node_buffer: [node_count]Table.Node = undefined; for (node_buffer) |*node, i| { const key = @intCast(Key, i); assertOrPanic(table.get(key) == null); node.init(key, {}); table.put(node); } for (node_buffer) |*node, i| { assertOrPanic(table.get(@intCast(Key, i)) == node); } }
test/stage1/behavior/bit_shifting.zig
const std = @import("std"); pub fn mmio(addr: usize, comptime size: u8, comptime PackedT: type) *volatile Mmio(size, PackedT) { return @intToPtr(*volatile Mmio(size, PackedT), addr); } pub fn Mmio(comptime size: u8, comptime PackedT: type) type { if ((size % 8) != 0) @compileError("size must be divisible by 8!"); if (!std.math.isPowerOfTwo(size / 8)) @compileError("size must encode a power of two number of bytes!"); const IntT = std.meta.Int(.unsigned, size); if (@sizeOf(PackedT) != (size / 8)) @compileError(std.fmt.comptimePrint("IntT and PackedT must have the same size!, they are {} and {} bytes respectively", .{ size / 8, @sizeOf(PackedT) })); return extern struct { const Self = @This(); raw: IntT, pub const underlying_type = PackedT; pub fn read(addr: *volatile Self) PackedT { return @bitCast(PackedT, addr.raw); } pub fn write(addr: *volatile Self, val: PackedT) void { // This is a workaround for a compiler bug related to miscompilation // If the tmp var is not used, result location will fuck things up var tmp = @bitCast(IntT, val); addr.raw = tmp; } pub fn modify(addr: *volatile Self, fields: anytype) void { var val = read(addr); inline for (@typeInfo(@TypeOf(fields)).Struct.fields) |field| { @field(val, field.name) = @field(fields, field.name); } write(addr, val); } pub fn toggle(addr: *volatile Self, fields: anytype) void { var val = read(addr); inline for (@typeInfo(@TypeOf(fields)).Struct.fields) |field| { @field(val, @tagName(field.default_value.?)) = !@field(val, @tagName(field.default_value.?)); } write(addr, val); } }; } pub fn MmioInt(comptime size: u8, comptime T: type) type { return extern struct { const Self = @This(); raw: std.meta.Int(.unsigned, size), pub fn read(addr: *volatile Self) T { return @truncate(T, addr.raw); } pub fn modify(addr: *volatile Self, val: T) void { const Int = std.meta.Int(.unsigned, size); const mask = ~@as(Int, (1 << @bitSizeOf(T)) - 1); var tmp = addr.raw; addr.raw = (tmp & mask) | val; } }; } pub fn mmioInt(addr: usize, comptime size: usize, comptime T: type) *volatile MmioInt(size, T) { return @intToPtr(*volatile MmioInt(size, T), addr); } const InterruptVector = extern union { C: fn () callconv(.C) void, Naked: fn () callconv(.Naked) void, // Interrupt is not supported on arm }; const unhandled = InterruptVector{ .C = struct { fn tmp() callconv(.C) noreturn { @panic("unhandled interrupt"); } }.tmp, };
src/mmio.zig
const std = @import("std"); const Context = @import("context.zig").Context; const Source = @import("context.zig").Source; const BuiltinPackage = @import("builtins.zig").BuiltinPackage; const Curve = @import("parse.zig").Curve; const Track = @import("parse.zig").Track; const Module = @import("parse.zig").Module; const parse = @import("parse.zig").parse; const CodeGenModuleResult = @import("codegen.zig").CodeGenModuleResult; const CodeGenTrackResult = @import("codegen.zig").CodeGenTrackResult; const ExportedModule = @import("codegen.zig").ExportedModule; const codegen = @import("codegen.zig").codegen; pub const CompiledScript = struct { parse_arena: std.heap.ArenaAllocator, codegen_arena: std.heap.ArenaAllocator, curves: []const Curve, tracks: []const Track, modules: []const Module, track_results: []const CodeGenTrackResult, module_results: []const CodeGenModuleResult, exported_modules: []const ExportedModule, pub fn deinit(self: *CompiledScript) void { self.codegen_arena.deinit(); self.parse_arena.deinit(); } }; pub const CompileOptions = struct { builtin_packages: []const BuiltinPackage, source: Source, errors_out: std.io.StreamSource.OutStream, errors_color: bool, dump_parse_out: ?std.io.StreamSource.OutStream = null, dump_codegen_out: ?std.io.StreamSource.OutStream = null, }; pub fn compile(allocator: *std.mem.Allocator, options: CompileOptions) !CompiledScript { const context: Context = .{ .builtin_packages = options.builtin_packages, .source = options.source, .errors_out = options.errors_out, .errors_color = options.errors_color, }; var parse_result = try parse(context, allocator, options.dump_parse_out); errdefer parse_result.deinit(); var codegen_result = try codegen(context, parse_result, allocator, options.dump_codegen_out); errdefer codegen_result.deinit(); return CompiledScript{ .parse_arena = parse_result.arena, .codegen_arena = codegen_result.arena, .curves = parse_result.curves, .tracks = parse_result.tracks, .modules = parse_result.modules, .track_results = codegen_result.track_results, .module_results = codegen_result.module_results, .exported_modules = codegen_result.exported_modules, }; }
src/zangscript/compile.zig
const std = @import("std"); const input = @import("input.zig"); pub fn run(stdout: anytype) anyerror!void { { var input_ = try input.readFile("inputs/day14"); defer input_.deinit(); const result = try part1(&input_); try stdout.print("14a: {}\n", .{ result }); std.debug.assert(result == 4517); } { var input_ = try input.readFile("inputs/day14"); defer input_.deinit(); const result = try part2(&input_); try stdout.print("14b: {}\n", .{ result }); std.debug.assert(result == 4704817645083); } } fn part1(input_: anytype) !usize { return solve(input_, 10); } fn part2(input_: anytype) !usize { return solve(input_, 40); } const max_element = 'Z' - 'A'; const Element = std.math.IntFittingRange(0, max_element); fn parseElement(c: u8) !Element { if (c < 'A' or c > 'Z') { return error.InvalidInput; } return @intCast(Element, c - 'A'); } fn solve(input_: anytype, num_steps: usize) !usize { var pairs: [max_element + 1][max_element + 1]usize = [_][max_element + 1]usize { [_]usize { 0 } ** (max_element + 1) } ** (max_element + 1); const template_last_element = template_last_element: { const template = (try input_.next()) orelse return error.InvalidInput; var template_i: usize = 1; while (template_i < template.len) : (template_i += 1) { const left = try parseElement(template[template_i - 1]); const right = try parseElement(template[template_i]); pairs[left][right] += 1; } break :template_last_element try parseElement(template[template_i - 1]); }; _ = (try input_.next()) orelse return error.InvalidInput; var rules: [max_element + 1][max_element + 1]?Element = [_][max_element + 1]?Element { [_]?Element { null } ** (max_element + 1) } ** (max_element + 1); while (try input_.next()) |line| { if (line.len != 2 + 4 + 1 or !std.mem.eql(u8, line[2..6], " -> ")) { return error.InvalidInput; } const left = try parseElement(line[0]); const right = try parseElement(line[1]); const middle = try parseElement(line[6]); rules[left][right] = middle; } { var new_pairs = pairs; var step_i: usize = 1; while (step_i <= num_steps) : (step_i += 1) { for (new_pairs) |*row, left_i| { for (row) |*new_count, right_i| { if (rules[left_i][right_i]) |middle| { const count = pairs[left_i][right_i]; new_count.* -= count; new_pairs[left_i][middle] += count; new_pairs[middle][right_i] += count; } } } pairs = new_pairs; } } var counts = [_]usize { 0 } ** (max_element + 1); for (pairs) |row, left_i| { for (row) |count| { counts[left_i] += count; } } counts[template_last_element] += 1; var max_count: usize = 0; var min_count: usize = std.math.maxInt(usize); for (counts) |count| { max_count = std.math.max(max_count, count); if (count > 0) { min_count = std.math.min(min_count, count); } } return max_count - min_count; } test "day 14 example 1" { const input_ = \\NNCB \\ \\CH -> B \\HH -> N \\CB -> H \\NH -> C \\HB -> C \\HC -> B \\HN -> C \\NN -> C \\BH -> H \\NC -> B \\NB -> B \\BN -> B \\BB -> N \\BC -> B \\CC -> N \\CN -> C ; try std.testing.expectEqual(@as(usize, 1749 - 161), try part1(&input.readString(input_))); try std.testing.expectEqual(@as(usize, 2192039569602 - 3849876073), try part2(&input.readString(input_))); }
src/day14.zig
const Tokenizer = @This(); index: usize = 0, bytes: []const u8, state: State = .lhs, const std = @import("std"); const testing = std.testing; const assert = std.debug.assert; pub fn next(self: *Tokenizer) ?Token { var start = self.index; var must_resolve = false; while (self.index < self.bytes.len) { const char = self.bytes[self.index]; switch (self.state) { .lhs => switch (char) { '\t', '\n', '\r', ' ' => { // silently ignore whitespace self.index += 1; }, else => { start = self.index; self.state = .target; }, }, .target => switch (char) { '\t', '\n', '\r', ' ' => { return errorIllegalChar(.invalid_target, self.index, char); }, '$' => { self.state = .target_dollar_sign; self.index += 1; }, '\\' => { self.state = .target_reverse_solidus; self.index += 1; }, ':' => { self.state = .target_colon; self.index += 1; }, else => { self.index += 1; }, }, .target_reverse_solidus => switch (char) { '\t', '\n', '\r' => { return errorIllegalChar(.bad_target_escape, self.index, char); }, ' ', '#', '\\' => { must_resolve = true; self.state = .target; self.index += 1; }, '$' => { self.state = .target_dollar_sign; self.index += 1; }, else => { self.state = .target; self.index += 1; }, }, .target_dollar_sign => switch (char) { '$' => { must_resolve = true; self.state = .target; self.index += 1; }, else => { return errorIllegalChar(.expected_dollar_sign, self.index, char); }, }, .target_colon => switch (char) { '\n', '\r' => { const bytes = self.bytes[start .. self.index - 1]; if (bytes.len != 0) { self.state = .lhs; return finishTarget(must_resolve, bytes); } // silently ignore null target self.state = .lhs; }, '\\' => { self.state = .target_colon_reverse_solidus; self.index += 1; }, else => { const bytes = self.bytes[start .. self.index - 1]; if (bytes.len != 0) { self.state = .rhs; return finishTarget(must_resolve, bytes); } // silently ignore null target self.state = .lhs; }, }, .target_colon_reverse_solidus => switch (char) { '\n', '\r' => { const bytes = self.bytes[start .. self.index - 2]; if (bytes.len != 0) { self.state = .lhs; return finishTarget(must_resolve, bytes); } // silently ignore null target self.state = .lhs; }, else => { self.state = .target; }, }, .rhs => switch (char) { '\t', ' ' => { // silently ignore horizontal whitespace self.index += 1; }, '\n', '\r' => { self.state = .lhs; }, '\\' => { self.state = .rhs_continuation; self.index += 1; }, '"' => { self.state = .prereq_quote; self.index += 1; start = self.index; }, else => { start = self.index; self.state = .prereq; }, }, .rhs_continuation => switch (char) { '\n' => { self.state = .rhs; self.index += 1; }, '\r' => { self.state = .rhs_continuation_linefeed; self.index += 1; }, else => { return errorIllegalChar(.continuation_eol, self.index, char); }, }, .rhs_continuation_linefeed => switch (char) { '\n' => { self.state = .rhs; self.index += 1; }, else => { return errorIllegalChar(.continuation_eol, self.index, char); }, }, .prereq_quote => switch (char) { '"' => { self.index += 1; self.state = .rhs; return Token{ .prereq = self.bytes[start .. self.index - 1] }; }, else => { self.index += 1; }, }, .prereq => switch (char) { '\t', ' ' => { self.state = .rhs; return Token{ .prereq = self.bytes[start..self.index] }; }, '\n', '\r' => { self.state = .lhs; return Token{ .prereq = self.bytes[start..self.index] }; }, '\\' => { self.state = .prereq_continuation; self.index += 1; }, else => { self.index += 1; }, }, .prereq_continuation => switch (char) { '\n' => { self.index += 1; self.state = .rhs; return Token{ .prereq = self.bytes[start .. self.index - 2] }; }, '\r' => { self.state = .prereq_continuation_linefeed; self.index += 1; }, else => { // not continuation self.state = .prereq; self.index += 1; }, }, .prereq_continuation_linefeed => switch (char) { '\n' => { self.index += 1; self.state = .rhs; return Token{ .prereq = self.bytes[start .. self.index - 1] }; }, else => { return errorIllegalChar(.continuation_eol, self.index, char); }, }, } } else { switch (self.state) { .lhs, .rhs, .rhs_continuation, .rhs_continuation_linefeed, => return null, .target => { return errorPosition(.incomplete_target, start, self.bytes[start..]); }, .target_reverse_solidus, .target_dollar_sign, => { const idx = self.index - 1; return errorIllegalChar(.incomplete_escape, idx, self.bytes[idx]); }, .target_colon => { const bytes = self.bytes[start .. self.index - 1]; if (bytes.len != 0) { self.index += 1; self.state = .rhs; return finishTarget(must_resolve, bytes); } // silently ignore null target self.state = .lhs; return null; }, .target_colon_reverse_solidus => { const bytes = self.bytes[start .. self.index - 2]; if (bytes.len != 0) { self.index += 1; self.state = .rhs; return finishTarget(must_resolve, bytes); } // silently ignore null target self.state = .lhs; return null; }, .prereq_quote => { return errorPosition(.incomplete_quoted_prerequisite, start, self.bytes[start..]); }, .prereq => { self.state = .lhs; return Token{ .prereq = self.bytes[start..] }; }, .prereq_continuation => { self.state = .lhs; return Token{ .prereq = self.bytes[start .. self.index - 1] }; }, .prereq_continuation_linefeed => { self.state = .lhs; return Token{ .prereq = self.bytes[start .. self.index - 2] }; }, } } unreachable; } fn errorPosition(comptime id: @TagType(Token), index: usize, bytes: []const u8) Token { return @unionInit(Token, @tagName(id), .{ .index = index, .bytes = bytes }); } fn errorIllegalChar(comptime id: @TagType(Token), index: usize, char: u8) Token { return @unionInit(Token, @tagName(id), .{ .index = index, .char = char }); } fn finishTarget(must_resolve: bool, bytes: []const u8) Token { return if (must_resolve) .{ .target_must_resolve = bytes } else .{ .target = bytes }; } const State = enum { lhs, target, target_reverse_solidus, target_dollar_sign, target_colon, target_colon_reverse_solidus, rhs, rhs_continuation, rhs_continuation_linefeed, prereq_quote, prereq, prereq_continuation, prereq_continuation_linefeed, }; pub const Token = union(enum) { target: []const u8, target_must_resolve: []const u8, prereq: []const u8, incomplete_quoted_prerequisite: IndexAndBytes, incomplete_target: IndexAndBytes, invalid_target: IndexAndChar, bad_target_escape: IndexAndChar, expected_dollar_sign: IndexAndChar, continuation_eol: IndexAndChar, incomplete_escape: IndexAndChar, pub const IndexAndChar = struct { index: usize, char: u8, }; pub const IndexAndBytes = struct { index: usize, bytes: []const u8, }; /// Resolve escapes in target. Only valid with .target_must_resolve. pub fn resolve(self: Token, writer: anytype) @TypeOf(writer).Error!void { const bytes = self.target_must_resolve; // resolve called on incorrect token var state: enum { start, escape, dollar } = .start; for (bytes) |c| { switch (state) { .start => { switch (c) { '\\' => state = .escape, '$' => state = .dollar, else => try writer.writeByte(c), } }, .escape => { switch (c) { ' ', '#', '\\' => {}, '$' => { try writer.writeByte('\\'); state = .dollar; continue; }, else => try writer.writeByte('\\'), } try writer.writeByte(c); state = .start; }, .dollar => { try writer.writeByte('$'); switch (c) { '$' => {}, else => try writer.writeByte(c), } state = .start; }, } } } pub fn printError(self: Token, writer: anytype) @TypeOf(writer).Error!void { switch (self) { .target, .target_must_resolve, .prereq => unreachable, // not an error .incomplete_quoted_prerequisite, .incomplete_target, => |index_and_bytes| { try writer.print("{s} '", .{self.errStr()}); if (self == .incomplete_target) { const tmp = Token{ .target_must_resolve = index_and_bytes.bytes }; try tmp.resolve(writer); } else { try printCharValues(writer, index_and_bytes.bytes); } try writer.print("' at position {d}", .{index_and_bytes.index}); }, .invalid_target, .bad_target_escape, .expected_dollar_sign, .continuation_eol, .incomplete_escape, => |index_and_char| { try writer.writeAll("illegal char "); try printUnderstandableChar(writer, index_and_char.char); try writer.print(" at position {d}: {s}", .{ index_and_char.index, self.errStr() }); }, } } fn errStr(self: Token) []const u8 { return switch (self) { .target, .target_must_resolve, .prereq => unreachable, // not an error .incomplete_quoted_prerequisite => "incomplete quoted prerequisite", .incomplete_target => "incomplete target", .invalid_target => "invalid target", .bad_target_escape => "bad target escape", .expected_dollar_sign => "expecting '$'", .continuation_eol => "continuation expecting end-of-line", .incomplete_escape => "incomplete escape", }; } }; test "empty file" { try depTokenizer("", ""); } test "empty whitespace" { try depTokenizer("\n", ""); try depTokenizer("\r", ""); try depTokenizer("\r\n", ""); try depTokenizer(" ", ""); } test "empty colon" { try depTokenizer(":", ""); try depTokenizer("\n:", ""); try depTokenizer("\r:", ""); try depTokenizer("\r\n:", ""); try depTokenizer(" :", ""); } test "empty target" { try depTokenizer("foo.o:", "target = {foo.o}"); try depTokenizer( \\foo.o: \\bar.o: \\abcd.o: , \\target = {foo.o} \\target = {bar.o} \\target = {abcd.o} ); } test "whitespace empty target" { try depTokenizer("\nfoo.o:", "target = {foo.o}"); try depTokenizer("\rfoo.o:", "target = {foo.o}"); try depTokenizer("\r\nfoo.o:", "target = {foo.o}"); try depTokenizer(" foo.o:", "target = {foo.o}"); } test "escape empty target" { try depTokenizer("\\ foo.o:", "target = { foo.o}"); try depTokenizer("\\#foo.o:", "target = {#foo.o}"); try depTokenizer("\\\\foo.o:", "target = {\\foo.o}"); try depTokenizer("$$foo.o:", "target = {$foo.o}"); } test "empty target linefeeds" { try depTokenizer("\n", ""); try depTokenizer("\r\n", ""); const expect = "target = {foo.o}"; try depTokenizer( \\foo.o: , expect); try depTokenizer( \\foo.o: \\ , expect); try depTokenizer( \\foo.o: , expect); try depTokenizer( \\foo.o: \\ , expect); } test "empty target linefeeds + continuations" { const expect = "target = {foo.o}"; try depTokenizer( \\foo.o:\ , expect); try depTokenizer( \\foo.o:\ \\ , expect); try depTokenizer( \\foo.o:\ , expect); try depTokenizer( \\foo.o:\ \\ , expect); } test "empty target linefeeds + hspace + continuations" { const expect = "target = {foo.o}"; try depTokenizer( \\foo.o: \ , expect); try depTokenizer( \\foo.o: \ \\ , expect); try depTokenizer( \\foo.o: \ , expect); try depTokenizer( \\foo.o: \ \\ , expect); } test "prereq" { const expect = \\target = {foo.o} \\prereq = {foo.c} ; try depTokenizer("foo.o: foo.c", expect); try depTokenizer( \\foo.o: \ \\foo.c , expect); try depTokenizer( \\foo.o: \ \\ foo.c , expect); try depTokenizer( \\foo.o: \ \\ foo.c , expect); } test "prereq continuation" { const expect = \\target = {foo.o} \\prereq = {foo.h} \\prereq = {bar.h} ; try depTokenizer( \\foo.o: foo.h\ \\bar.h , expect); try depTokenizer( \\foo.o: foo.h\ \\bar.h , expect); } test "multiple prereqs" { const expect = \\target = {foo.o} \\prereq = {foo.c} \\prereq = {foo.h} \\prereq = {bar.h} ; try depTokenizer("foo.o: foo.c foo.h bar.h", expect); try depTokenizer( \\foo.o: \ \\foo.c foo.h bar.h , expect); try depTokenizer( \\foo.o: foo.c foo.h bar.h\ , expect); try depTokenizer( \\foo.o: foo.c foo.h bar.h\ \\ , expect); try depTokenizer( \\foo.o: \ \\foo.c \ \\ foo.h\ \\bar.h \\ , expect); try depTokenizer( \\foo.o: \ \\foo.c \ \\ foo.h\ \\bar.h\ \\ , expect); try depTokenizer( \\foo.o: \ \\foo.c \ \\ foo.h\ \\bar.h\ , expect); } test "multiple targets and prereqs" { try depTokenizer( \\foo.o: foo.c \\bar.o: bar.c a.h b.h c.h \\abc.o: abc.c \ \\ one.h two.h \ \\ three.h four.h , \\target = {foo.o} \\prereq = {foo.c} \\target = {bar.o} \\prereq = {bar.c} \\prereq = {a.h} \\prereq = {b.h} \\prereq = {c.h} \\target = {abc.o} \\prereq = {abc.c} \\prereq = {one.h} \\prereq = {two.h} \\prereq = {three.h} \\prereq = {four.h} ); try depTokenizer( \\ascii.o: ascii.c \\base64.o: base64.c stdio.h \\elf.o: elf.c a.h b.h c.h \\macho.o: \ \\ macho.c\ \\ a.h b.h c.h , \\target = {ascii.o} \\prereq = {ascii.c} \\target = {base64.o} \\prereq = {base64.c} \\prereq = {stdio.h} \\target = {elf.o} \\prereq = {elf.c} \\prereq = {a.h} \\prereq = {b.h} \\prereq = {c.h} \\target = {macho.o} \\prereq = {macho.c} \\prereq = {a.h} \\prereq = {b.h} \\prereq = {c.h} ); try depTokenizer( \\a$$scii.o: ascii.c \\\\base64.o: "\base64.c" "s t#dio.h" \\e\\lf.o: "e\lf.c" "a.h$$" "$$b.h c.h$$" \\macho.o: \ \\ "macho!.c" \ \\ a.h b.h c.h , \\target = {a$scii.o} \\prereq = {ascii.c} \\target = {\base64.o} \\prereq = {\base64.c} \\prereq = {s t#dio.h} \\target = {e\lf.o} \\prereq = {e\lf.c} \\prereq = {a.h$$} \\prereq = {$$b.h c.h$$} \\target = {macho.o} \\prereq = {macho!.c} \\prereq = {a.h} \\prereq = {b.h} \\prereq = {c.h} ); } test "windows quoted prereqs" { try depTokenizer( \\c:\foo.o: "C:\Program Files (x86)\Microsoft Visual Studio\foo.c" \\c:\foo2.o: "C:\Program Files (x86)\Microsoft Visual Studio\foo2.c" \ \\ "C:\Program Files (x86)\Microsoft Visual Studio\foo1.h" \ \\ "C:\Program Files (x86)\Microsoft Visual Studio\foo2.h" , \\target = {c:\foo.o} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo.c} \\target = {c:\foo2.o} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo2.c} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo1.h} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo2.h} ); } test "windows mixed prereqs" { try depTokenizer( \\cimport.o: \ \\ C:\msys64\home\anon\project\zig\master\zig-cache\o\qhvhbUo7GU5iKyQ5mpA8TcQpncCYaQu0wwvr3ybiSTj_Dtqi1Nmcb70kfODJ2Qlg\cimport.h \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\stdio.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt.h" \ \\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime.h" \ \\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\sal.h" \ \\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\concurrencysal.h" \ \\ C:\msys64\opt\zig\lib\zig\include\vadefs.h \ \\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vadefs.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstdio.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\string.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memory.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memcpy_s.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\errno.h" \ \\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime_string.h" \ \\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstring.h" , \\target = {cimport.o} \\prereq = {C:\msys64\home\anon\project\zig\master\zig-cache\o\qhvhbUo7GU5iKyQ5mpA8TcQpncCYaQu0wwvr3ybiSTj_Dtqi1Nmcb70kfODJ2Qlg\cimport.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\stdio.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt.h} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime.h} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\sal.h} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\concurrencysal.h} \\prereq = {C:\msys64\opt\zig\lib\zig\include\vadefs.h} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vadefs.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstdio.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\string.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memory.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memcpy_s.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\errno.h} \\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime_string.h} \\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstring.h} ); } test "funky targets" { try depTokenizer( \\C:\Users\anon\foo.o: \\C:\Users\anon\foo\ .o: \\C:\Users\anon\foo\#.o: \\C:\Users\anon\foo$$.o: \\C:\Users\anon\\\ foo.o: \\C:\Users\anon\\#foo.o: \\C:\Users\anon\$$foo.o: \\C:\Users\anon\\\ \ \ \ \ foo.o: , \\target = {C:\Users\anon\foo.o} \\target = {C:\Users\anon\foo .o} \\target = {C:\Users\anon\foo#.o} \\target = {C:\Users\anon\foo$.o} \\target = {C:\Users\anon\ foo.o} \\target = {C:\Users\anon\#foo.o} \\target = {C:\Users\anon\$foo.o} \\target = {C:\Users\anon\ foo.o} ); } test "error incomplete escape - reverse_solidus" { try depTokenizer("\\", \\ERROR: illegal char '\' at position 0: incomplete escape ); try depTokenizer("\t\\", \\ERROR: illegal char '\' at position 1: incomplete escape ); try depTokenizer("\n\\", \\ERROR: illegal char '\' at position 1: incomplete escape ); try depTokenizer("\r\\", \\ERROR: illegal char '\' at position 1: incomplete escape ); try depTokenizer("\r\n\\", \\ERROR: illegal char '\' at position 2: incomplete escape ); try depTokenizer(" \\", \\ERROR: illegal char '\' at position 1: incomplete escape ); } test "error incomplete escape - dollar_sign" { try depTokenizer("$", \\ERROR: illegal char '$' at position 0: incomplete escape ); try depTokenizer("\t$", \\ERROR: illegal char '$' at position 1: incomplete escape ); try depTokenizer("\n$", \\ERROR: illegal char '$' at position 1: incomplete escape ); try depTokenizer("\r$", \\ERROR: illegal char '$' at position 1: incomplete escape ); try depTokenizer("\r\n$", \\ERROR: illegal char '$' at position 2: incomplete escape ); try depTokenizer(" $", \\ERROR: illegal char '$' at position 1: incomplete escape ); } test "error incomplete target" { try depTokenizer("foo.o", \\ERROR: incomplete target 'foo.o' at position 0 ); try depTokenizer("\tfoo.o", \\ERROR: incomplete target 'foo.o' at position 1 ); try depTokenizer("\nfoo.o", \\ERROR: incomplete target 'foo.o' at position 1 ); try depTokenizer("\rfoo.o", \\ERROR: incomplete target 'foo.o' at position 1 ); try depTokenizer("\r\nfoo.o", \\ERROR: incomplete target 'foo.o' at position 2 ); try depTokenizer(" foo.o", \\ERROR: incomplete target 'foo.o' at position 1 ); try depTokenizer("\\ foo.o", \\ERROR: incomplete target ' foo.o' at position 0 ); try depTokenizer("\\#foo.o", \\ERROR: incomplete target '#foo.o' at position 0 ); try depTokenizer("\\\\foo.o", \\ERROR: incomplete target '\foo.o' at position 0 ); try depTokenizer("$$foo.o", \\ERROR: incomplete target '$foo.o' at position 0 ); } test "error illegal char at position - bad target escape" { try depTokenizer("\\\t", \\ERROR: illegal char \x09 at position 1: bad target escape ); try depTokenizer("\\\n", \\ERROR: illegal char \x0A at position 1: bad target escape ); try depTokenizer("\\\r", \\ERROR: illegal char \x0D at position 1: bad target escape ); try depTokenizer("\\\r\n", \\ERROR: illegal char \x0D at position 1: bad target escape ); } test "error illegal char at position - execting dollar_sign" { try depTokenizer("$\t", \\ERROR: illegal char \x09 at position 1: expecting '$' ); try depTokenizer("$\n", \\ERROR: illegal char \x0A at position 1: expecting '$' ); try depTokenizer("$\r", \\ERROR: illegal char \x0D at position 1: expecting '$' ); try depTokenizer("$\r\n", \\ERROR: illegal char \x0D at position 1: expecting '$' ); } test "error illegal char at position - invalid target" { try depTokenizer("foo\t.o", \\ERROR: illegal char \x09 at position 3: invalid target ); try depTokenizer("foo\n.o", \\ERROR: illegal char \x0A at position 3: invalid target ); try depTokenizer("foo\r.o", \\ERROR: illegal char \x0D at position 3: invalid target ); try depTokenizer("foo\r\n.o", \\ERROR: illegal char \x0D at position 3: invalid target ); } test "error target - continuation expecting end-of-line" { try depTokenizer("foo.o: \\\t", \\target = {foo.o} \\ERROR: illegal char \x09 at position 8: continuation expecting end-of-line ); try depTokenizer("foo.o: \\ ", \\target = {foo.o} \\ERROR: illegal char \x20 at position 8: continuation expecting end-of-line ); try depTokenizer("foo.o: \\x", \\target = {foo.o} \\ERROR: illegal char 'x' at position 8: continuation expecting end-of-line ); try depTokenizer("foo.o: \\\x0dx", \\target = {foo.o} \\ERROR: illegal char 'x' at position 9: continuation expecting end-of-line ); } test "error prereq - continuation expecting end-of-line" { try depTokenizer("foo.o: foo.h\\\x0dx", \\target = {foo.o} \\ERROR: illegal char 'x' at position 14: continuation expecting end-of-line ); } // - tokenize input, emit textual representation, and compare to expect fn depTokenizer(input: []const u8, expect: []const u8) !void { var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); const arena = &arena_allocator.allocator; defer arena_allocator.deinit(); var it: Tokenizer = .{ .bytes = input }; var buffer = std.ArrayList(u8).init(arena); var resolve_buf = std.ArrayList(u8).init(arena); var i: usize = 0; while (it.next()) |token| { if (i != 0) try buffer.appendSlice("\n"); switch (token) { .target, .prereq => |bytes| { try buffer.appendSlice(@tagName(token)); try buffer.appendSlice(" = {"); for (bytes) |b| { try buffer.append(printable_char_tab[b]); } try buffer.appendSlice("}"); }, .target_must_resolve => { try buffer.appendSlice("target = {"); try token.resolve(resolve_buf.writer()); for (resolve_buf.items) |b| { try buffer.append(printable_char_tab[b]); } resolve_buf.items.len = 0; try buffer.appendSlice("}"); }, else => { try buffer.appendSlice("ERROR: "); try token.printError(buffer.outStream()); break; }, } i += 1; } if (std.mem.eql(u8, expect, buffer.items)) { testing.expect(true); return; } const out = std.io.getStdErr().writer(); try out.writeAll("\n"); try printSection(out, "<<<< input", input); try printSection(out, "==== expect", expect); try printSection(out, ">>>> got", buffer.items); try printRuler(out); testing.expect(false); } fn printSection(out: anytype, label: []const u8, bytes: []const u8) !void { try printLabel(out, label, bytes); try hexDump(out, bytes); try printRuler(out); try out.writeAll(bytes); try out.writeAll("\n"); } fn printLabel(out: anytype, label: []const u8, bytes: []const u8) !void { var buf: [80]u8 = undefined; var text = try std.fmt.bufPrint(buf[0..], "{s} {d} bytes ", .{ label, bytes.len }); try out.writeAll(text); var i: usize = text.len; const end = 79; while (i < 79) : (i += 1) { try out.writeAll(&[_]u8{label[0]}); } try out.writeAll("\n"); } fn printRuler(out: anytype) !void { var i: usize = 0; const end = 79; while (i < 79) : (i += 1) { try out.writeAll("-"); } try out.writeAll("\n"); } fn hexDump(out: anytype, bytes: []const u8) !void { const n16 = bytes.len >> 4; var line: usize = 0; var offset: usize = 0; while (line < n16) : (line += 1) { try hexDump16(out, offset, bytes[offset .. offset + 16]); offset += 16; } const n = bytes.len & 0x0f; if (n > 0) { try printDecValue(out, offset, 8); try out.writeAll(":"); try out.writeAll(" "); var end1 = std.math.min(offset + n, offset + 8); for (bytes[offset..end1]) |b| { try out.writeAll(" "); try printHexValue(out, b, 2); } var end2 = offset + n; if (end2 > end1) { try out.writeAll(" "); for (bytes[end1..end2]) |b| { try out.writeAll(" "); try printHexValue(out, b, 2); } } const short = 16 - n; var i: usize = 0; while (i < short) : (i += 1) { try out.writeAll(" "); } if (end2 > end1) { try out.writeAll(" |"); } else { try out.writeAll(" |"); } try printCharValues(out, bytes[offset..end2]); try out.writeAll("|\n"); offset += n; } try printDecValue(out, offset, 8); try out.writeAll(":"); try out.writeAll("\n"); } fn hexDump16(out: anytype, offset: usize, bytes: []const u8) !void { try printDecValue(out, offset, 8); try out.writeAll(":"); try out.writeAll(" "); for (bytes[0..8]) |b| { try out.writeAll(" "); try printHexValue(out, b, 2); } try out.writeAll(" "); for (bytes[8..16]) |b| { try out.writeAll(" "); try printHexValue(out, b, 2); } try out.writeAll(" |"); try printCharValues(out, bytes); try out.writeAll("|\n"); } fn printDecValue(out: anytype, value: u64, width: u8) !void { var buffer: [20]u8 = undefined; const len = std.fmt.formatIntBuf(buffer[0..], value, 10, false, .{ .width = width, .fill = '0' }); try out.writeAll(buffer[0..len]); } fn printHexValue(out: anytype, value: u64, width: u8) !void { var buffer: [16]u8 = undefined; const len = std.fmt.formatIntBuf(buffer[0..], value, 16, false, .{ .width = width, .fill = '0' }); try out.writeAll(buffer[0..len]); } fn printCharValues(out: anytype, bytes: []const u8) !void { for (bytes) |b| { try out.writeAll(&[_]u8{printable_char_tab[b]}); } } fn printUnderstandableChar(out: anytype, char: u8) !void { if (!std.ascii.isPrint(char) or char == ' ') { try out.print("\\x{X:0>2}", .{char}); } else { try out.print("'{c}'", .{printable_char_tab[char]}); } } // zig fmt: off const printable_char_tab: [256]u8 = ( "................................ !\"#$%&'()*+,-./0123456789:;<=>?" ++ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~." ++ "................................................................" ++ "................................................................" ).*;
src/DepTokenizer.zig
const std = @import("std"); const parser = @import("parser.zig"); const compiler = @import("main.zig"); const AstNode = parser.AstTree.AstNode; const Function = parser.Function; const ExprList = parser.ExprList; const CodeGenerator = @This(); const Asm = @import("asm.zig"); const Error = error{ InvalidExpression, } || std.os.WriteError; asm_: Asm, label_count: usize = 0, pub fn init(file: []const u8) !CodeGenerator { const asm_printer = try Asm.init(file); return CodeGenerator{ .asm_ = asm_printer }; } pub fn deinit(self: *CodeGenerator) void { self.asm_.deinit(); } pub fn codegen(self: *CodeGenerator, fn_nodes: Function) Error!void { try self.asmPrologue(fn_nodes.stack_size); // Traverse forwards. var it = fn_nodes.body.iterator(); while (it.next()) |node| { try self.genStmts(node); } try self.asmEpilogue(); } fn incLabelCount(self: *CodeGenerator) usize { self.label_count += 1; return self.label_count; } fn genStmts(self: *CodeGenerator, node: *const AstNode) Error!void { if (node.kind == .NK_LOOP) { const num = self.incLabelCount(); const loop = node.value.loop; if (loop.init) |init_stmt| { try self.genStmts(init_stmt); } var begin_label_buf: [16]u8 = undefined; const begin_label = try std.fmt.bufPrint(&begin_label_buf, ".L.begin.{d}", .{num}); try self.asm_.label(begin_label); var end_label_buf: [16]u8 = undefined; const end_label = try std.fmt.bufPrint(&end_label_buf, ".L.end_loop.{d}", .{num}); if (loop.condition) |condition| { try self.generateAsm(condition); //if condition is false jum to end try self.asm_.cmp(.immediate_constant, 0, "%rax"); try self.asm_.jcc(.equal, end_label); } try self.genStmts(loop.body); if (loop.increment) |increment| { try self.generateAsm(increment); } try self.asm_.jmp(begin_label); try self.asm_.label(end_label); return; } if (node.kind == .NK_IF) { const label_num = self.incLabelCount(); const if_statement = node.value.if_statement; try self.generateAsm(if_statement.if_expr); try self.asm_.cmp(.immediate_constant, 0, "%rax"); var else_label_buf: [16]u8 = undefined; const else_label = try std.fmt.bufPrint(&else_label_buf, ".L.else.{d}", .{label_num}); var end_label_buf: [16]u8 = undefined; const end_label = try std.fmt.bufPrint(&end_label_buf, ".L.end_if.{d}", .{label_num}); //if rax == 0 means if expr is false so jump to else branch try self.asm_.jcc(.equal, else_label); try self.genStmts(if_statement.then_branch); try self.asm_.jmp(end_label); try self.asm_.label(else_label); if (if_statement.else_branch) |else_branch| { try self.genStmts(else_branch); } try self.asm_.label(end_label); return; } if (node.kind == .NK_BLOCK) { //Traverse forwards. //the data for the block is the block field of the Value union var it = node.value.block.iterator(); while (it.next()) |block| { try self.genStmts(block); } return; } if (node.kind == .NK_RETURN) { try self.generateAsm(node.rhs.?); try self.asm_.jmp(".L.exit_main"); return; } if (node.kind == .NK_EXPR_STMT) { try self.generateAsm(node.rhs.?); return; } reportError(node.token, "invalid statement", .{}); } // Generate code for a given node. fn generateAsm(self: *CodeGenerator, node: *const AstNode) Error!void { if (node.kind == .NK_DEREF) { try self.generateAsm(node.rhs.?); try self.asm_.mov(.register, "(%rax)", "%rax"); return; } if (node.kind == .NK_ADDR) { try self.genAbsoluteAddress(node.rhs.?); return; } //since these nodes are terminal nodes there are no other nodes on either sides of the tree //so we must return after generating code for them. These serve as the terminating condition //of the recursive descent if (node.kind == .NK_NUM) { try self.asm_.mov(.immediate_constant, node.value.number, "%rax"); return; } if (node.kind == .NK_NEG) { //recurse on the side of the tree were the nodes are try self.generateAsm(node.rhs.?); try self.asm_.neg("%rax"); return; } if (node.kind == .NK_VAR) { try self.genAbsoluteAddress(node); try self.asm_.mov(.register, "(%rax)", "%rax"); return; } if (node.kind == .NK_ASSIGN) { try self.genAbsoluteAddress(node.lhs.?); try self.asm_.push("%rax"); try self.generateAsm(node.rhs.?); try self.asm_.pop("%rdi"); try self.asm_.mov(.register, "%rax", "(%rdi)"); return; } if (node.kind == .NK_RETURN) { try self.generateAsm(node.rhs.?); } try self.generateAsm(node.rhs.?); try self.asm_.push("%rax"); try self.generateAsm(node.lhs.?); try self.asm_.pop("%rdi"); switch (node.kind) { .NK_ADD => try self.asm_.add("%rdi", "%rax"), .NK_SUB => try self.asm_.sub(.register, "%rdi", "%rax"), .NK_MUL => try self.asm_.imul("%rdi", "%rax"), .NK_DIV => try self.asm_.idiv("%rdi"), .NK_EQ, .NK_NE, .NK_LT, .NK_LE, .NK_GE, .NK_GT => { try self.asm_.cmp(.register, "%rdi", "%rax"); if (node.kind == .NK_EQ) { try self.asm_.set(.equal, "%al"); } else if (node.kind == .NK_NE) { try self.asm_.set(.not_equal, "%al"); } else if (node.kind == .NK_LT) { try self.asm_.set(.less_than, "%al"); } else if (node.kind == .NK_LE) { try self.asm_.set(.less_than_equal, "%al"); } else if (node.kind == .NK_GT) { try self.asm_.set(.greater_than, "%al"); } else if (node.kind == .NK_GE) { try self.asm_.set(.greater_than_equal, "%al"); } try self.asm_.movzb("%al", "%rax"); }, else => { reportError(node.token, "invalid expression", .{}); return error.InvalidExpression; }, } } fn asmPrologue(self: *CodeGenerator, stack_size: usize) Error!void { // Prologue try self.asm_.comment("global main entry point "); try self.asm_.labelFunction("main"); try self.asm_.comment("asm prologue"); try self.asm_.push("%rbp"); try self.asm_.mov(.register, "%rsp", "%rbp"); try self.asm_.sub(.immediate_constant, stack_size, "%rsp"); try self.asm_.comment("prologue end"); } fn asmEpilogue(self: *CodeGenerator) Error!void { try self.asm_.comment("asm epilogue"); try self.asm_.label(".L.exit_main"); try self.asm_.mov(.register, "%rbp", "%rsp"); try self.asm_.pop("%rbp"); try self.asm_.ret(); } // Compute the absolute address of a given node. // It's an error if a given node does not reside in memory. fn genAbsoluteAddress(self: *CodeGenerator, node: *const AstNode) Error!void { if (node.kind == .NK_VAR) { try self.asm_.lea(node.value.identifier.rbp_offset, "%rbp", "%rax"); return; } if (node.kind == .NK_DEREF) { try self.generateAsm(node.rhs.?); return; } reportError(node.token, "not an lvalue", .{}); } fn reportError(token: parser.Token, comptime msg: []const u8, args: anytype) noreturn { const error_msg = "\nError '{[token_name]s}' in '{[token_stream]s}' at {[token_location]d}"; const identifier_name = token.value.ident_name; std.log.err(error_msg, .{ .token_name = identifier_name, .token_stream = compiler.TOKEN_STREAM, .token_location = token.location, }); const location_offset = 13; const token_location = location_offset + identifier_name.len + token.location; //add empty spaces till the character where the error starts std.debug.print("{[spaces]s:>[width]}", .{ .spaces = " ", .width = token_location }); const format_msg = "^ " ++ msg ++ "\n"; std.debug.print(format_msg, args); std.process.exit(4); }
src/code_generator.zig
const std = @import("std"); const mem = std.mem; const Allocator = mem.Allocator; pub fn isZigPrimitiveType(name: []const u8) bool { if (name.len > 1 and (name[0] == 'u' or name[0] == 'i')) { for (name[1..]) |c| { switch (c) { '0'...'9' => {}, else => break, } } else return true; } const primitives = [_][]const u8{ "void", "comptime_float", "comptime_int", "bool", "isize", "usize", "f16", "f32", "f64", "f128", "c_longdouble", "noreturn", "type", "anyerror", "c_short", "c_ushort", "c_int", "c_uint", "c_long", "c_ulong", "c_longlong", "c_ulonglong", // Removed in stage 2 in https://github.com/ziglang/zig/commit/05cf44933d753f7a5a53ab289ea60fd43761de57, // but these are still invalid identifiers in stage 1. "undefined", "true", "false", "null", }; for (primitives) |reserved| { if (mem.eql(u8, reserved, name)) { return true; } } return false; } pub fn writeIdentifier(out: anytype, id: []const u8) !void { // https://github.com/ziglang/zig/issues/2897 if (isZigPrimitiveType(id)) { try out.print("@\"{}\"", .{std.zig.fmtEscapes(id)}); } else { try out.print("{}", .{std.zig.fmtId(id)}); } } pub const CaseStyle = enum { snake, screaming_snake, title, camel, }; pub const SegmentIterator = struct { text: []const u8, offset: usize, pub fn init(text: []const u8) SegmentIterator { return .{ .text = text, .offset = 0, }; } fn nextBoundary(self: SegmentIterator) usize { var i = self.offset + 1; while (true) { if (i == self.text.len or self.text[i] == '_') { return i; } const prev_lower = std.ascii.isLower(self.text[i - 1]); const next_lower = std.ascii.isLower(self.text[i]); if (prev_lower and !next_lower) { return i; } else if (i != self.offset + 1 and !prev_lower and next_lower) { return i - 1; } i += 1; } } pub fn next(self: *SegmentIterator) ?[]const u8 { while (self.offset < self.text.len and self.text[self.offset] == '_') { self.offset += 1; } if (self.offset == self.text.len) { return null; } const end = self.nextBoundary(); const word = self.text[self.offset..end]; self.offset = end; return word; } pub fn rest(self: SegmentIterator) []const u8 { if (self.offset >= self.text.len) { return &[_]u8{}; } else { return self.text[self.offset..]; } } }; pub const IdRenderer = struct { tags: []const []const u8, text_cache: std.ArrayList(u8), pub fn init(allocator: *Allocator, tags: []const []const u8) IdRenderer { return .{ .tags = tags, .text_cache = std.ArrayList(u8).init(allocator), }; } pub fn deinit(self: IdRenderer) void { self.text_cache.deinit(); } fn renderSnake(self: *IdRenderer, screaming: bool, id: []const u8, tag: ?[]const u8) !void { var it = SegmentIterator.init(id); var first = true; const transform = if (screaming) std.ascii.toUpper else std.ascii.toLower; while (it.next()) |segment| { if (first) { first = false; } else { try self.text_cache.append('_'); } for (segment) |c| { try self.text_cache.append(transform(c)); } } if (tag) |name| { try self.text_cache.append('_'); for (name) |c| { try self.text_cache.append(transform(c)); } } } fn renderCamel(self: *IdRenderer, title: bool, id: []const u8, tag: ?[]const u8) !void { var it = SegmentIterator.init(id); var lower_first = !title; while (it.next()) |segment| { var i: usize = 0; while (i < segment.len and std.ascii.isDigit(segment[i])) { try self.text_cache.append(segment[i]); i += 1; } if (i == segment.len) { continue; } if (i == 0 and lower_first) { try self.text_cache.append(std.ascii.toLower(segment[i])); } else { try self.text_cache.append(std.ascii.toUpper(segment[i])); } lower_first = false; for (segment[i + 1 ..]) |c| { try self.text_cache.append(std.ascii.toLower(c)); } } if (tag) |name| { try self.text_cache.appendSlice(name); } } pub fn renderFmt(self: *IdRenderer, out: anytype, comptime fmt: []const u8, args: anytype) !void { self.text_cache.items.len = 0; try std.fmt.format(self.text_cache.writer(), fmt, args); try writeIdentifier(out, self.text_cache.items); } pub fn renderWithCase(self: *IdRenderer, out: anytype, case_style: CaseStyle, id: []const u8) !void { const tag = self.getAuthorTag(id); // The trailing underscore doesn't need to be removed here as its removed by the SegmentIterator. const adjusted_id = if (tag) |name| id[0 .. id.len - name.len] else id; self.text_cache.items.len = 0; switch (case_style) { .snake => try self.renderSnake(false, adjusted_id, tag), .screaming_snake => try self.renderSnake(true, adjusted_id, tag), .title => try self.renderCamel(true, adjusted_id, tag), .camel => try self.renderCamel(false, adjusted_id, tag), } try writeIdentifier(out, self.text_cache.items); } pub fn getAuthorTag(self: IdRenderer, id: []const u8) ?[]const u8 { for (self.tags) |tag| { if (mem.endsWith(u8, id, tag)) { return tag; } } return null; } pub fn stripAuthorTag(self: IdRenderer, id: []const u8) []const u8 { if (self.getAuthorTag(id)) |tag| { return mem.trimRight(u8, id[0 .. id.len - tag.len], "_"); } return id; } };
generator/id_render.zig
const std = @import("std"); const zzz = @import("zzz"); pub const default_root = "src/main.zig"; pub const ZChildIterator = struct { val: ?*zzz.ZNode, pub fn next(self: *ZChildIterator) ?*zzz.ZNode { return if (self.val) |node| blk: { self.val = node.sibling; break :blk node; } else null; } pub fn init(node: *zzz.ZNode) ZChildIterator { return ZChildIterator{ .val = node.child, }; } }; pub fn zFindChild(node: *zzz.ZNode, key: []const u8) ?*zzz.ZNode { var it = ZChildIterator.init(node); return while (it.next()) |child| { switch (child.value) { .String => |str| if (std.mem.eql(u8, str, key)) break child, else => continue, } } else null; } pub fn zGetString(node: *const zzz.ZNode) ![]const u8 { return switch (node.value) { .String => |str| str, else => { return error.NotAString; }, }; } pub fn zFindString(parent: *zzz.ZNode, key: []const u8) !?[]const u8 { return if (zFindChild(parent, key)) |node| if (node.child) |child| try zGetString(child) else null else null; } pub fn zPutKeyString(tree: *zzz.ZTree(1, 1000), parent: *zzz.ZNode, key: []const u8, value: []const u8) !void { var node = try tree.addNode(parent, .{ .String = key }); _ = try tree.addNode(node, .{ .String = value }); } pub const UserRepoResult = struct { user: []const u8, repo: []const u8, }; pub fn parseUserRepo(str: []const u8) !UserRepoResult { if (std.mem.count(u8, str, "/") != 1) { std.log.err("need to have a single '/' in {s}", .{str}); return error.Explained; } var it = std.mem.tokenize(u8, str, "/"); return UserRepoResult{ .user = it.next().?, .repo = it.next().?, }; } /// trim 'zig-' prefix and '-zig' or '.zig' suffixes from a name pub fn normalizeName(name: []const u8) ![]const u8 { const prefix = "zig-"; const dot_suffix = ".zig"; const dash_suffix = "-zig"; const begin = if (std.mem.startsWith(u8, name, prefix)) prefix.len else 0; const end = if (std.mem.endsWith(u8, name, dot_suffix)) name.len - dot_suffix.len else if (std.mem.endsWith(u8, name, dash_suffix)) name.len - dash_suffix.len else name.len; if (begin > end) return error.Overlap else if (begin == end) return error.Empty; return name[begin..end]; } test "normalize zig-zig" { try std.testing.expectError(error.Overlap, normalizeName("zig-zig")); } test "normalize zig-.zig" { try std.testing.expectError(error.Empty, normalizeName("zig-.zig")); } test "normalize SDL.zig" { try std.testing.expectEqualStrings("SDL", try normalizeName("SDL.zig")); } test "normalize zgl" { try std.testing.expectEqualStrings("zgl", try normalizeName("zgl")); } test "normalize zig-args" { try std.testing.expectEqualStrings("args", try normalizeName("zig-args")); } test "normalize vulkan-zig" { try std.testing.expectEqualStrings("vulkan", try normalizeName("vulkan-zig")); } test "normalize known-folders" { try std.testing.expectEqualStrings("known-folders", try normalizeName("known-folders")); }
src/common.zig
const std = @import("std"); const reg = @import("registry.zig"); const xml = @import("../xml.zig"); const renderRegistry = @import("render.zig").render; const parseXml = @import("parse.zig").parseXml; const IdRenderer = @import("../id_render.zig").IdRenderer; const mem = std.mem; const Allocator = mem.Allocator; const FeatureLevel = reg.FeatureLevel; const EnumFieldMerger = struct { const EnumExtensionMap = std.StringArrayHashMap(std.ArrayListUnmanaged(reg.Enum.Field)); const FieldSet = std.StringArrayHashMap(void); gpa: *Allocator, reg_arena: *Allocator, registry: *reg.Registry, enum_extensions: EnumExtensionMap, field_set: FieldSet, fn init(gpa: *Allocator, reg_arena: *Allocator, registry: *reg.Registry) EnumFieldMerger { return .{ .gpa = gpa, .reg_arena = reg_arena, .registry = registry, .enum_extensions = EnumExtensionMap.init(gpa), .field_set = FieldSet.init(gpa), }; } fn deinit(self: *EnumFieldMerger) void { for (self.enum_extensions.values()) |*value| { value.deinit(self.gpa); } self.field_set.deinit(); self.enum_extensions.deinit(); } fn putEnumExtension(self: *EnumFieldMerger, enum_name: []const u8, field: reg.Enum.Field) !void { const res = try self.enum_extensions.getOrPut(enum_name); if (!res.found_existing) { res.value_ptr.* = std.ArrayListUnmanaged(reg.Enum.Field){}; } try res.value_ptr.append(self.gpa, field); } fn addRequires(self: *EnumFieldMerger, reqs: []const reg.Require) !void { for (reqs) |req| { for (req.extends) |enum_ext| { try self.putEnumExtension(enum_ext.extends, enum_ext.field); } } } fn mergeEnumFields(self: *EnumFieldMerger, name: []const u8, base_enum: *reg.Enum) !void { // If there are no extensions for this enum, assume its valid. const extensions = self.enum_extensions.get(name) orelse return; self.field_set.clearRetainingCapacity(); const n_fields_upper_bound = base_enum.fields.len + extensions.items.len; const new_fields = try self.reg_arena.alloc(reg.Enum.Field, n_fields_upper_bound); var i: usize = 0; for (base_enum.fields) |field| { const res = try self.field_set.getOrPut(field.name); if (!res.found_existing) { new_fields[i] = field; i += 1; } } // Assume that if a field name clobbers, the value is the same for (extensions.items) |field| { const res = try self.field_set.getOrPut(field.name); if (!res.found_existing) { new_fields[i] = field; i += 1; } } // Existing base_enum.fields was allocatued by `self.reg_arena`, so // it gets cleaned up whenever that is deinited. base_enum.fields = self.reg_arena.shrink(new_fields, i); } fn merge(self: *EnumFieldMerger) !void { for (self.registry.features) |feature| { try self.addRequires(feature.requires); } for (self.registry.extensions) |ext| { try self.addRequires(ext.requires); } // Merge all the enum fields. // Assume that all keys of enum_extensions appear in `self.registry.decls` for (self.registry.decls) |*decl| { if (decl.decl_type == .enumeration) { try self.mergeEnumFields(decl.name, &decl.decl_type.enumeration); } } } }; pub const Generator = struct { gpa: *Allocator, reg_arena: std.heap.ArenaAllocator, registry: reg.Registry, id_renderer: IdRenderer, fn init(allocator: *Allocator, spec: *xml.Element) !Generator { const result = try parseXml(allocator, spec); const tags = try allocator.alloc([]const u8, result.registry.tags.len); for (tags) |*tag, i| tag.* = result.registry.tags[i].name; return Generator{ .gpa = allocator, .reg_arena = result.arena, .registry = result.registry, .id_renderer = IdRenderer.init(allocator, tags), }; } fn deinit(self: Generator) void { self.gpa.free(self.id_renderer.tags); self.reg_arena.deinit(); } fn stripFlagBits(self: Generator, name: []const u8) []const u8 { const tagless = self.id_renderer.stripAuthorTag(name); return tagless[0 .. tagless.len - "FlagBits".len]; } fn stripFlags(self: Generator, name: []const u8) []const u8 { const tagless = self.id_renderer.stripAuthorTag(name); return tagless[0 .. tagless.len - "Flags".len]; } // Solve `registry.declarations` according to `registry.extensions` and `registry.features`. fn mergeEnumFields(self: *Generator) !void { var merger = EnumFieldMerger.init(self.gpa, &self.reg_arena.allocator, &self.registry); defer merger.deinit(); try merger.merge(); } // https://github.com/KhronosGroup/Vulkan-Docs/pull/1556 fn fixupBitFlags(self: *Generator) !void { var seen_bits = std.StringArrayHashMap(void).init(&self.reg_arena.allocator); defer seen_bits.deinit(); for (self.registry.decls) |decl| { const bitmask = switch (decl.decl_type) { .bitmask => |bm| bm, else => continue, }; if (bitmask.bits_enum) |bits_enum| { try seen_bits.put(bits_enum, {}); } } var i: usize = 0; for (self.registry.decls) |decl| { switch (decl.decl_type) { .enumeration => |e| { if (e.is_bitmask and seen_bits.get(decl.name) == null) continue; }, else => {}, } self.registry.decls[i] = decl; i += 1; } self.registry.decls.len = i; } fn render(self: *Generator, writer: anytype) !void { try renderRegistry(writer, &self.reg_arena.allocator, &self.registry, &self.id_renderer); } }; /// Main function for generating the Vulkan bindings. vk.xml is to be provided via `spec_xml`, /// and the resulting binding is written to `writer`. `allocator` will be used to allocate temporary /// internal datastructures - mostly via an ArenaAllocator, but sometimes a hashmap uses this allocator /// directly. pub fn generate(allocator: *Allocator, spec_xml: []const u8, writer: anytype) !void { const spec = try xml.parse(allocator, spec_xml); defer spec.deinit(); var gen = try Generator.init(allocator, spec.root); defer gen.deinit(); try gen.mergeEnumFields(); try gen.fixupBitFlags(); try gen.render(writer); }
generator/vulkan/generator.zig
const wlr = @import("../wlroots.zig"); const wl = @import("wayland").server.wl; pub const OutputManagerV1 = extern struct { server: *wl.Server, global: *wl.Global, resources: wl.list.Head(wl.Resource, null), heads: wl.list.Head(OutputHeadV1, "link"), serial: u32, current_configuration_dirty: bool, events: extern struct { apply: wl.Signal(*OutputConfigurationV1), @"test": wl.Signal(*OutputConfigurationV1), destroy: wl.Signal(*OutputManagerV1), }, server_destroy: wl.Listener(*wl.Server), data: usize, extern fn wlr_output_manager_v1_create(server: *wl.Server) ?*OutputManagerV1; pub fn create(server: *wl.Server) !*OutputManagerV1 { return wlr_output_manager_v1_create(server) orelse error.OutOfMemory; } extern fn wlr_output_manager_v1_set_configuration(manager: *OutputManagerV1, config: *OutputConfigurationV1) void; pub const setConfiguration = wlr_output_manager_v1_set_configuration; }; pub const OutputHeadV1 = extern struct { pub const State = extern struct { output: *wlr.Output, enabled: bool, mode: ?*wlr.Output.Mode, custom_mode: extern struct { width: c_int, height: c_int, refresh: c_int, }, x: i32, y: i32, transform: wl.Output.Transform, scale: f64, }; state: State, manager: *OutputManagerV1, link: wl.list.Link, resources: wl.list.Head(wl.Resource, null), mode_resources: wl.list.Head(wl.Resource, null), output_destroy: wl.Listener(*wlr.Output), }; pub const OutputConfigurationV1 = extern struct { pub const Head = extern struct { state: OutputHeadV1.State, config: *OutputConfigurationV1, link: wl.list.Link, resource: ?*wl.Resource, output_destroy: wl.Listener(*wlr.Output), extern fn wlr_output_configuration_head_v1_create(config: *OutputConfigurationV1, output: *wlr.Output) ?*Head; pub fn create(config: *OutputConfigurationV1, output: *wlr.Output) !*Head { return wlr_output_configuration_head_v1_create(config, output) orelse error.OutOfMemory; } }; heads: wl.list.Head(Head, "link"), manager: *OutputManagerV1, serial: u32, finalized: bool, finished: bool, resource: ?*wl.Resource, extern fn wlr_output_configuration_v1_create() ?*OutputConfigurationV1; pub fn create() !*OutputConfigurationV1 { return wlr_output_configuration_v1_create() orelse error.OutOfMemory; } extern fn wlr_output_configuration_v1_destroy(config: *OutputConfigurationV1) void; pub const destroy = wlr_output_configuration_v1_destroy; extern fn wlr_output_configuration_v1_send_succeeded(config: *OutputConfigurationV1) void; pub const sendSucceeded = wlr_output_configuration_v1_send_succeeded; extern fn wlr_output_configuration_v1_send_failed(config: *OutputConfigurationV1) void; pub const sendFailed = wlr_output_configuration_v1_send_failed; };
src/types/output_management_v1.zig
const std = @import("std"); const assert = std.debug.assert; const warn = std.debug.warn; const mem = std.mem; pub const ModelData = struct { pub const VertexAttributeType = enum(u8) { Position = 0, Colour = 1, TextureCoordinates = 2, Normal = 3, BoneIndices = 4, BoneWeights = 5, Tangent = 6, }; // If bigger than 65536 then indices are 32-bit vertex_count: u32 = 0, // If zero then use non-indexed rendering index_count: u32 = 0, // See model file format.odt for attribute descriptions // See VertexAttributeType for attribute bit positions attributes_bitmap: u8 = 0, attributes_count: u32 = 0, interleaved: bool = false, vertex_data: ?[]const u32 = null, // These are used if interleaved == false positions: ?[]const f32 = null, // 3 per vertex colours: ?[]const u32 = null, // each u32 is a rgba8 packed colour tex_coords: ?[]const u32 = null, // each u32 is a u,v pair normals: ?[]const u32 = null, // each u32 is a packed normal bone_indices: ?[]const u32 = null, // each u32 is 4xu8 vertex_weights: ?[]const u32 = null, // each u32 is 4xu8 (normalised) tangents: ?[]const u32 = null, // same format as normals // These are used if interleaved == true vertex_size: u32 = 0, // in bytes // One or both of these will be null indices_u16: ?[]const u16 = null, indices_u32: ?[]const u32 = null, // See model file format.odt for the format of this data: material_count: u32 = 0, materials: ?[]u32 = null, bone_count: u32 = 0, bones: ?[]u8 = null, // This struct references (read-only) the data until delete is called (unless this function returns with an error) pub fn init(data: []align(4) const u8, allocator: *mem.Allocator) !ModelData { if (data.len < 7 * 4) { warn("ModelData.init: Data length is only {}\n", .{data.len}); return error.FileTooSmall; } if (data.len % 4 != 0) { return error.InvalidFileSize; } var model_data: ModelData = ModelData{}; const data_u32 = std.mem.bytesAsSlice(u32, data); const data_f32 = std.mem.bytesAsSlice(f32, data); if (data_u32[0] != 0xaaeecdbb) { warn("ModelData.init: Magic field incorrect. Value was {}\n", .{data_u32[0]}); return error.NotAModelFile; } model_data.attributes_bitmap = @intCast(u8, data_u32[2] & 0x7f); // Number of bits set model_data.attributes_count = @popCount(u8, model_data.attributes_bitmap); if (model_data.attributes_bitmap == 0) { return error.NoVertexDataAttributes; } model_data.index_count = data_u32[1]; model_data.interleaved = data_u32[3] != 0; model_data.vertex_count = data_u32[4]; if (model_data.vertex_count == 0) { return error.NoVertices; } // offset into data_u32 var offset: u32 = 5; if (model_data.interleaved) { if (model_data.attributes_bitmap & (1 << @enumToInt(VertexAttributeType.Position)) != 0) { model_data.vertex_size = 3 * 4; } model_data.vertex_size += @popCount(u8, model_data.attributes_bitmap >> 1) * 4; const vertex_data_size = model_data.vertex_count * model_data.vertex_size; model_data.vertex_data = data_u32[5..(5 + vertex_data_size)]; if (5 + vertex_data_size > data_u32.len) { return error.FileTooSmall; } offset += vertex_data_size; } else { var attrib_i: u3 = 0; while (attrib_i < 7) : (attrib_i += 1) { const attrib_bit_set = (model_data.attributes_bitmap & (@as(u8, 1) << attrib_i)) != 0; if (attrib_bit_set) { if (attrib_i == @enumToInt(VertexAttributeType.Position)) { if (offset + model_data.vertex_count * 3 > data_u32.len) { return error.FileTooSmall; } } else { if (offset + model_data.vertex_count > data_u32.len) { return error.FileTooSmall; } } if (attrib_i == @enumToInt(VertexAttributeType.Position)) { model_data.positions = data_f32[offset..(offset + model_data.vertex_count * 3)]; } else { const a = data_u32[offset..(offset + model_data.vertex_count)]; if (attrib_i == @enumToInt(VertexAttributeType.Colour)) { model_data.colours = a; } else if (attrib_i == @enumToInt(VertexAttributeType.TextureCoordinates)) { model_data.tex_coords = a; } else if (attrib_i == @enumToInt(VertexAttributeType.Normal)) { model_data.normals = a; } else if (attrib_i == @enumToInt(VertexAttributeType.BoneIndices)) { model_data.bone_indices = a; } else if (attrib_i == @enumToInt(VertexAttributeType.BoneWeights)) { model_data.vertex_weights = a; } else if (attrib_i == @enumToInt(VertexAttributeType.Tangent)) { model_data.tangents = a; } } if (attrib_i == @enumToInt(VertexAttributeType.Position)) { offset += model_data.vertex_count * 3; } else { offset += model_data.vertex_count; } } } model_data.vertex_data = data_u32[5..offset]; const has_bone_indices = (model_data.attributes_bitmap & (1 << @enumToInt(VertexAttributeType.BoneIndices))) != 0; const has_bone_weights = (model_data.attributes_bitmap & (1 << @enumToInt(VertexAttributeType.BoneWeights))) != 0; if (has_bone_indices != has_bone_weights and (has_bone_indices or has_bone_weights)) { return error.VertexWeightsRequireBoneIndices; } } // index data if (model_data.index_count == 0) { model_data.indices_u32 = null; model_data.indices_u16 = null; } else { if (model_data.vertex_count > 65536) { // large indices if (offset + model_data.index_count > data_u32.len) { return error.FileTooSmall; } model_data.indices_u32 = data_u32[offset..(offset + model_data.index_count)]; offset += model_data.index_count; } else { // small indices (if number of indices is odd then an extra u16 is added to the end of the data) if (offset + (model_data.index_count + 1) / 2 > data_u32.len) { return error.FileTooSmall; } model_data.indices_u16 = std.mem.bytesAsSlice(u16, data)[(offset * 2)..(offset * 2 + model_data.index_count)]; offset += (model_data.index_count + 1) / 2; } } // Materials if (offset + 1 > data_u32.len) { return error.FileTooSmall; } model_data.material_count = data_u32[offset]; offset += 1; if (model_data.material_count > 32) { warn("ModelData.init: Material count field invalid. Value was {}\n", .{model_data.material_count}); return error.TooManyMaterials; } if (offset + model_data.material_count * 3 > data_u32.len) { return error.FileTooSmall; } const offsetAtMaterialsListStart = offset; var i: u32 = 0; while (i < model_data.material_count) { if (offset + 3 > data_u32.len) { return error.FileTooSmall; } const first = data_u32[offset]; const n = data_u32[offset + 1]; offset += 2; if (model_data.index_count == 0) { if (first + n > model_data.vertex_count) { return error.InvalidModelMaterial; } } else { if (first + n > model_data.index_count) { return error.InvalidModelMaterial; } } // Diffuse colour offset += 3; const stringLen = data_u32[offset] & 0xff; if (offset + (1 + stringLen + 3) / 4 > data_u32.len) { return error.FileTooSmall; } offset += (1 + stringLen + 3) / 4; i += 1; } model_data.materials = try allocator.alloc(u32, offset - offsetAtMaterialsListStart); errdefer allocator.free(model_data.materials.?); mem.copy(u32, model_data.materials.?, data_u32[offsetAtMaterialsListStart..offset]); // Bones if (offset + 1 > data_u32.len) { return error.FileTooSmall; } model_data.bone_count = data_u32[offset]; offset += 1; if (model_data.bone_count != 0) { if (offset + model_data.bone_count * 8 > data_u32.len) { return error.FileTooSmall; } const offsetAtBonesListStart = offset; i = 0; while (i < model_data.bone_count) { if (offset + 8 > data_u32.len) { return error.FileTooSmall; } const parent = data_u32[offset + 6]; if (parent >= model_data.bone_count and @bitCast(i32, parent) >= 0) { return error.InvalidBoneParentIndex; } offset += 7; const stringLen = data_u32[offset] & 0xff; if (offset + (1 + stringLen + 3) / 4 > data_u32.len) { return error.FileTooSmall; } offset += (1 + stringLen + 3) / 4; i += 1; } model_data.bones = try allocator.alloc(u8, (offset - offsetAtBonesListStart) * 4); errdefer allocator.free(model_data.bones.?); mem.copy(u8, model_data.bones.?, std.mem.sliceAsBytes(data_u32[offsetAtBonesListStart..offset])); } return model_data; } // utf8 string is u8 length (bytes) followed by string data pub fn getMaterial(self: *ModelData, i: u32, first_index: *u32, index_vertex_count: *u32, default_colour: *([3]f32), utf8_name: *([]const u8)) !void { if (i >= self.material_count) { return error.NoSuchMaterial; } var j: u32 = 0; var offset: u32 = 0; while (j < self.material_count and j <= i) { const stringLen = @intCast(u8, self.materials.?[offset + 5] & 0xff); default_colour.*[0] = @bitCast(f32, self.materials.?[offset + 2]); default_colour.*[1] = @bitCast(f32, self.materials.?[offset + 3]); default_colour.*[2] = @bitCast(f32, self.materials.?[offset + 4]); if (j == i) { first_index.* = self.materials.?[offset]; index_vertex_count.* = self.materials.?[offset + 1]; offset += 2; utf8_name.* = std.mem.sliceAsBytes(self.materials.?)[(offset * 4 + 1)..(offset * 4 + 1 + stringLen)]; return; } offset += 5 + (1 + stringLen + 3) / 4; j += 1; } unreachable; } // Sets bone_data_offset to offset of next bone in array // Stop iterating when bone_data_offset >= bones.len pub fn getBoneName(self: ModelData, bone_data_offset: *u32) ![]const u8 { if (self.bone_count == 0 or bone_data_offset.* + 7 * 4 > self.bones.?.len) { std.testing.expect(false); return error.IndexOutOfBounds; } bone_data_offset.* += 7 * 4; const len = self.bones.?[bone_data_offset.*]; bone_data_offset.* += 1; const offset = bone_data_offset.*; bone_data_offset.* += len; if (bone_data_offset.* % 4 != 0) { bone_data_offset.* += 4 - (bone_data_offset.* % 4); } return self.bones.?[offset .. offset + len]; } // Does not delete the data that was passed to init() pub fn free(self: *ModelData, allocator: *mem.Allocator) void { if (self.materials != null) { allocator.free(self.materials.?); } if (self.bones != null) { allocator.free(self.bones.?); } self.vertex_data = null; self.indices_u16 = null; self.indices_u32 = null; } }; test "Model import test (non-interleaved)" { const testData = [_]u32{ 0xaaeecdbb, 1, 63, 0, 1, 0, 0, 0, 0xffffffff, 0x80008000, 0, 1 << 24, 255 << 24, 0, 1, 0, 1, 33, 33, 33, 0x0043402, 1, 2, 3, 4, 0, 0, 0, 0xffffffff, 0x00000601, 0, 0, 0, 0, 0, }; var buf: [1024]u8 = undefined; const a = &std.heap.FixedBufferAllocator.init(&buf).allocator; var m: ModelData = try ModelData.init(std.mem.sliceAsBytes(testData[0..]), a); defer m.free(a); std.testing.expect(m.vertex_count == 1); std.testing.expect(m.index_count == 1); std.testing.expect(m.positions.?.len == 3); std.testing.expect(m.colours.?.len == 1); std.testing.expect(m.tex_coords.?.len == 1); std.testing.expect(m.normals.?.len == 1); std.testing.expect(m.bone_indices.?.len == 1); std.testing.expect(m.vertex_weights.?.len == 1); std.testing.expect(m.indices_u16.?.len == 1); std.testing.expect(m.indices_u32 == null); std.testing.expect(m.interleaved == false); std.testing.expect(m.vertex_data.?.len == 8); std.testing.expect(m.material_count == 1); std.testing.expect(m.bone_count == 1); var first_index: u32 = undefined; var index_count: u32 = undefined; var utf8_name: []const u8 = undefined; var colour: [3]f32 = undefined; try m.getMaterial(0, &first_index, &index_count, &colour, &utf8_name); var bone_data_offset: u32 = 0; const bone_name = try m.getBoneName(&bone_data_offset); std.testing.expect(bone_name.len == 1 and bone_name[0] == 6); }
src/ModelFiles/ModelFiles.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const assert = std.debug.assert; const print = std.debug.print; const List = std.ArrayList; const Map = std.AutoHashMap; const ArrayMap = std.AutoArrayHashMap; const StrMap = std.StringHashMap; const BitSet = std.DynamicBitSet; const Str = []const u8; var gpa_impl = std.heap.GeneralPurposeAllocator(.{}){}; pub const gpa = &gpa_impl.allocator; pub fn streq(a: []const u8, b: []const u8) bool { return std.mem.eql(u8, a, b); } pub fn Counter(comptime K: type) type { return struct { counter: ArrayMap(K, usize), pub fn init(allocator: *Allocator) @This() { return .{ .counter = ArrayMap(K, usize).init(allocator) }; } pub fn deinit(self: *@This()) void { self.counter.deinit(); } pub fn add(self: *@This(), key: K) !void { var gop = try self.counter.getOrPut(key); if (gop.found_existing) { gop.value_ptr.* += 1; } else gop.value_ptr.* = 1; } pub fn addCount(self: *@This(), key: K, c: usize) !void { var gop = try self.counter.getOrPut(key); if (gop.found_existing) { gop.value_ptr.* += c; } else gop.value_ptr.* = c; } }; } pub fn toStrSlice(string: []const u8, delim: []const u8) ![][]const u8 { var list = List([]const u8).init(gpa); var it = std.mem.split(string, delim); while (it.next()) |line| { if (line.len == 0) continue; try list.append(line); } return list.toOwnedSlice(); } pub fn toIntSlice(comptime T: type, string: []const u8, delim: []const u8) ![]T { var list = List(T).init(gpa); var it = std.mem.split(string, delim); while (it.next()) |line| { if (line.len == 0) continue; try list.append(try std.fmt.parseInt(T, std.mem.trim(u8, line, "\n"), 10)); } return list.toOwnedSlice(); } pub fn parseInto(comptime T: type, string: []const u8, delim: []const u8) !T { const info = @typeInfo(T).Struct; var split = std.mem.split(string, delim); var item: T = undefined; inline for (info.fields) |field| { var s = split.next() orelse break; switch (@typeInfo(field.field_type)) { .Int => { @field(item, field.name) = std.fmt.parseInt(field.field_type, s, 10) catch |err| s[0]; }, .Float => { @field(item, field.name) = try std.fmt.parseFloat(field.field_type, s, 10); }, .Pointer => |p| { if (p.child != u8) @compileLog("unsupported type"); @field(item, field.name) = s; }, else => @compileError("unsupported type"), } } return item; } pub fn toSliceOf(comptime T: type, string: []const u8, delim: []const u8) ![]T { var list = List(T).init(gpa); // assume lines var it = std.mem.split(string, "\n"); while (it.next()) |line| { if (line.len == 0) continue; try list.append(try parseInto(T, line, delim)); } return list.toOwnedSlice(); }
2021/src/util.zig
const std = @import("std"); const bottom = @import("encoder.zig").BottomEncoder; const ByteEnum = @import("encoder.zig").ByteEnum; const mem = @import("zig-native-vector"); const help_text = @embedFile("help.txt"); pub const DecoderError = error{ invalid_input, } || std.mem.Allocator.Error; /// This struct is just a namespace for the decoder pub const BottomDecoder = struct { const decodeHash = GetDecodeHash(); pub fn decodeAlloc(str: []const u8, allocator: std.mem.Allocator) DecoderError![]u8 { var len = @maximum(std.math.divCeil(usize, str.len, bottom.max_expansion_per_byte) catch str.len, 40); var memory = try allocator.alloc(u8, (len - 1) * 2); errdefer allocator.free(memory); return decode(str, memory); } pub fn decode(str: []const u8, buffer: []u8) ![]u8 { var iter = std.mem.split(u8, str, "πŸ‘‰πŸ‘ˆ"); var index: usize = 0; while (iter.next()) |owo| { if (owo.len == 0) { break; } buffer[index] = decodeByte(owo) orelse return error.invalid_input; index += 1; } return buffer[0..index]; } const ListType = struct { @"0": []const u8, @"1": u8 }; fn GetDecodeHash() type { var list: [256]ListType = undefined; inline for (list) |*v, index| { v.* = getByte(index); } return std.ComptimeStringMap(u8, list); } fn getByte(comptime a: u8) ListType { @setEvalBranchQuota(10000000); comptime { var buffer: [40]u8 = std.mem.zeroes([40]u8); _ = bottom.encodeByte(a, &buffer); return .{ .@"0" = buffer[0..40], .@"1" = a }; } } pub fn decodeByte(byte: []const u8) ?u8 { var res: [40]u8 = comptime std.mem.zeroes([40]u8); var text = "πŸ‘‰πŸ‘ˆ"; if (byte.len > 40) return null; @memcpy(res[0..], byte.ptr, byte.len); // This is less than 40 always @memcpy(res[byte.len..].ptr, text, text.len); // There is always enough space var result = decodeHash.get(&res); return result; } }; test "decoder works" { if (@import("builtin").os.tag == .windows) { if (std.os.windows.kernel32.SetConsoleOutputCP(65001) == 0) { return error.console_not_support_utf8; } } const @"😈" = "πŸ’–πŸ’–,,,,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–πŸ₯Ί,,,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–πŸ₯Ί,,,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–βœ¨,πŸ‘‰πŸ‘ˆβœ¨βœ¨βœ¨,,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–βœ¨πŸ₯Ί,,,,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–βœ¨,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–βœ¨,,,,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–πŸ₯Ί,,,πŸ‘‰πŸ‘ˆπŸ’–πŸ’–πŸ‘‰πŸ‘ˆβœ¨βœ¨βœ¨,,,πŸ‘‰πŸ‘ˆ"; const res = try BottomDecoder.decodeAlloc(@"😈", std.testing.allocator); defer std.testing.allocator.free(res); try std.testing.expectEqualStrings("hello world!", res); } test "All bytes possible values are decodable" { var byte: u8 = @truncate(u8, 0); var buffer: [40]u8 = comptime std.mem.zeroes([40]u8); var encode: []u8 = undefined; var result: u8 = undefined; for (@as([256]u0, undefined)) |_, index| { byte = @truncate(u8, index); encode = bottom.encodeByte(byte, &buffer); result = BottomDecoder.decodeByte(encode[0 .. encode.len - 8]) orelse { std.log.err("Error", .{}); std.log.err("value of byte: {d} unexpected", .{byte}); std.log.err("value of byte encoded: {s} unexpected", .{encode}); return error.invalid_input; }; try std.testing.expectEqual(byte, result); } } test "All bytes decodeable in decode" { var byte: u8 = @truncate(u8, 0); var buffer: [40]u8 = comptime std.mem.zeroes([40]u8); var encode: []u8 = undefined; var result: []u8 = undefined; for (@as([256]u0, undefined)) |_, index| { byte = @truncate(u8, index); encode = bottom.encodeByte(byte, &buffer); result = BottomDecoder.decode(encode, &buffer) catch |err| { std.log.err("Error", .{}); std.log.err("value of byte: {d} unexpected", .{byte}); std.log.err("value of byte encoded: {s} unexpected", .{encode}); return err; }; try std.testing.expectEqual(byte, result[0]); } } test "All bytes decodeable in decodeAlloc" { var byte: u8 = @truncate(u8, 0); var buffer: [40]u8 = undefined; var encode: []u8 = undefined; var result: []u8 = undefined; var arena = std.heap.ArenaAllocator.init(std.testing.allocator); defer arena.deinit(); for (@as([256]u0, undefined)) |_, index| { byte = @truncate(u8, index); encode = bottom.encodeByte(byte, &buffer); result = BottomDecoder.decodeAlloc(encode, arena.allocator()) catch |err| { std.log.err("Error", .{}); std.log.err("value of byte: {d} unexpected", .{byte}); std.log.err("value of byte encoded: {s} unexpected", .{encode}); return err; }; try std.testing.expectEqual(byte, result[0]); } }
src/decoder.zig
const builtin = @import("builtin"); const std = @import("std"); const expect = std.testing.expect; const expectEqualSlices = std.testing.expectEqualSlices; const expectEqual = std.testing.expectEqual; const mem = std.mem; // comptime array passed as slice argument comptime { const S = struct { fn indexOfScalarPos(comptime T: type, slice: []const T, start_index: usize, value: T) ?usize { var i: usize = start_index; while (i < slice.len) : (i += 1) { if (slice[i] == value) return i; } return null; } fn indexOfScalar(comptime T: type, slice: []const T, value: T) ?usize { return indexOfScalarPos(T, slice, 0, value); } }; const unsigned = [_]type{ c_uint, c_ulong, c_ulonglong }; const list: []const type = &unsigned; var pos = S.indexOfScalar(type, list, c_ulong).?; if (pos != 1) @compileError("bad pos"); } test "slicing" { var array: [20]i32 = undefined; array[5] = 1234; var slice = array[5..10]; if (slice.len != 5) unreachable; const ptr = &slice[0]; if (ptr.* != 1234) unreachable; var slice_rest = array[10..]; if (slice_rest.len != 10) unreachable; } test "const slice" { comptime { const a = "1234567890"; try expect(a.len == 10); const b = a[1..2]; try expect(b.len == 1); try expect(b[0] == '2'); } } test "comptime slice of undefined pointer of length 0" { const slice1 = @as([*]i32, undefined)[0..0]; try expect(slice1.len == 0); const slice2 = @as([*]i32, undefined)[100..100]; try expect(slice2.len == 0); } test "implicitly cast array of size 0 to slice" { var msg = [_]u8{}; try assertLenIsZero(&msg); } fn assertLenIsZero(msg: []const u8) !void { try expect(msg.len == 0); } test "access len index of sentinel-terminated slice" { const S = struct { fn doTheTest() !void { var slice: [:0]const u8 = "hello"; try expect(slice.len == 5); try expect(slice[5] == 0); } }; try S.doTheTest(); comptime try S.doTheTest(); } test "comptime slice of slice preserves comptime var" { comptime { var buff: [10]u8 = undefined; buff[0..][0..][0] = 1; try expect(buff[0..][0..][0] == 1); } } test "slice of type" { comptime { var types_array = [_]type{ i32, f64, type }; for (types_array) |T, i| { switch (i) { 0 => try expect(T == i32), 1 => try expect(T == f64), 2 => try expect(T == type), else => unreachable, } } for (types_array[0..]) |T, i| { switch (i) { 0 => try expect(T == i32), 1 => try expect(T == f64), 2 => try expect(T == type), else => unreachable, } } } } test "generic malloc free" { const a = memAlloc(u8, 10) catch unreachable; memFree(u8, a); } var some_mem: [100]u8 = undefined; fn memAlloc(comptime T: type, n: usize) anyerror![]T { return @ptrCast([*]T, &some_mem[0])[0..n]; } fn memFree(comptime T: type, memory: []T) void { _ = memory; } test "slice of hardcoded address to pointer" { const S = struct { fn doTheTest() !void { const pointer = @intToPtr([*]u8, 0x04)[0..2]; comptime try expect(@TypeOf(pointer) == *[2]u8); const slice: []const u8 = pointer; try expect(@ptrToInt(slice.ptr) == 4); try expect(slice.len == 2); } }; try S.doTheTest(); } test "comptime slice of pointer preserves comptime var" { comptime { var buff: [10]u8 = undefined; var a = @ptrCast([*]u8, &buff); a[0..1][0] = 1; try expect(buff[0..][0..][0] == 1); } } 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]; try expect(sliceA[1] == 2); try expect(sliceB[1] == 2); } test "slicing zero length array" { const s1 = ""[0..]; const s2 = ([_]u32{})[0..]; try expect(s1.len == 0); try expect(s2.len == 0); try expect(mem.eql(u8, s1, "")); try expect(mem.eql(u32, s2, &[_]u32{})); } const x = @intToPtr([*]i32, 0x1000)[0..0x500]; const y = x[0x100..]; test "compile time slice of pointer to hard coded address" { if (builtin.zig_backend == .stage1) return error.SkipZigTest; try expect(@ptrToInt(x) == 0x1000); try expect(x.len == 0x500); try expect(@ptrToInt(y) == 0x1400); try expect(y.len == 0x400); }
test/behavior/slice.zig
const MMIO = @import("mmio.zig").MMIO; const PINB = MMIO(0x23, u8, packed struct { PINB0: u1 = 0, PINB1: u1 = 0, PINB2: u1 = 0, PINB3: u1 = 0, PINB4: u1 = 0, PINB5: u1 = 0, PINB6: u1 = 0, PINB7: u1 = 0, }); const DDRB = MMIO(0x24, u8, packed struct { DDB0: u1 = 0, DDB1: u1 = 0, DDB2: u1 = 0, DDB3: u1 = 0, DDB4: u1 = 0, DDB5: u1 = 0, DDB6: u1 = 0, DDB7: u1 = 0, }); const PORTB = MMIO(0x25, u8, packed struct { PORTB0: u1 = 0, PORTB1: u1 = 0, PORTB2: u1 = 0, PORTB3: u1 = 0, PORTB4: u1 = 0, PORTB5: u1 = 0, PORTB6: u1 = 0, PORTB7: u1 = 0, }); const PINC = MMIO(0x26, u8, packed struct { PINC0: u1 = 0, PINC1: u1 = 0, PINC2: u1 = 0, PINC3: u1 = 0, PINC4: u1 = 0, PINC5: u1 = 0, PINC6: u1 = 0, PINC7: u1 = 0, }); const DDRC = MMIO(0x27, u8, packed struct { DDC0: u1 = 0, DDC1: u1 = 0, DDC2: u1 = 0, DDC3: u1 = 0, DDC4: u1 = 0, DDC5: u1 = 0, DDC6: u1 = 0, DDC7: u1 = 0, }); const PORTC = MMIO(0x28, u8, packed struct { PORTC0: u1 = 0, PORTC1: u1 = 0, PORTC2: u1 = 0, PORTC3: u1 = 0, PORTC4: u1 = 0, PORTC5: u1 = 0, PORTC6: u1 = 0, PORTC7: u1 = 0, }); const PIND = MMIO(0x29, u8, packed struct { PIND0: u1 = 0, PIND1: u1 = 0, PIND2: u1 = 0, PIND3: u1 = 0, PIND4: u1 = 0, PIND5: u1 = 0, PIND6: u1 = 0, PIND7: u1 = 0, }); const DDRD = MMIO(0x2A, u8, packed struct { DDD0: u1 = 0, DDD1: u1 = 0, DDD2: u1 = 0, DDD3: u1 = 0, DDD4: u1 = 0, DDD5: u1 = 0, DDD6: u1 = 0, DDD7: u1 = 0, }); const PORTD = MMIO(0x2B, u8, packed struct { PORTD0: u1 = 0, PORTD1: u1 = 0, PORTD2: u1 = 0, PORTD3: u1 = 0, PORTD4: u1 = 0, PORTD5: u1 = 0, PORTD6: u1 = 0, PORTD7: u1 = 0, }); pub fn pinMode(comptime pin: comptime_int, comptime mode: enum { input, output, input_pullup }) void { switch (pin) { 0...7 => { var val = DDRD.readInt(); if (mode == .output) { val |= 1 << (pin - 0); } else { val &= ~@as(u8, 1 << (pin - 0)); } DDRD.writeInt(val); }, 8...13 => { var val = DDRB.readInt(); if (mode == .output) { val |= 1 << (pin - 8); } else { val &= ~@as(u8, 1 << (pin - 8)); } DDRB.writeInt(val); }, 14...19 => { var val = DDRC.readInt(); if (mode == .output) { val |= 1 << (pin - 14); } else { val &= ~@as(u8, 1 << (pin - 14)); } DDRC.writeInt(val); }, else => @compileError("Only port B, C and D are available yet (arduino pins 0 through 19)."), } if (mode == .input_pullup) { digitalWrite(pin, .high); } else { digitalWrite(pin, .low); } } pub fn digitalWrite(comptime pin: comptime_int, comptime value: enum { low, high }) void { switch (pin) { 0...7 => { var val = PORTD.readInt(); if (value == .high) { val |= 1 << (pin - 0); } else { val &= ~@as(u8, 1 << (pin - 0)); } PORTD.writeInt(val); }, 8...13 => { var val = PORTB.readInt(); if (value == .high) { val |= 1 << (pin - 8); } else { val &= ~@as(u8, 1 << (pin - 8)); } PORTB.writeInt(val); }, 14...19 => { var val = PORTC.readInt(); if (value == .high) { val |= 1 << (pin - 14); } else { val &= ~@as(u8, 1 << (pin - 14)); } PORTC.writeInt(val); }, else => @compileError("Only port B, C and D are available yet (arduino pins 0 through 19)."), } } pub fn digitalRead(comptime pin: comptime_int) bool { switch (pin) { 0...7 => { var val = PIND.readInt(); return (val & (1 << (pin - 0))) != 0; }, 8...13 => { var val = PINB.readInt(); return (val & (1 << (pin - 8))) != 0; }, 14...19 => { var val = PINC.readInt(); return (val & (1 << (pin - 14))) != 0; }, else => @compileError("Only port B, C and D are available yet (arduino pins 0 through 19)."), } }
src/gpio.zig
const std = @import("std"); const builtin = std.builtin; const Builder = std.build.Builder; pub fn makeLib(b: *Builder, mode: builtin.Mode, target: std.zig.CrossTarget, comptime prefix: []const u8) !*std.build.LibExeObjStep { const lib = b.addStaticLibrary("nfd", prefix ++ "src/lib.zig"); lib.setBuildMode(mode); lib.setTarget(target); const cflags = [_][]const u8{ "-Wall", }; lib.addIncludeDir(prefix ++ "nativefiledialog/src/include"); lib.addCSourceFile(prefix ++ "nativefiledialog/src/nfd_common.c", &cflags); if (lib.target.isDarwin()) { lib.addCSourceFile(prefix ++ "nativefiledialog/src/nfd_cocoa.m", &cflags); } else if (lib.target.isWindows()) { lib.addCSourceFile(prefix ++ "nativefiledialog/src/nfd_win.cpp", &cflags); } else { lib.addCSourceFile(prefix ++ "nativefiledialog/src/nfd_gtk.c", &cflags); } lib.linkLibC(); if (lib.target.isDarwin()) { lib.linkFramework("AppKit"); } else if (lib.target.isWindows()) { lib.linkSystemLibrary("shell32"); lib.linkSystemLibrary("ole32"); lib.linkSystemLibrary("uuid"); // needed by MinGW } else { lib.linkSystemLibrary("atk-1.0"); lib.linkSystemLibrary("gdk-3"); lib.linkSystemLibrary("gtk-3"); lib.linkSystemLibrary("glib-2.0"); lib.linkSystemLibrary("gobject-2.0"); } return lib; } pub fn build(b: *Builder) !void { const mode = b.standardReleaseOptions(); const target = b.standardTargetOptions(.{}); const lib = try makeLib(b, mode, target, ""); lib.install(); var demo = b.addExecutable("demo", "src/demo.zig"); demo.setBuildMode(mode); demo.addPackage(std.build.Pkg{ .name = "nfd", .path = std.build.FileSource.relative("src/lib.zig"), }); demo.linkLibrary(lib); demo.install(); const run_demo_cmd = demo.run(); run_demo_cmd.step.dependOn(b.getInstallStep()); const run_demo_step = b.step("run", "Run the demo"); run_demo_step.dependOn(&run_demo_cmd.step); }
build.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const gui = @import("gui"); const nvg = @import("nanovg"); const Rect = @import("gui/geometry.zig").Rect; const Point = @import("gui/geometry.zig").Point; const ColorLayer = @import("color.zig").ColorLayer; pub const ChangeType = enum { color, active, swap, }; const ColorForegroundBackgroundWidget = @This(); widget: gui.Widget, allocator: Allocator, active: ColorLayer = .foreground, colors: [2][4]u8 = [_][4]u8{ [_]u8{ 0, 0, 0, 0xff }, // foregorund [_]u8{0xff} ** 4, // background }, rects: [2]Rect(f32), background_image: nvg.Image, onChangedFn: ?fn (*Self, change_type: ChangeType) void = null, const pad = 5; const Self = @This(); pub fn init(allocator: Allocator, rect: Rect(f32), vg: nvg) !*Self { const rect_size = 32; const rect_offset = 14; var self = try allocator.create(Self); self.* = Self{ .widget = gui.Widget.init(allocator, rect), .allocator = allocator, .rects = [_]Rect(f32){ Rect(f32).make(2 * pad, 2 * pad, rect_size, rect_size), Rect(f32).make(2 * pad + rect_offset, 2 * pad + rect_offset, rect_size, rect_size), }, .background_image = vg.createImageRGBA(2, 2, .{ .repeat_x = true, .repeat_y = true, .nearest = true }, &.{ 0x66, 0x66, 0x66, 0xFF, 0x99, 0x99, 0x99, 0xFF, 0x99, 0x99, 0x99, 0xFF, 0x66, 0x66, 0x66, 0xFF, }), }; self.widget.onMouseDownFn = onMouseDown; self.widget.onMouseUpFn = onMouseUp; self.widget.drawFn = draw; return self; } pub fn deinit(self: *Self, vg: nvg) void { vg.deleteImage(self.background_image); self.widget.deinit(); self.allocator.destroy(self); } fn notifyChanged(self: *Self, change_type: ChangeType) void { if (self.onChangedFn) |onChanged| onChanged(self, change_type); } fn setActive(self: *Self, active: ColorLayer) void { if (self.active != active) { self.active = active; self.notifyChanged(.active); } } pub fn swap(self: *Self) void { std.mem.swap([4]u8, &self.colors[0], &self.colors[1]); self.notifyChanged(.swap); } pub fn getRgba(self: Self, color_layer: ColorLayer) [4]u8 { return self.colors[@enumToInt(color_layer)]; } pub fn setRgba(self: *Self, color_layer: ColorLayer, color: []const u8) void { const i = @enumToInt(color_layer); if (!std.mem.eql(u8, &self.colors[i], color)) { std.mem.copy(u8, &self.colors[i], color); self.notifyChanged(.color); } } pub fn getActiveRgba(self: Self) [4]u8 { return self.getRgba(self.active); } pub fn setActiveRgba(self: *Self, color: []const u8) void { self.setRgba(self.active, color); } fn onMouseDown(widget: *gui.Widget, event: *const gui.MouseEvent) void { if (event.button == .left) { var self = @fieldParentPtr(Self, "widget", widget); const point = Point(f32).make(event.x, event.y); for (self.rects) |rect, i| { if (rect.contains(point)) { self.setActive(@intToEnum(ColorLayer, @intCast(u1, i))); break; } } } } fn onMouseUp(widget: *gui.Widget, event: *const gui.MouseEvent) void { if (event.button == .left) { var self = @fieldParentPtr(Self, "widget", widget); const point = Point(f32).make(event.x, event.y); const swap_rect = Rect(f32).make(10,42,14,14); if (swap_rect.contains(point)) { self.swap(); } } } fn drawSwapArrows(vg: nvg) void { vg.beginPath(); vg.moveTo(15, 43); vg.lineTo(12, 47); vg.lineTo(14, 47); vg.lineTo(14, 52); vg.lineTo(19, 52); vg.lineTo(19, 54); vg.lineTo(23, 51); vg.lineTo(19, 48); vg.lineTo(19, 50); vg.lineTo(16, 50); vg.lineTo(16, 47); vg.lineTo(18, 47); vg.closePath(); vg.fillColor(nvg.rgb(66, 66, 66)); vg.fill(); } pub fn draw(widget: *gui.Widget, vg: nvg) void { const self = @fieldParentPtr(Self, "widget", widget); const rect = widget.relative_rect; vg.save(); defer vg.restore(); vg.translate(rect.x, rect.y); gui.drawPanel(vg, 0, 0, rect.w, rect.h, 1, false, false); gui.drawPanelInset(vg, pad, pad, 56, 56, 1); drawSwapArrows(vg); var i: usize = self.colors.len; while (i > 0) { i -= 1; const stroke_width: f32 = if (i == @enumToInt(self.active)) 2 else 1; const stroke_color = if (i == @enumToInt(self.active)) nvg.rgb(0, 0, 0) else nvg.rgb(66, 66, 66); vg.beginPath(); vg.rect( self.rects[i].x + 0.5 * stroke_width, self.rects[i].y + 0.5 * stroke_width, self.rects[i].w - stroke_width, self.rects[i].h - stroke_width, ); vg.fillPaint(vg.imagePattern(0, 0, 8, 8, 0, self.background_image, 1)); vg.fill(); vg.fillColor(nvg.rgba(self.colors[i][0], self.colors[i][1], self.colors[i][2], self.colors[i][3])); vg.fill(); vg.strokeWidth(stroke_width); vg.strokeColor(stroke_color); vg.stroke(); vg.beginPath(); vg.moveTo(self.rects[i].x + stroke_width, self.rects[i].y + stroke_width); vg.lineTo(self.rects[i].x + self.rects[i].w - stroke_width, self.rects[i].y + stroke_width); vg.lineTo(self.rects[i].x + stroke_width, self.rects[i].y + self.rects[i].h - stroke_width); vg.closePath(); vg.fillColor(nvg.rgb(self.colors[i][0], self.colors[i][1], self.colors[i][2])); vg.fill(); } }
src/ColorForegroundBackgroundWidget.zig
const combn = @import("../combn/combn.zig"); const Parser = combn.gllparser.Parser; const String = @import("String.zig"); const Node = @import("Node.zig"); const CompilerContext = @import("CompilerContext.zig"); const std = @import("std"); const mem = std.mem; const Compilation = @This(); value: union(ValueTag) { parser: CompiledParser, identifier: String, }, pub const CompiledParser = struct { ptr: *Parser(void, *Node), slice: ?[]*const Parser(void, *Node), pub fn deinit(self: @This(), allocator: mem.Allocator) void { self.ptr.deinit(allocator, null); if (self.slice) |slice| { allocator.free(slice); } } }; pub const ValueTag = enum { parser, identifier, }; pub fn initParser(parser: CompiledParser) Compilation { return .{ .value = .{ .parser = parser } }; } pub fn initIdentifier(identifier: String) Compilation { return .{ .value = .{ .identifier = identifier } }; } pub fn deinit(self: *const Compilation, allocator: mem.Allocator) void { switch (self.value) { .parser => |v| v.deinit(allocator), .identifier => |v| v.deinit(allocator), } } const HashContext = struct { pub fn hash(self: @This(), key: Compilation) u64 { _ = self; return switch (key.value) { .parser => |p| @ptrToInt(p.ptr), .identifier => |ident| std.hash_map.hashString(ident.value), }; } pub fn eql(self: @This(), a: Compilation, b: Compilation) bool { _ = self; return switch (a.value) { .parser => |aa| switch (b.value) { .parser => |bb| aa.ptr == bb.ptr, .identifier => false, }, .identifier => |aa| switch (b.value) { .parser => false, .identifier => |bb| std.mem.eql(u8, aa.value, bb.value), }, }; } }; pub const HashMap = std.HashMap(Compilation, Compilation, HashContext, std.hash_map.default_max_load_percentage);
src/dsl/Compilation.zig
const std = @import("std"); const assert = std.debug.assert; /// Marzullo's algorithm, invented by <NAME> for his Ph.D. dissertation in 1984, is an /// agreement algorithm used to select sources for estimating accurate time from a number of noisy /// time sources. NTP uses a modified form of this called the Intersection algorithm, which returns /// a larger interval for further statistical sampling. However, here we want the smallest interval. pub const Marzullo = struct { /// The smallest interval consistent with the largest number of sources. pub const Interval = struct { /// The lower bound on the minimum clock offset. lower_bound: i64, /// The upper bound on the maximum clock offset. upper_bound: i64, /// The number of "true chimers" consistent with the largest number of sources. sources_true: u8, /// The number of "false chimers" falling outside this interval. /// Where `sources_false` plus `sources_true` always equals the total number of sources. sources_false: u8, }; /// A tuple represents either the lower or upper end of a bound, and is fed as input to the /// Marzullo algorithm to compute the smallest interval across all tuples. /// For example, given a clock offset to a remote replica of 3s, a round trip time of 1s, and /// a maximum tolerance between clocks of 100ms on either side, we might create two tuples, the /// lower bound having an offset of 2.4s and the upper bound having an offset of 3.6s, /// to represent the error introduced by the round trip time and by the clocks themselves. pub const Tuple = struct { /// An identifier, the index of the clock source in the list of clock sources: source: u8, offset: i64, bound: enum { lower, upper, }, }; /// Returns the smallest interval consistent with the largest number of sources. pub fn smallest_interval(tuples: []Tuple) Interval { // There are two bounds (lower and upper) per source clock offset sample. const sources = @intCast(u8, @divExact(tuples.len, 2)); if (sources == 0) { return Interval{ .lower_bound = 0, .upper_bound = 0, .sources_true = 0, .sources_false = 0, }; } // Use a simpler sort implementation than the complexity of `std.sort.sort()` for safety: std.sort.insertionSort(Tuple, tuples, {}, less_than); // Here is a description of the algorithm: // https://en.wikipedia.org/wiki/Marzullo%27s_algorithm#Method var best: i64 = 0; var count: i64 = 0; var previous: ?Tuple = null; var interval: Interval = undefined; for (tuples) |tuple, i| { // Verify that our sort implementation is correct: if (previous) |p| { assert(p.offset <= tuple.offset); if (p.offset == tuple.offset) { if (p.bound != tuple.bound) { assert(p.bound == .lower and tuple.bound == .upper); } else { assert(p.source < tuple.source); } } } previous = tuple; // Update the current number of overlapping intervals: switch (tuple.bound) { .lower => count += 1, .upper => count -= 1, } // The last upper bound tuple will have a count of one less than the lower bound. // Therefore, we should never see count >= best for the last tuple: if (count > best) { best = count; interval.lower_bound = tuple.offset; interval.upper_bound = tuples[i + 1].offset; } else if (count == best and tuples[i + 1].bound == .upper) { // This is a tie for best overlap. Both intervals have the same number of sources. // We want to choose the smaller of the two intervals: const alternative = tuples[i + 1].offset - tuple.offset; if (alternative < interval.upper_bound - interval.lower_bound) { interval.lower_bound = tuple.offset; interval.upper_bound = tuples[i + 1].offset; } } } assert(previous.?.bound == .upper); // The number of false sources (ones which do not overlap the optimal interval) is the // number of sources minus the value of `best`: assert(best <= sources); interval.sources_true = @intCast(u8, best); interval.sources_false = @intCast(u8, sources - @intCast(u8, best)); assert(interval.sources_true + interval.sources_false == sources); return interval; } /// Sorts the list of tuples by clock offset. If two tuples with the same offset but opposite /// bounds exist, indicating that one interval ends just as another begins, then a method of /// deciding which comes first is necessary. Such an occurrence can be considered an overlap /// with no duration, which can be found by the algorithm by sorting the lower bound before the /// upper bound. Alternatively, if such pathological overlaps are considered objectionable then /// they can be avoided by sorting the upper bound before the lower bound. fn less_than(context: void, a: Tuple, b: Tuple) bool { if (a.offset < b.offset) return true; if (b.offset < a.offset) return false; if (a.bound == .lower and b.bound == .upper) return true; if (b.bound == .lower and a.bound == .upper) return false; // Use the source index to break the tie and ensure the sort is fully specified and stable // so that different sort algorithms sort the same way: if (a.source < b.source) return true; if (b.source < a.source) return false; return false; } }; fn test_smallest_interval(bounds: []const i64, smallest_interval: Marzullo.Interval) !void { var arena_allocator = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena_allocator.deinit(); const allocator = &arena_allocator.allocator; var tuples = try allocator.alloc(Marzullo.Tuple, bounds.len); for (bounds) |bound, i| { tuples[i] = .{ .source = @intCast(u8, @divTrunc(i, 2)), .offset = bound, .bound = if (i % 2 == 0) .lower else .upper, }; } var interval = Marzullo.smallest_interval(tuples); try std.testing.expectEqual(smallest_interval, interval); } test { try test_smallest_interval( &[_]i64{ 11, 13, 10, 12, 8, 12, }, Marzullo.Interval{ .lower_bound = 11, .upper_bound = 12, .sources_true = 3, .sources_false = 0, }, ); try test_smallest_interval( &[_]i64{ 8, 12, 11, 13, 14, 15, }, Marzullo.Interval{ .lower_bound = 11, .upper_bound = 12, .sources_true = 2, .sources_false = 1, }, ); try test_smallest_interval( &[_]i64{ -10, 10, -1, 1, 0, 0, }, Marzullo.Interval{ .lower_bound = 0, .upper_bound = 0, .sources_true = 3, .sources_false = 0, }, ); // The upper bound of the first interval overlaps inclusively with the lower of the last. try test_smallest_interval( &[_]i64{ 8, 12, 10, 11, 8, 10, }, Marzullo.Interval{ .lower_bound = 10, .upper_bound = 10, .sources_true = 3, .sources_false = 0, }, ); // The first smallest interval is selected. The alternative with equal overlap is 10..12. // However, while this shares the same number of sources, it is not the smallest interval. try test_smallest_interval( &[_]i64{ 8, 12, 10, 12, 8, 9, }, Marzullo.Interval{ .lower_bound = 8, .upper_bound = 9, .sources_true = 2, .sources_false = 1, }, ); // The last smallest interval is selected. The alternative with equal overlap is 7..9. // However, while this shares the same number of sources, it is not the smallest interval. try test_smallest_interval( &[_]i64{ 7, 9, 7, 12, 10, 11, }, Marzullo.Interval{ .lower_bound = 10, .upper_bound = 11, .sources_true = 2, .sources_false = 1, }, ); // The same idea as the previous test, but with negative offsets. try test_smallest_interval( &[_]i64{ -9, -7, -12, -7, -11, -10, }, Marzullo.Interval{ .lower_bound = -11, .upper_bound = -10, .sources_true = 2, .sources_false = 1, }, ); // A cluster of one with no remote sources. try test_smallest_interval( &[_]i64{}, Marzullo.Interval{ .lower_bound = 0, .upper_bound = 0, .sources_true = 0, .sources_false = 0, }, ); // A cluster of two with one remote source. try test_smallest_interval( &[_]i64{ 1, 3, }, Marzullo.Interval{ .lower_bound = 1, .upper_bound = 3, .sources_true = 1, .sources_false = 0, }, ); // A cluster of three with agreement. try test_smallest_interval( &[_]i64{ 1, 3, 2, 2, }, Marzullo.Interval{ .lower_bound = 2, .upper_bound = 2, .sources_true = 2, .sources_false = 0, }, ); // A cluster of three with no agreement, still returns the smallest interval. try test_smallest_interval( &[_]i64{ 1, 3, 4, 5, }, Marzullo.Interval{ .lower_bound = 4, .upper_bound = 5, .sources_true = 1, .sources_false = 1, }, ); }
src/vsr/marzullo.zig
const vk = @import("../../../vk.zig"); const std = @import("std"); const rg = @import("../render_graph.zig"); const vkctxt = @import("../../../vulkan_wrapper/vulkan_context.zig"); const printError = @import("../../../application/print_error.zig").printError; const RGResource = @import("../render_graph_resource.zig").RGResource; const RenderGraph = @import("../render_graph.zig").RenderGraph; pub const Texture = struct { rg_resource: RGResource, size: [2]u32, image: vk.Image, memory: vk.DeviceMemory, view: vk.ImageView, sampler: vk.Sampler, image_format: vk.Format = .r8g8b8a8_unorm, image_create_info: vk.ImageCreateInfo, image_layout: vk.ImageLayout, pub fn init(self: *Texture, name: []const u8, width: u32, height: u32, image_format: vk.Format, allocator: std.mem.Allocator) void { self.rg_resource.init(name, allocator); self.size[0] = width; self.size[1] = height; self.image_format = image_format; self.image_create_info = .{ .image_type = .@"2d", .format = self.image_format, .extent = .{ .width = self.size[0], .height = self.size[1], .depth = 1, }, .mip_levels = 1, .array_layers = 1, .samples = .{ .@"1_bit" = true, }, .tiling = .optimal, .usage = .{ .sampled_bit = true, .color_attachment_bit = true, .transfer_dst_bit = true, }, .sharing_mode = .exclusive, .initial_layout = .@"undefined", .flags = .{}, .queue_family_index_count = 0, .p_queue_family_indices = undefined, }; self.image_layout = .shader_read_only_optimal; } pub fn deinit(self: *Texture) void { self.rg_resource.deinit(); } pub fn alloc(self: *Texture) void { self.image = vkctxt.vkd.createImage(vkctxt.vkc.device, self.image_create_info, null) catch |err| { vkctxt.printVulkanError("Can't create texture", err, vkctxt.vkc.allocator); return; }; var mem_req: vk.MemoryRequirements = vkctxt.vkd.getImageMemoryRequirements(vkctxt.vkc.device, self.image); const mem_alloc_info: vk.MemoryAllocateInfo = .{ .allocation_size = mem_req.size, .memory_type_index = vkctxt.vkc.getMemoryType(mem_req.memory_type_bits, .{ .device_local_bit = true }), }; self.memory = vkctxt.vkd.allocateMemory(vkctxt.vkc.device, mem_alloc_info, null) catch |err| { vkctxt.printVulkanError("Can't allocate texture memory", err, vkctxt.vkc.allocator); return; }; vkctxt.vkd.bindImageMemory(vkctxt.vkc.device, self.image, self.memory, 0) catch |err| { vkctxt.printVulkanError("Can't bind texture memory", err, vkctxt.vkc.allocator); return; }; const view_info: vk.ImageViewCreateInfo = .{ .image = self.image, .view_type = .@"2d", .format = self.image_format, .subresource_range = .{ .aspect_mask = .{ .color_bit = true }, .level_count = 1, .layer_count = 1, .base_mip_level = 0, .base_array_layer = 0, }, .flags = .{}, .components = .{ .r = .identity, .g = .identity, .b = .identity, .a = .identity }, }; self.view = vkctxt.vkd.createImageView(vkctxt.vkc.device, view_info, null) catch |err| { vkctxt.printVulkanError("Can't create image view", err, vkctxt.vkc.allocator); return; }; const sampler_info: vk.SamplerCreateInfo = .{ .mag_filter = .linear, .min_filter = .linear, .mipmap_mode = .linear, .address_mode_u = .clamp_to_edge, .address_mode_v = .clamp_to_edge, .address_mode_w = .clamp_to_edge, .border_color = .float_opaque_white, .flags = .{}, .mip_lod_bias = 0, .anisotropy_enable = 0, .max_anisotropy = 0, .compare_enable = 0, .compare_op = .never, .min_lod = 0, .max_lod = 0, .unnormalized_coordinates = 0, }; self.sampler = vkctxt.vkd.createSampler(vkctxt.vkc.device, sampler_info, null) catch |err| { vkctxt.printVulkanError("Can't create sampler for ui texture", err, vkctxt.vkc.allocator); return; }; if (self.image_layout != .@"undefined") { const command_buffer: vk.CommandBuffer = rg.global_render_graph.allocateCommandBuffer(); RenderGraph.beginSingleTimeCommands(command_buffer); self.transitionImageLayout(command_buffer, .@"undefined", self.image_layout); RenderGraph.endSingleTimeCommands(command_buffer); rg.global_render_graph.submitCommandBuffer(command_buffer); } } pub fn destroy(self: *Texture) void { vkctxt.vkd.destroySampler(vkctxt.vkc.device, self.sampler, null); vkctxt.vkd.destroyImage(vkctxt.vkc.device, self.image, null); vkctxt.vkd.destroyImageView(vkctxt.vkc.device, self.view, null); vkctxt.vkd.freeMemory(vkctxt.vkc.device, self.memory, null); } pub fn transitionImageLayout(self: *Texture, command_buffer: vk.CommandBuffer, old_layout: vk.ImageLayout, new_layout: vk.ImageLayout) void { var barrier: vk.ImageMemoryBarrier = .{ .old_layout = old_layout, .new_layout = new_layout, .src_queue_family_index = vk.QUEUE_FAMILY_IGNORED, .dst_queue_family_index = vk.QUEUE_FAMILY_IGNORED, .image = self.image, .subresource_range = .{ .aspect_mask = .{ .color_bit = true, }, .base_mip_level = 0, .level_count = 1, .base_array_layer = 0, .layer_count = 1, }, .src_access_mask = undefined, .dst_access_mask = undefined, }; var source_stage: vk.PipelineStageFlags = undefined; var destination_stage: vk.PipelineStageFlags = undefined; if (old_layout == .@"undefined" and new_layout == .transfer_dst_optimal) { barrier.src_access_mask = .{}; barrier.dst_access_mask = .{ .transfer_write_bit = true }; source_stage = .{ .top_of_pipe_bit = true }; destination_stage = .{ .transfer_bit = true }; } else if (old_layout == .transfer_dst_optimal and new_layout == .shader_read_only_optimal) { barrier.src_access_mask = .{ .transfer_write_bit = true }; barrier.dst_access_mask = .{ .shader_read_bit = true }; source_stage = .{ .transfer_bit = true }; destination_stage = .{ .fragment_shader_bit = true }; } else if (old_layout == .@"undefined" and new_layout == .shader_read_only_optimal) { barrier.src_access_mask = .{}; barrier.dst_access_mask = .{ .shader_read_bit = true }; source_stage = .{ .top_of_pipe_bit = true }; destination_stage = .{ .fragment_shader_bit = true }; } else { @panic("Not supported image layouts for transfer"); } vkctxt.vkd.cmdPipelineBarrier(command_buffer, source_stage, destination_stage, .{}, 0, undefined, 0, undefined, 1, @ptrCast([*]const vk.ImageMemoryBarrier, &barrier)); } };
src/renderer/render_graph/resources/texture.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const gui = @import("gui"); const nvg = @import("nanovg"); const Rect = @import("gui/geometry.zig").Rect; const ColorPickerWidget = @This(); widget: gui.Widget, allocator: *Allocator, spinners: [4]*gui.Spinner(i32) = undefined, sliders: [5]*gui.Slider(f32) = undefined, color: [4]u8 = [_]u8{ 0, 0, 0, 0xff }, onChangedFn: ?fn (*ColorPickerWidget) void = null, const Self = @This(); pub fn init(allocator: *Allocator, rect: Rect(f32)) !*Self { var self = try allocator.create(Self); self.* = Self{ .widget = gui.Widget.init(allocator, rect), .allocator = allocator, }; self.widget.drawFn = draw; const pad = 5; inline for ([_]u2{ 0, 1, 2, 3 }) |i| { const y = @intToFloat(f32, i) * 28; self.sliders[i] = try gui.Slider(f32).init(allocator, Rect(f32).make(pad, y + pad, rect.w - 50 - 2 * pad, 23)); self.sliders[i].max_value = 1; self.sliders[i].onChangedFn = SliderChangedFn(i).changed; self.sliders[i].widget.drawFn = SliderDrawFn(i).draw; try self.widget.addChild(&self.sliders[i].widget); self.spinners[i] = try gui.Spinner(i32).init(allocator, Rect(f32).make(rect.w - 50, y + pad, 45, 23)); self.spinners[i].max_value = 255; self.spinners[i].onChangedFn = SpinnerChangedFn(i).changed; try self.widget.addChild(&self.spinners[i].widget); } self.setRgba(self.color); return self; } pub fn deinit(self: *Self) void { var i: usize = 0; while (i < 4) : (i += 1) { self.sliders[i].deinit(); self.spinners[i].deinit(); } self.widget.deinit(); self.allocator.destroy(self); } pub fn setRgba(self: *Self, color: [4]u8) void { for (color) |c, i| { self.color[i] = c; self.sliders[i].setValue(@intToFloat(f32, c) / 255.0); self.spinners[i].setValue(color[i]); } } pub fn setRgb(self: *Self, color: [3]u8) void { for (color) |c, i| { self.color[i] = c; self.sliders[i].setValue(@intToFloat(f32, c) / 255.0); self.spinners[i].setValue(color[i]); } } fn SliderChangedFn(comptime color_index: comptime_int) type { return struct { fn changed(slider: *gui.Slider(f32)) void { if (slider.widget.parent) |parent| { var picker = @fieldParentPtr(Self, "widget", parent); const value = @floatToInt(u8, slider.value * 255.0); if (picker.color[color_index] != value) { picker.color[color_index] = value; picker.spinners[color_index].setValue(value); if (picker.onChangedFn) |onChanged| onChanged(picker); } } } }; } fn SpinnerChangedFn(comptime color_index: comptime_int) type { return struct { fn changed(spinner: *gui.Spinner(i32)) void { if (spinner.widget.parent) |parent| { var picker = @fieldParentPtr(Self, "widget", parent); if (picker.color[color_index] != spinner.value) { picker.color[color_index] = @intCast(u8, spinner.value); picker.sliders[color_index].setValue(@intToFloat(f32, spinner.value) / 255.0); if (picker.onChangedFn) |onChanged| onChanged(picker); } } } }; } fn SliderDrawFn(comptime color_index: u2) type { return struct { fn draw(widget: *gui.Widget) void { if (widget.parent) |parent| { const picker = @fieldParentPtr(Self, "widget", parent); const rect = widget.relative_rect; const icol = switch (color_index) { 0 => nvg.rgb(0, picker.color[1], picker.color[2]), 1 => nvg.rgb(picker.color[0], 0, picker.color[2]), 2 => nvg.rgb(picker.color[0], picker.color[1], 0), 3 => nvg.rgb(0, 0, 0), }; const ocol = switch (color_index) { 0 => nvg.rgb(0xff, picker.color[1], picker.color[2]), 1 => nvg.rgb(picker.color[0], 0xff, picker.color[2]), 2 => nvg.rgb(picker.color[0], picker.color[1], 0xff), 3 => nvg.rgb(0xff, 0xff, 0xff), }; nvg.beginPath(); nvg.rect(rect.x, rect.y + 4, rect.w, rect.h - 4); const gradient = nvg.linearGradient(rect.x, 0, rect.x + rect.w, 0, icol, ocol); nvg.fillPaint(gradient); nvg.fill(); const x = @intToFloat(f32, picker.color[color_index]) / 255.0; drawColorPickerIndicator(rect.x + x * rect.w, rect.y + 4); } } }; } fn drawColorPickerIndicator(x: f32, y: f32) void { nvg.beginPath(); nvg.moveTo(x, y); nvg.lineTo(x + 4, y - 4); nvg.lineTo(x - 4, y - 4); nvg.closePath(); nvg.fillColor(nvg.rgb(0, 0, 0)); nvg.fill(); } pub fn draw(widget: *gui.Widget) void { const rect = widget.relative_rect; gui.drawPanel(rect.x, rect.y, rect.w, rect.h, 1, false, false); widget.drawChildren(); }
src/ColorPickerWidget.zig
pub const SYS = enum(usize) { restart_syscall = 0x00, exit = 0x01, fork = 0x02, read = 0x03, write = 0x04, open = 0x05, close = 0x06, creat = 0x08, link = 0x09, unlink = 0x0a, execve = 0x0b, chdir = 0x0c, mknod = 0x0e, chmod = 0x0f, lchown = 0x10, lseek = 0x13, getpid = 0x14, mount = 0x15, setuid = 0x17, getuid = 0x18, ptrace = 0x1a, pause = 0x1d, access = 0x21, nice = 0x22, sync = 0x24, kill = 0x25, rename = 0x26, mkdir = 0x27, rmdir = 0x28, dup = 0x29, pipe = 0x2a, times = 0x2b, brk = 0x2d, setgid = 0x2e, getgid = 0x2f, geteuid = 0x31, getegid = 0x32, acct = 0x33, umount2 = 0x34, ioctl = 0x36, fcntl = 0x37, setpgid = 0x39, umask = 0x3c, chroot = 0x3d, ustat = 0x3e, dup2 = 0x3f, getppid = 0x40, getpgrp = 0x41, setsid = 0x42, sigaction = 0x43, setreuid = 0x46, setregid = 0x47, sigsuspend = 0x48, sigpending = 0x49, sethostname = 0x4a, setrlimit = 0x4b, getrusage = 0x4d, gettimeofday = 0x4e, settimeofday = 0x4f, getgroups = 0x50, setgroups = 0x51, symlink = 0x53, readlink = 0x55, uselib = 0x56, swapon = 0x57, reboot = 0x58, munmap = 0x5b, truncate = 0x5c, ftruncate = 0x5d, fchmod = 0x5e, fchown = 0x5f, getpriority = 0x60, setpriority = 0x61, statfs = 0x63, fstatfs = 0x64, syslog = 0x67, setitimer = 0x68, getitimer = 0x69, stat = 0x6a, lstat = 0x6b, fstat = 0x6c, vhangup = 0x6f, wait4 = 0x72, swapoff = 0x73, sysinfo = 0x74, fsync = 0x76, sigreturn = 0x77, clone = 0x78, setdomainname = 0x79, uname = 0x7a, adjtimex = 0x7c, mprotect = 0x7d, sigprocmask = 0x7e, init_module = 0x80, delete_module = 0x81, quotactl = 0x83, getpgid = 0x84, fchdir = 0x85, bdflush = 0x86, sysfs = 0x87, personality = 0x88, setfsuid = 0x8a, setfsgid = 0x8b, _llseek = 0x8c, getdents = 0x8d, _newselect = 0x8e, flock = 0x8f, msync = 0x90, readv = 0x91, writev = 0x92, getsid = 0x93, fdatasync = 0x94, _sysctl = 0x95, mlock = 0x96, munlock = 0x97, mlockall = 0x98, munlockall = 0x99, sched_setparam = 0x9a, sched_getparam = 0x9b, sched_setscheduler = 0x9c, sched_getscheduler = 0x9d, sched_yield = 0x9e, sched_get_priority_max = 0x9f, sched_get_priority_min = 0xa0, sched_rr_get_interval = 0xa1, nanosleep = 0xa2, mremap = 0xa3, setresuid = 0xa4, getresuid = 0xa5, poll = 0xa8, nfsservctl = 0xa9, setresgid = 0xaa, getresgid = 0xab, prctl = 0xac, rt_sigreturn = 0xad, rt_sigaction = 0xae, rt_sigprocmask = 0xaf, rt_sigpending = 0xb0, rt_sigtimedwait = 0xb1, rt_sigqueueinfo = 0xb2, rt_sigsuspend = 0xb3, pread64 = 0xb4, pwrite64 = 0xb5, chown = 0xb6, getcwd = 0xb7, capget = 0xb8, capset = 0xb9, sigaltstack = 0xba, sendfile = 0xbb, vfork = 0xbe, ugetrlimit = 0xbf, mmap2 = 0xc0, truncate64 = 0xc1, ftruncate64 = 0xc2, stat64 = 0xc3, lstat64 = 0xc4, fstat64 = 0xc5, lchown32 = 0xc6, getuid32 = 0xc7, getgid32 = 0xc8, geteuid32 = 0xc9, getegid32 = 0xca, setreuid32 = 0xcb, setregid32 = 0xcc, getgroups32 = 0xcd, setgroups32 = 0xce, fchown32 = 0xcf, setresuid32 = 0xd0, getresuid32 = 0xd1, setresgid32 = 0xd2, getresgid32 = 0xd3, chown32 = 0xd4, setuid32 = 0xd5, setgid32 = 0xd6, setfsuid32 = 0xd7, setfsgid32 = 0xd8, getdents64 = 0xd9, pivot_root = 0xda, mincore = 0xdb, madvise = 0xdc, fcntl64 = 0xdd, gettid = 0xe0, readahead = 0xe1, setxattr = 0xe2, lsetxattr = 0xe3, fsetxattr = 0xe4, getxattr = 0xe5, lgetxattr = 0xe6, fgetxattr = 0xe7, listxattr = 0xe8, llistxattr = 0xe9, flistxattr = 0xea, removexattr = 0xeb, lremovexattr = 0xec, fremovexattr = 0xed, tkill = 0xee, sendfile64 = 0xef, futex = 0xf0, sched_setaffinity = 0xf1, sched_getaffinity = 0xf2, io_setup = 0xf3, io_destroy = 0xf4, io_getevents = 0xf5, io_submit = 0xf6, io_cancel = 0xf7, exit_group = 0xf8, lookup_dcookie = 0xf9, epoll_create = 0xfa, epoll_ctl = 0xfb, epoll_wait = 0xfc, remap_file_pages = 0xfd, set_tid_address = 0x100, timer_create = 0x101, timer_settime = 0x102, timer_gettime = 0x103, timer_getoverrun = 0x104, timer_delete = 0x105, clock_settime = 0x106, clock_gettime = 0x107, clock_getres = 0x108, clock_nanosleep = 0x109, statfs64 = 0x10a, fstatfs64 = 0x10b, tgkill = 0x10c, utimes = 0x10d, arm_fadvise64_64 = 0x10e, pciconfig_iobase = 0x10f, pciconfig_read = 0x110, pciconfig_write = 0x111, mq_open = 0x112, mq_unlink = 0x113, mq_timedsend = 0x114, mq_timedreceive = 0x115, mq_notify = 0x116, mq_getsetattr = 0x117, waitid = 0x118, socket = 0x119, bind = 0x11a, connect = 0x11b, listen = 0x11c, accept = 0x11d, getsockname = 0x11e, getpeername = 0x11f, socketpair = 0x120, send = 0x121, sendto = 0x122, recv = 0x123, recvfrom = 0x124, shutdown = 0x125, setsockopt = 0x126, getsockopt = 0x127, sendmsg = 0x128, recvmsg = 0x129, semop = 0x12a, semget = 0x12b, semctl = 0x12c, msgsnd = 0x12d, msgrcv = 0x12e, msgget = 0x12f, msgctl = 0x130, shmat = 0x131, shmdt = 0x132, shmget = 0x133, shmctl = 0x134, add_key = 0x135, request_key = 0x136, keyctl = 0x137, semtimedop = 0x138, vserver = 0x139, ioprio_set = 0x13a, ioprio_get = 0x13b, inotify_init = 0x13c, inotify_add_watch = 0x13d, inotify_rm_watch = 0x13e, mbind = 0x13f, get_mempolicy = 0x140, set_mempolicy = 0x141, openat = 0x142, mkdirat = 0x143, mknodat = 0x144, fchownat = 0x145, futimesat = 0x146, fstatat64 = 0x147, unlinkat = 0x148, renameat = 0x149, linkat = 0x14a, symlinkat = 0x14b, readlinkat = 0x14c, fchmodat = 0x14d, faccessat = 0x14e, pselect6 = 0x14f, ppoll = 0x150, unshare = 0x151, set_robust_list = 0x152, get_robust_list = 0x153, splice = 0x154, arm_sync_file_range = 0x155, sync_file_range2 = 0x155, tee = 0x156, vmsplice = 0x157, move_pages = 0x158, getcpu = 0x159, epoll_pwait = 0x15a, kexec_load = 0x15b, utimensat = 0x15c, signalfd = 0x15d, timerfd_create = 0x15e, eventfd = 0x15f, fallocate = 0x160, timerfd_settime = 0x161, timerfd_gettime = 0x162, signalfd4 = 0x163, eventfd2 = 0x164, epoll_create1 = 0x165, dup3 = 0x166, pipe2 = 0x167, inotify_init1 = 0x168, preadv = 0x169, pwritev = 0x16a, rt_tgsigqueueinfo = 0x16b, perf_event_open = 0x16c, recvmmsg = 0x16d, accept4 = 0x16e, fanotify_init = 0x16f, fanotify_mark = 0x170, prlimit64 = 0x171, name_to_handle_at = 0x172, open_by_handle_at = 0x173, clock_adjtime = 0x174, syncfs = 0x175, sendmmsg = 0x176, setns = 0x177, process_vm_readv = 0x178, process_vm_writev = 0x179, kcmp = 0x17a, finit_module = 0x17b, sched_setattr = 0x17c, sched_getattr = 0x17d, renameat2 = 0x17e, seccomp = 0x17f, getrandom = 0x180, memfd_create = 0x181, bpf = 0x182, execveat = 0x183, userfaultfd = 0x184, membarrier = 0x185, mlock2 = 0x186, copy_file_range = 0x187, preadv2 = 0x188, pwritev2 = 0x189, pkey_mprotect = 0x18a, pkey_alloc = 0x18b, pkey_free = 0x18c, statx = 0x18d, ARM_breakpoint = 0xf0001, ARM_cacheflush = 0xf0002, ARM_usr26 = 0xf0003, ARM_usr32 = 0xf0004, ARM_set_tls = 0xf0005, };
src/linux/arm/consts.zig
const std = @import("std"); const tools = @import("tools"); const with_trace = true; const assert = std.debug.assert; fn trace(comptime fmt: []const u8, args: anytype) void { if (with_trace) std.debug.print(fmt, args); } pub fn main() anyerror!void { const stdout = std.io.getStdOut().writer(); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); const Action = struct { write: u1, move: i2, next: u4, }; const State = [2]Action; const steps_exemple = 6; const states_exemple = [_]State{ //A .{ .{ .write = 1, .move = 1, .next = 1 }, .{ .write = 0, .move = -1, .next = 1 }, }, //B .{ .{ .write = 1, .move = -1, .next = 0 }, .{ .write = 1, .move = 1, .next = 0 }, }, }; const steps = 12656374; const states = [_]State{ //A .{ .{ .write = 1, .move = 1, .next = 1 }, .{ .write = 0, .move = -1, .next = 2 }, }, //B .{ .{ .write = 1, .move = -1, .next = 0 }, .{ .write = 1, .move = -1, .next = 3 }, }, //C .{ .{ .write = 1, .move = 1, .next = 3 }, .{ .write = 0, .move = 1, .next = 2 }, }, //D .{ .{ .write = 0, .move = -1, .next = 1 }, .{ .write = 0, .move = 1, .next = 4 }, }, //E .{ .{ .write = 1, .move = 1, .next = 2 }, .{ .write = 1, .move = -1, .next = 5 }, }, //F .{ .{ .write = 1, .move = -1, .next = 4 }, .{ .write = 1, .move = 1, .next = 0 }, }, }; var tape = [1]u1{0} ** 100000; var cursor: i32 = tape.len / 2; var state: u4 = 0; var step: u32 = 0; while (step < steps) : (step += 1) { const t = &tape[@intCast(usize, cursor)]; const action = states[state][t.*]; t.* = action.write; cursor += action.move; state = action.next; } const ones = blk: { var count: u32 = 0; for (tape) |t| { count += t; } break :blk count; }; try stdout.print("ones = {}\n", .{ones}); }
2017/day25.zig
const std = @import("std"); const za = @import("zalgebra"); const Vec4 = za.vec4; const Mat4 = za.mat4; // dross-zig const Vector3 = @import("vector3.zig").Vector3; const Vector4 = @import("vector4.zig").Vector4; // ----------------------------------------- // - Matrix4 - // ----------------------------------------- //[1, 0, 0, tx] //[0, 1, 0, ty] //[0, 0, 1, tz] //[0, 0, 0, 1] // Translation Matrix //[sx, 0, 0, 0] //[0, sy, 0, 0] //[0, 0, sz, 0] //[0, 0, 0, 1] // Scaling Matrix /// pub const Matrix4 = struct { data: Mat4 = undefined, const Self = @This(); /// Creates a 4x4 matrix with all 0s , expect 1s that are along the diagonal pub fn identity() Self { return .{ .data = Mat4.identity(), }; } /// Construct a new 4x4 matrix from the given slice pub fn fromSlice(data: *const [16]f32) Self { return = .{ .data = Mat4.from_slice(data), }; } /// Evaluates whether the two matrices are equal to one another. pub fn isEqual(left: Self, right: Self) bool { return Mat4.is_eq(left.data, right.data); } /// Multiplies the matrix by a Vector4(f32) and returns the resulting Vector4(f32) pub fn multiplyVec4(self: Self, v: Vector4) Vector4 { return .{ .data = self.data.mult_by_vec4(v.data), }; } /// Builds a 4x4 translation matrix by multiplying an /// identity matrix and the given translation vector. pub fn fromTranslate(axis: Vector3) Self { return .{ .data = Mat4.from_translate(axis.data), }; } /// Translates the matrix by the given axis vector. pub fn translate(self: Self, axis: Vector3) Self { return .{ .data = self.data.translate(axis.data), }; } /// Returns the translation vector from the transform matrix pub fn translation(self: Self) Vector3 { return Vector3{ .data = self.data.extract_translation(), }; } /// Builds a new 4x4 matrix from the given axis and angle (in degrees). pub fn fromRotation(angle_deg: f32, axis: Vector3) Self { return = .{ .data = Mat4.from_rotation(angle_deg, axis.data), }; } /// Rotates the matrix by the given angle (in degrees) along the given axis. pub fn rotate(self: Self, angle_deg: f32, axis: Vector3) Self { return .{ .data = self.data.rotate(angle_deg, axis.data), }; } /// Builds a rotation matrix from euler angles (X * Y * Z). pub fn fromEulerAngle(euler_angle: Vector3) Self { return = .{ .data = Mat4.from_euler_angle(euler_angle), }; } /// Returns an Orthogonal normalized matrix pub fn orthogonalNormalized(self: Self) Self { return .{ .data = self.data.ortho_normalize(), }; } /// Returns the rotation from the matrix as Euler angles (in degrees). pub fn rotation(self: Self) Vector3 { return Vector3{ .data = self.data.extract_rotation(), }; } /// Builds a new matrix 4x4 from the given scaling vector. pub fn fromScale(axis: Vector3) Self { return .{ .data = Mat4.from_scale(axis.data), }; } /// Scales the matrix by the given scaling axis pub fn scale(self: Self, axis: Vector3) Self { return .{ .data = self.data.scale(axis.data), }; } /// Returns the scale from the transform matrix as a Vector3. pub fn scaling(self: Self) Vector3 { return Vector3{ .data = self.data.extract_scale(), }; } /// Builds a perspective 4x4 matrix pub fn perspective(fov_deg: f32, aspect_ratio: f32, z_near: f32, z_far: f32) Self { return .{ .data = Mat4.perspective(fov_deg, aspect_ratio, z_near, z_far), }; } /// Build a orthographic 4x4 matrix pub fn orthographic(left: f32, right: f32, bottom: f32, top: f32, z_near: f32, z_far: f32) Self { return .{ .data = Mat4.orthographic(left, right, bottom, top, z_near, z_far), }; } /// Performs a right-handed look at pub fn lookAt(eye: Vector3, target: Vector3, up: Vector3) Self { return .{ .data = Mat4.look_at(eye.data, target.data, up.data), }; } /// Builds a new Matrix 4x4 via Matrix multiplication pub fn mult(left: Self, right: Self) Self { return .{ .data = Mat4.mult(left.data, right.data), }; } /// Builds an inverse Matrix 4x4 from the given matrix pub fn inverse(self: Self) Self { return .{ .data = self.data.inv(), }; } };
src/core/matrix4.zig
const __floatdidf = @import("floatdidf.zig").__floatdidf; const testing = @import("std").testing; fn test__floatdidf(a: i64, expected: f64) void { const r = __floatdidf(a); testing.expect(r == expected); } test "floatdidf" { test__floatdidf(0, 0.0); test__floatdidf(1, 1.0); test__floatdidf(2, 2.0); test__floatdidf(20, 20.0); test__floatdidf(-1, -1.0); test__floatdidf(-2, -2.0); test__floatdidf(-20, -20.0); test__floatdidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); test__floatdidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); test__floatdidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); test__floatdidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000008000000000)), -0x1.FFFFFEp+62); test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000800)), -0x1.FFFFFFFFFFFFEp+62); test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000010000000000)), -0x1.FFFFFCp+62); test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000001000)), -0x1.FFFFFFFFFFFFCp+62); test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000000)), -0x1.000000p+63); test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000001)), -0x1.000000p+63); test__floatdidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); test__floatdidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); test__floatdidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); test__floatdidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); test__floatdidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); test__floatdidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); test__floatdidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); test__floatdidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); test__floatdidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); test__floatdidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); test__floatdidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); test__floatdidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); test__floatdidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); test__floatdidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); test__floatdidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); test__floatdidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); test__floatdidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); }
lib/std/special/compiler_rt/floatdidf_test.zig
const std = @import("std"); // TODO make this receive a stream and write into it directly instead of // dealing with memory. pub fn prettyMemoryUsage(buffer: []u8, kilobytes: u64) ![]const u8 { const megabytes = kilobytes / 1024; const gigabytes = megabytes / 1024; if (kilobytes < 1024) { return try std.fmt.bufPrint(buffer, "{} KB", .{kilobytes}); } else if (megabytes < 1024) { return try std.fmt.bufPrint(buffer, "{d:.2} MB", .{megabytes}); } else if (gigabytes < 1024) { return try std.fmt.bufPrint(buffer, "{d:.2} GB", .{gigabytes}); } else { return try std.fmt.bufPrint(buffer, "how", .{}); } } pub fn read(fd: std.os.fd_t, buf: []u8) !usize { const max_count = switch (std.Target.current.os.tag) { .linux => 0x7ffff000, else => std.math.maxInt(isize), }; const adjusted_len = std.math.min(max_count, buf.len); const rc = std.os.system.read(fd, buf.ptr, adjusted_len); switch (std.os.errno(rc)) { 0 => return @intCast(usize, rc), std.os.EINVAL => unreachable, std.os.EFAULT => unreachable, // probably bad to do this mapping std.os.EINTR, std.os.EAGAIN => return error.WouldBlock, std.os.EBADF => return error.NotOpenForReading, // Can be a race condition. std.os.EIO => return error.InputOutput, std.os.EISDIR => return error.IsDir, std.os.ENOBUFS => return error.SystemResources, std.os.ENOMEM => return error.SystemResources, std.os.ECONNRESET => return error.ConnectionResetByPeer, std.os.ETIMEDOUT => return error.ConnectionTimedOut, else => |err| return std.os.unexpectedErrno(err), } } /// Wraps a file descriptor with a mutex to prevent /// data corruption by separate threads, and keeps /// a `closed` flag to stop threads from trying to /// operate on something that is closed (that would give EBADF, /// which is a race condition, aanicking the program) pub const WrappedWriter = struct { file: std.fs.File, lock: std.Mutex, closed: bool = false, pub fn init(fd: std.os.fd_t) @This() { return .{ .file = std.fs.File{ .handle = fd }, .lock = std.Mutex.init(), }; } pub fn deinit(self: *@This()) void { self.lock.deinit(); } pub fn markClosed(self: *@This()) void { const held = self.lock.acquire(); defer held.release(); self.closed = true; } pub const WriterError = std.fs.File.WriteError || error{Closed}; pub const Writer = std.io.Writer(*@This(), WriterError, write); pub fn writer(self: *@This()) Writer { return .{ .context = self }; } pub fn write(self: *@This(), bytes: []const u8) WriteError!usize { const held = self.lock.acquire(); defer held.release(); if (self.closed) return error.Closed; return try self.file.write(data); } }; /// Wraps a file descriptor with a mutex to prevent /// data corruption by separate threads, and keeps /// a `closed` flag to stop threads from trying to /// operate on something that is closed (that would give EBADF, /// which is a race condition, aanicking the program) pub const WrappedReader = struct { file: std.fs.File, lock: std.Mutex, closed: bool = false, pub fn init(fd: std.os.fd_t) @This() { return .{ .file = std.fs.File{ .handle = fd }, .lock = std.Mutex.init(), }; } pub fn deinit(self: *@This()) void { self.lock.deinit(); } pub fn markClosed(self: *@This()) void { const held = self.lock.acquire(); defer held.release(); self.closed = true; } pub const ReadrError = std.fs.File.ReadError || error{Closed}; pub const Readr = std.io.Reader(*@This(), ReaderError, read); pub fn reader(self: *@This()) Reader { return .{ .context = self }; } pub fn read(self: *@This(), buffer: []u8) ReadError!usize { const held = self.lock.acquire(); defer held.release(); if (self.closed) return error.Closed; return try self.file.read(data); } }; pub fn monotonicRead() u64 { var ts: std.os.timespec = undefined; std.os.clock_gettime(std.os.CLOCK_MONOTONIC, &ts) catch unreachable; return @intCast(u64, ts.tv_sec) * @as(u64, std.time.ns_per_s) + @intCast(u64, ts.tv_nsec); }
src/util.zig
const builtin = @import("builtin"); const std = @import("std"); const io = std.io; const os = std.os; const fs = std.fs; const Builder = std.build.Builder; const FileSource = std.build.FileSource; const thread = @import("src/thread.zig"); pub fn write_struct_def(comptime T: type) void { const file = fs.cwd().createFile("src/arch/aarch64/struct_defs_" ++ @typeName(T) ++ ".h", .{}) catch unreachable; defer file.close(); var writer = fs.File.writer(file); writer.print("// NOTE THIS FILE IS AUTO GENERATED BY BUILD.ZIG\n", .{}) catch {}; switch (@typeInfo(T)) { .Struct => |StructT| { inline for (StructT.fields) |f| { //const stdout = std.io.getStdOut().writer(); writer.print("#define {s}_{s} {}\n", .{ @typeName(T), f.name, @offsetOf(T, f.name) }) catch {}; } writer.print("#define {s}__size {}\n", .{ @typeName(T), @sizeOf(T) }) catch {}; }, else => @compileError("Thread type not a struct"), } } pub fn build(b: *Builder) void { write_struct_def(thread.Thread); write_struct_def(thread.CPUFrame); const want_gdb = b.option(bool, "gdb", "Build for QEMU gdb server") orelse false; // const want_pty = b.option(bool, "pty", "Create a separate serial port path") orelse false; const mode = b.standardReleaseOptions(); const exe = b.addExecutable("kernel8.elf", "src/kernel.zig"); exe.addPackagePath("ext2", "../libs/ext2/ext2.zig"); exe.addAssemblyFile("src/arch/aarch64/kernel_entry.S"); exe.addAssemblyFile("src/arch/aarch64/kernel_pre.S"); exe.addAssemblyFile("src/arch/aarch64/exception.S"); exe.addAssemblyFile("src/arch/aarch64/context.S"); exe.setBuildMode(mode); exe.setLinkerScriptPath(FileSource.relative("src/arch/aarch64/linker.ld")); // Use eabihf for freestanding arm code with hardware float support var features_sub = std.Target.Cpu.Feature.Set.empty; features_sub.addFeature(@enumToInt(std.Target.aarch64.Feature.neon)); features_sub.addFeature(@enumToInt(std.Target.aarch64.Feature.fp_armv8)); const target = std.zig.CrossTarget{ .cpu_arch = .aarch64, .os_tag = .freestanding, .cpu_features_sub = features_sub, .cpu_model = .{ .explicit = &std.Target.aarch64.cpu.generic }, }; exe.setTarget(target); // Dumping symbols const dump_step = b.step("dump", "Dump symbols"); dump_step.dependOn(&exe.step); const run_objdump = b.addSystemCommand(&[_][]const u8{"llvm-objcopy-13"}); run_objdump.addArtifactArg(exe); run_objdump.addArgs(&[_][]const u8{ "-O", "binary", "zig-out/bin/kernel8" }); const run_create_syms = b.addSystemCommand(&[_][]const u8{"./post.sh"}); run_create_syms.addArtifactArg(exe); dump_step.dependOn(&run_objdump.step); dump_step.dependOn(&run_create_syms.step); const qemu = b.step("qemu", "run kernel in qemu"); const qemu_path = "qemu-system-aarch64"; const run_qemu = b.addSystemCommand(&[_][]const u8{qemu_path}); run_qemu.addArg("-kernel"); run_qemu.addArtifactArg(exe); run_qemu.addArgs(&[_][]const u8{ "-m", "1024", "-M", "raspi3", "-nographic", "-semihosting", }); if (want_gdb) { run_qemu.addArgs(&[_][]const u8{ "-S", "-s", }); } //FIXME Update this to use the output path to the elf run_qemu.addArgs(&[_][]const u8{ "-device", "loader,file=zig-out/bin/kernel8.elf,addr=0x1000000,force-raw=true", }); //FIXME: This is temporary while we test (Wonder if we can do this based on some per-test config?) run_qemu.addArgs(&[_][]const u8{ "-device", "loader,file=../tools/ext2fs/data/test1.img,addr=0x2000000,force-raw=true", }); // Can we configure a gdb option? Which would launch gdb, connect it to qemu and have it ready to go qemu.dependOn(b.default_step); qemu.dependOn(&run_objdump.step); qemu.dependOn(&run_create_syms.step); qemu.dependOn(&run_qemu.step); b.installArtifact(exe); b.default_step.dependOn(&run_objdump.step); b.default_step.dependOn(&run_create_syms.step); }
kernel/build.zig
const program_version = "0.0.0"; // TODO const program_name = "st"; const std = @import("std"); const clap = @import("deps/clap"); const cfg = @import("config.zig"); const c = @import("c.zig"); const st = @import("st.zig"); const Bitset = @import("util.zig").Bitset; const Glyph = st.Glyph; pub const Shortcut = struct { mod: u32, keysym: c.KeySym, func: fn (*const Arg) void, arg: Arg, pub fn init(mod: u32, keysym: c.KeySym, func: fn (*const Arg) void, arg: Arg) Shortcut { return .{ .mod = mod, .keysym = keysym, .func = func, .arg = arg }; } }; pub const MouseShortcut = struct { b: u32, mask: u32, s: [*:0]const u8, pub fn init(b: u32, mask: u32, s: [*:0]const u8) MouseShortcut { return .{ .b = b, .mask = mask, .s = s }; } }; pub const Key = struct { k: c.KeySym, mask: u32, s: [*:0]const u8, // three-valued logic variables: 0 indifferent, 1 on, -1 off appkey: i3, appcursor: i3, pub fn init(k: c.KeySym, mask: u32, s: [*:0]const u8, appkey: i3, appcursor: i3) Key { return .{ .k = k, .mask = mask, .s = s, .appkey = appkey, .appcursor = appcursor }; } }; pub const XK_ANY_MOD = std.math.maxInt(u32); pub const XK_NO_MOD: u32 = 0; pub const XK_SWITCH_MOD: u32 = 1 << 13; const Arg = st.Arg; const die = st.die; const XEMBED_FOCUS_IN = 4; const XEMBED_FOCUS_OUT = 4; const WindowMode = Bitset(enum { Visible, Focused, AppKeypad, MouseButton, MouseMotion, Reverse, KeyboardLock, Hide, AppCursor, MouseSGR, @"8Bit", Blink, FBlink, Focus, MouseX10, MouseMany, BrcktPaste, Numlock, }); const winmode_mouse = &WindowMode.init_with(.{ .MouseButton, .MouseMotion, .MouseX10, .MouseMany }); // Purely graphic info const TermWindow = struct { /// tty width and height tw: u32, th: u32, /// window width and height w: u32, h: u32, /// char height ch: u32, /// char width cw: u32, /// window state/mode flags mode: WindowMode, /// cursor style cursor: u32 = cursorshape, }; const XWindow = struct { dpy: *c.Display, cmap: c.Colormap, win: c.Window, buf: c.Drawable, /// font spec buffer used for rendering specbuf: [*]c.XftGlyphFontSpec, xembed: c.Atom, wmdeletewin: c.Atom, netwmname: c.Atom, netwmpid: c.Atom, xim: c.XIM, xic: c.XIC, draw: *c.XftDraw, vis: *c.Visual, attrs: c.XSetWindowAttributes, scr: c_int, /// is fixed geometry? isfixed: bool = false, l: c_int = 0, t: c_int = 0, gm: c_int, }; const XSelection = struct { xtarget: c.Atom, primary: ?[*:0]u8, clipboard: ?[*:0]u8, tclick1: c.timespec, tclick2: c.timespec, }; const Font = struct { height: u32, width: u32, ascent: u32, descent: u32, badslant: u32, badweight: u32, lbearing: u16, rbearing: u16, match: *c.XftFont, set: ?*c.FcFontSet, pattern: *c.FcPattern, }; const DrawingContext = struct { col: []c.XftColor, font: Font, bfont: Font, ifont: Font, ibfont: Font, gc: c.GC, }; const handler = comptime blk: { var h = [_]?(fn (*c.XEvent) void){null} ** c.LASTEvent; h[c.KeyPress] = kpress; h[c.ClientMessage] = cmessage; h[c.ConfigureNotify] = resize; h[c.VisibilityNotify] = visibility; h[c.UnmapNotify] = unmap; h[c.Expose] = expose; h[c.FocusIn] = focus; h[c.FocusOut] = focus; h[c.MotionNotify] = bmotion; h[c.ButtonPress] = bpress; h[c.ButtonRelease] = brelease; // Uncomment if you want the selection to disappear when you select something // different in another window. // h[c.SelectionClear] = selclear_; h[c.SelectionNotify] = selnotify; // PropertyNotify is only turned on when there is some INCR transfer happening // for the selection retrieval. h[c.PropertyNotify] = propnotify; h[c.SelectionRequest] = selrequest; break :blk h; }; // Globals var dc: DrawingContext = undefined; var xw: XWindow = undefined; var xsel: XSelection = undefined; var win: TermWindow = undefined; const Fontcache = struct { font: *c.XftFont, flags: u32, unicodep: st.Rune, }; var frc: []Fontcache = undefined; var frccap: usize = 0; var usedfont: [*:0]const u8 = undefined; var usedfontsize: f64 = 0; var defaultfontsize: f64 = 0; var opt_class: ?[*:0]const u8 = null; var opt_cmd: ?[*:null]?[*:0]const u8 = null; var opt_embed: ?[*:0]const u8 = null; var opt_font: ?[*:0]const u8 = null; var opt_io: ?[*:0]const u8 = null; var opt_line: ?[*:0]const u8 = null; var opt_name: ?[*:0]const u8 = null; // guaranteed by main to be nonnull var opt_title: ?[*:0]const u8 = null; pub fn clipcopy(_: *const Arg) void { c.free(xsel.clipboard); xsel.clipboard = null; if (xsel.primary) |prim| { xsel.clipboard = st.xstrdup(prim); const clipboard = c.XInternAtom(xw.dpy, "CLIPBOARD", 0); _ = c.XSetSelectionOwner(xw.dpy, clipboard, xw.win, c.CurrentTime); } } pub fn clippaste(_: *const Arg) void { const clipboard = c.XInternAtom(xw.dpy, "CLIPBOARD", 0); _ = c.XConvertSelection( xw.dpy, clipboard, xsel.xtarget, clipboard, xw.win, c.CurrentTime, ); } pub fn selpaste(_: *const Arg) void { _ = c.XConvertSelection( xw.dpy, c.XA_PRIMARY, xsel.xtarget, c.XA_PRIMARY, xw.win, c.CurrentTime, ); } pub fn numlock(_: *const Arg) void { win.mode.toggle(.Numlock); } pub fn zoom(arg: *const Arg) void { const larg = Arg{ .f = usedfontsize + arg.f }; zoomabs(&larg); } pub fn zoomabs(arg: *const Arg) void { xunloadfonts(); xloadfonts(usedfont, arg.f); cresize(0, 0); st.redraw(); xhints(); } pub fn zoomreset(dummy: *const Arg) void { if (defaultfontsize > 0) { const larg = Arg{ .f = defaultfontsize }; zoomabs(&larg); } } fn evcol(e: *c.XEvent) u32 { var x = @intCast(u32, e.xbutton.x) - cfg.borderpx; x = st.limit(x, 0, win.tw - 1); return x / win.cw; } fn evrow(e: *c.XEvent) u32 { var y = @intCast(u32, e.xbutton.y) - cfg.borderpx; y = st.limit(y, 0, win.th - 1); return y / win.ch; } fn mousesel(e: *c.XEvent, done: c_int) void { const state = e.xbutton.state & ~@as(c_uint, c.Button1Mask | cfg.forceselmod); const seltype = for (cfg.selmasks[1..]) |mask, typ| { if (match(mask, state)) { break @intToEnum(st.SelectionType, @intCast(u2, typ)); } } else st.SelectionType.Regular; st.selextend(evcol(e), evrow(e), seltype, done != 0); if (done != 0) setsel(st.getsel(), e.xbutton.time); } var mousereport_ox: u32 = 0; var mousereport_oy: u32 = 0; var oldbutton: u32 = 3; // button event on startup: 3 = release fn mousereport(e: *c.XEvent) void { const x = evcol(e); const y = evcol(e); var button = e.xbutton.button; // from urxvt if (e.xbutton.@"type" == c.MotionNotify) { if (x == mousereport_ox and y == mousereport_oy) return; if (!win.mode.get(.MouseMotion) and !win.mode.get(.MouseMany)) return; // MOUSE_MOTION: no reporting if no button is pressed if (win.mode.get(.MouseMotion) and oldbutton == 3) return; button = oldbutton + 32; mousereport_ox = x; mousereport_oy = y; } else { if (!win.mode.get(.MouseSGR) and e.xbutton.@"type" == c.ButtonRelease) { button = 3; } else { button -= c.Button1; if (button >= 3) button += 64 - 3; } if (e.xbutton.@"type" == c.ButtonPress) { oldbutton = button; mousereport_ox = x; mousereport_oy = y; } else if (e.xbutton.@"type" == c.ButtonRelease) { oldbutton = 3; // WindowMode.MouseX10: no button release reporting if (win.mode.get(.MouseX10)) return; if (button == 64 or button == 65) return; } } const state = e.xbutton.state; if (!win.mode.get(.MouseX10)) { button += @as(c_uint, if (state & c.ShiftMask != 0) 4 else 0) // + @as(c_uint, if (state & c.Mod4Mask != 0) 8 else 0) // + @as(c_uint, if (state & c.ControlMask != 0) 16 else 0); } var buf: [40]u8 = undefined; const esc_str = if (win.mode.get(.MouseSGR)) std.fmt.bufPrint(&buf, "\x1b[<{};{};{}{c}", .{ button, x + 1, y + 1, @as(u8, if (e.xbutton.@"type" == c.ButtonRelease) 'm' else 'M'), }) catch unreachable else if (x < 223 and y < 223) std.fmt.bufPrint(&buf, "\x1b[m{c}{c}{c}", .{ @intCast(u8, 32 + button), @intCast(u8, 32 + x + 1), @intCast(u8, 32 + y + 1), }) catch unreachable else return; st.ttywrite(esc_str, false); } fn bpress(e: *c.XEvent) void { var now: c.struct_timespec = undefined; var snap: st.SelectionSnap = undefined; if (win.mode.any(winmode_mouse) and e.xbutton.state & cfg.forceselmod == 0) { mousereport(e); return; } for (cfg.mshortcuts) |ms| { if (e.xbutton.button == ms.b and match(ms.mask, e.xbutton.state)) { st.ttywrite(std.mem.span(ms.s), true); return; } } if (e.xbutton.button == c.Button1) { // If the user clicks below predefined timeouts specific // snapping behaviour is exposed. _ = c.clock_gettime(c.CLOCK_MONOTONIC, &now); if (st.TIMEDIFF(now, xsel.tclick2) <= cfg.tripleclicktimeout) { snap = .SnapLine; } else if (st.TIMEDIFF(now, xsel.tclick1) <= cfg.doubleclicktimeout) { snap = .SnapWord; } else { snap = .None; } xsel.tclick2 = xsel.tclick1; xsel.tclick1 = now; st.selstart(evcol(e), evrow(e), snap); } } fn propnotify(e: *c.XEvent) void { const clipboard = c.XInternAtom(xw.dpy, "CLIPBOARD", 0); const xpev = &e.xproperty; if (xpev.state == c.PropertyNewValue and (xpev.atom == c.XA_PRIMARY or xpev.atom == clipboard)) { selnotify(e); } } fn selnotify(e: *c.XEvent) void { var incratom = c.XInternAtom(xw.dpy, "INCR", 0); var property = if (e.@"type" == c.SelectionNotify) e.xselection.property else if (e.@"type" == c.PropertyNotify) e.xproperty.atom else return; var ofs: usize = 0; while (true) { var typ: c.Atom = undefined; var format: c_int = undefined; var nitems: usize = undefined; var rem: usize = undefined; var data: [*c]u8 = undefined; if (c.XGetWindowProperty( xw.dpy, xw.win, property, @intCast(c_long, ofs), c.BUFSIZ / 4, c.False, c.AnyPropertyType, &typ, &format, &nitems, &rem, &data, ) != 0) { _ = c.fprintf(c.stderr, "Clipboard allocation failed\n"); return; } if (e.@"type" == c.PropertyNotify and nitems == 0 and rem == 0) { // If there is some PropertyNotify with no data, then // this is the signal of the selection owner that all // data has been transferred. We won't need to receive // PropertyNotify events anymore. st.MODBIT(&xw.attrs.event_mask, false, c.PropertyChangeMask); _ = c.XChangeWindowAttributes(xw.dpy, xw.win, c.CWEventMask, &xw.attrs); } if (typ == incratom) { // Activate the PropertyNotify events so we receive // when the selection owner does send us the next // chunk of data. st.MODBIT(&xw.attrs.event_mask, true, c.PropertyChangeMask); _ = c.XChangeWindowAttributes(xw.dpy, xw.win, c.CWEventMask, &xw.attrs); // Deleting the property is the transfer start signal. _ = c.XDeleteProperty(xw.dpy, xw.win, property); continue; } // As seen in getsel: // Line endings are inconsistent in the terminal and GUI world // copy and pasting. When receiving some selection data, // replace all '\n' with '\r'. // FIXME: Fix the computer world. for (data[0 .. nitems * @intCast(usize, format) / 8]) |*ch| { if (ch.* == '\n') ch.* = '\r'; } if (win.mode.get(.BrcktPaste) and ofs == 0) st.ttywrite("\x1b[200~", false); st.ttywrite(data[0 .. nitems * @intCast(usize, format) / 8], true); if (win.mode.get(.BrcktPaste) and rem == 0) st.ttywrite("\x1b[201~", false); _ = c.XFree(data); ofs += nitems * @intCast(usize, format) / 32; if (rem <= 0) break; } // Deleting the property again tells the selection owner to send the // next data chunk in the property. _ = c.XDeleteProperty(xw.dpy, xw.win, property); } fn xclipcopy() void { clipcopy(Arg.None); } fn selclear_(e: *c.XEvent) void { st.selclear(); } fn selrequest(e: *c.XEvent) void { var xsre = @ptrCast(*c.XSelectionRequestEvent, e); var xev: c.XSelectionEvent = undefined; xev.@"type" = c.SelectionNotify; xev.requestor = xsre.requestor; xev.selection = xsre.selection; xev.target = xsre.target; xev.time = xsre.time; if (xsre.property == c.None) xsre.property = xsre.target; // reject xev.property = c.None; const xa_targets = c.XInternAtom(xw.dpy, "TARGETS", 0); if (xsre.target == xa_targets) { // respond with the supported type var string = xsel.xtarget; _ = c.XChangeProperty( xsre.display, xsre.requestor, xsre.property, c.XA_ATOM, 32, c.PropModeReplace, @ptrCast([*]u8, &string), 1, ); xev.property = xsre.property; } else if (xsre.target == xsel.xtarget or xsre.target == c.XA_STRING) { // xith XA_STRING non ascii characters may be incorrect in the // requestor. It is not our problem, use utf8. const clipboard = c.XInternAtom(xw.dpy, "CLIPBOARD", 0); const seltext: ?[*:0]u8 = if (xsre.selection == c.XA_PRIMARY) xsel.primary else if (xsre.selection == clipboard) xsel.clipboard else { _ = c.fprintf(c.stderr, "Unhandled clipboard selection 0x%lx\n", xsre.selection); return; }; if (seltext) |text| { _ = c.XChangeProperty( xsre.display, xsre.requestor, xsre.property, xsre.target, 8, c.PropModeReplace, text, @intCast(c_int, std.mem.len(text)), ); xev.property = xsre.property; } } // all done, send a notification to the listener if (c.XSendEvent( xsre.display, xsre.requestor, 1, 0, @ptrCast(*c.XEvent, &xev), ) == 0) _ = c.fprintf(c.stderr, "Error sending SelectionNotify event\n"); } /// transfers ownership of `str` fn setsel(str: ?[*:0]u8, t: c.Time) void { c.free(xsel.primary); xsel.primary = str; _ = c.XSetSelectionOwner(xw.dpy, c.XA_PRIMARY, xw.win, t); if (c.XGetSelectionOwner(xw.dpy, c.XA_PRIMARY) != xw.win) st.selclear(); } fn xsetsel(str: [*:0]const u8) void { setsel(str, c.CurrentTime); } fn brelease(e: *c.XEvent) void { if (win.mode.any(winmode_mouse) and e.xbutton.state & cfg.forceselmod == 0) { mousereport(e); return; } if (e.xbutton.button == c.Button2) selpaste(Arg.None) else if (e.xbutton.button == c.Button1) mousesel(e, 1); } fn bmotion(e: *c.XEvent) void { if (win.mode.any(winmode_mouse) and e.xbutton.state & cfg.forceselmod == 0) { mousereport(e); return; } mousesel(e, 0); } fn cresize(width: u32, height: u32) void { if (width != 0) win.w = width; if (height != 0) win.h = height; const col = std.math.max(1, (win.w - 2 * cfg.borderpx) / win.cw); const row = std.math.max(1, (win.h - 2 * cfg.borderpx) / win.ch); st.tresize(col, row); xresize(col, row); st.ttyresize(win.tw, win.th); } fn xresize(col: u32, row: u32) void { win.tw = col * win.cw; win.th = col * win.ch; _ = c.XFreePixmap(xw.dpy, xw.buf); xw.buf = c.XCreatePixmap( xw.dpy, xw.win, win.w, win.h, @intCast(c_uint, c._DefaultDepth(xw.dpy, xw.scr)), ); c.XftDrawChange(xw.draw, xw.buf); xclear(0, 0, win.w, win.h); // resize to new width xw.specbuf = @ptrCast([*]c.XftGlyphFontSpec, @alignCast(@alignOf([*]c.XftGlyphFontSpec), st.xrealloc(@ptrCast(*allowzero c_void, xw.specbuf), col * @sizeOf(c.XftGlyphFontSpec)))); } fn sixd_to_16bit(x: u3) u16 { return @intCast(u16, if (x == 0) 0 else 0x3737 + 0x2828 * @intCast(u16, x)); } fn xloadcolor(i: usize, color_name: ?[*:0]u8, ncolor: *c.XftColor) bool { var color: c.XRenderColor = undefined; color.alpha = 0xffff; var name = color_name orelse blk: { if (16 <= i and i <= 255) { if (i < 6 * 6 * 6 + 16) { const step = i - 16; color.red = sixd_to_16bit(@intCast(u3, (step / 36) % 6)); color.green = sixd_to_16bit(@intCast(u3, (step / 6) % 6)); color.blue = sixd_to_16bit(@intCast(u3, (step / 1) % 6)); } else { color.red = @intCast(u16, 0x0808 + 0x0a0a * (i - (6 * 6 * 6 + 16))); color.green = color.red; color.blue = color.red; } return c.XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, ncolor) != 0; } else break :blk cfg.colorname[i]; }; return c.XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor) != 0; } var colors_loaded = false; fn xloadcols() void { if (colors_loaded) { for (dc.col) |*cp| c.XftColorFree(xw.dpy, xw.vis, xw.cmap, cp); } else { dc.col.len = std.math.max(cfg.colorname.len, 256); dc.col.ptr = @ptrCast([*]c.XftColor, @alignCast(@alignOf([*]c.XftColor), st.xmalloc(dc.col.len * @sizeOf(c.XftColor)))); } for (dc.col) |*col, i| if (!xloadcolor(i, null, col)) { if (cfg.colorname[i]) |name| { die("could not allocate color '{}'\n", .{name}); } else { die("could not allocate color {}\n", .{i}); } }; colors_loaded = true; } fn xsetcolorname(x: u32, name: []const u8) u32 { if (!(0 <= x and x <= dc.collen)) return false; if (!xloadcolor(x, name, &ncolor)) return false; c.XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]); dc.col[x] = ncolor; return true; } // Absolute coordinates. fn xclear(x1: u32, y1: u32, x2: u32, y2: u32) void { c.XftDrawRect( xw.draw, &dc.col[if (win.mode.get(.Reverse)) cfg.defaultfg else cfg.defaultbg], @intCast(c_int, x1), @intCast(c_int, y1), x2 - x1, y2 - y1, ); } fn xhints() void { // another monstrosity because i'm sure XClassHint fields aren't actually mutated var class: c.XClassHint = .{ .res_name = @intToPtr([*c]u8, @ptrToInt(opt_name orelse cfg.termname)), .res_class = @intToPtr([*c]u8, @ptrToInt(opt_class orelse cfg.termname)), }; var wm: c.XWMHints = .{ .flags = c.InputHint, .input = 1, .initial_state = 0, .icon_pixmap = 0, .icon_window = 0, .icon_x = 0, .icon_y = 0, .icon_mask = 0, .window_group = 0, }; var sizeh: *c.XSizeHints = c.XAllocSizeHints().?; sizeh.flags = c.PSize | c.PResizeInc | c.PBaseSize | c.PMinSize; sizeh.height = @intCast(c_int, win.h); sizeh.width = @intCast(c_int, win.w); sizeh.height_inc = @intCast(c_int, win.ch); sizeh.width_inc = @intCast(c_int, win.cw); sizeh.base_height = 2 * cfg.borderpx; sizeh.base_width = 2 * cfg.borderpx; sizeh.min_height = @intCast(c_int, win.ch) + 2 * cfg.borderpx; sizeh.min_width = @intCast(c_int, win.cw) + 2 * cfg.borderpx; if (xw.isfixed) { sizeh.flags |= c.PMaxSize; sizeh.min_width = @intCast(c_int, win.w); sizeh.max_width = @intCast(c_int, win.w); sizeh.min_height = @intCast(c_int, win.h); sizeh.max_height = @intCast(c_int, win.h); } if (xw.gm & (c.XValue | c.YValue) != 0) { sizeh.flags |= c.USPosition | c.PWinGravity; sizeh.x = @intCast(c_int, xw.l); sizeh.y = @intCast(c_int, xw.t); sizeh.win_gravity = xgeommasktogravity(xw.gm); } c.XSetWMProperties(xw.dpy, xw.win, null, null, null, 0, sizeh, &wm, &class); _ = c.XFree(@ptrCast(?*c_void, sizeh)); } fn xgeommasktogravity(mask: c_int) c_int { return switch (mask & (c.XNegative | c.YNegative)) { 0 => c.NorthWestGravity, c.XNegative => c.NorthEastGravity, c.YNegative => c.SouthWestGravity, else => c.SouthEastGravity, }; } fn xloadfont(f: *Font, pattern: *c.FcPattern) bool { var configured = c.FcPatternDuplicate(pattern) orelse return false; _ = c.FcConfigSubstitute(null, configured, .FcMatchPattern); c.XftDefaultSubstitute(xw.dpy, xw.scr, configured); var result: c.FcResult = undefined; var font_match = c.FcFontMatch(null, configured, &result) orelse { c.FcPatternDestroy(configured); return false; }; f.match = c.XftFontOpenPattern(xw.dpy, font_match) orelse { c.FcPatternDestroy(configured); c.FcPatternDestroy(font_match); return false; }; var wantattr: c_int = undefined; var haveattr: c_int = undefined; if (c.XftPatternGetInteger(pattern, "slant", 0, &wantattr) == .FcResultMatch) { // Check if xft was unable to find a font with the appropriate // slant but gave us one anyway. Try to mitigate. if (c.XftPatternGetInteger(f.match.pattern, "slant", 0, &haveattr) != .FcResultMatch or haveattr < wantattr) { f.badslant = 1; _ = c.fputs("font slant does not match\n", c.stderr); } } if (c.XftPatternGetInteger(pattern, "weight", 0, &wantattr) == .FcResultMatch) { if (c.XftPatternGetInteger(f.match.pattern, "weight", 0, &haveattr) != .FcResultMatch or haveattr != wantattr) { f.badweight = 1; _ = c.fputs("font weight does not match\n", c.stderr); } } var extents: c.XGlyphInfo = undefined; c.XftTextExtentsUtf8( xw.dpy, f.match, @ptrCast([*]const c.FcChar8, &cfg.ascii_printable), cfg.ascii_printable.len, &extents, ); f.set = null; f.pattern = configured; f.ascent = @intCast(u32, f.match.ascent); f.descent = @intCast(u32, f.match.descent); f.lbearing = 0; f.rbearing = @intCast(u16, f.match.max_advance_width); f.height = f.ascent + f.descent; f.width = @intCast(u32, st.divceil(extents.xOff, cfg.ascii_printable.len)); return true; } fn xloadfonts(fontstr: [*:0]const u8, fontsize: f64) void { var fontval: f64 = undefined; const maybe_pattern = if (fontstr[0] == '-') c.XftXlfdParse(fontstr, 0, 0) else c.FcNameParse(@ptrCast([*c]const c.FcChar8, @alignCast(@alignOf(c.FcChar8), fontstr))); const pattern = maybe_pattern orelse die("can't open font {}\n", .{fontstr}); if (fontsize > 1) { _ = c.FcPatternDel(pattern, c.FC_PIXEL_SIZE); _ = c.FcPatternDel(pattern, c.FC_SIZE); _ = c.FcPatternAddDouble(pattern, c.FC_PIXEL_SIZE, fontsize); usedfontsize = fontsize; } else { if (c.FcPatternGetDouble(pattern, c.FC_PIXEL_SIZE, 0, &fontval) == .FcResultMatch) { usedfontsize = fontval; } else if (c.FcPatternGetDouble(pattern, c.FC_SIZE, 0, &fontval) == .FcResultMatch) { usedfontsize = -1; } else { // Default font size is 12, if none given. This is to // have a known usedfontsize value. _ = c.FcPatternAddDouble(pattern, c.FC_PIXEL_SIZE, 12); usedfontsize = 12; } defaultfontsize = usedfontsize; } if (!xloadfont(&dc.font, pattern)) die("can't open font {}\n", .{fontstr}); if (usedfontsize < 0) { _ = c.FcPatternGetDouble(dc.font.match.pattern, c.FC_PIXEL_SIZE, 0, &fontval); usedfontsize = fontval; if (fontsize == 0) defaultfontsize = fontval; } // Setting character width and height. win.cw = @floatToInt(u32, std.math.ceil(@intToFloat(f64, dc.font.width) * cfg.cwscale)); win.ch = @floatToInt(u32, std.math.ceil(@intToFloat(f64, dc.font.height) * cfg.chscale)); _ = c.FcPatternDel(pattern, c.FC_SLANT); _ = c.FcPatternAddInteger(pattern, c.FC_SLANT, c.FC_SLANT_ITALIC); if (!xloadfont(&dc.ifont, pattern)) die("can\'t open font {}\n", .{fontstr}); _ = c.FcPatternDel(pattern, c.FC_WEIGHT); _ = c.FcPatternAddInteger(pattern, c.FC_WEIGHT, c.FC_WEIGHT_BOLD); if (!xloadfont(&dc.ibfont, pattern)) die("can\'t open font {}\n", .{fontstr}); _ = c.FcPatternDel(pattern, c.FC_SLANT); _ = c.FcPatternAddInteger(pattern, c.FC_SLANT, c.FC_SLANT_ROMAN); if (!xloadfont(&dc.bfont, pattern)) die("can\'t open font {}\n", .{fontstr}); c.FcPatternDestroy(pattern); } fn xunloadfont(f: *Font) void { c.XftFontClose(xw.dpy, f.match); c.FcPatternDestroy(f.pattern); if (f.set) |set| c.FcFontSetDestroy(set); } fn xunloadfonts() void { // Free the loaded fonts in the dont cache. while (frc.len > 0) { c.XftFontClose(xw.dpy, frc[frc.len - 1].font); frc.len -= 1; } xunloadfont(&dc.font); xunloadfont(&dc.bfont); xunloadfont(&dc.ifont); xunloadfont(&dc.ibfont); } fn ximopen(dpy: *c.Display) void { var destroy: c.XIMCallback = .{ .client_data = null, .callback = ximdestroy, }; xw.xim = c.XOpenIM(xw.dpy, null, null, null); if (xw.xim == null) { _ = c.XSetLocaleModifiers("@im=local"); xw.xim = c.XOpenIM(xw.dpy, null, null, null); if (xw.xim == null) { _ = c.XSetLocaleModifiers("@im="); xw.xim = c.XOpenIM(xw.dpy, null, null, null); if (xw.xim == null) die("XOpenIM failed. Could not open input device.\n", .{}); } } if (c.XSetIMValues(xw.xim, c.XNDestroyCallback, &destroy, null) != null) die("XSetIMValues failed. Could not set input method value.\n", .{}); xw.xic = c.XCreateIC( xw.xim, c.XNInputStyle, c.XIMPreeditNothing | c.XIMStatusNothing, c.XNClientWindow, xw.win, c.XNFocusWindow, xw.win, null, ); if (xw.xic == null) die("XCreateIC failed. Could not obtain input method.\n", .{}); } fn ximinstantiate(dpy: ?*c.Display, client: c.XPointer, call: c.XPointer) callconv(.C) void { ximopen(dpy.?); _ = c.XUnregisterIMInstantiateCallback(xw.dpy, null, null, null, ximinstantiate, null); } fn ximdestroy(xim: c.XIM, client: c.XPointer, call: c.XPointer) callconv(.C) void { xw.xim = null; _ = c.XRegisterIMInstantiateCallback(xw.dpy, null, null, null, ximinstantiate, null); } fn xinit(cols: u32, rows: u32) void { xw.dpy = c.XOpenDisplay(null) orelse die("can't open display\n", .{}); xw.scr = c.XDefaultScreen(xw.dpy); xw.vis = c.XDefaultVisual(xw.dpy, xw.scr); // font if (c.FcInit() == 0) die("could not init fontconfig\n", .{}); usedfont = opt_font orelse cfg.font; xloadfonts(usedfont, 0); // colors xw.cmap = c.XDefaultColormap(xw.dpy, xw.scr); xloadcols(); // adjust fixed window geometry win.w = 2 * cfg.borderpx + cols * win.cw; win.h = 2 * cfg.borderpx + rows * win.ch; if (xw.gm & c.XNegative != 0) xw.l += c._DisplayWidth(xw.dpy, xw.scr) - @intCast(c_int, win.w) - 2; if (xw.gm & c.YNegative != 0) xw.t += c._DisplayHeight(xw.dpy, xw.scr) - @intCast(c_int, win.h) - 2; // Events xw.attrs.background_pixel = dc.col[cfg.defaultbg].pixel; xw.attrs.border_pixel = dc.col[cfg.defaultbg].pixel; xw.attrs.bit_gravity = c.NorthWestGravity; xw.attrs.event_mask = c.FocusChangeMask | c.KeyPressMask | c.KeyReleaseMask | c.ExposureMask | c.VisibilityChangeMask | c.StructureNotifyMask | c.ButtonMotionMask | c.ButtonPressMask | c.ButtonReleaseMask; xw.attrs.colormap = xw.cmap; var parent = if (opt_embed) |embed| @intCast(c_ulong, c.strtol(embed, null, 0)) else c.XRootWindow(xw.dpy, xw.scr); xw.win = c.XCreateWindow(xw.dpy, parent, xw.l, xw.t, win.w, win.h, 0, c.XDefaultDepth(xw.dpy, xw.scr), c.InputOutput, xw.vis, c.CWBackPixel | c.CWBorderPixel | c.CWBitGravity | c.CWEventMask | c.CWColormap, &xw.attrs); var gcvalues: c.XGCValues = undefined; std.mem.set(u8, std.mem.asBytes(&gcvalues), 0); gcvalues.graphics_exposures = c.False; dc.gc = c.XCreateGC(xw.dpy, parent, c.GCGraphicsExposures, &gcvalues); xw.buf = c.XCreatePixmap(xw.dpy, xw.win, win.w, win.h, @intCast(c_uint, c._DefaultDepth(xw.dpy, xw.scr))); _ = c.XSetForeground(xw.dpy, dc.gc, dc.col[cfg.defaultbg].pixel); _ = c.XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); // font spec buffer xw.specbuf = @ptrCast([*]c.XftGlyphFontSpec, @alignCast(@alignOf([*]c.XftGlyphFontSpec), st.xmalloc(cols * @sizeOf(c.XftGlyphFontSpec)))); // Xft rendering context xw.draw = c.XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap).?; // input methods ximopen(xw.dpy); // white cursor, black outline var cursor = c.XCreateFontCursor(xw.dpy, cfg.mouseshape); _ = c.XDefineCursor(xw.dpy, xw.win, cursor); var xmousefg: c.XColor = undefined; var xmousebg: c.XColor = undefined; if (c.XParseColor(xw.dpy, xw.cmap, cfg.colorname[cfg.mousefg], &xmousefg) == 0) { xmousefg.red = 0xffff; xmousefg.green = 0xffff; xmousefg.blue = 0xffff; } if (c.XParseColor(xw.dpy, xw.cmap, cfg.colorname[cfg.mousebg], &xmousebg) == 0) { xmousebg.red = 0x0000; xmousebg.green = 0x0000; xmousebg.blue = 0x0000; } _ = c.XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg); xw.xembed = c.XInternAtom(xw.dpy, "_XEMBED", c.False); xw.wmdeletewin = c.XInternAtom(xw.dpy, "WM_DELETE_WINDOW", c.False); xw.netwmname = c.XInternAtom(xw.dpy, "_NET_WM_NAME", c.False); _ = c.XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1); xw.netwmpid = c.XInternAtom(xw.dpy, "_NET_WM_PID", c.False); var thispid = c.getpid(); _ = c.XChangeProperty(xw.dpy, xw.win, xw.netwmpid, c.XA_CARDINAL, 32, c.PropModeReplace, @ptrCast(*u8, &thispid), 1); win.mode = WindowMode.init_with(.{.Numlock}); resettitle(); _ = c.XMapWindow(xw.dpy, xw.win); xhints(); _ = c.XSync(xw.dpy, c.False); _ = c.clock_gettime(c.CLOCK_MONOTONIC, &xsel.tclick1); _ = c.clock_gettime(c.CLOCK_MONOTONIC, &xsel.tclick2); xsel.primary = null; xsel.clipboard = null; xsel.xtarget = c.XInternAtom(xw.dpy, "UTF8_STRING", 0); if (xsel.xtarget == c.None) xsel.xtarget = c.XA_STRING; } fn xmakeglyphfontspecs(specs: [*]c.XftGlyphFontSpec, glyphs: *const Glyph, len: usize, x: u32, y: u32) u32 { @compileError("TODO xmakeglyphfontspecs"); } fn xdrawglyphdfontspecs(specs: [*]c.XftGlyphFontSpec, base: Glyph, len: usize, x: u32, y: u32) void { @compileError("TODO xdrawglyphdfontspecs"); } fn xdrawglyph(g: Glyph, x: u32, y: u32) void { var spec: c.XftGlyphFontSpec = undefined; const numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); xdrawglyphfontspecs(&spec, g, numspecs, x, y); } pub fn xdrawcursor(cx: u32, xy: u32, g: Glyph, ox: u32, oy: u32, og: Glyph) void { @compileError("TODO xdrawcursor"); } fn xsetenv() void { // enough for max u64 var buf: [64]u8 = undefined; _ = std.fmt.formatIntBuf(buf[0..], xw.win, 10, false, .{}); _ = c.setenv("WINDOWID", &buf, 1); } fn resettitle() void { xsettitle(null); } fn xsettitle(p: ?[*:0]const u8) void { // this monstrosity is to get rid of the const qualifier for // the Xutf8TextListToTextProperty call, but should actually be safe var title = @intToPtr([*c]u8, @ptrToInt(p orelse opt_title.?)); var prop: c.XTextProperty = undefined; _ = c.Xutf8TextListToTextProperty(xw.dpy, &title, 1, .XUTF8StringStyle, &prop); c.XSetWMName(xw.dpy, xw.win, &prop); c.XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname); _ = c.XFree(@ptrCast(?*c_void, prop.value)); } pub fn xstartdraw() bool { return win.mode.get(.Visible); } pub fn xdrawline(line: st.Line, x1: u32, y1: u32, x2: u32) void { var specs = xw.specbuf; var numspecs = xmakeglyphfontspecs(specs, &line[x1], x2 - x1, x1, y1); var base: Glyph = undefined; var i: u32 = 0; var ox: u32 = 0; var x = x1; while (x < x2 and i < numspecs) : (x += 1) { var new = line[x]; if (new.mode.bits == st.Attr.singleton(.WDummy).bits) continue; if (st.selected(x, y1)) new.mode.toggle(.Reverse); if (i > 0 and st.ATTRCMP(base, new)) { xdrawglyphdfontspecs(specs, base, i, ox, y1); specs += i; numspecs -= i; i = 0; } if (i == 0) { ox = x; base = new; } i += 1; } if (i > 0) xdrawglyphdfontspecs(specs, base, i, ox, y1); } pub fn xfinishdraw() void { _ = c.XCopyArea( xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, win.w, win.h, 0, 0, ); _ = c.XSetForeground( xw.dpy, dc.gc, dc.col[if (win.mode.get(.Reverse)) cfg.defaultfg else cfg.defaultbg].pixel, ); } pub fn xximspot(x: u32, y: u32) void { const spot: c.XPoint = .{ .x = @intCast(c_short, cfg.borderpx + x * win.cw), .y = @intCast(c_short, cfg.borderpx + (y + 1) * win.ch), }; const attr = c.XVaCreateNestedList(0, c.XNSpotLocation, &spot, null); _ = c.XSetICValues(xw.xic, c.XNPreeditAttributes, attr, null); _ = c.XFree(attr); } fn expose(ev: *c.XEvent) void { st.redraw(); } fn visibility(ev: *c.XEvent) void { var e = &ev.xvisibility; win.mode.set(.Visible, e.state != c.VisibilityFullyObscured); } fn unmap(ev: *c.XEvent) void { win.mode.set(.Visible, false); } fn xsetpointermotion(set: bool) void { st.MODBIT(xw.attrs.event_mask, set, c.PointerMotionMask); _ = c.XChangeWindowAttributes(xw.dpy, xw.win, c.CWEventMask, &xw.attrs); } fn xsetmode(set: bool, flags: WindowMode) void { const old_mode = win.mode; win.mode.setAll(flags, set); if (win.mode.get(.Reverse) != old_mode.get(.Reverse)) redraw(); } fn xsetcursor(cursor: u32) bool { const cur = if (cursor != 0) cursor else 1; if (!(0 <= cur and cur <= 6)) return false; win.cursor = cur; return true; } fn xseturgency(add: bool) void { var h = @as(?*c.XWMHints, c.XGetWMHints(xw.dpy, xw.win)) orelse unreachable; st.MODBIT(&h.flags, add, c.XUrgencyHint); _ = c.XSetWMHints(xw.dpy, xw.win, h); _ = c.XFree(h); } fn xbell() void { if (!win.mode.get(.Focused)) xseturgency(true); if (cfg.bellvolume != 0) _ = c.XkbBell(xw.dpy, xw.win, cfg.bellvolume, @as(c.Atom, null)); } fn focus(ev: *c.XEvent) void { var e = &ev.xfocus; if (e.mode == c.NotifyGrab) return; if (ev.@"type" == c.FocusIn) { c.XSetICFocus(xw.xic); win.mode.set(.Focused, true); xseturgency(false); if (win.mode.get(.Focus)) st.ttywrite("\x1b[I", false); } else { c.XUnsetICFocus(xw.xic); win.mode.set(.Focused, false); if (win.mode.get(.Focus)) st.ttywrite("\x1b[O", false); } } fn match(mask: u32, state: u32) bool { return mask == XK_ANY_MOD or mask == (state & ~cfg.ignoremod); } fn kmap(k: c.KeySym, state: u32) ?[*:0]const u8 { for (cfg.mappedkeys) |mk| { if (mk == k) break; } else { if ((k & 0xFFFF) < 0xFD00) return null; } for (cfg.key) |kp| { if (kp.k != k) continue; if (!match(kp.mask, state)) continue; if (if (win.mode.get(.AppKeypad)) kp.appkey < 0 else kp.appkey > 0) continue; if (win.mode.get(.Numlock) and kp.appkey == 2) continue; if (if (win.mode.get(.AppCursor)) kp.appcursor < 0 else kp.appcursor > 0) continue; return kp.s; } return null; } fn kpress(ev: *c.XEvent) void { var e = &ev.xkey; var ksym: c.KeySym = undefined; var buf: [32]u8 = undefined; var status: c_int = undefined; if (win.mode.get(.KeyboardLock)) return; var len = @intCast(usize, c.XmbLookupString(xw.xic, e, &buf, @sizeOf([32]u8), &ksym, &status)); // 1. shortcuts for (cfg.shortcuts) |bp| { if ((ksym == bp.keysym) and match(bp.mod, e.state)) { bp.func(&bp.arg); return; } } // 2. custom keys from config.h if (kmap(ksym, e.state)) |customkey| { st.ttywrite(std.mem.span(customkey), true); return; } // 3. composed string from input method if (len == 0) return; if (len == 1 and e.state & c.Mod1Mask != 0) { if (win.mode.get(.@"8Bit")) { if (buf[0] < 127) { var ch: st.Rune = buf[0] | 0x80; len = st.utf8encode(ch, @ptrCast([*:0]u8, &buf)); } } else { buf[1] = buf[0]; buf[0] = '\x1b'; len = 2; } } st.ttywrite(buf[0..len], true); } fn cmessage(e: *c.XEvent) void { // See xembed specs // http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html if (e.xclient.message_type == xw.xembed and e.xclient.format == 32) { if (e.xclient.data.l[1] == XEMBED_FOCUS_IN) { win.mode.set(.Focused, true); xseturgency(false); } else if (e.xclient.data.l[1] == XEMBED_FOCUS_OUT) { win.mode.set(.Focused, false); } } else if (e.xclient.data.l[0] == xw.wmdeletewin) { st.ttyhangup(); std.os.exit(0); } } fn resize(e: *c.XEvent) void { if (e.xconfigure.width == win.w and e.xconfigure.height == win.h) return; cresize(@intCast(u32, e.xconfigure.width), @intCast(u32, e.xconfigure.height)); } fn run() void { var xfd = c.XConnectionNumber(xw.dpy); var w: u32 = undefined; var h: u32 = undefined; var ev: c.XEvent = undefined; // Waiting for window mapping while (true) { _ = c.XNextEvent(xw.dpy, &ev); // This XFilterEvent call is required because of XOpenIM. It // does filter out the key event and some client message for // the input method too. if (c.XFilterEvent(&ev, c.None) != 0) continue; if (ev.@"type" == c.ConfigureNotify) { w = @intCast(u32, ev.xconfigure.width); h = @intCast(u32, ev.xconfigure.height); } if (ev.@"type" == c.MapNotify) break; } var ttyfd = st.ttynew(opt_line, cfg.shell, opt_io, opt_cmd); cresize(w, h); var last: c.struct_timespec = undefined; _ = c.clock_gettime(c.CLOCK_MONOTONIC, &last); var lastblink = last; var xev: u32 = cfg.actionfps; while (true) { var rfd: c.fd_set = undefined; c._FD_ZERO(&rfd); c._FD_SET(ttyfd, &rfd); c._FD_SET(xfd, &rfd); var tv: ?*c.struct_timespec = null; if (c.pselect(std.math.max(xfd, ttyfd) + 1, &rfd, null, null, tv, null) < 0) { if (std.c._errno().* == c.EINTR) continue; die("select falied: {}\n", .{c.strerror(std.c._errno().*)}); } var blinkset: bool = undefined; if (c._FD_ISSET(ttyfd, &rfd)) { _ = st.ttyread(); if (cfg.blinktimeout != 0) { blinkset = st.tattrset(.Blink); if (blinkset) win.mode.set(.Blink, false); } } if (c._FD_ISSET(xfd, &rfd)) xev = cfg.actionfps; var now: c.struct_timespec = undefined; _ = c.clock_gettime(c.CLOCK_MONOTONIC, &now); var drawtimeout: c.struct_timespec = .{ .tv_sec = 0, .tv_nsec = @divTrunc(1000 * 1_000_000, cfg.xfps), }; tv = &drawtimeout; var dodraw = false; if (cfg.blinktimeout != 0 and st.TIMEDIFF(now, lastblink) > cfg.blinktimeout) { st.tsetdirtattr(.Blink); win.mode.toggle(.Blink); lastblink = now; dodraw = true; } var deltatime = st.TIMEDIFF(now, last); if (deltatime > @divTrunc(1000, @as(u32, if (xev != 0) cfg.xfps else cfg.actionfps))) { dodraw = true; last = now; } if (dodraw) { while (c.XPending(xw.dpy) != 0) { _ = c.XNextEvent(xw.dpy, &ev); if (c.XFilterEvent(&ev, c.None) != 0) continue; if (handler[@intCast(usize, ev.@"type")]) |handlerfn| handlerfn(&ev); } st.draw(); _ = c.XFlush(xw.dpy); if (xev != 0 and !c._FD_ISSET(xfd, &rfd)) xev -= 1; if (!c._FD_ISSET(ttyfd, &rfd) and !c._FD_ISSET(xfd, &rfd)) { if (blinkset) { drawtimeout.tv_nsec = if (st.TIMEDIFF(now, lastblink) > cfg.blinktimeout) 1000 else 1_000_000 * (cfg.blinktimeout - st.TIMEDIFF(now, lastblink)); drawtimeout.tv_sec = @divTrunc(drawtimeout.tv_nsec, 1_000_000_000); drawtimeout.tv_nsec = @mod(drawtimeout.tv_nsec, 1_000_000_000); } else { tv = null; } } } } } const cmdline_params = comptime blk: { @setEvalBranchQuota(10_000); break :blk [_]clap.Param(clap.Help){ clap.parseParam("-a Disable alternate screens in terminal") catch unreachable, clap.parseParam("-c <class> Defines the window class (default $TERM)") catch unreachable, clap.parseParam("-f <font> xx") catch unreachable, clap.parseParam("-g <geometry> xx") catch unreachable, clap.parseParam("-i xx") catch unreachable, clap.parseParam("-n <nome> xx") catch unreachable, clap.parseParam("-o <iofile> xx") catch unreachable, clap.parseParam("-T <title> xx") catch unreachable, clap.parseParam("-t <title> xx") catch unreachable, clap.parseParam("-w <windowid> xx") catch unreachable, clap.parseParam("-l <line> xx") catch unreachable, clap.parseParam("-v xx") catch unreachable, // clap.parseParam("-e <command> [args] xx") catch unreachable, }; }; pub fn main() !void { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const alloc = &arena.allocator; var args = try clap.parse(clap.Help, cmdline_params[0..], std.heap.page_allocator); var allowaltscreen = cfg.allowaltscreen; var cols: c_uint = cfg.cols; var rows: c_uint = cfg.rows; var stderr = std.io.getStdErr().writer(); defer args.deinit(); if (args.flag("-a")) { allowaltscreen = false; } if (args.option("-c")) |class| { opt_class = (try alloc.dupeZ(u8, class)).ptr; } if (args.option("-f")) |font| { opt_font = (try alloc.dupeZ(u8, font)).ptr; } if (args.option("-g")) |geometry| { xw.gm = c.XParseGeometry((try alloc.dupeZ(u8, geometry)).ptr, &xw.l, &xw.t, &cols, &rows); } if (args.flag("-i")) { xw.isfixed = true; } if (args.option("-n")) |name| { opt_name = (try alloc.dupeZ(u8, name)).ptr; } if (args.option("-o")) |io| { opt_io = (try alloc.dupeZ(u8, io)).ptr; } if (args.option("-l")) |line| { opt_line = (try alloc.dupeZ(u8, line)).ptr; } if (args.option("-T")) |title| { opt_title = (try alloc.dupeZ(u8, title)).ptr; } if (args.option("-t")) |title| { opt_title = (try alloc.dupeZ(u8, title)).ptr; } if (args.option("-w")) |embed| { opt_embed = (try alloc.dupeZ(u8, embed)).ptr; } if (args.flag("-v")) { const exe_name = args.positionals()[0]; die("{} " ++ program_version ++ "\n", .{exe_name}); } // TODO handle -e !!! // if (args.option("-e")) |cmd| { // opt_cmd = ... // } if (opt_title == null) { opt_title = if (opt_line != null) program_name else if (opt_cmd) |cmd| cmd[0].? else program_name; } _ = c.setlocale(c.LC_CTYPE, ""); _ = c.XSetLocaleModifiers(""); cols = std.math.max(cols, 1); rows = std.math.max(rows, 1); st.tnew(cols, rows); xinit(cols, rows); xsetenv(); st.selinit(); run(); return; }
src/main.zig
const std = @import("std"); const panic = std.debug.panic; const assert = std.debug.assert; const os = std.os; const gl = @import("opengl.zig"); const genexp = @import("genexp004.zig"); fn updateFrameStats(window: os.windows.HWND, name: [*:0]const u8) struct { time: f64, delta_time: f32 } { const state = struct { var timer: std.time.Timer = undefined; var previous_time_ns: u64 = 0; var header_refresh_time_ns: u64 = 0; var frame_count: u64 = ~@as(u64, 0); }; if (state.frame_count == ~@as(u64, 0)) { state.timer = std.time.Timer.start() catch unreachable; state.previous_time_ns = 0; state.header_refresh_time_ns = 0; state.frame_count = 0; } const now_ns = state.timer.read(); const time = @intToFloat(f64, now_ns) / std.time.ns_per_s; const delta_time = @intToFloat(f32, now_ns - state.previous_time_ns) / std.time.ns_per_s; state.previous_time_ns = now_ns; if ((now_ns - state.header_refresh_time_ns) >= std.time.ns_per_s) { const t = @intToFloat(f64, now_ns - state.header_refresh_time_ns) / std.time.ns_per_s; const fps = @intToFloat(f64, state.frame_count) / t; const ms = (1.0 / fps) * 1000.0; var buffer = [_]u8{0} ** 128; const buffer_slice = buffer[0 .. buffer.len - 1]; const header = std.fmt.bufPrint( buffer_slice, "[{d:.1} fps {d:.3} ms] {}", .{ fps, ms, name }, ) catch buffer_slice; _ = SetWindowTextA(window, @ptrCast(os.windows.LPCSTR, header.ptr)); state.header_refresh_time_ns = now_ns; state.frame_count = 0; } state.frame_count += 1; return .{ .time = time, .delta_time = delta_time }; } const WS_VISIBLE = 0x10000000; const VK_ESCAPE = 0x001B; const RECT = extern struct { left: os.windows.LONG, top: os.windows.LONG, right: os.windows.LONG, bottom: os.windows.LONG, }; extern "kernel32" fn AdjustWindowRect( lpRect: ?*RECT, dwStyle: os.windows.DWORD, bMenu: bool, ) callconv(.Stdcall) bool; extern "user32" fn SetProcessDPIAware() callconv(.Stdcall) bool; extern "user32" fn SetWindowTextA( hWnd: os.windows.HWND, lpString: os.windows.LPCSTR, ) callconv(.Stdcall) bool; fn processWindowMessage( window: os.windows.HWND, message: os.windows.UINT, wparam: os.windows.WPARAM, lparam: os.windows.LPARAM, ) callconv(.Stdcall) os.windows.LRESULT { const processed = switch (message) { os.windows.user32.WM_DESTROY => blk: { os.windows.user32.PostQuitMessage(0); break :blk true; }, os.windows.user32.WM_KEYDOWN => blk: { if (wparam == VK_ESCAPE) { os.windows.user32.PostQuitMessage(0); break :blk true; } break :blk false; }, else => false, }; return if (processed) null else os.windows.user32.DefWindowProcA(window, message, wparam, lparam); } pub fn main() !void { _ = SetProcessDPIAware(); const winclass = os.windows.user32.WNDCLASSEXA{ .style = 0, .lpfnWndProc = processWindowMessage, .cbClsExtra = 0, .cbWndExtra = 0, .hInstance = @ptrCast(os.windows.HINSTANCE, os.windows.kernel32.GetModuleHandleA(null)), .hIcon = null, .hCursor = null, .hbrBackground = null, .lpszMenuName = null, .lpszClassName = "genexp", .hIconSm = null, }; _ = os.windows.user32.RegisterClassExA(&winclass); const style = os.windows.user32.WS_OVERLAPPED + os.windows.user32.WS_SYSMENU + os.windows.user32.WS_CAPTION + os.windows.user32.WS_MINIMIZEBOX; var rect = RECT{ .left = 0, .top = 0, .right = genexp.window_width, .bottom = genexp.window_height }; _ = AdjustWindowRect(&rect, style, false); const window = os.windows.user32.CreateWindowExA( 0, "genexp", "genexp", style + WS_VISIBLE, -1, -1, rect.right - rect.left, rect.bottom - rect.top, null, null, winclass.hInstance, null, ); gl.init(window); gl.matrixLoadIdentityEXT(gl.PROJECTION); gl.matrixOrthoEXT( gl.PROJECTION, -genexp.window_width * 0.5, genexp.window_width * 0.5, -genexp.window_height * 0.5, genexp.window_height * 0.5, -1.0, 1.0, ); gl.enable(gl.FRAMEBUFFER_SRGB); gl.enable(gl.MULTISAMPLE); var tex_srgb: u32 = undefined; gl.createTextures(gl.TEXTURE_2D_MULTISAMPLE, 1, &tex_srgb); gl.textureStorage2DMultisample( tex_srgb, 8, gl.SRGB8_ALPHA8, genexp.window_width, genexp.window_height, gl.FALSE, ); var fbo_srgb: u32 = undefined; gl.createFramebuffers(1, &fbo_srgb); gl.namedFramebufferTexture(fbo_srgb, gl.COLOR_ATTACHMENT0, tex_srgb, 0); gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, fbo_srgb); gl.clearBufferfv(gl.COLOR, 0, &[_]f32{ 0.0, 0.0, 0.0, 0.0 }); var genexp_state = genexp.GenerativeExperimentState.init(); try genexp.setup(&genexp_state); gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, 0); while (true) { var message = std.mem.zeroes(os.windows.user32.MSG); if (os.windows.user32.PeekMessageA(&message, null, 0, 0, os.windows.user32.PM_REMOVE)) { _ = os.windows.user32.DispatchMessageA(&message); if (message.message == os.windows.user32.WM_QUIT) break; } else { gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, fbo_srgb); const stats = updateFrameStats(window.?, genexp.window_name); genexp.update(&genexp_state, stats.time, stats.delta_time); gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, 0); gl.blitNamedFramebuffer( fbo_srgb, 0, 0, 0, genexp.window_width, genexp.window_height, 0, 0, genexp.window_width, genexp.window_height, gl.COLOR_BUFFER_BIT, gl.NEAREST, ); gl.swapBuffers(); if (gl.getError() != 0) { panic("OpenGL error detected.", .{}); } } } genexp_state.deinit(); gl.deleteTextures(1, &tex_srgb); gl.deleteFramebuffers(1, &fbo_srgb); if (gl.getError() != 0) { panic("OpenGL error detected.", .{}); } gl.deinit(); }
src/main.zig
const std = @import("std"); const api = @import("api.zig"); const EmbedInfo = @import("main.zig").EmbedInfo; var log_file: ?std.fs.File = null; var log_allocator = std.heap.page_allocator; /// The function that gets called when the child plugin /// is first initialized. pub const HotReloadInit = fn ( embed_info: *EmbedInfo, log_fn: HotReloadLog, ) callconv(.Cold) bool; /// The function that gets called when the child plugin /// is about to be destroyed. pub const HotReloadDeinit = fn ( embed_info: *EmbedInfo, ) callconv(.Cold) void; /// The function that gets called when the child plugin /// has already been initialized and is just getting updated. /// Currently we use this to check which AEffect properties /// were changed and don't work with hot reloads. pub const HotReloadUpdate = fn ( embed_info: *EmbedInfo, log_fn: HotReloadLog, ) callconv(.Cold) bool; /// This function get passed _from_ the hot reload wrapper /// to the child plugin. The latter can then use it to /// write to a common log stream across reloads. /// I guess this could be done inside the child plugin itself, /// but this seems more convenient. pub const HotReloadLog = fn ( ptr: [*]u8, len: usize, ) callconv(.Fastcall) void; pub const MetaInfo = struct { watch_path: []const u8, log_file_path: []const u8, }; /// Used during reloads to track how many VST calls were missed. const ReloadDiagnostics = struct { // TODO Maybe track which opcode got skipped skipped_dispatcher: usize = 0, skipped_get_parameter: usize = 0, skipped_set_parameter: usize = 0, skipped_process_replacing: usize = 0, skipped_process_replacing_f64: usize = 0, pub fn format( diagnostics: ReloadDiagnostics, comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: var, ) !void { try writer.print("\n\t Skipped dispatcher calls: {}", .{diagnostics.skipped_dispatcher}); try writer.print("\n\t Skipped get_parameter calls: {}", .{diagnostics.skipped_get_parameter}); try writer.print("\n\t Skipped set_parameter calls: {}", .{diagnostics.skipped_set_parameter}); try writer.print("\n\t Skipped process_replacing calls: {}", .{diagnostics.skipped_process_replacing}); try writer.print("\n\t Skipped process_replacing_f64 calls: {}", .{diagnostics.skipped_process_replacing_f64}); } }; pub const ChildInfo = struct { /// A reference to the shared library of the child plugin. lib: *std.DynLib, init: HotReloadInit, deinit: HotReloadDeinit, update: HotReloadUpdate, dispatcher: api.DispatcherCallback, set_parameter: api.SetParameterCallback, get_parameter: api.GetParameterCallback, process_replacing: api.ProcessCallback, process_replacing_f64: api.ProcessCallbackF64, }; /// Simple reference counter. const Arc = struct { int: std.atomic.Int(usize), pub fn init() Arc { return Arc{ .int = std.atomic.Int(usize).init(0), }; } pub fn acquire(self: *Arc) void { _ = self.int.incr(); } pub fn release(self: *Arc) void { _ = self.int.decr(); } pub fn isLocked(self: *Arc) bool { return self.int.get() > 0; } }; /// Tracks which plugin functions are currently running. /// None of these should ever have a value higher than 1. /// I could just use a bool then, but I want to know when /// shit hits the fan. pub const WhatsRunning = struct { dispatcher: Arc = Arc.init(), set_parameter: Arc = Arc.init(), get_parameter: Arc = Arc.init(), process_replacing: Arc = Arc.init(), process_replacing_f64: Arc = Arc.init(), pub fn isLocked(self: *WhatsRunning) bool { return self.dispatcher.isLocked() or self.set_parameter.isLocked() or self.get_parameter.isLocked() or self.process_replacing.isLocked() or self.process_replacing_f64.isLocked(); } }; pub fn HotReloadWrapper(meta: MetaInfo) type { return struct { const Self = @This(); var reload_diagnostics: ?*ReloadDiagnostics = null; meta: MetaInfo, allocator: *std.mem.Allocator, embed_info: EmbedInfo, child_info: ?ChildInfo, watch_thread: *std.Thread, stop_watching: bool, execute_noops: bool = false, whats_running: WhatsRunning, /// TODO Remove the dummy argument once https://github.com/ziglang/zig/issues/5380 /// gets fixed pub fn generateExports(comptime dummy: void) void { @export(VSTPluginMain, .{ .name = "VSTPluginMain", .linkage = .Strong, }); } /// No-Op functions that are called when no child plugin is currently loaded. /// This happens during reloads, between when the old one is unloaded and /// the new one is initialized. /// /// If reload_diagnostics is a valid pointer, these functions will increment /// the respective counters. pub const Noops = struct { fn dispatcher(effect: *api.AEffect, opcode: i32, index: i32, value: isize, ptr: ?*c_void, opt: f32) callconv(.C) isize { if (reload_diagnostics) |diag| diag.skipped_dispatcher += 1; return 0; } fn setParameter(effect: *api.AEffect, index: i32, parameter: f32) callconv(.C) void { if (reload_diagnostics) |diag| diag.skipped_set_parameter += 1; } fn getParameter(effect: *api.AEffect, indeX: i32) callconv(.C) f32 { if (reload_diagnostics) |diag| diag.skipped_get_parameter += 1; return 0; } fn processReplacing(effect: *api.AEffect, inputs: [*][*]f32, outputs: [*][*]f32, sample_frames: i32) callconv(.C) void { if (reload_diagnostics) |diag| diag.skipped_process_replacing += 1; } fn processReplacingF64(effect: *api.AEffect, inputs: [*][*]f64, outputs: [*][*]f64, sample_frames: i32) callconv(.C) void { if (reload_diagnostics) |diag| diag.skipped_process_replacing_f64 += 1; } }; pub fn generateTopLevelHandlers() type { return struct { pub fn log( comptime level: std.log.Level, comptime scope: @TypeOf(.EnumLiteral), comptime format: []const u8, args: var, ) void { const data = std.fmt.allocPrint(log_allocator, format, args) catch return; defer log_allocator.free(data); const now = std.time.milliTimestamp(); const data2 = std.fmt.allocPrint(log_allocator, "[{d}, {}, {}] {}", .{ now, scope, level, data, }) catch return; defer log_allocator.free(data2); if (log_file) |file| { file.writeAll(data2) catch return; } std.debug.print("{}", .{data2}); } }; } fn VSTPluginMain(callback: api.HostCallback) callconv(.C) ?*api.AEffect { // Open the log file as early as possible const cwd = std.fs.cwd(); log_file = cwd.createFile(meta.log_file_path, .{}) catch return null; // TODO Find out if we can move this allocator to the heap and pass // it to the child plugin. var allocator = std.heap.page_allocator; var self = allocator.create(Self) catch unreachable; self.stop_watching = false; self.execute_noops = false; self.whats_running = .{}; self.meta = meta; self.allocator = allocator; self.embed_info = .{ .host_callback = callback, .effect = undefined, }; const lib_path = self.readLibPath() catch |err| { std.log.emerg(.vst_hot_reload, "Failed to read lib_path from \"{}\": {}\n", .{ self.meta.watch_path, err }); return null; }; defer allocator.free(lib_path); self.reload(lib_path) catch |err| { std.log.emerg(.vst_hot_reload, "Failed to load library \"{}\": {}\n", .{ lib_path, err }); return null; }; self.watch_thread = std.Thread.spawn(self, checkLoopNoError) catch |err| { std.log.emerg(.vst_hot_reload, "Failed to spawn watch thread: {}\n", .{err}); return null; }; return &self.embed_info.effect; } fn deinit(self: *Self) void { self.deinitChild(); self.stop_watching = true; self.watch_thread.wait(); self.allocator.destroy(self); } /// Gets passed to the child plugin. See HotReloadLog. fn externalWriteLog(ptr: [*]u8, len: usize) callconv(.Fastcall) void { var data: []u8 = undefined; data.ptr = ptr; data.len = len; std.debug.print("{}", .{data}); if (log_file) |file| { file.writeAll(data) catch return; } } /// Read the location of the shared library from the watch file. fn readLibPath(self: *Self) ![]const u8 { const cwd = std.fs.cwd(); var watch_file = try cwd.openFile(self.meta.watch_path, .{}); defer watch_file.close(); var stat = try watch_file.stat(); var buffer = try self.allocator.alloc(u8, stat.size); _ = try watch_file.readAll(buffer); return buffer; } fn reload(self: *Self, lib_path: []const u8) !void { var reload_timer = try std.time.Timer.start(); var diagnostics = ReloadDiagnostics{}; reload_diagnostics = &diagnostics; defer { reload_diagnostics = null; const reload_took = reload_timer.read(); const reload_took_ms = @intToFloat(f64, reload_took) / std.time.ns_per_ms; std.log.debug(.vst_hot_reload, "Reload took {d:.2}ms {}\n", .{ reload_took_ms, diagnostics }); } const first_init = self.child_info == null; self.unloadChild(); var lib = try self.allocator.create(std.DynLib); lib.* = try std.DynLib.open(lib_path); try self.loadChild(lib, first_init); } fn loadChild(self: *Self, lib: *std.DynLib, call_init: bool) !void { var child_info = ChildInfo{ .lib = lib, .init = lib.lookup(HotReloadInit, "VSTHotReloadInit") orelse return error.MissingExport, .deinit = lib.lookup(HotReloadDeinit, "VSTHotReloadDeinit") orelse return error.MissingExport, .update = lib.lookup(HotReloadUpdate, "VSTHotReloadUpdate") orelse return error.MissingExport, .dispatcher = undefined, .set_parameter = undefined, .get_parameter = undefined, .process_replacing = undefined, .process_replacing_f64 = undefined, }; var embed_info = try self.allocator.create(EmbedInfo); embed_info.* = self.embed_info; if (call_init) { std.log.debug(.vst_hot_reload, "Calling VSTHotReloadInit\n", .{}); const result = child_info.init(embed_info, externalWriteLog); if (!result) return error.VSTHotReloadInitFailed; } else { std.log.debug(.vst_hot_reload, "Calling VSTHotReloadUpdate\n", .{}); const result = child_info.update(embed_info, externalWriteLog); if (!result) return error.VSTHotReloadUpdateFailed; } const effect = embed_info.effect; child_info.dispatcher = effect.dispatcher; child_info.set_parameter = effect.setParameter; child_info.get_parameter = effect.getParameter; child_info.process_replacing = effect.processReplacing; child_info.process_replacing_f64 = effect.processReplacingF64; self.embed_info.effect = .{ .dispatcher = dispatchWrapper, .setParameter = setParameterWrapper, .getParameter = getParameterWrapper, .processReplacing = processReplacingWrapper, .processReplacingF64 = processReplacingWrapperF64, .num_programs = effect.num_programs, .num_params = effect.num_params, .num_inputs = effect.num_inputs, .num_outputs = effect.num_outputs, .flags = effect.flags, .initial_delay = effect.initial_delay, .unique_id = effect.unique_id, .version = effect.version, }; // TODO Pass the actual embed_info pointer to the plugin self.embed_info.custom_ref = embed_info.custom_ref; self.child_info = child_info; self.execute_noops = false; } fn unloadChild(self: *Self) void { var child_info = self.child_info orelse return; std.log.debug(.vst_hot_reload, "Running noops from now on\n", .{}); self.execute_noops = true; // We need to make sure that no plugin function is running when we call // deinit. while (self.whats_running.isLocked()) { std.log.debug(.hot_reload, "Waiting for: {}\n", .{self.whats_running}); std.time.sleep(1 * std.time.ns_per_ms); } std.log.debug(.vst_hot_reload, "Calling VSTHotReloadDeinit\n", .{}); child_info.deinit(&self.embed_info); child_info.lib.close(); self.allocator.destroy(child_info.lib); self.child_info = null; } fn checkLoopNoError(self: *Self) void { self.checkLoop() catch |err| { std.log.emerg(.vst_hot_reload, "checkLoop failed: {}\n", .{err}); }; } fn checkLoop(self: *Self) !void { const cwd = std.fs.cwd(); var maybe_last: ?i128 = null; while (!self.stop_watching) { std.time.sleep(1 * std.time.ns_per_s); // TODO If a reload is currently in process we need // to wait for that first. // TODO When you delete zig-cache this call fails, so you have // to restart the plugin to have automatic reloads again. const watch_file = try cwd.openFile(self.meta.watch_path, .{}); defer watch_file.close(); const stat = try watch_file.stat(); if (maybe_last) |mtime| { if (stat.mtime > mtime) { var lib_path = try self.allocator.alloc(u8, stat.size); defer self.allocator.free(lib_path); _ = try watch_file.readAll(lib_path); try self.reload(lib_path); } } maybe_last = stat.mtime; } } fn dispatchWrapper( effect: *api.AEffect, opcode: i32, index: i32, value: isize, ptr: ?*c_void, opt: f32, ) callconv(.C) isize { var self = fromEffectPtr(effect); if (opcode == 1) { // TODO Handle Shutdown } return self.callOrNoop("dispatcher", Noops.dispatcher, .{ effect, opcode, index, value, ptr, opt, }); } fn setParameterWrapper(effect: *api.AEffect, index: i32, parameter: f32) callconv(.C) void { var self = fromEffectPtr(effect); self.callOrNoop("set_parameter", Noops.setParameter, .{ effect, index, parameter, }); } fn getParameterWrapper(effect: *api.AEffect, index: i32) callconv(.C) f32 { var self = fromEffectPtr(effect); return self.callOrNoop("get_parameter", Noops.getParameter, .{ effect, index, }); } fn processReplacingWrapper( effect: *api.AEffect, inputs: [*][*]f32, outputs: [*][*]f32, sample_frames: i32, ) callconv(.C) void { var self = fromEffectPtr(effect); self.callOrNoop("process_replacing", Noops.processReplacing, .{ effect, inputs, outputs, sample_frames, }); } fn processReplacingWrapperF64( effect: *api.AEffect, inputs: [*][*]f64, outputs: [*][*]f64, sample_frames: i32, ) callconv(.C) void { var self = fromEffectPtr(effect); self.callOrNoop("process_replacing_f64", Noops.processReplacingF64, .{ effect, inputs, outputs, sample_frames, }); } fn fromEffectPtr(effect: *api.AEffect) *Self { const embed_info = @fieldParentPtr(EmbedInfo, "effect", effect); return @fieldParentPtr(Self, "embed_info", embed_info); } fn callOrNoop(self: *Self, comptime name: []const u8, noop: var, args: var) return_type: { break :return_type @typeInfo(@TypeOf(noop)).Fn.return_type.?; } { const arc = &@field(self.whats_running, name); if (self.execute_noops) { return @call(.{}, noop, args); } else if (self.child_info == null) { std.log.warn(.vst_hot_reload, "Had to unexepectedly call noop for {}\n", .{name}); return @call(.{}, noop, args); } else { arc.acquire(); defer arc.release(); return @call(.{}, @field(self.child_info.?, name), args); } } }; }
src/hot_reload.zig
pub const INVALID_HANDLE_VALUE = @import("zig.zig").typedConst(HANDLE, @as(i32, -1)); pub const E_NOTIMPL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467263)); pub const E_OUTOFMEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147024882)); pub const E_INVALIDARG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147024809)); pub const E_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467259)); pub const STRICT = @as(u32, 1); pub const MAX_PATH = @as(u32, 260); pub const STATUS_WAIT_0 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 0)); pub const FACILTIY_MUI_ERROR_CODE = @as(u32, 11); pub const STATUS_SEVERITY_SUCCESS = @as(u32, 0); pub const STATUS_SEVERITY_INFORMATIONAL = @as(u32, 1); pub const STATUS_SEVERITY_WARNING = @as(u32, 2); pub const STATUS_SEVERITY_ERROR = @as(u32, 3); pub const STATUS_SUCCESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 0)); pub const STATUS_WAIT_1 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1)); pub const STATUS_WAIT_2 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 2)); pub const STATUS_WAIT_3 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 3)); pub const STATUS_WAIT_63 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 63)); pub const STATUS_ABANDONED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 128)); pub const STATUS_ABANDONED_WAIT_0 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 128)); pub const STATUS_ABANDONED_WAIT_63 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 191)); pub const STATUS_USER_APC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 192)); pub const STATUS_ALREADY_COMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 255)); pub const STATUS_KERNEL_APC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 256)); pub const STATUS_ALERTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 257)); pub const STATUS_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 258)); pub const STATUS_PENDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 259)); pub const STATUS_REPARSE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 260)); pub const STATUS_MORE_ENTRIES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 261)); pub const STATUS_NOT_ALL_ASSIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 262)); pub const STATUS_SOME_NOT_MAPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 263)); pub const STATUS_OPLOCK_BREAK_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 264)); pub const STATUS_VOLUME_MOUNTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 265)); pub const STATUS_RXACT_COMMITTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 266)); pub const STATUS_NOTIFY_CLEANUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 267)); pub const STATUS_NOTIFY_ENUM_DIR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 268)); pub const STATUS_NO_QUOTAS_FOR_ACCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 269)); pub const STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 270)); pub const STATUS_PAGE_FAULT_TRANSITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 272)); pub const STATUS_PAGE_FAULT_DEMAND_ZERO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 273)); pub const STATUS_PAGE_FAULT_COPY_ON_WRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 274)); pub const STATUS_PAGE_FAULT_GUARD_PAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 275)); pub const STATUS_PAGE_FAULT_PAGING_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 276)); pub const STATUS_CACHE_PAGE_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 277)); pub const STATUS_CRASH_DUMP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 278)); pub const STATUS_BUFFER_ALL_ZEROS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 279)); pub const STATUS_REPARSE_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 280)); pub const STATUS_RESOURCE_REQUIREMENTS_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 281)); pub const STATUS_TRANSLATION_COMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 288)); pub const STATUS_DS_MEMBERSHIP_EVALUATED_LOCALLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 289)); pub const STATUS_NOTHING_TO_TERMINATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 290)); pub const STATUS_PROCESS_NOT_IN_JOB = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 291)); pub const STATUS_PROCESS_IN_JOB = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 292)); pub const STATUS_VOLSNAP_HIBERNATE_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 293)); pub const STATUS_FSFILTER_OP_COMPLETED_SUCCESSFULLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 294)); pub const STATUS_INTERRUPT_VECTOR_ALREADY_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 295)); pub const STATUS_INTERRUPT_STILL_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 296)); pub const STATUS_PROCESS_CLONED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 297)); pub const STATUS_FILE_LOCKED_WITH_ONLY_READERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 298)); pub const STATUS_FILE_LOCKED_WITH_WRITERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 299)); pub const STATUS_VALID_IMAGE_HASH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 300)); pub const STATUS_VALID_CATALOG_HASH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 301)); pub const STATUS_VALID_STRONG_CODE_HASH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 302)); pub const STATUS_GHOSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 303)); pub const STATUS_DATA_OVERWRITTEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 304)); pub const STATUS_RESOURCEMANAGER_READ_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 514)); pub const STATUS_RING_PREVIOUSLY_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 528)); pub const STATUS_RING_PREVIOUSLY_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 529)); pub const STATUS_RING_PREVIOUSLY_ABOVE_QUOTA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 530)); pub const STATUS_RING_NEWLY_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 531)); pub const STATUS_RING_SIGNAL_OPPOSITE_ENDPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 532)); pub const STATUS_OPLOCK_SWITCHED_TO_NEW_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 533)); pub const STATUS_OPLOCK_HANDLE_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 534)); pub const STATUS_WAIT_FOR_OPLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 871)); pub const STATUS_REPARSE_GLOBAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 872)); pub const DBG_EXCEPTION_HANDLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 65537)); pub const DBG_CONTINUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 65538)); pub const STATUS_FLT_IO_COMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1835009)); pub const STATUS_OBJECT_NAME_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741824)); pub const STATUS_THREAD_WAS_SUSPENDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741825)); pub const STATUS_WORKING_SET_LIMIT_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741826)); pub const STATUS_IMAGE_NOT_AT_BASE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741827)); pub const STATUS_RXACT_STATE_CREATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741828)); pub const STATUS_SEGMENT_NOTIFICATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741829)); pub const STATUS_LOCAL_USER_SESSION_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741830)); pub const STATUS_BAD_CURRENT_DIRECTORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741831)); pub const STATUS_SERIAL_MORE_WRITES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741832)); pub const STATUS_REGISTRY_RECOVERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741833)); pub const STATUS_FT_READ_RECOVERY_FROM_BACKUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741834)); pub const STATUS_FT_WRITE_RECOVERY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741835)); pub const STATUS_SERIAL_COUNTER_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741836)); pub const STATUS_NULL_LM_PASSWORD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741837)); pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741838)); pub const STATUS_RECEIVE_PARTIAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741839)); pub const STATUS_RECEIVE_EXPEDITED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741840)); pub const STATUS_RECEIVE_PARTIAL_EXPEDITED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741841)); pub const STATUS_EVENT_DONE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741842)); pub const STATUS_EVENT_PENDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741843)); pub const STATUS_CHECKING_FILE_SYSTEM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741844)); pub const STATUS_FATAL_APP_EXIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741845)); pub const STATUS_PREDEFINED_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741846)); pub const STATUS_WAS_UNLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741847)); pub const STATUS_SERVICE_NOTIFICATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741848)); pub const STATUS_WAS_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741849)); pub const STATUS_LOG_HARD_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741850)); pub const STATUS_ALREADY_WIN32 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741851)); pub const STATUS_WX86_UNSIMULATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741852)); pub const STATUS_WX86_CONTINUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741853)); pub const STATUS_WX86_SINGLE_STEP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741854)); pub const STATUS_WX86_BREAKPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741855)); pub const STATUS_WX86_EXCEPTION_CONTINUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741856)); pub const STATUS_WX86_EXCEPTION_LASTCHANCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741857)); pub const STATUS_WX86_EXCEPTION_CHAIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741858)); pub const STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741859)); pub const STATUS_NO_YIELD_PERFORMED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741860)); pub const STATUS_TIMER_RESUME_IGNORED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741861)); pub const STATUS_ARBITRATION_UNHANDLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741862)); pub const STATUS_CARDBUS_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741863)); pub const STATUS_WX86_CREATEWX86TIB = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741864)); pub const STATUS_MP_PROCESSOR_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741865)); pub const STATUS_HIBERNATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741866)); pub const STATUS_RESUME_HIBERNATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741867)); pub const STATUS_FIRMWARE_UPDATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741868)); pub const STATUS_DRIVERS_LEAKING_LOCKED_PAGES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741869)); pub const STATUS_MESSAGE_RETRIEVED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741870)); pub const STATUS_SYSTEM_POWERSTATE_TRANSITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741871)); pub const STATUS_ALPC_CHECK_COMPLETION_LIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741872)); pub const STATUS_SYSTEM_POWERSTATE_COMPLEX_TRANSITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741873)); pub const STATUS_ACCESS_AUDIT_BY_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741874)); pub const STATUS_ABANDON_HIBERFILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741875)); pub const STATUS_BIZRULES_NOT_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741876)); pub const STATUS_FT_READ_FROM_COPY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741877)); pub const STATUS_IMAGE_AT_DIFFERENT_BASE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741878)); pub const STATUS_PATCH_DEFERRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073741879)); pub const DBG_REPLY_LATER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807361)); pub const DBG_UNABLE_TO_PROVIDE_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807362)); pub const DBG_TERMINATE_THREAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807363)); pub const DBG_TERMINATE_PROCESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807364)); pub const DBG_CONTROL_C = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807365)); pub const DBG_PRINTEXCEPTION_C = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807366)); pub const DBG_RIPEXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807367)); pub const DBG_CONTROL_BREAK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807368)); pub const DBG_COMMAND_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807369)); pub const DBG_PRINTEXCEPTION_WIDE_C = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073807370)); pub const STATUS_HEURISTIC_DAMAGE_POSSIBLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075380225)); pub const STATUS_GUARD_PAGE_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483647)); pub const STATUS_DATATYPE_MISALIGNMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483646)); pub const STATUS_BREAKPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483645)); pub const STATUS_SINGLE_STEP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483644)); pub const STATUS_BUFFER_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483643)); pub const STATUS_NO_MORE_FILES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483642)); pub const STATUS_WAKE_SYSTEM_DEBUGGER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483641)); pub const STATUS_HANDLES_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483638)); pub const STATUS_NO_INHERITANCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483637)); pub const STATUS_GUID_SUBSTITUTION_MADE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483636)); pub const STATUS_PARTIAL_COPY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483635)); pub const STATUS_DEVICE_PAPER_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483634)); pub const STATUS_DEVICE_POWERED_OFF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483633)); pub const STATUS_DEVICE_OFF_LINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483632)); pub const STATUS_DEVICE_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483631)); pub const STATUS_NO_MORE_EAS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483630)); pub const STATUS_INVALID_EA_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483629)); pub const STATUS_EA_LIST_INCONSISTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483628)); pub const STATUS_INVALID_EA_FLAG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483627)); pub const STATUS_VERIFY_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483626)); pub const STATUS_EXTRANEOUS_INFORMATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483625)); pub const STATUS_RXACT_COMMIT_NECESSARY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483624)); pub const STATUS_NO_MORE_ENTRIES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483622)); pub const STATUS_FILEMARK_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483621)); pub const STATUS_MEDIA_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483620)); pub const STATUS_BUS_RESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483619)); pub const STATUS_END_OF_MEDIA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483618)); pub const STATUS_BEGINNING_OF_MEDIA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483617)); pub const STATUS_MEDIA_CHECK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483616)); pub const STATUS_SETMARK_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483615)); pub const STATUS_NO_DATA_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483614)); pub const STATUS_REDIRECTOR_HAS_OPEN_HANDLES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483613)); pub const STATUS_SERVER_HAS_OPEN_HANDLES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483612)); pub const STATUS_ALREADY_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483611)); pub const STATUS_LONGJUMP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483610)); pub const STATUS_CLEANER_CARTRIDGE_INSTALLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483609)); pub const STATUS_PLUGPLAY_QUERY_VETOED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483608)); pub const STATUS_UNWIND_CONSOLIDATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483607)); pub const STATUS_REGISTRY_HIVE_RECOVERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483606)); pub const STATUS_DLL_MIGHT_BE_INSECURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483605)); pub const STATUS_DLL_MIGHT_BE_INCOMPATIBLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483604)); pub const STATUS_STOPPED_ON_SYMLINK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483603)); pub const STATUS_CANNOT_GRANT_REQUESTED_OPLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483602)); pub const STATUS_NO_ACE_CONDITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483601)); pub const STATUS_DEVICE_SUPPORT_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483600)); pub const STATUS_DEVICE_POWER_CYCLE_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483599)); pub const STATUS_NO_WORK_DONE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483598)); pub const STATUS_RETURN_ADDRESS_HIJACK_ATTEMPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483597)); pub const DBG_EXCEPTION_NOT_HANDLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147418111)); pub const STATUS_CLUSTER_NODE_ALREADY_UP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2146238463)); pub const STATUS_CLUSTER_NODE_ALREADY_DOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2146238462)); pub const STATUS_CLUSTER_NETWORK_ALREADY_ONLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2146238461)); pub const STATUS_CLUSTER_NETWORK_ALREADY_OFFLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2146238460)); pub const STATUS_CLUSTER_NODE_ALREADY_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2146238459)); pub const STATUS_FLT_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145648639)); pub const STATUS_FVE_PARTIAL_METADATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145320959)); pub const STATUS_FVE_TRANSIENT_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145320958)); pub const STATUS_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147430656)); pub const STATUS_UNSUCCESSFUL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741823)); pub const STATUS_NOT_IMPLEMENTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741822)); pub const STATUS_INVALID_INFO_CLASS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741821)); pub const STATUS_INFO_LENGTH_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741820)); pub const STATUS_ACCESS_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741819)); pub const STATUS_IN_PAGE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741818)); pub const STATUS_PAGEFILE_QUOTA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741817)); pub const STATUS_INVALID_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741816)); pub const STATUS_BAD_INITIAL_STACK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741815)); pub const STATUS_BAD_INITIAL_PC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741814)); pub const STATUS_INVALID_CID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741813)); pub const STATUS_TIMER_NOT_CANCELED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741812)); pub const STATUS_INVALID_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741811)); pub const STATUS_NO_SUCH_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741810)); pub const STATUS_NO_SUCH_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741809)); pub const STATUS_INVALID_DEVICE_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741808)); pub const STATUS_END_OF_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741807)); pub const STATUS_WRONG_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741806)); pub const STATUS_NO_MEDIA_IN_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741805)); pub const STATUS_UNRECOGNIZED_MEDIA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741804)); pub const STATUS_NONEXISTENT_SECTOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741803)); pub const STATUS_MORE_PROCESSING_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741802)); pub const STATUS_NO_MEMORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741801)); pub const STATUS_CONFLICTING_ADDRESSES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741800)); pub const STATUS_NOT_MAPPED_VIEW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741799)); pub const STATUS_UNABLE_TO_FREE_VM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741798)); pub const STATUS_UNABLE_TO_DELETE_SECTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741797)); pub const STATUS_INVALID_SYSTEM_SERVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741796)); pub const STATUS_ILLEGAL_INSTRUCTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741795)); pub const STATUS_INVALID_LOCK_SEQUENCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741794)); pub const STATUS_INVALID_VIEW_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741793)); pub const STATUS_INVALID_FILE_FOR_SECTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741792)); pub const STATUS_ALREADY_COMMITTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741791)); pub const STATUS_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741789)); pub const STATUS_OBJECT_TYPE_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741788)); pub const STATUS_NONCONTINUABLE_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741787)); pub const STATUS_INVALID_DISPOSITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741786)); pub const STATUS_UNWIND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741785)); pub const STATUS_BAD_STACK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741784)); pub const STATUS_INVALID_UNWIND_TARGET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741783)); pub const STATUS_NOT_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741782)); pub const STATUS_PARITY_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741781)); pub const STATUS_UNABLE_TO_DECOMMIT_VM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741780)); pub const STATUS_NOT_COMMITTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741779)); pub const STATUS_INVALID_PORT_ATTRIBUTES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741778)); pub const STATUS_PORT_MESSAGE_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741777)); pub const STATUS_INVALID_PARAMETER_MIX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741776)); pub const STATUS_INVALID_QUOTA_LOWER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741775)); pub const STATUS_DISK_CORRUPT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741774)); pub const STATUS_OBJECT_NAME_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741773)); pub const STATUS_OBJECT_NAME_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741772)); pub const STATUS_OBJECT_NAME_COLLISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741771)); pub const STATUS_PORT_DO_NOT_DISTURB = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741770)); pub const STATUS_PORT_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741769)); pub const STATUS_DEVICE_ALREADY_ATTACHED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741768)); pub const STATUS_OBJECT_PATH_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741767)); pub const STATUS_OBJECT_PATH_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741766)); pub const STATUS_OBJECT_PATH_SYNTAX_BAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741765)); pub const STATUS_DATA_OVERRUN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741764)); pub const STATUS_DATA_LATE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741763)); pub const STATUS_DATA_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741762)); pub const STATUS_CRC_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741761)); pub const STATUS_SECTION_TOO_BIG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741760)); pub const STATUS_PORT_CONNECTION_REFUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741759)); pub const STATUS_INVALID_PORT_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741758)); pub const STATUS_SHARING_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741757)); pub const STATUS_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741756)); pub const STATUS_INVALID_PAGE_PROTECTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741755)); pub const STATUS_MUTANT_NOT_OWNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741754)); pub const STATUS_SEMAPHORE_LIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741753)); pub const STATUS_PORT_ALREADY_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741752)); pub const STATUS_SECTION_NOT_IMAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741751)); pub const STATUS_SUSPEND_COUNT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741750)); pub const STATUS_THREAD_IS_TERMINATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741749)); pub const STATUS_BAD_WORKING_SET_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741748)); pub const STATUS_INCOMPATIBLE_FILE_MAP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741747)); pub const STATUS_SECTION_PROTECTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741746)); pub const STATUS_EAS_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741745)); pub const STATUS_EA_TOO_LARGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741744)); pub const STATUS_NONEXISTENT_EA_ENTRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741743)); pub const STATUS_NO_EAS_ON_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741742)); pub const STATUS_EA_CORRUPT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741741)); pub const STATUS_FILE_LOCK_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741740)); pub const STATUS_LOCK_NOT_GRANTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741739)); pub const STATUS_DELETE_PENDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741738)); pub const STATUS_CTL_FILE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741737)); pub const STATUS_UNKNOWN_REVISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741736)); pub const STATUS_REVISION_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741735)); pub const STATUS_INVALID_OWNER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741734)); pub const STATUS_INVALID_PRIMARY_GROUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741733)); pub const STATUS_NO_IMPERSONATION_TOKEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741732)); pub const STATUS_CANT_DISABLE_MANDATORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741731)); pub const STATUS_NO_LOGON_SERVERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741730)); pub const STATUS_NO_SUCH_PRIVILEGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741728)); pub const STATUS_PRIVILEGE_NOT_HELD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741727)); pub const STATUS_INVALID_ACCOUNT_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741726)); pub const STATUS_USER_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741725)); pub const STATUS_GROUP_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741723)); pub const STATUS_NO_SUCH_GROUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741722)); pub const STATUS_MEMBER_IN_GROUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741721)); pub const STATUS_MEMBER_NOT_IN_GROUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741720)); pub const STATUS_LAST_ADMIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741719)); pub const STATUS_ILL_FORMED_PASSWORD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741717)); pub const STATUS_PASSWORD_RESTRICTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741716)); pub const STATUS_INVALID_LOGON_HOURS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741713)); pub const STATUS_INVALID_WORKSTATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741712)); pub const STATUS_NONE_MAPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741709)); pub const STATUS_TOO_MANY_LUIDS_REQUESTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741708)); pub const STATUS_LUIDS_EXHAUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741707)); pub const STATUS_INVALID_SUB_AUTHORITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741706)); pub const STATUS_INVALID_ACL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741705)); pub const STATUS_INVALID_SID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741704)); pub const STATUS_INVALID_SECURITY_DESCR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741703)); pub const STATUS_PROCEDURE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741702)); pub const STATUS_INVALID_IMAGE_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741701)); pub const STATUS_NO_TOKEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741700)); pub const STATUS_BAD_INHERITANCE_ACL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741699)); pub const STATUS_RANGE_NOT_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741698)); pub const STATUS_DISK_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741697)); pub const STATUS_SERVER_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741696)); pub const STATUS_SERVER_NOT_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741695)); pub const STATUS_TOO_MANY_GUIDS_REQUESTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741694)); pub const STATUS_GUIDS_EXHAUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741693)); pub const STATUS_INVALID_ID_AUTHORITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741692)); pub const STATUS_AGENTS_EXHAUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741691)); pub const STATUS_INVALID_VOLUME_LABEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741690)); pub const STATUS_SECTION_NOT_EXTENDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741689)); pub const STATUS_NOT_MAPPED_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741688)); pub const STATUS_RESOURCE_DATA_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741687)); pub const STATUS_RESOURCE_TYPE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741686)); pub const STATUS_RESOURCE_NAME_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741685)); pub const STATUS_ARRAY_BOUNDS_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741684)); pub const STATUS_FLOAT_DENORMAL_OPERAND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741683)); pub const STATUS_FLOAT_DIVIDE_BY_ZERO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741682)); pub const STATUS_FLOAT_INEXACT_RESULT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741681)); pub const STATUS_FLOAT_INVALID_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741680)); pub const STATUS_FLOAT_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741679)); pub const STATUS_FLOAT_STACK_CHECK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741678)); pub const STATUS_FLOAT_UNDERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741677)); pub const STATUS_INTEGER_DIVIDE_BY_ZERO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741676)); pub const STATUS_INTEGER_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741675)); pub const STATUS_PRIVILEGED_INSTRUCTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741674)); pub const STATUS_TOO_MANY_PAGING_FILES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741673)); pub const STATUS_FILE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741672)); pub const STATUS_ALLOTTED_SPACE_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741671)); pub const STATUS_INSUFFICIENT_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741670)); pub const STATUS_DFS_EXIT_PATH_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741669)); pub const STATUS_DEVICE_DATA_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741668)); pub const STATUS_DEVICE_NOT_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741667)); pub const STATUS_DEVICE_POWER_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741666)); pub const STATUS_FREE_VM_NOT_AT_BASE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741665)); pub const STATUS_MEMORY_NOT_ALLOCATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741664)); pub const STATUS_WORKING_SET_QUOTA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741663)); pub const STATUS_MEDIA_WRITE_PROTECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741662)); pub const STATUS_DEVICE_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741661)); pub const STATUS_INVALID_GROUP_ATTRIBUTES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741660)); pub const STATUS_BAD_IMPERSONATION_LEVEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741659)); pub const STATUS_CANT_OPEN_ANONYMOUS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741658)); pub const STATUS_BAD_VALIDATION_CLASS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741657)); pub const STATUS_BAD_TOKEN_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741656)); pub const STATUS_BAD_MASTER_BOOT_RECORD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741655)); pub const STATUS_INSTRUCTION_MISALIGNMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741654)); pub const STATUS_INSTANCE_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741653)); pub const STATUS_PIPE_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741652)); pub const STATUS_INVALID_PIPE_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741651)); pub const STATUS_PIPE_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741650)); pub const STATUS_ILLEGAL_FUNCTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741649)); pub const STATUS_PIPE_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741648)); pub const STATUS_PIPE_CLOSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741647)); pub const STATUS_PIPE_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741646)); pub const STATUS_PIPE_LISTENING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741645)); pub const STATUS_INVALID_READ_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741644)); pub const STATUS_IO_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741643)); pub const STATUS_FILE_FORCED_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741642)); pub const STATUS_PROFILING_NOT_STARTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741641)); pub const STATUS_PROFILING_NOT_STOPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741640)); pub const STATUS_COULD_NOT_INTERPRET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741639)); pub const STATUS_FILE_IS_A_DIRECTORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741638)); pub const STATUS_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741637)); pub const STATUS_REMOTE_NOT_LISTENING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741636)); pub const STATUS_DUPLICATE_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741635)); pub const STATUS_BAD_NETWORK_PATH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741634)); pub const STATUS_NETWORK_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741633)); pub const STATUS_DEVICE_DOES_NOT_EXIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741632)); pub const STATUS_TOO_MANY_COMMANDS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741631)); pub const STATUS_ADAPTER_HARDWARE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741630)); pub const STATUS_INVALID_NETWORK_RESPONSE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741629)); pub const STATUS_UNEXPECTED_NETWORK_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741628)); pub const STATUS_BAD_REMOTE_ADAPTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741627)); pub const STATUS_PRINT_QUEUE_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741626)); pub const STATUS_NO_SPOOL_SPACE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741625)); pub const STATUS_PRINT_CANCELLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741624)); pub const STATUS_NETWORK_NAME_DELETED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741623)); pub const STATUS_NETWORK_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741622)); pub const STATUS_BAD_DEVICE_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741621)); pub const STATUS_BAD_NETWORK_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741620)); pub const STATUS_TOO_MANY_NAMES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741619)); pub const STATUS_TOO_MANY_SESSIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741618)); pub const STATUS_SHARING_PAUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741617)); pub const STATUS_REQUEST_NOT_ACCEPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741616)); pub const STATUS_REDIRECTOR_PAUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741615)); pub const STATUS_NET_WRITE_FAULT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741614)); pub const STATUS_PROFILING_AT_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741613)); pub const STATUS_NOT_SAME_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741612)); pub const STATUS_FILE_RENAMED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741611)); pub const STATUS_VIRTUAL_CIRCUIT_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741610)); pub const STATUS_NO_SECURITY_ON_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741609)); pub const STATUS_CANT_WAIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741608)); pub const STATUS_PIPE_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741607)); pub const STATUS_CANT_ACCESS_DOMAIN_INFO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741606)); pub const STATUS_CANT_TERMINATE_SELF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741605)); pub const STATUS_INVALID_SERVER_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741604)); pub const STATUS_INVALID_DOMAIN_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741603)); pub const STATUS_INVALID_DOMAIN_ROLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741602)); pub const STATUS_NO_SUCH_DOMAIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741601)); pub const STATUS_DOMAIN_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741600)); pub const STATUS_DOMAIN_LIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741599)); pub const STATUS_OPLOCK_NOT_GRANTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741598)); pub const STATUS_INVALID_OPLOCK_PROTOCOL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741597)); pub const STATUS_INTERNAL_DB_CORRUPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741596)); pub const STATUS_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741595)); pub const STATUS_GENERIC_NOT_MAPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741594)); pub const STATUS_BAD_DESCRIPTOR_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741593)); pub const STATUS_INVALID_USER_BUFFER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741592)); pub const STATUS_UNEXPECTED_IO_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741591)); pub const STATUS_UNEXPECTED_MM_CREATE_ERR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741590)); pub const STATUS_UNEXPECTED_MM_MAP_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741589)); pub const STATUS_UNEXPECTED_MM_EXTEND_ERR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741588)); pub const STATUS_NOT_LOGON_PROCESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741587)); pub const STATUS_LOGON_SESSION_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741586)); pub const STATUS_INVALID_PARAMETER_1 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741585)); pub const STATUS_INVALID_PARAMETER_2 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741584)); pub const STATUS_INVALID_PARAMETER_3 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741583)); pub const STATUS_INVALID_PARAMETER_4 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741582)); pub const STATUS_INVALID_PARAMETER_5 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741581)); pub const STATUS_INVALID_PARAMETER_6 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741580)); pub const STATUS_INVALID_PARAMETER_7 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741579)); pub const STATUS_INVALID_PARAMETER_8 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741578)); pub const STATUS_INVALID_PARAMETER_9 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741577)); pub const STATUS_INVALID_PARAMETER_10 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741576)); pub const STATUS_INVALID_PARAMETER_11 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741575)); pub const STATUS_INVALID_PARAMETER_12 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741574)); pub const STATUS_REDIRECTOR_NOT_STARTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741573)); pub const STATUS_REDIRECTOR_STARTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741572)); pub const STATUS_STACK_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741571)); pub const STATUS_NO_SUCH_PACKAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741570)); pub const STATUS_BAD_FUNCTION_TABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741569)); pub const STATUS_VARIABLE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741568)); pub const STATUS_DIRECTORY_NOT_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741567)); pub const STATUS_FILE_CORRUPT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741566)); pub const STATUS_NOT_A_DIRECTORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741565)); pub const STATUS_BAD_LOGON_SESSION_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741564)); pub const STATUS_LOGON_SESSION_COLLISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741563)); pub const STATUS_NAME_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741562)); pub const STATUS_FILES_OPEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741561)); pub const STATUS_CONNECTION_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741560)); pub const STATUS_MESSAGE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741559)); pub const STATUS_PROCESS_IS_TERMINATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741558)); pub const STATUS_INVALID_LOGON_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741557)); pub const STATUS_NO_GUID_TRANSLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741556)); pub const STATUS_CANNOT_IMPERSONATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741555)); pub const STATUS_IMAGE_ALREADY_LOADED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741554)); pub const STATUS_ABIOS_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741553)); pub const STATUS_ABIOS_LID_NOT_EXIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741552)); pub const STATUS_ABIOS_LID_ALREADY_OWNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741551)); pub const STATUS_ABIOS_NOT_LID_OWNER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741550)); pub const STATUS_ABIOS_INVALID_COMMAND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741549)); pub const STATUS_ABIOS_INVALID_LID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741548)); pub const STATUS_ABIOS_SELECTOR_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741547)); pub const STATUS_ABIOS_INVALID_SELECTOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741546)); pub const STATUS_NO_LDT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741545)); pub const STATUS_INVALID_LDT_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741544)); pub const STATUS_INVALID_LDT_OFFSET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741543)); pub const STATUS_INVALID_LDT_DESCRIPTOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741542)); pub const STATUS_INVALID_IMAGE_NE_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741541)); pub const STATUS_RXACT_INVALID_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741540)); pub const STATUS_RXACT_COMMIT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741539)); pub const STATUS_MAPPED_FILE_SIZE_ZERO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741538)); pub const STATUS_TOO_MANY_OPENED_FILES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741537)); pub const STATUS_CANCELLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741536)); pub const STATUS_CANNOT_DELETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741535)); pub const STATUS_INVALID_COMPUTER_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741534)); pub const STATUS_FILE_DELETED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741533)); pub const STATUS_SPECIAL_ACCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741532)); pub const STATUS_SPECIAL_GROUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741531)); pub const STATUS_SPECIAL_USER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741530)); pub const STATUS_MEMBERS_PRIMARY_GROUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741529)); pub const STATUS_FILE_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741528)); pub const STATUS_TOO_MANY_THREADS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741527)); pub const STATUS_THREAD_NOT_IN_PROCESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741526)); pub const STATUS_TOKEN_ALREADY_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741525)); pub const STATUS_PAGEFILE_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741524)); pub const STATUS_COMMITMENT_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741523)); pub const STATUS_INVALID_IMAGE_LE_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741522)); pub const STATUS_INVALID_IMAGE_NOT_MZ = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741521)); pub const STATUS_INVALID_IMAGE_PROTECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741520)); pub const STATUS_INVALID_IMAGE_WIN_16 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741519)); pub const STATUS_LOGON_SERVER_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741518)); pub const STATUS_TIME_DIFFERENCE_AT_DC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741517)); pub const STATUS_SYNCHRONIZATION_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741516)); pub const STATUS_DLL_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741515)); pub const STATUS_OPEN_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741514)); pub const STATUS_IO_PRIVILEGE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741513)); pub const STATUS_ORDINAL_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741512)); pub const STATUS_ENTRYPOINT_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741511)); pub const STATUS_CONTROL_C_EXIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741510)); pub const STATUS_LOCAL_DISCONNECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741509)); pub const STATUS_REMOTE_DISCONNECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741508)); pub const STATUS_REMOTE_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741507)); pub const STATUS_LINK_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741506)); pub const STATUS_LINK_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741505)); pub const STATUS_INVALID_CONNECTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741504)); pub const STATUS_INVALID_ADDRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741503)); pub const STATUS_DLL_INIT_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741502)); pub const STATUS_MISSING_SYSTEMFILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741501)); pub const STATUS_UNHANDLED_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741500)); pub const STATUS_APP_INIT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741499)); pub const STATUS_PAGEFILE_CREATE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741498)); pub const STATUS_NO_PAGEFILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741497)); pub const STATUS_INVALID_LEVEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741496)); pub const STATUS_WRONG_PASSWORD_CORE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741495)); pub const STATUS_ILLEGAL_FLOAT_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741494)); pub const STATUS_PIPE_BROKEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741493)); pub const STATUS_REGISTRY_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741492)); pub const STATUS_REGISTRY_IO_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741491)); pub const STATUS_NO_EVENT_PAIR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741490)); pub const STATUS_UNRECOGNIZED_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741489)); pub const STATUS_SERIAL_NO_DEVICE_INITED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741488)); pub const STATUS_NO_SUCH_ALIAS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741487)); pub const STATUS_MEMBER_NOT_IN_ALIAS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741486)); pub const STATUS_MEMBER_IN_ALIAS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741485)); pub const STATUS_ALIAS_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741484)); pub const STATUS_LOGON_NOT_GRANTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741483)); pub const STATUS_TOO_MANY_SECRETS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741482)); pub const STATUS_SECRET_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741481)); pub const STATUS_INTERNAL_DB_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741480)); pub const STATUS_FULLSCREEN_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741479)); pub const STATUS_TOO_MANY_CONTEXT_IDS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741478)); pub const STATUS_NOT_REGISTRY_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741476)); pub const STATUS_NT_CROSS_ENCRYPTION_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741475)); pub const STATUS_DOMAIN_CTRLR_CONFIG_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741474)); pub const STATUS_FT_MISSING_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741473)); pub const STATUS_ILL_FORMED_SERVICE_ENTRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741472)); pub const STATUS_ILLEGAL_CHARACTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741471)); pub const STATUS_UNMAPPABLE_CHARACTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741470)); pub const STATUS_UNDEFINED_CHARACTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741469)); pub const STATUS_FLOPPY_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741468)); pub const STATUS_FLOPPY_ID_MARK_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741467)); pub const STATUS_FLOPPY_WRONG_CYLINDER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741466)); pub const STATUS_FLOPPY_UNKNOWN_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741465)); pub const STATUS_FLOPPY_BAD_REGISTERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741464)); pub const STATUS_DISK_RECALIBRATE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741463)); pub const STATUS_DISK_OPERATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741462)); pub const STATUS_DISK_RESET_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741461)); pub const STATUS_SHARED_IRQ_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741460)); pub const STATUS_FT_ORPHANING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741459)); pub const STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741458)); pub const STATUS_PARTITION_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741454)); pub const STATUS_INVALID_BLOCK_LENGTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741453)); pub const STATUS_DEVICE_NOT_PARTITIONED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741452)); pub const STATUS_UNABLE_TO_LOCK_MEDIA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741451)); pub const STATUS_UNABLE_TO_UNLOAD_MEDIA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741450)); pub const STATUS_EOM_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741449)); pub const STATUS_NO_MEDIA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741448)); pub const STATUS_NO_SUCH_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741446)); pub const STATUS_INVALID_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741445)); pub const STATUS_KEY_DELETED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741444)); pub const STATUS_NO_LOG_SPACE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741443)); pub const STATUS_TOO_MANY_SIDS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741442)); pub const STATUS_LM_CROSS_ENCRYPTION_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741441)); pub const STATUS_KEY_HAS_CHILDREN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741440)); pub const STATUS_CHILD_MUST_BE_VOLATILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741439)); pub const STATUS_DEVICE_CONFIGURATION_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741438)); pub const STATUS_DRIVER_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741437)); pub const STATUS_INVALID_DEVICE_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741436)); pub const STATUS_IO_DEVICE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741435)); pub const STATUS_DEVICE_PROTOCOL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741434)); pub const STATUS_BACKUP_CONTROLLER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741433)); pub const STATUS_LOG_FILE_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741432)); pub const STATUS_TOO_LATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741431)); pub const STATUS_NO_TRUST_LSA_SECRET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741430)); pub const STATUS_NO_TRUST_SAM_ACCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741429)); pub const STATUS_TRUSTED_DOMAIN_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741428)); pub const STATUS_TRUSTED_RELATIONSHIP_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741427)); pub const STATUS_EVENTLOG_FILE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741426)); pub const STATUS_EVENTLOG_CANT_START = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741425)); pub const STATUS_TRUST_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741424)); pub const STATUS_MUTANT_LIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741423)); pub const STATUS_NETLOGON_NOT_STARTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741422)); pub const STATUS_POSSIBLE_DEADLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741420)); pub const STATUS_NETWORK_CREDENTIAL_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741419)); pub const STATUS_REMOTE_SESSION_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741418)); pub const STATUS_EVENTLOG_FILE_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741417)); pub const STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741416)); pub const STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741415)); pub const STATUS_NOLOGON_SERVER_TRUST_ACCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741414)); pub const STATUS_DOMAIN_TRUST_INCONSISTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741413)); pub const STATUS_FS_DRIVER_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741412)); pub const STATUS_IMAGE_ALREADY_LOADED_AS_DLL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741411)); pub const STATUS_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741410)); pub const STATUS_SHORT_NAMES_NOT_ENABLED_ON_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741409)); pub const STATUS_SECURITY_STREAM_IS_INCONSISTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741408)); pub const STATUS_INVALID_LOCK_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741407)); pub const STATUS_INVALID_ACE_CONDITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741406)); pub const STATUS_IMAGE_SUBSYSTEM_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741405)); pub const STATUS_NOTIFICATION_GUID_ALREADY_DEFINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741404)); pub const STATUS_INVALID_EXCEPTION_HANDLER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741403)); pub const STATUS_DUPLICATE_PRIVILEGES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741402)); pub const STATUS_NOT_ALLOWED_ON_SYSTEM_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741401)); pub const STATUS_REPAIR_NEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741400)); pub const STATUS_QUOTA_NOT_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741399)); pub const STATUS_NO_APPLICATION_PACKAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741398)); pub const STATUS_FILE_METADATA_OPTIMIZATION_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741397)); pub const STATUS_NOT_SAME_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741396)); pub const STATUS_FATAL_MEMORY_EXHAUSTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741395)); pub const STATUS_ERROR_PROCESS_NOT_IN_JOB = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741394)); pub const STATUS_CPU_SET_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741393)); pub const STATUS_IO_DEVICE_INVALID_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741392)); pub const STATUS_IO_UNALIGNED_WRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741391)); pub const STATUS_CONTROL_STACK_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741390)); pub const STATUS_NETWORK_OPEN_RESTRICTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741311)); pub const STATUS_NO_USER_SESSION_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741310)); pub const STATUS_USER_SESSION_DELETED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741309)); pub const STATUS_RESOURCE_LANG_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741308)); pub const STATUS_INSUFF_SERVER_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741307)); pub const STATUS_INVALID_BUFFER_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741306)); pub const STATUS_INVALID_ADDRESS_COMPONENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741305)); pub const STATUS_INVALID_ADDRESS_WILDCARD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741304)); pub const STATUS_TOO_MANY_ADDRESSES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741303)); pub const STATUS_ADDRESS_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741302)); pub const STATUS_ADDRESS_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741301)); pub const STATUS_CONNECTION_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741300)); pub const STATUS_CONNECTION_RESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741299)); pub const STATUS_TOO_MANY_NODES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741298)); pub const STATUS_TRANSACTION_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741297)); pub const STATUS_TRANSACTION_TIMED_OUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741296)); pub const STATUS_TRANSACTION_NO_RELEASE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741295)); pub const STATUS_TRANSACTION_NO_MATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741294)); pub const STATUS_TRANSACTION_RESPONDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741293)); pub const STATUS_TRANSACTION_INVALID_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741292)); pub const STATUS_TRANSACTION_INVALID_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741291)); pub const STATUS_NOT_SERVER_SESSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741290)); pub const STATUS_NOT_CLIENT_SESSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741289)); pub const STATUS_CANNOT_LOAD_REGISTRY_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741288)); pub const STATUS_DEBUG_ATTACH_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741287)); pub const STATUS_SYSTEM_PROCESS_TERMINATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741286)); pub const STATUS_DATA_NOT_ACCEPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741285)); pub const STATUS_NO_BROWSER_SERVERS_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741284)); pub const STATUS_VDM_HARD_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741283)); pub const STATUS_DRIVER_CANCEL_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741282)); pub const STATUS_REPLY_MESSAGE_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741281)); pub const STATUS_MAPPED_ALIGNMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741280)); pub const STATUS_IMAGE_CHECKSUM_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741279)); pub const STATUS_LOST_WRITEBEHIND_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741278)); pub const STATUS_CLIENT_SERVER_PARAMETERS_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741277)); pub const STATUS_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741275)); pub const STATUS_NOT_TINY_STREAM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741274)); pub const STATUS_RECOVERY_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741273)); pub const STATUS_STACK_OVERFLOW_READ = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741272)); pub const STATUS_FAIL_CHECK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741271)); pub const STATUS_DUPLICATE_OBJECTID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741270)); pub const STATUS_OBJECTID_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741269)); pub const STATUS_CONVERT_TO_LARGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741268)); pub const STATUS_RETRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741267)); pub const STATUS_FOUND_OUT_OF_SCOPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741266)); pub const STATUS_ALLOCATE_BUCKET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741265)); pub const STATUS_PROPSET_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741264)); pub const STATUS_MARSHALL_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741263)); pub const STATUS_INVALID_VARIANT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741262)); pub const STATUS_DOMAIN_CONTROLLER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741261)); pub const STATUS_HANDLE_NOT_CLOSABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741259)); pub const STATUS_CONNECTION_REFUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741258)); pub const STATUS_GRACEFUL_DISCONNECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741257)); pub const STATUS_ADDRESS_ALREADY_ASSOCIATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741256)); pub const STATUS_ADDRESS_NOT_ASSOCIATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741255)); pub const STATUS_CONNECTION_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741254)); pub const STATUS_CONNECTION_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741253)); pub const STATUS_NETWORK_UNREACHABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741252)); pub const STATUS_HOST_UNREACHABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741251)); pub const STATUS_PROTOCOL_UNREACHABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741250)); pub const STATUS_PORT_UNREACHABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741249)); pub const STATUS_REQUEST_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741248)); pub const STATUS_CONNECTION_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741247)); pub const STATUS_BAD_COMPRESSION_BUFFER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741246)); pub const STATUS_USER_MAPPED_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741245)); pub const STATUS_AUDIT_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741244)); pub const STATUS_TIMER_RESOLUTION_NOT_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741243)); pub const STATUS_CONNECTION_COUNT_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741242)); pub const STATUS_LOGIN_TIME_RESTRICTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741241)); pub const STATUS_LOGIN_WKSTA_RESTRICTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741240)); pub const STATUS_IMAGE_MP_UP_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741239)); pub const STATUS_INSUFFICIENT_LOGON_INFO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741232)); pub const STATUS_BAD_DLL_ENTRYPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741231)); pub const STATUS_BAD_SERVICE_ENTRYPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741230)); pub const STATUS_LPC_REPLY_LOST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741229)); pub const STATUS_IP_ADDRESS_CONFLICT1 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741228)); pub const STATUS_IP_ADDRESS_CONFLICT2 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741227)); pub const STATUS_REGISTRY_QUOTA_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741226)); pub const STATUS_PATH_NOT_COVERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741225)); pub const STATUS_NO_CALLBACK_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741224)); pub const STATUS_LICENSE_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741223)); pub const STATUS_PWD_TOO_SHORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741222)); pub const STATUS_PWD_TOO_RECENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741221)); pub const STATUS_PWD_HISTORY_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741220)); pub const STATUS_PLUGPLAY_NO_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741218)); pub const STATUS_UNSUPPORTED_COMPRESSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741217)); pub const STATUS_INVALID_HW_PROFILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741216)); pub const STATUS_INVALID_PLUGPLAY_DEVICE_PATH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741215)); pub const STATUS_DRIVER_ORDINAL_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741214)); pub const STATUS_DRIVER_ENTRYPOINT_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741213)); pub const STATUS_RESOURCE_NOT_OWNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741212)); pub const STATUS_TOO_MANY_LINKS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741211)); pub const STATUS_QUOTA_LIST_INCONSISTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741210)); pub const STATUS_FILE_IS_OFFLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741209)); pub const STATUS_EVALUATION_EXPIRATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741208)); pub const STATUS_ILLEGAL_DLL_RELOCATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741207)); pub const STATUS_LICENSE_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741206)); pub const STATUS_DLL_INIT_FAILED_LOGOFF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741205)); pub const STATUS_DRIVER_UNABLE_TO_LOAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741204)); pub const STATUS_DFS_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741203)); pub const STATUS_VOLUME_DISMOUNTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741202)); pub const STATUS_WX86_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741201)); pub const STATUS_WX86_FLOAT_STACK_CHECK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741200)); pub const STATUS_VALIDATE_CONTINUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741199)); pub const STATUS_NO_MATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741198)); pub const STATUS_NO_MORE_MATCHES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741197)); pub const STATUS_NOT_A_REPARSE_POINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741195)); pub const STATUS_IO_REPARSE_TAG_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741194)); pub const STATUS_IO_REPARSE_TAG_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741193)); pub const STATUS_IO_REPARSE_DATA_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741192)); pub const STATUS_IO_REPARSE_TAG_NOT_HANDLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741191)); pub const STATUS_PWD_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741190)); pub const STATUS_STOWED_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741189)); pub const STATUS_CONTEXT_STOWED_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741188)); pub const STATUS_REPARSE_POINT_NOT_RESOLVED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741184)); pub const STATUS_DIRECTORY_IS_A_REPARSE_POINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741183)); pub const STATUS_RANGE_LIST_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741182)); pub const STATUS_SOURCE_ELEMENT_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741181)); pub const STATUS_DESTINATION_ELEMENT_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741180)); pub const STATUS_ILLEGAL_ELEMENT_ADDRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741179)); pub const STATUS_MAGAZINE_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741178)); pub const STATUS_REINITIALIZATION_NEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741177)); pub const STATUS_DEVICE_REQUIRES_CLEANING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147483000)); pub const STATUS_DEVICE_DOOR_OPEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147482999)); pub const STATUS_ENCRYPTION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741174)); pub const STATUS_DECRYPTION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741173)); pub const STATUS_RANGE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741172)); pub const STATUS_NO_RECOVERY_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741171)); pub const STATUS_NO_EFS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741170)); pub const STATUS_WRONG_EFS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741169)); pub const STATUS_NO_USER_KEYS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741168)); pub const STATUS_FILE_NOT_ENCRYPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741167)); pub const STATUS_NOT_EXPORT_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741166)); pub const STATUS_FILE_ENCRYPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741165)); pub const STATUS_WAKE_SYSTEM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073742484)); pub const STATUS_WMI_GUID_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741163)); pub const STATUS_WMI_INSTANCE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741162)); pub const STATUS_WMI_ITEMID_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741161)); pub const STATUS_WMI_TRY_AGAIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741160)); pub const STATUS_SHARED_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741159)); pub const STATUS_POLICY_OBJECT_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741158)); pub const STATUS_POLICY_ONLY_IN_DS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741157)); pub const STATUS_VOLUME_NOT_UPGRADED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741156)); pub const STATUS_REMOTE_STORAGE_NOT_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741155)); pub const STATUS_REMOTE_STORAGE_MEDIA_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741154)); pub const STATUS_NO_TRACKING_SERVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741153)); pub const STATUS_SERVER_SID_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741152)); pub const STATUS_DS_NO_ATTRIBUTE_OR_VALUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741151)); pub const STATUS_DS_INVALID_ATTRIBUTE_SYNTAX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741150)); pub const STATUS_DS_ATTRIBUTE_TYPE_UNDEFINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741149)); pub const STATUS_DS_ATTRIBUTE_OR_VALUE_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741148)); pub const STATUS_DS_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741147)); pub const STATUS_DS_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741146)); pub const STATUS_DS_NO_RIDS_ALLOCATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741145)); pub const STATUS_DS_NO_MORE_RIDS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741144)); pub const STATUS_DS_INCORRECT_ROLE_OWNER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741143)); pub const STATUS_DS_RIDMGR_INIT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741142)); pub const STATUS_DS_OBJ_CLASS_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741141)); pub const STATUS_DS_CANT_ON_NON_LEAF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741140)); pub const STATUS_DS_CANT_ON_RDN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741139)); pub const STATUS_DS_CANT_MOD_OBJ_CLASS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741138)); pub const STATUS_DS_CROSS_DOM_MOVE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741137)); pub const STATUS_DS_GC_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741136)); pub const STATUS_DIRECTORY_SERVICE_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741135)); pub const STATUS_REPARSE_ATTRIBUTE_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741134)); pub const STATUS_CANT_ENABLE_DENY_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741133)); pub const STATUS_FLOAT_MULTIPLE_FAULTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741132)); pub const STATUS_FLOAT_MULTIPLE_TRAPS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741131)); pub const STATUS_DEVICE_REMOVED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741130)); pub const STATUS_JOURNAL_DELETE_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741129)); pub const STATUS_JOURNAL_NOT_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741128)); pub const STATUS_NOINTERFACE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741127)); pub const STATUS_DS_RIDMGR_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741126)); pub const STATUS_DS_ADMIN_LIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741119)); pub const STATUS_DRIVER_FAILED_SLEEP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741118)); pub const STATUS_MUTUAL_AUTHENTICATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741117)); pub const STATUS_CORRUPT_SYSTEM_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741116)); pub const STATUS_DATATYPE_MISALIGNMENT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741115)); pub const STATUS_WMI_READ_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741114)); pub const STATUS_WMI_SET_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741113)); pub const STATUS_COMMITMENT_MINIMUM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741112)); pub const STATUS_REG_NAT_CONSUMPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741111)); pub const STATUS_TRANSPORT_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741110)); pub const STATUS_DS_SAM_INIT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741109)); pub const STATUS_ONLY_IF_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741108)); pub const STATUS_DS_SENSITIVE_GROUP_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741107)); pub const STATUS_PNP_RESTART_ENUMERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741106)); pub const STATUS_JOURNAL_ENTRY_DELETED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741105)); pub const STATUS_DS_CANT_MOD_PRIMARYGROUPID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741104)); pub const STATUS_SYSTEM_IMAGE_BAD_SIGNATURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741103)); pub const STATUS_PNP_REBOOT_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741102)); pub const STATUS_POWER_STATE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741101)); pub const STATUS_DS_INVALID_GROUP_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741100)); pub const STATUS_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741099)); pub const STATUS_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741098)); pub const STATUS_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741097)); pub const STATUS_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741096)); pub const STATUS_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741095)); pub const STATUS_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741094)); pub const STATUS_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741093)); pub const STATUS_DS_HAVE_PRIMARY_MEMBERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741092)); pub const STATUS_WMI_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741091)); pub const STATUS_INSUFFICIENT_POWER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741090)); pub const STATUS_SAM_NEED_BOOTKEY_PASSWORD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741089)); pub const STATUS_SAM_NEED_BOOTKEY_FLOPPY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741088)); pub const STATUS_DS_CANT_START = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741087)); pub const STATUS_DS_INIT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741086)); pub const STATUS_SAM_INIT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741085)); pub const STATUS_DS_GC_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741084)); pub const STATUS_DS_LOCAL_MEMBER_OF_LOCAL_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741083)); pub const STATUS_DS_NO_FPO_IN_UNIVERSAL_GROUPS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741082)); pub const STATUS_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741081)); pub const STATUS_MULTIPLE_FAULT_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741080)); pub const STATUS_CURRENT_DOMAIN_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741079)); pub const STATUS_CANNOT_MAKE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741078)); pub const STATUS_SYSTEM_SHUTDOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741077)); pub const STATUS_DS_INIT_FAILURE_CONSOLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741076)); pub const STATUS_DS_SAM_INIT_FAILURE_CONSOLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741075)); pub const STATUS_UNFINISHED_CONTEXT_DELETED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741074)); pub const STATUS_NO_TGT_REPLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741073)); pub const STATUS_OBJECTID_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741072)); pub const STATUS_NO_IP_ADDRESSES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741071)); pub const STATUS_WRONG_CREDENTIAL_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741070)); pub const STATUS_CRYPTO_SYSTEM_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741069)); pub const STATUS_MAX_REFERRALS_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741068)); pub const STATUS_MUST_BE_KDC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741067)); pub const STATUS_STRONG_CRYPTO_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741066)); pub const STATUS_TOO_MANY_PRINCIPALS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741065)); pub const STATUS_NO_PA_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741064)); pub const STATUS_PKINIT_NAME_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741063)); pub const STATUS_SMARTCARD_LOGON_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741062)); pub const STATUS_KDC_INVALID_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741061)); pub const STATUS_KDC_UNABLE_TO_REFER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741060)); pub const STATUS_KDC_UNKNOWN_ETYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741059)); pub const STATUS_SHUTDOWN_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741058)); pub const STATUS_SERVER_SHUTDOWN_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741057)); pub const STATUS_NOT_SUPPORTED_ON_SBS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741056)); pub const STATUS_WMI_GUID_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741055)); pub const STATUS_WMI_ALREADY_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741054)); pub const STATUS_WMI_ALREADY_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741053)); pub const STATUS_MFT_TOO_FRAGMENTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741052)); pub const STATUS_COPY_PROTECTION_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741051)); pub const STATUS_CSS_AUTHENTICATION_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741050)); pub const STATUS_CSS_KEY_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741049)); pub const STATUS_CSS_KEY_NOT_ESTABLISHED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741048)); pub const STATUS_CSS_SCRAMBLED_SECTOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741047)); pub const STATUS_CSS_REGION_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741046)); pub const STATUS_CSS_RESETS_EXHAUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741045)); pub const STATUS_PASSWORD_CHANGE_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741044)); pub const STATUS_LOST_MODE_LOGON_RESTRICTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741043)); pub const STATUS_PKINIT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741024)); pub const STATUS_SMARTCARD_SUBSYSTEM_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741023)); pub const STATUS_NO_KERB_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073741022)); pub const STATUS_HOST_DOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740976)); pub const STATUS_UNSUPPORTED_PREAUTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740975)); pub const STATUS_EFS_ALG_BLOB_TOO_BIG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740974)); pub const STATUS_PORT_NOT_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740973)); pub const STATUS_DEBUGGER_INACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740972)); pub const STATUS_DS_VERSION_CHECK_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740971)); pub const STATUS_AUDITING_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740970)); pub const STATUS_PRENT4_MACHINE_ACCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740969)); pub const STATUS_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740968)); pub const STATUS_INVALID_IMAGE_WIN_32 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740967)); pub const STATUS_INVALID_IMAGE_WIN_64 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740966)); pub const STATUS_BAD_BINDINGS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740965)); pub const STATUS_NETWORK_SESSION_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740964)); pub const STATUS_APPHELP_BLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740963)); pub const STATUS_ALL_SIDS_FILTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740962)); pub const STATUS_NOT_SAFE_MODE_DRIVER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740961)); pub const STATUS_ACCESS_DISABLED_BY_POLICY_DEFAULT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740959)); pub const STATUS_ACCESS_DISABLED_BY_POLICY_PATH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740958)); pub const STATUS_ACCESS_DISABLED_BY_POLICY_PUBLISHER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740957)); pub const STATUS_ACCESS_DISABLED_BY_POLICY_OTHER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740956)); pub const STATUS_FAILED_DRIVER_ENTRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740955)); pub const STATUS_DEVICE_ENUMERATION_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740954)); pub const STATUS_MOUNT_POINT_NOT_RESOLVED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740952)); pub const STATUS_INVALID_DEVICE_OBJECT_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740951)); pub const STATUS_MCA_OCCURED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740950)); pub const STATUS_DRIVER_BLOCKED_CRITICAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740949)); pub const STATUS_DRIVER_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740948)); pub const STATUS_DRIVER_DATABASE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740947)); pub const STATUS_SYSTEM_HIVE_TOO_LARGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740946)); pub const STATUS_INVALID_IMPORT_OF_NON_DLL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740945)); pub const STATUS_DS_SHUTTING_DOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073742704)); pub const STATUS_NO_SECRETS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740943)); pub const STATUS_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740942)); pub const STATUS_FAILED_STACK_SWITCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740941)); pub const STATUS_HEAP_CORRUPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740940)); pub const STATUS_SMARTCARD_WRONG_PIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740928)); pub const STATUS_SMARTCARD_CARD_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740927)); pub const STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740926)); pub const STATUS_SMARTCARD_NO_CARD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740925)); pub const STATUS_SMARTCARD_NO_KEY_CONTAINER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740924)); pub const STATUS_SMARTCARD_NO_CERTIFICATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740923)); pub const STATUS_SMARTCARD_NO_KEYSET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740922)); pub const STATUS_SMARTCARD_IO_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740921)); pub const STATUS_SMARTCARD_CERT_REVOKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740919)); pub const STATUS_ISSUING_CA_UNTRUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740918)); pub const STATUS_REVOCATION_OFFLINE_C = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740917)); pub const STATUS_PKINIT_CLIENT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740916)); pub const STATUS_SMARTCARD_CERT_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740915)); pub const STATUS_DRIVER_FAILED_PRIOR_UNLOAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740914)); pub const STATUS_SMARTCARD_SILENT_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740913)); pub const STATUS_PER_USER_TRUST_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740799)); pub const STATUS_ALL_USER_TRUST_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740798)); pub const STATUS_USER_DELETE_TRUST_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740797)); pub const STATUS_DS_NAME_NOT_UNIQUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740796)); pub const STATUS_DS_DUPLICATE_ID_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740795)); pub const STATUS_DS_GROUP_CONVERSION_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740794)); pub const STATUS_VOLSNAP_PREPARE_HIBERNATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740793)); pub const STATUS_USER2USER_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740792)); pub const STATUS_STACK_BUFFER_OVERRUN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740791)); pub const STATUS_NO_S4U_PROT_SUPPORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740790)); pub const STATUS_CROSSREALM_DELEGATION_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740789)); pub const STATUS_REVOCATION_OFFLINE_KDC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740788)); pub const STATUS_ISSUING_CA_UNTRUSTED_KDC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740787)); pub const STATUS_KDC_CERT_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740786)); pub const STATUS_KDC_CERT_REVOKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740785)); pub const STATUS_PARAMETER_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740784)); pub const STATUS_HIBERNATION_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740783)); pub const STATUS_DELAY_LOAD_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740782)); pub const STATUS_VDM_DISALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740780)); pub const STATUS_HUNG_DISPLAY_DRIVER_THREAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740779)); pub const STATUS_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740778)); pub const STATUS_INVALID_CRUNTIME_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740777)); pub const STATUS_NTLM_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740776)); pub const STATUS_DS_SRC_SID_EXISTS_IN_FOREST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740775)); pub const STATUS_DS_DOMAIN_NAME_EXISTS_IN_FOREST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740774)); pub const STATUS_DS_FLAT_NAME_EXISTS_IN_FOREST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740773)); pub const STATUS_INVALID_USER_PRINCIPAL_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740772)); pub const STATUS_FATAL_USER_CALLBACK_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740771)); pub const STATUS_ASSERTION_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740768)); pub const STATUS_VERIFIER_STOP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740767)); pub const STATUS_CALLBACK_POP_STACK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740765)); pub const STATUS_INCOMPATIBLE_DRIVER_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740764)); pub const STATUS_HIVE_UNLOADED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740763)); pub const STATUS_COMPRESSION_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740762)); pub const STATUS_FILE_SYSTEM_LIMITATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740761)); pub const STATUS_INVALID_IMAGE_HASH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740760)); pub const STATUS_NOT_CAPABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740759)); pub const STATUS_REQUEST_OUT_OF_SEQUENCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740758)); pub const STATUS_IMPLEMENTATION_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740757)); pub const STATUS_ELEVATION_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740756)); pub const STATUS_NO_SECURITY_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740755)); pub const STATUS_PKU2U_CERT_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740753)); pub const STATUS_BEYOND_VDL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740750)); pub const STATUS_ENCOUNTERED_WRITE_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740749)); pub const STATUS_PTE_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740748)); pub const STATUS_PURGE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740747)); pub const STATUS_CRED_REQUIRES_CONFIRMATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740736)); pub const STATUS_CS_ENCRYPTION_INVALID_SERVER_RESPONSE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740735)); pub const STATUS_CS_ENCRYPTION_UNSUPPORTED_SERVER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740734)); pub const STATUS_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740733)); pub const STATUS_CS_ENCRYPTION_NEW_ENCRYPTED_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740732)); pub const STATUS_CS_ENCRYPTION_FILE_NOT_CSE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740731)); pub const STATUS_INVALID_LABEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740730)); pub const STATUS_DRIVER_PROCESS_TERMINATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740720)); pub const STATUS_AMBIGUOUS_SYSTEM_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740719)); pub const STATUS_SYSTEM_DEVICE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740718)); pub const STATUS_RESTART_BOOT_APPLICATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740717)); pub const STATUS_INSUFFICIENT_NVRAM_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740716)); pub const STATUS_INVALID_SESSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740715)); pub const STATUS_THREAD_ALREADY_IN_SESSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740714)); pub const STATUS_THREAD_NOT_IN_SESSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740713)); pub const STATUS_INVALID_WEIGHT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740712)); pub const STATUS_REQUEST_PAUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740711)); pub const STATUS_NO_RANGES_PROCESSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740704)); pub const STATUS_DISK_RESOURCES_EXHAUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740703)); pub const STATUS_NEEDS_REMEDIATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740702)); pub const STATUS_DEVICE_FEATURE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740701)); pub const STATUS_DEVICE_UNREACHABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740700)); pub const STATUS_INVALID_TOKEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740699)); pub const STATUS_SERVER_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740698)); pub const STATUS_FILE_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740697)); pub const STATUS_DEVICE_INSUFFICIENT_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740696)); pub const STATUS_PACKAGE_UPDATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740695)); pub const STATUS_NOT_READ_FROM_COPY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740694)); pub const STATUS_FT_WRITE_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740693)); pub const STATUS_FT_DI_SCAN_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740692)); pub const STATUS_OBJECT_NOT_EXTERNALLY_BACKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740691)); pub const STATUS_EXTERNAL_BACKING_PROVIDER_UNKNOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740690)); pub const STATUS_COMPRESSION_NOT_BENEFICIAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740689)); pub const STATUS_DATA_CHECKSUM_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740688)); pub const STATUS_INTERMIXED_KERNEL_EA_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740687)); pub const STATUS_TRIM_READ_ZERO_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740686)); pub const STATUS_TOO_MANY_SEGMENT_DESCRIPTORS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740685)); pub const STATUS_INVALID_OFFSET_ALIGNMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740684)); pub const STATUS_INVALID_FIELD_IN_PARAMETER_LIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740683)); pub const STATUS_OPERATION_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740682)); pub const STATUS_INVALID_INITIATOR_TARGET_PATH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740681)); pub const STATUS_SCRUB_DATA_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740680)); pub const STATUS_NOT_REDUNDANT_STORAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740679)); pub const STATUS_RESIDENT_FILE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740678)); pub const STATUS_COMPRESSED_FILE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740677)); pub const STATUS_DIRECTORY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740676)); pub const STATUS_IO_OPERATION_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740675)); pub const STATUS_SYSTEM_NEEDS_REMEDIATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740674)); pub const STATUS_APPX_INTEGRITY_FAILURE_CLR_NGEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740673)); pub const STATUS_SHARE_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740672)); pub const STATUS_APISET_NOT_HOSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740671)); pub const STATUS_APISET_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740670)); pub const STATUS_DEVICE_HARDWARE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740669)); pub const STATUS_FIRMWARE_SLOT_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740668)); pub const STATUS_FIRMWARE_IMAGE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740667)); pub const STATUS_STORAGE_TOPOLOGY_ID_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740666)); pub const STATUS_WIM_NOT_BOOTABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740665)); pub const STATUS_BLOCKED_BY_PARENTAL_CONTROLS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740664)); pub const STATUS_NEEDS_REGISTRATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740663)); pub const STATUS_QUOTA_ACTIVITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740662)); pub const STATUS_CALLBACK_INVOKE_INLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740661)); pub const STATUS_BLOCK_TOO_MANY_REFERENCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740660)); pub const STATUS_MARKED_TO_DISALLOW_WRITES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740659)); pub const STATUS_NETWORK_ACCESS_DENIED_EDP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740658)); pub const STATUS_ENCLAVE_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740657)); pub const STATUS_PNP_NO_COMPAT_DRIVERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740656)); pub const STATUS_PNP_DRIVER_PACKAGE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740655)); pub const STATUS_PNP_DRIVER_CONFIGURATION_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740654)); pub const STATUS_PNP_DRIVER_CONFIGURATION_INCOMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740653)); pub const STATUS_PNP_FUNCTION_DRIVER_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740652)); pub const STATUS_PNP_DEVICE_CONFIGURATION_PENDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740651)); pub const STATUS_DEVICE_HINT_NAME_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740650)); pub const STATUS_PACKAGE_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740649)); pub const STATUS_DEVICE_IN_MAINTENANCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740647)); pub const STATUS_NOT_SUPPORTED_ON_DAX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740646)); pub const STATUS_FREE_SPACE_TOO_FRAGMENTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740645)); pub const STATUS_DAX_MAPPING_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740644)); pub const STATUS_CHILD_PROCESS_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740643)); pub const STATUS_STORAGE_LOST_DATA_PERSISTENCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740642)); pub const STATUS_VRF_CFG_AND_IO_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740641)); pub const STATUS_PARTITION_TERMINATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740640)); pub const STATUS_EXTERNAL_SYSKEY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740639)); pub const STATUS_ENCLAVE_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740638)); pub const STATUS_FILE_PROTECTED_UNDER_DPL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740637)); pub const STATUS_VOLUME_NOT_CLUSTER_ALIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740636)); pub const STATUS_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740635)); pub const STATUS_APPX_FILE_NOT_ENCRYPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740634)); pub const STATUS_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740633)); pub const STATUS_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740632)); pub const STATUS_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740631)); pub const STATUS_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740630)); pub const STATUS_FT_READ_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740629)); pub const STATUS_PATCH_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740628)); pub const STATUS_STORAGE_RESERVE_ID_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740627)); pub const STATUS_STORAGE_RESERVE_DOES_NOT_EXIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740626)); pub const STATUS_STORAGE_RESERVE_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740625)); pub const STATUS_STORAGE_RESERVE_NOT_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740624)); pub const STATUS_NOT_A_DAX_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740623)); pub const STATUS_NOT_DAX_MAPPABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740622)); pub const STATUS_CASE_DIFFERING_NAMES_IN_DIR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740621)); pub const STATUS_FILE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740620)); pub const STATUS_NOT_SUPPORTED_WITH_BTT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740619)); pub const STATUS_ENCRYPTION_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740618)); pub const STATUS_ENCRYPTING_METADATA_DISALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740617)); pub const STATUS_CANT_CLEAR_ENCRYPTION_FLAG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740616)); pub const STATUS_UNSATISFIED_DEPENDENCIES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740615)); pub const STATUS_CASE_SENSITIVE_PATH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740614)); pub const STATUS_INVALID_TASK_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740544)); pub const STATUS_INVALID_TASK_INDEX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740543)); pub const STATUS_THREAD_ALREADY_IN_TASK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740542)); pub const STATUS_CALLBACK_BYPASS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740541)); pub const STATUS_UNDEFINED_SCOPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740540)); pub const STATUS_INVALID_CAP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740539)); pub const STATUS_NOT_GUI_PROCESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740538)); pub const STATUS_DEVICE_HUNG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740537)); pub const STATUS_CONTAINER_ASSIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740536)); pub const STATUS_JOB_NO_CONTAINER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740535)); pub const STATUS_DEVICE_UNRESPONSIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740534)); pub const STATUS_REPARSE_POINT_ENCOUNTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740533)); pub const STATUS_ATTRIBUTE_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740532)); pub const STATUS_NOT_A_TIERED_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740531)); pub const STATUS_ALREADY_HAS_STREAM_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740530)); pub const STATUS_JOB_NOT_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740529)); pub const STATUS_ALREADY_INITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740528)); pub const STATUS_ENCLAVE_NOT_TERMINATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740527)); pub const STATUS_ENCLAVE_IS_TERMINATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740526)); pub const STATUS_SMB1_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740525)); pub const STATUS_SMR_GARBAGE_COLLECTION_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740524)); pub const STATUS_INTERRUPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740523)); pub const STATUS_THREAD_NOT_RUNNING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740522)); pub const STATUS_FAIL_FAST_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740286)); pub const STATUS_IMAGE_CERT_REVOKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740285)); pub const STATUS_DYNAMIC_CODE_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740284)); pub const STATUS_IMAGE_CERT_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740283)); pub const STATUS_STRICT_CFG_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740282)); pub const STATUS_SET_CONTEXT_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740278)); pub const STATUS_CROSS_PARTITION_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740277)); pub const STATUS_PORT_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740032)); pub const STATUS_MESSAGE_LOST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740031)); pub const STATUS_INVALID_MESSAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740030)); pub const STATUS_REQUEST_CANCELED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740029)); pub const STATUS_RECURSIVE_DISPATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740028)); pub const STATUS_LPC_RECEIVE_BUFFER_EXPECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740027)); pub const STATUS_LPC_INVALID_CONNECTION_USAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740026)); pub const STATUS_LPC_REQUESTS_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740025)); pub const STATUS_RESOURCE_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740024)); pub const STATUS_HARDWARE_MEMORY_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740023)); pub const STATUS_THREADPOOL_HANDLE_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740022)); pub const STATUS_THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740021)); pub const STATUS_THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740020)); pub const STATUS_THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740019)); pub const STATUS_THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740018)); pub const STATUS_THREADPOOL_RELEASED_DURING_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740017)); pub const STATUS_CALLBACK_RETURNED_WHILE_IMPERSONATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740016)); pub const STATUS_APC_RETURNED_WHILE_IMPERSONATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740015)); pub const STATUS_PROCESS_IS_PROTECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740014)); pub const STATUS_MCA_EXCEPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740013)); pub const STATUS_CERTIFICATE_MAPPING_NOT_UNIQUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740012)); pub const STATUS_SYMLINK_CLASS_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740011)); pub const STATUS_INVALID_IDN_NORMALIZATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740010)); pub const STATUS_NO_UNICODE_TRANSLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740009)); pub const STATUS_ALREADY_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740008)); pub const STATUS_CONTEXT_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740007)); pub const STATUS_PORT_ALREADY_HAS_COMPLETION_LIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740006)); pub const STATUS_CALLBACK_RETURNED_THREAD_PRIORITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740005)); pub const STATUS_INVALID_THREAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740004)); pub const STATUS_CALLBACK_RETURNED_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740003)); pub const STATUS_CALLBACK_RETURNED_LDR_LOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740002)); pub const STATUS_CALLBACK_RETURNED_LANG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740001)); pub const STATUS_CALLBACK_RETURNED_PRI_BACK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073740000)); pub const STATUS_CALLBACK_RETURNED_THREAD_AFFINITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739999)); pub const STATUS_LPC_HANDLE_COUNT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739998)); pub const STATUS_EXECUTABLE_MEMORY_WRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739997)); pub const STATUS_KERNEL_EXECUTABLE_MEMORY_WRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739996)); pub const STATUS_ATTACHED_EXECUTABLE_MEMORY_WRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739995)); pub const STATUS_TRIGGERED_EXECUTABLE_MEMORY_WRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739994)); pub const STATUS_DISK_REPAIR_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739776)); pub const STATUS_DS_DOMAIN_RENAME_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739775)); pub const STATUS_DISK_QUOTA_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739774)); pub const STATUS_DATA_LOST_REPAIR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147481597)); pub const STATUS_CONTENT_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739772)); pub const STATUS_BAD_CLUSTERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739771)); pub const STATUS_VOLUME_DIRTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739770)); pub const STATUS_DISK_REPAIR_REDIRECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073743879)); pub const STATUS_DISK_REPAIR_UNSUCCESSFUL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739768)); pub const STATUS_CORRUPT_LOG_OVERFULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739767)); pub const STATUS_CORRUPT_LOG_CORRUPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739766)); pub const STATUS_CORRUPT_LOG_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739765)); pub const STATUS_CORRUPT_LOG_DELETED_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739764)); pub const STATUS_CORRUPT_LOG_CLEARED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739763)); pub const STATUS_ORPHAN_NAME_EXHAUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739762)); pub const STATUS_PROACTIVE_SCAN_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739761)); pub const STATUS_ENCRYPTED_IO_NOT_POSSIBLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739760)); pub const STATUS_CORRUPT_LOG_UPLEVEL_RECORDS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739759)); pub const STATUS_FILE_CHECKED_OUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739519)); pub const STATUS_CHECKOUT_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739518)); pub const STATUS_BAD_FILE_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739517)); pub const STATUS_FILE_TOO_LARGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739516)); pub const STATUS_FORMS_AUTH_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739515)); pub const STATUS_VIRUS_INFECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739514)); pub const STATUS_VIRUS_DELETED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739513)); pub const STATUS_BAD_MCFG_TABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739512)); pub const STATUS_CANNOT_BREAK_OPLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739511)); pub const STATUS_BAD_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739510)); pub const STATUS_BAD_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739509)); pub const STATUS_NO_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739508)); pub const STATUS_FILE_HANDLE_REVOKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073739504)); pub const STATUS_WOW_ASSERTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073702760)); pub const STATUS_INVALID_SIGNATURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700864)); pub const STATUS_HMAC_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700863)); pub const STATUS_AUTH_TAG_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700862)); pub const STATUS_INVALID_STATE_TRANSITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700861)); pub const STATUS_INVALID_KERNEL_INFO_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700860)); pub const STATUS_INVALID_PEP_INFO_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700859)); pub const STATUS_HANDLE_REVOKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700858)); pub const STATUS_EOF_ON_GHOSTED_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700857)); pub const STATUS_CC_NEEDS_CALLBACK_SECTION_DRAIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700856)); pub const STATUS_IPSEC_QUEUE_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700848)); pub const STATUS_ND_QUEUE_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700847)); pub const STATUS_HOPLIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700846)); pub const STATUS_PROTOCOL_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700845)); pub const STATUS_FASTPATH_REJECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700844)); pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700736)); pub const STATUS_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700735)); pub const STATUS_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700734)); pub const STATUS_XML_PARSE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700733)); pub const STATUS_XMLDSIG_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700732)); pub const STATUS_WRONG_COMPARTMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700731)); pub const STATUS_AUTHIP_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700730)); pub const STATUS_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700729)); pub const STATUS_DS_OID_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700728)); pub const STATUS_INCORRECT_ACCOUNT_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700727)); pub const STATUS_HASH_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700608)); pub const STATUS_HASH_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700607)); pub const STATUS_SECONDARY_IC_PROVIDER_NOT_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700575)); pub const STATUS_GPIO_CLIENT_INFORMATION_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700574)); pub const STATUS_GPIO_VERSION_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700573)); pub const STATUS_GPIO_INVALID_REGISTRATION_PACKET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700572)); pub const STATUS_GPIO_OPERATION_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700571)); pub const STATUS_GPIO_INCOMPATIBLE_CONNECT_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700570)); pub const STATUS_GPIO_INTERRUPT_ALREADY_UNMASKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147442393)); pub const STATUS_CANNOT_SWITCH_RUNLEVEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700543)); pub const STATUS_INVALID_RUNLEVEL_SETTING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700542)); pub const STATUS_RUNLEVEL_SWITCH_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700541)); pub const STATUS_SERVICES_FAILED_AUTOSTART = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073783108)); pub const STATUS_RUNLEVEL_SWITCH_AGENT_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700539)); pub const STATUS_RUNLEVEL_SWITCH_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700538)); pub const STATUS_NOT_APPCONTAINER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700352)); pub const STATUS_NOT_SUPPORTED_IN_APPCONTAINER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700351)); pub const STATUS_INVALID_PACKAGE_SID_LENGTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700350)); pub const STATUS_LPAC_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700349)); pub const STATUS_ADMINLESS_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700348)); pub const STATUS_APP_DATA_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700223)); pub const STATUS_APP_DATA_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700222)); pub const STATUS_APP_DATA_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700221)); pub const STATUS_APP_DATA_LIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700220)); pub const STATUS_APP_DATA_REBOOT_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700219)); pub const STATUS_OFFLOAD_READ_FLT_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700191)); pub const STATUS_OFFLOAD_WRITE_FLT_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700190)); pub const STATUS_OFFLOAD_READ_FILE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700189)); pub const STATUS_OFFLOAD_WRITE_FILE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700188)); pub const STATUS_WOF_WIM_HEADER_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700187)); pub const STATUS_WOF_WIM_RESOURCE_TABLE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700186)); pub const STATUS_WOF_FILE_RESOURCE_TABLE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073700185)); pub const STATUS_CIMFS_IMAGE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073692671)); pub const STATUS_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073689087)); pub const STATUS_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073689086)); pub const STATUS_FILE_SYSTEM_VIRTUALIZATION_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073689085)); pub const STATUS_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073689084)); pub const STATUS_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073689083)); pub const STATUS_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688832)); pub const STATUS_CLOUD_FILE_PROVIDER_NOT_RUNNING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688831)); pub const STATUS_CLOUD_FILE_METADATA_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688830)); pub const STATUS_CLOUD_FILE_METADATA_TOO_LARGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688829)); pub const STATUS_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147430652)); pub const STATUS_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2147430651)); pub const STATUS_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688826)); pub const STATUS_NOT_A_CLOUD_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688825)); pub const STATUS_CLOUD_FILE_NOT_IN_SYNC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688824)); pub const STATUS_CLOUD_FILE_ALREADY_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688823)); pub const STATUS_CLOUD_FILE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688822)); pub const STATUS_CLOUD_FILE_INVALID_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688821)); pub const STATUS_CLOUD_FILE_READ_ONLY_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688820)); pub const STATUS_CLOUD_FILE_CONNECTED_PROVIDER_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688819)); pub const STATUS_CLOUD_FILE_VALIDATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688818)); pub const STATUS_CLOUD_FILE_AUTHENTICATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688817)); pub const STATUS_CLOUD_FILE_INSUFFICIENT_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688816)); pub const STATUS_CLOUD_FILE_NETWORK_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688815)); pub const STATUS_CLOUD_FILE_UNSUCCESSFUL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688814)); pub const STATUS_CLOUD_FILE_NOT_UNDER_SYNC_ROOT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688813)); pub const STATUS_CLOUD_FILE_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688812)); pub const STATUS_CLOUD_FILE_PINNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688811)); pub const STATUS_CLOUD_FILE_REQUEST_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688810)); pub const STATUS_CLOUD_FILE_PROPERTY_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688809)); pub const STATUS_CLOUD_FILE_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688808)); pub const STATUS_CLOUD_FILE_INCOMPATIBLE_HARDLINKS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688807)); pub const STATUS_CLOUD_FILE_PROPERTY_LOCK_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688806)); pub const STATUS_CLOUD_FILE_REQUEST_CANCELED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688805)); pub const STATUS_CLOUD_FILE_PROVIDER_TERMINATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688803)); pub const STATUS_NOT_A_CLOUD_SYNC_ROOT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688802)); pub const STATUS_CLOUD_FILE_REQUEST_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688801)); pub const STATUS_CLOUD_FILE_DEHYDRATION_DISALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073688800)); pub const STATUS_FILE_SNAP_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073679104)); pub const STATUS_FILE_SNAP_USER_SECTION_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073679103)); pub const STATUS_FILE_SNAP_MODIFY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073679102)); pub const STATUS_FILE_SNAP_IO_NOT_COORDINATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073679101)); pub const STATUS_FILE_SNAP_UNEXPECTED_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073679100)); pub const STATUS_FILE_SNAP_INVALID_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073679099)); pub const DBG_NO_STATE_CHANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073676287)); pub const DBG_APP_NOT_IDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073676286)); pub const RPC_NT_INVALID_STRING_BINDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610751)); pub const RPC_NT_WRONG_KIND_OF_BINDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610750)); pub const RPC_NT_INVALID_BINDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610749)); pub const RPC_NT_PROTSEQ_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610748)); pub const RPC_NT_INVALID_RPC_PROTSEQ = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610747)); pub const RPC_NT_INVALID_STRING_UUID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610746)); pub const RPC_NT_INVALID_ENDPOINT_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610745)); pub const RPC_NT_INVALID_NET_ADDR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610744)); pub const RPC_NT_NO_ENDPOINT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610743)); pub const RPC_NT_INVALID_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610742)); pub const RPC_NT_OBJECT_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610741)); pub const RPC_NT_ALREADY_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610740)); pub const RPC_NT_TYPE_ALREADY_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610739)); pub const RPC_NT_ALREADY_LISTENING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610738)); pub const RPC_NT_NO_PROTSEQS_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610737)); pub const RPC_NT_NOT_LISTENING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610736)); pub const RPC_NT_UNKNOWN_MGR_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610735)); pub const RPC_NT_UNKNOWN_IF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610734)); pub const RPC_NT_NO_BINDINGS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610733)); pub const RPC_NT_NO_PROTSEQS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610732)); pub const RPC_NT_CANT_CREATE_ENDPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610731)); pub const RPC_NT_OUT_OF_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610730)); pub const RPC_NT_SERVER_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610729)); pub const RPC_NT_SERVER_TOO_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610728)); pub const RPC_NT_INVALID_NETWORK_OPTIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610727)); pub const RPC_NT_NO_CALL_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610726)); pub const RPC_NT_CALL_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610725)); pub const RPC_NT_CALL_FAILED_DNE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610724)); pub const RPC_NT_PROTOCOL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610723)); pub const RPC_NT_UNSUPPORTED_TRANS_SYN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610721)); pub const RPC_NT_UNSUPPORTED_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610719)); pub const RPC_NT_INVALID_TAG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610718)); pub const RPC_NT_INVALID_BOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610717)); pub const RPC_NT_NO_ENTRY_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610716)); pub const RPC_NT_INVALID_NAME_SYNTAX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610715)); pub const RPC_NT_UNSUPPORTED_NAME_SYNTAX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610714)); pub const RPC_NT_UUID_NO_ADDRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610712)); pub const RPC_NT_DUPLICATE_ENDPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610711)); pub const RPC_NT_UNKNOWN_AUTHN_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610710)); pub const RPC_NT_MAX_CALLS_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610709)); pub const RPC_NT_STRING_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610708)); pub const RPC_NT_PROTSEQ_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610707)); pub const RPC_NT_PROCNUM_OUT_OF_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610706)); pub const RPC_NT_BINDING_HAS_NO_AUTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610705)); pub const RPC_NT_UNKNOWN_AUTHN_SERVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610704)); pub const RPC_NT_UNKNOWN_AUTHN_LEVEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610703)); pub const RPC_NT_INVALID_AUTH_IDENTITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610702)); pub const RPC_NT_UNKNOWN_AUTHZ_SERVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610701)); pub const EPT_NT_INVALID_ENTRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610700)); pub const EPT_NT_CANT_PERFORM_OP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610699)); pub const EPT_NT_NOT_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610698)); pub const RPC_NT_NOTHING_TO_EXPORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610697)); pub const RPC_NT_INCOMPLETE_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610696)); pub const RPC_NT_INVALID_VERS_OPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610695)); pub const RPC_NT_NO_MORE_MEMBERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610694)); pub const RPC_NT_NOT_ALL_OBJS_UNEXPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610693)); pub const RPC_NT_INTERFACE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610692)); pub const RPC_NT_ENTRY_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610691)); pub const RPC_NT_ENTRY_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610690)); pub const RPC_NT_NAME_SERVICE_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610689)); pub const RPC_NT_INVALID_NAF_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610688)); pub const RPC_NT_CANNOT_SUPPORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610687)); pub const RPC_NT_NO_CONTEXT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610686)); pub const RPC_NT_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610685)); pub const RPC_NT_ZERO_DIVIDE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610684)); pub const RPC_NT_ADDRESS_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610683)); pub const RPC_NT_FP_DIV_ZERO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610682)); pub const RPC_NT_FP_UNDERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610681)); pub const RPC_NT_FP_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610680)); pub const RPC_NT_NO_MORE_ENTRIES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545215)); pub const RPC_NT_SS_CHAR_TRANS_OPEN_FAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545214)); pub const RPC_NT_SS_CHAR_TRANS_SHORT_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545213)); pub const RPC_NT_SS_IN_NULL_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545212)); pub const RPC_NT_SS_CONTEXT_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545211)); pub const RPC_NT_SS_CONTEXT_DAMAGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545210)); pub const RPC_NT_SS_HANDLES_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545209)); pub const RPC_NT_SS_CANNOT_GET_CALL_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545208)); pub const RPC_NT_NULL_REF_POINTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545207)); pub const RPC_NT_ENUM_VALUE_OUT_OF_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545206)); pub const RPC_NT_BYTE_COUNT_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545205)); pub const RPC_NT_BAD_STUB_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545204)); pub const RPC_NT_CALL_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610679)); pub const RPC_NT_NO_MORE_BINDINGS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610678)); pub const RPC_NT_GROUP_MEMBER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610677)); pub const EPT_NT_CANT_CREATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610676)); pub const RPC_NT_INVALID_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610675)); pub const RPC_NT_NO_INTERFACES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610673)); pub const RPC_NT_CALL_CANCELLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610672)); pub const RPC_NT_BINDING_INCOMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610671)); pub const RPC_NT_COMM_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610670)); pub const RPC_NT_UNSUPPORTED_AUTHN_LEVEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610669)); pub const RPC_NT_NO_PRINC_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610668)); pub const RPC_NT_NOT_RPC_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610667)); pub const RPC_NT_UUID_LOCAL_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073872982)); pub const RPC_NT_SEC_PKG_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610665)); pub const RPC_NT_NOT_CANCELLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610664)); pub const RPC_NT_INVALID_ES_ACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545127)); pub const RPC_NT_WRONG_ES_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545126)); pub const RPC_NT_WRONG_STUB_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545125)); pub const RPC_NT_INVALID_PIPE_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545124)); pub const RPC_NT_INVALID_PIPE_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545123)); pub const RPC_NT_WRONG_PIPE_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545122)); pub const RPC_NT_PIPE_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545121)); pub const RPC_NT_PIPE_DISCIPLINE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545120)); pub const RPC_NT_PIPE_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073545119)); pub const RPC_NT_INVALID_ASYNC_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610654)); pub const RPC_NT_INVALID_ASYNC_CALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610653)); pub const RPC_NT_PROXY_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610652)); pub const RPC_NT_COOKIE_AUTH_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073610651)); pub const RPC_NT_SEND_INCOMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1073873071)); pub const STATUS_ACPI_INVALID_OPCODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431103)); pub const STATUS_ACPI_STACK_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431102)); pub const STATUS_ACPI_ASSERT_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431101)); pub const STATUS_ACPI_INVALID_INDEX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431100)); pub const STATUS_ACPI_INVALID_ARGUMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431099)); pub const STATUS_ACPI_FATAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431098)); pub const STATUS_ACPI_INVALID_SUPERNAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431097)); pub const STATUS_ACPI_INVALID_ARGTYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431096)); pub const STATUS_ACPI_INVALID_OBJTYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431095)); pub const STATUS_ACPI_INVALID_TARGETTYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431094)); pub const STATUS_ACPI_INCORRECT_ARGUMENT_COUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431093)); pub const STATUS_ACPI_ADDRESS_NOT_MAPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431092)); pub const STATUS_ACPI_INVALID_EVENTTYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431091)); pub const STATUS_ACPI_HANDLER_COLLISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431090)); pub const STATUS_ACPI_INVALID_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431089)); pub const STATUS_ACPI_INVALID_REGION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431088)); pub const STATUS_ACPI_INVALID_ACCESS_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431087)); pub const STATUS_ACPI_ACQUIRE_GLOBAL_LOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431086)); pub const STATUS_ACPI_ALREADY_INITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431085)); pub const STATUS_ACPI_NOT_INITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431084)); pub const STATUS_ACPI_INVALID_MUTEX_LEVEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431083)); pub const STATUS_ACPI_MUTEX_NOT_OWNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431082)); pub const STATUS_ACPI_MUTEX_NOT_OWNER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431081)); pub const STATUS_ACPI_RS_ACCESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431080)); pub const STATUS_ACPI_INVALID_TABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431079)); pub const STATUS_ACPI_REG_HANDLER_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431072)); pub const STATUS_ACPI_POWER_REQUEST_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072431071)); pub const STATUS_CTX_WINSTATION_NAME_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086463)); pub const STATUS_CTX_INVALID_PD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086462)); pub const STATUS_CTX_PD_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086461)); pub const STATUS_CTX_CDM_CONNECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1074397188)); pub const STATUS_CTX_CDM_DISCONNECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1074397189)); pub const STATUS_CTX_CLOSE_PENDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086458)); pub const STATUS_CTX_NO_OUTBUF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086457)); pub const STATUS_CTX_MODEM_INF_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086456)); pub const STATUS_CTX_INVALID_MODEMNAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086455)); pub const STATUS_CTX_RESPONSE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086454)); pub const STATUS_CTX_MODEM_RESPONSE_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086453)); pub const STATUS_CTX_MODEM_RESPONSE_NO_CARRIER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086452)); pub const STATUS_CTX_MODEM_RESPONSE_NO_DIALTONE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086451)); pub const STATUS_CTX_MODEM_RESPONSE_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086450)); pub const STATUS_CTX_MODEM_RESPONSE_VOICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086449)); pub const STATUS_CTX_TD_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086448)); pub const STATUS_CTX_LICENSE_CLIENT_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086446)); pub const STATUS_CTX_LICENSE_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086445)); pub const STATUS_CTX_LICENSE_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086444)); pub const STATUS_CTX_WINSTATION_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086443)); pub const STATUS_CTX_WINSTATION_NAME_COLLISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086442)); pub const STATUS_CTX_WINSTATION_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086441)); pub const STATUS_CTX_BAD_VIDEO_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086440)); pub const STATUS_CTX_GRAPHICS_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086430)); pub const STATUS_CTX_NOT_CONSOLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086428)); pub const STATUS_CTX_CLIENT_QUERY_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086426)); pub const STATUS_CTX_CONSOLE_DISCONNECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086425)); pub const STATUS_CTX_CONSOLE_CONNECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086424)); pub const STATUS_CTX_SHADOW_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086422)); pub const STATUS_CTX_WINSTATION_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086421)); pub const STATUS_CTX_INVALID_WD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086418)); pub const STATUS_CTX_WD_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086417)); pub const STATUS_CTX_SHADOW_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086416)); pub const STATUS_CTX_SHADOW_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086415)); pub const STATUS_RDP_PROTOCOL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086414)); pub const STATUS_CTX_CLIENT_LICENSE_NOT_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086413)); pub const STATUS_CTX_CLIENT_LICENSE_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086412)); pub const STATUS_CTX_SHADOW_ENDED_BY_MODE_CHANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086411)); pub const STATUS_CTX_SHADOW_NOT_RUNNING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086410)); pub const STATUS_CTX_LOGON_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086409)); pub const STATUS_CTX_SECURITY_LAYER_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086408)); pub const STATUS_TS_INCOMPATIBLE_SESSIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086407)); pub const STATUS_TS_VIDEO_SUBSYSTEM_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073086406)); pub const STATUS_PNP_BAD_MPS_TABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073479627)); pub const STATUS_PNP_TRANSLATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073479626)); pub const STATUS_PNP_IRQ_TRANSLATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073479625)); pub const STATUS_PNP_INVALID_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073479624)); pub const STATUS_IO_REISSUE_AS_CACHED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073479623)); pub const STATUS_MUI_FILE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073020927)); pub const STATUS_MUI_INVALID_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073020926)); pub const STATUS_MUI_INVALID_RC_CONFIG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073020925)); pub const STATUS_MUI_INVALID_LOCALE_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073020924)); pub const STATUS_MUI_INVALID_ULTIMATEFALLBACK_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073020923)); pub const STATUS_MUI_FILE_NOT_LOADED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073020922)); pub const STATUS_RESOURCE_ENUM_USER_STOP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1073020921)); pub const STATUS_FLT_NO_HANDLER_DEFINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906815)); pub const STATUS_FLT_CONTEXT_ALREADY_DEFINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906814)); pub const STATUS_FLT_INVALID_ASYNCHRONOUS_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906813)); pub const STATUS_FLT_DISALLOW_FAST_IO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906812)); pub const STATUS_FLT_INVALID_NAME_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906811)); pub const STATUS_FLT_NOT_SAFE_TO_POST_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906810)); pub const STATUS_FLT_NOT_INITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906809)); pub const STATUS_FLT_FILTER_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906808)); pub const STATUS_FLT_POST_OPERATION_CLEANUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906807)); pub const STATUS_FLT_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906806)); pub const STATUS_FLT_DELETING_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906805)); pub const STATUS_FLT_MUST_BE_NONPAGED_POOL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906804)); pub const STATUS_FLT_DUPLICATE_ENTRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906803)); pub const STATUS_FLT_CBDQ_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906802)); pub const STATUS_FLT_DO_NOT_ATTACH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906801)); pub const STATUS_FLT_DO_NOT_DETACH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906800)); pub const STATUS_FLT_INSTANCE_ALTITUDE_COLLISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906799)); pub const STATUS_FLT_INSTANCE_NAME_COLLISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906798)); pub const STATUS_FLT_FILTER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906797)); pub const STATUS_FLT_VOLUME_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906796)); pub const STATUS_FLT_INSTANCE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906795)); pub const STATUS_FLT_CONTEXT_ALLOCATION_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906794)); pub const STATUS_FLT_INVALID_CONTEXT_REGISTRATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906793)); pub const STATUS_FLT_NAME_CACHE_MISS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906792)); pub const STATUS_FLT_NO_DEVICE_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906791)); pub const STATUS_FLT_VOLUME_ALREADY_MOUNTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906790)); pub const STATUS_FLT_ALREADY_ENLISTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906789)); pub const STATUS_FLT_CONTEXT_ALREADY_LINKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906788)); pub const STATUS_FLT_NO_WAITER_FOR_REPLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906784)); pub const STATUS_FLT_REGISTRATION_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071906781)); pub const STATUS_SXS_SECTION_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365567)); pub const STATUS_SXS_CANT_GEN_ACTCTX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365566)); pub const STATUS_SXS_INVALID_ACTCTXDATA_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365565)); pub const STATUS_SXS_ASSEMBLY_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365564)); pub const STATUS_SXS_MANIFEST_FORMAT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365563)); pub const STATUS_SXS_MANIFEST_PARSE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365562)); pub const STATUS_SXS_ACTIVATION_CONTEXT_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365561)); pub const STATUS_SXS_KEY_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365560)); pub const STATUS_SXS_VERSION_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365559)); pub const STATUS_SXS_WRONG_SECTION_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365558)); pub const STATUS_SXS_THREAD_QUERIES_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365557)); pub const STATUS_SXS_ASSEMBLY_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365556)); pub const STATUS_SXS_RELEASE_ACTIVATION_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075118093)); pub const STATUS_SXS_PROCESS_DEFAULT_ALREADY_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365554)); pub const STATUS_SXS_EARLY_DEACTIVATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365553)); pub const STATUS_SXS_INVALID_DEACTIVATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365552)); pub const STATUS_SXS_MULTIPLE_DEACTIVATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365551)); pub const STATUS_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365550)); pub const STATUS_SXS_PROCESS_TERMINATION_REQUESTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365549)); pub const STATUS_SXS_CORRUPT_ACTIVATION_STACK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365548)); pub const STATUS_SXS_CORRUPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365547)); pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365546)); pub const STATUS_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365545)); pub const STATUS_SXS_IDENTITY_DUPLICATE_ATTRIBUTE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365544)); pub const STATUS_SXS_IDENTITY_PARSE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365543)); pub const STATUS_SXS_COMPONENT_STORE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365542)); pub const STATUS_SXS_FILE_HASH_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365541)); pub const STATUS_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365540)); pub const STATUS_SXS_IDENTITIES_DIFFERENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365539)); pub const STATUS_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365538)); pub const STATUS_SXS_FILE_NOT_PART_OF_ASSEMBLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365537)); pub const STATUS_ADVANCED_INSTALLER_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365536)); pub const STATUS_XML_ENCODING_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365535)); pub const STATUS_SXS_MANIFEST_TOO_BIG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365534)); pub const STATUS_SXS_SETTING_NOT_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365533)); pub const STATUS_SXS_TRANSACTION_CLOSURE_INCOMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365532)); pub const STATUS_SMI_PRIMITIVE_INSTALLER_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365531)); pub const STATUS_GENERIC_COMMAND_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365530)); pub const STATUS_SXS_FILE_HASH_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072365529)); pub const STATUS_CLUSTER_INVALID_NODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496639)); pub const STATUS_CLUSTER_NODE_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496638)); pub const STATUS_CLUSTER_JOIN_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496637)); pub const STATUS_CLUSTER_NODE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496636)); pub const STATUS_CLUSTER_LOCAL_NODE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496635)); pub const STATUS_CLUSTER_NETWORK_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496634)); pub const STATUS_CLUSTER_NETWORK_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496633)); pub const STATUS_CLUSTER_NETINTERFACE_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496632)); pub const STATUS_CLUSTER_NETINTERFACE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496631)); pub const STATUS_CLUSTER_INVALID_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496630)); pub const STATUS_CLUSTER_INVALID_NETWORK_PROVIDER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496629)); pub const STATUS_CLUSTER_NODE_DOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496628)); pub const STATUS_CLUSTER_NODE_UNREACHABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496627)); pub const STATUS_CLUSTER_NODE_NOT_MEMBER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496626)); pub const STATUS_CLUSTER_JOIN_NOT_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496625)); pub const STATUS_CLUSTER_INVALID_NETWORK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496624)); pub const STATUS_CLUSTER_NO_NET_ADAPTERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496623)); pub const STATUS_CLUSTER_NODE_UP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496622)); pub const STATUS_CLUSTER_NODE_PAUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496621)); pub const STATUS_CLUSTER_NODE_NOT_PAUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496620)); pub const STATUS_CLUSTER_NO_SECURITY_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496619)); pub const STATUS_CLUSTER_NETWORK_NOT_INTERNAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496618)); pub const STATUS_CLUSTER_POISONED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496617)); pub const STATUS_CLUSTER_NON_CSV_PATH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496616)); pub const STATUS_CLUSTER_CSV_VOLUME_NOT_LOCAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496615)); pub const STATUS_CLUSTER_CSV_READ_OPLOCK_BREAK_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496608)); pub const STATUS_CLUSTER_CSV_AUTO_PAUSE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496607)); pub const STATUS_CLUSTER_CSV_REDIRECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496606)); pub const STATUS_CLUSTER_CSV_NOT_REDIRECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496605)); pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496604)); pub const STATUS_CLUSTER_CSV_SNAPSHOT_CREATION_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496603)); pub const STATUS_CLUSTER_CSV_VOLUME_DRAINING_SUCCEEDED_DOWNLEVEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496602)); pub const STATUS_CLUSTER_CSV_NO_SNAPSHOTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496601)); pub const STATUS_CSV_IO_PAUSE_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496600)); pub const STATUS_CLUSTER_CSV_INVALID_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496599)); pub const STATUS_CLUSTER_CSV_SUPPORTED_ONLY_ON_COORDINATOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496592)); pub const STATUS_CLUSTER_CAM_TICKET_REPLAY_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072496591)); pub const STATUS_TRANSACTIONAL_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103423)); pub const STATUS_INVALID_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103422)); pub const STATUS_TRANSACTION_NOT_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103421)); pub const STATUS_TM_INITIALIZATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103420)); pub const STATUS_RM_NOT_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103419)); pub const STATUS_RM_METADATA_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103418)); pub const STATUS_TRANSACTION_NOT_JOINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103417)); pub const STATUS_DIRECTORY_NOT_RM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103416)); pub const STATUS_COULD_NOT_RESIZE_LOG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145845239)); pub const STATUS_TRANSACTIONS_UNSUPPORTED_REMOTE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103414)); pub const STATUS_LOG_RESIZE_INVALID_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103413)); pub const STATUS_REMOTE_FILE_VERSION_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103412)); pub const STATUS_CRM_PROTOCOL_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103409)); pub const STATUS_TRANSACTION_PROPAGATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103408)); pub const STATUS_CRM_PROTOCOL_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103407)); pub const STATUS_TRANSACTION_SUPERIOR_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103406)); pub const STATUS_TRANSACTION_REQUEST_NOT_VALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103405)); pub const STATUS_TRANSACTION_NOT_REQUESTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103404)); pub const STATUS_TRANSACTION_ALREADY_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103403)); pub const STATUS_TRANSACTION_ALREADY_COMMITTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103402)); pub const STATUS_TRANSACTION_INVALID_MARSHALL_BUFFER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103401)); pub const STATUS_CURRENT_TRANSACTION_NOT_VALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103400)); pub const STATUS_LOG_GROWTH_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103399)); pub const STATUS_OBJECT_NO_LONGER_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103391)); pub const STATUS_STREAM_MINIVERSION_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103390)); pub const STATUS_STREAM_MINIVERSION_NOT_VALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103389)); pub const STATUS_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103388)); pub const STATUS_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103387)); pub const STATUS_CANT_CREATE_MORE_STREAM_MINIVERSIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103386)); pub const STATUS_HANDLE_NO_LONGER_VALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103384)); pub const STATUS_NO_TXF_METADATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145845207)); pub const STATUS_LOG_CORRUPTION_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103376)); pub const STATUS_CANT_RECOVER_WITH_HANDLE_OPEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145845199)); pub const STATUS_RM_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103374)); pub const STATUS_ENLISTMENT_NOT_SUPERIOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103373)); pub const STATUS_RECOVERY_NOT_NEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075380276)); pub const STATUS_RM_ALREADY_STARTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075380277)); pub const STATUS_FILE_IDENTITY_NOT_PERSISTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103370)); pub const STATUS_CANT_BREAK_TRANSACTIONAL_DEPENDENCY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103369)); pub const STATUS_CANT_CROSS_RM_BOUNDARY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103368)); pub const STATUS_TXF_DIR_NOT_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103367)); pub const STATUS_INDOUBT_TRANSACTIONS_EXIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103366)); pub const STATUS_TM_VOLATILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103365)); pub const STATUS_ROLLBACK_TIMER_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103364)); pub const STATUS_TXF_ATTRIBUTE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103363)); pub const STATUS_EFS_NOT_ALLOWED_IN_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103362)); pub const STATUS_TRANSACTIONAL_OPEN_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103361)); pub const STATUS_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103360)); pub const STATUS_TXF_METADATA_ALREADY_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145845183)); pub const STATUS_TRANSACTION_SCOPE_CALLBACKS_NOT_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145845182)); pub const STATUS_TRANSACTION_REQUIRED_PROMOTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103357)); pub const STATUS_CANNOT_EXECUTE_FILE_IN_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103356)); pub const STATUS_TRANSACTIONS_NOT_FROZEN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103355)); pub const STATUS_TRANSACTION_FREEZE_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103354)); pub const STATUS_NOT_SNAPSHOT_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103353)); pub const STATUS_NO_SAVEPOINT_WITH_OPEN_FILES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103352)); pub const STATUS_SPARSE_NOT_ALLOWED_IN_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103351)); pub const STATUS_TM_IDENTITY_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103350)); pub const STATUS_FLOATED_SECTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103349)); pub const STATUS_CANNOT_ACCEPT_TRANSACTED_WORK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103348)); pub const STATUS_CANNOT_ABORT_TRANSACTIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103347)); pub const STATUS_TRANSACTION_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103346)); pub const STATUS_RESOURCEMANAGER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103345)); pub const STATUS_ENLISTMENT_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103344)); pub const STATUS_TRANSACTIONMANAGER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103343)); pub const STATUS_TRANSACTIONMANAGER_NOT_ONLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103342)); pub const STATUS_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103341)); pub const STATUS_TRANSACTION_NOT_ROOT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103340)); pub const STATUS_TRANSACTION_OBJECT_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103339)); pub const STATUS_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103338)); pub const STATUS_TRANSACTION_RESPONSE_NOT_ENLISTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103337)); pub const STATUS_TRANSACTION_RECORD_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103336)); pub const STATUS_NO_LINK_TRACKING_IN_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103335)); pub const STATUS_OPERATION_NOT_SUPPORTED_IN_TRANSACTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103334)); pub const STATUS_TRANSACTION_INTEGRITY_VIOLATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103333)); pub const STATUS_TRANSACTIONMANAGER_IDENTITY_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103332)); pub const STATUS_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103331)); pub const STATUS_TRANSACTION_MUST_WRITETHROUGH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103330)); pub const STATUS_TRANSACTION_NO_SUPERIOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103329)); pub const STATUS_EXPIRED_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103328)); pub const STATUS_TRANSACTION_NOT_ENLISTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072103327)); pub const STATUS_LOG_SECTOR_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037887)); pub const STATUS_LOG_SECTOR_PARITY_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037886)); pub const STATUS_LOG_SECTOR_REMAPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037885)); pub const STATUS_LOG_BLOCK_INCOMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037884)); pub const STATUS_LOG_INVALID_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037883)); pub const STATUS_LOG_BLOCKS_EXHAUSTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037882)); pub const STATUS_LOG_READ_CONTEXT_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037881)); pub const STATUS_LOG_RESTART_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037880)); pub const STATUS_LOG_BLOCK_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037879)); pub const STATUS_LOG_BLOCK_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037878)); pub const STATUS_LOG_READ_MODE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037877)); pub const STATUS_LOG_NO_RESTART = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075445772)); pub const STATUS_LOG_METADATA_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037875)); pub const STATUS_LOG_METADATA_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037874)); pub const STATUS_LOG_METADATA_INCONSISTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037873)); pub const STATUS_LOG_RESERVATION_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037872)); pub const STATUS_LOG_CANT_DELETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037871)); pub const STATUS_LOG_CONTAINER_LIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037870)); pub const STATUS_LOG_START_OF_LOG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037869)); pub const STATUS_LOG_POLICY_ALREADY_INSTALLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037868)); pub const STATUS_LOG_POLICY_NOT_INSTALLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037867)); pub const STATUS_LOG_POLICY_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037866)); pub const STATUS_LOG_POLICY_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037865)); pub const STATUS_LOG_PINNED_ARCHIVE_TAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037864)); pub const STATUS_LOG_RECORD_NONEXISTENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037863)); pub const STATUS_LOG_RECORDS_RESERVED_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037862)); pub const STATUS_LOG_SPACE_RESERVED_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037861)); pub const STATUS_LOG_TAIL_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037860)); pub const STATUS_LOG_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037859)); pub const STATUS_LOG_MULTIPLEXED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037858)); pub const STATUS_LOG_DEDICATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037857)); pub const STATUS_LOG_ARCHIVE_NOT_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037856)); pub const STATUS_LOG_ARCHIVE_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037855)); pub const STATUS_LOG_EPHEMERAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037854)); pub const STATUS_LOG_NOT_ENOUGH_CONTAINERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037853)); pub const STATUS_LOG_CLIENT_ALREADY_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037852)); pub const STATUS_LOG_CLIENT_NOT_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037851)); pub const STATUS_LOG_FULL_HANDLER_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037850)); pub const STATUS_LOG_CONTAINER_READ_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037849)); pub const STATUS_LOG_CONTAINER_WRITE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037848)); pub const STATUS_LOG_CONTAINER_OPEN_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037847)); pub const STATUS_LOG_CONTAINER_STATE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037846)); pub const STATUS_LOG_STATE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037845)); pub const STATUS_LOG_PINNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037844)); pub const STATUS_LOG_METADATA_FLUSH_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037843)); pub const STATUS_LOG_INCONSISTENT_SECURITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037842)); pub const STATUS_LOG_APPENDED_FLUSH_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037841)); pub const STATUS_LOG_PINNED_RESERVATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1072037840)); pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071972118)); pub const STATUS_VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2145713941)); pub const STATUS_VIDEO_DRIVER_DEBUG_REPORT_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075511532)); pub const STATUS_MONITOR_NO_DESCRIPTOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841279)); pub const STATUS_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841278)); pub const STATUS_MONITOR_INVALID_DESCRIPTOR_CHECKSUM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841277)); pub const STATUS_MONITOR_INVALID_STANDARD_TIMING_BLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841276)); pub const STATUS_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841275)); pub const STATUS_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841274)); pub const STATUS_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841273)); pub const STATUS_MONITOR_NO_MORE_DESCRIPTOR_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841272)); pub const STATUS_MONITOR_INVALID_DETAILED_TIMING_BLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841271)); pub const STATUS_MONITOR_INVALID_MANUFACTURE_DATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071841270)); pub const STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775744)); pub const STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775743)); pub const STATUS_GRAPHICS_INVALID_DISPLAY_ADAPTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775742)); pub const STATUS_GRAPHICS_ADAPTER_WAS_RESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775741)); pub const STATUS_GRAPHICS_INVALID_DRIVER_MODEL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775740)); pub const STATUS_GRAPHICS_PRESENT_MODE_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775739)); pub const STATUS_GRAPHICS_PRESENT_OCCLUDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775738)); pub const STATUS_GRAPHICS_PRESENT_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775737)); pub const STATUS_GRAPHICS_CANNOTCOLORCONVERT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775736)); pub const STATUS_GRAPHICS_DRIVER_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775735)); pub const STATUS_GRAPHICS_PARTIAL_DATA_POPULATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075707914)); pub const STATUS_GRAPHICS_PRESENT_REDIRECTION_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775733)); pub const STATUS_GRAPHICS_PRESENT_UNOCCLUDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775732)); pub const STATUS_GRAPHICS_WINDOWDC_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775731)); pub const STATUS_GRAPHICS_WINDOWLESS_PRESENT_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775730)); pub const STATUS_GRAPHICS_PRESENT_INVALID_WINDOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775729)); pub const STATUS_GRAPHICS_PRESENT_BUFFER_NOT_BOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775728)); pub const STATUS_GRAPHICS_VAIL_STATE_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775727)); pub const STATUS_GRAPHICS_INDIRECT_DISPLAY_ABANDON_SWAPCHAIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775726)); pub const STATUS_GRAPHICS_INDIRECT_DISPLAY_DEVICE_STOPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775725)); pub const STATUS_GRAPHICS_NO_VIDEO_MEMORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775488)); pub const STATUS_GRAPHICS_CANT_LOCK_MEMORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775487)); pub const STATUS_GRAPHICS_ALLOCATION_BUSY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775486)); pub const STATUS_GRAPHICS_TOO_MANY_REFERENCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775485)); pub const STATUS_GRAPHICS_TRY_AGAIN_LATER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775484)); pub const STATUS_GRAPHICS_TRY_AGAIN_NOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775483)); pub const STATUS_GRAPHICS_ALLOCATION_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775482)); pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775481)); pub const STATUS_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775480)); pub const STATUS_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775479)); pub const STATUS_GRAPHICS_INVALID_ALLOCATION_USAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775472)); pub const STATUS_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775471)); pub const STATUS_GRAPHICS_ALLOCATION_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775470)); pub const STATUS_GRAPHICS_INVALID_ALLOCATION_INSTANCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775469)); pub const STATUS_GRAPHICS_INVALID_ALLOCATION_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775468)); pub const STATUS_GRAPHICS_WRONG_ALLOCATION_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775467)); pub const STATUS_GRAPHICS_ALLOCATION_CONTENT_LOST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775466)); pub const STATUS_GRAPHICS_GPU_EXCEPTION_ON_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071775232)); pub const STATUS_GRAPHICS_SKIP_ALLOCATION_PREPARATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708417)); pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774976)); pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774975)); pub const STATUS_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774974)); pub const STATUS_GRAPHICS_INVALID_VIDPN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774973)); pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774972)); pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774971)); pub const STATUS_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774970)); pub const STATUS_GRAPHICS_MODE_NOT_PINNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708679)); pub const STATUS_GRAPHICS_INVALID_VIDPN_SOURCEMODESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774968)); pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGETMODESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774967)); pub const STATUS_GRAPHICS_INVALID_FREQUENCY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774966)); pub const STATUS_GRAPHICS_INVALID_ACTIVE_REGION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774965)); pub const STATUS_GRAPHICS_INVALID_TOTAL_REGION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774964)); pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774960)); pub const STATUS_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774959)); pub const STATUS_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774958)); pub const STATUS_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774957)); pub const STATUS_GRAPHICS_MODE_ALREADY_IN_MODESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774956)); pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774955)); pub const STATUS_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774954)); pub const STATUS_GRAPHICS_SOURCE_ALREADY_IN_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774953)); pub const STATUS_GRAPHICS_TARGET_ALREADY_IN_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774952)); pub const STATUS_GRAPHICS_INVALID_VIDPN_PRESENT_PATH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774951)); pub const STATUS_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774950)); pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774949)); pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774948)); pub const STATUS_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774947)); pub const STATUS_GRAPHICS_NO_PREFERRED_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708702)); pub const STATUS_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774945)); pub const STATUS_GRAPHICS_STALE_MODESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774944)); pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCEMODESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774943)); pub const STATUS_GRAPHICS_INVALID_MONITOR_SOURCE_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774942)); pub const STATUS_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774941)); pub const STATUS_GRAPHICS_MODE_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774940)); pub const STATUS_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774939)); pub const STATUS_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774938)); pub const STATUS_GRAPHICS_PATH_NOT_IN_TOPOLOGY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774937)); pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774936)); pub const STATUS_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774935)); pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTORSET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774934)); pub const STATUS_GRAPHICS_INVALID_MONITORDESCRIPTOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774933)); pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774932)); pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774931)); pub const STATUS_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774930)); pub const STATUS_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774929)); pub const STATUS_GRAPHICS_RESOURCES_NOT_RELATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774928)); pub const STATUS_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774927)); pub const STATUS_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774926)); pub const STATUS_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774925)); pub const STATUS_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774924)); pub const STATUS_GRAPHICS_NO_VIDPNMGR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774923)); pub const STATUS_GRAPHICS_NO_ACTIVE_VIDPN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774922)); pub const STATUS_GRAPHICS_STALE_VIDPN_TOPOLOGY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774921)); pub const STATUS_GRAPHICS_MONITOR_NOT_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774920)); pub const STATUS_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774919)); pub const STATUS_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774918)); pub const STATUS_GRAPHICS_INVALID_VISIBLEREGION_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774917)); pub const STATUS_GRAPHICS_INVALID_STRIDE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774916)); pub const STATUS_GRAPHICS_INVALID_PIXELFORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774915)); pub const STATUS_GRAPHICS_INVALID_COLORBASIS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774914)); pub const STATUS_GRAPHICS_INVALID_PIXELVALUEACCESSMODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774913)); pub const STATUS_GRAPHICS_TARGET_NOT_IN_TOPOLOGY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774912)); pub const STATUS_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774911)); pub const STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774910)); pub const STATUS_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774909)); pub const STATUS_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774908)); pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774907)); pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774906)); pub const STATUS_GRAPHICS_INVALID_GAMMA_RAMP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774905)); pub const STATUS_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774904)); pub const STATUS_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774903)); pub const STATUS_GRAPHICS_MODE_NOT_IN_MODESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774902)); pub const STATUS_GRAPHICS_DATASET_IS_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708747)); pub const STATUS_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708748)); pub const STATUS_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774899)); pub const STATUS_GRAPHICS_INVALID_PATH_CONTENT_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774898)); pub const STATUS_GRAPHICS_INVALID_COPYPROTECTION_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774897)); pub const STATUS_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774896)); pub const STATUS_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708753)); pub const STATUS_GRAPHICS_INVALID_SCANLINE_ORDERING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774894)); pub const STATUS_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774893)); pub const STATUS_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774892)); pub const STATUS_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774891)); pub const STATUS_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774890)); pub const STATUS_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774889)); pub const STATUS_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774888)); pub const STATUS_GRAPHICS_MAX_NUM_PATHS_REACHED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774887)); pub const STATUS_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774886)); pub const STATUS_GRAPHICS_INVALID_CLIENT_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774885)); pub const STATUS_GRAPHICS_CLIENTVIDPN_NOT_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774884)); pub const STATUS_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774720)); pub const STATUS_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774719)); pub const STATUS_GRAPHICS_UNKNOWN_CHILD_STATUS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708975)); pub const STATUS_GRAPHICS_NOT_A_LINKED_ADAPTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774672)); pub const STATUS_GRAPHICS_LEADLINK_NOT_ENUMERATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774671)); pub const STATUS_GRAPHICS_CHAINLINKS_NOT_ENUMERATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774670)); pub const STATUS_GRAPHICS_ADAPTER_CHAIN_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774669)); pub const STATUS_GRAPHICS_CHAINLINKS_NOT_STARTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774668)); pub const STATUS_GRAPHICS_CHAINLINKS_NOT_POWERED_ON = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774667)); pub const STATUS_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774666)); pub const STATUS_GRAPHICS_LEADLINK_START_DEFERRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708983)); pub const STATUS_GRAPHICS_NOT_POST_DEVICE_DRIVER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774664)); pub const STATUS_GRAPHICS_POLLING_TOO_FREQUENTLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708985)); pub const STATUS_GRAPHICS_START_DEFERRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708986)); pub const STATUS_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774661)); pub const STATUS_GRAPHICS_DEPENDABLE_CHILD_STATUS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1075708988)); pub const STATUS_GRAPHICS_OPM_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774464)); pub const STATUS_GRAPHICS_COPP_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774463)); pub const STATUS_GRAPHICS_UAB_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774462)); pub const STATUS_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774461)); pub const STATUS_GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774459)); pub const STATUS_GRAPHICS_OPM_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774453)); pub const STATUS_GRAPHICS_OPM_INVALID_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774452)); pub const STATUS_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774450)); pub const STATUS_GRAPHICS_OPM_SPANNING_MODE_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774449)); pub const STATUS_GRAPHICS_OPM_THEATER_MODE_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774448)); pub const STATUS_GRAPHICS_PVP_HFS_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774447)); pub const STATUS_GRAPHICS_OPM_INVALID_SRM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774446)); pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774445)); pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774444)); pub const STATUS_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774443)); pub const STATUS_GRAPHICS_OPM_HDCP_SRM_NEVER_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774442)); pub const STATUS_GRAPHICS_OPM_RESOLUTION_TOO_HIGH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774441)); pub const STATUS_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774440)); pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774438)); pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774436)); pub const STATUS_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774435)); pub const STATUS_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774434)); pub const STATUS_GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774433)); pub const STATUS_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774432)); pub const STATUS_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774431)); pub const STATUS_GRAPHICS_I2C_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774336)); pub const STATUS_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774335)); pub const STATUS_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774334)); pub const STATUS_GRAPHICS_I2C_ERROR_RECEIVING_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774333)); pub const STATUS_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774332)); pub const STATUS_GRAPHICS_DDCCI_INVALID_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774331)); pub const STATUS_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774330)); pub const STATUS_GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774329)); pub const STATUS_GRAPHICS_MCA_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774328)); pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774327)); pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774326)); pub const STATUS_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774325)); pub const STATUS_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774324)); pub const STATUS_GRAPHICS_MONITOR_NO_LONGER_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774323)); pub const STATUS_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774240)); pub const STATUS_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774239)); pub const STATUS_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774238)); pub const STATUS_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774237)); pub const STATUS_GRAPHICS_INVALID_POINTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774236)); pub const STATUS_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774235)); pub const STATUS_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774234)); pub const STATUS_GRAPHICS_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774233)); pub const STATUS_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071774232)); pub const STATUS_FVE_LOCKED_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579136)); pub const STATUS_FVE_NOT_ENCRYPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579135)); pub const STATUS_FVE_BAD_INFORMATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579134)); pub const STATUS_FVE_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579133)); pub const STATUS_FVE_FAILED_WRONG_FS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579132)); pub const STATUS_FVE_BAD_PARTITION_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579131)); pub const STATUS_FVE_FS_NOT_EXTENDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579130)); pub const STATUS_FVE_FS_MOUNTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579129)); pub const STATUS_FVE_NO_LICENSE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579128)); pub const STATUS_FVE_ACTION_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579127)); pub const STATUS_FVE_BAD_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579126)); pub const STATUS_FVE_VOLUME_NOT_BOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579125)); pub const STATUS_FVE_NOT_DATA_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579124)); pub const STATUS_FVE_CONV_READ_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579123)); pub const STATUS_FVE_CONV_WRITE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579122)); pub const STATUS_FVE_OVERLAPPED_UPDATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579121)); pub const STATUS_FVE_FAILED_SECTOR_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579120)); pub const STATUS_FVE_FAILED_AUTHENTICATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579119)); pub const STATUS_FVE_NOT_OS_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579118)); pub const STATUS_FVE_KEYFILE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579117)); pub const STATUS_FVE_KEYFILE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579116)); pub const STATUS_FVE_KEYFILE_NO_VMK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579115)); pub const STATUS_FVE_TPM_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579114)); pub const STATUS_FVE_TPM_SRK_AUTH_NOT_ZERO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579113)); pub const STATUS_FVE_TPM_INVALID_PCR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579112)); pub const STATUS_FVE_TPM_NO_VMK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579111)); pub const STATUS_FVE_PIN_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579110)); pub const STATUS_FVE_AUTH_INVALID_APPLICATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579109)); pub const STATUS_FVE_AUTH_INVALID_CONFIG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579108)); pub const STATUS_FVE_DEBUGGER_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579107)); pub const STATUS_FVE_DRY_RUN_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579106)); pub const STATUS_FVE_BAD_METADATA_POINTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579105)); pub const STATUS_FVE_OLD_METADATA_COPY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579104)); pub const STATUS_FVE_REBOOT_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579103)); pub const STATUS_FVE_RAW_ACCESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579102)); pub const STATUS_FVE_RAW_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579101)); pub const STATUS_FVE_NO_AUTOUNLOCK_MASTER_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579100)); pub const STATUS_FVE_MOR_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579099)); pub const STATUS_FVE_NO_FEATURE_LICENSE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579098)); pub const STATUS_FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579097)); pub const STATUS_FVE_CONV_RECOVERY_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579096)); pub const STATUS_FVE_VIRTUALIZED_SPACE_TOO_BIG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579095)); pub const STATUS_FVE_INVALID_DATUM_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579094)); pub const STATUS_FVE_VOLUME_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579088)); pub const STATUS_FVE_ENH_PIN_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579087)); pub const STATUS_FVE_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579086)); pub const STATUS_FVE_WIPE_NOT_ALLOWED_ON_TP_STORAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579085)); pub const STATUS_FVE_NOT_ALLOWED_ON_CSV_STACK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579084)); pub const STATUS_FVE_NOT_ALLOWED_ON_CLUSTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579083)); pub const STATUS_FVE_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579082)); pub const STATUS_FVE_WIPE_CANCEL_NOT_APPLICABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579081)); pub const STATUS_FVE_EDRIVE_DRY_RUN_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579080)); pub const STATUS_FVE_SECUREBOOT_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579079)); pub const STATUS_FVE_SECUREBOOT_CONFIG_CHANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579078)); pub const STATUS_FVE_DEVICE_LOCKEDOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579077)); pub const STATUS_FVE_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579076)); pub const STATUS_FVE_NOT_DE_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579075)); pub const STATUS_FVE_PROTECTION_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579074)); pub const STATUS_FVE_PROTECTION_CANNOT_BE_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579073)); pub const STATUS_FVE_OSV_KSR_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071579072)); pub const STATUS_FWP_CALLOUT_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513599)); pub const STATUS_FWP_CONDITION_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513598)); pub const STATUS_FWP_FILTER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513597)); pub const STATUS_FWP_LAYER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513596)); pub const STATUS_FWP_PROVIDER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513595)); pub const STATUS_FWP_PROVIDER_CONTEXT_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513594)); pub const STATUS_FWP_SUBLAYER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513593)); pub const STATUS_FWP_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513592)); pub const STATUS_FWP_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513591)); pub const STATUS_FWP_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513590)); pub const STATUS_FWP_DYNAMIC_SESSION_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513589)); pub const STATUS_FWP_WRONG_SESSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513588)); pub const STATUS_FWP_NO_TXN_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513587)); pub const STATUS_FWP_TXN_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513586)); pub const STATUS_FWP_TXN_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513585)); pub const STATUS_FWP_SESSION_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513584)); pub const STATUS_FWP_INCOMPATIBLE_TXN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513583)); pub const STATUS_FWP_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513582)); pub const STATUS_FWP_NET_EVENTS_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513581)); pub const STATUS_FWP_INCOMPATIBLE_LAYER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513580)); pub const STATUS_FWP_KM_CLIENTS_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513579)); pub const STATUS_FWP_LIFETIME_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513578)); pub const STATUS_FWP_BUILTIN_OBJECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513577)); pub const STATUS_FWP_TOO_MANY_CALLOUTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513576)); pub const STATUS_FWP_NOTIFICATION_DROPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513575)); pub const STATUS_FWP_TRAFFIC_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513574)); pub const STATUS_FWP_INCOMPATIBLE_SA_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513573)); pub const STATUS_FWP_NULL_POINTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513572)); pub const STATUS_FWP_INVALID_ENUMERATOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513571)); pub const STATUS_FWP_INVALID_FLAGS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513570)); pub const STATUS_FWP_INVALID_NET_MASK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513569)); pub const STATUS_FWP_INVALID_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513568)); pub const STATUS_FWP_INVALID_INTERVAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513567)); pub const STATUS_FWP_ZERO_LENGTH_ARRAY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513566)); pub const STATUS_FWP_NULL_DISPLAY_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513565)); pub const STATUS_FWP_INVALID_ACTION_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513564)); pub const STATUS_FWP_INVALID_WEIGHT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513563)); pub const STATUS_FWP_MATCH_TYPE_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513562)); pub const STATUS_FWP_TYPE_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513561)); pub const STATUS_FWP_OUT_OF_BOUNDS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513560)); pub const STATUS_FWP_RESERVED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513559)); pub const STATUS_FWP_DUPLICATE_CONDITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513558)); pub const STATUS_FWP_DUPLICATE_KEYMOD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513557)); pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_LAYER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513556)); pub const STATUS_FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513555)); pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513554)); pub const STATUS_FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513553)); pub const STATUS_FWP_INCOMPATIBLE_AUTH_METHOD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513552)); pub const STATUS_FWP_INCOMPATIBLE_DH_GROUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513551)); pub const STATUS_FWP_EM_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513550)); pub const STATUS_FWP_NEVER_MATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513549)); pub const STATUS_FWP_PROVIDER_CONTEXT_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513548)); pub const STATUS_FWP_INVALID_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513547)); pub const STATUS_FWP_TOO_MANY_SUBLAYERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513546)); pub const STATUS_FWP_CALLOUT_NOTIFICATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513545)); pub const STATUS_FWP_INVALID_AUTH_TRANSFORM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513544)); pub const STATUS_FWP_INVALID_CIPHER_TRANSFORM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513543)); pub const STATUS_FWP_INCOMPATIBLE_CIPHER_TRANSFORM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513542)); pub const STATUS_FWP_INVALID_TRANSFORM_COMBINATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513541)); pub const STATUS_FWP_DUPLICATE_AUTH_METHOD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513540)); pub const STATUS_FWP_INVALID_TUNNEL_ENDPOINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513539)); pub const STATUS_FWP_L2_DRIVER_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513538)); pub const STATUS_FWP_KEY_DICTATOR_ALREADY_REGISTERED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513537)); pub const STATUS_FWP_KEY_DICTATION_INVALID_KEYING_MATERIAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513536)); pub const STATUS_FWP_CONNECTIONS_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513535)); pub const STATUS_FWP_INVALID_DNS_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513534)); pub const STATUS_FWP_STILL_ON = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513533)); pub const STATUS_FWP_IKEEXT_NOT_RUNNING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513532)); pub const STATUS_FWP_TCPIP_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513344)); pub const STATUS_FWP_INJECT_HANDLE_CLOSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513343)); pub const STATUS_FWP_INJECT_HANDLE_STALE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513342)); pub const STATUS_FWP_CANNOT_PEND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513341)); pub const STATUS_FWP_DROP_NOICMP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071513340)); pub const STATUS_NDIS_CLOSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448062)); pub const STATUS_NDIS_BAD_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448060)); pub const STATUS_NDIS_BAD_CHARACTERISTICS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448059)); pub const STATUS_NDIS_ADAPTER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448058)); pub const STATUS_NDIS_OPEN_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448057)); pub const STATUS_NDIS_DEVICE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448056)); pub const STATUS_NDIS_MULTICAST_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448055)); pub const STATUS_NDIS_MULTICAST_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448054)); pub const STATUS_NDIS_MULTICAST_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448053)); pub const STATUS_NDIS_REQUEST_ABORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448052)); pub const STATUS_NDIS_RESET_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448051)); pub const STATUS_NDIS_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071447877)); pub const STATUS_NDIS_INVALID_PACKET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448049)); pub const STATUS_NDIS_ADAPTER_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448047)); pub const STATUS_NDIS_INVALID_LENGTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448044)); pub const STATUS_NDIS_INVALID_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448043)); pub const STATUS_NDIS_BUFFER_TOO_SHORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448042)); pub const STATUS_NDIS_INVALID_OID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448041)); pub const STATUS_NDIS_ADAPTER_REMOVED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448040)); pub const STATUS_NDIS_UNSUPPORTED_MEDIA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448039)); pub const STATUS_NDIS_GROUP_ADDRESS_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448038)); pub const STATUS_NDIS_FILE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448037)); pub const STATUS_NDIS_ERROR_READING_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448036)); pub const STATUS_NDIS_ALREADY_MAPPED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448035)); pub const STATUS_NDIS_RESOURCE_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448034)); pub const STATUS_NDIS_MEDIA_DISCONNECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448033)); pub const STATUS_NDIS_INVALID_ADDRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448030)); pub const STATUS_NDIS_INVALID_DEVICE_REQUEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448048)); pub const STATUS_NDIS_PAUSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448022)); pub const STATUS_NDIS_INTERFACE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448021)); pub const STATUS_NDIS_UNSUPPORTED_REVISION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448020)); pub const STATUS_NDIS_INVALID_PORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448019)); pub const STATUS_NDIS_INVALID_PORT_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448018)); pub const STATUS_NDIS_LOW_POWER_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448017)); pub const STATUS_NDIS_REINIT_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448016)); pub const STATUS_NDIS_NO_QUEUES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071448015)); pub const STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439872)); pub const STATUS_NDIS_DOT11_MEDIA_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439871)); pub const STATUS_NDIS_DOT11_POWER_STATE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439870)); pub const STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439869)); pub const STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439868)); pub const STATUS_NDIS_DOT11_AP_CHANNEL_CURRENTLY_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439867)); pub const STATUS_NDIS_DOT11_AP_BAND_CURRENTLY_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439866)); pub const STATUS_NDIS_DOT11_AP_CHANNEL_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439865)); pub const STATUS_NDIS_DOT11_AP_BAND_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071439864)); pub const STATUS_NDIS_INDICATION_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1076035585)); pub const STATUS_NDIS_OFFLOAD_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071443953)); pub const STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071443950)); pub const STATUS_NDIS_OFFLOAD_PATH_REJECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071443949)); pub const STATUS_TPM_ERROR_MASK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054848)); pub const STATUS_TPM_AUTHFAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054847)); pub const STATUS_TPM_BADINDEX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054846)); pub const STATUS_TPM_BAD_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054845)); pub const STATUS_TPM_AUDITFAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054844)); pub const STATUS_TPM_CLEAR_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054843)); pub const STATUS_TPM_DEACTIVATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054842)); pub const STATUS_TPM_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054841)); pub const STATUS_TPM_DISABLED_CMD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054840)); pub const STATUS_TPM_FAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054839)); pub const STATUS_TPM_BAD_ORDINAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054838)); pub const STATUS_TPM_INSTALL_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054837)); pub const STATUS_TPM_INVALID_KEYHANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054836)); pub const STATUS_TPM_KEYNOTFOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054835)); pub const STATUS_TPM_INAPPROPRIATE_ENC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054834)); pub const STATUS_TPM_MIGRATEFAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054833)); pub const STATUS_TPM_INVALID_PCR_INFO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054832)); pub const STATUS_TPM_NOSPACE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054831)); pub const STATUS_TPM_NOSRK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054830)); pub const STATUS_TPM_NOTSEALED_BLOB = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054829)); pub const STATUS_TPM_OWNER_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054828)); pub const STATUS_TPM_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054827)); pub const STATUS_TPM_SHORTRANDOM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054826)); pub const STATUS_TPM_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054825)); pub const STATUS_TPM_WRONGPCRVAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054824)); pub const STATUS_TPM_BAD_PARAM_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054823)); pub const STATUS_TPM_SHA_THREAD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054822)); pub const STATUS_TPM_SHA_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054821)); pub const STATUS_TPM_FAILEDSELFTEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054820)); pub const STATUS_TPM_AUTH2FAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054819)); pub const STATUS_TPM_BADTAG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054818)); pub const STATUS_TPM_IOERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054817)); pub const STATUS_TPM_ENCRYPT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054816)); pub const STATUS_TPM_DECRYPT_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054815)); pub const STATUS_TPM_INVALID_AUTHHANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054814)); pub const STATUS_TPM_NO_ENDORSEMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054813)); pub const STATUS_TPM_INVALID_KEYUSAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054812)); pub const STATUS_TPM_WRONG_ENTITYTYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054811)); pub const STATUS_TPM_INVALID_POSTINIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054810)); pub const STATUS_TPM_INAPPROPRIATE_SIG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054809)); pub const STATUS_TPM_BAD_KEY_PROPERTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054808)); pub const STATUS_TPM_BAD_MIGRATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054807)); pub const STATUS_TPM_BAD_SCHEME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054806)); pub const STATUS_TPM_BAD_DATASIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054805)); pub const STATUS_TPM_BAD_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054804)); pub const STATUS_TPM_BAD_PRESENCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054803)); pub const STATUS_TPM_BAD_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054802)); pub const STATUS_TPM_NO_WRAP_TRANSPORT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054801)); pub const STATUS_TPM_AUDITFAIL_UNSUCCESSFUL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054800)); pub const STATUS_TPM_AUDITFAIL_SUCCESSFUL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054799)); pub const STATUS_TPM_NOTRESETABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054798)); pub const STATUS_TPM_NOTLOCAL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054797)); pub const STATUS_TPM_BAD_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054796)); pub const STATUS_TPM_INVALID_RESOURCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054795)); pub const STATUS_TPM_NOTFIPS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054794)); pub const STATUS_TPM_INVALID_FAMILY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054793)); pub const STATUS_TPM_NO_NV_PERMISSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054792)); pub const STATUS_TPM_REQUIRES_SIGN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054791)); pub const STATUS_TPM_KEY_NOTSUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054790)); pub const STATUS_TPM_AUTH_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054789)); pub const STATUS_TPM_AREA_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054788)); pub const STATUS_TPM_BAD_LOCALITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054787)); pub const STATUS_TPM_READ_ONLY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054786)); pub const STATUS_TPM_PER_NOWRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054785)); pub const STATUS_TPM_FAMILYCOUNT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054784)); pub const STATUS_TPM_WRITE_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054783)); pub const STATUS_TPM_BAD_ATTRIBUTES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054782)); pub const STATUS_TPM_INVALID_STRUCTURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054781)); pub const STATUS_TPM_KEY_OWNER_CONTROL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054780)); pub const STATUS_TPM_BAD_COUNTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054779)); pub const STATUS_TPM_NOT_FULLWRITE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054778)); pub const STATUS_TPM_CONTEXT_GAP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054777)); pub const STATUS_TPM_MAXNVWRITES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054776)); pub const STATUS_TPM_NOOPERATOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054775)); pub const STATUS_TPM_RESOURCEMISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054774)); pub const STATUS_TPM_DELEGATE_LOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054773)); pub const STATUS_TPM_DELEGATE_FAMILY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054772)); pub const STATUS_TPM_DELEGATE_ADMIN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054771)); pub const STATUS_TPM_TRANSPORT_NOTEXCLUSIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054770)); pub const STATUS_TPM_OWNER_CONTROL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054769)); pub const STATUS_TPM_DAA_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054768)); pub const STATUS_TPM_DAA_INPUT_DATA0 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054767)); pub const STATUS_TPM_DAA_INPUT_DATA1 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054766)); pub const STATUS_TPM_DAA_ISSUER_SETTINGS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054765)); pub const STATUS_TPM_DAA_TPM_SETTINGS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054764)); pub const STATUS_TPM_DAA_STAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054763)); pub const STATUS_TPM_DAA_ISSUER_VALIDITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054762)); pub const STATUS_TPM_DAA_WRONG_W = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054761)); pub const STATUS_TPM_BAD_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054760)); pub const STATUS_TPM_BAD_DELEGATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054759)); pub const STATUS_TPM_BADCONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054758)); pub const STATUS_TPM_TOOMANYCONTEXTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054757)); pub const STATUS_TPM_MA_TICKET_SIGNATURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054756)); pub const STATUS_TPM_MA_DESTINATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054755)); pub const STATUS_TPM_MA_SOURCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054754)); pub const STATUS_TPM_MA_AUTHORITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054753)); pub const STATUS_TPM_PERMANENTEK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054751)); pub const STATUS_TPM_BAD_SIGNATURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054750)); pub const STATUS_TPM_NOCONTEXTSPACE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054749)); pub const STATUS_TPM_20_E_ASYMMETRIC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054719)); pub const STATUS_TPM_20_E_ATTRIBUTES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054718)); pub const STATUS_TPM_20_E_HASH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054717)); pub const STATUS_TPM_20_E_VALUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054716)); pub const STATUS_TPM_20_E_HIERARCHY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054715)); pub const STATUS_TPM_20_E_KEY_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054713)); pub const STATUS_TPM_20_E_MGF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054712)); pub const STATUS_TPM_20_E_MODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054711)); pub const STATUS_TPM_20_E_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054710)); pub const STATUS_TPM_20_E_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054709)); pub const STATUS_TPM_20_E_KDF = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054708)); pub const STATUS_TPM_20_E_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054707)); pub const STATUS_TPM_20_E_AUTH_FAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054706)); pub const STATUS_TPM_20_E_NONCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054705)); pub const STATUS_TPM_20_E_PP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054704)); pub const STATUS_TPM_20_E_SCHEME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054702)); pub const STATUS_TPM_20_E_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054699)); pub const STATUS_TPM_20_E_SYMMETRIC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054698)); pub const STATUS_TPM_20_E_TAG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054697)); pub const STATUS_TPM_20_E_SELECTOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054696)); pub const STATUS_TPM_20_E_INSUFFICIENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054694)); pub const STATUS_TPM_20_E_SIGNATURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054693)); pub const STATUS_TPM_20_E_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054692)); pub const STATUS_TPM_20_E_POLICY_FAIL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054691)); pub const STATUS_TPM_20_E_INTEGRITY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054689)); pub const STATUS_TPM_20_E_TICKET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054688)); pub const STATUS_TPM_20_E_RESERVED_BITS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054687)); pub const STATUS_TPM_20_E_BAD_AUTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054686)); pub const STATUS_TPM_20_E_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054685)); pub const STATUS_TPM_20_E_POLICY_CC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054684)); pub const STATUS_TPM_20_E_BINDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054683)); pub const STATUS_TPM_20_E_CURVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054682)); pub const STATUS_TPM_20_E_ECC_POINT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054681)); pub const STATUS_TPM_20_E_INITIALIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054592)); pub const STATUS_TPM_20_E_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054591)); pub const STATUS_TPM_20_E_SEQUENCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054589)); pub const STATUS_TPM_20_E_PRIVATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054581)); pub const STATUS_TPM_20_E_HMAC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054567)); pub const STATUS_TPM_20_E_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054560)); pub const STATUS_TPM_20_E_EXCLUSIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054559)); pub const STATUS_TPM_20_E_ECC_CURVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054557)); pub const STATUS_TPM_20_E_AUTH_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054556)); pub const STATUS_TPM_20_E_AUTH_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054555)); pub const STATUS_TPM_20_E_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054554)); pub const STATUS_TPM_20_E_PCR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054553)); pub const STATUS_TPM_20_E_PCR_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054552)); pub const STATUS_TPM_20_E_UPGRADE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054547)); pub const STATUS_TPM_20_E_TOO_MANY_CONTEXTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054546)); pub const STATUS_TPM_20_E_AUTH_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054545)); pub const STATUS_TPM_20_E_REBOOT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054544)); pub const STATUS_TPM_20_E_UNBALANCED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054543)); pub const STATUS_TPM_20_E_COMMAND_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054526)); pub const STATUS_TPM_20_E_COMMAND_CODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054525)); pub const STATUS_TPM_20_E_AUTHSIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054524)); pub const STATUS_TPM_20_E_AUTH_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054523)); pub const STATUS_TPM_20_E_NV_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054522)); pub const STATUS_TPM_20_E_NV_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054521)); pub const STATUS_TPM_20_E_NV_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054520)); pub const STATUS_TPM_20_E_NV_AUTHORIZATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054519)); pub const STATUS_TPM_20_E_NV_UNINITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054518)); pub const STATUS_TPM_20_E_NV_SPACE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054517)); pub const STATUS_TPM_20_E_NV_DEFINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054516)); pub const STATUS_TPM_20_E_BAD_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054512)); pub const STATUS_TPM_20_E_CPHASH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054511)); pub const STATUS_TPM_20_E_PARENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054510)); pub const STATUS_TPM_20_E_NEEDS_TEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054509)); pub const STATUS_TPM_20_E_NO_RESULT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054508)); pub const STATUS_TPM_20_E_SENSITIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071054507)); pub const STATUS_TPM_COMMAND_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071053824)); pub const STATUS_TPM_INVALID_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071053823)); pub const STATUS_TPM_DUPLICATE_VHANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071053822)); pub const STATUS_TPM_EMBEDDED_COMMAND_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071053821)); pub const STATUS_TPM_EMBEDDED_COMMAND_UNSUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071053820)); pub const STATUS_TPM_RETRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071052800)); pub const STATUS_TPM_NEEDS_SELFTEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071052799)); pub const STATUS_TPM_DOING_SELFTEST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071052798)); pub const STATUS_TPM_DEFEND_LOCK_RUNNING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071052797)); pub const STATUS_TPM_COMMAND_CANCELED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071050751)); pub const STATUS_TPM_TOO_MANY_CONTEXTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071050750)); pub const STATUS_TPM_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071050749)); pub const STATUS_TPM_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071050748)); pub const STATUS_TPM_INSUFFICIENT_BUFFER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071050747)); pub const STATUS_TPM_PPI_FUNCTION_UNSUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071050746)); pub const STATUS_PCP_ERROR_MASK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046656)); pub const STATUS_PCP_DEVICE_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046655)); pub const STATUS_PCP_INVALID_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046654)); pub const STATUS_PCP_INVALID_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046653)); pub const STATUS_PCP_FLAG_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046652)); pub const STATUS_PCP_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046651)); pub const STATUS_PCP_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046650)); pub const STATUS_PCP_INTERNAL_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046649)); pub const STATUS_PCP_AUTHENTICATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046648)); pub const STATUS_PCP_AUTHENTICATION_IGNORED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046647)); pub const STATUS_PCP_POLICY_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046646)); pub const STATUS_PCP_PROFILE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046645)); pub const STATUS_PCP_VALIDATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046644)); pub const STATUS_PCP_DEVICE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046643)); pub const STATUS_PCP_WRONG_PARENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046642)); pub const STATUS_PCP_KEY_NOT_LOADED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046641)); pub const STATUS_PCP_NO_KEY_CERTIFICATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046640)); pub const STATUS_PCP_KEY_NOT_FINALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046639)); pub const STATUS_PCP_ATTESTATION_CHALLENGE_NOT_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046638)); pub const STATUS_PCP_NOT_PCR_BOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046637)); pub const STATUS_PCP_KEY_ALREADY_FINALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046636)); pub const STATUS_PCP_KEY_USAGE_POLICY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046635)); pub const STATUS_PCP_KEY_USAGE_POLICY_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046634)); pub const STATUS_PCP_SOFT_KEY_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046633)); pub const STATUS_PCP_KEY_NOT_AUTHENTICATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046632)); pub const STATUS_PCP_KEY_NOT_AIK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046631)); pub const STATUS_PCP_KEY_NOT_SIGNING_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046630)); pub const STATUS_PCP_LOCKED_OUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046629)); pub const STATUS_PCP_CLAIM_TYPE_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046628)); pub const STATUS_PCP_TPM_VERSION_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046627)); pub const STATUS_PCP_BUFFER_LENGTH_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046626)); pub const STATUS_PCP_IFX_RSA_KEY_CREATION_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046625)); pub const STATUS_PCP_TICKET_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046624)); pub const STATUS_PCP_RAW_POLICY_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046623)); pub const STATUS_PCP_KEY_HANDLE_INVALIDATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071046622)); pub const STATUS_PCP_UNSUPPORTED_PSS_SALT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 1076437027)); pub const STATUS_RTPM_CONTEXT_CONTINUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 2699264)); pub const STATUS_RTPM_CONTEXT_COMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 2699265)); pub const STATUS_RTPM_NO_RESULT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071042558)); pub const STATUS_RTPM_PCR_READ_INCOMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071042557)); pub const STATUS_RTPM_INVALID_CONTEXT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071042556)); pub const STATUS_RTPM_UNSUPPORTED_CMD = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071042555)); pub const STATUS_TPM_ZERO_EXHAUST_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071038464)); pub const STATUS_HV_INVALID_HYPERCALL_CODE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268414)); pub const STATUS_HV_INVALID_HYPERCALL_INPUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268413)); pub const STATUS_HV_INVALID_ALIGNMENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268412)); pub const STATUS_HV_INVALID_PARAMETER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268411)); pub const STATUS_HV_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268410)); pub const STATUS_HV_INVALID_PARTITION_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268409)); pub const STATUS_HV_OPERATION_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268408)); pub const STATUS_HV_UNKNOWN_PROPERTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268407)); pub const STATUS_HV_PROPERTY_VALUE_OUT_OF_RANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268406)); pub const STATUS_HV_INSUFFICIENT_MEMORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268405)); pub const STATUS_HV_PARTITION_TOO_DEEP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268404)); pub const STATUS_HV_INVALID_PARTITION_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268403)); pub const STATUS_HV_INVALID_VP_INDEX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268402)); pub const STATUS_HV_INVALID_PORT_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268399)); pub const STATUS_HV_INVALID_CONNECTION_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268398)); pub const STATUS_HV_INSUFFICIENT_BUFFERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268397)); pub const STATUS_HV_NOT_ACKNOWLEDGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268396)); pub const STATUS_HV_INVALID_VP_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268395)); pub const STATUS_HV_ACKNOWLEDGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268394)); pub const STATUS_HV_INVALID_SAVE_RESTORE_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268393)); pub const STATUS_HV_INVALID_SYNIC_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268392)); pub const STATUS_HV_OBJECT_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268391)); pub const STATUS_HV_INVALID_PROXIMITY_DOMAIN_INFO = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268390)); pub const STATUS_HV_NO_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268389)); pub const STATUS_HV_INACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268388)); pub const STATUS_HV_NO_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268387)); pub const STATUS_HV_FEATURE_UNAVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268386)); pub const STATUS_HV_INSUFFICIENT_BUFFER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268365)); pub const STATUS_HV_INSUFFICIENT_DEVICE_DOMAINS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268360)); pub const STATUS_HV_CPUID_FEATURE_VALIDATION_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268356)); pub const STATUS_HV_CPUID_XSAVE_FEATURE_VALIDATION_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268355)); pub const STATUS_HV_PROCESSOR_STARTUP_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268354)); pub const STATUS_HV_SMX_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268353)); pub const STATUS_HV_INVALID_LP_INDEX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268351)); pub const STATUS_HV_INVALID_REGISTER_VALUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268336)); pub const STATUS_HV_INVALID_VTL_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268335)); pub const STATUS_HV_NX_NOT_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268331)); pub const STATUS_HV_INVALID_DEVICE_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268329)); pub const STATUS_HV_INVALID_DEVICE_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268328)); pub const STATUS_HV_PENDING_PAGE_REQUESTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 3473497)); pub const STATUS_HV_PAGE_REQUEST_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268320)); pub const STATUS_HV_INVALID_CPU_GROUP_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268305)); pub const STATUS_HV_INVALID_CPU_GROUP_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268304)); pub const STATUS_HV_OPERATION_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268303)); pub const STATUS_HV_NOT_ALLOWED_WITH_NESTED_VIRT_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268302)); pub const STATUS_HV_INSUFFICIENT_ROOT_MEMORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268301)); pub const STATUS_HV_EVENT_BUFFER_ALREADY_FREED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268300)); pub const STATUS_HV_INSUFFICIENT_CONTIGUOUS_MEMORY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070268299)); pub const STATUS_HV_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070264320)); pub const STATUS_VID_DUPLICATE_HANDLER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137343)); pub const STATUS_VID_TOO_MANY_HANDLERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137342)); pub const STATUS_VID_QUEUE_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137341)); pub const STATUS_VID_HANDLER_NOT_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137340)); pub const STATUS_VID_INVALID_OBJECT_NAME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137339)); pub const STATUS_VID_PARTITION_NAME_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137338)); pub const STATUS_VID_MESSAGE_QUEUE_NAME_TOO_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137337)); pub const STATUS_VID_PARTITION_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137336)); pub const STATUS_VID_PARTITION_DOES_NOT_EXIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137335)); pub const STATUS_VID_PARTITION_NAME_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137334)); pub const STATUS_VID_MESSAGE_QUEUE_ALREADY_EXISTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137333)); pub const STATUS_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137332)); pub const STATUS_VID_MB_STILL_REFERENCED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137331)); pub const STATUS_VID_CHILD_GPA_PAGE_SET_CORRUPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137330)); pub const STATUS_VID_INVALID_NUMA_SETTINGS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137329)); pub const STATUS_VID_INVALID_NUMA_NODE_INDEX = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137328)); pub const STATUS_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137327)); pub const STATUS_VID_INVALID_MEMORY_BLOCK_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137326)); pub const STATUS_VID_PAGE_RANGE_OVERFLOW = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137325)); pub const STATUS_VID_INVALID_MESSAGE_QUEUE_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137324)); pub const STATUS_VID_INVALID_GPA_RANGE_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137323)); pub const STATUS_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137322)); pub const STATUS_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137321)); pub const STATUS_VID_INVALID_PPM_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137320)); pub const STATUS_VID_MBPS_ARE_LOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137319)); pub const STATUS_VID_MESSAGE_QUEUE_CLOSED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137318)); pub const STATUS_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137317)); pub const STATUS_VID_STOP_PENDING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137316)); pub const STATUS_VID_INVALID_PROCESSOR_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137315)); pub const STATUS_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137314)); pub const STATUS_VID_KM_INTERFACE_ALREADY_INITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137313)); pub const STATUS_VID_MB_PROPERTY_ALREADY_SET_RESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137312)); pub const STATUS_VID_MMIO_RANGE_DESTROYED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137311)); pub const STATUS_VID_INVALID_CHILD_GPA_PAGE_SET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137310)); pub const STATUS_VID_RESERVE_PAGE_SET_IS_BEING_USED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137309)); pub const STATUS_VID_RESERVE_PAGE_SET_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137308)); pub const STATUS_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137307)); pub const STATUS_VID_MBP_COUNT_EXCEEDED_LIMIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137306)); pub const STATUS_VID_SAVED_STATE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137305)); pub const STATUS_VID_SAVED_STATE_UNRECOGNIZED_ITEM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137304)); pub const STATUS_VID_SAVED_STATE_INCOMPATIBLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137303)); pub const STATUS_VID_VTL_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070137302)); pub const STATUS_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143879167)); pub const STATUS_IPSEC_BAD_SPI = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202879)); pub const STATUS_IPSEC_SA_LIFETIME_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202878)); pub const STATUS_IPSEC_WRONG_SA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202877)); pub const STATUS_IPSEC_REPLAY_CHECK_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202876)); pub const STATUS_IPSEC_INVALID_PACKET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202875)); pub const STATUS_IPSEC_INTEGRITY_CHECK_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202874)); pub const STATUS_IPSEC_CLEAR_TEXT_DROP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202873)); pub const STATUS_IPSEC_AUTH_FIREWALL_DROP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202872)); pub const STATUS_IPSEC_THROTTLE_DROP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070202871)); pub const STATUS_IPSEC_DOSP_BLOCK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070170112)); pub const STATUS_IPSEC_DOSP_RECEIVED_MULTICAST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070170111)); pub const STATUS_IPSEC_DOSP_INVALID_PACKET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070170110)); pub const STATUS_IPSEC_DOSP_STATE_LOOKUP_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070170109)); pub const STATUS_IPSEC_DOSP_MAX_ENTRIES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070170108)); pub const STATUS_IPSEC_DOSP_KEYMOD_NOT_ALLOWED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070170107)); pub const STATUS_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070170106)); pub const STATUS_VOLMGR_INCOMPLETE_REGENERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143813631)); pub const STATUS_VOLMGR_INCOMPLETE_DISK_MIGRATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143813630)); pub const STATUS_VOLMGR_DATABASE_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071807)); pub const STATUS_VOLMGR_DISK_CONFIGURATION_CORRUPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071806)); pub const STATUS_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071805)); pub const STATUS_VOLMGR_PACK_CONFIG_UPDATE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071804)); pub const STATUS_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071803)); pub const STATUS_VOLMGR_DISK_DUPLICATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071802)); pub const STATUS_VOLMGR_DISK_DYNAMIC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071801)); pub const STATUS_VOLMGR_DISK_ID_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071800)); pub const STATUS_VOLMGR_DISK_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071799)); pub const STATUS_VOLMGR_DISK_LAST_VOTER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071798)); pub const STATUS_VOLMGR_DISK_LAYOUT_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071797)); pub const STATUS_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071796)); pub const STATUS_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071795)); pub const STATUS_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071794)); pub const STATUS_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071793)); pub const STATUS_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071792)); pub const STATUS_VOLMGR_DISK_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071791)); pub const STATUS_VOLMGR_DISK_NOT_EMPTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071790)); pub const STATUS_VOLMGR_DISK_NOT_ENOUGH_SPACE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071789)); pub const STATUS_VOLMGR_DISK_REVECTORING_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071788)); pub const STATUS_VOLMGR_DISK_SECTOR_SIZE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071787)); pub const STATUS_VOLMGR_DISK_SET_NOT_CONTAINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071786)); pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071785)); pub const STATUS_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071784)); pub const STATUS_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071783)); pub const STATUS_VOLMGR_EXTENT_ALREADY_USED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071782)); pub const STATUS_VOLMGR_EXTENT_NOT_CONTIGUOUS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071781)); pub const STATUS_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071780)); pub const STATUS_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071779)); pub const STATUS_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071778)); pub const STATUS_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071777)); pub const STATUS_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071776)); pub const STATUS_VOLMGR_INTERLEAVE_LENGTH_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071775)); pub const STATUS_VOLMGR_MAXIMUM_REGISTERED_USERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071774)); pub const STATUS_VOLMGR_MEMBER_IN_SYNC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071773)); pub const STATUS_VOLMGR_MEMBER_INDEX_DUPLICATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071772)); pub const STATUS_VOLMGR_MEMBER_INDEX_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071771)); pub const STATUS_VOLMGR_MEMBER_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071770)); pub const STATUS_VOLMGR_MEMBER_NOT_DETACHED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071769)); pub const STATUS_VOLMGR_MEMBER_REGENERATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071768)); pub const STATUS_VOLMGR_ALL_DISKS_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071767)); pub const STATUS_VOLMGR_NO_REGISTERED_USERS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071766)); pub const STATUS_VOLMGR_NO_SUCH_USER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071765)); pub const STATUS_VOLMGR_NOTIFICATION_RESET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071764)); pub const STATUS_VOLMGR_NUMBER_OF_MEMBERS_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071763)); pub const STATUS_VOLMGR_NUMBER_OF_PLEXES_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071762)); pub const STATUS_VOLMGR_PACK_DUPLICATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071761)); pub const STATUS_VOLMGR_PACK_ID_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071760)); pub const STATUS_VOLMGR_PACK_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071759)); pub const STATUS_VOLMGR_PACK_NAME_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071758)); pub const STATUS_VOLMGR_PACK_OFFLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071757)); pub const STATUS_VOLMGR_PACK_HAS_QUORUM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071756)); pub const STATUS_VOLMGR_PACK_WITHOUT_QUORUM = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071755)); pub const STATUS_VOLMGR_PARTITION_STYLE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071754)); pub const STATUS_VOLMGR_PARTITION_UPDATE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071753)); pub const STATUS_VOLMGR_PLEX_IN_SYNC = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071752)); pub const STATUS_VOLMGR_PLEX_INDEX_DUPLICATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071751)); pub const STATUS_VOLMGR_PLEX_INDEX_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071750)); pub const STATUS_VOLMGR_PLEX_LAST_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071749)); pub const STATUS_VOLMGR_PLEX_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071748)); pub const STATUS_VOLMGR_PLEX_REGENERATING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071747)); pub const STATUS_VOLMGR_PLEX_TYPE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071746)); pub const STATUS_VOLMGR_PLEX_NOT_RAID5 = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071745)); pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071744)); pub const STATUS_VOLMGR_STRUCTURE_SIZE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071743)); pub const STATUS_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071742)); pub const STATUS_VOLMGR_TRANSACTION_IN_PROGRESS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071741)); pub const STATUS_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071740)); pub const STATUS_VOLMGR_VOLUME_CONTAINS_MISSING_DISK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071739)); pub const STATUS_VOLMGR_VOLUME_ID_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071738)); pub const STATUS_VOLMGR_VOLUME_LENGTH_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071737)); pub const STATUS_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071736)); pub const STATUS_VOLMGR_VOLUME_NOT_MIRRORED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071735)); pub const STATUS_VOLMGR_VOLUME_NOT_RETAINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071734)); pub const STATUS_VOLMGR_VOLUME_OFFLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071733)); pub const STATUS_VOLMGR_VOLUME_RETAINED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071732)); pub const STATUS_VOLMGR_NUMBER_OF_EXTENTS_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071731)); pub const STATUS_VOLMGR_DIFFERENT_SECTOR_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071730)); pub const STATUS_VOLMGR_BAD_BOOT_DISK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071729)); pub const STATUS_VOLMGR_PACK_CONFIG_OFFLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071728)); pub const STATUS_VOLMGR_PACK_CONFIG_ONLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071727)); pub const STATUS_VOLMGR_NOT_PRIMARY_PACK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071726)); pub const STATUS_VOLMGR_PACK_LOG_UPDATE_FAILED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071725)); pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071724)); pub const STATUS_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071723)); pub const STATUS_VOLMGR_VOLUME_MIRRORED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071722)); pub const STATUS_VOLMGR_PLEX_NOT_SIMPLE_SPANNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071721)); pub const STATUS_VOLMGR_NO_VALID_LOG_COPIES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071720)); pub const STATUS_VOLMGR_PRIMARY_PACK_PRESENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071719)); pub const STATUS_VOLMGR_NUMBER_OF_DISKS_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071718)); pub const STATUS_VOLMGR_MIRROR_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071717)); pub const STATUS_VOLMGR_RAID5_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070071716)); pub const STATUS_BCD_NOT_ALL_ENTRIES_IMPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143748095)); pub const STATUS_BCD_TOO_MANY_ELEMENTS = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1070006270)); pub const STATUS_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143748093)); pub const STATUS_VHD_DRIVE_FOOTER_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940735)); pub const STATUS_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940734)); pub const STATUS_VHD_DRIVE_FOOTER_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940733)); pub const STATUS_VHD_FORMAT_UNKNOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940732)); pub const STATUS_VHD_FORMAT_UNSUPPORTED_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940731)); pub const STATUS_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940730)); pub const STATUS_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940729)); pub const STATUS_VHD_SPARSE_HEADER_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940728)); pub const STATUS_VHD_BLOCK_ALLOCATION_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940727)); pub const STATUS_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940726)); pub const STATUS_VHD_INVALID_BLOCK_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940725)); pub const STATUS_VHD_BITMAP_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940724)); pub const STATUS_VHD_PARENT_VHD_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940723)); pub const STATUS_VHD_CHILD_PARENT_ID_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940722)); pub const STATUS_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940721)); pub const STATUS_VHD_METADATA_READ_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940720)); pub const STATUS_VHD_METADATA_WRITE_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940719)); pub const STATUS_VHD_INVALID_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940718)); pub const STATUS_VHD_INVALID_FILE_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940717)); pub const STATUS_VIRTDISK_PROVIDER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940716)); pub const STATUS_VIRTDISK_NOT_VIRTUAL_DISK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940715)); pub const STATUS_VHD_PARENT_VHD_ACCESS_DENIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940714)); pub const STATUS_VHD_CHILD_PARENT_SIZE_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940713)); pub const STATUS_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940712)); pub const STATUS_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940711)); pub const STATUS_VIRTUAL_DISK_LIMITATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940710)); pub const STATUS_VHD_INVALID_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940709)); pub const STATUS_VHD_INVALID_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940708)); pub const STATUS_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940707)); pub const STATUS_VIRTDISK_DISK_ALREADY_OWNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940706)); pub const STATUS_VIRTDISK_DISK_ONLINE_AND_WRITABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940705)); pub const STATUS_CTLOG_TRACKING_NOT_INITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940704)); pub const STATUS_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940703)); pub const STATUS_CTLOG_VHD_CHANGED_OFFLINE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940702)); pub const STATUS_CTLOG_INVALID_TRACKING_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940701)); pub const STATUS_CTLOG_INCONSISTENT_TRACKING_FILE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940700)); pub const STATUS_VHD_METADATA_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940696)); pub const STATUS_VHD_INVALID_CHANGE_TRACKING_ID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940695)); pub const STATUS_VHD_CHANGE_TRACKING_DISABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940694)); pub const STATUS_VHD_MISSING_CHANGE_TRACKING_INFORMATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940688)); pub const STATUS_VHD_RESIZE_WOULD_TRUNCATE_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940687)); pub const STATUS_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940686)); pub const STATUS_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069940685)); pub const STATUS_QUERY_STORAGE_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143682559)); pub const STATUS_GDI_HANDLE_LEAK = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143354879)); pub const STATUS_RKF_KEY_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069547519)); pub const STATUS_RKF_DUPLICATE_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069547518)); pub const STATUS_RKF_BLOB_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069547517)); pub const STATUS_RKF_STORE_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069547516)); pub const STATUS_RKF_FILE_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069547515)); pub const STATUS_RKF_ACTIVE_KEY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069547514)); pub const STATUS_RDBSS_RESTART_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069481983)); pub const STATUS_RDBSS_CONTINUE_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069481982)); pub const STATUS_RDBSS_POST_OPERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069481981)); pub const STATUS_RDBSS_RETRY_LOOKUP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069481980)); pub const STATUS_BTH_ATT_INVALID_HANDLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416447)); pub const STATUS_BTH_ATT_READ_NOT_PERMITTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416446)); pub const STATUS_BTH_ATT_WRITE_NOT_PERMITTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416445)); pub const STATUS_BTH_ATT_INVALID_PDU = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416444)); pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHENTICATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416443)); pub const STATUS_BTH_ATT_REQUEST_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416442)); pub const STATUS_BTH_ATT_INVALID_OFFSET = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416441)); pub const STATUS_BTH_ATT_INSUFFICIENT_AUTHORIZATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416440)); pub const STATUS_BTH_ATT_PREPARE_QUEUE_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416439)); pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416438)); pub const STATUS_BTH_ATT_ATTRIBUTE_NOT_LONG = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416437)); pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416436)); pub const STATUS_BTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416435)); pub const STATUS_BTH_ATT_UNLIKELY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416434)); pub const STATUS_BTH_ATT_INSUFFICIENT_ENCRYPTION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416433)); pub const STATUS_BTH_ATT_UNSUPPORTED_GROUP_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416432)); pub const STATUS_BTH_ATT_INSUFFICIENT_RESOURCES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069416431)); pub const STATUS_BTH_ATT_UNKNOWN_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069412352)); pub const STATUS_SECUREBOOT_ROLLBACK_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350911)); pub const STATUS_SECUREBOOT_POLICY_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350910)); pub const STATUS_SECUREBOOT_INVALID_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350909)); pub const STATUS_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350908)); pub const STATUS_SECUREBOOT_POLICY_NOT_SIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350907)); pub const STATUS_SECUREBOOT_NOT_ENABLED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -2143092730)); pub const STATUS_SECUREBOOT_FILE_REPLACED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350905)); pub const STATUS_SECUREBOOT_POLICY_NOT_AUTHORIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350904)); pub const STATUS_SECUREBOOT_POLICY_UNKNOWN = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350903)); pub const STATUS_SECUREBOOT_POLICY_MISSING_ANTIROLLBACKVERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350902)); pub const STATUS_SECUREBOOT_PLATFORM_ID_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350901)); pub const STATUS_SECUREBOOT_POLICY_ROLLBACK_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350900)); pub const STATUS_SECUREBOOT_POLICY_UPGRADE_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350899)); pub const STATUS_SECUREBOOT_REQUIRED_POLICY_FILE_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350898)); pub const STATUS_SECUREBOOT_NOT_BASE_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350897)); pub const STATUS_SECUREBOOT_NOT_SUPPLEMENTAL_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069350896)); pub const STATUS_PLATFORM_MANIFEST_NOT_AUTHORIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058340863)); pub const STATUS_PLATFORM_MANIFEST_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058340862)); pub const STATUS_PLATFORM_MANIFEST_FILE_NOT_AUTHORIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058340861)); pub const STATUS_PLATFORM_MANIFEST_CATALOG_NOT_AUTHORIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058340860)); pub const STATUS_PLATFORM_MANIFEST_BINARY_ID_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058340859)); pub const STATUS_PLATFORM_MANIFEST_NOT_ACTIVE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058340858)); pub const STATUS_PLATFORM_MANIFEST_NOT_SIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058340857)); pub const STATUS_SYSTEM_INTEGRITY_ROLLBACK_DETECTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058471935)); pub const STATUS_SYSTEM_INTEGRITY_POLICY_VIOLATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058471934)); pub const STATUS_SYSTEM_INTEGRITY_INVALID_POLICY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058471933)); pub const STATUS_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058471932)); pub const STATUS_SYSTEM_INTEGRITY_TOO_MANY_POLICIES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058471931)); pub const STATUS_SYSTEM_INTEGRITY_SUPPLEMENTAL_POLICY_NOT_AUTHORIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058471930)); pub const STATUS_NO_APPLICABLE_APP_LICENSES_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406399)); pub const STATUS_CLIP_LICENSE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406398)); pub const STATUS_CLIP_DEVICE_LICENSE_MISSING = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406397)); pub const STATUS_CLIP_LICENSE_INVALID_SIGNATURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406396)); pub const STATUS_CLIP_KEYHOLDER_LICENSE_MISSING_OR_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406395)); pub const STATUS_CLIP_LICENSE_EXPIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406394)); pub const STATUS_CLIP_LICENSE_SIGNED_BY_UNKNOWN_SOURCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406393)); pub const STATUS_CLIP_LICENSE_NOT_SIGNED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406392)); pub const STATUS_CLIP_LICENSE_HARDWARE_ID_OUT_OF_TOLERANCE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406391)); pub const STATUS_CLIP_LICENSE_DEVICE_ID_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058406390)); pub const STATUS_AUDIO_ENGINE_NODE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069285375)); pub const STATUS_HDAUDIO_EMPTY_CONNECTION_LIST = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069285374)); pub const STATUS_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069285373)); pub const STATUS_HDAUDIO_NO_LOGICAL_DEVICES_CREATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069285372)); pub const STATUS_HDAUDIO_NULL_LINKED_LIST_ENTRY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069285371)); pub const STATUS_SPACES_REPAIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 15138816)); pub const STATUS_SPACES_PAUSE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 15138817)); pub const STATUS_SPACES_COMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 15138818)); pub const STATUS_SPACES_REDIRECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, 15138819)); pub const STATUS_SPACES_FAULT_DOMAIN_TYPE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058603007)); pub const STATUS_SPACES_RESILIENCY_TYPE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058603005)); pub const STATUS_SPACES_DRIVE_SECTOR_SIZE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058603004)); pub const STATUS_SPACES_DRIVE_REDUNDANCY_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058603002)); pub const STATUS_SPACES_NUMBER_OF_DATA_COPIES_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058603001)); pub const STATUS_SPACES_INTERLEAVE_LENGTH_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602999)); pub const STATUS_SPACES_NUMBER_OF_COLUMNS_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602998)); pub const STATUS_SPACES_NOT_ENOUGH_DRIVES = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602997)); pub const STATUS_SPACES_EXTENDED_ERROR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602996)); pub const STATUS_SPACES_PROVISIONING_TYPE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602995)); pub const STATUS_SPACES_ALLOCATION_SIZE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602994)); pub const STATUS_SPACES_ENCLOSURE_AWARE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602993)); pub const STATUS_SPACES_WRITE_CACHE_SIZE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602992)); pub const STATUS_SPACES_NUMBER_OF_GROUPS_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602991)); pub const STATUS_SPACES_DRIVE_OPERATIONAL_STATE_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602990)); pub const STATUS_SPACES_UPDATE_COLUMN_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602989)); pub const STATUS_SPACES_MAP_REQUIRED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602988)); pub const STATUS_SPACES_UNSUPPORTED_VERSION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602987)); pub const STATUS_SPACES_CORRUPT_METADATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602986)); pub const STATUS_SPACES_DRT_FULL = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602985)); pub const STATUS_SPACES_INCONSISTENCY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602984)); pub const STATUS_SPACES_LOG_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602983)); pub const STATUS_SPACES_NO_REDUNDANCY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602982)); pub const STATUS_SPACES_DRIVE_NOT_READY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602981)); pub const STATUS_SPACES_DRIVE_SPLIT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602980)); pub const STATUS_SPACES_DRIVE_LOST_DATA = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602979)); pub const STATUS_SPACES_ENTRY_INCOMPLETE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602978)); pub const STATUS_SPACES_ENTRY_INVALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602977)); pub const STATUS_SPACES_MARK_DIRTY = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058602976)); pub const STATUS_VOLSNAP_BOOTFILE_NOT_VALID = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1068498941)); pub const STATUS_VOLSNAP_ACTIVATION_TIMEOUT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1068498940)); pub const STATUS_IO_PREEMPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1068433407)); pub const STATUS_SVHDX_ERROR_STORED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067712512)); pub const STATUS_SVHDX_ERROR_NOT_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647232)); pub const STATUS_SVHDX_UNIT_ATTENTION_AVAILABLE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647231)); pub const STATUS_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647230)); pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647229)); pub const STATUS_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647228)); pub const STATUS_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647227)); pub const STATUS_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647226)); pub const STATUS_SVHDX_RESERVATION_CONFLICT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647225)); pub const STATUS_SVHDX_WRONG_FILE_TYPE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647224)); pub const STATUS_SVHDX_VERSION_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647223)); pub const STATUS_VHD_SHARED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647222)); pub const STATUS_SVHDX_NO_INITIATOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647221)); pub const STATUS_VHDSET_BACKING_STORAGE_NOT_FOUND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067647220)); pub const STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067646976)); pub const STATUS_SMB_BAD_CLUSTER_DIALECT = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067646975)); pub const STATUS_SMB_GUEST_LOGON_BLOCKED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1067646974)); pub const STATUS_SECCORE_INVALID_COMMAND = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058537472)); pub const STATUS_VSM_NOT_INITIALIZED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069219840)); pub const STATUS_VSM_DMA_PROTECTION_NOT_IN_USE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1069219839)); pub const STATUS_APPEXEC_CONDITION_NOT_SATISFIED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275328)); pub const STATUS_APPEXEC_HANDLE_INVALIDATED = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275327)); pub const STATUS_APPEXEC_INVALID_HOST_GENERATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275326)); pub const STATUS_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275325)); pub const STATUS_APPEXEC_INVALID_HOST_STATE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275324)); pub const STATUS_APPEXEC_NO_DONOR = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275323)); pub const STATUS_APPEXEC_HOST_ID_MISMATCH = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275322)); pub const STATUS_APPEXEC_UNKNOWN_USER = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1058275321)); pub const STATUS_QUIC_HANDSHAKE_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071382528)); pub const STATUS_QUIC_VER_NEG_FAILURE = @import("zig.zig").typedConst(NTSTATUS, @as(i32, -1071382527)); pub const WINVER = @as(u32, 1280); pub const APP_LOCAL_DEVICE_ID_SIZE = @as(u32, 32); pub const DM_UPDATE = @as(u32, 1); pub const DM_COPY = @as(u32, 2); pub const DM_PROMPT = @as(u32, 4); pub const DM_MODIFY = @as(u32, 8); pub const SEC_E_OK = @import("zig.zig").typedConst(HRESULT, @as(i32, 0)); pub const RPC_X_NO_MORE_ENTRIES = @as(i32, 1772); pub const RPC_X_SS_CHAR_TRANS_OPEN_FAIL = @as(i32, 1773); pub const RPC_X_SS_CHAR_TRANS_SHORT_FILE = @as(i32, 1774); pub const RPC_X_SS_IN_NULL_CONTEXT = @as(i32, 1775); pub const RPC_X_SS_CONTEXT_DAMAGED = @as(i32, 1777); pub const RPC_X_SS_HANDLES_MISMATCH = @as(i32, 1778); pub const RPC_X_SS_CANNOT_GET_CALL_HANDLE = @as(i32, 1779); pub const RPC_X_NULL_REF_POINTER = @as(i32, 1780); pub const RPC_X_ENUM_VALUE_OUT_OF_RANGE = @as(i32, 1781); pub const RPC_X_BYTE_COUNT_TOO_SMALL = @as(i32, 1782); pub const RPC_X_BAD_STUB_DATA = @as(i32, 1783); pub const RPC_X_INVALID_ES_ACTION = @as(i32, 1827); pub const RPC_X_WRONG_ES_VERSION = @as(i32, 1828); pub const RPC_X_WRONG_STUB_VERSION = @as(i32, 1829); pub const RPC_X_INVALID_PIPE_OBJECT = @as(i32, 1830); pub const RPC_X_WRONG_PIPE_ORDER = @as(i32, 1831); pub const RPC_X_WRONG_PIPE_VERSION = @as(i32, 1832); pub const OR_INVALID_OXID = @as(i32, 1910); pub const OR_INVALID_OID = @as(i32, 1911); pub const OR_INVALID_SET = @as(i32, 1912); pub const RPC_X_PIPE_CLOSED = @as(i32, 1916); pub const RPC_X_PIPE_DISCIPLINE_ERROR = @as(i32, 1917); pub const RPC_X_PIPE_EMPTY = @as(i32, 1918); pub const PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED = @as(i32, 4050); pub const PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO = @as(i32, 4051); pub const PEERDIST_ERROR_MISSING_DATA = @as(i32, 4052); pub const PEERDIST_ERROR_NO_MORE = @as(i32, 4053); pub const PEERDIST_ERROR_NOT_INITIALIZED = @as(i32, 4054); pub const PEERDIST_ERROR_ALREADY_INITIALIZED = @as(i32, 4055); pub const PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS = @as(i32, 4056); pub const PEERDIST_ERROR_INVALIDATED = @as(i32, 4057); pub const PEERDIST_ERROR_ALREADY_EXISTS = @as(i32, 4058); pub const PEERDIST_ERROR_OPERATION_NOTFOUND = @as(i32, 4059); pub const PEERDIST_ERROR_ALREADY_COMPLETED = @as(i32, 4060); pub const PEERDIST_ERROR_OUT_OF_BOUNDS = @as(i32, 4061); pub const PEERDIST_ERROR_VERSION_UNSUPPORTED = @as(i32, 4062); pub const PEERDIST_ERROR_INVALID_CONFIGURATION = @as(i32, 4063); pub const PEERDIST_ERROR_NOT_LICENSED = @as(i32, 4064); pub const PEERDIST_ERROR_SERVICE_UNAVAILABLE = @as(i32, 4065); pub const PEERDIST_ERROR_TRUST_FAILURE = @as(i32, 4066); pub const SCHED_E_SERVICE_NOT_LOCALSYSTEM = @as(i32, 6200); pub const FRS_ERR_INVALID_API_SEQUENCE = @as(i32, 8001); pub const FRS_ERR_STARTING_SERVICE = @as(i32, 8002); pub const FRS_ERR_STOPPING_SERVICE = @as(i32, 8003); pub const FRS_ERR_INTERNAL_API = @as(i32, 8004); pub const FRS_ERR_INTERNAL = @as(i32, 8005); pub const FRS_ERR_SERVICE_COMM = @as(i32, 8006); pub const FRS_ERR_INSUFFICIENT_PRIV = @as(i32, 8007); pub const FRS_ERR_AUTHENTICATION = @as(i32, 8008); pub const FRS_ERR_PARENT_INSUFFICIENT_PRIV = @as(i32, 8009); pub const FRS_ERR_PARENT_AUTHENTICATION = @as(i32, 8010); pub const FRS_ERR_CHILD_TO_PARENT_COMM = @as(i32, 8011); pub const FRS_ERR_PARENT_TO_CHILD_COMM = @as(i32, 8012); pub const FRS_ERR_SYSVOL_POPULATE = @as(i32, 8013); pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT = @as(i32, 8014); pub const FRS_ERR_SYSVOL_IS_BUSY = @as(i32, 8015); pub const FRS_ERR_SYSVOL_DEMOTE = @as(i32, 8016); pub const FRS_ERR_INVALID_SERVICE_PARAMETER = @as(i32, 8017); pub const DNS_INFO_NO_RECORDS = @as(i32, 9501); pub const DNS_REQUEST_PENDING = @as(i32, 9506); pub const DNS_STATUS_FQDN = @as(i32, 9557); pub const DNS_STATUS_DOTTED_NAME = @as(i32, 9558); pub const DNS_STATUS_SINGLE_PART_NAME = @as(i32, 9559); pub const DNS_WARNING_PTR_CREATE_FAILED = @as(i32, 9715); pub const DNS_WARNING_DOMAIN_UNDELETED = @as(i32, 9716); pub const DNS_INFO_AXFR_COMPLETE = @as(i32, 9751); pub const DNS_INFO_ADDED_LOCAL_WINS = @as(i32, 9753); pub const DNS_STATUS_CONTINUE_NEEDED = @as(i32, 9801); pub const WARNING_IPSEC_MM_POLICY_PRUNED = @as(i32, 13024); pub const WARNING_IPSEC_QM_POLICY_PRUNED = @as(i32, 13025); pub const APPMODEL_ERROR_NO_PACKAGE = @as(i32, 15700); pub const APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT = @as(i32, 15701); pub const APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT = @as(i32, 15702); pub const APPMODEL_ERROR_NO_APPLICATION = @as(i32, 15703); pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_READ_FAILED = @as(i32, 15704); pub const APPMODEL_ERROR_DYNAMIC_PROPERTY_INVALID = @as(i32, 15705); pub const APPMODEL_ERROR_PACKAGE_NOT_AVAILABLE = @as(i32, 15706); pub const APPMODEL_ERROR_NO_MUTABLE_DIRECTORY = @as(i32, 15707); pub const STORE_ERROR_UNLICENSED = @as(i32, 15861); pub const STORE_ERROR_UNLICENSED_USER = @as(i32, 15862); pub const STORE_ERROR_PENDING_COM_TRANSACTION = @as(i32, 15863); pub const STORE_ERROR_LICENSE_REVOKED = @as(i32, 15864); pub const SEVERITY_SUCCESS = @as(u32, 0); pub const SEVERITY_ERROR = @as(u32, 1); pub const NOERROR = @as(u32, 0); pub const E_UNEXPECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418113)); pub const E_NOINTERFACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467262)); pub const E_POINTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467261)); pub const E_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147024890)); pub const E_ABORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467260)); pub const E_ACCESSDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147024891)); pub const E_BOUNDS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483637)); pub const E_CHANGED_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483636)); pub const E_ILLEGAL_STATE_CHANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483635)); pub const E_ILLEGAL_METHOD_CALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483634)); pub const RO_E_METADATA_NAME_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483633)); pub const RO_E_METADATA_NAME_IS_NAMESPACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483632)); pub const RO_E_METADATA_INVALID_TYPE_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483631)); pub const RO_E_INVALID_METADATA_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483630)); pub const RO_E_CLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483629)); pub const RO_E_EXCLUSIVE_WRITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483628)); pub const RO_E_CHANGE_NOTIFICATION_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483627)); pub const RO_E_ERROR_STRING_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483626)); pub const E_STRING_NOT_NULL_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483625)); pub const E_ILLEGAL_DELEGATE_ASSIGNMENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483624)); pub const E_ASYNC_OPERATION_NOT_STARTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483623)); pub const E_APPLICATION_EXITING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483622)); pub const E_APPLICATION_VIEW_EXITING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483621)); pub const RO_E_MUST_BE_AGILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483620)); pub const RO_E_UNSUPPORTED_FROM_MTA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483619)); pub const RO_E_COMMITTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483618)); pub const RO_E_BLOCKED_CROSS_ASTA_CALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483617)); pub const RO_E_CANNOT_ACTIVATE_FULL_TRUST_SERVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483616)); pub const RO_E_CANNOT_ACTIVATE_UNIVERSAL_APPLICATION_SERVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147483615)); pub const CO_E_INIT_TLS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467258)); pub const CO_E_INIT_SHARED_ALLOCATOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467257)); pub const CO_E_INIT_MEMORY_ALLOCATOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467256)); pub const CO_E_INIT_CLASS_CACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467255)); pub const CO_E_INIT_RPC_CHANNEL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467254)); pub const CO_E_INIT_TLS_SET_CHANNEL_CONTROL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467253)); pub const CO_E_INIT_TLS_CHANNEL_CONTROL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467252)); pub const CO_E_INIT_UNACCEPTED_USER_ALLOCATOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467251)); pub const CO_E_INIT_SCM_MUTEX_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467250)); pub const CO_E_INIT_SCM_FILE_MAPPING_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467249)); pub const CO_E_INIT_SCM_MAP_VIEW_OF_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467248)); pub const CO_E_INIT_SCM_EXEC_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467247)); pub const CO_E_INIT_ONLY_SINGLE_THREADED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467246)); pub const CO_E_CANT_REMOTE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467245)); pub const CO_E_BAD_SERVER_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467244)); pub const CO_E_WRONG_SERVER_IDENTITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467243)); pub const CO_E_OLE1DDE_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467242)); pub const CO_E_RUNAS_SYNTAX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467241)); pub const CO_E_CREATEPROCESS_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467240)); pub const CO_E_RUNAS_CREATEPROCESS_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467239)); pub const CO_E_RUNAS_LOGON_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467238)); pub const CO_E_LAUNCH_PERMSSION_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467237)); pub const CO_E_START_SERVICE_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467236)); pub const CO_E_REMOTE_COMMUNICATION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467235)); pub const CO_E_SERVER_START_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467234)); pub const CO_E_CLSREG_INCONSISTENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467233)); pub const CO_E_IIDREG_INCONSISTENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467232)); pub const CO_E_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467231)); pub const CO_E_RELOAD_DLL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467230)); pub const CO_E_MSI_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467229)); pub const CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467228)); pub const CO_E_SERVER_PAUSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467227)); pub const CO_E_SERVER_NOT_PAUSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467226)); pub const CO_E_CLASS_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467225)); pub const CO_E_CLRNOTAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467224)); pub const CO_E_ASYNC_WORK_REJECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467223)); pub const CO_E_SERVER_INIT_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467222)); pub const CO_E_NO_SECCTX_IN_ACTIVATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467221)); pub const CO_E_TRACKER_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467216)); pub const CO_E_THREADPOOL_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467215)); pub const CO_E_SXS_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467214)); pub const CO_E_MALFORMED_SPN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467213)); pub const CO_E_UNREVOKED_REGISTRATION_ON_APARTMENT_SHUTDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467212)); pub const CO_E_PREMATURE_STUB_RUNDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147467211)); pub const S_OK = @import("zig.zig").typedConst(HRESULT, @as(i32, 0)); pub const S_FALSE = @import("zig.zig").typedConst(HRESULT, @as(i32, 1)); pub const OLE_E_FIRST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221504)); pub const OLE_E_LAST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221249)); pub const OLE_S_FIRST = @import("zig.zig").typedConst(HRESULT, @as(i32, 262144)); pub const OLE_S_LAST = @import("zig.zig").typedConst(HRESULT, @as(i32, 262399)); pub const OLE_E_OLEVERB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221504)); pub const OLE_E_ADVF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221503)); pub const OLE_E_ENUM_NOMORE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221502)); pub const OLE_E_ADVISENOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221501)); pub const OLE_E_NOCONNECTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221500)); pub const OLE_E_NOTRUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221499)); pub const OLE_E_NOCACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221498)); pub const OLE_E_BLANK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221497)); pub const OLE_E_CLASSDIFF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221496)); pub const OLE_E_CANT_GETMONIKER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221495)); pub const OLE_E_CANT_BINDTOSOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221494)); pub const OLE_E_STATIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221493)); pub const OLE_E_PROMPTSAVECANCELLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221492)); pub const OLE_E_INVALIDRECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221491)); pub const OLE_E_WRONGCOMPOBJ = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221490)); pub const OLE_E_INVALIDHWND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221489)); pub const OLE_E_NOT_INPLACEACTIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221488)); pub const OLE_E_CANTCONVERT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221487)); pub const OLE_E_NOSTORAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221486)); pub const DV_E_FORMATETC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221404)); pub const DV_E_DVTARGETDEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221403)); pub const DV_E_STGMEDIUM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221402)); pub const DV_E_STATDATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221401)); pub const DV_E_LINDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221400)); pub const DV_E_TYMED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221399)); pub const DV_E_CLIPFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221398)); pub const DV_E_DVASPECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221397)); pub const DV_E_DVTARGETDEVICE_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221396)); pub const DV_E_NOIVIEWOBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221395)); pub const DRAGDROP_E_FIRST = @as(i32, -2147221248); pub const DRAGDROP_E_LAST = @as(i32, -2147221233); pub const DRAGDROP_S_FIRST = @as(i32, 262400); pub const DRAGDROP_S_LAST = @as(i32, 262415); pub const DRAGDROP_E_NOTREGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221248)); pub const DRAGDROP_E_ALREADYREGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221247)); pub const DRAGDROP_E_INVALIDHWND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221246)); pub const DRAGDROP_E_CONCURRENT_DRAG_ATTEMPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221245)); pub const CLASSFACTORY_E_FIRST = @as(i32, -2147221232); pub const CLASSFACTORY_E_LAST = @as(i32, -2147221217); pub const CLASSFACTORY_S_FIRST = @as(i32, 262416); pub const CLASSFACTORY_S_LAST = @as(i32, 262431); pub const CLASS_E_NOAGGREGATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221232)); pub const CLASS_E_CLASSNOTAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221231)); pub const CLASS_E_NOTLICENSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221230)); pub const MARSHAL_E_FIRST = @as(i32, -2147221216); pub const MARSHAL_E_LAST = @as(i32, -2147221201); pub const MARSHAL_S_FIRST = @as(i32, 262432); pub const MARSHAL_S_LAST = @as(i32, 262447); pub const DATA_E_FIRST = @as(i32, -2147221200); pub const DATA_E_LAST = @as(i32, -2147221185); pub const DATA_S_FIRST = @as(i32, 262448); pub const DATA_S_LAST = @as(i32, 262463); pub const VIEW_E_FIRST = @as(i32, -2147221184); pub const VIEW_E_LAST = @as(i32, -2147221169); pub const VIEW_S_FIRST = @as(i32, 262464); pub const VIEW_S_LAST = @as(i32, 262479); pub const VIEW_E_DRAW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221184)); pub const REGDB_E_FIRST = @as(i32, -2147221168); pub const REGDB_E_LAST = @as(i32, -2147221153); pub const REGDB_S_FIRST = @as(i32, 262480); pub const REGDB_S_LAST = @as(i32, 262495); pub const REGDB_E_READREGDB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221168)); pub const REGDB_E_WRITEREGDB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221167)); pub const REGDB_E_KEYMISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221166)); pub const REGDB_E_INVALIDVALUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221165)); pub const REGDB_E_CLASSNOTREG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221164)); pub const REGDB_E_IIDNOTREG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221163)); pub const REGDB_E_BADTHREADINGMODEL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221162)); pub const REGDB_E_PACKAGEPOLICYVIOLATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221161)); pub const CAT_E_FIRST = @as(i32, -2147221152); pub const CAT_E_LAST = @as(i32, -2147221151); pub const CAT_E_CATIDNOEXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221152)); pub const CAT_E_NODESCRIPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221151)); pub const CS_E_FIRST = @as(i32, -2147221148); pub const CS_E_LAST = @as(i32, -2147221137); pub const CS_E_PACKAGE_NOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221148)); pub const CS_E_NOT_DELETABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221147)); pub const CS_E_CLASS_NOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221146)); pub const CS_E_INVALID_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221145)); pub const CS_E_NO_CLASSSTORE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221144)); pub const CS_E_OBJECT_NOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221143)); pub const CS_E_OBJECT_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221142)); pub const CS_E_INVALID_PATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221141)); pub const CS_E_NETWORK_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221140)); pub const CS_E_ADMIN_LIMIT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221139)); pub const CS_E_SCHEMA_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221138)); pub const CS_E_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221137)); pub const CACHE_E_FIRST = @as(i32, -2147221136); pub const CACHE_E_LAST = @as(i32, -2147221121); pub const CACHE_S_FIRST = @as(i32, 262512); pub const CACHE_S_LAST = @as(i32, 262527); pub const CACHE_E_NOCACHE_UPDATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221136)); pub const OLEOBJ_E_FIRST = @as(i32, -2147221120); pub const OLEOBJ_E_LAST = @as(i32, -2147221105); pub const OLEOBJ_S_FIRST = @as(i32, 262528); pub const OLEOBJ_S_LAST = @as(i32, 262543); pub const OLEOBJ_E_NOVERBS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221120)); pub const OLEOBJ_E_INVALIDVERB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221119)); pub const CLIENTSITE_E_FIRST = @as(i32, -2147221104); pub const CLIENTSITE_E_LAST = @as(i32, -2147221089); pub const CLIENTSITE_S_FIRST = @as(i32, 262544); pub const CLIENTSITE_S_LAST = @as(i32, 262559); pub const INPLACE_E_NOTUNDOABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221088)); pub const INPLACE_E_NOTOOLSPACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221087)); pub const INPLACE_E_FIRST = @as(i32, -2147221088); pub const INPLACE_E_LAST = @as(i32, -2147221073); pub const INPLACE_S_FIRST = @as(i32, 262560); pub const INPLACE_S_LAST = @as(i32, 262575); pub const ENUM_E_FIRST = @as(i32, -2147221072); pub const ENUM_E_LAST = @as(i32, -2147221057); pub const ENUM_S_FIRST = @as(i32, 262576); pub const ENUM_S_LAST = @as(i32, 262591); pub const CONVERT10_E_FIRST = @as(i32, -2147221056); pub const CONVERT10_E_LAST = @as(i32, -2147221041); pub const CONVERT10_S_FIRST = @as(i32, 262592); pub const CONVERT10_S_LAST = @as(i32, 262607); pub const CONVERT10_E_OLESTREAM_GET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221056)); pub const CONVERT10_E_OLESTREAM_PUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221055)); pub const CONVERT10_E_OLESTREAM_FMT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221054)); pub const CONVERT10_E_OLESTREAM_BITMAP_TO_DIB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221053)); pub const CONVERT10_E_STG_FMT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221052)); pub const CONVERT10_E_STG_NO_STD_STREAM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221051)); pub const CONVERT10_E_STG_DIB_TO_BITMAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221050)); pub const CLIPBRD_E_FIRST = @as(i32, -2147221040); pub const CLIPBRD_E_LAST = @as(i32, -2147221025); pub const CLIPBRD_S_FIRST = @as(i32, 262608); pub const CLIPBRD_S_LAST = @as(i32, 262623); pub const CLIPBRD_E_CANT_OPEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221040)); pub const CLIPBRD_E_CANT_EMPTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221039)); pub const CLIPBRD_E_CANT_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221038)); pub const CLIPBRD_E_BAD_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221037)); pub const CLIPBRD_E_CANT_CLOSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221036)); pub const MK_E_FIRST = @as(i32, -2147221024); pub const MK_E_LAST = @as(i32, -2147221009); pub const MK_S_FIRST = @as(i32, 262624); pub const MK_S_LAST = @as(i32, 262639); pub const MK_E_CONNECTMANUALLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221024)); pub const MK_E_EXCEEDEDDEADLINE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221023)); pub const MK_E_NEEDGENERIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221022)); pub const MK_E_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221021)); pub const MK_E_SYNTAX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221020)); pub const MK_E_NOOBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221019)); pub const MK_E_INVALIDEXTENSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221018)); pub const MK_E_INTERMEDIATEINTERFACENOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221017)); pub const MK_E_NOTBINDABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221016)); pub const MK_E_NOTBOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221015)); pub const MK_E_CANTOPENFILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221014)); pub const MK_E_MUSTBOTHERUSER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221013)); pub const MK_E_NOINVERSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221012)); pub const MK_E_NOSTORAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221011)); pub const MK_E_NOPREFIX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221010)); pub const MK_E_ENUMERATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221009)); pub const CO_E_FIRST = @as(i32, -2147221008); pub const CO_E_LAST = @as(i32, -2147220993); pub const CO_S_FIRST = @as(i32, 262640); pub const CO_S_LAST = @as(i32, 262655); pub const CO_E_NOTINITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221008)); pub const CO_E_ALREADYINITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221007)); pub const CO_E_CANTDETERMINECLASS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221006)); pub const CO_E_CLASSSTRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221005)); pub const CO_E_IIDSTRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221004)); pub const CO_E_APPNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221003)); pub const CO_E_APPSINGLEUSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221002)); pub const CO_E_ERRORINAPP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221001)); pub const CO_E_DLLNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147221000)); pub const CO_E_ERRORINDLL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220999)); pub const CO_E_WRONGOSFORAPP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220998)); pub const CO_E_OBJNOTREG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220997)); pub const CO_E_OBJISREG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220996)); pub const CO_E_OBJNOTCONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220995)); pub const CO_E_APPDIDNTREG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220994)); pub const CO_E_RELEASED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220993)); pub const EVENT_E_FIRST = @as(i32, -2147220992); pub const EVENT_E_LAST = @as(i32, -2147220961); pub const EVENT_S_FIRST = @as(i32, 262656); pub const EVENT_S_LAST = @as(i32, 262687); pub const EVENT_S_SOME_SUBSCRIBERS_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, 262656)); pub const EVENT_E_ALL_SUBSCRIBERS_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220991)); pub const EVENT_S_NOSUBSCRIBERS = @import("zig.zig").typedConst(HRESULT, @as(i32, 262658)); pub const EVENT_E_QUERYSYNTAX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220989)); pub const EVENT_E_QUERYFIELD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220988)); pub const EVENT_E_INTERNALEXCEPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220987)); pub const EVENT_E_INTERNALERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220986)); pub const EVENT_E_INVALID_PER_USER_SID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220985)); pub const EVENT_E_USER_EXCEPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220984)); pub const EVENT_E_TOO_MANY_METHODS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220983)); pub const EVENT_E_MISSING_EVENTCLASS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220982)); pub const EVENT_E_NOT_ALL_REMOVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220981)); pub const EVENT_E_COMPLUS_NOT_INSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220980)); pub const EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220979)); pub const EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220978)); pub const EVENT_E_INVALID_EVENT_CLASS_PARTITION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220977)); pub const EVENT_E_PER_USER_SID_NOT_LOGGED_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220976)); pub const TPC_E_INVALID_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220927)); pub const TPC_E_NO_DEFAULT_TABLET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220974)); pub const TPC_E_UNKNOWN_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220965)); pub const TPC_E_INVALID_INPUT_RECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220967)); pub const TPC_E_INVALID_STROKE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220958)); pub const TPC_E_INITIALIZE_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220957)); pub const TPC_E_NOT_RELEVANT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220942)); pub const TPC_E_INVALID_PACKET_DESCRIPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220941)); pub const TPC_E_RECOGNIZER_NOT_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220939)); pub const TPC_E_INVALID_RIGHTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220938)); pub const TPC_E_OUT_OF_ORDER_CALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220937)); pub const TPC_E_QUEUE_FULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220936)); pub const TPC_E_INVALID_CONFIGURATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220935)); pub const TPC_E_INVALID_DATA_FROM_RECOGNIZER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147220934)); pub const TPC_S_TRUNCATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 262738)); pub const TPC_S_INTERRUPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, 262739)); pub const TPC_S_NO_DATA_TO_PROCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, 262740)); pub const XACT_E_FIRST = @as(u32, 2147799040); pub const XACT_E_LAST = @as(u32, 2147799083); pub const XACT_S_FIRST = @as(u32, 315392); pub const XACT_S_LAST = @as(u32, 315408); pub const XACT_E_ALREADYOTHERSINGLEPHASE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168256)); pub const XACT_E_CANTRETAIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168255)); pub const XACT_E_COMMITFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168254)); pub const XACT_E_COMMITPREVENTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168253)); pub const XACT_E_HEURISTICABORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168252)); pub const XACT_E_HEURISTICCOMMIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168251)); pub const XACT_E_HEURISTICDAMAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168250)); pub const XACT_E_HEURISTICDANGER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168249)); pub const XACT_E_ISOLATIONLEVEL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168248)); pub const XACT_E_NOASYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168247)); pub const XACT_E_NOENLIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168246)); pub const XACT_E_NOISORETAIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168245)); pub const XACT_E_NORESOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168244)); pub const XACT_E_NOTCURRENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168243)); pub const XACT_E_NOTRANSACTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168242)); pub const XACT_E_NOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168241)); pub const XACT_E_UNKNOWNRMGRID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168240)); pub const XACT_E_WRONGSTATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168239)); pub const XACT_E_WRONGUOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168238)); pub const XACT_E_XTIONEXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168237)); pub const XACT_E_NOIMPORTOBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168236)); pub const XACT_E_INVALIDCOOKIE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168235)); pub const XACT_E_INDOUBT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168234)); pub const XACT_E_NOTIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168233)); pub const XACT_E_ALREADYINPROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168232)); pub const XACT_E_ABORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168231)); pub const XACT_E_LOGFULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168230)); pub const XACT_E_TMNOTAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168229)); pub const XACT_E_CONNECTION_DOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168228)); pub const XACT_E_CONNECTION_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168227)); pub const XACT_E_REENLISTTIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168226)); pub const XACT_E_TIP_CONNECT_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168225)); pub const XACT_E_TIP_PROTOCOL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168224)); pub const XACT_E_TIP_PULL_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168223)); pub const XACT_E_DEST_TMNOTAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168222)); pub const XACT_E_TIP_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168221)); pub const XACT_E_NETWORK_TX_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168220)); pub const XACT_E_PARTNER_NETWORK_TX_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168219)); pub const XACT_E_XA_TX_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168218)); pub const XACT_E_UNABLE_TO_READ_DTC_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168217)); pub const XACT_E_UNABLE_TO_LOAD_DTC_PROXY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168216)); pub const XACT_E_ABORTING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168215)); pub const XACT_E_PUSH_COMM_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168214)); pub const XACT_E_PULL_COMM_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168213)); pub const XACT_E_LU_TX_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168212)); pub const XACT_E_CLERKNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168128)); pub const XACT_E_CLERKEXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168127)); pub const XACT_E_RECOVERYINPROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168126)); pub const XACT_E_TRANSACTIONCLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168125)); pub const XACT_E_INVALIDLSN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168124)); pub const XACT_E_REPLAYREQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147168123)); pub const XACT_S_ASYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, 315392)); pub const XACT_S_DEFECT = @import("zig.zig").typedConst(HRESULT, @as(i32, 315393)); pub const XACT_S_READONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, 315394)); pub const XACT_S_SOMENORETAIN = @import("zig.zig").typedConst(HRESULT, @as(i32, 315395)); pub const XACT_S_OKINFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, 315396)); pub const XACT_S_MADECHANGESCONTENT = @import("zig.zig").typedConst(HRESULT, @as(i32, 315397)); pub const XACT_S_MADECHANGESINFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, 315398)); pub const XACT_S_ALLNORETAIN = @import("zig.zig").typedConst(HRESULT, @as(i32, 315399)); pub const XACT_S_ABORTING = @import("zig.zig").typedConst(HRESULT, @as(i32, 315400)); pub const XACT_S_SINGLEPHASE = @import("zig.zig").typedConst(HRESULT, @as(i32, 315401)); pub const XACT_S_LOCALLY_OK = @import("zig.zig").typedConst(HRESULT, @as(i32, 315402)); pub const XACT_S_LASTRESOURCEMANAGER = @import("zig.zig").typedConst(HRESULT, @as(i32, 315408)); pub const CONTEXT_E_FIRST = @as(i32, -2147164160); pub const CONTEXT_E_LAST = @as(i32, -2147164113); pub const CONTEXT_S_FIRST = @as(i32, 319488); pub const CONTEXT_S_LAST = @as(i32, 319535); pub const CONTEXT_E_ABORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164158)); pub const CONTEXT_E_ABORTING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164157)); pub const CONTEXT_E_NOCONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164156)); pub const CONTEXT_E_WOULD_DEADLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164155)); pub const CONTEXT_E_SYNCH_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164154)); pub const CONTEXT_E_OLDREF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164153)); pub const CONTEXT_E_ROLENOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164148)); pub const CONTEXT_E_TMNOTAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164145)); pub const CO_E_ACTIVATIONFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164127)); pub const CO_E_ACTIVATIONFAILED_EVENTLOGGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164126)); pub const CO_E_ACTIVATIONFAILED_CATALOGERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164125)); pub const CO_E_ACTIVATIONFAILED_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164124)); pub const CO_E_INITIALIZATIONFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164123)); pub const CONTEXT_E_NOJIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164122)); pub const CONTEXT_E_NOTRANSACTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164121)); pub const CO_E_THREADINGMODEL_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164120)); pub const CO_E_NOIISINTRINSICS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164119)); pub const CO_E_NOCOOKIES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164118)); pub const CO_E_DBERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164117)); pub const CO_E_NOTPOOLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164116)); pub const CO_E_NOTCONSTRUCTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164115)); pub const CO_E_NOSYNCHRONIZATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164114)); pub const CO_E_ISOLEVELMISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164113)); pub const CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164112)); pub const CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147164111)); pub const OLE_S_USEREG = @import("zig.zig").typedConst(HRESULT, @as(i32, 262144)); pub const OLE_S_STATIC = @import("zig.zig").typedConst(HRESULT, @as(i32, 262145)); pub const OLE_S_MAC_CLIPFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, 262146)); pub const DRAGDROP_S_DROP = @import("zig.zig").typedConst(HRESULT, @as(i32, 262400)); pub const DRAGDROP_S_CANCEL = @import("zig.zig").typedConst(HRESULT, @as(i32, 262401)); pub const DRAGDROP_S_USEDEFAULTCURSORS = @import("zig.zig").typedConst(HRESULT, @as(i32, 262402)); pub const DATA_S_SAMEFORMATETC = @import("zig.zig").typedConst(HRESULT, @as(i32, 262448)); pub const VIEW_S_ALREADY_FROZEN = @import("zig.zig").typedConst(HRESULT, @as(i32, 262464)); pub const CACHE_S_FORMATETC_NOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, 262512)); pub const CACHE_S_SAMECACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, 262513)); pub const CACHE_S_SOMECACHES_NOTUPDATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 262514)); pub const OLEOBJ_S_INVALIDVERB = @import("zig.zig").typedConst(HRESULT, @as(i32, 262528)); pub const OLEOBJ_S_CANNOT_DOVERB_NOW = @import("zig.zig").typedConst(HRESULT, @as(i32, 262529)); pub const OLEOBJ_S_INVALIDHWND = @import("zig.zig").typedConst(HRESULT, @as(i32, 262530)); pub const INPLACE_S_TRUNCATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 262560)); pub const CONVERT10_S_NO_PRESENTATION = @import("zig.zig").typedConst(HRESULT, @as(i32, 262592)); pub const MK_S_REDUCED_TO_SELF = @import("zig.zig").typedConst(HRESULT, @as(i32, 262626)); pub const MK_S_ME = @import("zig.zig").typedConst(HRESULT, @as(i32, 262628)); pub const MK_S_HIM = @import("zig.zig").typedConst(HRESULT, @as(i32, 262629)); pub const MK_S_US = @import("zig.zig").typedConst(HRESULT, @as(i32, 262630)); pub const MK_S_MONIKERALREADYREGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, 262631)); pub const SCHED_S_TASK_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, 267008)); pub const SCHED_S_TASK_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, 267009)); pub const SCHED_S_TASK_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, 267010)); pub const SCHED_S_TASK_HAS_NOT_RUN = @import("zig.zig").typedConst(HRESULT, @as(i32, 267011)); pub const SCHED_S_TASK_NO_MORE_RUNS = @import("zig.zig").typedConst(HRESULT, @as(i32, 267012)); pub const SCHED_S_TASK_NOT_SCHEDULED = @import("zig.zig").typedConst(HRESULT, @as(i32, 267013)); pub const SCHED_S_TASK_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 267014)); pub const SCHED_S_TASK_NO_VALID_TRIGGERS = @import("zig.zig").typedConst(HRESULT, @as(i32, 267015)); pub const SCHED_S_EVENT_TRIGGER = @import("zig.zig").typedConst(HRESULT, @as(i32, 267016)); pub const SCHED_E_TRIGGER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216631)); pub const SCHED_E_TASK_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216630)); pub const SCHED_E_TASK_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216629)); pub const SCHED_E_SERVICE_NOT_INSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216628)); pub const SCHED_E_CANNOT_OPEN_TASK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216627)); pub const SCHED_E_INVALID_TASK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216626)); pub const SCHED_E_ACCOUNT_INFORMATION_NOT_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216625)); pub const SCHED_E_ACCOUNT_NAME_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216624)); pub const SCHED_E_ACCOUNT_DBASE_CORRUPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216623)); pub const SCHED_E_NO_SECURITY_SERVICES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216622)); pub const SCHED_E_UNKNOWN_OBJECT_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216621)); pub const SCHED_E_UNSUPPORTED_ACCOUNT_OPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216620)); pub const SCHED_E_SERVICE_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216619)); pub const SCHED_E_UNEXPECTEDNODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216618)); pub const SCHED_E_NAMESPACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216617)); pub const SCHED_E_INVALIDVALUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216616)); pub const SCHED_E_MISSINGNODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216615)); pub const SCHED_E_MALFORMEDXML = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216614)); pub const SCHED_S_SOME_TRIGGERS_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, 267035)); pub const SCHED_S_BATCH_LOGON_PROBLEM = @import("zig.zig").typedConst(HRESULT, @as(i32, 267036)); pub const SCHED_E_TOO_MANY_NODES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216611)); pub const SCHED_E_PAST_END_BOUNDARY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216610)); pub const SCHED_E_ALREADY_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216609)); pub const SCHED_E_USER_NOT_LOGGED_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216608)); pub const SCHED_E_INVALID_TASK_HASH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216607)); pub const SCHED_E_SERVICE_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216606)); pub const SCHED_E_SERVICE_TOO_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216605)); pub const SCHED_E_TASK_ATTEMPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216604)); pub const SCHED_S_TASK_QUEUED = @import("zig.zig").typedConst(HRESULT, @as(i32, 267045)); pub const SCHED_E_TASK_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216602)); pub const SCHED_E_TASK_NOT_V1_COMPAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216601)); pub const SCHED_E_START_ON_DEMAND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216600)); pub const SCHED_E_TASK_NOT_UBPM_COMPAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216599)); pub const SCHED_E_DEPRECATED_FEATURE_USED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147216592)); pub const CO_E_CLASS_CREATE_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959359)); pub const CO_E_SCM_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959358)); pub const CO_E_SCM_RPC_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959357)); pub const CO_E_BAD_PATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959356)); pub const CO_E_SERVER_EXEC_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959355)); pub const CO_E_OBJSRV_RPC_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959354)); pub const MK_E_NO_NORMALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959353)); pub const CO_E_SERVER_STOPPING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959352)); pub const MEM_E_INVALID_ROOT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959351)); pub const MEM_E_INVALID_LINK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959344)); pub const MEM_E_INVALID_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959343)); pub const CO_S_NOTALLINTERFACES = @import("zig.zig").typedConst(HRESULT, @as(i32, 524306)); pub const CO_S_MACHINENAMENOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, 524307)); pub const CO_E_MISSING_DISPLAYNAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959339)); pub const CO_E_RUNAS_VALUE_MUST_BE_AAA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959338)); pub const CO_E_ELEVATION_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146959337)); pub const APPX_E_PACKAGING_INTERNAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958848)); pub const APPX_E_INTERLEAVING_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958847)); pub const APPX_E_RELATIONSHIPS_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958846)); pub const APPX_E_MISSING_REQUIRED_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958845)); pub const APPX_E_INVALID_MANIFEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958844)); pub const APPX_E_INVALID_BLOCKMAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958843)); pub const APPX_E_CORRUPT_CONTENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958842)); pub const APPX_E_BLOCK_HASH_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958841)); pub const APPX_E_REQUESTED_RANGE_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958840)); pub const APPX_E_INVALID_SIP_CLIENT_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958839)); pub const APPX_E_INVALID_KEY_INFO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958838)); pub const APPX_E_INVALID_CONTENTGROUPMAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958837)); pub const APPX_E_INVALID_APPINSTALLER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958836)); pub const APPX_E_DELTA_BASELINE_VERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958835)); pub const APPX_E_DELTA_PACKAGE_MISSING_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958834)); pub const APPX_E_INVALID_DELTA_PACKAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958833)); pub const APPX_E_DELTA_APPENDED_PACKAGE_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958832)); pub const APPX_E_INVALID_PACKAGING_LAYOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958831)); pub const APPX_E_INVALID_PACKAGESIGNCONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958830)); pub const APPX_E_RESOURCESPRI_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958829)); pub const APPX_E_FILE_COMPRESSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958828)); pub const APPX_E_INVALID_PAYLOAD_PACKAGE_EXTENSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958827)); pub const APPX_E_INVALID_ENCRYPTION_EXCLUSION_FILE_LIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958826)); pub const BT_E_SPURIOUS_ACTIVATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146958592)); pub const DISP_E_UNKNOWNINTERFACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352575)); pub const DISP_E_MEMBERNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352573)); pub const DISP_E_PARAMNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352572)); pub const DISP_E_TYPEMISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352571)); pub const DISP_E_UNKNOWNNAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352570)); pub const DISP_E_NONAMEDARGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352569)); pub const DISP_E_BADVARTYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352568)); pub const DISP_E_EXCEPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352567)); pub const DISP_E_OVERFLOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352566)); pub const DISP_E_BADINDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352565)); pub const DISP_E_UNKNOWNLCID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352564)); pub const DISP_E_ARRAYISLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352563)); pub const DISP_E_BADPARAMCOUNT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352562)); pub const DISP_E_PARAMNOTOPTIONAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352561)); pub const DISP_E_BADCALLEE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352560)); pub const DISP_E_NOTACOLLECTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352559)); pub const DISP_E_DIVBYZERO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352558)); pub const DISP_E_BUFFERTOOSMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352557)); pub const TYPE_E_BUFFERTOOSMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319786)); pub const TYPE_E_FIELDNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319785)); pub const TYPE_E_INVDATAREAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319784)); pub const TYPE_E_UNSUPFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319783)); pub const TYPE_E_REGISTRYACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319780)); pub const TYPE_E_LIBNOTREGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319779)); pub const TYPE_E_UNDEFINEDTYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319769)); pub const TYPE_E_QUALIFIEDNAMEDISALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319768)); pub const TYPE_E_INVALIDSTATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319767)); pub const TYPE_E_WRONGTYPEKIND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319766)); pub const TYPE_E_ELEMENTNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319765)); pub const TYPE_E_AMBIGUOUSNAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319764)); pub const TYPE_E_NAMECONFLICT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319763)); pub const TYPE_E_UNKNOWNLCID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319762)); pub const TYPE_E_DLLFUNCTIONNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147319761)); pub const TYPE_E_BADMODULEKIND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147317571)); pub const TYPE_E_SIZETOOBIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147317563)); pub const TYPE_E_DUPLICATEID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147317562)); pub const TYPE_E_INVALIDID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147317553)); pub const TYPE_E_TYPEMISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147316576)); pub const TYPE_E_OUTOFBOUNDS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147316575)); pub const TYPE_E_IOERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147316574)); pub const TYPE_E_CANTCREATETMPFILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147316573)); pub const TYPE_E_CANTLOADLIBRARY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147312566)); pub const TYPE_E_INCONSISTENTPROPFUNCS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147312509)); pub const TYPE_E_CIRCULARTYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147312508)); pub const STG_E_INVALIDFUNCTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287039)); pub const STG_E_FILENOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287038)); pub const STG_E_PATHNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287037)); pub const STG_E_TOOMANYOPENFILES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287036)); pub const STG_E_ACCESSDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287035)); pub const STG_E_INVALIDHANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287034)); pub const STG_E_INSUFFICIENTMEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287032)); pub const STG_E_INVALIDPOINTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287031)); pub const STG_E_NOMOREFILES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287022)); pub const STG_E_DISKISWRITEPROTECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287021)); pub const STG_E_SEEKERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287015)); pub const STG_E_WRITEFAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287011)); pub const STG_E_READFAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287010)); pub const STG_E_SHAREVIOLATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287008)); pub const STG_E_LOCKVIOLATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147287007)); pub const STG_E_FILEALREADYEXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286960)); pub const STG_E_INVALIDPARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286953)); pub const STG_E_MEDIUMFULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286928)); pub const STG_E_PROPSETMISMATCHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286800)); pub const STG_E_ABNORMALAPIEXIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286790)); pub const STG_E_INVALIDHEADER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286789)); pub const STG_E_INVALIDNAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286788)); pub const STG_E_UNKNOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286787)); pub const STG_E_UNIMPLEMENTEDFUNCTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286786)); pub const STG_E_INVALIDFLAG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286785)); pub const STG_E_INUSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286784)); pub const STG_E_NOTCURRENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286783)); pub const STG_E_REVERTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286782)); pub const STG_E_CANTSAVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286781)); pub const STG_E_OLDFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286780)); pub const STG_E_OLDDLL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286779)); pub const STG_E_SHAREREQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286778)); pub const STG_E_NOTFILEBASEDSTORAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286777)); pub const STG_E_EXTANTMARSHALLINGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286776)); pub const STG_E_DOCFILECORRUPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286775)); pub const STG_E_BADBASEADDRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286768)); pub const STG_E_DOCFILETOOLARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286767)); pub const STG_E_NOTSIMPLEFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286766)); pub const STG_E_INCOMPLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286527)); pub const STG_E_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286526)); pub const STG_S_CONVERTED = @import("zig.zig").typedConst(HRESULT, @as(i32, 197120)); pub const STG_S_BLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, 197121)); pub const STG_S_RETRYNOW = @import("zig.zig").typedConst(HRESULT, @as(i32, 197122)); pub const STG_S_MONITORING = @import("zig.zig").typedConst(HRESULT, @as(i32, 197123)); pub const STG_S_MULTIPLEOPENS = @import("zig.zig").typedConst(HRESULT, @as(i32, 197124)); pub const STG_S_CONSOLIDATIONFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, 197125)); pub const STG_S_CANNOTCONSOLIDATE = @import("zig.zig").typedConst(HRESULT, @as(i32, 197126)); pub const STG_S_POWER_CYCLE_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, 197127)); pub const STG_E_FIRMWARE_SLOT_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286520)); pub const STG_E_FIRMWARE_IMAGE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286519)); pub const STG_E_DEVICE_UNRESPONSIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286518)); pub const STG_E_STATUS_COPY_PROTECTION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286267)); pub const STG_E_CSS_AUTHENTICATION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286266)); pub const STG_E_CSS_KEY_NOT_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286265)); pub const STG_E_CSS_KEY_NOT_ESTABLISHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286264)); pub const STG_E_CSS_SCRAMBLED_SECTOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286263)); pub const STG_E_CSS_REGION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286262)); pub const STG_E_RESETS_EXHAUSTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147286261)); pub const RPC_E_CALL_REJECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418111)); pub const RPC_E_CALL_CANCELED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418110)); pub const RPC_E_CANTPOST_INSENDCALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418109)); pub const RPC_E_CANTCALLOUT_INASYNCCALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418108)); pub const RPC_E_CANTCALLOUT_INEXTERNALCALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418107)); pub const RPC_E_CONNECTION_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418106)); pub const RPC_E_SERVER_DIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418105)); pub const RPC_E_CLIENT_DIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418104)); pub const RPC_E_INVALID_DATAPACKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418103)); pub const RPC_E_CANTTRANSMIT_CALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418102)); pub const RPC_E_CLIENT_CANTMARSHAL_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418101)); pub const RPC_E_CLIENT_CANTUNMARSHAL_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418100)); pub const RPC_E_SERVER_CANTMARSHAL_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418099)); pub const RPC_E_SERVER_CANTUNMARSHAL_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418098)); pub const RPC_E_INVALID_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418097)); pub const RPC_E_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418096)); pub const RPC_E_CANTCALLOUT_AGAIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418095)); pub const RPC_E_SERVER_DIED_DNE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147418094)); pub const RPC_E_SYS_CALL_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417856)); pub const RPC_E_OUT_OF_RESOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417855)); pub const RPC_E_ATTEMPTED_MULTITHREAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417854)); pub const RPC_E_NOT_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417853)); pub const RPC_E_FAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417852)); pub const RPC_E_SERVERFAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417851)); pub const RPC_E_CHANGED_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417850)); pub const RPC_E_INVALIDMETHOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417849)); pub const RPC_E_DISCONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417848)); pub const RPC_E_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417847)); pub const RPC_E_SERVERCALL_RETRYLATER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417846)); pub const RPC_E_SERVERCALL_REJECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417845)); pub const RPC_E_INVALID_CALLDATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417844)); pub const RPC_E_CANTCALLOUT_ININPUTSYNCCALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417843)); pub const RPC_E_WRONG_THREAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417842)); pub const RPC_E_THREAD_NOT_INIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417841)); pub const RPC_E_VERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417840)); pub const RPC_E_INVALID_HEADER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417839)); pub const RPC_E_INVALID_EXTENSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417838)); pub const RPC_E_INVALID_IPID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417837)); pub const RPC_E_INVALID_OBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417836)); pub const RPC_S_CALLPENDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417835)); pub const RPC_S_WAITONTIMER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417834)); pub const RPC_E_CALL_COMPLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417833)); pub const RPC_E_UNSECURE_CALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417832)); pub const RPC_E_TOO_LATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417831)); pub const RPC_E_NO_GOOD_SECURITY_PACKAGES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417830)); pub const RPC_E_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417829)); pub const RPC_E_REMOTE_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417828)); pub const RPC_E_INVALID_OBJREF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417827)); pub const RPC_E_NO_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417826)); pub const RPC_E_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417825)); pub const RPC_E_NO_SYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417824)); pub const RPC_E_FULLSIC_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417823)); pub const RPC_E_INVALID_STD_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417822)); pub const CO_E_FAILEDTOIMPERSONATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417821)); pub const CO_E_FAILEDTOGETSECCTX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417820)); pub const CO_E_FAILEDTOOPENTHREADTOKEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417819)); pub const CO_E_FAILEDTOGETTOKENINFO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417818)); pub const CO_E_TRUSTEEDOESNTMATCHCLIENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417817)); pub const CO_E_FAILEDTOQUERYCLIENTBLANKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417816)); pub const CO_E_FAILEDTOSETDACL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417815)); pub const CO_E_ACCESSCHECKFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417814)); pub const CO_E_NETACCESSAPIFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417813)); pub const CO_E_WRONGTRUSTEENAMESYNTAX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417812)); pub const CO_E_INVALIDSID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417811)); pub const CO_E_CONVERSIONFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417810)); pub const CO_E_NOMATCHINGSIDFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417809)); pub const CO_E_LOOKUPACCSIDFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417808)); pub const CO_E_NOMATCHINGNAMEFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417807)); pub const CO_E_LOOKUPACCNAMEFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417806)); pub const CO_E_SETSERLHNDLFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417805)); pub const CO_E_FAILEDTOGETWINDIR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417804)); pub const CO_E_PATHTOOLONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417803)); pub const CO_E_FAILEDTOGENUUID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417802)); pub const CO_E_FAILEDTOCREATEFILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417801)); pub const CO_E_FAILEDTOCLOSEHANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417800)); pub const CO_E_EXCEEDSYSACLLIMIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417799)); pub const CO_E_ACESINWRONGORDER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417798)); pub const CO_E_INCOMPATIBLESTREAMVERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417797)); pub const CO_E_FAILEDTOOPENPROCESSTOKEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417796)); pub const CO_E_DECODEFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417795)); pub const CO_E_ACNOTINITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417793)); pub const CO_E_CANCEL_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147417792)); pub const RPC_E_UNEXPECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147352577)); pub const ERROR_AUDITING_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1073151999)); pub const ERROR_ALL_SIDS_FILTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1073151998)); pub const ERROR_BIZRULES_NOT_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1073151997)); pub const NTE_BAD_UID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893823)); pub const NTE_BAD_HASH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893822)); pub const NTE_BAD_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893821)); pub const NTE_BAD_LEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893820)); pub const NTE_BAD_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893819)); pub const NTE_BAD_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893818)); pub const NTE_BAD_VER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893817)); pub const NTE_BAD_ALGID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893816)); pub const NTE_BAD_FLAGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893815)); pub const NTE_BAD_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893814)); pub const NTE_BAD_KEY_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893813)); pub const NTE_BAD_HASH_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893812)); pub const NTE_NO_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893811)); pub const NTE_NO_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893810)); pub const NTE_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893809)); pub const NTE_PERM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893808)); pub const NTE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893807)); pub const NTE_DOUBLE_ENCRYPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893806)); pub const NTE_BAD_PROVIDER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893805)); pub const NTE_BAD_PROV_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893804)); pub const NTE_BAD_PUBLIC_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893803)); pub const NTE_BAD_KEYSET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893802)); pub const NTE_PROV_TYPE_NOT_DEF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893801)); pub const NTE_PROV_TYPE_ENTRY_BAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893800)); pub const NTE_KEYSET_NOT_DEF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893799)); pub const NTE_KEYSET_ENTRY_BAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893798)); pub const NTE_PROV_TYPE_NO_MATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893797)); pub const NTE_SIGNATURE_FILE_BAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893796)); pub const NTE_PROVIDER_DLL_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893795)); pub const NTE_PROV_DLL_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893794)); pub const NTE_BAD_KEYSET_PARAM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893793)); pub const NTE_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893792)); pub const NTE_SYS_ERR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893791)); pub const NTE_SILENT_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893790)); pub const NTE_TOKEN_KEYSET_STORAGE_FULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893789)); pub const NTE_TEMPORARY_PROFILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893788)); pub const NTE_FIXEDPARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893787)); pub const NTE_INVALID_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893786)); pub const NTE_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893785)); pub const NTE_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893784)); pub const NTE_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893783)); pub const NTE_NO_MORE_ITEMS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893782)); pub const NTE_BUFFERS_OVERLAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893781)); pub const NTE_DECRYPTION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893780)); pub const NTE_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893779)); pub const NTE_UI_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893778)); pub const NTE_HMAC_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893777)); pub const NTE_DEVICE_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893776)); pub const NTE_AUTHENTICATION_IGNORED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893775)); pub const NTE_VALIDATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893774)); pub const NTE_INCORRECT_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893773)); pub const NTE_ENCRYPTION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893772)); pub const NTE_DEVICE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893771)); pub const NTE_USER_CANCELLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893770)); pub const NTE_PASSWORD_CHANGE_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893769)); pub const NTE_NOT_ACTIVE_CONSOLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893768)); pub const SEC_E_INSUFFICIENT_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893056)); pub const SEC_E_INVALID_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893055)); pub const SEC_E_UNSUPPORTED_FUNCTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893054)); pub const SEC_E_TARGET_UNKNOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893053)); pub const SEC_E_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893052)); pub const SEC_E_SECPKG_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893051)); pub const SEC_E_NOT_OWNER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893050)); pub const SEC_E_CANNOT_INSTALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893049)); pub const SEC_E_INVALID_TOKEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893048)); pub const SEC_E_CANNOT_PACK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893047)); pub const SEC_E_QOP_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893046)); pub const SEC_E_NO_IMPERSONATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893045)); pub const SEC_E_LOGON_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893044)); pub const SEC_E_UNKNOWN_CREDENTIALS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893043)); pub const SEC_E_NO_CREDENTIALS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893042)); pub const SEC_E_MESSAGE_ALTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893041)); pub const SEC_E_OUT_OF_SEQUENCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893040)); pub const SEC_E_NO_AUTHENTICATING_AUTHORITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893039)); pub const SEC_I_CONTINUE_NEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, 590610)); pub const SEC_I_COMPLETE_NEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, 590611)); pub const SEC_I_COMPLETE_AND_CONTINUE = @import("zig.zig").typedConst(HRESULT, @as(i32, 590612)); pub const SEC_I_LOCAL_LOGON = @import("zig.zig").typedConst(HRESULT, @as(i32, 590613)); pub const SEC_I_GENERIC_EXTENSION_RECEIVED = @import("zig.zig").typedConst(HRESULT, @as(i32, 590614)); pub const SEC_E_BAD_PKGID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893034)); pub const SEC_E_CONTEXT_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893033)); pub const SEC_I_CONTEXT_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, 590615)); pub const SEC_E_INCOMPLETE_MESSAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893032)); pub const SEC_E_INCOMPLETE_CREDENTIALS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893024)); pub const SEC_E_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893023)); pub const SEC_I_INCOMPLETE_CREDENTIALS = @import("zig.zig").typedConst(HRESULT, @as(i32, 590624)); pub const SEC_I_RENEGOTIATE = @import("zig.zig").typedConst(HRESULT, @as(i32, 590625)); pub const SEC_E_WRONG_PRINCIPAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893022)); pub const SEC_I_NO_LSA_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, 590627)); pub const SEC_E_TIME_SKEW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893020)); pub const SEC_E_UNTRUSTED_ROOT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893019)); pub const SEC_E_ILLEGAL_MESSAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893018)); pub const SEC_E_CERT_UNKNOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893017)); pub const SEC_E_CERT_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893016)); pub const SEC_E_ENCRYPT_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893015)); pub const SEC_E_DECRYPT_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893008)); pub const SEC_E_ALGORITHM_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893007)); pub const SEC_E_SECURITY_QOS_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893006)); pub const SEC_E_UNFINISHED_CONTEXT_DELETED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893005)); pub const SEC_E_NO_TGT_REPLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893004)); pub const SEC_E_NO_IP_ADDRESSES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893003)); pub const SEC_E_WRONG_CREDENTIAL_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893002)); pub const SEC_E_CRYPTO_SYSTEM_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893001)); pub const SEC_E_MAX_REFERRALS_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146893000)); pub const SEC_E_MUST_BE_KDC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892999)); pub const SEC_E_STRONG_CRYPTO_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892998)); pub const SEC_E_TOO_MANY_PRINCIPALS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892997)); pub const SEC_E_NO_PA_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892996)); pub const SEC_E_PKINIT_NAME_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892995)); pub const SEC_E_SMARTCARD_LOGON_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892994)); pub const SEC_E_SHUTDOWN_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892993)); pub const SEC_E_KDC_INVALID_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892992)); pub const SEC_E_KDC_UNABLE_TO_REFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892991)); pub const SEC_E_KDC_UNKNOWN_ETYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892990)); pub const SEC_E_UNSUPPORTED_PREAUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892989)); pub const SEC_E_DELEGATION_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892987)); pub const SEC_E_BAD_BINDINGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892986)); pub const SEC_E_MULTIPLE_ACCOUNTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892985)); pub const SEC_E_NO_KERB_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892984)); pub const SEC_E_CERT_WRONG_USAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892983)); pub const SEC_E_DOWNGRADE_DETECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892976)); pub const SEC_E_SMARTCARD_CERT_REVOKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892975)); pub const SEC_E_ISSUING_CA_UNTRUSTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892974)); pub const SEC_E_REVOCATION_OFFLINE_C = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892973)); pub const SEC_E_PKINIT_CLIENT_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892972)); pub const SEC_E_SMARTCARD_CERT_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892971)); pub const SEC_E_NO_S4U_PROT_SUPPORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892970)); pub const SEC_E_CROSSREALM_DELEGATION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892969)); pub const SEC_E_REVOCATION_OFFLINE_KDC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892968)); pub const SEC_E_ISSUING_CA_UNTRUSTED_KDC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892967)); pub const SEC_E_KDC_CERT_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892966)); pub const SEC_E_KDC_CERT_REVOKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892965)); pub const SEC_I_SIGNATURE_NEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, 590684)); pub const SEC_E_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892963)); pub const SEC_E_DELEGATION_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892962)); pub const SEC_E_POLICY_NLTM_ONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892961)); pub const SEC_I_NO_RENEGOTIATION = @import("zig.zig").typedConst(HRESULT, @as(i32, 590688)); pub const SEC_E_NO_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892959)); pub const SEC_E_PKU2U_CERT_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892958)); pub const SEC_E_MUTUAL_AUTH_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892957)); pub const SEC_I_MESSAGE_FRAGMENT = @import("zig.zig").typedConst(HRESULT, @as(i32, 590692)); pub const SEC_E_ONLY_HTTPS_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892955)); pub const SEC_I_CONTINUE_NEEDED_MESSAGE_OK = @import("zig.zig").typedConst(HRESULT, @as(i32, 590694)); pub const SEC_E_APPLICATION_PROTOCOL_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892953)); pub const SEC_I_ASYNC_CALL_PENDING = @import("zig.zig").typedConst(HRESULT, @as(i32, 590696)); pub const SEC_E_INVALID_UPN_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892951)); pub const SEC_E_EXT_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892950)); pub const SEC_E_INSUFFICIENT_BUFFERS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146892949)); pub const CRYPT_E_MSG_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889727)); pub const CRYPT_E_UNKNOWN_ALGO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889726)); pub const CRYPT_E_OID_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889725)); pub const CRYPT_E_INVALID_MSG_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889724)); pub const CRYPT_E_UNEXPECTED_ENCODING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889723)); pub const CRYPT_E_AUTH_ATTR_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889722)); pub const CRYPT_E_HASH_VALUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889721)); pub const CRYPT_E_INVALID_INDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889720)); pub const CRYPT_E_ALREADY_DECRYPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889719)); pub const CRYPT_E_NOT_DECRYPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889718)); pub const CRYPT_E_RECIPIENT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889717)); pub const CRYPT_E_CONTROL_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889716)); pub const CRYPT_E_ISSUER_SERIALNUMBER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889715)); pub const CRYPT_E_SIGNER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889714)); pub const CRYPT_E_ATTRIBUTES_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889713)); pub const CRYPT_E_STREAM_MSG_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889712)); pub const CRYPT_E_STREAM_INSUFFICIENT_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146889711)); pub const CRYPT_I_NEW_PROTECTION_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, 593938)); pub const CRYPT_E_BAD_LEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885631)); pub const CRYPT_E_BAD_ENCODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885630)); pub const CRYPT_E_FILE_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885629)); pub const CRYPT_E_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885628)); pub const CRYPT_E_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885627)); pub const CRYPT_E_NO_PROVIDER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885626)); pub const CRYPT_E_SELF_SIGNED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885625)); pub const CRYPT_E_DELETED_PREV = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885624)); pub const CRYPT_E_NO_MATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885623)); pub const CRYPT_E_UNEXPECTED_MSG_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885622)); pub const CRYPT_E_NO_KEY_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885621)); pub const CRYPT_E_NO_DECRYPT_CERT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885620)); pub const CRYPT_E_BAD_MSG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885619)); pub const CRYPT_E_NO_SIGNER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885618)); pub const CRYPT_E_PENDING_CLOSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885617)); pub const CRYPT_E_REVOKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885616)); pub const CRYPT_E_NO_REVOCATION_DLL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885615)); pub const CRYPT_E_NO_REVOCATION_CHECK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885614)); pub const CRYPT_E_REVOCATION_OFFLINE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885613)); pub const CRYPT_E_NOT_IN_REVOCATION_DATABASE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885612)); pub const CRYPT_E_INVALID_NUMERIC_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885600)); pub const CRYPT_E_INVALID_PRINTABLE_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885599)); pub const CRYPT_E_INVALID_IA5_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885598)); pub const CRYPT_E_INVALID_X500_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885597)); pub const CRYPT_E_NOT_CHAR_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885596)); pub const CRYPT_E_FILERESIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885595)); pub const CRYPT_E_SECURITY_SETTINGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885594)); pub const CRYPT_E_NO_VERIFY_USAGE_DLL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885593)); pub const CRYPT_E_NO_VERIFY_USAGE_CHECK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885592)); pub const CRYPT_E_VERIFY_USAGE_OFFLINE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885591)); pub const CRYPT_E_NOT_IN_CTL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885590)); pub const CRYPT_E_NO_TRUSTED_SIGNER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885589)); pub const CRYPT_E_MISSING_PUBKEY_PARA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885588)); pub const CRYPT_E_OBJECT_LOCATOR_OBJECT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146885587)); pub const CRYPT_E_OSS_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881536)); pub const OSS_MORE_BUF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881535)); pub const OSS_NEGATIVE_UINTEGER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881534)); pub const OSS_PDU_RANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881533)); pub const OSS_MORE_INPUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881532)); pub const OSS_DATA_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881531)); pub const OSS_BAD_ARG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881530)); pub const OSS_BAD_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881529)); pub const OSS_OUT_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881528)); pub const OSS_PDU_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881527)); pub const OSS_LIMITED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881526)); pub const OSS_BAD_PTR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881525)); pub const OSS_BAD_TIME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881524)); pub const OSS_INDEFINITE_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881523)); pub const OSS_MEM_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881522)); pub const OSS_BAD_TABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881521)); pub const OSS_TOO_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881520)); pub const OSS_CONSTRAINT_VIOLATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881519)); pub const OSS_FATAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881518)); pub const OSS_ACCESS_SERIALIZATION_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881517)); pub const OSS_NULL_TBL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881516)); pub const OSS_NULL_FCN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881515)); pub const OSS_BAD_ENCRULES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881514)); pub const OSS_UNAVAIL_ENCRULES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881513)); pub const OSS_CANT_OPEN_TRACE_WINDOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881512)); pub const OSS_UNIMPLEMENTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881511)); pub const OSS_OID_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881510)); pub const OSS_CANT_OPEN_TRACE_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881509)); pub const OSS_TRACE_FILE_ALREADY_OPEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881508)); pub const OSS_TABLE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881507)); pub const OSS_TYPE_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881506)); pub const OSS_REAL_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881505)); pub const OSS_REAL_CODE_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881504)); pub const OSS_OUT_OF_RANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881503)); pub const OSS_COPIER_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881502)); pub const OSS_CONSTRAINT_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881501)); pub const OSS_COMPARATOR_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881500)); pub const OSS_COMPARATOR_CODE_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881499)); pub const OSS_MEM_MGR_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881498)); pub const OSS_PDV_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881497)); pub const OSS_PDV_CODE_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881496)); pub const OSS_API_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881495)); pub const OSS_BERDER_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881494)); pub const OSS_PER_DLL_NOT_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881493)); pub const OSS_OPEN_TYPE_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881492)); pub const OSS_MUTEX_NOT_CREATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881491)); pub const OSS_CANT_CLOSE_TRACE_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881490)); pub const CRYPT_E_ASN1_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881280)); pub const CRYPT_E_ASN1_INTERNAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881279)); pub const CRYPT_E_ASN1_EOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881278)); pub const CRYPT_E_ASN1_CORRUPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881277)); pub const CRYPT_E_ASN1_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881276)); pub const CRYPT_E_ASN1_CONSTRAINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881275)); pub const CRYPT_E_ASN1_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881274)); pub const CRYPT_E_ASN1_OVERFLOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881273)); pub const CRYPT_E_ASN1_BADPDU = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881272)); pub const CRYPT_E_ASN1_BADARGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881271)); pub const CRYPT_E_ASN1_BADREAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881270)); pub const CRYPT_E_ASN1_BADTAG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881269)); pub const CRYPT_E_ASN1_CHOICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881268)); pub const CRYPT_E_ASN1_RULE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881267)); pub const CRYPT_E_ASN1_UTF8 = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881266)); pub const CRYPT_E_ASN1_PDU_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881229)); pub const CRYPT_E_ASN1_NYI = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881228)); pub const CRYPT_E_ASN1_EXTENDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881023)); pub const CRYPT_E_ASN1_NOEOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146881022)); pub const CERTSRV_E_BAD_REQUESTSUBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877439)); pub const CERTSRV_E_NO_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877438)); pub const CERTSRV_E_BAD_REQUESTSTATUS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877437)); pub const CERTSRV_E_PROPERTY_EMPTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877436)); pub const CERTSRV_E_INVALID_CA_CERTIFICATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877435)); pub const CERTSRV_E_SERVER_SUSPENDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877434)); pub const CERTSRV_E_ENCODING_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877433)); pub const CERTSRV_E_ROLECONFLICT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877432)); pub const CERTSRV_E_RESTRICTEDOFFICER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877431)); pub const CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877430)); pub const CERTSRV_E_NO_VALID_KRA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877429)); pub const CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877428)); pub const CERTSRV_E_NO_CAADMIN_DEFINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877427)); pub const CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877426)); pub const CERTSRV_E_NO_DB_SESSIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877425)); pub const CERTSRV_E_ALIGNMENT_FAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877424)); pub const CERTSRV_E_ENROLL_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877423)); pub const CERTSRV_E_TEMPLATE_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877422)); pub const CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877421)); pub const CERTSRV_E_ADMIN_DENIED_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877420)); pub const CERTSRV_E_NO_POLICY_SERVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877419)); pub const CERTSRV_E_WEAK_SIGNATURE_OR_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877418)); pub const CERTSRV_E_KEY_ATTESTATION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877417)); pub const CERTSRV_E_ENCRYPTION_CERT_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146877416)); pub const CERTSRV_E_UNSUPPORTED_CERT_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875392)); pub const CERTSRV_E_NO_CERT_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875391)); pub const CERTSRV_E_TEMPLATE_CONFLICT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875390)); pub const CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875389)); pub const CERTSRV_E_ARCHIVED_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875388)); pub const CERTSRV_E_SMIME_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875387)); pub const CERTSRV_E_BAD_RENEWAL_SUBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875386)); pub const CERTSRV_E_BAD_TEMPLATE_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875385)); pub const CERTSRV_E_TEMPLATE_POLICY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875384)); pub const CERTSRV_E_SIGNATURE_POLICY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875383)); pub const CERTSRV_E_SIGNATURE_COUNT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875382)); pub const CERTSRV_E_SIGNATURE_REJECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875381)); pub const CERTSRV_E_ISSUANCE_POLICY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875380)); pub const CERTSRV_E_SUBJECT_UPN_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875379)); pub const CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875378)); pub const CERTSRV_E_SUBJECT_DNS_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875377)); pub const CERTSRV_E_ARCHIVED_KEY_UNEXPECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875376)); pub const CERTSRV_E_KEY_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875375)); pub const CERTSRV_E_SUBJECT_EMAIL_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875374)); pub const CERTSRV_E_UNKNOWN_CERT_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875373)); pub const CERTSRV_E_CERT_TYPE_OVERLAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875372)); pub const CERTSRV_E_TOO_MANY_SIGNATURES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875371)); pub const CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875370)); pub const CERTSRV_E_INVALID_EK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875369)); pub const CERTSRV_E_INVALID_IDBINDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875368)); pub const CERTSRV_E_INVALID_ATTESTATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875367)); pub const CERTSRV_E_KEY_ATTESTATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875366)); pub const CERTSRV_E_CORRUPT_KEY_ATTESTATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875365)); pub const CERTSRV_E_EXPIRED_CHALLENGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875364)); pub const CERTSRV_E_INVALID_RESPONSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875363)); pub const CERTSRV_E_INVALID_REQUESTID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875362)); pub const CERTSRV_E_REQUEST_PRECERTIFICATE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875361)); pub const CERTSRV_E_PENDING_CLIENT_RESPONSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146875360)); pub const XENROLL_E_KEY_NOT_EXPORTABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146873344)); pub const XENROLL_E_CANNOT_ADD_ROOT_CERT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146873343)); pub const XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146873342)); pub const XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146873341)); pub const XENROLL_E_RESPONSE_KA_HASH_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146873340)); pub const XENROLL_E_KEYSPEC_SMIME_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146873339)); pub const TRUST_E_SYSTEM_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869247)); pub const TRUST_E_NO_SIGNER_CERT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869246)); pub const TRUST_E_COUNTER_SIGNER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869245)); pub const TRUST_E_CERT_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869244)); pub const TRUST_E_TIME_STAMP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869243)); pub const TRUST_E_BAD_DIGEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869232)); pub const TRUST_E_MALFORMED_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869231)); pub const TRUST_E_BASIC_CONSTRAINTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869223)); pub const TRUST_E_FINANCIAL_CRITERIA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146869218)); pub const MSSIPOTF_E_OUTOFMEMRANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865151)); pub const MSSIPOTF_E_CANTGETOBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865150)); pub const MSSIPOTF_E_NOHEADTABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865149)); pub const MSSIPOTF_E_BAD_MAGICNUMBER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865148)); pub const MSSIPOTF_E_BAD_OFFSET_TABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865147)); pub const MSSIPOTF_E_TABLE_TAGORDER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865146)); pub const MSSIPOTF_E_TABLE_LONGWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865145)); pub const MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865144)); pub const MSSIPOTF_E_TABLES_OVERLAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865143)); pub const MSSIPOTF_E_TABLE_PADBYTES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865142)); pub const MSSIPOTF_E_FILETOOSMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865141)); pub const MSSIPOTF_E_TABLE_CHECKSUM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865140)); pub const MSSIPOTF_E_FILE_CHECKSUM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865139)); pub const MSSIPOTF_E_FAILED_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865136)); pub const MSSIPOTF_E_FAILED_HINTS_CHECK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865135)); pub const MSSIPOTF_E_NOT_OPENTYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865134)); pub const MSSIPOTF_E_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865133)); pub const MSSIPOTF_E_CRYPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865132)); pub const MSSIPOTF_E_BADVERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865131)); pub const MSSIPOTF_E_DSIG_STRUCTURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865130)); pub const MSSIPOTF_E_PCONST_CHECK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865129)); pub const MSSIPOTF_E_STRUCTURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865128)); pub const ERROR_CRED_REQUIRES_CONFIRMATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146865127)); pub const NTE_OP_OK = @as(u32, 0); pub const TRUST_E_PROVIDER_UNKNOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762751)); pub const TRUST_E_ACTION_UNKNOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762750)); pub const TRUST_E_SUBJECT_FORM_UNKNOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762749)); pub const TRUST_E_SUBJECT_NOT_TRUSTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762748)); pub const DIGSIG_E_ENCODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762747)); pub const DIGSIG_E_DECODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762746)); pub const DIGSIG_E_EXTENSIBILITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762745)); pub const DIGSIG_E_CRYPTO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762744)); pub const PERSIST_E_SIZEDEFINITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762743)); pub const PERSIST_E_SIZEINDEFINITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762742)); pub const PERSIST_E_NOTSELFSIZING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762741)); pub const TRUST_E_NOSIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762496)); pub const CERT_E_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762495)); pub const CERT_E_VALIDITYPERIODNESTING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762494)); pub const CERT_E_ROLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762493)); pub const CERT_E_PATHLENCONST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762492)); pub const CERT_E_CRITICAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762491)); pub const CERT_E_PURPOSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762490)); pub const CERT_E_ISSUERCHAINING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762489)); pub const CERT_E_MALFORMED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762488)); pub const CERT_E_UNTRUSTEDROOT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762487)); pub const CERT_E_CHAINING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762486)); pub const TRUST_E_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762485)); pub const CERT_E_REVOKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762484)); pub const CERT_E_UNTRUSTEDTESTROOT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762483)); pub const CERT_E_REVOCATION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762482)); pub const CERT_E_CN_NO_MATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762481)); pub const CERT_E_WRONG_USAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762480)); pub const TRUST_E_EXPLICIT_DISTRUST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762479)); pub const CERT_E_UNTRUSTEDCA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762478)); pub const CERT_E_INVALID_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762477)); pub const CERT_E_INVALID_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146762476)); pub const SPAPI_E_EXPECTED_SECTION_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500608)); pub const SPAPI_E_BAD_SECTION_NAME_LINE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500607)); pub const SPAPI_E_SECTION_NAME_TOO_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500606)); pub const SPAPI_E_GENERAL_SYNTAX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500605)); pub const SPAPI_E_WRONG_INF_STYLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500352)); pub const SPAPI_E_SECTION_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500351)); pub const SPAPI_E_LINE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500350)); pub const SPAPI_E_NO_BACKUP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500349)); pub const SPAPI_E_NO_ASSOCIATED_CLASS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500096)); pub const SPAPI_E_CLASS_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500095)); pub const SPAPI_E_DUPLICATE_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500094)); pub const SPAPI_E_NO_DRIVER_SELECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500093)); pub const SPAPI_E_KEY_DOES_NOT_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500092)); pub const SPAPI_E_INVALID_DEVINST_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500091)); pub const SPAPI_E_INVALID_CLASS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500090)); pub const SPAPI_E_DEVINST_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500089)); pub const SPAPI_E_DEVINFO_NOT_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500088)); pub const SPAPI_E_INVALID_REG_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500087)); pub const SPAPI_E_NO_INF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500086)); pub const SPAPI_E_NO_SUCH_DEVINST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500085)); pub const SPAPI_E_CANT_LOAD_CLASS_ICON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500084)); pub const SPAPI_E_INVALID_CLASS_INSTALLER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500083)); pub const SPAPI_E_DI_DO_DEFAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500082)); pub const SPAPI_E_DI_NOFILECOPY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500081)); pub const SPAPI_E_INVALID_HWPROFILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500080)); pub const SPAPI_E_NO_DEVICE_SELECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500079)); pub const SPAPI_E_DEVINFO_LIST_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500078)); pub const SPAPI_E_DEVINFO_DATA_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500077)); pub const SPAPI_E_DI_BAD_PATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500076)); pub const SPAPI_E_NO_CLASSINSTALL_PARAMS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500075)); pub const SPAPI_E_FILEQUEUE_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500074)); pub const SPAPI_E_BAD_SERVICE_INSTALLSECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500073)); pub const SPAPI_E_NO_CLASS_DRIVER_LIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500072)); pub const SPAPI_E_NO_ASSOCIATED_SERVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500071)); pub const SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500070)); pub const SPAPI_E_DEVICE_INTERFACE_ACTIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500069)); pub const SPAPI_E_DEVICE_INTERFACE_REMOVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500068)); pub const SPAPI_E_BAD_INTERFACE_INSTALLSECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500067)); pub const SPAPI_E_NO_SUCH_INTERFACE_CLASS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500066)); pub const SPAPI_E_INVALID_REFERENCE_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500065)); pub const SPAPI_E_INVALID_MACHINENAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500064)); pub const SPAPI_E_REMOTE_COMM_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500063)); pub const SPAPI_E_MACHINE_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500062)); pub const SPAPI_E_NO_CONFIGMGR_SERVICES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500061)); pub const SPAPI_E_INVALID_PROPPAGE_PROVIDER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500060)); pub const SPAPI_E_NO_SUCH_DEVICE_INTERFACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500059)); pub const SPAPI_E_DI_POSTPROCESSING_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500058)); pub const SPAPI_E_INVALID_COINSTALLER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500057)); pub const SPAPI_E_NO_COMPAT_DRIVERS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500056)); pub const SPAPI_E_NO_DEVICE_ICON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500055)); pub const SPAPI_E_INVALID_INF_LOGCONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500054)); pub const SPAPI_E_DI_DONT_INSTALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500053)); pub const SPAPI_E_INVALID_FILTER_DRIVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500052)); pub const SPAPI_E_NON_WINDOWS_NT_DRIVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500051)); pub const SPAPI_E_NON_WINDOWS_DRIVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500050)); pub const SPAPI_E_NO_CATALOG_FOR_OEM_INF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500049)); pub const SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500048)); pub const SPAPI_E_NOT_DISABLEABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500047)); pub const SPAPI_E_CANT_REMOVE_DEVINST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500046)); pub const SPAPI_E_INVALID_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500045)); pub const SPAPI_E_DRIVER_NONNATIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500044)); pub const SPAPI_E_IN_WOW64 = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500043)); pub const SPAPI_E_SET_SYSTEM_RESTORE_POINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500042)); pub const SPAPI_E_INCORRECTLY_COPIED_INF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500041)); pub const SPAPI_E_SCE_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500040)); pub const SPAPI_E_UNKNOWN_EXCEPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500039)); pub const SPAPI_E_PNP_REGISTRY_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500038)); pub const SPAPI_E_REMOTE_REQUEST_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500037)); pub const SPAPI_E_NOT_AN_INSTALLED_OEM_INF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500036)); pub const SPAPI_E_INF_IN_USE_BY_DEVICES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500035)); pub const SPAPI_E_DI_FUNCTION_OBSOLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500034)); pub const SPAPI_E_NO_AUTHENTICODE_CATALOG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500033)); pub const SPAPI_E_AUTHENTICODE_DISALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500032)); pub const SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500031)); pub const SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500030)); pub const SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500029)); pub const SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500028)); pub const SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500027)); pub const SPAPI_E_DEVICE_INSTALLER_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500026)); pub const SPAPI_E_DRIVER_STORE_ADD_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500025)); pub const SPAPI_E_DEVICE_INSTALL_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500024)); pub const SPAPI_E_DRIVER_INSTALL_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500023)); pub const SPAPI_E_WRONG_INF_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500022)); pub const SPAPI_E_FILE_HASH_NOT_IN_CATALOG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500021)); pub const SPAPI_E_DRIVER_STORE_DELETE_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146500020)); pub const SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146499840)); pub const SPAPI_E_ERROR_NOT_INSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146496512)); pub const SCARD_F_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435071)); pub const SCARD_E_CANCELLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435070)); pub const SCARD_E_INVALID_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435069)); pub const SCARD_E_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435068)); pub const SCARD_E_INVALID_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435067)); pub const SCARD_E_NO_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435066)); pub const SCARD_F_WAITED_TOO_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435065)); pub const SCARD_E_INSUFFICIENT_BUFFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435064)); pub const SCARD_E_UNKNOWN_READER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435063)); pub const SCARD_E_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435062)); pub const SCARD_E_SHARING_VIOLATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435061)); pub const SCARD_E_NO_SMARTCARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435060)); pub const SCARD_E_UNKNOWN_CARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435059)); pub const SCARD_E_CANT_DISPOSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435058)); pub const SCARD_E_PROTO_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435057)); pub const SCARD_E_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435056)); pub const SCARD_E_INVALID_VALUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435055)); pub const SCARD_E_SYSTEM_CANCELLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435054)); pub const SCARD_F_COMM_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435053)); pub const SCARD_F_UNKNOWN_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435052)); pub const SCARD_E_INVALID_ATR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435051)); pub const SCARD_E_NOT_TRANSACTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435050)); pub const SCARD_E_READER_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435049)); pub const SCARD_P_SHUTDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435048)); pub const SCARD_E_PCI_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435047)); pub const SCARD_E_READER_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435046)); pub const SCARD_E_DUPLICATE_READER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435045)); pub const SCARD_E_CARD_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435044)); pub const SCARD_E_NO_SERVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435043)); pub const SCARD_E_SERVICE_STOPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435042)); pub const SCARD_E_UNEXPECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435041)); pub const SCARD_E_ICC_INSTALLATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435040)); pub const SCARD_E_ICC_CREATEORDER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435039)); pub const SCARD_E_UNSUPPORTED_FEATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435038)); pub const SCARD_E_DIR_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435037)); pub const SCARD_E_FILE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435036)); pub const SCARD_E_NO_DIR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435035)); pub const SCARD_E_NO_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435034)); pub const SCARD_E_NO_ACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435033)); pub const SCARD_E_WRITE_TOO_MANY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435032)); pub const SCARD_E_BAD_SEEK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435031)); pub const SCARD_E_INVALID_CHV = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435030)); pub const SCARD_E_UNKNOWN_RES_MNG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435029)); pub const SCARD_E_NO_SUCH_CERTIFICATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435028)); pub const SCARD_E_CERTIFICATE_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435027)); pub const SCARD_E_NO_READERS_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435026)); pub const SCARD_E_COMM_DATA_LOST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435025)); pub const SCARD_E_NO_KEY_CONTAINER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435024)); pub const SCARD_E_SERVER_TOO_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435023)); pub const SCARD_E_PIN_CACHE_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435022)); pub const SCARD_E_NO_PIN_CACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435021)); pub const SCARD_E_READ_ONLY_CARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146435020)); pub const SCARD_W_UNSUPPORTED_CARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434971)); pub const SCARD_W_UNRESPONSIVE_CARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434970)); pub const SCARD_W_UNPOWERED_CARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434969)); pub const SCARD_W_RESET_CARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434968)); pub const SCARD_W_REMOVED_CARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434967)); pub const SCARD_W_SECURITY_VIOLATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434966)); pub const SCARD_W_WRONG_CHV = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434965)); pub const SCARD_W_CHV_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434964)); pub const SCARD_W_EOF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434963)); pub const SCARD_W_CANCELLED_BY_USER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434962)); pub const SCARD_W_CARD_NOT_AUTHENTICATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434961)); pub const SCARD_W_CACHE_ITEM_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434960)); pub const SCARD_W_CACHE_ITEM_STALE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434959)); pub const SCARD_W_CACHE_ITEM_TOO_BIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146434958)); pub const COMADMIN_E_OBJECTERRORS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368511)); pub const COMADMIN_E_OBJECTINVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368510)); pub const COMADMIN_E_KEYMISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368509)); pub const COMADMIN_E_ALREADYINSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368508)); pub const COMADMIN_E_APP_FILE_WRITEFAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368505)); pub const COMADMIN_E_APP_FILE_READFAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368504)); pub const COMADMIN_E_APP_FILE_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368503)); pub const COMADMIN_E_BADPATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368502)); pub const COMADMIN_E_APPLICATIONEXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368501)); pub const COMADMIN_E_ROLEEXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368500)); pub const COMADMIN_E_CANTCOPYFILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368499)); pub const COMADMIN_E_NOUSER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368497)); pub const COMADMIN_E_INVALIDUSERIDS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368496)); pub const COMADMIN_E_NOREGISTRYCLSID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368495)); pub const COMADMIN_E_BADREGISTRYPROGID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368494)); pub const COMADMIN_E_AUTHENTICATIONLEVEL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368493)); pub const COMADMIN_E_USERPASSWDNOTVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368492)); pub const COMADMIN_E_CLSIDORIIDMISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368488)); pub const COMADMIN_E_REMOTEINTERFACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368487)); pub const COMADMIN_E_DLLREGISTERSERVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368486)); pub const COMADMIN_E_NOSERVERSHARE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368485)); pub const COMADMIN_E_DLLLOADFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368483)); pub const COMADMIN_E_BADREGISTRYLIBID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368482)); pub const COMADMIN_E_APPDIRNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368481)); pub const COMADMIN_E_REGISTRARFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368477)); pub const COMADMIN_E_COMPFILE_DOESNOTEXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368476)); pub const COMADMIN_E_COMPFILE_LOADDLLFAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368475)); pub const COMADMIN_E_COMPFILE_GETCLASSOBJ = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368474)); pub const COMADMIN_E_COMPFILE_CLASSNOTAVAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368473)); pub const COMADMIN_E_COMPFILE_BADTLB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368472)); pub const COMADMIN_E_COMPFILE_NOTINSTALLABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368471)); pub const COMADMIN_E_NOTCHANGEABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368470)); pub const COMADMIN_E_NOTDELETEABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368469)); pub const COMADMIN_E_SESSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368468)); pub const COMADMIN_E_COMP_MOVE_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368467)); pub const COMADMIN_E_COMP_MOVE_BAD_DEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368466)); pub const COMADMIN_E_REGISTERTLB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368464)); pub const COMADMIN_E_SYSTEMAPP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368461)); pub const COMADMIN_E_COMPFILE_NOREGISTRAR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368460)); pub const COMADMIN_E_COREQCOMPINSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368459)); pub const COMADMIN_E_SERVICENOTINSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368458)); pub const COMADMIN_E_PROPERTYSAVEFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368457)); pub const COMADMIN_E_OBJECTEXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368456)); pub const COMADMIN_E_COMPONENTEXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368455)); pub const COMADMIN_E_REGFILE_CORRUPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368453)); pub const COMADMIN_E_PROPERTY_OVERFLOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368452)); pub const COMADMIN_E_NOTINREGISTRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368450)); pub const COMADMIN_E_OBJECTNOTPOOLABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368449)); pub const COMADMIN_E_APPLID_MATCHES_CLSID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368442)); pub const COMADMIN_E_ROLE_DOES_NOT_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368441)); pub const COMADMIN_E_START_APP_NEEDS_COMPONENTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368440)); pub const COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368439)); pub const COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368438)); pub const COMADMIN_E_CAN_NOT_START_APP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368437)); pub const COMADMIN_E_CAN_NOT_EXPORT_SYS_APP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368436)); pub const COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368435)); pub const COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368434)); pub const COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368433)); pub const COMADMIN_E_BASE_PARTITION_ONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368432)); pub const COMADMIN_E_START_APP_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368431)); pub const COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368425)); pub const COMADMIN_E_CAT_INVALID_PARTITION_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368424)); pub const COMADMIN_E_CAT_PARTITION_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368423)); pub const COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368422)); pub const COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368421)); pub const COMADMIN_E_AMBIGUOUS_APPLICATION_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368420)); pub const COMADMIN_E_AMBIGUOUS_PARTITION_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368419)); pub const COMADMIN_E_REGDB_NOTINITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368398)); pub const COMADMIN_E_REGDB_NOTOPEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368397)); pub const COMADMIN_E_REGDB_SYSTEMERR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368396)); pub const COMADMIN_E_REGDB_ALREADYRUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368395)); pub const COMADMIN_E_MIG_VERSIONNOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368384)); pub const COMADMIN_E_MIG_SCHEMANOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368383)); pub const COMADMIN_E_CAT_BITNESSMISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368382)); pub const COMADMIN_E_CAT_UNACCEPTABLEBITNESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368381)); pub const COMADMIN_E_CAT_WRONGAPPBITNESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368380)); pub const COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368379)); pub const COMADMIN_E_CAT_SERVERFAULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368378)); pub const COMQC_E_APPLICATION_NOT_QUEUED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146368000)); pub const COMQC_E_NO_QUEUEABLE_INTERFACES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367999)); pub const COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367998)); pub const COMQC_E_NO_IPERSISTSTREAM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367997)); pub const COMQC_E_BAD_MESSAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367996)); pub const COMQC_E_UNAUTHENTICATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367995)); pub const COMQC_E_UNTRUSTED_ENQUEUER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367994)); pub const MSDTC_E_DUPLICATE_RESOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367743)); pub const COMADMIN_E_OBJECT_PARENT_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367480)); pub const COMADMIN_E_OBJECT_DOES_NOT_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367479)); pub const COMADMIN_E_APP_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367478)); pub const COMADMIN_E_INVALID_PARTITION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367477)); pub const COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367475)); pub const COMADMIN_E_USER_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367474)); pub const COMADMIN_E_CANTRECYCLELIBRARYAPPS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367473)); pub const COMADMIN_E_CANTRECYCLESERVICEAPPS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367471)); pub const COMADMIN_E_PROCESSALREADYRECYCLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367470)); pub const COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367469)); pub const COMADMIN_E_CANTMAKEINPROCSERVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367468)); pub const COMADMIN_E_PROGIDINUSEBYCLSID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367467)); pub const COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367466)); pub const COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367465)); pub const COMADMIN_E_PARTITION_ACCESSDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367464)); pub const COMADMIN_E_PARTITION_MSI_ONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367463)); pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367462)); pub const COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367461)); pub const COMADMIN_E_COMP_MOVE_SOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367460)); pub const COMADMIN_E_COMP_MOVE_DEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367459)); pub const COMADMIN_E_COMP_MOVE_PRIVATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367458)); pub const COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367457)); pub const COMADMIN_E_CANNOT_ALIAS_EVENTCLASS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367456)); pub const COMADMIN_E_PRIVATE_ACCESSDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367455)); pub const COMADMIN_E_SAFERINVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367454)); pub const COMADMIN_E_REGISTRY_ACCESSDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367453)); pub const COMADMIN_E_PARTITIONS_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2146367452)); pub const WER_S_REPORT_DEBUG = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769472)); pub const WER_S_REPORT_UPLOADED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769473)); pub const WER_S_REPORT_QUEUED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769474)); pub const WER_S_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769475)); pub const WER_S_SUSPENDED_UPLOAD = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769476)); pub const WER_S_DISABLED_QUEUE = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769477)); pub const WER_S_DISABLED_ARCHIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769478)); pub const WER_S_REPORT_ASYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769479)); pub const WER_S_IGNORE_ASSERT_INSTANCE = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769480)); pub const WER_S_IGNORE_ALL_ASSERTS = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769481)); pub const WER_S_ASSERT_CONTINUE = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769482)); pub const WER_S_THROTTLED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769483)); pub const WER_S_REPORT_UPLOADED_CAB = @import("zig.zig").typedConst(HRESULT, @as(i32, 1769484)); pub const WER_E_CRASH_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681408)); pub const WER_E_CANCELED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681407)); pub const WER_E_NETWORK_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681406)); pub const WER_E_NOT_INITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681405)); pub const WER_E_ALREADY_REPORTING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681404)); pub const WER_E_DUMP_THROTTLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681403)); pub const WER_E_INSUFFICIENT_CONSENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681402)); pub const WER_E_TOO_HEAVY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145681401)); pub const ERROR_FLT_IO_COMPLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, 2031617)); pub const ERROR_FLT_NO_HANDLER_DEFINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452031)); pub const ERROR_FLT_CONTEXT_ALREADY_DEFINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452030)); pub const ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452029)); pub const ERROR_FLT_DISALLOW_FAST_IO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452028)); pub const ERROR_FLT_INVALID_NAME_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452027)); pub const ERROR_FLT_NOT_SAFE_TO_POST_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452026)); pub const ERROR_FLT_NOT_INITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452025)); pub const ERROR_FLT_FILTER_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452024)); pub const ERROR_FLT_POST_OPERATION_CLEANUP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452023)); pub const ERROR_FLT_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452022)); pub const ERROR_FLT_DELETING_OBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452021)); pub const ERROR_FLT_MUST_BE_NONPAGED_POOL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452020)); pub const ERROR_FLT_DUPLICATE_ENTRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452019)); pub const ERROR_FLT_CBDQ_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452018)); pub const ERROR_FLT_DO_NOT_ATTACH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452017)); pub const ERROR_FLT_DO_NOT_DETACH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452016)); pub const ERROR_FLT_INSTANCE_ALTITUDE_COLLISION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452015)); pub const ERROR_FLT_INSTANCE_NAME_COLLISION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452014)); pub const ERROR_FLT_FILTER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452013)); pub const ERROR_FLT_VOLUME_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452012)); pub const ERROR_FLT_INSTANCE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452011)); pub const ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452010)); pub const ERROR_FLT_INVALID_CONTEXT_REGISTRATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452009)); pub const ERROR_FLT_NAME_CACHE_MISS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452008)); pub const ERROR_FLT_NO_DEVICE_OBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452007)); pub const ERROR_FLT_VOLUME_ALREADY_MOUNTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452006)); pub const ERROR_FLT_ALREADY_ENLISTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452005)); pub const ERROR_FLT_CONTEXT_ALREADY_LINKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452004)); pub const ERROR_FLT_NO_WAITER_FOR_REPLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145452000)); pub const ERROR_FLT_REGISTRATION_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145451997)); pub const ERROR_HUNG_DISPLAY_DRIVER_THREAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144993279)); pub const DWM_E_COMPOSITIONDISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144980991)); pub const DWM_E_REMOTING_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144980990)); pub const DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144980989)); pub const DWM_E_NOT_QUEUING_PRESENTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144980988)); pub const DWM_E_ADAPTER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144980987)); pub const DWM_S_GDI_REDIRECTION_SURFACE = @import("zig.zig").typedConst(HRESULT, @as(i32, 2502661)); pub const DWM_E_TEXTURE_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144980985)); pub const DWM_S_GDI_REDIRECTION_SURFACE_BLT_VIA_GDI = @import("zig.zig").typedConst(HRESULT, @as(i32, 2502664)); pub const ERROR_MONITOR_NO_DESCRIPTOR = @import("zig.zig").typedConst(HRESULT, @as(i32, 2494465)); pub const ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, 2494466)); pub const ERROR_MONITOR_INVALID_DESCRIPTOR_CHECKSUM = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247357)); pub const ERROR_MONITOR_INVALID_STANDARD_TIMING_BLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247356)); pub const ERROR_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247355)); pub const ERROR_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247354)); pub const ERROR_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247353)); pub const ERROR_MONITOR_NO_MORE_DESCRIPTOR_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247352)); pub const ERROR_MONITOR_INVALID_DETAILED_TIMING_BLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247351)); pub const ERROR_MONITOR_INVALID_MANUFACTURE_DATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071247350)); pub const ERROR_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243264)); pub const ERROR_GRAPHICS_INSUFFICIENT_DMA_BUFFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243263)); pub const ERROR_GRAPHICS_INVALID_DISPLAY_ADAPTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243262)); pub const ERROR_GRAPHICS_ADAPTER_WAS_RESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243261)); pub const ERROR_GRAPHICS_INVALID_DRIVER_MODEL = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243260)); pub const ERROR_GRAPHICS_PRESENT_MODE_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243259)); pub const ERROR_GRAPHICS_PRESENT_OCCLUDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243258)); pub const ERROR_GRAPHICS_PRESENT_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243257)); pub const ERROR_GRAPHICS_CANNOTCOLORCONVERT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243256)); pub const ERROR_GRAPHICS_DRIVER_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243255)); pub const ERROR_GRAPHICS_PARTIAL_DATA_POPULATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076240394)); pub const ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243253)); pub const ERROR_GRAPHICS_PRESENT_UNOCCLUDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243252)); pub const ERROR_GRAPHICS_WINDOWDC_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243251)); pub const ERROR_GRAPHICS_WINDOWLESS_PRESENT_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243250)); pub const ERROR_GRAPHICS_PRESENT_INVALID_WINDOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243249)); pub const ERROR_GRAPHICS_PRESENT_BUFFER_NOT_BOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243248)); pub const ERROR_GRAPHICS_VAIL_STATE_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243247)); pub const ERROR_GRAPHICS_INDIRECT_DISPLAY_ABANDON_SWAPCHAIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243246)); pub const ERROR_GRAPHICS_INDIRECT_DISPLAY_DEVICE_STOPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243245)); pub const ERROR_GRAPHICS_VAIL_FAILED_TO_SEND_CREATE_SUPERWETINK_MESSAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243244)); pub const ERROR_GRAPHICS_VAIL_FAILED_TO_SEND_DESTROY_SUPERWETINK_MESSAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243243)); pub const ERROR_GRAPHICS_NO_VIDEO_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243008)); pub const ERROR_GRAPHICS_CANT_LOCK_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243007)); pub const ERROR_GRAPHICS_ALLOCATION_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243006)); pub const ERROR_GRAPHICS_TOO_MANY_REFERENCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243005)); pub const ERROR_GRAPHICS_TRY_AGAIN_LATER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243004)); pub const ERROR_GRAPHICS_TRY_AGAIN_NOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243003)); pub const ERROR_GRAPHICS_ALLOCATION_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243002)); pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243001)); pub const ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071243000)); pub const ERROR_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242999)); pub const ERROR_GRAPHICS_INVALID_ALLOCATION_USAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242992)); pub const ERROR_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242991)); pub const ERROR_GRAPHICS_ALLOCATION_CLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242990)); pub const ERROR_GRAPHICS_INVALID_ALLOCATION_INSTANCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242989)); pub const ERROR_GRAPHICS_INVALID_ALLOCATION_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242988)); pub const ERROR_GRAPHICS_WRONG_ALLOCATION_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242987)); pub const ERROR_GRAPHICS_ALLOCATION_CONTENT_LOST = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242986)); pub const ERROR_GRAPHICS_GPU_EXCEPTION_ON_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242752)); pub const ERROR_GRAPHICS_SKIP_ALLOCATION_PREPARATION = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076240897)); pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242496)); pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242495)); pub const ERROR_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242494)); pub const ERROR_GRAPHICS_INVALID_VIDPN = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242493)); pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242492)); pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242491)); pub const ERROR_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242490)); pub const ERROR_GRAPHICS_MODE_NOT_PINNED = @import("zig.zig").typedConst(HRESULT, @as(i32, 2499335)); pub const ERROR_GRAPHICS_INVALID_VIDPN_SOURCEMODESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242488)); pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGETMODESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242487)); pub const ERROR_GRAPHICS_INVALID_FREQUENCY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242486)); pub const ERROR_GRAPHICS_INVALID_ACTIVE_REGION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242485)); pub const ERROR_GRAPHICS_INVALID_TOTAL_REGION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242484)); pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242480)); pub const ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242479)); pub const ERROR_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242478)); pub const ERROR_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242477)); pub const ERROR_GRAPHICS_MODE_ALREADY_IN_MODESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242476)); pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242475)); pub const ERROR_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242474)); pub const ERROR_GRAPHICS_SOURCE_ALREADY_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242473)); pub const ERROR_GRAPHICS_TARGET_ALREADY_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242472)); pub const ERROR_GRAPHICS_INVALID_VIDPN_PRESENT_PATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242471)); pub const ERROR_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242470)); pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242469)); pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242468)); pub const ERROR_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242467)); pub const ERROR_GRAPHICS_NO_PREFERRED_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, 2499358)); pub const ERROR_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242465)); pub const ERROR_GRAPHICS_STALE_MODESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242464)); pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCEMODESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242463)); pub const ERROR_GRAPHICS_INVALID_MONITOR_SOURCE_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242462)); pub const ERROR_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242461)); pub const ERROR_GRAPHICS_MODE_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242460)); pub const ERROR_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242459)); pub const ERROR_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242458)); pub const ERROR_GRAPHICS_PATH_NOT_IN_TOPOLOGY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242457)); pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242456)); pub const ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242455)); pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTORSET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242454)); pub const ERROR_GRAPHICS_INVALID_MONITORDESCRIPTOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242453)); pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242452)); pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242451)); pub const ERROR_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242450)); pub const ERROR_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242449)); pub const ERROR_GRAPHICS_RESOURCES_NOT_RELATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242448)); pub const ERROR_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242447)); pub const ERROR_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242446)); pub const ERROR_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242445)); pub const ERROR_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242444)); pub const ERROR_GRAPHICS_NO_VIDPNMGR = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242443)); pub const ERROR_GRAPHICS_NO_ACTIVE_VIDPN = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242442)); pub const ERROR_GRAPHICS_STALE_VIDPN_TOPOLOGY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242441)); pub const ERROR_GRAPHICS_MONITOR_NOT_CONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242440)); pub const ERROR_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242439)); pub const ERROR_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242438)); pub const ERROR_GRAPHICS_INVALID_VISIBLEREGION_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242437)); pub const ERROR_GRAPHICS_INVALID_STRIDE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242436)); pub const ERROR_GRAPHICS_INVALID_PIXELFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242435)); pub const ERROR_GRAPHICS_INVALID_COLORBASIS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242434)); pub const ERROR_GRAPHICS_INVALID_PIXELVALUEACCESSMODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242433)); pub const ERROR_GRAPHICS_TARGET_NOT_IN_TOPOLOGY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242432)); pub const ERROR_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242431)); pub const ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242430)); pub const ERROR_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242429)); pub const ERROR_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242428)); pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242427)); pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242426)); pub const ERROR_GRAPHICS_INVALID_GAMMA_RAMP = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242425)); pub const ERROR_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242424)); pub const ERROR_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242423)); pub const ERROR_GRAPHICS_MODE_NOT_IN_MODESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242422)); pub const ERROR_GRAPHICS_DATASET_IS_EMPTY = @import("zig.zig").typedConst(HRESULT, @as(i32, 2499403)); pub const ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET = @import("zig.zig").typedConst(HRESULT, @as(i32, 2499404)); pub const ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242419)); pub const ERROR_GRAPHICS_INVALID_PATH_CONTENT_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242418)); pub const ERROR_GRAPHICS_INVALID_COPYPROTECTION_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242417)); pub const ERROR_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242416)); pub const ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED = @import("zig.zig").typedConst(HRESULT, @as(i32, 2499409)); pub const ERROR_GRAPHICS_INVALID_SCANLINE_ORDERING = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242414)); pub const ERROR_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242413)); pub const ERROR_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242412)); pub const ERROR_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242411)); pub const ERROR_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242410)); pub const ERROR_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242409)); pub const ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242408)); pub const ERROR_GRAPHICS_MAX_NUM_PATHS_REACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242407)); pub const ERROR_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242406)); pub const ERROR_GRAPHICS_INVALID_CLIENT_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242405)); pub const ERROR_GRAPHICS_CLIENTVIDPN_NOT_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242404)); pub const ERROR_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242240)); pub const ERROR_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242239)); pub const ERROR_GRAPHICS_UNKNOWN_CHILD_STATUS = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076241455)); pub const ERROR_GRAPHICS_NOT_A_LINKED_ADAPTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242192)); pub const ERROR_GRAPHICS_LEADLINK_NOT_ENUMERATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242191)); pub const ERROR_GRAPHICS_CHAINLINKS_NOT_ENUMERATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242190)); pub const ERROR_GRAPHICS_ADAPTER_CHAIN_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242189)); pub const ERROR_GRAPHICS_CHAINLINKS_NOT_STARTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242188)); pub const ERROR_GRAPHICS_CHAINLINKS_NOT_POWERED_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242187)); pub const ERROR_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242186)); pub const ERROR_GRAPHICS_LEADLINK_START_DEFERRED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076241463)); pub const ERROR_GRAPHICS_NOT_POST_DEVICE_DRIVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242184)); pub const ERROR_GRAPHICS_POLLING_TOO_FREQUENTLY = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076241465)); pub const ERROR_GRAPHICS_START_DEFERRED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076241466)); pub const ERROR_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071242181)); pub const ERROR_GRAPHICS_DEPENDABLE_CHILD_STATUS = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076241468)); pub const ERROR_GRAPHICS_OPM_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241984)); pub const ERROR_GRAPHICS_COPP_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241983)); pub const ERROR_GRAPHICS_UAB_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241982)); pub const ERROR_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241981)); pub const ERROR_GRAPHICS_OPM_NO_VIDEO_OUTPUTS_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241979)); pub const ERROR_GRAPHICS_OPM_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241973)); pub const ERROR_GRAPHICS_OPM_INVALID_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241972)); pub const ERROR_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241970)); pub const ERROR_GRAPHICS_OPM_SPANNING_MODE_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241969)); pub const ERROR_GRAPHICS_OPM_THEATER_MODE_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241968)); pub const ERROR_GRAPHICS_PVP_HFS_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241967)); pub const ERROR_GRAPHICS_OPM_INVALID_SRM = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241966)); pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241965)); pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241964)); pub const ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241963)); pub const ERROR_GRAPHICS_OPM_HDCP_SRM_NEVER_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241962)); pub const ERROR_GRAPHICS_OPM_RESOLUTION_TOO_HIGH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241961)); pub const ERROR_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241960)); pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_NO_LONGER_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241958)); pub const ERROR_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241957)); pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241956)); pub const ERROR_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241955)); pub const ERROR_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241954)); pub const ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241953)); pub const ERROR_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241952)); pub const ERROR_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241951)); pub const ERROR_GRAPHICS_I2C_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241856)); pub const ERROR_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241855)); pub const ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241854)); pub const ERROR_GRAPHICS_I2C_ERROR_RECEIVING_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241853)); pub const ERROR_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241852)); pub const ERROR_GRAPHICS_DDCCI_INVALID_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241851)); pub const ERROR_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241850)); pub const ERROR_GRAPHICS_MCA_INVALID_CAPABILITIES_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241849)); pub const ERROR_GRAPHICS_MCA_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241848)); pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241847)); pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241846)); pub const ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241845)); pub const ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241844)); pub const ERROR_GRAPHICS_MONITOR_NO_LONGER_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241843)); pub const ERROR_GRAPHICS_DDCCI_CURRENT_CURRENT_VALUE_GREATER_THAN_MAXIMUM_VALUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241768)); pub const ERROR_GRAPHICS_MCA_INVALID_VCP_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241767)); pub const ERROR_GRAPHICS_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241766)); pub const ERROR_GRAPHICS_MCA_MCCS_VERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241765)); pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_MCCS_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241764)); pub const ERROR_GRAPHICS_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241762)); pub const ERROR_GRAPHICS_MCA_UNSUPPORTED_COLOR_TEMPERATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241761)); pub const ERROR_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241760)); pub const ERROR_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241759)); pub const ERROR_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241758)); pub const ERROR_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241757)); pub const ERROR_GRAPHICS_INVALID_POINTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241756)); pub const ERROR_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241755)); pub const ERROR_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241754)); pub const ERROR_GRAPHICS_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071241753)); pub const ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -1071249944)); pub const NAP_E_INVALID_PACKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927743)); pub const NAP_E_MISSING_SOH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927742)); pub const NAP_E_CONFLICTING_ID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927741)); pub const NAP_E_NO_CACHED_SOH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927740)); pub const NAP_E_STILL_BOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927739)); pub const NAP_E_NOT_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927738)); pub const NAP_E_NOT_INITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927737)); pub const NAP_E_MISMATCHED_ID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927736)); pub const NAP_E_NOT_PENDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927735)); pub const NAP_E_ID_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927734)); pub const NAP_E_MAXSIZE_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927733)); pub const NAP_E_SERVICE_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927732)); pub const NAP_S_CERT_ALREADY_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, 2555917)); pub const NAP_E_ENTITY_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927730)); pub const NAP_E_NETSH_GROUPPOLICY_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927729)); pub const NAP_E_TOO_MANY_CALLS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927728)); pub const NAP_E_SHV_CONFIG_EXISTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927727)); pub const NAP_E_SHV_CONFIG_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927726)); pub const NAP_E_SHV_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927725)); pub const TPM_E_ERROR_MASK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862208)); pub const TPM_E_AUTHFAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862207)); pub const TPM_E_BADINDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862206)); pub const TPM_E_BAD_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862205)); pub const TPM_E_AUDITFAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862204)); pub const TPM_E_CLEAR_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862203)); pub const TPM_E_DEACTIVATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862202)); pub const TPM_E_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862201)); pub const TPM_E_DISABLED_CMD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862200)); pub const TPM_E_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862199)); pub const TPM_E_BAD_ORDINAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862198)); pub const TPM_E_INSTALL_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862197)); pub const TPM_E_INVALID_KEYHANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862196)); pub const TPM_E_KEYNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862195)); pub const TPM_E_INAPPROPRIATE_ENC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862194)); pub const TPM_E_MIGRATEFAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862193)); pub const TPM_E_INVALID_PCR_INFO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862192)); pub const TPM_E_NOSPACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862191)); pub const TPM_E_NOSRK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862190)); pub const TPM_E_NOTSEALED_BLOB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862189)); pub const TPM_E_OWNER_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862188)); pub const TPM_E_RESOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862187)); pub const TPM_E_SHORTRANDOM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862186)); pub const TPM_E_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862185)); pub const TPM_E_WRONGPCRVAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862184)); pub const TPM_E_BAD_PARAM_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862183)); pub const TPM_E_SHA_THREAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862182)); pub const TPM_E_SHA_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862181)); pub const TPM_E_FAILEDSELFTEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862180)); pub const TPM_E_AUTH2FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862179)); pub const TPM_E_BADTAG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862178)); pub const TPM_E_IOERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862177)); pub const TPM_E_ENCRYPT_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862176)); pub const TPM_E_DECRYPT_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862175)); pub const TPM_E_INVALID_AUTHHANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862174)); pub const TPM_E_NO_ENDORSEMENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862173)); pub const TPM_E_INVALID_KEYUSAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862172)); pub const TPM_E_WRONG_ENTITYTYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862171)); pub const TPM_E_INVALID_POSTINIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862170)); pub const TPM_E_INAPPROPRIATE_SIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862169)); pub const TPM_E_BAD_KEY_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862168)); pub const TPM_E_BAD_MIGRATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862167)); pub const TPM_E_BAD_SCHEME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862166)); pub const TPM_E_BAD_DATASIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862165)); pub const TPM_E_BAD_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862164)); pub const TPM_E_BAD_PRESENCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862163)); pub const TPM_E_BAD_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862162)); pub const TPM_E_NO_WRAP_TRANSPORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862161)); pub const TPM_E_AUDITFAIL_UNSUCCESSFUL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862160)); pub const TPM_E_AUDITFAIL_SUCCESSFUL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862159)); pub const TPM_E_NOTRESETABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862158)); pub const TPM_E_NOTLOCAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862157)); pub const TPM_E_BAD_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862156)); pub const TPM_E_INVALID_RESOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862155)); pub const TPM_E_NOTFIPS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862154)); pub const TPM_E_INVALID_FAMILY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862153)); pub const TPM_E_NO_NV_PERMISSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862152)); pub const TPM_E_REQUIRES_SIGN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862151)); pub const TPM_E_KEY_NOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862150)); pub const TPM_E_AUTH_CONFLICT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862149)); pub const TPM_E_AREA_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862148)); pub const TPM_E_BAD_LOCALITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862147)); pub const TPM_E_READ_ONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862146)); pub const TPM_E_PER_NOWRITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862145)); pub const TPM_E_FAMILYCOUNT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862144)); pub const TPM_E_WRITE_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862143)); pub const TPM_E_BAD_ATTRIBUTES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862142)); pub const TPM_E_INVALID_STRUCTURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862141)); pub const TPM_E_KEY_OWNER_CONTROL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862140)); pub const TPM_E_BAD_COUNTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862139)); pub const TPM_E_NOT_FULLWRITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862138)); pub const TPM_E_CONTEXT_GAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862137)); pub const TPM_E_MAXNVWRITES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862136)); pub const TPM_E_NOOPERATOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862135)); pub const TPM_E_RESOURCEMISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862134)); pub const TPM_E_DELEGATE_LOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862133)); pub const TPM_E_DELEGATE_FAMILY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862132)); pub const TPM_E_DELEGATE_ADMIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862131)); pub const TPM_E_TRANSPORT_NOTEXCLUSIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862130)); pub const TPM_E_OWNER_CONTROL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862129)); pub const TPM_E_DAA_RESOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862128)); pub const TPM_E_DAA_INPUT_DATA0 = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862127)); pub const TPM_E_DAA_INPUT_DATA1 = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862126)); pub const TPM_E_DAA_ISSUER_SETTINGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862125)); pub const TPM_E_DAA_TPM_SETTINGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862124)); pub const TPM_E_DAA_STAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862123)); pub const TPM_E_DAA_ISSUER_VALIDITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862122)); pub const TPM_E_DAA_WRONG_W = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862121)); pub const TPM_E_BAD_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862120)); pub const TPM_E_BAD_DELEGATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862119)); pub const TPM_E_BADCONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862118)); pub const TPM_E_TOOMANYCONTEXTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862117)); pub const TPM_E_MA_TICKET_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862116)); pub const TPM_E_MA_DESTINATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862115)); pub const TPM_E_MA_SOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862114)); pub const TPM_E_MA_AUTHORITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862113)); pub const TPM_E_PERMANENTEK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862111)); pub const TPM_E_BAD_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862110)); pub const TPM_E_NOCONTEXTSPACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862109)); pub const TPM_20_E_ASYMMETRIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862079)); pub const TPM_20_E_ATTRIBUTES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862078)); pub const TPM_20_E_HASH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862077)); pub const TPM_20_E_VALUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862076)); pub const TPM_20_E_HIERARCHY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862075)); pub const TPM_20_E_KEY_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862073)); pub const TPM_20_E_MGF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862072)); pub const TPM_20_E_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862071)); pub const TPM_20_E_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862070)); pub const TPM_20_E_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862069)); pub const TPM_20_E_KDF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862068)); pub const TPM_20_E_RANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862067)); pub const TPM_20_E_AUTH_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862066)); pub const TPM_20_E_NONCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862065)); pub const TPM_20_E_PP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862064)); pub const TPM_20_E_SCHEME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862062)); pub const TPM_20_E_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862059)); pub const TPM_20_E_SYMMETRIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862058)); pub const TPM_20_E_TAG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862057)); pub const TPM_20_E_SELECTOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862056)); pub const TPM_20_E_INSUFFICIENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862054)); pub const TPM_20_E_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862053)); pub const TPM_20_E_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862052)); pub const TPM_20_E_POLICY_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862051)); pub const TPM_20_E_INTEGRITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862049)); pub const TPM_20_E_TICKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862048)); pub const TPM_20_E_RESERVED_BITS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862047)); pub const TPM_20_E_BAD_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862046)); pub const TPM_20_E_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862045)); pub const TPM_20_E_POLICY_CC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862044)); pub const TPM_20_E_BINDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862043)); pub const TPM_20_E_CURVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862042)); pub const TPM_20_E_ECC_POINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144862041)); pub const TPM_20_E_INITIALIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861952)); pub const TPM_20_E_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861951)); pub const TPM_20_E_SEQUENCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861949)); pub const TPM_20_E_PRIVATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861941)); pub const TPM_20_E_HMAC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861927)); pub const TPM_20_E_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861920)); pub const TPM_20_E_EXCLUSIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861919)); pub const TPM_20_E_ECC_CURVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861917)); pub const TPM_20_E_AUTH_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861916)); pub const TPM_20_E_AUTH_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861915)); pub const TPM_20_E_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861914)); pub const TPM_20_E_PCR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861913)); pub const TPM_20_E_PCR_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861912)); pub const TPM_20_E_UPGRADE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861907)); pub const TPM_20_E_TOO_MANY_CONTEXTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861906)); pub const TPM_20_E_AUTH_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861905)); pub const TPM_20_E_REBOOT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861904)); pub const TPM_20_E_UNBALANCED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861903)); pub const TPM_20_E_COMMAND_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861886)); pub const TPM_20_E_COMMAND_CODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861885)); pub const TPM_20_E_AUTHSIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861884)); pub const TPM_20_E_AUTH_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861883)); pub const TPM_20_E_NV_RANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861882)); pub const TPM_20_E_NV_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861881)); pub const TPM_20_E_NV_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861880)); pub const TPM_20_E_NV_AUTHORIZATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861879)); pub const TPM_20_E_NV_UNINITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861878)); pub const TPM_20_E_NV_SPACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861877)); pub const TPM_20_E_NV_DEFINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861876)); pub const TPM_20_E_BAD_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861872)); pub const TPM_20_E_CPHASH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861871)); pub const TPM_20_E_PARENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861870)); pub const TPM_20_E_NEEDS_TEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861869)); pub const TPM_20_E_NO_RESULT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861868)); pub const TPM_20_E_SENSITIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861867)); pub const TPM_E_COMMAND_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861184)); pub const TPM_E_INVALID_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861183)); pub const TPM_E_DUPLICATE_VHANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861182)); pub const TPM_E_EMBEDDED_COMMAND_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861181)); pub const TPM_E_EMBEDDED_COMMAND_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144861180)); pub const TPM_E_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144860160)); pub const TPM_E_NEEDS_SELFTEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144860159)); pub const TPM_E_DOING_SELFTEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144860158)); pub const TPM_E_DEFEND_LOCK_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144860157)); pub const TPM_20_E_CONTEXT_GAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859903)); pub const TPM_20_E_OBJECT_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859902)); pub const TPM_20_E_SESSION_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859901)); pub const TPM_20_E_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859900)); pub const TPM_20_E_SESSION_HANDLES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859899)); pub const TPM_20_E_OBJECT_HANDLES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859898)); pub const TPM_20_E_LOCALITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859897)); pub const TPM_20_E_YIELDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859896)); pub const TPM_20_E_CANCELED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859895)); pub const TPM_20_E_TESTING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859894)); pub const TPM_20_E_NV_RATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859872)); pub const TPM_20_E_LOCKOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859871)); pub const TPM_20_E_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859870)); pub const TPM_20_E_NV_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144859869)); pub const TBS_E_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845823)); pub const TBS_E_BAD_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845822)); pub const TBS_E_INVALID_OUTPUT_POINTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845821)); pub const TBS_E_INVALID_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845820)); pub const TBS_E_INSUFFICIENT_BUFFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845819)); pub const TBS_E_IOERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845818)); pub const TBS_E_INVALID_CONTEXT_PARAM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845817)); pub const TBS_E_SERVICE_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845816)); pub const TBS_E_TOO_MANY_TBS_CONTEXTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845815)); pub const TBS_E_TOO_MANY_RESOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845814)); pub const TBS_E_SERVICE_START_PENDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845813)); pub const TBS_E_PPI_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845812)); pub const TBS_E_COMMAND_CANCELED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845811)); pub const TBS_E_BUFFER_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845810)); pub const TBS_E_TPM_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845809)); pub const TBS_E_SERVICE_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845808)); pub const TBS_E_NO_EVENT_LOG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845807)); pub const TBS_E_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845806)); pub const TBS_E_PROVISIONING_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845805)); pub const TBS_E_PPI_FUNCTION_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845804)); pub const TBS_E_OWNERAUTH_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845803)); pub const TBS_E_PROVISIONING_INCOMPLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144845802)); pub const TPMAPI_E_INVALID_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796416)); pub const TPMAPI_E_NOT_ENOUGH_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796415)); pub const TPMAPI_E_TOO_MUCH_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796414)); pub const TPMAPI_E_INVALID_OUTPUT_POINTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796413)); pub const TPMAPI_E_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796412)); pub const TPMAPI_E_OUT_OF_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796411)); pub const TPMAPI_E_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796410)); pub const TPMAPI_E_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796409)); pub const TPMAPI_E_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796408)); pub const TPMAPI_E_AUTHORIZATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796407)); pub const TPMAPI_E_INVALID_CONTEXT_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796406)); pub const TPMAPI_E_TBS_COMMUNICATION_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796405)); pub const TPMAPI_E_TPM_COMMAND_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796404)); pub const TPMAPI_E_MESSAGE_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796403)); pub const TPMAPI_E_INVALID_ENCODING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796402)); pub const TPMAPI_E_INVALID_KEY_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796401)); pub const TPMAPI_E_ENCRYPTION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796400)); pub const TPMAPI_E_INVALID_KEY_PARAMS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796399)); pub const TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796398)); pub const TPMAPI_E_INVALID_PCR_INDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796397)); pub const TPMAPI_E_INVALID_DELEGATE_BLOB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796396)); pub const TPMAPI_E_INVALID_CONTEXT_PARAMS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796395)); pub const TPMAPI_E_INVALID_KEY_BLOB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796394)); pub const TPMAPI_E_INVALID_PCR_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796393)); pub const TPMAPI_E_INVALID_OWNER_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796392)); pub const TPMAPI_E_FIPS_RNG_CHECK_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796391)); pub const TPMAPI_E_EMPTY_TCG_LOG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796390)); pub const TPMAPI_E_INVALID_TCG_LOG_ENTRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796389)); pub const TPMAPI_E_TCG_SEPARATOR_ABSENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796388)); pub const TPMAPI_E_TCG_INVALID_DIGEST_ENTRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796387)); pub const TPMAPI_E_POLICY_DENIES_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796386)); pub const TPMAPI_E_NV_BITS_NOT_DEFINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796385)); pub const TPMAPI_E_NV_BITS_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796384)); pub const TPMAPI_E_SEALING_KEY_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796383)); pub const TPMAPI_E_NO_AUTHORIZATION_CHAIN_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796382)); pub const TPMAPI_E_SVN_COUNTER_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796381)); pub const TPMAPI_E_OWNER_AUTH_NOT_NULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796380)); pub const TPMAPI_E_ENDORSEMENT_AUTH_NOT_NULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796379)); pub const TPMAPI_E_AUTHORIZATION_REVOKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796378)); pub const TPMAPI_E_MALFORMED_AUTHORIZATION_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796377)); pub const TPMAPI_E_AUTHORIZING_KEY_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796376)); pub const TPMAPI_E_INVALID_AUTHORIZATION_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796375)); pub const TPMAPI_E_MALFORMED_AUTHORIZATION_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796374)); pub const TPMAPI_E_MALFORMED_AUTHORIZATION_OTHER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796373)); pub const TPMAPI_E_SEALING_KEY_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796372)); pub const TPMAPI_E_INVALID_TPM_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796371)); pub const TPMAPI_E_INVALID_POLICYAUTH_BLOB_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796370)); pub const TBSIMP_E_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796160)); pub const TBSIMP_E_CLEANUP_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796159)); pub const TBSIMP_E_INVALID_CONTEXT_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796158)); pub const TBSIMP_E_INVALID_CONTEXT_PARAM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796157)); pub const TBSIMP_E_TPM_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796156)); pub const TBSIMP_E_HASH_BAD_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796155)); pub const TBSIMP_E_DUPLICATE_VHANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796154)); pub const TBSIMP_E_INVALID_OUTPUT_POINTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796153)); pub const TBSIMP_E_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796152)); pub const TBSIMP_E_RPC_INIT_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796151)); pub const TBSIMP_E_SCHEDULER_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796150)); pub const TBSIMP_E_COMMAND_CANCELED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796149)); pub const TBSIMP_E_OUT_OF_MEMORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796148)); pub const TBSIMP_E_LIST_NO_MORE_ITEMS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796147)); pub const TBSIMP_E_LIST_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796146)); pub const TBSIMP_E_NOT_ENOUGH_SPACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796145)); pub const TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796144)); pub const TBSIMP_E_COMMAND_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796143)); pub const TBSIMP_E_UNKNOWN_ORDINAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796142)); pub const TBSIMP_E_RESOURCE_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796141)); pub const TBSIMP_E_INVALID_RESOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796140)); pub const TBSIMP_E_NOTHING_TO_UNLOAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796139)); pub const TBSIMP_E_HASH_TABLE_FULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796138)); pub const TBSIMP_E_TOO_MANY_TBS_CONTEXTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796137)); pub const TBSIMP_E_TOO_MANY_RESOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796136)); pub const TBSIMP_E_PPI_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796135)); pub const TBSIMP_E_TPM_INCOMPATIBLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796134)); pub const TBSIMP_E_NO_EVENT_LOG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144796133)); pub const TPM_E_PPI_ACPI_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795904)); pub const TPM_E_PPI_USER_ABORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795903)); pub const TPM_E_PPI_BIOS_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795902)); pub const TPM_E_PPI_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795901)); pub const TPM_E_PPI_BLOCKED_IN_BIOS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795900)); pub const TPM_E_PCP_ERROR_MASK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795648)); pub const TPM_E_PCP_DEVICE_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795647)); pub const TPM_E_PCP_INVALID_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795646)); pub const TPM_E_PCP_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795645)); pub const TPM_E_PCP_FLAG_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795644)); pub const TPM_E_PCP_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795643)); pub const TPM_E_PCP_BUFFER_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795642)); pub const TPM_E_PCP_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795641)); pub const TPM_E_PCP_AUTHENTICATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795640)); pub const TPM_E_PCP_AUTHENTICATION_IGNORED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795639)); pub const TPM_E_PCP_POLICY_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795638)); pub const TPM_E_PCP_PROFILE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795637)); pub const TPM_E_PCP_VALIDATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795636)); pub const TPM_E_PCP_WRONG_PARENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795634)); pub const TPM_E_KEY_NOT_LOADED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795633)); pub const TPM_E_NO_KEY_CERTIFICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795632)); pub const TPM_E_KEY_NOT_FINALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795631)); pub const TPM_E_ATTESTATION_CHALLENGE_NOT_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795630)); pub const TPM_E_NOT_PCR_BOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795629)); pub const TPM_E_KEY_ALREADY_FINALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795628)); pub const TPM_E_KEY_USAGE_POLICY_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795627)); pub const TPM_E_KEY_USAGE_POLICY_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795626)); pub const TPM_E_SOFT_KEY_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795625)); pub const TPM_E_KEY_NOT_AUTHENTICATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795624)); pub const TPM_E_PCP_KEY_NOT_AIK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795623)); pub const TPM_E_KEY_NOT_SIGNING_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795622)); pub const TPM_E_LOCKED_OUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795621)); pub const TPM_E_CLAIM_TYPE_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795620)); pub const TPM_E_VERSION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795619)); pub const TPM_E_BUFFER_LENGTH_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795618)); pub const TPM_E_PCP_IFX_RSA_KEY_CREATION_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795617)); pub const TPM_E_PCP_TICKET_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795616)); pub const TPM_E_PCP_RAW_POLICY_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795615)); pub const TPM_E_PCP_KEY_HANDLE_INVALIDATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795614)); pub const TPM_E_PCP_UNSUPPORTED_PSS_SALT = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076429859)); pub const TPM_E_PCP_PLATFORM_CLAIM_MAY_BE_OUTDATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076429860)); pub const TPM_E_PCP_PLATFORM_CLAIM_OUTDATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076429861)); pub const TPM_E_PCP_PLATFORM_CLAIM_REBOOT = @import("zig.zig").typedConst(HRESULT, @as(i32, 1076429862)); pub const TPM_E_ZERO_EXHAUST_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795392)); pub const TPM_E_PROVISIONING_INCOMPLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795136)); pub const TPM_E_INVALID_OWNER_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795135)); pub const TPM_E_TOO_MUCH_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144795134)); pub const PLA_E_DCS_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337918)); pub const PLA_E_DCS_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337750)); pub const PLA_E_TOO_MANY_FOLDERS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337851)); pub const PLA_E_NO_MIN_DISK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337808)); pub const PLA_E_DCS_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337737)); pub const PLA_S_PROPERTY_IGNORED = @import("zig.zig").typedConst(HRESULT, @as(i32, 3145984)); pub const PLA_E_PROPERTY_CONFLICT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337663)); pub const PLA_E_DCS_SINGLETON_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337662)); pub const PLA_E_CREDENTIALS_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337661)); pub const PLA_E_DCS_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337660)); pub const PLA_E_CONFLICT_INCL_EXCL_API = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337659)); pub const PLA_E_NETWORK_EXE_NOT_VALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337658)); pub const PLA_E_EXE_ALREADY_CONFIGURED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337657)); pub const PLA_E_EXE_PATH_NOT_VALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337656)); pub const PLA_E_DC_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337655)); pub const PLA_E_DCS_START_WAIT_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337654)); pub const PLA_E_DC_START_WAIT_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337653)); pub const PLA_E_REPORT_WAIT_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337652)); pub const PLA_E_NO_DUPLICATES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337651)); pub const PLA_E_EXE_FULL_PATH_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337650)); pub const PLA_E_INVALID_SESSION_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337649)); pub const PLA_E_PLA_CHANNEL_NOT_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337648)); pub const PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337647)); pub const PLA_E_RULES_MANAGER_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337646)); pub const PLA_E_CABAPI_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144337645)); pub const FVE_E_LOCKED_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272384)); pub const FVE_E_NOT_ENCRYPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272383)); pub const FVE_E_NO_TPM_BIOS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272382)); pub const FVE_E_NO_MBR_METRIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272381)); pub const FVE_E_NO_BOOTSECTOR_METRIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272380)); pub const FVE_E_NO_BOOTMGR_METRIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272379)); pub const FVE_E_WRONG_BOOTMGR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272378)); pub const FVE_E_SECURE_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272377)); pub const FVE_E_NOT_ACTIVATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272376)); pub const FVE_E_ACTION_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272375)); pub const FVE_E_AD_SCHEMA_NOT_INSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272374)); pub const FVE_E_AD_INVALID_DATATYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272373)); pub const FVE_E_AD_INVALID_DATASIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272372)); pub const FVE_E_AD_NO_VALUES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272371)); pub const FVE_E_AD_ATTR_NOT_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272370)); pub const FVE_E_AD_GUID_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272369)); pub const FVE_E_BAD_INFORMATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272368)); pub const FVE_E_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272367)); pub const FVE_E_SYSTEM_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272366)); pub const FVE_E_FAILED_WRONG_FS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272365)); pub const FVE_E_BAD_PARTITION_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272364)); pub const FVE_E_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272363)); pub const FVE_E_BAD_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272362)); pub const FVE_E_VOLUME_NOT_BOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272361)); pub const FVE_E_TPM_NOT_OWNED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272360)); pub const FVE_E_NOT_DATA_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272359)); pub const FVE_E_AD_INSUFFICIENT_BUFFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272358)); pub const FVE_E_CONV_READ = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272357)); pub const FVE_E_CONV_WRITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272356)); pub const FVE_E_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272355)); pub const FVE_E_CLUSTERING_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272354)); pub const FVE_E_VOLUME_BOUND_ALREADY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272353)); pub const FVE_E_OS_NOT_PROTECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272352)); pub const FVE_E_PROTECTION_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272351)); pub const FVE_E_RECOVERY_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272350)); pub const FVE_E_FOREIGN_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272349)); pub const FVE_E_OVERLAPPED_UPDATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272348)); pub const FVE_E_TPM_SRK_AUTH_NOT_ZERO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272347)); pub const FVE_E_FAILED_SECTOR_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272346)); pub const FVE_E_FAILED_AUTHENTICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272345)); pub const FVE_E_NOT_OS_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272344)); pub const FVE_E_AUTOUNLOCK_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272343)); pub const FVE_E_WRONG_BOOTSECTOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272342)); pub const FVE_E_WRONG_SYSTEM_FS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272341)); pub const FVE_E_POLICY_PASSWORD_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272340)); pub const FVE_E_CANNOT_SET_FVEK_ENCRYPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272339)); pub const FVE_E_CANNOT_ENCRYPT_NO_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272338)); pub const FVE_E_BOOTABLE_CDDVD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272336)); pub const FVE_E_PROTECTOR_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272335)); pub const FVE_E_RELATIVE_PATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272334)); pub const FVE_E_PROTECTOR_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272333)); pub const FVE_E_INVALID_KEY_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272332)); pub const FVE_E_INVALID_PASSWORD_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272331)); pub const FVE_E_FIPS_RNG_CHECK_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272330)); pub const FVE_E_FIPS_PREVENTS_RECOVERY_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272329)); pub const FVE_E_FIPS_PREVENTS_EXTERNAL_KEY_EXPORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272328)); pub const FVE_E_NOT_DECRYPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272327)); pub const FVE_E_INVALID_PROTECTOR_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272326)); pub const FVE_E_NO_PROTECTORS_TO_TEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272325)); pub const FVE_E_KEYFILE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272324)); pub const FVE_E_KEYFILE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272323)); pub const FVE_E_KEYFILE_NO_VMK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272322)); pub const FVE_E_TPM_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272321)); pub const FVE_E_NOT_ALLOWED_IN_SAFE_MODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272320)); pub const FVE_E_TPM_INVALID_PCR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272319)); pub const FVE_E_TPM_NO_VMK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272318)); pub const FVE_E_PIN_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272317)); pub const FVE_E_AUTH_INVALID_APPLICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272316)); pub const FVE_E_AUTH_INVALID_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272315)); pub const FVE_E_FIPS_DISABLE_PROTECTION_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272314)); pub const FVE_E_FS_NOT_EXTENDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272313)); pub const FVE_E_FIRMWARE_TYPE_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272312)); pub const FVE_E_NO_LICENSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272311)); pub const FVE_E_NOT_ON_STACK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272310)); pub const FVE_E_FS_MOUNTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272309)); pub const FVE_E_TOKEN_NOT_IMPERSONATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272308)); pub const FVE_E_DRY_RUN_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272307)); pub const FVE_E_REBOOT_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272306)); pub const FVE_E_DEBUGGER_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272305)); pub const FVE_E_RAW_ACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272304)); pub const FVE_E_RAW_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272303)); pub const FVE_E_BCD_APPLICATIONS_PATH_INCORRECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272302)); pub const FVE_E_NOT_ALLOWED_IN_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272301)); pub const FVE_E_NO_AUTOUNLOCK_MASTER_KEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272300)); pub const FVE_E_MOR_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272299)); pub const FVE_E_HIDDEN_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272298)); pub const FVE_E_TRANSIENT_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272297)); pub const FVE_E_PUBKEY_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272296)); pub const FVE_E_VOLUME_HANDLE_OPEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272295)); pub const FVE_E_NO_FEATURE_LICENSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272294)); pub const FVE_E_INVALID_STARTUP_OPTIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272293)); pub const FVE_E_POLICY_RECOVERY_PASSWORD_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272292)); pub const FVE_E_POLICY_RECOVERY_PASSWORD_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272291)); pub const FVE_E_POLICY_RECOVERY_KEY_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272290)); pub const FVE_E_POLICY_RECOVERY_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272289)); pub const FVE_E_POLICY_STARTUP_PIN_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272288)); pub const FVE_E_POLICY_STARTUP_PIN_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272287)); pub const FVE_E_POLICY_STARTUP_KEY_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272286)); pub const FVE_E_POLICY_STARTUP_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272285)); pub const FVE_E_POLICY_STARTUP_PIN_KEY_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272284)); pub const FVE_E_POLICY_STARTUP_PIN_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272283)); pub const FVE_E_POLICY_STARTUP_TPM_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272282)); pub const FVE_E_POLICY_STARTUP_TPM_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272281)); pub const FVE_E_POLICY_INVALID_PIN_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272280)); pub const FVE_E_KEY_PROTECTOR_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272279)); pub const FVE_E_POLICY_PASSPHRASE_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272278)); pub const FVE_E_POLICY_PASSPHRASE_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272277)); pub const FVE_E_FIPS_PREVENTS_PASSPHRASE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272276)); pub const FVE_E_OS_VOLUME_PASSPHRASE_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272275)); pub const FVE_E_INVALID_BITLOCKER_OID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272274)); pub const FVE_E_VOLUME_TOO_SMALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272273)); pub const FVE_E_DV_NOT_SUPPORTED_ON_FS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272272)); pub const FVE_E_DV_NOT_ALLOWED_BY_GP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272271)); pub const FVE_E_POLICY_USER_CERTIFICATE_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272270)); pub const FVE_E_POLICY_USER_CERTIFICATE_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272269)); pub const FVE_E_POLICY_USER_CERT_MUST_BE_HW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272268)); pub const FVE_E_POLICY_USER_CONFIGURE_FDV_AUTOUNLOCK_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272267)); pub const FVE_E_POLICY_USER_CONFIGURE_RDV_AUTOUNLOCK_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272266)); pub const FVE_E_POLICY_USER_CONFIGURE_RDV_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272265)); pub const FVE_E_POLICY_USER_ENABLE_RDV_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272264)); pub const FVE_E_POLICY_USER_DISABLE_RDV_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272263)); pub const FVE_E_POLICY_INVALID_PASSPHRASE_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272256)); pub const FVE_E_POLICY_PASSPHRASE_TOO_SIMPLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272255)); pub const FVE_E_RECOVERY_PARTITION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272254)); pub const FVE_E_POLICY_CONFLICT_FDV_RK_OFF_AUK_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272253)); pub const FVE_E_POLICY_CONFLICT_RDV_RK_OFF_AUK_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272252)); pub const FVE_E_NON_BITLOCKER_OID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272251)); pub const FVE_E_POLICY_PROHIBITS_SELFSIGNED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272250)); pub const FVE_E_POLICY_CONFLICT_RO_AND_STARTUP_KEY_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272249)); pub const FVE_E_CONV_RECOVERY_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272248)); pub const FVE_E_VIRTUALIZED_SPACE_TOO_BIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272247)); pub const FVE_E_POLICY_CONFLICT_OSV_RP_OFF_ADB_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272240)); pub const FVE_E_POLICY_CONFLICT_FDV_RP_OFF_ADB_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272239)); pub const FVE_E_POLICY_CONFLICT_RDV_RP_OFF_ADB_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272238)); pub const FVE_E_NON_BITLOCKER_KU = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272237)); pub const FVE_E_PRIVATEKEY_AUTH_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272236)); pub const FVE_E_REMOVAL_OF_DRA_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272235)); pub const FVE_E_OPERATION_NOT_SUPPORTED_ON_VISTA_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272234)); pub const FVE_E_CANT_LOCK_AUTOUNLOCK_ENABLED_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272233)); pub const FVE_E_FIPS_HASH_KDF_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272232)); pub const FVE_E_ENH_PIN_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272231)); pub const FVE_E_INVALID_PIN_CHARS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272230)); pub const FVE_E_INVALID_DATUM_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272229)); pub const FVE_E_EFI_ONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272228)); pub const FVE_E_MULTIPLE_NKP_CERTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272227)); pub const FVE_E_REMOVAL_OF_NKP_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272226)); pub const FVE_E_INVALID_NKP_CERT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272225)); pub const FVE_E_NO_EXISTING_PIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272224)); pub const FVE_E_PROTECTOR_CHANGE_PIN_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272223)); pub const FVE_E_PIN_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272222)); pub const FVE_E_PROTECTOR_CHANGE_MAX_PIN_CHANGE_ATTEMPTS_REACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272221)); pub const FVE_E_POLICY_PASSPHRASE_REQUIRES_ASCII = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272220)); pub const FVE_E_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272219)); pub const FVE_E_WIPE_NOT_ALLOWED_ON_TP_STORAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272218)); pub const FVE_E_KEY_LENGTH_NOT_SUPPORTED_BY_EDRIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272217)); pub const FVE_E_NO_EXISTING_PASSPHRASE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272216)); pub const FVE_E_PROTECTOR_CHANGE_PASSPHRASE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272215)); pub const FVE_E_PASSPHRASE_TOO_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272214)); pub const FVE_E_NO_PASSPHRASE_WITH_TPM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272213)); pub const FVE_E_NO_TPM_WITH_PASSPHRASE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272212)); pub const FVE_E_NOT_ALLOWED_ON_CSV_STACK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272211)); pub const FVE_E_NOT_ALLOWED_ON_CLUSTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272210)); pub const FVE_E_EDRIVE_NO_FAILOVER_TO_SW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272209)); pub const FVE_E_EDRIVE_BAND_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272208)); pub const FVE_E_EDRIVE_DISALLOWED_BY_GP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272207)); pub const FVE_E_EDRIVE_INCOMPATIBLE_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272206)); pub const FVE_E_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272205)); pub const FVE_E_EDRIVE_DV_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272204)); pub const FVE_E_NO_PREBOOT_KEYBOARD_DETECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272203)); pub const FVE_E_NO_PREBOOT_KEYBOARD_OR_WINRE_DETECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272202)); pub const FVE_E_POLICY_REQUIRES_STARTUP_PIN_ON_TOUCH_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272201)); pub const FVE_E_POLICY_REQUIRES_RECOVERY_PASSWORD_ON_TOUCH_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272200)); pub const FVE_E_WIPE_CANCEL_NOT_APPLICABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272199)); pub const FVE_E_SECUREBOOT_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272198)); pub const FVE_E_SECUREBOOT_CONFIGURATION_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272197)); pub const FVE_E_EDRIVE_DRY_RUN_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272196)); pub const FVE_E_SHADOW_COPY_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272195)); pub const FVE_E_POLICY_INVALID_ENHANCED_BCD_SETTINGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272194)); pub const FVE_E_EDRIVE_INCOMPATIBLE_FIRMWARE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272193)); pub const FVE_E_PROTECTOR_CHANGE_MAX_PASSPHRASE_CHANGE_ATTEMPTS_REACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272192)); pub const FVE_E_PASSPHRASE_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272191)); pub const FVE_E_LIVEID_ACCOUNT_SUSPENDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272190)); pub const FVE_E_LIVEID_ACCOUNT_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272189)); pub const FVE_E_NOT_PROVISIONED_ON_ALL_VOLUMES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272188)); pub const FVE_E_DE_FIXED_DATA_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272187)); pub const FVE_E_DE_HARDWARE_NOT_COMPLIANT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272186)); pub const FVE_E_DE_WINRE_NOT_CONFIGURED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272185)); pub const FVE_E_DE_PROTECTION_SUSPENDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272184)); pub const FVE_E_DE_OS_VOLUME_NOT_PROTECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272183)); pub const FVE_E_DE_DEVICE_LOCKEDOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272182)); pub const FVE_E_DE_PROTECTION_NOT_YET_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272181)); pub const FVE_E_INVALID_PIN_CHARS_DETAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272180)); pub const FVE_E_DEVICE_LOCKOUT_COUNTER_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272179)); pub const FVE_E_DEVICELOCKOUT_COUNTER_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272178)); pub const FVE_E_BUFFER_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272177)); pub const FVE_E_NO_SUCH_CAPABILITY_ON_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272176)); pub const FVE_E_DE_PREVENTED_FOR_OS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272175)); pub const FVE_E_DE_VOLUME_OPTED_OUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272174)); pub const FVE_E_DE_VOLUME_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272173)); pub const FVE_E_EOW_NOT_SUPPORTED_IN_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272172)); pub const FVE_E_ADBACKUP_NOT_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272171)); pub const FVE_E_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272170)); pub const FVE_E_NOT_DE_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272169)); pub const FVE_E_PROTECTION_CANNOT_BE_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272168)); pub const FVE_E_OSV_KSR_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272167)); pub const FVE_E_AD_BACKUP_REQUIRED_POLICY_NOT_SET_OS_DRIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272166)); pub const FVE_E_AD_BACKUP_REQUIRED_POLICY_NOT_SET_FIXED_DRIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272165)); pub const FVE_E_AD_BACKUP_REQUIRED_POLICY_NOT_SET_REMOVABLE_DRIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272164)); pub const FVE_E_KEY_ROTATION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272163)); pub const FVE_E_EXECUTE_REQUEST_SENT_TOO_SOON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272162)); pub const FVE_E_KEY_ROTATION_NOT_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272161)); pub const FVE_E_DEVICE_NOT_JOINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272160)); pub const FVE_E_AAD_ENDPOINT_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144272159)); pub const FWP_E_CALLOUT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206847)); pub const FWP_E_CONDITION_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206846)); pub const FWP_E_FILTER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206845)); pub const FWP_E_LAYER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206844)); pub const FWP_E_PROVIDER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206843)); pub const FWP_E_PROVIDER_CONTEXT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206842)); pub const FWP_E_SUBLAYER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206841)); pub const FWP_E_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206840)); pub const FWP_E_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206839)); pub const FWP_E_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206838)); pub const FWP_E_DYNAMIC_SESSION_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206837)); pub const FWP_E_WRONG_SESSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206836)); pub const FWP_E_NO_TXN_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206835)); pub const FWP_E_TXN_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206834)); pub const FWP_E_TXN_ABORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206833)); pub const FWP_E_SESSION_ABORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206832)); pub const FWP_E_INCOMPATIBLE_TXN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206831)); pub const FWP_E_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206830)); pub const FWP_E_NET_EVENTS_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206829)); pub const FWP_E_INCOMPATIBLE_LAYER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206828)); pub const FWP_E_KM_CLIENTS_ONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206827)); pub const FWP_E_LIFETIME_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206826)); pub const FWP_E_BUILTIN_OBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206825)); pub const FWP_E_TOO_MANY_CALLOUTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206824)); pub const FWP_E_NOTIFICATION_DROPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206823)); pub const FWP_E_TRAFFIC_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206822)); pub const FWP_E_INCOMPATIBLE_SA_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206821)); pub const FWP_E_NULL_POINTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206820)); pub const FWP_E_INVALID_ENUMERATOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206819)); pub const FWP_E_INVALID_FLAGS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206818)); pub const FWP_E_INVALID_NET_MASK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206817)); pub const FWP_E_INVALID_RANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206816)); pub const FWP_E_INVALID_INTERVAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206815)); pub const FWP_E_ZERO_LENGTH_ARRAY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206814)); pub const FWP_E_NULL_DISPLAY_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206813)); pub const FWP_E_INVALID_ACTION_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206812)); pub const FWP_E_INVALID_WEIGHT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206811)); pub const FWP_E_MATCH_TYPE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206810)); pub const FWP_E_TYPE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206809)); pub const FWP_E_OUT_OF_BOUNDS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206808)); pub const FWP_E_RESERVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206807)); pub const FWP_E_DUPLICATE_CONDITION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206806)); pub const FWP_E_DUPLICATE_KEYMOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206805)); pub const FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206804)); pub const FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206803)); pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206802)); pub const FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206801)); pub const FWP_E_INCOMPATIBLE_AUTH_METHOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206800)); pub const FWP_E_INCOMPATIBLE_DH_GROUP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206799)); pub const FWP_E_EM_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206798)); pub const FWP_E_NEVER_MATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206797)); pub const FWP_E_PROVIDER_CONTEXT_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206796)); pub const FWP_E_INVALID_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206795)); pub const FWP_E_TOO_MANY_SUBLAYERS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206794)); pub const FWP_E_CALLOUT_NOTIFICATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206793)); pub const FWP_E_INVALID_AUTH_TRANSFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206792)); pub const FWP_E_INVALID_CIPHER_TRANSFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206791)); pub const FWP_E_INCOMPATIBLE_CIPHER_TRANSFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206790)); pub const FWP_E_INVALID_TRANSFORM_COMBINATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206789)); pub const FWP_E_DUPLICATE_AUTH_METHOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206788)); pub const FWP_E_INVALID_TUNNEL_ENDPOINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206787)); pub const FWP_E_L2_DRIVER_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206786)); pub const FWP_E_KEY_DICTATOR_ALREADY_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206785)); pub const FWP_E_KEY_DICTATION_INVALID_KEYING_MATERIAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206784)); pub const FWP_E_CONNECTIONS_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206783)); pub const FWP_E_INVALID_DNS_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206782)); pub const FWP_E_STILL_ON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206781)); pub const FWP_E_IKEEXT_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206780)); pub const FWP_E_DROP_NOICMP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144206588)); pub const WS_S_ASYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, 3997696)); pub const WS_S_END = @import("zig.zig").typedConst(HRESULT, @as(i32, 3997697)); pub const WS_E_INVALID_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485952)); pub const WS_E_OBJECT_FAULTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485951)); pub const WS_E_NUMERIC_OVERFLOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485950)); pub const WS_E_INVALID_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485949)); pub const WS_E_OPERATION_ABORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485948)); pub const WS_E_ENDPOINT_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485947)); pub const WS_E_OPERATION_TIMED_OUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485946)); pub const WS_E_OPERATION_ABANDONED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485945)); pub const WS_E_QUOTA_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485944)); pub const WS_E_NO_TRANSLATION_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485943)); pub const WS_E_SECURITY_VERIFICATION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485942)); pub const WS_E_ADDRESS_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485941)); pub const WS_E_ADDRESS_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485940)); pub const WS_E_ENDPOINT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485939)); pub const WS_E_ENDPOINT_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485938)); pub const WS_E_ENDPOINT_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485937)); pub const WS_E_ENDPOINT_UNREACHABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485936)); pub const WS_E_ENDPOINT_ACTION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485935)); pub const WS_E_ENDPOINT_TOO_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485934)); pub const WS_E_ENDPOINT_FAULT_RECEIVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485933)); pub const WS_E_ENDPOINT_DISCONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485932)); pub const WS_E_PROXY_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485931)); pub const WS_E_PROXY_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485930)); pub const WS_E_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485929)); pub const WS_E_PROXY_REQUIRES_BASIC_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485928)); pub const WS_E_PROXY_REQUIRES_DIGEST_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485927)); pub const WS_E_PROXY_REQUIRES_NTLM_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485926)); pub const WS_E_PROXY_REQUIRES_NEGOTIATE_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485925)); pub const WS_E_SERVER_REQUIRES_BASIC_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485924)); pub const WS_E_SERVER_REQUIRES_DIGEST_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485923)); pub const WS_E_SERVER_REQUIRES_NTLM_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485922)); pub const WS_E_SERVER_REQUIRES_NEGOTIATE_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485921)); pub const WS_E_INVALID_ENDPOINT_URL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485920)); pub const WS_E_OTHER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485919)); pub const WS_E_SECURITY_TOKEN_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485918)); pub const WS_E_SECURITY_SYSTEM_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143485917)); pub const HCS_E_TERMINATED_DURING_START = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878912)); pub const HCS_E_IMAGE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878911)); pub const HCS_E_HYPERV_NOT_INSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878910)); pub const HCS_E_INVALID_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878907)); pub const HCS_E_UNEXPECTED_EXIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878906)); pub const HCS_E_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878905)); pub const HCS_E_CONNECT_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878904)); pub const HCS_E_CONNECTION_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878903)); pub const HCS_E_CONNECTION_CLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878902)); pub const HCS_E_UNKNOWN_MESSAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878901)); pub const HCS_E_UNSUPPORTED_PROTOCOL_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878900)); pub const HCS_E_INVALID_JSON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878899)); pub const HCS_E_SYSTEM_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878898)); pub const HCS_E_SYSTEM_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878897)); pub const HCS_E_SYSTEM_ALREADY_STOPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878896)); pub const HCS_E_PROTOCOL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878895)); pub const HCS_E_INVALID_LAYER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878894)); pub const HCS_E_WINDOWS_INSIDER_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878893)); pub const HCS_E_SERVICE_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878892)); pub const HCS_E_OPERATION_NOT_STARTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878891)); pub const HCS_E_OPERATION_ALREADY_STARTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878890)); pub const HCS_E_OPERATION_PENDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878889)); pub const HCS_E_OPERATION_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878888)); pub const HCS_E_OPERATION_SYSTEM_CALLBACK_ALREADY_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878887)); pub const HCS_E_OPERATION_RESULT_ALLOCATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878886)); pub const HCS_E_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878885)); pub const HCS_E_GUEST_CRITICAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878884)); pub const HCS_E_PROCESS_INFO_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878883)); pub const HCS_E_SERVICE_DISCONNECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878882)); pub const HCS_E_PROCESS_ALREADY_STOPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878881)); pub const WHV_E_UNKNOWN_CAPABILITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878400)); pub const WHV_E_INSUFFICIENT_BUFFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878399)); pub const WHV_E_UNKNOWN_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878398)); pub const WHV_E_UNSUPPORTED_HYPERVISOR_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878397)); pub const WHV_E_INVALID_PARTITION_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878396)); pub const WHV_E_GPA_RANGE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878395)); pub const WHV_E_VP_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878394)); pub const WHV_E_VP_DOES_NOT_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878393)); pub const WHV_E_INVALID_VP_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878392)); pub const WHV_E_INVALID_VP_REGISTER_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878391)); pub const WHV_E_UNSUPPORTED_PROCESSOR_CONFIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143878384)); pub const VM_SAVED_STATE_DUMP_E_PARTITION_STATE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136064)); pub const VM_SAVED_STATE_DUMP_E_GUEST_MEMORY_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136063)); pub const VM_SAVED_STATE_DUMP_E_NO_VP_FOUND_IN_PARTITION_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136062)); pub const VM_SAVED_STATE_DUMP_E_NESTED_VIRTUALIZATION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136061)); pub const VM_SAVED_STATE_DUMP_E_WINDOWS_KERNEL_IMAGE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136060)); pub const VM_SAVED_STATE_DUMP_E_PXE_NOT_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136059)); pub const VM_SAVED_STATE_DUMP_E_PDPTE_NOT_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136058)); pub const VM_SAVED_STATE_DUMP_E_PDE_NOT_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136057)); pub const VM_SAVED_STATE_DUMP_E_PTE_NOT_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1070136056)); pub const HCN_E_NETWORK_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617023)); pub const HCN_E_ENDPOINT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617022)); pub const HCN_E_LAYER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617021)); pub const HCN_E_SWITCH_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617020)); pub const HCN_E_SUBNET_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617019)); pub const HCN_E_ADAPTER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617018)); pub const HCN_E_PORT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617017)); pub const HCN_E_POLICY_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617016)); pub const HCN_E_VFP_PORTSETTING_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617015)); pub const HCN_E_INVALID_NETWORK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617014)); pub const HCN_E_INVALID_NETWORK_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617013)); pub const HCN_E_INVALID_ENDPOINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617012)); pub const HCN_E_INVALID_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617011)); pub const HCN_E_INVALID_POLICY_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617010)); pub const HCN_E_INVALID_REMOTE_ENDPOINT_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617009)); pub const HCN_E_NETWORK_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617008)); pub const HCN_E_LAYER_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617007)); pub const HCN_E_POLICY_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617006)); pub const HCN_E_PORT_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617005)); pub const HCN_E_ENDPOINT_ALREADY_ATTACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617004)); pub const HCN_E_REQUEST_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617003)); pub const HCN_E_MAPPING_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617002)); pub const HCN_E_DEGRADED_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617001)); pub const HCN_E_SHARED_SWITCH_MODIFICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143617000)); pub const HCN_E_GUID_CONVERSION_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616999)); pub const HCN_E_REGKEY_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616998)); pub const HCN_E_INVALID_JSON = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616997)); pub const HCN_E_INVALID_JSON_REFERENCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616996)); pub const HCN_E_ENDPOINT_SHARING_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616995)); pub const HCN_E_INVALID_IP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616994)); pub const HCN_E_SWITCH_EXTENSION_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616993)); pub const HCN_E_MANAGER_STOPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616992)); pub const GCN_E_MODULE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616991)); pub const GCN_E_NO_REQUEST_HANDLERS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616990)); pub const GCN_E_REQUEST_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616989)); pub const GCN_E_RUNTIMEKEYS_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616988)); pub const GCN_E_NETADAPTER_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616987)); pub const GCN_E_NETADAPTER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616986)); pub const GCN_E_NETCOMPARTMENT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616985)); pub const GCN_E_NETINTERFACE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616984)); pub const GCN_E_DEFAULTNAMESPACE_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616983)); pub const HCN_E_ICS_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616982)); pub const HCN_E_ENDPOINT_NAMESPACE_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616981)); pub const HCN_E_ENTITY_HAS_REFERENCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616980)); pub const HCN_E_INVALID_INTERNAL_PORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616979)); pub const HCN_E_NAMESPACE_ATTACH_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616978)); pub const HCN_E_ADDR_INVALID_OR_RESERVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616977)); pub const HCN_E_INVALID_PREFIX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616976)); pub const HCN_E_OBJECT_USED_AFTER_UNLOAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616975)); pub const HCN_E_INVALID_SUBNET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616974)); pub const HCN_E_INVALID_IP_SUBNET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616973)); pub const HCN_E_ENDPOINT_NOT_ATTACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616972)); pub const HCN_E_ENDPOINT_NOT_LOCAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616971)); pub const HCN_INTERFACEPARAMETERS_ALREADY_APPLIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143616970)); pub const SDIAG_E_CANCELLED = @as(i32, -2143551232); pub const SDIAG_E_SCRIPT = @as(i32, -2143551231); pub const SDIAG_E_POWERSHELL = @as(i32, -2143551230); pub const SDIAG_E_MANAGEDHOST = @as(i32, -2143551229); pub const SDIAG_E_NOVERIFIER = @as(i32, -2143551228); pub const SDIAG_S_CANNOTRUN = @as(i32, 3932421); pub const SDIAG_E_DISABLED = @as(i32, -2143551226); pub const SDIAG_E_TRUST = @as(i32, -2143551225); pub const SDIAG_E_CANNOTRUN = @as(i32, -2143551224); pub const SDIAG_E_VERSION = @as(i32, -2143551223); pub const SDIAG_E_RESOURCE = @as(i32, -2143551222); pub const SDIAG_E_ROOTCAUSE = @as(i32, -2143551221); pub const WPN_E_CHANNEL_CLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420160)); pub const WPN_E_CHANNEL_REQUEST_NOT_COMPLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420159)); pub const WPN_E_INVALID_APP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420158)); pub const WPN_E_OUTSTANDING_CHANNEL_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420157)); pub const WPN_E_DUPLICATE_CHANNEL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420156)); pub const WPN_E_PLATFORM_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420155)); pub const WPN_E_NOTIFICATION_POSTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420154)); pub const WPN_E_NOTIFICATION_HIDDEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420153)); pub const WPN_E_NOTIFICATION_NOT_POSTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420152)); pub const WPN_E_CLOUD_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420151)); pub const WPN_E_CLOUD_INCAPABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420144)); pub const WPN_E_CLOUD_AUTH_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420134)); pub const WPN_E_CLOUD_SERVICE_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420133)); pub const WPN_E_FAILED_LOCK_SCREEN_UPDATE_INTIALIZATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420132)); pub const WPN_E_NOTIFICATION_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420143)); pub const WPN_E_NOTIFICATION_INCAPABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420142)); pub const WPN_E_INTERNET_INCAPABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420141)); pub const WPN_E_NOTIFICATION_TYPE_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420140)); pub const WPN_E_NOTIFICATION_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420139)); pub const WPN_E_TAG_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420138)); pub const WPN_E_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420137)); pub const WPN_E_DUPLICATE_REGISTRATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420136)); pub const WPN_E_PUSH_NOTIFICATION_INCAPABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420135)); pub const WPN_E_DEV_ID_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420128)); pub const WPN_E_TAG_ALPHANUMERIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420118)); pub const WPN_E_INVALID_HTTP_STATUS_CODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143420117)); pub const WPN_E_OUT_OF_SESSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419904)); pub const WPN_E_POWER_SAVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419903)); pub const WPN_E_IMAGE_NOT_FOUND_IN_CACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419902)); pub const WPN_E_ALL_URL_NOT_COMPLETED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419901)); pub const WPN_E_INVALID_CLOUD_IMAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419900)); pub const WPN_E_NOTIFICATION_ID_MATCHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419899)); pub const WPN_E_CALLBACK_ALREADY_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419898)); pub const WPN_E_TOAST_NOTIFICATION_DROPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419897)); pub const WPN_E_STORAGE_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419896)); pub const WPN_E_GROUP_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419895)); pub const WPN_E_GROUP_ALPHANUMERIC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419894)); pub const WPN_E_CLOUD_DISABLED_FOR_APP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143419893)); pub const E_MBN_CONTEXT_NOT_ACTIVATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945343)); pub const E_MBN_BAD_SIM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945342)); pub const E_MBN_DATA_CLASS_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945341)); pub const E_MBN_INVALID_ACCESS_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945340)); pub const E_MBN_MAX_ACTIVATED_CONTEXTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945339)); pub const E_MBN_PACKET_SVC_DETACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945338)); pub const E_MBN_PROVIDER_NOT_VISIBLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945337)); pub const E_MBN_RADIO_POWER_OFF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945336)); pub const E_MBN_SERVICE_NOT_ACTIVATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945335)); pub const E_MBN_SIM_NOT_INSERTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945334)); pub const E_MBN_VOICE_CALL_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945333)); pub const E_MBN_INVALID_CACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945332)); pub const E_MBN_NOT_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945331)); pub const E_MBN_PROVIDERS_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945330)); pub const E_MBN_PIN_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945329)); pub const E_MBN_PIN_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945328)); pub const E_MBN_PIN_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945327)); pub const E_MBN_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945326)); pub const E_MBN_INVALID_PROFILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945320)); pub const E_MBN_DEFAULT_PROFILE_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945319)); pub const E_MBN_SMS_ENCODING_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945312)); pub const E_MBN_SMS_FILTER_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945311)); pub const E_MBN_SMS_INVALID_MEMORY_INDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945310)); pub const E_MBN_SMS_LANG_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945309)); pub const E_MBN_SMS_MEMORY_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945308)); pub const E_MBN_SMS_NETWORK_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945307)); pub const E_MBN_SMS_UNKNOWN_SMSC_ADDRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945306)); pub const E_MBN_SMS_FORMAT_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945305)); pub const E_MBN_SMS_OPERATION_NOT_ALLOWED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945304)); pub const E_MBN_SMS_MEMORY_FULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141945303)); pub const PEER_E_IPV6_NOT_INSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995583)); pub const PEER_E_NOT_INITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995582)); pub const PEER_E_CANNOT_START_SERVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995581)); pub const PEER_E_NOT_LICENSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995580)); pub const PEER_E_INVALID_GRAPH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995568)); pub const PEER_E_DBNAME_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995567)); pub const PEER_E_DUPLICATE_GRAPH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995566)); pub const PEER_E_GRAPH_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995565)); pub const PEER_E_GRAPH_SHUTTING_DOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995564)); pub const PEER_E_GRAPH_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995563)); pub const PEER_E_INVALID_DATABASE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995562)); pub const PEER_E_TOO_MANY_ATTRIBUTES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995561)); pub const PEER_E_CONNECTION_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995325)); pub const PEER_E_CONNECT_SELF = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995322)); pub const PEER_E_ALREADY_LISTENING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995321)); pub const PEER_E_NODE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995320)); pub const PEER_E_CONNECTION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995319)); pub const PEER_E_CONNECTION_NOT_AUTHENTICATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995318)); pub const PEER_E_CONNECTION_REFUSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995317)); pub const PEER_E_CLASSIFIER_TOO_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995071)); pub const PEER_E_TOO_MANY_IDENTITIES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995070)); pub const PEER_E_NO_KEY_ACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995069)); pub const PEER_E_GROUPS_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140995068)); pub const PEER_E_RECORD_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994815)); pub const PEER_E_DATABASE_ACCESSDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994814)); pub const PEER_E_DBINITIALIZATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994813)); pub const PEER_E_MAX_RECORD_SIZE_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994812)); pub const PEER_E_DATABASE_ALREADY_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994811)); pub const PEER_E_DATABASE_NOT_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994810)); pub const PEER_E_IDENTITY_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994559)); pub const PEER_E_EVENT_HANDLE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994303)); pub const PEER_E_INVALID_SEARCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994047)); pub const PEER_E_INVALID_ATTRIBUTES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140994046)); pub const PEER_E_INVITATION_NOT_TRUSTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140993791)); pub const PEER_E_CHAIN_TOO_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140993789)); pub const PEER_E_INVALID_TIME_PERIOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140993787)); pub const PEER_E_CIRCULAR_CHAIN_DETECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140993786)); pub const PEER_E_CERT_STORE_CORRUPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140993535)); pub const PEER_E_NO_CLOUD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140991487)); pub const PEER_E_CLOUD_NAME_AMBIGUOUS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140991483)); pub const PEER_E_INVALID_RECORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987376)); pub const PEER_E_NOT_AUTHORIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987360)); pub const PEER_E_PASSWORD_DOES_NOT_MEET_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987359)); pub const PEER_E_DEFERRED_VALIDATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987344)); pub const PEER_E_INVALID_GROUP_PROPERTIES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987328)); pub const PEER_E_INVALID_PEER_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987312)); pub const PEER_E_INVALID_CLASSIFIER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987296)); pub const PEER_E_INVALID_FRIENDLY_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987280)); pub const PEER_E_INVALID_ROLE_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987279)); pub const PEER_E_INVALID_CLASSIFIER_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987278)); pub const PEER_E_INVALID_RECORD_EXPIRATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987264)); pub const PEER_E_INVALID_CREDENTIAL_INFO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987263)); pub const PEER_E_INVALID_CREDENTIAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987262)); pub const PEER_E_INVALID_RECORD_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987261)); pub const PEER_E_UNSUPPORTED_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987248)); pub const PEER_E_GROUP_NOT_READY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987247)); pub const PEER_E_GROUP_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987246)); pub const PEER_E_INVALID_GROUP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987245)); pub const PEER_E_NO_MEMBERS_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987244)); pub const PEER_E_NO_MEMBER_CONNECTIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987243)); pub const PEER_E_UNABLE_TO_LISTEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987242)); pub const PEER_E_IDENTITY_DELETED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987232)); pub const PEER_E_SERVICE_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140987231)); pub const PEER_E_CONTACT_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140971007)); pub const PEER_S_GRAPH_DATA_CREATED = @import("zig.zig").typedConst(HRESULT, @as(i32, 6488065)); pub const PEER_S_NO_EVENT_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, 6488066)); pub const PEER_S_ALREADY_CONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, 6496256)); pub const PEER_S_SUBSCRIPTION_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, 6512640)); pub const PEER_S_NO_CONNECTIVITY = @import("zig.zig").typedConst(HRESULT, @as(i32, 6488069)); pub const PEER_S_ALREADY_A_MEMBER = @import("zig.zig").typedConst(HRESULT, @as(i32, 6488070)); pub const PEER_E_CANNOT_CONVERT_PEER_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140979199)); pub const PEER_E_INVALID_PEER_HOST_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140979198)); pub const PEER_E_NO_MORE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140979197)); pub const PEER_E_PNRP_DUPLICATE_PEER_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140979195)); pub const PEER_E_INVITE_CANCELLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966912)); pub const PEER_E_INVITE_RESPONSE_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966911)); pub const PEER_E_NOT_SIGNED_IN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966909)); pub const PEER_E_PRIVACY_DECLINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966908)); pub const PEER_E_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966907)); pub const PEER_E_INVALID_ADDRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966905)); pub const PEER_E_FW_EXCEPTION_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966904)); pub const PEER_E_FW_BLOCKED_BY_POLICY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966903)); pub const PEER_E_FW_BLOCKED_BY_SHIELDS_UP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966902)); pub const PEER_E_FW_DECLINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140966901)); pub const UI_E_CREATE_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731135)); pub const UI_E_SHUTDOWN_CALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731134)); pub const UI_E_ILLEGAL_REENTRANCY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731133)); pub const UI_E_OBJECT_SEALED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731132)); pub const UI_E_VALUE_NOT_SET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731131)); pub const UI_E_VALUE_NOT_DETERMINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731130)); pub const UI_E_INVALID_OUTPUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731129)); pub const UI_E_BOOLEAN_EXPECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731128)); pub const UI_E_DIFFERENT_OWNER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731127)); pub const UI_E_AMBIGUOUS_MATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731126)); pub const UI_E_FP_OVERFLOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731125)); pub const UI_E_WRONG_THREAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144731124)); pub const UI_E_STORYBOARD_ACTIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730879)); pub const UI_E_STORYBOARD_NOT_PLAYING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730878)); pub const UI_E_START_KEYFRAME_AFTER_END = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730877)); pub const UI_E_END_KEYFRAME_NOT_DETERMINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730876)); pub const UI_E_LOOPS_OVERLAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730875)); pub const UI_E_TRANSITION_ALREADY_USED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730874)); pub const UI_E_TRANSITION_NOT_IN_STORYBOARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730873)); pub const UI_E_TRANSITION_ECLIPSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730872)); pub const UI_E_TIME_BEFORE_LAST_UPDATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730871)); pub const UI_E_TIMER_CLIENT_ALREADY_CONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730870)); pub const UI_E_INVALID_DIMENSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730869)); pub const UI_E_PRIMITIVE_OUT_OF_BOUNDS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730868)); pub const UI_E_WINDOW_CLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144730623)); pub const E_BLUETOOTH_ATT_INVALID_HANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864511)); pub const E_BLUETOOTH_ATT_READ_NOT_PERMITTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864510)); pub const E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864509)); pub const E_BLUETOOTH_ATT_INVALID_PDU = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864508)); pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHENTICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864507)); pub const E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864506)); pub const E_BLUETOOTH_ATT_INVALID_OFFSET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864505)); pub const E_BLUETOOTH_ATT_INSUFFICIENT_AUTHORIZATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864504)); pub const E_BLUETOOTH_ATT_PREPARE_QUEUE_FULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864503)); pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864502)); pub const E_BLUETOOTH_ATT_ATTRIBUTE_NOT_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864501)); pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864500)); pub const E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864499)); pub const E_BLUETOOTH_ATT_UNLIKELY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864498)); pub const E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864497)); pub const E_BLUETOOTH_ATT_UNSUPPORTED_GROUP_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864496)); pub const E_BLUETOOTH_ATT_INSUFFICIENT_RESOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140864495)); pub const E_BLUETOOTH_ATT_UNKNOWN_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140860416)); pub const E_AUDIO_ENGINE_NODE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140798975)); pub const E_HDAUDIO_EMPTY_CONNECTION_LIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140798974)); pub const E_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140798973)); pub const E_HDAUDIO_NO_LOGICAL_DEVICES_CREATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140798972)); pub const E_HDAUDIO_NULL_LINKED_LIST_ENTRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140798971)); pub const STATEREPOSITORY_E_CONCURRENCY_LOCKING_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733439)); pub const STATEREPOSITORY_E_STATEMENT_INPROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733438)); pub const STATEREPOSITORY_E_CONFIGURATION_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733437)); pub const STATEREPOSITORY_E_UNKNOWN_SCHEMA_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733436)); pub const STATEREPOSITORY_ERROR_DICTIONARY_CORRUPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733435)); pub const STATEREPOSITORY_E_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733434)); pub const STATEREPOSITORY_E_BUSY_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733433)); pub const STATEREPOSITORY_E_BUSY_RECOVERY_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733432)); pub const STATEREPOSITORY_E_LOCKED_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733431)); pub const STATEREPOSITORY_E_LOCKED_SHAREDCACHE_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733430)); pub const STATEREPOSITORY_E_TRANSACTION_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733429)); pub const STATEREPOSITORY_E_BUSY_TIMEOUT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733428)); pub const STATEREPOSITORY_E_BUSY_RECOVERY_TIMEOUT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733427)); pub const STATEREPOSITORY_E_LOCKED_TIMEOUT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733426)); pub const STATEREPOSITORY_E_LOCKED_SHAREDCACHE_TIMEOUT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733425)); pub const STATEREPOSITORY_E_SERVICE_STOP_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733424)); pub const STATEREPOSTORY_E_NESTED_TRANSACTION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733423)); pub const STATEREPOSITORY_ERROR_CACHE_CORRUPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2140733422)); pub const STATEREPOSITORY_TRANSACTION_CALLER_ID_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, 6750227)); pub const STATEREPOSITORY_TRANSACTION_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, 6750228)); pub const ERROR_SPACES_POOL_WAS_DELETED = @import("zig.zig").typedConst(HRESULT, @as(i32, 15138817)); pub const ERROR_SPACES_FAULT_DOMAIN_TYPE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344831)); pub const ERROR_SPACES_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344830)); pub const ERROR_SPACES_RESILIENCY_TYPE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344829)); pub const ERROR_SPACES_DRIVE_SECTOR_SIZE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344828)); pub const ERROR_SPACES_DRIVE_REDUNDANCY_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344826)); pub const ERROR_SPACES_NUMBER_OF_DATA_COPIES_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344825)); pub const ERROR_SPACES_PARITY_LAYOUT_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344824)); pub const ERROR_SPACES_INTERLEAVE_LENGTH_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344823)); pub const ERROR_SPACES_NUMBER_OF_COLUMNS_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344822)); pub const ERROR_SPACES_NOT_ENOUGH_DRIVES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344821)); pub const ERROR_SPACES_EXTENDED_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344820)); pub const ERROR_SPACES_PROVISIONING_TYPE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344819)); pub const ERROR_SPACES_ALLOCATION_SIZE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344818)); pub const ERROR_SPACES_ENCLOSURE_AWARE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344817)); pub const ERROR_SPACES_WRITE_CACHE_SIZE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344816)); pub const ERROR_SPACES_NUMBER_OF_GROUPS_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344815)); pub const ERROR_SPACES_DRIVE_OPERATIONAL_STATE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344814)); pub const ERROR_SPACES_ENTRY_INCOMPLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344813)); pub const ERROR_SPACES_ENTRY_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2132344812)); pub const ERROR_VOLSNAP_BOOTFILE_NOT_VALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138963967)); pub const ERROR_VOLSNAP_ACTIVATION_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138963966)); pub const ERROR_TIERING_NOT_SUPPORTED_ON_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898431)); pub const ERROR_TIERING_VOLUME_DISMOUNT_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898430)); pub const ERROR_TIERING_STORAGE_TIER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898429)); pub const ERROR_TIERING_INVALID_FILE_ID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898428)); pub const ERROR_TIERING_WRONG_CLUSTER_NODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898427)); pub const ERROR_TIERING_ALREADY_PROCESSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898426)); pub const ERROR_TIERING_CANNOT_PIN_OBJECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898425)); pub const ERROR_TIERING_FILE_IS_NOT_PINNED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898424)); pub const ERROR_NOT_A_TIERED_VOLUME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898423)); pub const ERROR_ATTRIBUTE_NOT_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138898422)); pub const ERROR_SECCORE_INVALID_COMMAND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058537472)); pub const ERROR_NO_APPLICABLE_APP_LICENSES_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406399)); pub const ERROR_CLIP_LICENSE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406398)); pub const ERROR_CLIP_DEVICE_LICENSE_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406397)); pub const ERROR_CLIP_LICENSE_INVALID_SIGNATURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406396)); pub const ERROR_CLIP_KEYHOLDER_LICENSE_MISSING_OR_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406395)); pub const ERROR_CLIP_LICENSE_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406394)); pub const ERROR_CLIP_LICENSE_SIGNED_BY_UNKNOWN_SOURCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406393)); pub const ERROR_CLIP_LICENSE_NOT_SIGNED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406392)); pub const ERROR_CLIP_LICENSE_HARDWARE_ID_OUT_OF_TOLERANCE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406391)); pub const ERROR_CLIP_LICENSE_DEVICE_ID_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1058406390)); pub const DXGI_STATUS_OCCLUDED = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213121)); pub const DXGI_STATUS_CLIPPED = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213122)); pub const DXGI_STATUS_NO_REDIRECTION = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213124)); pub const DXGI_STATUS_NO_DESKTOP_ACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213125)); pub const DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213126)); pub const DXGI_STATUS_MODE_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213127)); pub const DXGI_STATUS_MODE_CHANGE_IN_PROGRESS = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213128)); pub const DXCORE_ERROR_EVENT_NOT_UNREGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2004877311)); pub const DXGI_STATUS_UNOCCLUDED = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213129)); pub const DXGI_STATUS_DDA_WAS_STILL_DRAWING = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213130)); pub const DXGI_STATUS_PRESENT_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, 142213167)); pub const DXGI_DDI_ERR_WASSTILLDRAWING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005204991)); pub const DXGI_DDI_ERR_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005204990)); pub const DXGI_DDI_ERR_NONEXCLUSIVE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005204989)); pub const D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005336063)); pub const D3D10_ERROR_FILE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005336062)); pub const D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005139455)); pub const D3D11_ERROR_FILE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005139454)); pub const D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005139453)); pub const D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005139452)); pub const D3D12_ERROR_ADAPTER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005008383)); pub const D3D12_ERROR_DRIVER_VERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2005008382)); pub const D2DERR_WRONG_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238911)); pub const D2DERR_NOT_INITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238910)); pub const D2DERR_UNSUPPORTED_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238909)); pub const D2DERR_SCANNER_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238908)); pub const D2DERR_SCREEN_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238907)); pub const D2DERR_DISPLAY_STATE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238906)); pub const D2DERR_ZERO_VECTOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238905)); pub const D2DERR_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238904)); pub const D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238903)); pub const D2DERR_INVALID_CALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238902)); pub const D2DERR_NO_HARDWARE_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238901)); pub const D2DERR_RECREATE_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238900)); pub const D2DERR_TOO_MANY_SHADER_ELEMENTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238899)); pub const D2DERR_SHADER_COMPILE_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238898)); pub const D2DERR_MAX_TEXTURE_SIZE_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238897)); pub const D2DERR_UNSUPPORTED_VERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238896)); pub const D2DERR_BAD_NUMBER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238895)); pub const D2DERR_WRONG_FACTORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238894)); pub const D2DERR_LAYER_ALREADY_IN_USE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238893)); pub const D2DERR_POP_CALL_DID_NOT_MATCH_PUSH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238892)); pub const D2DERR_WRONG_RESOURCE_DOMAIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238891)); pub const D2DERR_PUSH_POP_UNBALANCED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238890)); pub const D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238889)); pub const D2DERR_INCOMPATIBLE_BRUSH_TYPES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238888)); pub const D2DERR_WIN32_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238887)); pub const D2DERR_TARGET_NOT_GDI_COMPATIBLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238886)); pub const D2DERR_TEXT_EFFECT_IS_WRONG_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238885)); pub const D2DERR_TEXT_RENDERER_NOT_RELEASED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238884)); pub const D2DERR_EXCEEDS_MAX_BITMAP_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238883)); pub const D2DERR_INVALID_GRAPH_CONFIGURATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238882)); pub const D2DERR_INVALID_INTERNAL_GRAPH_CONFIGURATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238881)); pub const D2DERR_CYCLIC_GRAPH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238880)); pub const D2DERR_BITMAP_CANNOT_DRAW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238879)); pub const D2DERR_OUTSTANDING_BITMAP_REFERENCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238878)); pub const D2DERR_ORIGINAL_TARGET_NOT_BOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238877)); pub const D2DERR_INVALID_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238876)); pub const D2DERR_BITMAP_BOUND_AS_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238875)); pub const D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238874)); pub const D2DERR_INTERMEDIATE_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238873)); pub const D2DERR_EFFECT_IS_NOT_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238872)); pub const D2DERR_INVALID_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238871)); pub const D2DERR_NO_SUBPROPERTIES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238870)); pub const D2DERR_PRINT_JOB_CLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238869)); pub const D2DERR_PRINT_FORMAT_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238868)); pub const D2DERR_TOO_MANY_TRANSFORM_INPUTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238867)); pub const D2DERR_INVALID_GLYPH_IMAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003238866)); pub const DWRITE_E_FILEFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283968)); pub const DWRITE_E_UNEXPECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283967)); pub const DWRITE_E_NOFONT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283966)); pub const DWRITE_E_FILENOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283965)); pub const DWRITE_E_FILEACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283964)); pub const DWRITE_E_FONTCOLLECTIONOBSOLETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283963)); pub const DWRITE_E_ALREADYREGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283962)); pub const DWRITE_E_CACHEFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283961)); pub const DWRITE_E_CACHEVERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283960)); pub const DWRITE_E_UNSUPPORTEDOPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283959)); pub const DWRITE_E_TEXTRENDERERINCOMPATIBLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283958)); pub const DWRITE_E_FLOWDIRECTIONCONFLICTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283957)); pub const DWRITE_E_NOCOLOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003283956)); pub const WINCODEC_ERR_WRONGSTATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292412)); pub const WINCODEC_ERR_VALUEOUTOFRANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292411)); pub const WINCODEC_ERR_UNKNOWNIMAGEFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292409)); pub const WINCODEC_ERR_UNSUPPORTEDVERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292405)); pub const WINCODEC_ERR_NOTINITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292404)); pub const WINCODEC_ERR_ALREADYLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292403)); pub const WINCODEC_ERR_PROPERTYNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292352)); pub const WINCODEC_ERR_PROPERTYNOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292351)); pub const WINCODEC_ERR_PROPERTYSIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292350)); pub const WINCODEC_ERR_CODECPRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292349)); pub const WINCODEC_ERR_CODECNOTHUMBNAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292348)); pub const WINCODEC_ERR_PALETTEUNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292347)); pub const WINCODEC_ERR_CODECTOOMANYSCANLINES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292346)); pub const WINCODEC_ERR_INTERNALERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292344)); pub const WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292343)); pub const WINCODEC_ERR_COMPONENTNOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292336)); pub const WINCODEC_ERR_IMAGESIZEOUTOFRANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292335)); pub const WINCODEC_ERR_TOOMUCHMETADATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292334)); pub const WINCODEC_ERR_BADIMAGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292320)); pub const WINCODEC_ERR_BADHEADER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292319)); pub const WINCODEC_ERR_FRAMEMISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292318)); pub const WINCODEC_ERR_BADMETADATAHEADER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292317)); pub const WINCODEC_ERR_BADSTREAMDATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292304)); pub const WINCODEC_ERR_STREAMWRITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292303)); pub const WINCODEC_ERR_STREAMREAD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292302)); pub const WINCODEC_ERR_STREAMNOTAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292301)); pub const WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292288)); pub const WINCODEC_ERR_UNSUPPORTEDOPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292287)); pub const WINCODEC_ERR_INVALIDREGISTRATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292278)); pub const WINCODEC_ERR_COMPONENTINITIALIZEFAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292277)); pub const WINCODEC_ERR_INSUFFICIENTBUFFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292276)); pub const WINCODEC_ERR_DUPLICATEMETADATAPRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292275)); pub const WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292274)); pub const WINCODEC_ERR_UNEXPECTEDSIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292273)); pub const WINCODEC_ERR_INVALIDQUERYREQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292272)); pub const WINCODEC_ERR_UNEXPECTEDMETADATATYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292271)); pub const WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292270)); pub const WINCODEC_ERR_INVALIDQUERYCHARACTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292269)); pub const WINCODEC_ERR_WIN32ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292268)); pub const WINCODEC_ERR_INVALIDPROGRESSIVELEVEL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292267)); pub const WINCODEC_ERR_INVALIDJPEGSCANINDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003292266)); pub const MILERR_OBJECTBUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304447)); pub const MILERR_INSUFFICIENTBUFFER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304446)); pub const MILERR_WIN32ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304445)); pub const MILERR_SCANNER_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304444)); pub const MILERR_SCREENACCESSDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304443)); pub const MILERR_DISPLAYSTATEINVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304442)); pub const MILERR_NONINVERTIBLEMATRIX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304441)); pub const MILERR_ZEROVECTOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304440)); pub const MILERR_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304439)); pub const MILERR_BADNUMBER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304438)); pub const MILERR_INTERNALERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304320)); pub const MILERR_DISPLAYFORMATNOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304316)); pub const MILERR_INVALIDCALL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304315)); pub const MILERR_ALREADYLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304314)); pub const MILERR_NOTLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304313)); pub const MILERR_DEVICECANNOTRENDERTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304312)); pub const MILERR_GLYPHBITMAPMISSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304311)); pub const MILERR_MALFORMEDGLYPHCACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304310)); pub const MILERR_GENERIC_IGNORE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304309)); pub const MILERR_MALFORMED_GUIDELINE_DATA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304308)); pub const MILERR_NO_HARDWARE_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304307)); pub const MILERR_NEED_RECREATE_AND_PRESENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304306)); pub const MILERR_ALREADY_INITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304305)); pub const MILERR_MISMATCHED_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304304)); pub const MILERR_NO_REDIRECTION_SURFACE_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304303)); pub const MILERR_REMOTING_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304302)); pub const MILERR_QUEUED_PRESENT_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304301)); pub const MILERR_NOT_QUEUING_PRESENTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304300)); pub const MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304299)); pub const MILERR_TOOMANYSHADERELEMNTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304298)); pub const MILERR_MROW_READLOCK_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304297)); pub const MILERR_MROW_UPDATE_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304296)); pub const MILERR_SHADER_COMPILE_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304295)); pub const MILERR_MAX_TEXTURE_SIZE_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304294)); pub const MILERR_QPC_TIME_WENT_BACKWARD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304293)); pub const MILERR_DXGI_ENUMERATION_OUT_OF_SYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304291)); pub const MILERR_ADAPTER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304290)); pub const MILERR_COLORSPACE_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304289)); pub const MILERR_PREFILTER_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304288)); pub const MILERR_DISPLAYID_ACCESS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003304287)); pub const UCEERR_INVALIDPACKETHEADER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303424)); pub const UCEERR_UNKNOWNPACKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303423)); pub const UCEERR_ILLEGALPACKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303422)); pub const UCEERR_MALFORMEDPACKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303421)); pub const UCEERR_ILLEGALHANDLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303420)); pub const UCEERR_HANDLELOOKUPFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303419)); pub const UCEERR_RENDERTHREADFAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303418)); pub const UCEERR_CTXSTACKFRSTTARGETNULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303417)); pub const UCEERR_CONNECTIONIDLOOKUPFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303416)); pub const UCEERR_BLOCKSFULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303415)); pub const UCEERR_MEMORYFAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303414)); pub const UCEERR_PACKETRECORDOUTOFRANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303413)); pub const UCEERR_ILLEGALRECORDTYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303412)); pub const UCEERR_OUTOFHANDLES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303411)); pub const UCEERR_UNCHANGABLE_UPDATE_ATTEMPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303410)); pub const UCEERR_NO_MULTIPLE_WORKER_THREADS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303409)); pub const UCEERR_REMOTINGNOTSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303408)); pub const UCEERR_MISSINGENDCOMMAND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303407)); pub const UCEERR_MISSINGBEGINCOMMAND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303406)); pub const UCEERR_CHANNELSYNCTIMEDOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303405)); pub const UCEERR_CHANNELSYNCABANDONED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303404)); pub const UCEERR_UNSUPPORTEDTRANSPORTVERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303403)); pub const UCEERR_TRANSPORTUNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303402)); pub const UCEERR_FEEDBACK_UNSUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303401)); pub const UCEERR_COMMANDTRANSPORTDENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303400)); pub const UCEERR_GRAPHICSSTREAMUNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303399)); pub const UCEERR_GRAPHICSSTREAMALREADYOPEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303392)); pub const UCEERR_TRANSPORTDISCONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303391)); pub const UCEERR_TRANSPORTOVERLOADED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303390)); pub const UCEERR_PARTITION_ZOMBIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303389)); pub const MILAVERR_NOCLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303168)); pub const MILAVERR_NOMEDIATYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303167)); pub const MILAVERR_NOVIDEOMIXER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303166)); pub const MILAVERR_NOVIDEOPRESENTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303165)); pub const MILAVERR_NOREADYFRAMES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303164)); pub const MILAVERR_MODULENOTLOADED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303163)); pub const MILAVERR_WMPFACTORYNOTREGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303162)); pub const MILAVERR_INVALIDWMPVERSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303161)); pub const MILAVERR_INSUFFICIENTVIDEORESOURCES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303160)); pub const MILAVERR_VIDEOACCELERATIONNOTAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303159)); pub const MILAVERR_REQUESTEDTEXTURETOOBIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303158)); pub const MILAVERR_SEEKFAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303157)); pub const MILAVERR_UNEXPECTEDWMPFAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303156)); pub const MILAVERR_MEDIAPLAYERCLOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303155)); pub const MILAVERR_UNKNOWNHARDWAREERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003303154)); pub const MILEFFECTSERR_UNKNOWNPROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302898)); pub const MILEFFECTSERR_EFFECTNOTPARTOFGROUP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302897)); pub const MILEFFECTSERR_NOINPUTSOURCEATTACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302896)); pub const MILEFFECTSERR_CONNECTORNOTCONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302895)); pub const MILEFFECTSERR_CONNECTORNOTASSOCIATEDWITHEFFECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302894)); pub const MILEFFECTSERR_RESERVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302893)); pub const MILEFFECTSERR_CYCLEDETECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302892)); pub const MILEFFECTSERR_EFFECTINMORETHANONEGRAPH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302891)); pub const MILEFFECTSERR_EFFECTALREADYINAGRAPH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302890)); pub const MILEFFECTSERR_EFFECTHASNOCHILDREN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302889)); pub const MILEFFECTSERR_ALREADYATTACHEDTOLISTENER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302888)); pub const MILEFFECTSERR_NOTAFFINETRANSFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302887)); pub const MILEFFECTSERR_EMPTYBOUNDS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302886)); pub const MILEFFECTSERR_OUTPUTSIZETOOLARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302885)); pub const DWMERR_STATE_TRANSITION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302656)); pub const DWMERR_THEME_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302655)); pub const DWMERR_CATASTROPHIC_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302654)); pub const DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302400)); pub const DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302399)); pub const DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003302398)); pub const ONL_E_INVALID_AUTHENTICATION_TARGET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701823)); pub const ONL_E_ACCESS_DENIED_BY_TOU = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701822)); pub const ONL_E_INVALID_APPLICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701821)); pub const ONL_E_PASSWORD_UPDATE_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701820)); pub const ONL_E_ACCOUNT_UPDATE_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701819)); pub const ONL_E_FORCESIGNIN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701818)); pub const ONL_E_ACCOUNT_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701817)); pub const ONL_E_PARENTAL_CONSENT_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701816)); pub const ONL_E_EMAIL_VERIFICATION_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701815)); pub const ONL_E_ACCOUNT_SUSPENDED_COMPROIMISE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701814)); pub const ONL_E_ACCOUNT_SUSPENDED_ABUSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701813)); pub const ONL_E_ACTION_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701812)); pub const ONL_CONNECTION_COUNT_LIMIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701811)); pub const ONL_E_CONNECTED_ACCOUNT_CAN_NOT_SIGNOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701810)); pub const ONL_E_USER_AUTHENTICATION_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701809)); pub const ONL_E_REQUEST_THROTTLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2138701808)); pub const FA_E_MAX_PERSISTED_ITEMS_REACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927200)); pub const FA_E_HOMEGROUP_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927198)); pub const E_MONITOR_RESOLUTION_TOO_LOW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927152)); pub const E_ELEVATED_ACTIVATION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927151)); pub const E_UAC_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927150)); pub const E_FULL_ADMIN_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927149)); pub const E_APPLICATION_NOT_REGISTERED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927148)); pub const E_MULTIPLE_EXTENSIONS_FOR_APPLICATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927147)); pub const E_MULTIPLE_PACKAGES_FOR_FAMILY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927146)); pub const E_APPLICATION_MANAGER_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927145)); pub const S_STORE_LAUNCHED_FOR_REMEDIATION = @import("zig.zig").typedConst(HRESULT, @as(i32, 2556504)); pub const S_APPLICATION_ACTIVATION_ERROR_HANDLED_BY_DIALOG = @import("zig.zig").typedConst(HRESULT, @as(i32, 2556505)); pub const E_APPLICATION_ACTIVATION_TIMED_OUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927142)); pub const E_APPLICATION_ACTIVATION_EXEC_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927141)); pub const E_APPLICATION_TEMPORARY_LICENSE_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927140)); pub const E_APPLICATION_TRIAL_LICENSE_EXPIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927139)); pub const E_SKYDRIVE_ROOT_TARGET_FILE_SYSTEM_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927136)); pub const E_SKYDRIVE_ROOT_TARGET_OVERLAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927135)); pub const E_SKYDRIVE_ROOT_TARGET_CANNOT_INDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927134)); pub const E_SKYDRIVE_FILE_NOT_UPLOADED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927133)); pub const E_SKYDRIVE_UPDATE_AVAILABILITY_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927132)); pub const E_SKYDRIVE_ROOT_TARGET_VOLUME_ROOT_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2144927131)); pub const E_SYNCENGINE_FILE_SIZE_OVER_LIMIT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013089791)); pub const E_SYNCENGINE_FILE_SIZE_EXCEEDS_REMAINING_QUOTA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013089790)); pub const E_SYNCENGINE_UNSUPPORTED_FILE_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013089789)); pub const E_SYNCENGINE_FOLDER_ITEM_COUNT_LIMIT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013089788)); pub const E_SYNCENGINE_FILE_SYNC_PARTNER_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013089787)); pub const E_SYNCENGINE_SYNC_PAUSED_BY_SERVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013089786)); pub const E_SYNCENGINE_FILE_IDENTIFIER_UNKNOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013085694)); pub const E_SYNCENGINE_SERVICE_AUTHENTICATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013085693)); pub const E_SYNCENGINE_UNKNOWN_SERVICE_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013085692)); pub const E_SYNCENGINE_SERVICE_RETURNED_UNEXPECTED_SIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013085691)); pub const E_SYNCENGINE_REQUEST_BLOCKED_BY_SERVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013085690)); pub const E_SYNCENGINE_REQUEST_BLOCKED_DUE_TO_CLIENT_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013085689)); pub const E_SYNCENGINE_FOLDER_INACCESSIBLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081599)); pub const E_SYNCENGINE_UNSUPPORTED_FOLDER_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081598)); pub const E_SYNCENGINE_UNSUPPORTED_MARKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081597)); pub const E_SYNCENGINE_PATH_LENGTH_LIMIT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081596)); pub const E_SYNCENGINE_REMOTE_PATH_LENGTH_LIMIT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081595)); pub const E_SYNCENGINE_CLIENT_UPDATE_NEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081594)); pub const E_SYNCENGINE_PROXY_AUTHENTICATION_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081593)); pub const E_SYNCENGINE_STORAGE_SERVICE_PROVISIONING_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081592)); pub const E_SYNCENGINE_UNSUPPORTED_REPARSE_POINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081591)); pub const E_SYNCENGINE_STORAGE_SERVICE_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081590)); pub const E_SYNCENGINE_FOLDER_IN_REDIRECTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013081589)); pub const EAS_E_POLICY_NOT_MANAGED_BY_OS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913087)); pub const EAS_E_POLICY_COMPLIANT_WITH_ACTIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913086)); pub const EAS_E_REQUESTED_POLICY_NOT_ENFORCEABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913085)); pub const EAS_E_CURRENT_USER_HAS_BLANK_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913084)); pub const EAS_E_REQUESTED_POLICY_PASSWORD_EXPIRATION_INCOMPATIBLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913083)); pub const EAS_E_USER_CANNOT_CHANGE_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913082)); pub const EAS_E_ADMINS_HAVE_BLANK_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913081)); pub const EAS_E_ADMINS_CANNOT_CHANGE_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913080)); pub const EAS_E_LOCAL_CONTROLLED_USERS_CANNOT_CHANGE_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913079)); pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CONNECTED_ADMINS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913078)); pub const EAS_E_CONNECTED_ADMINS_NEED_TO_CHANGE_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913077)); pub const EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CURRENT_CONNECTED_USER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913076)); pub const EAS_E_CURRENT_CONNECTED_USER_NEED_TO_CHANGE_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2141913075)); pub const WEB_E_UNSUPPORTED_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484287)); pub const WEB_E_INVALID_XML = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484286)); pub const WEB_E_MISSING_REQUIRED_ELEMENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484285)); pub const WEB_E_MISSING_REQUIRED_ATTRIBUTE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484284)); pub const WEB_E_UNEXPECTED_CONTENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484283)); pub const WEB_E_RESOURCE_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484282)); pub const WEB_E_INVALID_JSON_STRING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484281)); pub const WEB_E_INVALID_JSON_NUMBER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484280)); pub const WEB_E_JSON_VALUE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089484279)); pub const HTTP_E_STATUS_UNEXPECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145845247)); pub const HTTP_E_STATUS_UNEXPECTED_REDIRECTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145845245)); pub const HTTP_E_STATUS_UNEXPECTED_CLIENT_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145845244)); pub const HTTP_E_STATUS_UNEXPECTED_SERVER_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145845243)); pub const HTTP_E_STATUS_AMBIGUOUS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844948)); pub const HTTP_E_STATUS_MOVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844947)); pub const HTTP_E_STATUS_REDIRECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844946)); pub const HTTP_E_STATUS_REDIRECT_METHOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844945)); pub const HTTP_E_STATUS_NOT_MODIFIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844944)); pub const HTTP_E_STATUS_USE_PROXY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844943)); pub const HTTP_E_STATUS_REDIRECT_KEEP_VERB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844941)); pub const HTTP_E_STATUS_BAD_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844848)); pub const HTTP_E_STATUS_DENIED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844847)); pub const HTTP_E_STATUS_PAYMENT_REQ = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844846)); pub const HTTP_E_STATUS_FORBIDDEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844845)); pub const HTTP_E_STATUS_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844844)); pub const HTTP_E_STATUS_BAD_METHOD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844843)); pub const HTTP_E_STATUS_NONE_ACCEPTABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844842)); pub const HTTP_E_STATUS_PROXY_AUTH_REQ = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844841)); pub const HTTP_E_STATUS_REQUEST_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844840)); pub const HTTP_E_STATUS_CONFLICT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844839)); pub const HTTP_E_STATUS_GONE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844838)); pub const HTTP_E_STATUS_LENGTH_REQUIRED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844837)); pub const HTTP_E_STATUS_PRECOND_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844836)); pub const HTTP_E_STATUS_REQUEST_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844835)); pub const HTTP_E_STATUS_URI_TOO_LONG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844834)); pub const HTTP_E_STATUS_UNSUPPORTED_MEDIA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844833)); pub const HTTP_E_STATUS_RANGE_NOT_SATISFIABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844832)); pub const HTTP_E_STATUS_EXPECTATION_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844831)); pub const HTTP_E_STATUS_SERVER_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844748)); pub const HTTP_E_STATUS_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844747)); pub const HTTP_E_STATUS_BAD_GATEWAY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844746)); pub const HTTP_E_STATUS_SERVICE_UNAVAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844745)); pub const HTTP_E_STATUS_GATEWAY_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844744)); pub const HTTP_E_STATUS_VERSION_NOT_SUP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2145844743)); pub const E_INVALID_PROTOCOL_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089418751)); pub const E_INVALID_PROTOCOL_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089418750)); pub const E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089418749)); pub const E_SUBPROTOCOL_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089418748)); pub const E_PROTOCOL_VERSION_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2089418747)); pub const INPUT_E_OUT_OF_ORDER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289344)); pub const INPUT_E_REENTRANCY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289343)); pub const INPUT_E_MULTIMODAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289342)); pub const INPUT_E_PACKET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289341)); pub const INPUT_E_FRAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289340)); pub const INPUT_E_HISTORY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289339)); pub const INPUT_E_DEVICE_INFO = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289338)); pub const INPUT_E_TRANSFORM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289337)); pub const INPUT_E_DEVICE_PROPERTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143289336)); pub const ERROR_DBG_CREATE_PROCESS_FAILURE_LOCKDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2135949311)); pub const ERROR_DBG_ATTACH_PROCESS_FAILURE_LOCKDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2135949310)); pub const ERROR_DBG_CONNECT_SERVER_FAILURE_LOCKDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2135949309)); pub const ERROR_DBG_START_SERVER_FAILURE_LOCKDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2135949308)); pub const ERROR_IO_PREEMPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1996423167)); pub const JSCRIPT_E_CANTEXECUTE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1996357631)); pub const WEP_E_NOT_PROVISIONED_ON_ALL_VOLUMES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200383)); pub const WEP_E_FIXED_DATA_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200382)); pub const WEP_E_HARDWARE_NOT_COMPLIANT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200381)); pub const WEP_E_LOCK_NOT_CONFIGURED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200380)); pub const WEP_E_PROTECTION_SUSPENDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200379)); pub const WEP_E_NO_LICENSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200378)); pub const WEP_E_OS_NOT_PROTECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200377)); pub const WEP_E_UNEXPECTED_FAIL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200376)); pub const WEP_E_BUFFER_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2013200375)); pub const ERROR_SVHDX_ERROR_STORED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067712512)); pub const ERROR_SVHDX_ERROR_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647232)); pub const ERROR_SVHDX_UNIT_ATTENTION_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647231)); pub const ERROR_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647230)); pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647229)); pub const ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647228)); pub const ERROR_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647227)); pub const ERROR_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647226)); pub const ERROR_SVHDX_RESERVATION_CONFLICT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647225)); pub const ERROR_SVHDX_WRONG_FILE_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647224)); pub const ERROR_SVHDX_VERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647223)); pub const ERROR_VHD_SHARED = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647222)); pub const ERROR_SVHDX_NO_INITIATOR = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647221)); pub const ERROR_VHDSET_BACKING_STORAGE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067647220)); pub const ERROR_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067646976)); pub const ERROR_SMB_BAD_CLUSTER_DIALECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -1067646975)); pub const WININET_E_OUT_OF_HANDLES = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012895)); pub const WININET_E_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012894)); pub const WININET_E_EXTENDED_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012893)); pub const WININET_E_INTERNAL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012892)); pub const WININET_E_INVALID_URL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012891)); pub const WININET_E_UNRECOGNIZED_SCHEME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012890)); pub const WININET_E_NAME_NOT_RESOLVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012889)); pub const WININET_E_PROTOCOL_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012888)); pub const WININET_E_INVALID_OPTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012887)); pub const WININET_E_BAD_OPTION_LENGTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012886)); pub const WININET_E_OPTION_NOT_SETTABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012885)); pub const WININET_E_SHUTDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012884)); pub const WININET_E_INCORRECT_USER_NAME = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012883)); pub const WININET_E_INCORRECT_PASSWORD = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012882)); pub const WININET_E_LOGIN_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012881)); pub const WININET_E_INVALID_OPERATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012880)); pub const WININET_E_OPERATION_CANCELLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012879)); pub const WININET_E_INCORRECT_HANDLE_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012878)); pub const WININET_E_INCORRECT_HANDLE_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012877)); pub const WININET_E_NOT_PROXY_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012876)); pub const WININET_E_REGISTRY_VALUE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012875)); pub const WININET_E_BAD_REGISTRY_PARAMETER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012874)); pub const WININET_E_NO_DIRECT_ACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012873)); pub const WININET_E_NO_CONTEXT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012872)); pub const WININET_E_NO_CALLBACK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012871)); pub const WININET_E_REQUEST_PENDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012870)); pub const WININET_E_INCORRECT_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012869)); pub const WININET_E_ITEM_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012868)); pub const WININET_E_CANNOT_CONNECT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012867)); pub const WININET_E_CONNECTION_ABORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012866)); pub const WININET_E_CONNECTION_RESET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012865)); pub const WININET_E_FORCE_RETRY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012864)); pub const WININET_E_INVALID_PROXY_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012863)); pub const WININET_E_NEED_UI = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012862)); pub const WININET_E_HANDLE_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012860)); pub const WININET_E_SEC_CERT_DATE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012859)); pub const WININET_E_SEC_CERT_CN_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012858)); pub const WININET_E_HTTP_TO_HTTPS_ON_REDIR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012857)); pub const WININET_E_HTTPS_TO_HTTP_ON_REDIR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012856)); pub const WININET_E_MIXED_SECURITY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012855)); pub const WININET_E_CHG_POST_IS_NON_SECURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012854)); pub const WININET_E_POST_IS_NON_SECURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012853)); pub const WININET_E_CLIENT_AUTH_CERT_NEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012852)); pub const WININET_E_INVALID_CA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012851)); pub const WININET_E_CLIENT_AUTH_NOT_SETUP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012850)); pub const WININET_E_ASYNC_THREAD_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012849)); pub const WININET_E_REDIRECT_SCHEME_CHANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012848)); pub const WININET_E_DIALOG_PENDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012847)); pub const WININET_E_RETRY_DIALOG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012846)); pub const WININET_E_NO_NEW_CONTAINERS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012845)); pub const WININET_E_HTTPS_HTTP_SUBMIT_REDIR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012844)); pub const WININET_E_SEC_CERT_ERRORS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012841)); pub const WININET_E_SEC_CERT_REV_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012839)); pub const WININET_E_HEADER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012746)); pub const WININET_E_DOWNLEVEL_SERVER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012745)); pub const WININET_E_INVALID_SERVER_RESPONSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012744)); pub const WININET_E_INVALID_HEADER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012743)); pub const WININET_E_INVALID_QUERY_REQUEST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012742)); pub const WININET_E_HEADER_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012741)); pub const WININET_E_REDIRECT_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012740)); pub const WININET_E_SECURITY_CHANNEL_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012739)); pub const WININET_E_UNABLE_TO_CACHE_FILE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012738)); pub const WININET_E_TCPIP_NOT_INSTALLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012737)); pub const WININET_E_DISCONNECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012733)); pub const WININET_E_SERVER_UNREACHABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012732)); pub const WININET_E_PROXY_SERVER_UNREACHABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012731)); pub const WININET_E_BAD_AUTO_PROXY_SCRIPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012730)); pub const WININET_E_UNABLE_TO_DOWNLOAD_SCRIPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012729)); pub const WININET_E_SEC_INVALID_CERT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012727)); pub const WININET_E_SEC_CERT_REVOKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012726)); pub const WININET_E_FAILED_DUETOSECURITYCHECK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012725)); pub const WININET_E_NOT_INITIALIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012724)); pub const WININET_E_LOGIN_FAILURE_DISPLAY_ENTITY_BODY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012722)); pub const WININET_E_DECODING_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012721)); pub const WININET_E_NOT_REDIRECTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012736)); pub const WININET_E_COOKIE_NEEDS_CONFIRMATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012735)); pub const WININET_E_COOKIE_DECLINED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012734)); pub const WININET_E_REDIRECT_NEEDS_CONFIRMATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2147012728)); pub const SQLITE_E_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574335)); pub const SQLITE_E_INTERNAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574334)); pub const SQLITE_E_PERM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574333)); pub const SQLITE_E_ABORT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574332)); pub const SQLITE_E_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574331)); pub const SQLITE_E_LOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574330)); pub const SQLITE_E_NOMEM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574329)); pub const SQLITE_E_READONLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574328)); pub const SQLITE_E_INTERRUPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574327)); pub const SQLITE_E_IOERR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574326)); pub const SQLITE_E_CORRUPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574325)); pub const SQLITE_E_NOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574324)); pub const SQLITE_E_FULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574323)); pub const SQLITE_E_CANTOPEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574322)); pub const SQLITE_E_PROTOCOL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574321)); pub const SQLITE_E_EMPTY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574320)); pub const SQLITE_E_SCHEMA = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574319)); pub const SQLITE_E_TOOBIG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574318)); pub const SQLITE_E_CONSTRAINT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574317)); pub const SQLITE_E_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574316)); pub const SQLITE_E_MISUSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574315)); pub const SQLITE_E_NOLFS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574314)); pub const SQLITE_E_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574313)); pub const SQLITE_E_FORMAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574312)); pub const SQLITE_E_RANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574311)); pub const SQLITE_E_NOTADB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574310)); pub const SQLITE_E_NOTICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574309)); pub const SQLITE_E_WARNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574308)); pub const SQLITE_E_ROW = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574236)); pub const SQLITE_E_DONE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574235)); pub const SQLITE_E_IOERR_READ = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574070)); pub const SQLITE_E_IOERR_SHORT_READ = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573814)); pub const SQLITE_E_IOERR_WRITE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573558)); pub const SQLITE_E_IOERR_FSYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573302)); pub const SQLITE_E_IOERR_DIR_FSYNC = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573046)); pub const SQLITE_E_IOERR_TRUNCATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572790)); pub const SQLITE_E_IOERR_FSTAT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572534)); pub const SQLITE_E_IOERR_UNLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572278)); pub const SQLITE_E_IOERR_RDLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572022)); pub const SQLITE_E_IOERR_DELETE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018571766)); pub const SQLITE_E_IOERR_BLOCKED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018571510)); pub const SQLITE_E_IOERR_NOMEM = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018571254)); pub const SQLITE_E_IOERR_ACCESS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018570998)); pub const SQLITE_E_IOERR_CHECKRESERVEDLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018570742)); pub const SQLITE_E_IOERR_LOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018570486)); pub const SQLITE_E_IOERR_CLOSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018570230)); pub const SQLITE_E_IOERR_DIR_CLOSE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018569974)); pub const SQLITE_E_IOERR_SHMOPEN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018569718)); pub const SQLITE_E_IOERR_SHMSIZE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018569462)); pub const SQLITE_E_IOERR_SHMLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018569206)); pub const SQLITE_E_IOERR_SHMMAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018568950)); pub const SQLITE_E_IOERR_SEEK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018568694)); pub const SQLITE_E_IOERR_DELETE_NOENT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018568438)); pub const SQLITE_E_IOERR_MMAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018568182)); pub const SQLITE_E_IOERR_GETTEMPPATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018567926)); pub const SQLITE_E_IOERR_CONVPATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018567670)); pub const SQLITE_E_IOERR_VNODE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018567678)); pub const SQLITE_E_IOERR_AUTH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018567677)); pub const SQLITE_E_LOCKED_SHAREDCACHE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574074)); pub const SQLITE_E_BUSY_RECOVERY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574075)); pub const SQLITE_E_BUSY_SNAPSHOT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573819)); pub const SQLITE_E_CANTOPEN_NOTEMPDIR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574066)); pub const SQLITE_E_CANTOPEN_ISDIR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573810)); pub const SQLITE_E_CANTOPEN_FULLPATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573554)); pub const SQLITE_E_CANTOPEN_CONVPATH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573298)); pub const SQLITE_E_CORRUPT_VTAB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574069)); pub const SQLITE_E_READONLY_RECOVERY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574072)); pub const SQLITE_E_READONLY_CANTLOCK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573816)); pub const SQLITE_E_READONLY_ROLLBACK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573560)); pub const SQLITE_E_READONLY_DBMOVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573304)); pub const SQLITE_E_ABORT_ROLLBACK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573820)); pub const SQLITE_E_CONSTRAINT_CHECK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574061)); pub const SQLITE_E_CONSTRAINT_COMMITHOOK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573805)); pub const SQLITE_E_CONSTRAINT_FOREIGNKEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573549)); pub const SQLITE_E_CONSTRAINT_FUNCTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573293)); pub const SQLITE_E_CONSTRAINT_NOTNULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573037)); pub const SQLITE_E_CONSTRAINT_PRIMARYKEY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572781)); pub const SQLITE_E_CONSTRAINT_TRIGGER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572525)); pub const SQLITE_E_CONSTRAINT_UNIQUE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572269)); pub const SQLITE_E_CONSTRAINT_VTAB = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018572013)); pub const SQLITE_E_CONSTRAINT_ROWID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018571757)); pub const SQLITE_E_NOTICE_RECOVER_WAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574053)); pub const SQLITE_E_NOTICE_RECOVER_ROLLBACK = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018573797)); pub const SQLITE_E_WARNING_AUTOINDEX = @import("zig.zig").typedConst(HRESULT, @as(i32, -2018574052)); pub const UTC_E_TOGGLE_TRACE_STARTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128447)); pub const UTC_E_ALTERNATIVE_TRACE_CANNOT_PREEMPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128446)); pub const UTC_E_AOT_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128445)); pub const UTC_E_SCRIPT_TYPE_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128444)); pub const UTC_E_SCENARIODEF_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128443)); pub const UTC_E_TRACEPROFILE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128442)); pub const UTC_E_FORWARDER_ALREADY_ENABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128441)); pub const UTC_E_FORWARDER_ALREADY_DISABLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128440)); pub const UTC_E_EVENTLOG_ENTRY_MALFORMED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128439)); pub const UTC_E_DIAGRULES_SCHEMAVERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128438)); pub const UTC_E_SCRIPT_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128437)); pub const UTC_E_INVALID_CUSTOM_FILTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128436)); pub const UTC_E_TRACE_NOT_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128435)); pub const UTC_E_REESCALATED_TOO_QUICKLY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128434)); pub const UTC_E_ESCALATION_ALREADY_RUNNING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128433)); pub const UTC_E_PERFTRACK_ALREADY_TRACING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128432)); pub const UTC_E_REACHED_MAX_ESCALATIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128431)); pub const UTC_E_FORWARDER_PRODUCER_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128430)); pub const UTC_E_INTENTIONAL_SCRIPT_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128429)); pub const UTC_E_SQM_INIT_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128428)); pub const UTC_E_NO_WER_LOGGER_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128427)); pub const UTC_E_TRACERS_DONT_EXIST = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128426)); pub const UTC_E_WINRT_INIT_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128425)); pub const UTC_E_SCENARIODEF_SCHEMAVERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128424)); pub const UTC_E_INVALID_FILTER = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128423)); pub const UTC_E_EXE_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128422)); pub const UTC_E_ESCALATION_NOT_AUTHORIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128421)); pub const UTC_E_SETUP_NOT_AUTHORIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128420)); pub const UTC_E_CHILD_PROCESS_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128419)); pub const UTC_E_COMMAND_LINE_NOT_AUTHORIZED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128418)); pub const UTC_E_CANNOT_LOAD_SCENARIO_EDITOR_XML = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128417)); pub const UTC_E_ESCALATION_TIMED_OUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128416)); pub const UTC_E_SETUP_TIMED_OUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128415)); pub const UTC_E_TRIGGER_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128414)); pub const UTC_E_TRIGGER_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128413)); pub const UTC_E_SIF_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128412)); pub const UTC_E_DELAY_TERMINATED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128411)); pub const UTC_E_DEVICE_TICKET_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128410)); pub const UTC_E_TRACE_BUFFER_LIMIT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128409)); pub const UTC_E_API_RESULT_UNAVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128408)); pub const UTC_E_RPC_TIMEOUT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128407)); pub const UTC_E_RPC_WAIT_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128406)); pub const UTC_E_API_BUSY = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128405)); pub const UTC_E_TRACE_MIN_DURATION_REQUIREMENT_NOT_MET = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128404)); pub const UTC_E_EXCLUSIVITY_NOT_AVAILABLE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128403)); pub const UTC_E_GETFILE_FILE_PATH_NOT_APPROVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128402)); pub const UTC_E_ESCALATION_DIRECTORY_ALREADY_EXISTS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128401)); pub const UTC_E_TIME_TRIGGER_ON_START_INVALID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128400)); pub const UTC_E_TIME_TRIGGER_ONLY_VALID_ON_SINGLE_TRANSITION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128399)); pub const UTC_E_TIME_TRIGGER_INVALID_TIME_RANGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128398)); pub const UTC_E_MULTIPLE_TIME_TRIGGER_ON_SINGLE_STATE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128397)); pub const UTC_E_BINARY_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128396)); pub const UTC_E_FAILED_TO_RESOLVE_CONTAINER_ID = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128394)); pub const UTC_E_UNABLE_TO_RESOLVE_SESSION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128393)); pub const UTC_E_THROTTLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128392)); pub const UTC_E_UNAPPROVED_SCRIPT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128391)); pub const UTC_E_SCRIPT_MISSING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128390)); pub const UTC_E_SCENARIO_THROTTLED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128389)); pub const UTC_E_API_NOT_SUPPORTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128388)); pub const UTC_E_GETFILE_EXTERNAL_PATH_NOT_APPROVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128387)); pub const UTC_E_TRY_GET_SCENARIO_TIMEOUT_EXCEEDED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128386)); pub const UTC_E_CERT_REV_FAILED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128385)); pub const UTC_E_FAILED_TO_START_NDISCAP = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128384)); pub const UTC_E_KERNELDUMP_LIMIT_REACHED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128383)); pub const UTC_E_MISSING_AGGREGATE_EVENT_TAG = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128382)); pub const UTC_E_INVALID_AGGREGATION_STRUCT = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128381)); pub const UTC_E_ACTION_NOT_SUPPORTED_IN_DESTINATION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128380)); pub const UTC_E_FILTER_MISSING_ATTRIBUTE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128379)); pub const UTC_E_FILTER_INVALID_TYPE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128378)); pub const UTC_E_FILTER_VARIABLE_NOT_FOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128377)); pub const UTC_E_FILTER_FUNCTION_RESTRICTED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128376)); pub const UTC_E_FILTER_VERSION_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128375)); pub const UTC_E_FILTER_INVALID_FUNCTION = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128368)); pub const UTC_E_FILTER_INVALID_FUNCTION_PARAMS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128367)); pub const UTC_E_FILTER_INVALID_COMMAND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128366)); pub const UTC_E_FILTER_ILLEGAL_EVAL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128365)); pub const UTC_E_TTTRACER_RETURNED_ERROR = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128364)); pub const UTC_E_AGENT_DIAGNOSTICS_TOO_LARGE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128363)); pub const UTC_E_FAILED_TO_RECEIVE_AGENT_DIAGNOSTICS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128362)); pub const UTC_E_SCENARIO_HAS_NO_ACTIONS = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128361)); pub const UTC_E_TTTRACER_STORAGE_FULL = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128360)); pub const UTC_E_INSUFFICIENT_SPACE_TO_START_TRACE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128359)); pub const UTC_E_ESCALATION_CANCELLED_AT_SHUTDOWN = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128358)); pub const UTC_E_GETFILEINFOACTION_FILE_NOT_APPROVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128357)); pub const UTC_E_SETREGKEYACTION_TYPE_NOT_APPROVED = @import("zig.zig").typedConst(HRESULT, @as(i32, -2017128356)); pub const WINML_ERR_INVALID_DEVICE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003828735)); pub const WINML_ERR_INVALID_BINDING = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003828734)); pub const WINML_ERR_VALUE_NOTFOUND = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003828733)); pub const WINML_ERR_SIZE_MISMATCH = @import("zig.zig").typedConst(HRESULT, @as(i32, -2003828732)); pub const ERROR_QUIC_HANDSHAKE_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143223808)); pub const ERROR_QUIC_VER_NEG_FAILURE = @import("zig.zig").typedConst(HRESULT, @as(i32, -2143223807)); //-------------------------------------------------------------------------------- // Section: Types (30) //-------------------------------------------------------------------------------- pub const NTSTATUS_FACILITY_CODE = enum(u32) { DEBUGGER = 1, RPC_RUNTIME = 2, RPC_STUBS = 3, IO_ERROR_CODE = 4, CODCLASS_ERROR_CODE = 6, NTWIN32 = 7, NTCERT = 8, NTSSPI = 9, TERMINAL_SERVER = 10, USB_ERROR_CODE = 16, HID_ERROR_CODE = 17, FIREWIRE_ERROR_CODE = 18, CLUSTER_ERROR_CODE = 19, ACPI_ERROR_CODE = 20, SXS_ERROR_CODE = 21, TRANSACTION = 25, COMMONLOG = 26, VIDEO = 27, FILTER_MANAGER = 28, MONITOR = 29, GRAPHICS_KERNEL = 30, DRIVER_FRAMEWORK = 32, FVE_ERROR_CODE = 33, FWP_ERROR_CODE = 34, NDIS_ERROR_CODE = 35, QUIC_ERROR_CODE = 36, TPM = 41, RTPM = 42, HYPERVISOR = 53, IPSEC = 54, VIRTUALIZATION = 55, VOLMGR = 56, BCD_ERROR_CODE = 57, WIN32K_NTUSER = 62, WIN32K_NTGDI = 63, RESUME_KEY_FILTER = 64, RDBSS = 65, BTH_ATT = 66, SECUREBOOT = 67, AUDIO_KERNEL = 68, VSM = 69, VOLSNAP = 80, SDBUS = 81, SHARED_VHDX = 92, SMB = 93, XVS = 94, INTERIX = 153, SPACES = 231, SECURITY_CORE = 232, SYSTEM_INTEGRITY = 233, LICENSING = 234, PLATFORM_MANIFEST = 235, APP_EXEC = 236, MAXIMUM_VALUE = 237, }; pub const FACILITY_DEBUGGER = NTSTATUS_FACILITY_CODE.DEBUGGER; pub const FACILITY_RPC_RUNTIME = NTSTATUS_FACILITY_CODE.RPC_RUNTIME; pub const FACILITY_RPC_STUBS = NTSTATUS_FACILITY_CODE.RPC_STUBS; pub const FACILITY_IO_ERROR_CODE = NTSTATUS_FACILITY_CODE.IO_ERROR_CODE; pub const FACILITY_CODCLASS_ERROR_CODE = NTSTATUS_FACILITY_CODE.CODCLASS_ERROR_CODE; pub const FACILITY_NTWIN32 = NTSTATUS_FACILITY_CODE.NTWIN32; pub const FACILITY_NTCERT = NTSTATUS_FACILITY_CODE.NTCERT; pub const FACILITY_NTSSPI = NTSTATUS_FACILITY_CODE.NTSSPI; pub const FACILITY_TERMINAL_SERVER = NTSTATUS_FACILITY_CODE.TERMINAL_SERVER; pub const FACILITY_USB_ERROR_CODE = NTSTATUS_FACILITY_CODE.USB_ERROR_CODE; pub const FACILITY_HID_ERROR_CODE = NTSTATUS_FACILITY_CODE.HID_ERROR_CODE; pub const FACILITY_FIREWIRE_ERROR_CODE = NTSTATUS_FACILITY_CODE.FIREWIRE_ERROR_CODE; pub const FACILITY_CLUSTER_ERROR_CODE = NTSTATUS_FACILITY_CODE.CLUSTER_ERROR_CODE; pub const FACILITY_ACPI_ERROR_CODE = NTSTATUS_FACILITY_CODE.ACPI_ERROR_CODE; pub const FACILITY_SXS_ERROR_CODE = NTSTATUS_FACILITY_CODE.SXS_ERROR_CODE; pub const FACILITY_TRANSACTION = NTSTATUS_FACILITY_CODE.TRANSACTION; pub const FACILITY_COMMONLOG = NTSTATUS_FACILITY_CODE.COMMONLOG; pub const FACILITY_VIDEO = NTSTATUS_FACILITY_CODE.VIDEO; pub const FACILITY_FILTER_MANAGER = NTSTATUS_FACILITY_CODE.FILTER_MANAGER; pub const FACILITY_MONITOR = NTSTATUS_FACILITY_CODE.MONITOR; pub const FACILITY_GRAPHICS_KERNEL = NTSTATUS_FACILITY_CODE.GRAPHICS_KERNEL; pub const FACILITY_DRIVER_FRAMEWORK = NTSTATUS_FACILITY_CODE.DRIVER_FRAMEWORK; pub const FACILITY_FVE_ERROR_CODE = NTSTATUS_FACILITY_CODE.FVE_ERROR_CODE; pub const FACILITY_FWP_ERROR_CODE = NTSTATUS_FACILITY_CODE.FWP_ERROR_CODE; pub const FACILITY_NDIS_ERROR_CODE = NTSTATUS_FACILITY_CODE.NDIS_ERROR_CODE; pub const FACILITY_QUIC_ERROR_CODE = NTSTATUS_FACILITY_CODE.QUIC_ERROR_CODE; pub const FACILITY_TPM = NTSTATUS_FACILITY_CODE.TPM; pub const FACILITY_RTPM = NTSTATUS_FACILITY_CODE.RTPM; pub const FACILITY_HYPERVISOR = NTSTATUS_FACILITY_CODE.HYPERVISOR; pub const FACILITY_IPSEC = NTSTATUS_FACILITY_CODE.IPSEC; pub const FACILITY_VIRTUALIZATION = NTSTATUS_FACILITY_CODE.VIRTUALIZATION; pub const FACILITY_VOLMGR = NTSTATUS_FACILITY_CODE.VOLMGR; pub const FACILITY_BCD_ERROR_CODE = NTSTATUS_FACILITY_CODE.BCD_ERROR_CODE; pub const FACILITY_WIN32K_NTUSER = NTSTATUS_FACILITY_CODE.WIN32K_NTUSER; pub const FACILITY_WIN32K_NTGDI = NTSTATUS_FACILITY_CODE.WIN32K_NTGDI; pub const FACILITY_RESUME_KEY_FILTER = NTSTATUS_FACILITY_CODE.RESUME_KEY_FILTER; pub const FACILITY_RDBSS = NTSTATUS_FACILITY_CODE.RDBSS; pub const FACILITY_BTH_ATT = NTSTATUS_FACILITY_CODE.BTH_ATT; pub const FACILITY_SECUREBOOT = NTSTATUS_FACILITY_CODE.SECUREBOOT; pub const FACILITY_AUDIO_KERNEL = NTSTATUS_FACILITY_CODE.AUDIO_KERNEL; pub const FACILITY_VSM = NTSTATUS_FACILITY_CODE.VSM; pub const FACILITY_VOLSNAP = NTSTATUS_FACILITY_CODE.VOLSNAP; pub const FACILITY_SDBUS = NTSTATUS_FACILITY_CODE.SDBUS; pub const FACILITY_SHARED_VHDX = NTSTATUS_FACILITY_CODE.SHARED_VHDX; pub const FACILITY_SMB = NTSTATUS_FACILITY_CODE.SMB; pub const FACILITY_XVS = NTSTATUS_FACILITY_CODE.XVS; pub const FACILITY_INTERIX = NTSTATUS_FACILITY_CODE.INTERIX; pub const FACILITY_SPACES = NTSTATUS_FACILITY_CODE.SPACES; pub const FACILITY_SECURITY_CORE = NTSTATUS_FACILITY_CODE.SECURITY_CORE; pub const FACILITY_SYSTEM_INTEGRITY = NTSTATUS_FACILITY_CODE.SYSTEM_INTEGRITY; pub const FACILITY_LICENSING = NTSTATUS_FACILITY_CODE.LICENSING; pub const FACILITY_PLATFORM_MANIFEST = NTSTATUS_FACILITY_CODE.PLATFORM_MANIFEST; pub const FACILITY_APP_EXEC = NTSTATUS_FACILITY_CODE.APP_EXEC; pub const FACILITY_MAXIMUM_VALUE = NTSTATUS_FACILITY_CODE.MAXIMUM_VALUE; pub const DUPLICATE_HANDLE_OPTIONS = enum(u32) { CLOSE_SOURCE = 1, SAME_ACCESS = 2, _, pub fn initFlags(o: struct { CLOSE_SOURCE: u1 = 0, SAME_ACCESS: u1 = 0, }) DUPLICATE_HANDLE_OPTIONS { return @intToEnum(DUPLICATE_HANDLE_OPTIONS, (if (o.CLOSE_SOURCE == 1) @enumToInt(DUPLICATE_HANDLE_OPTIONS.CLOSE_SOURCE) else 0) | (if (o.SAME_ACCESS == 1) @enumToInt(DUPLICATE_HANDLE_OPTIONS.SAME_ACCESS) else 0) ); } }; pub const DUPLICATE_CLOSE_SOURCE = DUPLICATE_HANDLE_OPTIONS.CLOSE_SOURCE; pub const DUPLICATE_SAME_ACCESS = DUPLICATE_HANDLE_OPTIONS.SAME_ACCESS; pub const HANDLE_FLAGS = enum(u32) { INHERIT = 1, PROTECT_FROM_CLOSE = 2, _, pub fn initFlags(o: struct { INHERIT: u1 = 0, PROTECT_FROM_CLOSE: u1 = 0, }) HANDLE_FLAGS { return @intToEnum(HANDLE_FLAGS, (if (o.INHERIT == 1) @enumToInt(HANDLE_FLAGS.INHERIT) else 0) | (if (o.PROTECT_FROM_CLOSE == 1) @enumToInt(HANDLE_FLAGS.PROTECT_FROM_CLOSE) else 0) ); } }; pub const HANDLE_FLAG_INHERIT = HANDLE_FLAGS.INHERIT; pub const HANDLE_FLAG_PROTECT_FROM_CLOSE = HANDLE_FLAGS.PROTECT_FROM_CLOSE; pub const BOOL = i32; pub const BOOLEAN = u8; // TODO: this type has a FreeFunc 'SysFreeString', what can Zig do with this information? pub const BSTR = *u16; // TODO: this type has a FreeFunc 'CloseHandle', what can Zig do with this information? pub const HANDLE = @import("std").os.windows.HANDLE; // TODO: this type has a FreeFunc 'FreeLibrary', what can Zig do with this information? pub const HINSTANCE = *opaque{}; pub const HRESULT = i32; pub const HWND = *opaque{}; pub const LPARAM = isize; pub const LRESULT = isize; pub const LSTATUS = i32; pub const NTSTATUS = i32; pub const PSID = *opaque{}; pub const PSTR = [*:0]u8; pub const PWSTR = [*:0]u16; pub const WPARAM = usize; pub const SYSTEMTIME = extern struct { wYear: u16, wMonth: u16, wDayOfWeek: u16, wDay: u16, wHour: u16, wMinute: u16, wSecond: u16, wMilliseconds: u16, }; pub const FARPROC = fn( ) callconv(@import("std").os.windows.WINAPI) isize; pub const NEARPROC = fn( ) callconv(@import("std").os.windows.WINAPI) isize; pub const PROC = fn( ) callconv(@import("std").os.windows.WINAPI) isize; pub const FILETIME = extern struct { dwLowDateTime: u32, dwHighDateTime: u32, }; pub const RECT = extern struct { left: i32, top: i32, right: i32, bottom: i32, }; pub const RECTL = extern struct { left: i32, top: i32, right: i32, bottom: i32, }; pub const POINT = extern struct { x: i32, y: i32, }; pub const POINTL = extern struct { x: i32, y: i32, }; pub const SIZE = extern struct { cx: i32, cy: i32, }; pub const POINTS = extern struct { x: i16, y: i16, }; pub const APP_LOCAL_DEVICE_ID = extern struct { value: [32]u8, }; //-------------------------------------------------------------------------------- // Section: Functions (16) //-------------------------------------------------------------------------------- pub extern "OLEAUT32" fn SysAllocString( psz: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) ?BSTR; pub extern "OLEAUT32" fn SysReAllocString( pbstr: ?*?BSTR, psz: ?[*:0]const u16, ) callconv(@import("std").os.windows.WINAPI) i32; pub extern "OLEAUT32" fn SysAllocStringLen( strIn: ?[*:0]const u16, ui: u32, ) callconv(@import("std").os.windows.WINAPI) ?BSTR; pub extern "OLEAUT32" fn SysReAllocStringLen( pbstr: ?*?BSTR, psz: ?[*:0]const u16, len: u32, ) callconv(@import("std").os.windows.WINAPI) i32; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLEAUT32" fn SysAddRefString( bstrString: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) HRESULT; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "OLEAUT32" fn SysReleaseString( bstrString: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLEAUT32" fn SysFreeString( bstrString: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) void; pub extern "OLEAUT32" fn SysStringLen( pbstr: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLEAUT32" fn SysStringByteLen( bstr: ?BSTR, ) callconv(@import("std").os.windows.WINAPI) u32; pub extern "OLEAUT32" fn SysAllocStringByteLen( psz: ?[*:0]const u8, len: u32, ) callconv(@import("std").os.windows.WINAPI) ?BSTR; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn CloseHandle( hObject: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn DuplicateHandle( hSourceProcessHandle: ?HANDLE, hSourceHandle: ?HANDLE, hTargetProcessHandle: ?HANDLE, lpTargetHandle: ?*?HANDLE, dwDesiredAccess: u32, bInheritHandle: BOOL, dwOptions: DUPLICATE_HANDLE_OPTIONS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows10.0.10240' pub extern "api-ms-win-core-handle-l1-1-0" fn CompareObjectHandles( hFirstObjectHandle: ?HANDLE, hSecondObjectHandle: ?HANDLE, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn GetHandleInformation( hObject: ?HANDLE, lpdwFlags: ?*u32, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.0' pub extern "KERNEL32" fn SetHandleInformation( hObject: ?HANDLE, dwMask: u32, dwFlags: HANDLE_FLAGS, ) callconv(@import("std").os.windows.WINAPI) BOOL; // TODO: this type is limited to platform 'windows5.1.2600' pub extern "ntdll" fn RtlNtStatusToDosError( Status: NTSTATUS, ) callconv(@import("std").os.windows.WINAPI) u32; //-------------------------------------------------------------------------------- // 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 { // The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476 if (@hasDecl(@This(), "FARPROC")) { _ = FARPROC; } if (@hasDecl(@This(), "NEARPROC")) { _ = NEARPROC; } if (@hasDecl(@This(), "PROC")) { _ = PROC; } @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/foundation.zig
const std = @import("std"); const clap = @import("clap"); const config = @import("config.zig"); const gui = @import("gui.zig"); const VTE = @import("vte"); const c = VTE.c; const allocator = std.heap.page_allocator; const fmt = std.fmt; const mem = std.mem; const os = std.os; const process = std.process; const stderr = std.io.getStdErr().writer(); const stdout = std.io.getStdOut().writer(); const version = @import("version.zig").version; const params = [_]clap.Param(clap.Help){ clap.parseParam("-h, --help Display this help and exit.") catch unreachable, clap.parseParam("-e, --command <COMMAND> Command and args to execute.") catch unreachable, clap.parseParam("-t, --title <TITLE> Defines the window title.") catch unreachable, clap.parseParam("-w, --working-directory <DIR> Set the terminal's working directory.") catch unreachable, }; pub fn main() !void { var diag = clap.Diagnostic{}; var args = clap.parse(clap.Help, &params, .{ .diagnostic = &diag }) catch |err| { diag.report(stderr, err) catch {}; return err; }; defer args.deinit(); if (args.flag("--help")) { try stdout.print("Zterm version {s}\nCopyright 2021 by <NAME>\n\n", .{version}); usage(0); } const cmd = if (args.option("--command")) |e| e else os.getenvZ("SHELL") orelse "/bin/sh"; const title = if (args.option("--title")) |t| t else "Zterm"; const directory = if (args.option("--working-directory")) |d| d else os.getenv("PWD") orelse os.getenv("HOME") orelse "/"; var buf: [os.system.HOST_NAME_MAX]u8 = undefined; const hostname = try os.gethostname(&buf); var opts = gui.Opts{ .command = try fmt.allocPrintZ(allocator, "{s}", .{cmd}), .title = try fmt.allocPrintZ(allocator, "{s}", .{title}), .directory = try fmt.allocPrintZ(allocator, "{s}", .{directory}), .hostname = try fmt.allocPrintZ(allocator, "{s}", .{hostname}), .config_dir = if (config.getConfigDir(allocator)) |d| d else return, }; defer allocator.free(opts.command); defer allocator.free(opts.title); defer allocator.free(opts.directory); defer allocator.free(opts.hostname); const app = c.gtk_application_new("org.hitchhiker-linux.zterm", c.G_APPLICATION_FLAGS_NONE) orelse @panic("null app :("); defer c.g_object_unref(app); _ = c.g_signal_connect_data( app, "activate", @ptrCast(c.GCallback, gui.activate), // Here we cast a pointer to "opts" to a gpointer and pass it into the // GCallback created above @ptrCast(c.gpointer, &opts), null, c.G_CONNECT_AFTER, ); _ = c.g_application_run(@ptrCast(*c.GApplication, app), 0, null); } fn usage(status: u8) void { stderr.print("Usage: {s} ", .{"zterm"}) catch {}; clap.usage(stderr, &params) catch {}; stderr.print("\nFlags: \n", .{}) catch {}; clap.help(stderr, &params) catch {}; process.exit(status); }
src/main.zig
const builtin = @import("builtin"); const std = @import("std"); const Random = std.rand.Random; const zeroCaseFn = switch (builtin.zig_backend) { .stage1 => fn (*Random, f64) f64, else => *const fn (*Random, f64) f64, }; const pdfFn = switch (builtin.zig_backend) { .stage1 => fn (f64) f64, else => *const fn (f64) f64, }; const ZigTable = struct { r: f64, x: [257]f64, f: [257]f64, pdf: pdfFn, is_symmetric: bool, zero_case: zeroCaseFn, }; fn ZigTableGen(comptime is_symmetric: bool, comptime r: f64, comptime v: f64, comptime f: fn (f64) f64, comptime f_inv: fn (f64) f64, comptime zero_case: fn (*Random, f64) f64) ZigTable { var tables: ZigTable = undefined; tables.is_symmetric = is_symmetric; tables.r = r; tables.pdf = f; tables.zero_case = zero_case; tables.x[0] = v / f(r); tables.x[1] = r; for (tables.x[2..256]) |*entry, i| { const last = tables.x[2 + i - 1]; entry.* = f_inv(v / last + f(last)); } tables.x[256] = 0; for (tables.f[0..]) |*entry, i| { entry.* = f(tables.x[i]); } return tables; } const norm_r = 3.6541528853610088; const norm_v = 0.00492867323399; fn norm_f(x: f64) f64 { return @exp(-x * x / 2.0); } fn norm_f_inv(y: f64) f64 { return @sqrt(-2.0 * @log(y)); } fn norm_zero_case(random: *Random, u: f64) f64 { _ = random; _ = u; return 0.0; } const NormalDist = blk: { @setEvalBranchQuota(30000); break :blk ZigTableGen(true, norm_r, norm_v, norm_f, norm_f_inv, norm_zero_case); }; test "bug 920 fixed" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO const NormalDist1 = blk: { break :blk ZigTableGen(true, norm_r, norm_v, norm_f, norm_f_inv, norm_zero_case); }; for (NormalDist1.f) |_, i| { // Here we use `expectApproxEqAbs` instead of `expectEqual` to account for the small // differences in math functions of different libcs. For example, if the compiler // links against glibc, but the target is musl libc, then these values might be // slightly different. // Arguably, this is a bug in the compiler because comptime should emulate the target, // including rounding errors in libc math functions. However that behavior is not // what this particular test is intended to cover. try std.testing.expectApproxEqAbs(NormalDist1.f[i], NormalDist.f[i], @sqrt(std.math.floatEps(f64))); } }
test/behavior/bugs/920.zig
const std = @import("std"); const Allocator = std.mem.Allocator; pub const Lexer = @import("Lexer.zig"); pub const Parser = @import("Parser.zig"); pub const Cst = @import("Cst.zig"); // pub const Span = struct { // offset_or_index: u32, // index if len_or_tag is tag // len_or_tag: u16, // tag if u16 max // // 16 bits free // }; // 4 bytes pub const SpanData = struct { start: u32, end: u32, // pub fn valid(self: @This()) bool { // return self.start <= self.end; // } }; // 3 bytes // store in a MultiArrayList pub const Token = struct { kind: Kind, preceding_whitespace_len: u16 = 0, pub const Kind = enum(u8) { // missing, brkt_paren_open, // ( brkt_paren_close, // ) brkt_brace_open, // { brkt_brace_close, // } brkt_square_open, // [ brkt_square_close, // ] punct_colon, // : punct_dblColon, // :: punct_semiColon, // ; punct_comma, // , punct_eq, // = punct_plus, // + punct_minus, // - punct_star, // * punct_slash, // / ident, float, int_dec, int_hex, int_oct, int_bin, string_open, string_literal, string_close, esc_quote_single, // \' esc_quote_double, // \" esc_ascii_newline, // \n esc_ascii_carriageReturn, // \r esc_ascii_tab, // \t esc_ascii_backslash, // \\ esc_ascii_null, // \0 esc_ascii_escape, // \e // esc_ascii_charactercode, // \xnn // esc_unicode, // \u{7FFF} kw_fn, kw_let, kw_use, EOF, }; }; pub const TokenKind = Token.Kind; /// Describes a single location in a file as a line and column pub const Location = struct { line: usize, column: usize, pub fn get(str: []const u8, offset: usize) @This() { var line: usize = 0; var column: usize = 0; for (str) |ch, i| { switch (ch) { '\n' => { line += 1; column = 0; }, else => column += 1, } if (offset == i) break; } return .{ .line = line + 1, .column = column + 1 }; } }; /// Describes Span as two `Location`s pub const LocationSpan = struct { start: Location, end: Location, pub fn get(str: []const u8, span: SpanData) @This() { return .{ .start = Location.get(str, span.start), .end = Location.get(str, span.end), }; } };
fexc/src/parse/!mod.zig
const std = @import("std"); const Allocator = std.mem.Allocator; const ArrayList = std.ArrayList; const StringHashMap = std.StringHashMap; const SysInfoWMI = @import("../../../../core/wmi.zig").SysInfoWMI; const VariantElem = SysInfoWMI.VariantElem; const util = @import("../../../../core/util.zig"); const _WMI = @import("win32").system.wmi; const COM = @import("win32").system.com; const OLE = @import("win32").system.ole; const Foundation = @import("win32").foundation; pub const HardwareManager = extern struct { /// An instance of [`SysInfoWMI`](https://github.com/iabtw/SysInfo-Zig/blob/main/lib/core/wmi.zig), used for /// querying system information (including hardware) /// on Windows. pub const WMI: SysInfoWMI = .{}; /// The default heap allocator used for /// tasks where the user doesn't necessarily /// have to provide their own allocator. /// /// __Rarely used.__ var gpa = std.heap.GeneralPurposeAllocator(.{}){}; /// Used internally to append multiple key-value /// pairs to an existing hashmap. /// Keep note that they're appended by means of index, /// meaning, the order in the `keys` slice should reflect /// its value pair order in the `vals` slice. /// /// The `keys` and `vals` slices must have the same amount of items. /// /// `T` - The type for this `StringHashMap`. /// `map` - The `StringHashMap` to append the keys/values to. /// `keys` - The keys to append to the hashmap. /// `vals` - The values to append to the hashmap. /// /// **Returns**: A status code indicating whether or not the operation /// was successful. `1` means error, `0` means OK. pub fn appendKeysToMap( self: @This(), comptime T: anytype, map: *StringHashMap(T), keys: [][]const u8, vals: [][]const u8, ) u8 { // Discarding reference to `self` so // the compiler won't complain. _ = self; // Why would we attempt to do something that's broken for this logic? if (keys.len != vals.len or keys.len == 0) return 1; var i: usize = 0; while (i < keys.len) : (i += 1) map.put(keys[i], vals[i]) catch return 1; return 0; } /// Used internally to only obtain the provided /// set of keys, and return a new, filtered hashmap. /// /// `keys` - A `StringHashMap` of the key-value pairs /// to look for and "replace". Fallbacks to the key /// if the value is `null`. /// `list` - A `StringHashMap` of the actual data. /// `allocator` - The allocator instance used to allocate the /// hashmap to heap. /// /// **Returns**: An `ArrayList` of `StringHashMap(VariantElem)`; or `null` /// if something goes wrong. /// /// **NOTE**: if you do use this, you must free the /// newly provided `ArrayList` value from heap after you're /// done using it! The library doesn't, and can't, do this automatically. pub fn getKeys( self: @This(), keys: StringHashMap([]const u8), list: StringHashMap(VariantElem), allocator: *Allocator, ) StringHashMap(VariantElem) { // Discarding reference to `self` so // the compiler won't complain. _ = self; var map = StringHashMap(VariantElem).init(allocator); var itr = list.iterator(); while (itr.next()) |entry| { var keysItr = keys.iterator(); while (keysItr.next()) |keyEntry| if (std.mem.eql(u8, entry.key_ptr.*, keyEntry.key_ptr.*)) map.put(keyEntry.value_ptr.*, entry.value_ptr.*) catch continue; } return map; } /// Obtains information about the current system's /// CPU(s) in use. /// /// `allocator` - The allocator instance used to allocate the `ArrayList` /// and hashmap to heap. /// /// **WARNING**: Haven't tested yet on dual processor setups... /// /// **Returns**: An `ArrayList` of `StringHashMap`, where each instance of /// the hash map is a unique WMI/CIM object's key-value pairs. /// Or `null` if something goes wrong. /// /// **NOTE**: You MUST free the provided value after you're done using it! /// The library doesn't, and can't, do this automatically. pub fn getCPUInfo( self: @This(), allocator: *Allocator, ) ?ArrayList(StringHashMap(VariantElem)) { // Discarding reference to `self` so // the compiler won't complain. _ = self; const pEnumerator = WMI.query("SELECT * FROM Win32_Processor", null, null) orelse return null; const list = WMI.getItems(pEnumerator, null, allocator); // Something definitely went wrong. if (list.items.len == 0) return null; defer list.deinit(); var array = ArrayList(StringHashMap(VariantElem)).init(allocator); var keyMap = StringHashMap([]const u8).init(&gpa.allocator); defer keyMap.deinit(); var i: usize = 0; while (i < list.items.len) : (i += 1) { var keys = [_][]const u8{ "Manufacturer", "Name", "NumberOfCores", "NumberOfLogicalProcessors" }; var vals = [_][]const u8{ "Manufacturer", "Model", "Cores", "Threads" }; if (self.appendKeysToMap( []const u8, &keyMap, keys[0..], vals[0..], ) != 0) continue; array.append(self.getKeys(keyMap, list.items[i], allocator)) catch continue; } return array; } /// Obtains information about the current system's /// CPU(s) in use. /// /// `allocator` - The allocator instance used to allocate /// the `ArrayList` and hashmap to heap. /// /// **WARNING**: Haven't tested yet on dual processor setups... /// /// **Returns**: An `ArrayList` of `StringHashMap`, where each instance of /// the hash map is a unique WMI/CIM object's key-value pairs. /// Or `null` if something goes wrong. /// /// **NOTE**: You MUST free the provided value after you're done using it! /// The library doesn't, and can't, do this automatically. pub fn getGPUInfo( self: @This(), allocator: *Allocator, ) ?ArrayList(StringHashMap(VariantElem)) { // Discarding reference to `self` so // the compiler won't complain. _ = self; const pEnumerator = WMI.query("SELECT * FROM Win32_VideoController", null, null) orelse return null; const list = WMI.getItems(pEnumerator, null, allocator); // Something definitely went wrong. if (list.items.len == 0) return null; defer list.deinit(); var array = ArrayList(StringHashMap(VariantElem)).init(allocator); var keyMap = StringHashMap([]const u8).init(&gpa.allocator); defer keyMap.deinit(); var i: usize = 0; while (i < list.items.len) : (i += 1) { var keys = [_][]const u8{ "Manufacturer", "Name", "PNPDeviceID" }; var vals = [_][]const u8{ "Manufacturer", "Model", "PNPDeviceID" }; if (self.appendKeysToMap( []const u8, &keyMap, keys[0..], vals[0..], ) != 0) continue; array.append(self.getKeys(keyMap, list.items[i], allocator)) catch continue; } // TODO: Obtain the ACPI/PCI path of GPU devices. // Currently broken due to faulty logic with SafeArray // element access. // i = 0; // while (i < array.items.len) : (i += 1) { // var itr = array.items[i].iterator(); // while (itr.next()) |entry| { // if (std.mem.eql(u8, entry.key_ptr.*, "PNPDeviceID")) { // var str = std.fmt.allocPrint(&gpa.allocator, "SELECT * FROM Win32_PnPEntity WHERE PNPDeviceID = '{s}'", .{entry.value_ptr.*.String.?}) catch break; // // Replaces regular slashes with // str = std.mem.replaceOwned(u8, &gpa.allocator, str, "\\", "\\\\") catch break; // defer gpa.allocator.free(str); // const pEnum = WMI.query( // str, // null, // null, // ); // const myItems = WMI.getItems(pEnum.?, null, &gpa.allocator); // if (myItems.items.len == 0) { // std.debug.print("Failed to obtain properties of Win32_PnPEntity enumerator. Returned status code: 1\n", .{}); // break; // } // defer myItems.deinit(); // var j: usize = 0; // while (j < myItems.items.len) : (j += 1) { // var iter = myItems.items[j].iterator(); // while (iter.next()) |entry_val| { // switch (entry_val.value_ptr.*) { // .String => |str_val| { // if (std.mem.eql(u8, entry_val.key_ptr.*, "__PATH")) { // var path = WMI.utf8ToBSTR(str_val.?) catch continue; // var obj = WMI.getObjectInst(path.?); // if (obj == null) { // std.debug.print("Failed on obj\n", .{}); // continue; // } // var methodName = WMI.utf8ToBSTR("GetDeviceProperties") catch continue; // var pInInst = WMI.getMethod(obj, methodName.?); // var executed = WMI.execMethod(path.?, methodName.?, pInInst); // var data = WMI.getItem(null, executed, "deviceProperties", &gpa.allocator) catch continue; // var lUpper: i32 = 0; // var lLower: i32 = 0; // var propName: ?*c_void = null; // var propVal: COM.VARIANT = undefined; // if (OLE.SafeArrayGetUBound(data.?.AnyArray, 1, &lUpper) != 0) // continue; // if (OLE.SafeArrayGetLBound(data.?.AnyArray, 1, &lLower) != 0) // continue; // var l: i32 = lLower; // while (l < lUpper) : (l += 1) { // var t: ?*i32 = null; // // Breaks here \/ !! // if (OLE.SafeArrayGetElement(data.?.AnyArray.?, &l, &propName) != 0) continue; // var bstr: *Foundation.BSTR = @ptrCast( // *Foundation.BSTR, // @alignCast(@alignOf(Foundation.BSTR), propName.?), // ); // const slice = std.mem.sliceTo( // @ptrCast([*:0]u16, bstr), // 0, // ); // if (executed.?.*.IWbemClassObject_Get( // slice, // 0, // &propVal, // t, // t, // ) != 0) continue; // defer _ = OLE.VariantClear(&propVal); // if (std.unicode.utf16leToUtf8Alloc(&gpa.allocator, slice)) |propName_utf8| { // if (WMI.getElementVariant(propVal, &gpa.allocator) catch null) |val| // // map.put(propName_utf8, val) catch continue; // std.debug.print("__KEY: {any} | __VAL: {any}\n", .{ propName_utf8, val }); // } else |_| continue; // } // } // }, // else => |other_val| { // _ = other_val; // continue; // }, // } // } // } // } // } // } return array; } };
lib/managers/hardware/OS/windows/windows.zig